First part of program argument and environment variable support.
[planlOS.git] / programs / include / unistd.h
bloba6411222025d2256fc2b6f967fd75ba7befab76b
1 /*
2 Copyright (C) 2008 Mathias Gottschlag
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in the
6 Software without restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8 Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 #ifndef UNISTD_H_INCLUDED
23 #define UNISTD_H_INCLUDED
25 #include <sys/types.h>
27 extern char **environ;
29 #define SEEK_SET 0
30 #define SEEK_CUR 1
31 #define SEEK_END 2
33 #define R_OK 1
34 #define W_OK 2
35 #define X_OK 4
36 #define F_OK 8
38 ssize_t write(int fildes, const void *buf, size_t nbyte);
39 ssize_t read(int fildes, void *buf, size_t nbyte);
40 int close(int fildes);
41 off_t lseek(int fildes, off_t offset, int whence);
42 int unlink(const char *filename);
44 unsigned sleep(unsigned seconds);
46 pid_t fork(void);
48 int pipe(int fd[2]);
50 int dup(int fd);
51 int dup2(int fd, int fd2);
53 int execl(const char *path, const char *arg0, ...);
54 int execle(const char *path, const char *arg0, ...);
55 int execlp(const char *file, const char *arg0, ...);
56 int execv(const char *path, char *const argv[]);
57 int execve(const char *file, char *const argv[], char *const env[]);
58 int execvp(const char *path, char *const argv[]);
60 char *getcwd(char *buf, size_t size);
61 int chdir(const char *path);
63 extern char *optarg;
64 extern int opterr;
65 extern int optind;
66 extern int optopt;
67 extern int optreset;
69 int getopt(int argc, char *const *argv, const char *optstring);
71 pid_t getpid(void);
73 int access(const char *path, int amode);
75 pid_t tcgetpgrp(int fd);
77 #endif