1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 
5 #ifndef _ENVIRO_H
6 #define _ENVIRO_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <stdio.h>
13 
14 /* definition for sysconf */
15 #define _POSIX_JOB_CONTROL         1
16 #define _POSIX_SAVED_IDS           1
17 #define _POSIX_VERSION             2016L
18 #define _POSIX_ASYNCHRONOUS_IO     1
19 #define _POSIX_FSYNC               1
20 #define _POSIX_MAPPED_FILES        0
21 #define _POSIX_MEMLOCK             0
22 #define _POSIX_MEMLOCK_RANGE       0
23 #define _POSIX_MEMORY_PROTECTION   0
24 #define _POSIX_MESSAGE_PASSING     1
25 #define _POSIX_PRIORITIZED_IO      1
26 #define _POSIX_PRIORITY_SCHEDULING 1
27 #define _POSIX_REALTIME_SIGNALS    0
28 #define _POSIX_SEMAPHORES          1
29 #define _POSIX_SYNCHRONIZED_IO     0
30 #define _POSIX_BARRIERS            0
31 #define _POSIX_READER_WRITER_LOCKS 0
32 #define _POSIX_SPIN_LOCKS          0
33 
34 #define _POSIX_THREADS                    1
35 #define _POSIX_THREAD_ATTR_STACKADDR      1
36 #define _POSIX_THREAD_ATTR_STACKSIZE      1
37 #define _POSIX_THREAD_PRIORITY_SCHEDULING 1
38 #define _POSIX_THREAD_PRIO_INHERIT        1
39 #define _POSIX_THREAD_PRIO_PROTECT        1
40 #define _POSIX_THREAD_PROCESS_SHARED      1
41 #define _POSIX_THREAD_SAFE_FUNCTIONS      0
42 
43 #define _POSIX_SPAWN          0
44 #define _POSIX_TIMEOUTS       0
45 #define _POSIX_CPUTIME        1
46 #define _POSIX_THREAD_CPUTIME 1
47 #define _POSIX_ADVISORY_INFO  0
48 
49 /* definition for confstr */
50 #define _CS_GNU_LIBC_VERSION       1
51 #define _CS_GNU_LIBPTHREAD_VERSION 2
52 
53 #define _POSIX_GNU_LIBC_VERSION       "newlib 7.3"
54 #define _POSIX_GNU_LIBPTHREAD_VERSION "IEEE Std 1003.1, 2016 Edition"
55 
56 /* definition for uname */
57 #define _UTSNAME_SYSNAME_LENGTH  32
58 #define _UTSNAME_NODENAME_LENGTH 32
59 #define _UTSNAME_RELEASE_LENGTH  32
60 #define _UTSNAME_VERSION_LENGTH  32
61 #define _UTSNAME_MACHINE_LENGTH  32
62 
63 struct utsname {
64     char sysname[_UTSNAME_SYSNAME_LENGTH];   /* name of this implementation of the operating system */
65     char nodename[_UTSNAME_NODENAME_LENGTH]; /* name of this node within the communications network to
66                                                 which this node is attached, if any */
67     char release[_UTSNAME_RELEASE_LENGTH];   /* current release level of this implementation */
68     char version[_UTSNAME_VERSION_LENGTH];   /* current version level of this release */
69     char machine[_UTSNAME_MACHINE_LENGTH];   /* name of the hardware type on which the system is running */
70 };
71 
72 /* definition for environment variable */
73 typedef struct pthread_environ {
74     char *envname;
75     char *envval;
76 
77     struct pthread_environ *next;
78 } pthread_environ_t;
79 
80 int   setenv(const char *envname, const char *envval, int overwrite);
81 char *getenv(const char *name);
82 int   unsetenv(const char *name);
83 int   putenv(char *string);
84 int   clearenv (void);
85 
86 int    uname(struct utsname *name);
87 long   sysconf(int name);
88 size_t confstr(int name, char *buf, size_t len);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* _ENVIRO_H */
95