diff --git a/headers/posix/fcntl.h b/headers/posix/fcntl.h index c94368435d..c424686076 100644 --- a/headers/posix/fcntl.h +++ b/headers/posix/fcntl.h @@ -20,11 +20,7 @@ #define F_UNLCK 0x0200 #define F_WRLCK 0x0400 -#if __GNUC__ -# define FD_CLOEXEC 1 /* Close on exec. */ -#else -# define FD_CLOEXEC 0x0800 -#endif +#define FD_CLOEXEC 1 /* Close on exec. */ /* flags for open() */ #define O_RDONLY 0 /* read only */ @@ -48,9 +44,10 @@ #define O_NOFOLLOW 0x00010000 /* should we implement this? it's similar to O_NOTRAVERSE but will fail on symlinks */ #define O_NOCACHE 0x00020000 /* doesn't use the file system cache if possible */ -#define O_DIRECT O_DIRECT +#define O_DIRECT O_NOCACHE #define O_SHLOCK 0x00040000 #define O_EXLOCK 0x00080000 +#define O_MOUNT 0x00100000 /* for file systems */ #define O_FSYNC 0x10000000 diff --git a/headers/posix/time.h b/headers/posix/time.h index 486b4fa8d1..ffab73081d 100644 --- a/headers/posix/time.h +++ b/headers/posix/time.h @@ -1,5 +1,8 @@ #ifndef _TIME_H_ #define _TIME_H_ +/* +** Distributed under the terms of the OpenBeOS License. +*/ typedef long clock_t; typedef long time_t; @@ -7,11 +10,52 @@ typedef long time_t; #define CLOCKS_PER_SEC 1000 #define CLK_TCK CLOCKS_PER_SEC +#define MAX_TIMESTR 70 + /* maximum length of a string returned by asctime(), and ctime() */ + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; /* day of month (1 to 31) */ + int tm_mon; /* months since January (0 to 11) */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday (0 to 6, Sunday = 0, ...) */ + int tm_yday; /* days since January 1 (0 to 365) */ + int tm_isdst; /* daylight savings time (0 == no, >0 == yes, <0 == has to be calculated */ + int tm_gmtoff; /* timezone offset to GMT */ + char *tm_zone; /* timezone name */ +}; + + +/* special timezone support */ +extern char *tzname[2]; +extern int daylight; +extern long timezone; + + #ifdef __cplusplus extern "C" { #endif -// ToDo: add function prototypes... +extern clock_t clock(void); +extern double difftime(time_t time1, time_t time2); +extern time_t mktime(struct tm *tm); +extern time_t time(time_t *timer); +extern char *asctime(const struct tm *tm); +extern char *asctime_r(const struct tm *timep, char *buffer); +extern char *ctime(const time_t *timer); +extern char *ctime_r(const time_t *timer, char *buffer); +extern struct tm *gmtime(const time_t *timer); +extern struct tm *gmtime_r(const time_t *timer, struct tm *tm); +extern struct tm *localtime(const time_t *timer); +extern struct tm *localtime_r(const time_t *timer, struct tm *tm); +extern size_t strftime(char *buffer, size_t maxSize, const char *format, + const struct tm *tm); + +/* special timezone support */ +extern void tzset(void); +extern int stime(const time_t *t); #ifdef __cplusplus } diff --git a/headers/posix/unistd.h b/headers/posix/unistd.h index 67e5616fa4..d53b349eaa 100644 --- a/headers/posix/unistd.h +++ b/headers/posix/unistd.h @@ -62,7 +62,6 @@ extern "C" { # define SEEK_END 2 #endif -// ToDo: unimplemented functions are commented out /* file functions */ extern int access(const char *path, int accessMode); @@ -71,7 +70,7 @@ extern int chdir(const char *path); extern int fchdir(int fd); extern char *getcwd(char *buffer, size_t size); -//extern int pipe(int fildes[2]); +extern int pipe(int fildes[2]); extern int dup(int fd); extern int dup2(int fd1, int fd2); extern int close(int fd); @@ -94,14 +93,14 @@ extern ssize_t write_pos(int fd, off_t pos, const void *buffer,size_t count); extern ssize_t pwrite(int fd, const void *buffer, size_t count, off_t pos); extern off_t lseek(int fd, off_t offset, int whence); -//extern int sync(void); -//extern int fsync(int fd); +extern int sync(void); +extern int fsync(int fd); extern int chown(const char *path, uid_t owner, gid_t group); extern int fchown(int fd, uid_t owner, gid_t group); extern int lchown(const char *path, uid_t owner, gid_t group); -//extern int mknod(const char *name, mode_t mode, dev_t dev); +extern int mknod(const char *name, mode_t mode, dev_t dev); /* mount flags */ #define B_MOUNT_READ_ONLY 1 @@ -117,36 +116,36 @@ extern long fpathconf(int fd, int name); extern long pathconf(const char *path, int name); /* process functions */ -//extern pid_t fork(void); -//extern int execve(const char *path, char * const argv[], char * const envp[]); -//extern int execl(const char *path, const char *arg, ...); -//extern int execv(const char *path, char *const *argv); -//extern int execlp(const char *file, const char *arg, ...); -//extern int execle(const char *path, const char *arg , ... /*, char **envp */); -//extern int exect(const char *path, char *const *argv); -//extern int execvp(const char *file, char *const *argv); +extern pid_t fork(void); +extern int execve(const char *path, char * const argv[], char * const envp[]); +extern int execl(const char *path, const char *arg, ...); +extern int execv(const char *path, char *const *argv); +extern int execlp(const char *file, const char *arg, ...); +extern int execle(const char *path, const char *arg , ... /*, char **envp */); +extern int exect(const char *path, char *const *argv); +extern int execvp(const char *file, char *const *argv); -//extern void _exit(int status); +extern void _exit(int status); -//extern int system(const char *string); -//extern pid_t tcgetpgrp(int fd); -//extern int tcsetpgrp(int fd, pid_t pgrpid); -//extern void *sbrk(long incr); +extern int system(const char *string); +extern pid_t tcgetpgrp(int fd); +extern int tcsetpgrp(int fd, pid_t pgrpid); +extern void *sbrk(long incr); -//extern uint alarm(unsigned int seconds); -//extern uint ualarm(unsigned int microSeconds); +extern uint alarm(unsigned int seconds); +extern uint ualarm(unsigned int microSeconds); extern uint sleep(unsigned int seconds); extern int usleep(unsigned int microSeconds); -//extern clock_t clock(void); -//extern int pause(void); +extern clock_t clock(void); +extern int pause(void); /* process */ -//extern pid_t getpgrp(void); -//extern pid_t getpid(void); -//extern pid_t getppid(void); +extern pid_t getpgrp(void); +extern pid_t getpid(void); +extern pid_t getppid(void); -//extern pid_t setsid(void); -//extern int setpgid(pid_t pid, pid_t pgid); +extern pid_t setsid(void); +extern int setpgid(pid_t pid, pid_t pgid); /* access permissions */ extern gid_t getegid(void); @@ -167,13 +166,13 @@ extern int sethostname(const char *hostName, size_t nameSize); extern int gethostname(char *hostName, size_t nameSize); /* tty */ -//extern int isatty(int fd); -//extern char *ttyname(int fd); -//extern int ttyname_r(int fd, char *buffer, size_t bufferSize); -//extern char *ctermid(char *s); +extern int isatty(int fd); +extern char *ttyname(int fd); +extern int ttyname_r(int fd, char *buffer, size_t bufferSize); +extern char *ctermid(char *s); /* misc */ -//extern char *crypt(const char *key, const char *salt); +extern char *crypt(const char *key, const char *salt); extern int getopt(int argc, char *const *argv, const char *shortOpts); /* getopt() related external variables */