Debian Codegraph @

share/libc/utmpx.h

raw
1 /**************************************************************************/
2 /* */
3 /* This file is part of Frama-C. */
4 /* */
5 /* Copyright (C) 2007-2022 */
6 /* CEA (Commissariat à l'énergie atomique et aux énergies */
7 /* alternatives) */
8 /* */
9 /* you can redistribute it and/or modify it under the terms of the GNU */
10 /* Lesser General Public License as published by the Free Software */
11 /* Foundation, version 2.1. */
12 /* */
13 /* It is distributed in the hope that it will be useful, */
14 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
16 /* GNU Lesser General Public License for more details. */
17 /* */
18 /* See the GNU Lesser General Public License version 2.1 */
19 /* for more details (enclosed in the file licenses/LGPLv2.1). */
20 /* */
21 /**************************************************************************/
22
23 #ifndef __FC_UTMPX
24 #define __FC_UTMPX
25 #include "features.h"
26 __PUSH_FC_STDLIB
27
28 #include "__fc_define_pid_t.h"
29 #include "stdint.h"
30 #include "sys/time.h"
31
32 __BEGIN_DECLS
33
34 // The sizes of arrays and values for the constants below are based on those
35 // of the glibc, declared in the order given by POSIX.1-2008.
36
37 struct utmpx {
38 char ut_user[32];
39 char ut_id[4];
40 char ut_line[32];
41 char ut_host[256]; // not POSIX, but allowed by it, and present in glibc
42 pid_t ut_pid;
43 short ut_type;
44 struct timeval ut_tv;
45 int32_t ut_addr_v6[4]; // not POSIX, but allowed by it
46 char __glibc_reserved[20]; // not POSIX, but allowed by it
47 };
48
49 #define EMPTY 0
50 #define BOOT_TIME 2
51 #define OLD_TIME 4
52 #define NEW_TIME 3
53 #define USER_PROCESS 7
54 #define INIT_PROCESS 5
55 #define LOGIN_PROCESS 6
56 #define DEAD_PROCESS 8
57
58 extern void endutxent(void);
59 extern struct utmpx *getutxent(void);
60 extern struct utmpx *getutxid(const struct utmpx *);
61 extern struct utmpx *getutxline(const struct utmpx *);
62 extern struct utmpx *pututxline(const struct utmpx *);
63 extern void setutxent(void);
64
65 __END_DECLS
66 __POP_FC_STDLIB
67 #endif