488877d8b55d07b6664036eba5e22bc267473315
[platform/core/system/tlm.git] / src / common / tlm-utils.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * This file is part of tlm (Tiny Login Manager)
5  *
6  * Copyright (C) 2013 Intel Corporation.
7  *
8  * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com>
9  *          Jussi Laako <jussi.laako@linux.intel.com>
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24  * 02110-1301 USA
25  */
26
27 #ifndef _TLM_UTILS_H
28 #define _TLM_UTILS_H
29
30 #include <sys/types.h>
31 #include <glib.h>
32
33 G_BEGIN_DECLS
34
35 void
36 g_clear_string (gchar **);
37
38 const gchar *
39 tlm_user_get_name (uid_t user_id);
40
41 uid_t
42 tlm_user_get_uid (const gchar *username);
43
44 gid_t
45 tlm_user_get_gid (const gchar *username);
46
47 const gchar *
48 tlm_user_get_home_dir (const gchar *username);
49
50 const gchar *
51 tlm_user_get_shell (const gchar *username);
52
53 gboolean
54 tlm_utils_delete_dir (const gchar *dir);
55
56 void
57 tlm_utils_log_utmp_entry (const gchar *username);
58
59 gchar **
60 tlm_utils_split_command_line (const gchar *command);
61
62 GList *
63 tlm_utils_split_command_lines (const GList const *commands_list);
64
65 typedef void (*WatchCb) (const gchar *found_item, gboolean is_final, GError *error, gpointer userdata);
66
67 guint
68 tlm_utils_watch_for_files (const gchar **watch_list, WatchCb cb, gpointer userdata);
69
70 G_END_DECLS
71
72 #endif /* _TLM_UTILS_H */