source: mainline/uspace/lib/posix/unistd.h@ f1fae414

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

getpagesize() provided as a function so it is properly detected by Autoconf-generated scripts.
Added minor symbol dependencies into unistd.h.

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[a16210b5]1/*
2 * Copyright (c) 2011 Jiri Zarevucky
[4f4b4e7]3 * Copyright (c) 2011 Petr Koupy
[a16210b5]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 */
[4f4b4e7]29
30/** @addtogroup libposix
31 * @{
32 */
33/** @file
34 */
35
[a16210b5]36#ifndef POSIX_UNISTD_H_
37#define POSIX_UNISTD_H_
38
39#include "libc/unistd.h"
[59f799b]40#include "sys/types.h"
[a16210b5]41
[4f4b4e7]42/* Process Termination */
43#define _exit exit
[a16210b5]44
[4f4b4e7]45/* Option Arguments */
[a16210b5]46extern char *optarg;
47extern int optind, opterr, optopt;
48extern int getopt(int, char * const [], const char *);
49
[b4d6252]50/* Environmental Variables */
51extern char **posix_environ;
52
[4f4b4e7]53/* Identifying Terminals */
54extern int posix_isatty(int fd);
[a16210b5]55
[72ec8cc]56/* Query Memory Parameters */
57extern int posix_getpagesize(void);
58
[4f4b4e7]59/* Process Identification */
[a16210b5]60#define getpid task_get_id
[59f799b]61extern posix_uid_t posix_getuid(void);
62extern posix_gid_t posix_getgid(void);
[a16210b5]63
[4f4b4e7]64/* Standard Streams */
65#undef STDIN_FILENO
[a16210b5]66#define STDIN_FILENO (fileno(stdin))
[4f4b4e7]67#undef STDOUT_FILENO
[a16210b5]68#define STDOUT_FILENO (fileno(stdout))
[4f4b4e7]69#undef STDERR_FILENO
[a16210b5]70#define STDERR_FILENO (fileno(stderr))
71
[b08ef1fd]72/* File Accessibility */
73#undef F_OK
74#undef X_OK
75#undef W_OK
76#undef R_OK
77#define F_OK 0 /* Test for existence. */
78#define X_OK 1 /* Test for execute permission. */
79#define W_OK 2 /* Test for write permission. */
80#define R_OK 4 /* Test for read permission. */
81extern int posix_access(const char *path, int amode);
82
[59f799b]83/* System Parameters */
84enum {
85 _SC_PHYS_PAGES,
86 _SC_AVPHYS_PAGES,
87 _SC_PAGESIZE,
88 _SC_CLK_TCK
89};
90extern long posix_sysconf(int name);
91
[72ec8cc]92/* Path Configuration Parameters */
93enum {
94 _PC_2_SYMLINKS,
95 _PC_ALLOC_SIZE_MIN,
96 _PC_ASYNC_IO,
97 _PC_CHOWN_RESTRICTED,
98 _PC_FILESIZEBITS,
99 _PC_LINK_MAX,
100 _PC_MAX_CANON,
101 _PC_MAX_INPUT,
102 _PC_NAME_MAX,
103 _PC_NO_TRUNC,
104 _PC_PATH_MAX,
105 _PC_PIPE_BUF,
106 _PC_PRIO_IO,
107 _PC_REC_INCR_XFER_SIZE,
108 _PC_REC_MIN_XFER_SIZE,
109 _PC_REC_XFER_ALIGN,
110 _PC_SYMLINK_MAX,
111 _PC_SYNC_IO,
112 _PC_VDISABLE
113};
114
[491e1ee]115#ifndef LIBPOSIX_INTERNAL
[b4d6252]116 #define environ posix_environ
117
[4f4b4e7]118 #define isatty posix_isatty
[b08ef1fd]119
[72ec8cc]120 #undef getpagesize
121 #define getpagesize posix_getpagesize
122
[59f799b]123 #define getuid posix_getuid
124 #define getgid posix_getgid
125
[b08ef1fd]126 #define access posix_access
[59f799b]127
128 #define sysconf posix_sysconf
[4f4b4e7]129#endif
130
[a16210b5]131#endif /* POSIX_UNISTD_H_ */
132
[4f4b4e7]133/** @}
134 */
Note: See TracBrowser for help on using the repository browser.