source: mainline/uspace/lib/posix/unistd.h@ 3f466c33

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3f466c33 was 244d6fd, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 14 years ago

Add sigaddset(), getlogin() and getlogin_r() functions.

  • Property mode set to 100644
File size: 4.1 KB
Line 
1/*
2 * Copyright (c) 2011 Jiri Zarevucky
3 * Copyright (c) 2011 Petr Koupy
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup libposix
31 * @{
32 */
33/** @file
34 */
35
36#ifndef POSIX_UNISTD_H_
37#define POSIX_UNISTD_H_
38
39#include "libc/unistd.h"
40#include "sys/types.h"
41
42/* Process Termination */
43#define _exit exit
44
45/* Option Arguments */
46extern char *optarg;
47extern int optind, opterr, optopt;
48extern int getopt(int, char * const [], const char *);
49
50/* Environment */
51extern char **posix_environ;
52
53extern char *posix_getlogin(void);
54extern int posix_getlogin_r(char *name, size_t namesize);
55
56/* Identifying Terminals */
57extern int posix_isatty(int fd);
58
59/* Query Memory Parameters */
60extern int posix_getpagesize(void);
61
62/* Process Identification */
63extern posix_pid_t posix_getpid(void);
64extern posix_uid_t posix_getuid(void);
65extern posix_gid_t posix_getgid(void);
66
67/* Standard Streams */
68#undef STDIN_FILENO
69#define STDIN_FILENO (fileno(stdin))
70#undef STDOUT_FILENO
71#define STDOUT_FILENO (fileno(stdout))
72#undef STDERR_FILENO
73#define STDERR_FILENO (fileno(stderr))
74
75/* File Accessibility */
76#undef F_OK
77#undef X_OK
78#undef W_OK
79#undef R_OK
80#define F_OK 0 /* Test for existence. */
81#define X_OK 1 /* Test for execute permission. */
82#define W_OK 2 /* Test for write permission. */
83#define R_OK 4 /* Test for read permission. */
84extern int posix_access(const char *path, int amode);
85
86/* System Parameters */
87enum {
88 _SC_PHYS_PAGES,
89 _SC_AVPHYS_PAGES,
90 _SC_PAGESIZE,
91 _SC_CLK_TCK
92};
93extern long posix_sysconf(int name);
94
95/* Path Configuration Parameters */
96enum {
97 _PC_2_SYMLINKS,
98 _PC_ALLOC_SIZE_MIN,
99 _PC_ASYNC_IO,
100 _PC_CHOWN_RESTRICTED,
101 _PC_FILESIZEBITS,
102 _PC_LINK_MAX,
103 _PC_MAX_CANON,
104 _PC_MAX_INPUT,
105 _PC_NAME_MAX,
106 _PC_NO_TRUNC,
107 _PC_PATH_MAX,
108 _PC_PIPE_BUF,
109 _PC_PRIO_IO,
110 _PC_REC_INCR_XFER_SIZE,
111 _PC_REC_MIN_XFER_SIZE,
112 _PC_REC_XFER_ALIGN,
113 _PC_SYMLINK_MAX,
114 _PC_SYNC_IO,
115 _PC_VDISABLE
116};
117extern long posix_pathconf(const char *path, int name);
118
119/* Creating a Process */
120extern posix_pid_t posix_fork(void);
121
122/* Executing a File */
123extern int posix_execv(const char *path, char *const argv[]);
124extern int posix_execvp(const char *file, char *const argv[]);
125
126/* Creating a Pipe */
127extern int posix_pipe(int fildes[2]);
128
129#ifndef LIBPOSIX_INTERNAL
130 #define environ posix_environ
131 #define getlogin posix_getlogin
132 #define getlogin_r posix_getlogin_r
133
134 #define isatty posix_isatty
135
136 #undef getpagesize
137 #define getpagesize posix_getpagesize
138
139 #define getpid posix_getpid
140 #define getuid posix_getuid
141 #define getgid posix_getgid
142
143 #define access posix_access
144
145 #define sysconf posix_sysconf
146
147 #define pathconf posix_pathconf
148
149 #define fork posix_fork
150
151 #define execv posix_execv
152 #define execvp posix_execvp
153
154 #define pipe posix_pipe
155#endif
156
157#endif /* POSIX_UNISTD_H_ */
158
159/** @}
160 */
Note: See TracBrowser for help on using the repository browser.