source: mainline/uspace/lib/posix/unistd.h@ 7d0b76d

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 7d0b76d was b4d6252, checked in by Petr Koupy <petr.koupy@…>, 15 years ago

Various minor changes to header files.
Added stdint.h header.
Added offsetof macro definition.

  • Property mode set to 100644
File size: 2.9 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/* Environmental Variables */
51extern char **posix_environ;
52
53/* Identifying Terminals */
54extern int posix_isatty(int fd);
55
56/* Process Identification */
57#define getpid task_get_id
58extern posix_uid_t posix_getuid(void);
59extern posix_gid_t posix_getgid(void);
60
61/* Standard Streams */
62#undef STDIN_FILENO
63#define STDIN_FILENO (fileno(stdin))
64#undef STDOUT_FILENO
65#define STDOUT_FILENO (fileno(stdout))
66#undef STDERR_FILENO
67#define STDERR_FILENO (fileno(stderr))
68
69/* File Accessibility */
70#undef F_OK
71#undef X_OK
72#undef W_OK
73#undef R_OK
74#define F_OK 0 /* Test for existence. */
75#define X_OK 1 /* Test for execute permission. */
76#define W_OK 2 /* Test for write permission. */
77#define R_OK 4 /* Test for read permission. */
78extern int posix_access(const char *path, int amode);
79
80/* System Parameters */
81enum {
82 _SC_PHYS_PAGES,
83 _SC_AVPHYS_PAGES,
84 _SC_PAGESIZE,
85 _SC_CLK_TCK
86};
87extern long posix_sysconf(int name);
88
89#ifndef LIBPOSIX_INTERNAL
90 #define environ posix_environ
91
92 #define isatty posix_isatty
93
94 #define getuid posix_getuid
95 #define getgid posix_getgid
96
97 #define access posix_access
98
99 #define sysconf posix_sysconf
100#endif
101
102#endif /* POSIX_UNISTD_H_ */
103
104/** @}
105 */
Note: See TracBrowser for help on using the repository browser.