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_PROCSEGMENT_H__
23 #define __GLIBTOP_PROCSEGMENT_H__
24 
25 #include <glibtop.h>
26 #include <glibtop/global.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GLIBTOP_PROC_SEGMENT_TEXT_RSS		0
31 #define GLIBTOP_PROC_SEGMENT_SHLIB_RSS		1
32 #define GLIBTOP_PROC_SEGMENT_DATA_RSS		2
33 #define GLIBTOP_PROC_SEGMENT_STACK_RSS		3
34 #define GLIBTOP_PROC_SEGMENT_DIRTY_SIZE		4
35 #define GLIBTOP_PROC_SEGMENT_START_CODE		5
36 #define GLIBTOP_PROC_SEGMENT_END_CODE		6
37 #define GLIBTOP_PROC_SEGMENT_START_STACK	7
38 
39 #define GLIBTOP_MAX_PROC_SEGMENT		8
40 
41 typedef struct _glibtop_proc_segment	glibtop_proc_segment;
42 
43 /* Segment stuff */
44 
45 struct _glibtop_proc_segment
46 {
47 	guint64	flags;
48 	guint64 text_rss;	/* text resident set size */
49 	guint64 shlib_rss;	/* shared-lib resident set size */
50 	guint64 data_rss;	/* data resident set size */
51 	guint64 stack_rss;	/* stack resident set size */
52 	guint64 dirty_size;	/* size of dirty pages */
53 	guint64 start_code;
54 				/* address of beginning of code segment */
55 	guint64 end_code;	/* address of end of code segment */
56 	guint64 start_stack;	/* address of the bottom of stack segment */
57 };
58 
59 void glibtop_get_proc_segment(glibtop_proc_segment *buf, pid_t pid);
60 
61 #if GLIBTOP_SUID_PROC_SEGMENT
62 #define glibtop_get_proc_segment_r	glibtop_get_proc_segment_p
63 #else
64 #define glibtop_get_proc_segment_r	glibtop_get_proc_segment_s
65 #endif
66 
67 void glibtop_get_proc_segment_l (glibtop *server, glibtop_proc_segment *buf, pid_t pid);
68 
69 #if GLIBTOP_SUID_PROC_SEGMENT
70 void _glibtop_init_proc_segment_p (glibtop *server);
71 void glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf, pid_t pid);
72 #else
73 void _glibtop_init_proc_segment_s (glibtop *server);
74 void glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf, pid_t pid);
75 #endif
76 
77 
78 G_END_DECLS
79 
80 #endif
81