Debian Codegraph @

madrisan-nagios-plugins-linux/nagios-plugins-linux/include/processes.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 /* processes.h -- get informations about running processes
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef _PROCESSES_H_
18 #define _PROCESSES_H_
19
20 #include <sys/resource.h>
21 #include <sys/types.h>
22
23 #define NBPROCS_NONE 0x00
24 #define NBPROCS_VERBOSE 0x01
25 #define NBPROCS_THREADS 0x02
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 struct procs_list_node;
33
34 /* Return name corresponding to 'uid', or NULL on error */
35 char *uid_to_username (uid_t uid);
36
37 /* Return the list of the users with running processes */
38 struct procs_list_node *procs_list_getall (unsigned int flags);
39
40 /* Access to procs generated lists */
41 char *procs_list_node_get_username (struct procs_list_node *node);
42 long procs_list_node_get_nbr (struct procs_list_node *node);
43
44 #ifdef RLIMIT_NPROC
45 unsigned long procs_list_node_get_rlimit_nproc_soft (struct procs_list_node
46 *node);
47 unsigned long procs_list_node_get_rlimit_nproc_hard (struct procs_list_node
48 *node);
49 #endif
50 struct procs_list_node * procs_list_node_get_next (struct procs_list_node
51 *node);
52 long procs_list_node_get_total_procs_nbr (struct procs_list_node *list);
53
54 #define proc_list_node_foreach(list_entry, list) \
55 for (list_entry = procs_list_node_get_next (list); \
56 list_entry != procs_list_node_get_next(list_entry); \
57 list_entry = procs_list_node_get_next(list_entry))
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif /* _PROCESSES_H_ */