<sys/unistd.h>, <time.h>

Change-Id: If0d0cd9115dec33d27e8e5644c0020021d8816b8
This commit is contained in:
Ben Gras 2013-11-22 16:20:09 +01:00 committed by Lionel Sambuc
parent 256829c7e8
commit 3b4bc508ac
2 changed files with 140 additions and 37 deletions

View file

@ -97,11 +97,7 @@ clock_t clock(void);
char *ctime(const time_t *) __RENAME(__ctime50); char *ctime(const time_t *) __RENAME(__ctime50);
double difftime(time_t, time_t) __RENAME(__difftime50); double difftime(time_t, time_t) __RENAME(__difftime50);
struct tm *gmtime(const time_t *) __RENAME(__gmtime50); struct tm *gmtime(const time_t *) __RENAME(__gmtime50);
#ifndef __MINIX
struct tm *localtime(const time_t *) __RENAME(__locatime50); struct tm *localtime(const time_t *) __RENAME(__locatime50);
#else
struct tm *localtime(const time_t *) __RENAME(__localtime50);
#endif
time_t time(time_t *) __RENAME(__time50); time_t time(time_t *) __RENAME(__time50);
time_t mktime(struct tm *) __RENAME(__mktime50); time_t mktime(struct tm *) __RENAME(__mktime50);
#endif #endif
@ -118,11 +114,7 @@ size_t strftime(char * __restrict, size_t, const char * __restrict,
* need to include unistd.h * need to include unistd.h
*/ */
long __sysconf(int); long __sysconf(int);
#ifdef __minix
#define CLK_TCK (__sysconf(3))
#else
#define CLK_TCK (__sysconf(39)) #define CLK_TCK (__sysconf(39))
#endif /* !__minix */
#endif #endif
#endif #endif
@ -164,18 +156,14 @@ int clock_settime(clockid_t, const struct timespec *)
__RENAME(__clock_settime50); __RENAME(__clock_settime50);
int nanosleep(const struct timespec *, struct timespec *) int nanosleep(const struct timespec *, struct timespec *)
__RENAME(__nanosleep50); __RENAME(__nanosleep50);
#ifndef __minix
int timer_gettime(timer_t, struct itimerspec *) __RENAME(__timer_gettime50); int timer_gettime(timer_t, struct itimerspec *) __RENAME(__timer_gettime50);
int timer_settime(timer_t, int, const struct itimerspec * __restrict, int timer_settime(timer_t, int, const struct itimerspec * __restrict,
struct itimerspec * __restrict) __RENAME(__timer_settime50); struct itimerspec * __restrict) __RENAME(__timer_settime50);
#endif /* !__minix */
#endif #endif
#ifndef __minix
int timer_create(clockid_t, struct sigevent * __restrict, int timer_create(clockid_t, struct sigevent * __restrict,
timer_t * __restrict); timer_t * __restrict);
int timer_delete(timer_t); int timer_delete(timer_t);
int timer_getoverrun(timer_t); int timer_getoverrun(timer_t);
#endif /* __minix */
#endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */ #endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */
#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \

View file

@ -1,4 +1,4 @@
/* $NetBSD: unistd.h,v 1.52 2009/08/30 16:38:48 christos Exp $ */ /* $NetBSD: unistd.h,v 1.53 2012/08/01 15:24:22 martin Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -62,6 +62,13 @@
#define _POSIX_VERSION 200112L #define _POSIX_VERSION 200112L
#define _POSIX2_VERSION 200112L #define _POSIX2_VERSION 200112L
#ifndef __minix
/*
* We support the posix_spawn() family of functions (unconditionally).
*/
#define _POSIX_SPAWN 200809L
#endif
/* execution-time symbolic constants */ /* execution-time symbolic constants */
/* /*
@ -145,7 +152,7 @@
/* timeouts */ /* timeouts */
#undef _POSIX_TIMEOUTS #undef _POSIX_TIMEOUTS
/* timers */ /* timers */
#undef _POSIX_TIMERS #define _POSIX_TIMERS 200112L
/* typed memory objects */ /* typed memory objects */
#undef _POSIX_TYPED_MEMORY_OBJECTS #undef _POSIX_TYPED_MEMORY_OBJECTS
/* may disable terminal spec chars */ /* may disable terminal spec chars */
@ -173,37 +180,145 @@
#define L_SET SEEK_SET #define L_SET SEEK_SET
#define L_INCR SEEK_CUR #define L_INCR SEEK_CUR
#define L_XTND SEEK_END #define L_XTND SEEK_END
/*
* fsync_range values.
*
* Note the following flag values were chosen to not overlap
* values for SEEK_XXX flags. While not currently implemented,
* it is possible to extend this call to respect SEEK_CUR and
* SEEK_END offset addressing modes.
*/
#define FDATASYNC 0x0010 /* sync data and minimal metadata */
#define FFILESYNC 0x0020 /* sync data and metadata */
#define FDISKSYNC 0x0040 /* flush disk caches after sync */
#endif #endif
/* configurable pathname variables; use as argument to pathconf(3) */ /* configurable pathname variables; use as argument to pathconf(3) */
#define _PC_LINK_MAX 1 /* link count */ #define _PC_LINK_MAX 1
#define _PC_MAX_CANON 2 /* size of the canonical input queue */ #define _PC_MAX_CANON 2
#define _PC_MAX_INPUT 3 /* type-ahead buffer size */ #define _PC_MAX_INPUT 3
#define _PC_NAME_MAX 4 /* file name size */ #define _PC_NAME_MAX 4
#define _PC_PATH_MAX 5 /* pathname size */ #define _PC_PATH_MAX 5
#define _PC_PIPE_BUF 6 /* pipe size */ #define _PC_PIPE_BUF 6
#define _PC_NO_TRUNC 7 /* treatment of long name components */ #define _PC_CHOWN_RESTRICTED 7
#define _PC_VDISABLE 8 /* tty disable */ #define _PC_NO_TRUNC 8
#define _PC_CHOWN_RESTRICTED 9 /* chown restricted or not */ #define _PC_VDISABLE 9
#define _PC_SYNC_IO 10
#define _PC_FILESIZEBITS 11
#define _PC_SYMLINK_MAX 12
#define _PC_2_SYMLINKS 13
#define _PC_ACL_EXTENDED 14
/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */
#define _PC_MIN_HOLE_SIZE 15
/* configurable system variables; use as argument to sysconf(3) */ /* configurable system variables; use as argument to sysconf(3) */
/* /*
* XXX The value of _SC_CLK_TCK is embedded in <time.h>. * XXX The value of _SC_CLK_TCK is embedded in <time.h>.
* XXX The value of _SC_PAGESIZE is embedded in <sys/shm.h>. * XXX The value of _SC_PAGESIZE is embedded in <sys/shm.h>.
*/ */
#define _SC_ARG_MAX 1 #define _SC_ARG_MAX 1
#define _SC_CHILD_MAX 2 #define _SC_CHILD_MAX 2
#define _SC_CLOCKS_PER_SEC 3 #define _O_SC_CLK_TCK 3 /* Old version, always 100 */
#define _SC_CLK_TCK 3 #define _SC_NGROUPS_MAX 4
#define _SC_NGROUPS_MAX 4 #define _SC_OPEN_MAX 5
#define _SC_OPEN_MAX 5 #define _SC_JOB_CONTROL 6
#define _SC_JOB_CONTROL 6 #define _SC_SAVED_IDS 7
#define _SC_SAVED_IDS 7 #define _SC_VERSION 8
#define _SC_VERSION 8 #define _SC_BC_BASE_MAX 9
#define _SC_STREAM_MAX 9 #define _SC_BC_DIM_MAX 10
#define _SC_TZNAME_MAX 10 #define _SC_BC_SCALE_MAX 11
#define _SC_PAGESIZE 11 #define _SC_BC_STRING_MAX 12
#define _SC_PAGE_SIZE _SC_PAGESIZE #define _SC_COLL_WEIGHTS_MAX 13
#define _SC_LINE_MAX 15 #define _SC_EXPR_NEST_MAX 14
#define _SC_LINE_MAX 15
#define _SC_RE_DUP_MAX 16
#define _SC_2_VERSION 17
#define _SC_2_C_BIND 18
#define _SC_2_C_DEV 19
#define _SC_2_CHAR_TERM 20
#define _SC_2_FORT_DEV 21
#define _SC_2_FORT_RUN 22
#define _SC_2_LOCALEDEF 23
#define _SC_2_SW_DEV 24
#define _SC_2_UPE 25
#define _SC_STREAM_MAX 26
#define _SC_TZNAME_MAX 27
#define _SC_PAGESIZE 28
#define _SC_PAGE_SIZE _SC_PAGESIZE /* 1170 compatibility */
#define _SC_FSYNC 29
#define _SC_XOPEN_SHM 30
#define _SC_SYNCHRONIZED_IO 31
#define _SC_IOV_MAX 32
#define _SC_MAPPED_FILES 33
#define _SC_MEMLOCK 34
#define _SC_MEMLOCK_RANGE 35
#define _SC_MEMORY_PROTECTION 36
#define _SC_LOGIN_NAME_MAX 37
#define _SC_MONOTONIC_CLOCK 38
#define _SC_CLK_TCK 39 /* New, variable version */
#define _SC_ATEXIT_MAX 40
#define _SC_THREADS 41
#define _SC_SEMAPHORES 42
#define _SC_BARRIERS 43
#define _SC_TIMERS 44
#define _SC_SPIN_LOCKS 45
#define _SC_READER_WRITER_LOCKS 46
#define _SC_GETGR_R_SIZE_MAX 47
#define _SC_GETPW_R_SIZE_MAX 48
#define _SC_CLOCK_SELECTION 49
#define _SC_ASYNCHRONOUS_IO 50
#define _SC_AIO_LISTIO_MAX 51
#define _SC_AIO_MAX 52
#define _SC_MESSAGE_PASSING 53
#define _SC_MQ_OPEN_MAX 54
#define _SC_MQ_PRIO_MAX 55
#define _SC_PRIORITY_SCHEDULING 56
#define _SC_THREAD_DESTRUCTOR_ITERATIONS 57
#define _SC_THREAD_KEYS_MAX 58
#define _SC_THREAD_STACK_MIN 59
#define _SC_THREAD_THREADS_MAX 60
#define _SC_THREAD_ATTR_STACKADDR 61
#define _SC_THREAD_ATTR_STACKSIZE 62
#define _SC_THREAD_PRIORITY_SCHEDULING 63
#define _SC_THREAD_PRIO_INHERIT 64
#define _SC_THREAD_PRIO_PROTECT 65
#define _SC_THREAD_PROCESS_SHARED 66
#define _SC_THREAD_SAFE_FUNCTIONS 67
#define _SC_TTY_NAME_MAX 68
#define _SC_HOST_NAME_MAX 69
#define _SC_PASS_MAX 70
#define _SC_REGEXP 71
#define _SC_SHELL 72
#define _SC_SYMLOOP_MAX 73
/* Actually, they are not supported or implemented yet */
#define _SC_V6_ILP32_OFF32 74
#define _SC_V6_ILP32_OFFBIG 75
#define _SC_V6_LP64_OFF64 76
#define _SC_V6_LPBIG_OFFBIG 77
#define _SC_2_PBS 80
#define _SC_2_PBS_ACCOUNTING 81
#define _SC_2_PBS_CHECKPOINT 82
#define _SC_2_PBS_LOCATE 83
#define _SC_2_PBS_MESSAGE 84
#define _SC_2_PBS_TRACK 85
/* This is implemented */
#define _SC_SPAWN 86
#ifdef _NETBSD_SOURCE
/* Commonly provided sysconf() extensions */
#define _SC_NPROCESSORS_CONF 1001
#define _SC_NPROCESSORS_ONLN 1002
/* Native variables */
#define _SC_SCHED_RT_TS 2001
#define _SC_SCHED_PRI_MIN 2002
#define _SC_SCHED_PRI_MAX 2003
#endif /* _NETBSD_SOURCE */
/* configurable system strings */
#define _CS_PATH 1
#endif /* !_SYS_UNISTD_H_ */ #endif /* !_SYS_UNISTD_H_ */