source: mainline/uspace/lib/posix/unistd.h@ 9b1503e

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

Added function stubs into stdio.h and unistd.h.

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