summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/include/unistd.h
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/include/unistd.h')
-rw-r--r--mdk-stage1/dietlibc/include/unistd.h113
1 files changed, 89 insertions, 24 deletions
diff --git a/mdk-stage1/dietlibc/include/unistd.h b/mdk-stage1/dietlibc/include/unistd.h
index 1a528c0e4..2fba5d584 100644
--- a/mdk-stage1/dietlibc/include/unistd.h
+++ b/mdk-stage1/dietlibc/include/unistd.h
@@ -2,12 +2,14 @@
#define _UNISTD_H
#include <sys/cdefs.h>
-#include <dirent.h>
#include <sys/types.h>
#include <sys/time.h>
-#include <getopt.h>
-#include <linux/sysctl.h>
#include <sys/stat.h>
+#include <sys/fsuid.h>
+
+extern int optind,opterr;
+extern char *optarg;
+int getopt(int argc, char *const argv[], const char *options);
/* Values for the second argument to access.
These may be OR'd together. */
@@ -17,28 +19,28 @@
#define F_OK 0 /* Test for existence. */
/* Test for access to NAME using the real UID and real GID. */
-extern int access (__const char *__name, int __type) __THROW;
+extern int access (const char *__name, int __type) __THROW;
+#ifndef SEEK_SET
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
+#endif
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
off_t lseek(int fildes, off_t offset, int whence) __THROW;
-int llseek(int fildes, unsigned long hi, unsigned long lo, loff_t* result,int whence) __THROW;
#ifndef __NO_STAT64
loff_t lseek64(int fildes, loff_t offset, int whence) __THROW;
-#endif
-#if _FILE_OFFSET_BITS == 64
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
#define lseek(fildes,offset,whence) lseek64(fildes,offset,whence)
#endif
+#endif
int chdir(const char *path) __THROW;
int fchdir(int fd) __THROW;
-int mkdir(const char *pathname, mode_t mode) __THROW;
int rmdir(const char *pathname) __THROW;
char *getcwd(char *buf, size_t size) __THROW;
@@ -60,23 +62,24 @@ int execlp(const char *file, const char *arg, ...) __THROW;
int execv(const char *path, char *const argv[]) __THROW;
int execvp(const char *file, char *const argv[]) __THROW;
int execl(const char *path, ...) __THROW;
+int execle(const char *path, ...) __THROW;
-pid_t getpid(void) __attribute__((__const__)) __THROW;
+pid_t getpid(void) __THROW;
pid_t getppid(void) __THROW;
-int kill(pid_t pid, int sig) __THROW;
int setpgid (pid_t pid,pid_t pgid) __THROW;
pid_t getpgid (pid_t pid) __THROW;
int setpgrp (void) __THROW;
pid_t getpgrp (void) __THROW;
+pid_t getsid(pid_t pid) __THROW;
pid_t setsid (void) __THROW;
int dup (int oldfd) __THROW;
int dup2 (int oldfd,int newfd) __THROW;
-int mknod(const char *pathname, mode_t mode, dev_t dev) __THROW;
-
-int getdents(unsigned int fd, struct dirent *dirp, unsigned int count) __THROW;
-int getdents64(unsigned int fd, struct dirent64 *dirp, unsigned int count) __THROW;
+struct dirent;
+struct dirent64;
+int getdents(int fd, struct dirent *dirp, unsigned int count) __THROW;
+int getdents64(int fd, struct dirent64 *dirp, unsigned int count) __THROW;
pid_t fork(void) __THROW;
pid_t vfork(void) __THROW;
@@ -90,6 +93,8 @@ int fchown(int fd, uid_t owner, gid_t group) __THROW;
int lchown(const char *path, uid_t owner, gid_t group) __THROW;
int fsync(int fd) __THROW;
+#define _POSIX_SYNCHRONIZED_IO
+int fdatasync(int fd) __THROW;
int pipe(int filedes[2]) __THROW;
@@ -101,7 +106,7 @@ void *sbrk(ptrdiff_t increment) __THROW;
int gethostname(char *name, size_t len) __THROW;
int sethostname(const char *name, size_t len) __THROW;
-void usleep(unsigned long usec) __THROW;
+int usleep(unsigned long useconds) __THROW;
unsigned int sleep(unsigned int seconds) __THROW;
unsigned int alarm(unsigned int seconds) __THROW;
@@ -111,11 +116,16 @@ int isatty(int desc) __THROW;
void _exit(int status) __THROW __attribute__((noreturn));
-extern int daemon (int nochdir,int noclose) __THROW;
+extern int daemon(int nochdir,int noclose) __THROW;
+
+int pause(void) __THROW;
-#if _FILE_OFFSET_BITS == 64
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
#define open open64
#define creat creat64
+#define truncate truncate64
+#define ftruncate ftruncate64
+#define getdents getdents64
#endif
extern char* getlogin(void) __THROW;
@@ -137,32 +147,87 @@ int setreuid(uid_t ruid, uid_t euid) __THROW;
#define setegid(egid) setregid(-1,egid)
int rename(const char *oldpath, const char *newpath) __THROW;
+int truncate(const char *path, off_t length) __THROW;
int ftruncate(int fd, off_t length) __THROW;
-
-int mkstemp(char *Template) __THROW;
+#ifndef __NO_STAT64
+int truncate64(const char *path, loff_t length) __THROW;
+int ftruncate64(int fd, loff_t length) __THROW;
+#endif
int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) __THROW;
int nice(int inc) __THROW;
-extern char *__environ[];
+extern char **__environ;
char *crypt(const char *key, const char *salt) __THROW;
void encrypt(char block[64], int edflag) __THROW;
void setkey(const char *key) __THROW;
-size_t getpagesize(void) __attribute__((__const__)) __THROW;
+size_t getpagesize(void) __THROW __attribute__((__const__));
int getdomainname(char *name, size_t len) __THROW;
int setdomainname(const char *name, size_t len) __THROW;
int getgroups(int size, gid_t list[]) __THROW;
+int getdtablesize(void) __THROW;
+char *getpass(const char * prompt) __THROW;
/* warning: linux specific: */
+int llseek(int fildes, unsigned long hi, unsigned long lo, loff_t* result,int whence) __THROW;
+
+/* include <linux/sysctl.h> to get all the definitions! */
+struct __sysctl_args;
int _sysctl(struct __sysctl_args *args) __THROW;
-int sendfile(int out_fd, int in_fd, off_t *offset, size_t count) __THROW;
-int getdtablesize(void) __THROW;
-char *getpass(const char * prompt) __THROW;
+#define _SC_CLK_TCK 1
+#define _SC_ARG_MAX 2
+#define _SC_NGROUPS_MAX 3
+#define _SC_OPEN_MAX 4
+#define _SC_PAGESIZE 5
+#define _SC_NPROCESSORS_ONLN 6
+#define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_ONLN
+long sysconf(int name) __THROW;
+#define _PC_PATH_MAX 1
+#define _PC_VDISABLE 2
+
+pid_t tcgetpgrp(int fd) __THROW;
+int tcsetpgrp(int fd, pid_t pgrpid) __THROW;
+
+int profil(unsigned short *buf, size_t bufsiz, size_t offset, unsigned int scale);
+
+/* Linux only: */
+int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) __THROW;
+int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) __THROW;
+int setresuid(uid_t ruid, uid_t euid, uid_t suid) __THROW;
+int setresgid(gid_t rgid, gid_t egid, gid_t sgid) __THROW;
+
+/* 32-bit uid support */
+int chown32(const char *path, uid32_t owner, gid32_t group) __THROW;
+int fchown32(int fd, uid32_t owner, gid32_t group) __THROW;
+int lchown32(const char *path, uid32_t owner, gid32_t group) __THROW;
+uid32_t getuid32(void) __THROW;
+uid32_t geteuid32(void) __THROW;
+gid32_t getgid32(void) __THROW;
+gid32_t getegid32(void) __THROW;
+int setuid32(uid32_t uid) __THROW;
+int setgid32(gid32_t gid) __THROW;
+int setreuid32(uid32_t ruid, uid32_t euid) __THROW;
+int setregid32(gid32_t rgid, gid32_t egid) __THROW;
+#define seteuid32(euid) setreuid32(-1,euid)
+#define setegid32(egid) setregid32(-1,egid)
+int getgroups32(int size, gid32_t list[]) __THROW;
+int getresuid32(uid32_t *ruid, uid32_t *euid, uid32_t *suid);
+int getresgid32(gid32_t *rgid, gid32_t *egid, gid32_t *sgid);
+int setresuid32(uid32_t ruid, uid32_t euid, uid32_t suid) __THROW;
+int setresgid32(gid32_t rgid, gid32_t egid, gid32_t sgid) __THROW;
+
+#ifdef _BSD_SOURCE
+char *getusershell(void);
+void setusershell(void);
+void endusershell(void);
+#endif
+
+#define _POSIX_VERSION 199506L
#endif