1 /* Copyright (C) 1998-99 Martin Baulig
2    This file is part of LibGTop 1.0.
3 
4    Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
5 
6    LibGTop is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License,
9    or (at your option) any later version.
10 
11    LibGTop is distributed in the hope that it will be useful, but WITHOUT
12    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14    for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with LibGTop; see the file COPYING. If not, write to the
18    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19    Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef __GLIBTOP_PROCUID_H__
23 #define __GLIBTOP_PROCUID_H__
24 
25 #include <glibtop.h>
26 #include <glibtop/global.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GLIBTOP_PROC_UID_UID		0
31 #define GLIBTOP_PROC_UID_EUID		1
32 #define GLIBTOP_PROC_UID_GID		2
33 #define GLIBTOP_PROC_UID_EGID		3
34 #define GLIBTOP_PROC_UID_SUID		4
35 #define GLIBTOP_PROC_UID_SGID		5
36 #define GLIBTOP_PROC_UID_FSUID		6
37 #define GLIBTOP_PROC_UID_FSGID		7
38 #define GLIBTOP_PROC_UID_PID		8
39 #define GLIBTOP_PROC_UID_PPID		9
40 #define GLIBTOP_PROC_UID_PGRP		10
41 #define GLIBTOP_PROC_UID_SESSION	11
42 #define GLIBTOP_PROC_UID_TTY		12
43 #define GLIBTOP_PROC_UID_TPGID		13
44 #define GLIBTOP_PROC_UID_PRIORITY	14
45 #define GLIBTOP_PROC_UID_NICE		15
46 #define GLIBTOP_PROC_UID_NGROUPS    16
47 #define GLIBTOP_PROC_UID_GROUPS     17
48 
49 #define GLIBTOP_MAX_PROC_UID		18
50 
51 typedef struct _glibtop_proc_uid	glibtop_proc_uid;
52 
53 #define GLIBTOP_MAX_GROUPS          64
54 
55 /* User, Group, Terminal and session */
56 
57 struct _glibtop_proc_uid
58 {
59 	guint64 flags;
60 	gint32 uid;		/* user id */
61 	gint32 euid;		/* effective user id */
62 	gint32 gid;		/* group id */
63 	gint32 egid;		/* effective group id */
64 	gint32 suid;       /* set user id */
65 	gint32 sgid;       /* set group id */
66 	gint32 fsuid;      /* ??? user id */
67 	gint32 fsgid;      /* ??? group id */
68 	gint32 pid;		/* process id */
69 	gint32 ppid;		/* pid of parent process */
70 	gint32 pgrp;		/* process group id */
71 	gint32 session;	/* session id */
72 	gint32 tty;		/* full device number of controlling terminal */
73 	gint32 tpgid;		/* terminal process group id */
74 	gint32 priority;	/* kernel scheduling priority */
75 	gint32 nice;		/* standard unix nice level of process */
76 	gint32 ngroups;
77 	gint32 groups [GLIBTOP_MAX_GROUPS];
78 
79 };
80 
81 void glibtop_get_proc_uid(glibtop_proc_uid *buf, pid_t pid);
82 
83 #if GLIBTOP_SUID_PROC_UID
84 #define glibtop_get_proc_uid_r		glibtop_get_proc_uid_p
85 #else
86 #define glibtop_get_proc_uid_r		glibtop_get_proc_uid_s
87 #endif
88 
89 void glibtop_get_proc_uid_l (glibtop *server, glibtop_proc_uid *buf, pid_t pid);
90 
91 #if GLIBTOP_SUID_PROC_UID
92 void _glibtop_init_proc_uid_p (glibtop *server);
93 void glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, pid_t pid);
94 #else
95 void _glibtop_init_proc_uid_s (glibtop *server);
96 void glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, pid_t pid);
97 #endif
98 
99 
100 G_END_DECLS
101 
102 #endif
103