diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-06-30 12:09:42 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-06-30 12:09:42 +0000 |
commit | 4959e310bfbf3fa34b5a4b4ff688d8d564c8363c (patch) | |
tree | 65381cc0476c07dfb96c8dee790fda3630744a8f /posix | |
parent | fdacb17d4819c7112a147195c5ce3c82147f4b46 (diff) | |
download | glibc-4959e310bfbf3fa34b5a4b4ff688d8d564c8363c.tar.gz glibc-4959e310bfbf3fa34b5a4b4ff688d8d564c8363c.tar.xz glibc-4959e310bfbf3fa34b5a4b4ff688d8d564c8363c.zip |
Update.
1998-06-30 11:47 Ulrich Drepper <drepper@cygnus.com> * include/aio.h: New file. * posix/Makefile (distribute): Add bits/pthreadtypes.h. (tests): Build and run annexc program. * posix/annexc.c: New file. * posix/bits/posix1_lim.h: Add several more _POSIX_* limits. * rt/aio.h: Remove __need_timespec_t. We can include the whole time.h. * rt/aio_misc.c: Include limits.h. * rt/aio_notify.c: Include errno.h. * sysdeps/unix/sysv/linux/alpha/bits/types.h: Include pthreadtypes.h. Define size_t. * sysdeps/unix/sysv/linux/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/bits/errno.h: Define ENOTSUP though the kernel doesn't do this. * sysdeps/unix/sysv/linux/bits/fcntl.h: Define O_LARGEFILE only if __USE_LARGEFILE64 is defined. * sysdeps/unix/sysv/linux/bits/pthreadtypes.h: New file. Empty. * sysdeps/unix/sysv/linux/bits/sched.h: Define __sched_param struct if requested. * sysdeps/unix/sysv/linux/bits/siginifo.h: Protect non-standard names. * stdlib/isomac.c: Avoid include_next warning.
Diffstat (limited to 'posix')
-rw-r--r-- | posix/Makefile | 11 | ||||
-rw-r--r-- | posix/annexc.c | 867 | ||||
-rw-r--r-- | posix/bits/posix1_lim.h | 32 |
3 files changed, 908 insertions, 2 deletions
diff --git a/posix/Makefile b/posix/Makefile index 20c1c2b44c..ae3a40b04c 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -26,7 +26,8 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \ bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h \ bits/local_lim.h tar.h bits/utsname.h bits/confname.h \ bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \ - bits/sched.h re_comp.h wait.h bits/environments.h cpio.h + bits/sched.h re_comp.h wait.h bits/environments.h cpio.h \ + bits/pthreadtypes.h distribute := confstr.h TESTS TESTS2C.sed testcases.h \ PTESTS PTESTS2C.sed ptestcases.h \ @@ -132,3 +133,11 @@ endif %.gz: % gzip -9v -c $< > $@-tmp mv $@-tmp $@ + +# Run a test on the header files we use. +# XXX Please note that for now we ignore the result of this test. +tests: $(objpfx)annexc + -$(dir $<)$(notdir $<) '$(CC)' '-I../include -I../include -I.. $(+sysdep-includes) -I../include -I../include -I..' > $<.out + +$(objpfx)annexc: annexc.c + $(native-compile) diff --git a/posix/annexc.c b/posix/annexc.c new file mode 100644 index 0000000000..dbc5e28520 --- /dev/null +++ b/posix/annexc.c @@ -0,0 +1,867 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <ctype.h> +#include <fnmatch.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#define TMPFILE "/tmp/macros" +#define HEADER_MAX 256 + +/* <aio.h>. */ +static const char *const aio_syms[] = +{ + "AIO_ALLDONE", "AIO_CANCELED", "AIO_NOTCANCELED", "LIO_NOP", "LIO_NOWAIT", + "LIO_READ", "LIO_WAIT", "LIO_WRITE", + /* From <fcntl.h>. */ + "FD_CLOEXEC", "F_DUPFD", "F_GETFD", "F_GETFL", "F_GETLK", "F_RDLCK", + "F_SETFD", "F_SETFL", "F_SETLK", "F_SETLKW", "F_UNLCK", "F_WRLCK", + "O_ACCMODE", "O_APPEND", "O_CREAT", "O_DSYNC", "O_EXCL", "O_NOCTTY", + "O_NONBLOCK", "O_RDONLY", "O_RDWR", "O_RSYNC", "O_SYNC", "O_TRUNC", + "O_WRONLY", + /* From <signal.h>. */ + "SA_NOCLDSTOP", "SA_SIGINFO", "SIGABRT", "SIGALRM", "SIGBUS", "SIGCHLD", + "SIGCONT", "SIGEV_NONE", "SIGEV_SIGNAL", "SIGEV_SIGNAL", "SIGEV_THREAD", + "SIGFPE", "SIGHUP", "SIGILL", "SIGINT", "SIGKILL", "SIGPIPE", "SIGQUIT", + "SIGRTMAX", "SIGRTMIN", "SIGSEGV", "SIGSTOP", "SIGTERM", "SIGTSTP", + "SIGTTIN", "SIGTTOU", "SIGUSR1", "SIGUSR2", "SIG_BLOCK", "SIG_DFL", + "SIG_ERR", "SIG_IGN", "SIG_SETMASK", "SIG_UNBLOCK", "SI_ASYNCIO", + "SI_MESGQ", "SI_QUEUE", "SI_TIMER", "SI_USER" +}; +static const char *const aio_maybe[] = +{ + "aio_cancel", "aio_error", "aio_fsync", "aio_read", "aio_return", + "aio_suspend", "aio_write", "lio_listio", + /* From <fcntl.h>. */ + "creat", "fcntl", "open", "SEEK_CUR", "SEEK_END", "SEEK_SET", "S_IRGRP", + "S_IROTH", "S_IRUSR", "S_IRWXG", "S_IRWXO", "S_IRWXU", "S_ISBLK", + "S_ISCHR", "S_ISDIR", "S_ISFIFO", "S_ISGID", "S_ISREG", "S_ISUID", + "S_IWGRP", "S_IWOTH", "S_IWUSR", "S_IXGRP", "S_IXOTH", "S_IXUSR", + /* From <signal.h>. */ + "kill", "raise", "sigaction", "sigaddset", "sigdelset", "sigemptyset", + "sigfillset", "sigismember", "signal", "sigpending", "sigprocmask", + "sigqueue", "sigsuspend", "sigtimedwait", "sigwait", "sigwaitinfo" +}; + +/* <assert.h>. */ +static const char *const assert_syms[] = +{ + "assert" +}; +static const char *const assert_maybe[] = +{ +}; + +/* <ctype.h>. */ +static const char *const ctype_syms[] = +{ +}; +static const char *const ctype_maybe[] = +{ + "isalnum", "isalpha", "iscntrl", "isdigit", "isgraph", "islower", + "isprint", "ispunct", "isspace", "isupper", "isxdigit", "tolower", + "toupper" +}; + +/* <dirent.h>. */ +static const char *const dirent_syms[] = +{ +}; +static const char *const dirent_maybe[] = +{ + "closedir", "opendir", "readdir", "readdir_r", "rewinddir" +}; + +/* <errno.h>. */ +static const char *const errno_syms[] = +{ + "E2BIG", "EACCESS", "EAGAIN", "EBADF", "EBADMSG", "EBUSY", "ECANCELED", + "ECHILD", "EDEADLK", "EDOM", "EEXIST", "EFAULT", "EFBIG", "EINPROGRESS", + "EINTR", "EINVAL", "EIO", "EISDIR", "EMFILE", "EMLINK", "EMSGSIZE", + "ENAMETOOLONG", "ENFILE", "ENODEV", "ENOENT", "ENOEXEC", "ENOLCK", + "ENOMEM", "ENOSPC", "ENOSYS", "ENOTDIR", "ENOTEMPTY", "ENOTSUP", + "ENOTTY", "ENXIO", "EPERM", "EPIPE", "ERANGE", "EROFS", "ESPIPE", + "ESRCH", "ETIMEDOUT", "EXDEV" +}; +static const char *const errno_maybe[] = +{ + "errno", "E*" +}; + +/* <fcntl.h>. */ +static const char *const fcntl_syms[] = +{ + "FD_CLOEXEC", "F_DUPFD", "F_GETFD", "F_GETFL", "F_GETLK", "F_RDLCK", + "F_SETFD", "F_SETFL", "F_SETLK", "F_SETLKW", "F_UNLCK", "F_WRLCK", + "O_ACCMODE", "O_APPEND", "O_CREAT", "O_DSYNC", "O_EXCL", "O_NOCTTY", + "O_NONBLOCK", "O_RDONLY", "O_RDWR", "O_RSYNC", "O_SYNC", "O_TRUNC", + "O_WRONLY" +}; +static const char *const fcntl_maybe[] = +{ + "creat", "fcntl", "open", "SEEK_CUR", "SEEK_END", "SEEK_SET", "S_IRGRP", + "S_IROTH", "S_IRUSR", "S_IRWXG", "S_IRWXO", "S_IRWXU", "S_ISBLK", + "S_ISCHR", "S_ISDIR", "S_ISFIFO", "S_ISGID", "S_ISREG", "S_ISUID", + "S_IWGRP", "S_IWOTH", "S_IWUSR", "S_IXGRP", "S_IXOTH", "S_IXUSR" +}; + +/* <float.h>. */ +static const char *const float_syms[] = +{ + "DBL_DIG", "DBL_EPSILON", "DBL_MANT_DIG", "DBL_MAX", "DBL_MAX_10_EXP", + "DBL_MAX_EXP", "DBL_MIN", "DBL_MIN_10_EXP", "DBL_MIN_EXP", "FLT_DIG", + "FLT_EPSILON", "FLT_MANT_DIG", "FLT_MAX", "FLT_MAX_10_EXP", "FLT_MAX_EXP", + "FLT_MIN", "FLT_MIN_10_EXP", "FLT_MIN_EXP", "FLT_RADIX", "FLT_ROUNDS", + "LDBL_DIG", "LDBL_EPSILON", "LDBL_MANT_DIG", "LDBL_MAX", "LDBL_MAX_10_EXP", + "LDBL_MAX_EXP", "LDBL_MIN", "LDBL_MIN_10_EXP", "LDBL_MIN_EXP" +}; +static const char *const float_maybe[] = +{ +}; + +/* <grp.h>. */ +static const char *const grp_syms[] = +{ +}; +static const char *const grp_maybe[] = +{ + "getgrgid", "getgrgid_r", "getgrnam", "getgrnam_r" +}; + +/* <limits.h>. */ +static const char *const limits_syms[] = +{ + "_POSIX_AIO_LISTIO_MAX", "_POSIX_AIO_MAX", "_POSIX_ARG_MAX", + "_POSIX_CHILD_MAX", "_POSIX_CLOCKRES_MAX", "_POSIX_DELAYTIMER_MAX", + "_POSIX_LINK_MAX", "_POSIX_LOGIN_NAME_MAX", "_POSIX_MAX_CANON", + "_POSIX_MAX_INPUT", "_POSIX_MQ_OPEN_MAX", "_POSIX_MQ_PRIO_MAX", + "_POSIX_NAME_MAX", "_POSIX_NGROUPS_MAX", "_POSIX_OPEN_MAX", + "_POSIX_PATH_MAX", "_POSIX_PIPE_BUF", "_POSIX_RTSIG_MAX", + "_POSIX_SEM_NSEMS_MAX", "_POSIX_SEM_VALUE_MAX", "_POSIX_SIGQUEUE_MAX", + "_POSIX_SSIZE_MAX", "_POSIX_STREAM_MAX", + "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", "_POSIX_THREAD_KEYS_MAX", + "_POSIX_THREAD_THREADS_MAX", "_POSIX_TIMER_MAX", "_POSIX_TTY_NAME_MAX", + "_POSIX_TZNAME_MAX", "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", + "CHAR_BIT", "CHAR_MAX", "CHAR_MIN", "INT_MAX", "INT_MIN", "MB_LEN_MAX", + "NGROUPS_MAX", "PAGESIZE", "SCHAR_MIN", "SCHAR_MAX" +}; +static const char *const limits_maybe[] = +{ + "AIO_LISTIO_MAX", "AIO_MAX", "ARG_MAX", "CHILD_MAX", "DELAYTIMER_MAX", + "LINK_MAX", "LOGIN_NAME_MAX", "LONG_MAX", "LONG_MIN", "MAX_CANON", + "MAX_INPUT", "MQ_OPEN_MAX", "MQ_PRIO_MAX", "NAME_MAX", "OPEN_MAX", + "PATH_MAX", "PIPE_BUF", "RTSIG_MAX", "PTHREAD_DESTRUCTOR_ITERATIONS", + "PTHREAD_KEYS_MAX", "PTHREAD_STACK_MIN", "PTHREAD_THREADS_MAX" +}; + +/* <locale.h>. */ +static const char *const locale_syms[] = +{ + "LC_ALL", "LC_COLLATE", "LC_CTYPE", "LC_MONETARY", "LC_NUMERIC", + "LC_TIME", "NULL" +}; +static const char *const locale_maybe[] = +{ + "LC_*", "localeconv", "setlocale" +}; + +/* <math.h>. */ +static const char *const math_syms[] = +{ + "HUGE_VAL" +}; +static const char *const math_maybe[] = +{ + "acos", "asin", "atan2", "atan", "ceil", "cos", "cosh", "exp", + "fabs", "floor", "fmod", "frexp", "ldexp", "log10", "log", "modf", + "pow", "sin", "sinh", "sqrt", "tan", "tanh", + "acosf", "asinf", "atan2f", "atanf", "ceilf", "cosf", "coshf", "expf", + "fabsf", "floorf", "fmodf", "frexpf", "ldexpf", "log10f", "logf", "modff", + "powf", "sinf", "sinhf", "sqrtf", "tanf", "tanhf", + "acosl", "asinl", "atan2l", "atanl", "ceill", "cosl", "coshl", "expl", + "fabsl", "floorl", "fmodl", "frexpl", "ldexpl", "log10l", "logl", "modfl", + "powl", "sinl", "sinhl", "sqrtl", "tanl", "tanhl" +}; + +/* <mqueue.h>. */ +static const char *const mqueue_syms[] = +{ +}; +static const char *const mqueue_maybe[] = +{ + "mq_close", "mq_getattr", "mq_notify", "mq_open", "mq_receive", + "mq_send", "mq_setattr", "mq_unlink" +}; + +/* <pthread.h>. */ +static const char *const pthread_syms[] = +{ + "PTHREAD_CANCELED", "PTHREAD_CANCEL_ASYNCHRONOUS", + "PTHREAD_CANCEL_DEFERRED", "PTHREAD_CANCEL_DISABLE", "PTHREAD_CANCEL_ENABLE", + "PTHREAD_COND_INITIALIZER", "PTHREAD_CREATE_DETACHED", + "PTHREAD_CREATE_JOINABLE", "PTHREAD_EXPLICIT_SCHED", + "PTHREAD_INHERIT_SCHED", "PTHREAD_MUTEX_INITIALIZER", + "PTHREAD_ONCE_INIT", "PTHREAD_PRIO_INHERIT", "PTHREAD_PRIO_NONE", + "PTHREAD_PRIO_PROTECT", "PTHREAD_PROCESS_PRIVATE", + "PTHREAD_PROCESS_SHARED", "PTHREAD_SCOPE_PROCESS", "PTHREAD_SCOPE_SYSTEM", + /* These come from <sched.h>. */ + "SCHED_FIFO", "SCHED_OTHER", "SCHED_RR", + /* These come from <time.h>. */ + "CLK_TCK", "CLOCKS_PER_SEC", "CLOCK_REALTIME", "NULL", "TIMER_ABSTIME" +}; +static const char *const pthread_maybe[] = +{ + "pthread_atfork", "pthread_attr_destroy", "pthread_attr_getdetachstate", + "pthread_attr_getinheritsched", "pthread_attr_getschedparam", + "pthread_attr_getschedpolicy", "pthread_attr_getscope", + "pthread_attr_getstackaddr", "pthread_attr_getstacksize", + "pthread_attr_init", "pthread_attr_setdetachstate", + "pthread_attr_setinheritsched", "pthread_attr_setschedparam", + "pthread_attr_setschedpolicy", "pthread_attr_setscope", + "pthread_attr_setstackaddr", "pthread_attr_setstacksize", + "pthread_cleanup_pop", "pthread_cleanup_push", "pthread_cond_broadcast", + "pthread_cond_destroy", "pthread_cond_init", "pthread_cond_signal", + "pthread_cond_timedwait", "pthread_cond_wait", "pthread_condattr_destroy", + "pthread_condattr_getpshared", "pthread_condattr_init", + "pthread_condattr_setpshared", "pthread_create", "pthread_detach", + "pthread_equal", "pthread_exit", "pthread_getspecific", "pthread_join", + "pthread_key_create", "pthread_key_destroy", "pthread_kill", + "pthread_mutex_destroy", "pthread_mutex_getprioceiling", + "pthread_mutex_init", "pthread_mutex_lock", "pthread_mutex_setprioceiling", + "pthread_mutex_trylock", "pthread_mutex_unlock", "pthread_mutexattr_destroy", + "pthread_mutexattr_getprioceiling", "pthread_mutexattr_getprotocol", + "pthread_mutexattr_getpshared", "pthread_mutexattr_init", + "pthread_mutexattr_setprioceiling", "pthread_mutexattr_setprotocol", + "pthread_mutexattr_setpshared", "pthread_once", "pthread_self", + "pthread_setcancelstate", "pthread_setcanceltype", "pthread_setspecific", + "pthread_sigmask", "pthread_testcancel" + /* These come from <sched.h>. */ + "sched_get_priority_max", "sched_get_priority_min", + "sched_get_rr_interval", "sched_getparam", "sched_getscheduler", + "sched_setparam", "sched_setscheduler", "sched_yield", + /* These come from <time.h>. */ + "asctime", "asctime_r", "clock", "clock_getres", "clock_gettime", + "clock_settime", "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r", + "localtime", "localtime_r", "mktime", "nanosleep", "strftime", "time", + "timer_create", "timer_delete", "timer_getoverrun", "timer_gettime", + "timer_settime", "tzset" +}; + +/* <pwd.h>. */ +static const char *const pwd_syms[] = +{ +}; +static const char *const pwd_maybe[] = +{ + "getpwnam", "getpwnam_r", "getpwuid", "getpwuid_r" +}; + +/* <sched.h>. */ +static const char *const sched_syms[] = +{ + "SCHED_FIFO", "SCHED_OTHER", "SCHED_RR", +}; +static const char *const sched_maybe[] = +{ + "sched_get_priority_max", "sched_get_priority_min", + "sched_get_rr_interval", "sched_getparam", "sched_getscheduler", + "sched_setparam", "sched_setscheduler", "sched_yield", + /* These come from <time.h>. */ + "CLK_TCK", "CLOCKS_PER_SEC", "CLOCK_REALTIME", "NULL", "TIMER_ABSTIME" + "asctime", "asctime_r", "clock", "clock_getres", "clock_gettime", + "clock_settime", "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r", + "localtime", "localtime_r", "mktime", "nanosleep", "strftime", "time", + "timer_create", "timer_delete", "timer_getoverrun", "timer_gettime", + "timer_settime", "tzset" +}; + +/* <semaphore.h>. */ +static const char *const semaphore_syms[] = +{ +}; +static const char *const semaphore_maybe[] = +{ + "sem_close", "sem_destroy", "sem_getvalue", "sem_init", "sem_open", + "sen_post", "sem_trywait", "sem_unlink", "sem_wait" +}; + +/* <setjmp.h>. */ +static const char *const setjmp_syms[] = +{ +}; +static const char *const setjmp_maybe[] = +{ + "longjmp", "setjmp", "siglongjmp", "sigsetjmp" +}; + +/* <signal.h>. */ +static const char *const signal_syms[] = +{ + "SA_NOCLDSTOP", "SA_SIGINFO", "SIGABRT", "SIGALRM", "SIGBUS", "SIGCHLD", + "SIGCONT", "SIGEV_NONE", "SIGEV_SIGNAL", "SIGEV_SIGNAL", "SIGEV_THREAD", + "SIGFPE", "SIGHUP", "SIGILL", "SIGINT", "SIGKILL", "SIGPIPE", "SIGQUIT", + "SIGRTMAX", "SIGRTMIN", "SIGSEGV", "SIGSTOP", "SIGTERM", "SIGTSTP", + "SIGTTIN", "SIGTTOU", "SIGUSR1", "SIGUSR2", "SIG_BLOCK", "SIG_DFL", + "SIG_ERR", "SIG_IGN", "SIG_SETMASK", "SIG_UNBLOCK", "SI_ASYNCIO", + "SI_MESGQ", "SI_QUEUE", "SI_TIMER", "SI_USER" +}; +static const char *const signal_maybe[] = +{ + "kill", "raise", "sigaction", "sigaddset", "sigdelset", "sigemptyset", + "sigfillset", "sigismember", "signal", "sigpending", "sigprocmask", + "sigqueue", "sigsuspend", "sigtimedwait", "sigwait", "sigwaitinfo" +}; + +/* <stdarg.h>. */ +static const char *const stdarg_syms[] = +{ + "va_arg", "va_end", "va_list", "va_start" +}; +static const char *const stdarg_maybe[] = +{ +}; + +/* <stddef.h>. */ +static const char *const stddef_syms[] = +{ + "NULL", "offsetof" +}; +static const char *const stddef_maybe[] = +{ +}; + +/* <stdio.h>. */ +static const char *const stdio_syms[] = +{ + "BUFSIZ", "EOF", "FILENAME_MAX", "L_ctermid", "L_cuserid", "L_tmpnam", + "NULL", "SEEK_CUR", "SEEK_END", "SEEK_SET", "STREAM_MAX", "TMP_MAX", + "stderr", "stdin", "stdout", "_IOFBF", "_IOLBF", "_IONBF" +}; +static const char *const stdio_maybe[] = +{ + "clearerr", "fclose", "fdopen", "feof", "ferror", "fflush", "fgetc", + "fgetpos", "fgets", "fileno", "flockfile", "fopen", "fprintf", "fputc", + "fputs", "fread", "freopen", "fscanf", "fseek", "fsetpos", "ftell", + "ftrylockfile", "funlockfile", "fwrite", "getc", "getchar", + "getchar_unlocked", "getc_unlocked", "gets", "perror", "printf", "putc", + "putchar", "putchar_unlocked", "putc_unlocked", "puts", "remove", "rename", + "rewind", "scanf", "setbuf", "setvbuf", "sprintf", "sscanf", "tmpfile", + "tmpnam", "ungetc", "vfprintf", "vprintf", "vsprintf" +}; + +/* <stdlib.h>. */ +static const char *const stdlib_syms[] = +{ + "EXIT_FAILURE", "EXIT_SUCCESS", "MB_CUR_MAX", "NULL", "RAND_MAX" +}; +static const char *const stdlib_maybe[] = +{ + "abort", "abs", "atexit", "atof", "atoi", "atol", "bsearch", "calloc", + "div", "exit", "free", "getenv", "labs", "ldiv", "malloc", "mblen", + "mbstowcs", "mbtowc", "qsort", "rand", "rand_r", "realloc", "srand", + "strtod", "strtol", "strtoul", "system", "wcstombs", "wctomb" +}; + +/* <string.h>. */ +static const char *const string_syms[] = +{ + "NULL" +}; +static const char *const string_maybe[] = +{ + "memchr", "memcmp", "memcpy", "memmove", "memset", "strcat", "strchr", + "strcmp", "strcoll", "strcpy", "strcspn", "strerror", "strlen", + "strncat", "strncmp", "strncpy", "strpbrk", "strrchr", "strspn", + "strstr", "strtok", "strtok_r", "strxfrm" +}; + +/* <sys/mman.h>. */ +static const char *const mman_syms[] = +{ + "MAP_FAILED", "MAP_FIXED", "MAP_PRIVATE", "MAP_SHARED", "MCL_CURRENT", + "MCL_FUTURE", "MS_ASYNC", "MS_INVALIDATE", "MS_ASYNC", "MS_INVALIDATE", + "MS_SYNC", "PROT_EXEC", "PROT_NONE", "PROT_READ", "PROT_WRITE" +}; +static const char *const mman_maybe[] = +{ + "mlock", "mlockall", "mmap", "mprotect", "msync", "munlock", "munlockall", + "munmap", "shm_open", "shm_unlock" +}; + +/* <sys/stat.h>. */ +static const char *const stat_syms[] = +{ + "S_IRGRP", "S_IROTH", "S_IRUSR", "S_IRWXG", "S_IRWXO", "S_IRWXU", + "S_ISBLK", "S_ISCHR", "S_ISDIR", "S_ISFIFO", "S_ISGID", "S_ISREG", + "S_ISUID", "S_IWGRP", "S_IWOTH", "S_IWUSR", "S_IXGRP", "S_IXOTH", + "S_IXUSR", "S_TYPEISMQ", "S_TYPEISSEM", "S_TYPEISSHM" +}; +static const char *const stat_maybe[] = +{ + "chmod", "fchmod", "fstat", "mkdir", "mkfifo", "stat", "umask" +}; + +/* <sys/times.h>. */ +static const char *const times_syms[] = +{ +}; +static const char *const times_maybe[] = +{ + "times" +}; + +/* <sys/types.h>. */ +static const char *const types_syms[] = +{ +}; +static const char *const types_maybe[] = +{ +}; + +/* <sys/utsname.h>. */ +static const char *const utsname_syms[] = +{ +}; +static const char *const utsname_maybe[] = +{ + "uname" +}; + +/* <sys/wait.h>. */ +static const char *const wait_syms[] = +{ + "WEXITSTATUS", "WIFEXITED", "WIFSIGNALED", "WIFSTOPPED", "WNOHANG", + "WSTOPSIG", "WTERMSIG", "WUNTRACED" +}; +static const char *const wait_maybe[] = +{ + "wait", "waitpid" +}; + +/* <termios.h>. */ +static const char *const termios_syms[] = +{ + "B0", "B110", "B1200", "B134", "B150", "B1800", "B19200", "B200", "B2400", + "B300", "B38400", "B4800", "B50", "B600", "B75", "B9600", "BRKINT", "CLOCAL", + "CREAD", "CS5", "CS6", "CS7", "CS8", "CSIZE", "CSTOPN", "ECHO", "ECHOE", + "ECHOK", "ECHONL", "HUPCL", "ICANON", "ICRNL", "IEXTEN", "IGNBRK", "IGNCR", + "IGNPAR", "INCLR", "INPCK", "ISIG", "ISTRIP", "IXOFF", "IXON", "NCCS", + "NOFLSH", "OPOST", "PARENB", "PARMRK", "PARODD", "TCIFLUSH", "TCIOFF", + "TCIOFLUSH", "TCOFLUSH", "TCOOFF", "TCOON", "TCSADRAIN", "TCSAFLUSH", + "TCSANOW", "TOSTOP", "VEOF", "VEOL", "VERASE", "VINTR", "VKILL", "VMIN", + "VQUIT", "VSTART", "VSTOP", "VSUSP", "VTIME" +}; +static const char *const termios_maybe[] = +{ + "cfgetispeed", "cfgetospeed", "cfsetispeed", "cfsetospeed", "tcdrain", + "tcflow", "tcflush", "tcgetattr", "tcsendbrk", "tcsetattr" +}; + +/* <time.h>. */ +static const char *const time_syms[] = +{ + "CLK_TCK", "CLOCKS_PER_SEC", "CLOCK_REALTIME", "NULL", "TIMER_ABSTIME" +}; +static const char *const time_maybe[] = +{ + "asctime", "asctime_r", "clock", "clock_getres", "clock_gettime", + "clock_settime", "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r", + "localtime", "localtime_r", "mktime", "nanosleep", "strftime", "time", + "timer_create", "timer_delete", "timer_getoverrun", "timer_gettime", + "timer_settime", "tzset" +}; + +/* <unistd.h>. */ +static const char *const unistd_syms[] = +{ + "F_OK", "NULL", "R_OK", "SEEK_CUR", "SEEK_END", "SEEK_SET", "STDERR_FILENO", + "STDIN_FILENO", "STDOUT_FILENO", "W_OK", "X_OK", + "_PC_ASYNC_IO", "_PC_CHOWN_RESTRICTED", "_PC_LINK_MAX", "_PC_MAX_CANON", + "_PC_MAX_INPUT", "_PC_NAME_MAX", "_PC_NO_TRUNC", "_PC_PATH_MAX", + "_PC_PIPE_BUF", "_PC_PRIO_IO", "_PC_SYNC_IO", "_PC_VDISABLE", + "_SC_AIO_LISTIO_MAX", "_SC_AIO_MAX", "_SC_AIO_PRIO_DELTA_MAX", + "_SC_ARG_MAX", "_SC_ASYNCHRONOUS_IO", "_SC_CHILD_MAX", "_SC_CLK_TCK", + "_SC_DELAYTIMER_MAX", "_SC_FSYNC", "_SC_GETGR_R_SIZE_MAX", + "_SC_GETPW_R_SIZE_MAX", "_SC_JOB_CONTROL", "_SC_LOGIN_NAME_MAX", + "_SC_MAPPED_FILES", "_SC_MEMLOCK", "_SC_MEMLOCK_RANGE", + "_SC_MEMORY_PROTECTION", "_SC_MESSAGE_PASSING", "_SC_MQ_OPEN_MAX", + "_SC_MQ_PRIO_MAX", "_SC_NGROUPS_MAX", "_SC_OPEN_MAX", "_SC_PAGESIZE", + "_SC_PRIORITIZED_IO", "_SC_PRIORITY_SCHEDULING", "_SC_REALTIME_SIGNALS", + "_SC_RTSIG_MAX", "_SC_SAVED_IDS", "_SC_SEMAPHORES", "_SC_SEM_NSEMS_MAX", + "_SC_SEM_VALUE_MAX", "_SC_SHARED_MEMORY_OBJECTS", "_SC_SIGQUEUE_MAX", + "_SC_STREAM_MAX", "_SC_SYNCHRONIZED_IO", "_SC_THREADS", + "_SC_THREAD_ATTR_STACKADDR", "_SC_THREAD_ATTR_STACKSIZE", + "_SC_THREAD_DESTRUCTOR_ITERATIONS", "_SC_THREAD_PRIO_INHERIT", + "_SC_THREAD_PRIORITY_SCHEDULING", "_SC_THREAD_PRIO_PROTECT", + "_SC_THREAD_PROCESS_SHARED", "_SC_THREAD_SAFE_FUNCTIONS", + "_SC_THREAD_STACK_MIN", "_SC_THREAD_THREADS_MAX", "_SC_TIMERS", + "_SC_TIMER_MAX", "_SC_TTY_NAME_MAX", "_SC_TZNAME_MAX", "_SC_VERSION" +}; +static const char *const unistd_maybe[] = +{ + "_POSIX_ASYNCHRONOUS_IO", "_POSIX_ASYNC_IO", "_POSIX_CHOWN_RESTRICTED", + "_POSIX_FSYNC", "_POSIX_JOB_CONTROL", "_POSIX_MAPPED_FILES", + "_POSIX_MEMLOCK", "_POSIX_MEMLOCK_RANGE", "_MEMORY_PROTECTION", + "_POSIX_MESSAGE_PASSING", "_POSIX_NO_TRUNC", "_POSIX_PRIORITIZED_IO", + "_POSIX_PRIORITY_SCHEDULING", "_POSIX_PRIO_IO", "_POSIX_REATIME_SIGNALS", + "_POSIX_SAVED_IDS", "_POSIX_SEMAPHORES", "_POSIX_SHARED_MEMORY_OBJECTS", + "_POSIX_SYNCHRONIZED_IO", "_POSIX_SYNC_IO", "_POSIX_THREADS", + "_POSIX_THREAD_ATTR_STACKADDR", "_POSIX_THREAD_ATTR_STACKSIZE", + "_POSIX_THREAD_PRIO_INHERIT", "_POSIX_THREAD_PRIO_PROTECT", + "_POSIX_THREAD_PROCESS_SHARED", "_POSIX_THREAD_SAFE_FUNCTIONS", + "_POSIX_THREAD_PRIORITY_SCHEDULING", "_POSIX_TIMERS", + "_POSIX_VDISABLE", "_POSIX_VERSION", + "_exit", "access", "alarm", "chdir", "chown", "close", "ctermid", "cuserid", + "dup2", "dup", "execl", "execle", "execlp", "execv", "execve", "execvp", + "fdatasync", "fork", "fpathconf", "fsync", "ftruncate", "getcwd", "getegid", + "geteuid", "getgid", "getgroups", "getlogin", "getlogin_r", "getpgrp", + "getpid", "getppid", "getuid", "isatty", "link", "lseek", "pathconf", + "pause", "pipe", "read", "rmdir", "setgid", "setgpid", "setsid", "setuid", + "sleep", "sleep", "sysconf", "tcgetpgrp", "tcsetpgrp", "ttyname", + "ttyname_r", "unlink", "write" +}; + +/* <utime.h>. */ +static const char *const utime_syms[] = +{ +}; +static const char *const utime_maybe[] = +{ + "utime" +}; + + +static struct header +{ + const char *name; + const char *const *syms; + size_t nsyms; + const char *const *maybe; + size_t nmaybe; + const char *subset; +} headers[] = +{ +#define H(n) \ + { #n ".h", n##_syms, sizeof (n##_syms) / sizeof (n##_syms[0]), \ + n##_maybe, sizeof (n##_maybe) / sizeof (n##_maybe[0]), NULL } +#define Hc(n, s) \ + { #n ".h", n##_syms, sizeof (n##_syms) / sizeof (n##_syms[0]), \ + n##_maybe, sizeof (n##_maybe) / sizeof (n##_maybe[0]), s } +#define Hs(n) \ + { "sys/" #n ".h", n##_syms, sizeof (n##_syms) / sizeof (n##_syms[0]), \ + n##_maybe, sizeof (n##_maybe) / sizeof (n##_maybe[0]), NULL } + H(aio), + H(assert), + H(ctype), + H(dirent), + H(errno), + H(fcntl), + H(float), + H(grp), + H(limits), + H(locale), + H(math), + Hc(mqueue, "_POSIX_MESSAGE_PASSING"), + H(pthread), + H(pwd), + H(sched), + H(semaphore), + H(setjmp), + H(signal), + H(stdarg), + H(stddef), + H(stdio), + H(stdlib), + H(string), + Hs(mman), + Hs(stat), + Hs(times), + Hs(types), + Hs(utsname), + Hs(wait), + H(termios), + H(time), + H(unistd), + H(utime) +}; + +#define NUMBER_OF_HEADERS (sizeof headers / sizeof *headers) + + +/* Format string to build command to invoke compiler. */ +static const char fmt[] = "\ +echo \"#include <%s>\" |\ +%s -E -dM -D_POSIX_SOURCE %s \ +-isystem `%s --print-prog-name=include` - > %s"; + +static const char testfmt[] = "\ +echo \"#include <unistd.h>\n#ifndef %s\n#error not defined\n#endif\n\" |\ +%s -E -dM -D_POSIX_SOURCE %s \ +-isystem `%s --print-prog-name=include` - 2> /dev/null > %s"; + + +/* The compiler we use (given on the command line). */ +const char *CC; +/* The -I parameters for CC to find all headers. */ +const char *INC; + +static char *xstrndup (const char *, size_t); +static const char **get_null_defines (void); +static int check_header (const struct header *, const char **); + +int +main (int argc, char *argv[]) +{ + int h; + int result = 0; + const char **ignore_list; + + CC = argc > 1 ? argv[1] : "gcc"; + INC = argc > 2 ? argv[2] : ""; + + if (system (NULL) == 0) + { + puts ("Sorry, no command processor."); + return EXIT_FAILURE; + } + + /* First get list of symbols which are defined by the compiler. */ + ignore_list = get_null_defines (); + + fputs ("Tested files:\n", stdout); + + for (h = 0; h < NUMBER_OF_HEADERS; ++h) + result |= check_header (&headers[h], ignore_list); + + /* The test suite should return errors but for now this is not + practical. Give a warning and ask the user to correct the bugs. */ + return result; +} + + +static char * +xstrndup (const char *s, size_t n) +{ + size_t len = n; + char *new = malloc (len + 1); + + if (new == NULL) + return NULL; + + new[len] = '\0'; + return memcpy (new, s, len); +} + + +static const char ** +get_null_defines (void) +{ + char line[BUFSIZ], *command; + char **result = NULL; + size_t result_len = 0; + size_t result_max = 0; + FILE *input; + int first = 1; + + command = malloc (sizeof fmt + sizeof "/dev/null" + 2 * strlen (CC) + + strlen (INC) + strlen (TMPFILE)); + + if (command == NULL) + { + puts ("No more memory."); + exit (1); + } + + sprintf (command, fmt, "/dev/null", CC, INC, CC, TMPFILE); + + if (system (command)) + { + puts ("system() returned nonzero"); + return NULL; + } + free (command); + input = fopen (TMPFILE, "r"); + + if (input == NULL) + { + printf ("Could not read %s: ", TMPFILE); + perror (NULL); + return NULL; + } + + while (fgets (line, sizeof line, input) != NULL) + { + char *start, *end; + if (strlen (line) < 9 || line[7] != ' ') + { /* "#define A" */ + printf ("Malformed input, expected '#define MACRO'\ngot '%s'\n", + line); + continue; + } + if (line[8] == '_') + /* It's a safe identifier. */ + continue; + if (result_len == result_max) + { + result_max += 10; + result = realloc (result, result_max * sizeof (char **)); + if (result == NULL) + { + puts ("No more memory."); + exit (1); + } + } + start = &line[8]; + for (end = start + 1; !isspace (*end) && *end != '\0'; ++end) + ; + result[result_len++] = xstrndup (start, end - start); + + if (first) + { + fputs ("The following identifiers will be ignored since the compiler defines them\nby default:\n", stdout); + first = 0; + } + puts (result[result_len - 1]); + } + if (result_len == result_max) + { + result_max += 1; + result = realloc (result, result_max * sizeof (char **)); + if (result == NULL) + { + puts ("No more memory."); + exit (1); + } + } + result[result_len] = NULL; + fclose (input); + remove (TMPFILE); + + return (const char **) result; +} + + +static int +check_header (const struct header *header, const char **except) +{ + char line[BUFSIZ], *command; + FILE *input; + int result = 0; + int found[header->nsyms]; + int i; + + memset (found, '\0', header->nsyms * sizeof (int)); + command = alloca (sizeof fmt + strlen (header->name) + 2 * strlen (CC) + + strlen (INC) + strlen (TMPFILE)); + + + if (command == NULL) + { + puts ("No more memory."); + exit (1); + } + + printf ("=== %s ===\n", header->name); + sprintf (command, fmt, header->name, CC, INC, CC, TMPFILE); + + /* First see whether this subset is supported at all. */ + if (header->subset != NULL) + { + sprintf (line, testfmt, header->subset, CC, INC, CC, TMPFILE); + if (system (line)) + { + printf ("!! not available\n"); + return 0; + } + } + + if (system (command)) + { + puts ("system() returned nonzero"); + result = 1; + } + input = fopen (TMPFILE, "r"); + + if (input == NULL) + { + printf ("Could not read %s: ", TMPFILE); + perror (NULL); + return 1; + } + + while (fgets (line, sizeof line, input) != NULL) + { + char *endmac; + const char **ignore; + if (strlen (line) < 9 || line[7] != ' ') + { /* "#define A" */ + printf ("Malformed input, expected '#define MACRO'\ngot '%s'\n", + line); + result = 1; + continue; + } + + /* Now check whether it's one of the required macros. */ + for (i = 0; i < header->nsyms; ++i) + if (!strncmp (&line[8], header->syms[i], strlen (header->syms[i]))) + break; + if (i < header->nsyms) + { + found[i] = 1; + continue; + } + + /* Symbols starting with "_" are ok. */ + if (line[8] == '_') + continue; + + /* Find next char after the macro identifier; this can be either + a space or an open parenthesis. */ + endmac = strpbrk (&line[8], " ("); + if (endmac != NULL) + *endmac = '\0'; + + /* Maybe one of the symbols which are always defined. */ + for (ignore = except; *ignore != NULL; ++ignore) + if (! strcmp (&line[8], *ignore)) + break; + if (*ignore != NULL) + continue; + + /* Otherwise the symbol better should match one of the following. */ + for (i = 0; i < header->nmaybe; ++i) + if (fnmatch (header->maybe[i], &line[8], 0) == 0) + break; + if (i < header->nmaybe) + continue; + + printf ("* invalid macro `%s'\n", &line[8]); + result |= 1; + } + fclose (input); + remove (TMPFILE); + + for (i = 0; i < header->nsyms; ++i) + if (found[i] == 0) + printf ("** macro `%s' not defined\n", header->syms[i]); + + return result; +} diff --git a/posix/bits/posix1_lim.h b/posix/bits/posix1_lim.h index 29d1acf947..71a7cc45a3 100644 --- a/posix/bits/posix1_lim.h +++ b/posix/bits/posix1_lim.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,12 +28,21 @@ /* These are the standard-mandated minimum values. */ +/* Minimum number of operations in one list I/O call. */ +#define _POSIX_AIO_LISTIO_MAX 2 + +/* Minimal number of outstanding asynchronous I/O operations. */ +#define _POSIX_AIO_MAX 1 + /* Maximum length of arguments to `execve', including environment. */ #define _POSIX_ARG_MAX 4096 /* Maximum simultaneous processes per real user ID. */ #define _POSIX_CHILD_MAX 6 +/* Minimal number of timer expiration overruns. */ +#define _POSIX_DELAYTIMER_MAX 32 + /* Maximum link count of a file. */ #define _POSIX_LINK_MAX 8 @@ -44,6 +53,12 @@ available in a terminal input queue. */ #define _POSIX_MAX_INPUT 255 +/* Maximum number of message queues open for a process. */ +#define _POSIX_MQ_OPEN_MAX 8 + +/* Maximum number of supported message priorities. */ +#define _POSIX_MQ_PRIO_MAX 32 + /* Number of simultaneous supplementary group IDs per process. */ #define _POSIX_NGROUPS_MAX 0 @@ -63,6 +78,18 @@ /* Number of bytes than can be written atomically to a pipe. */ #define _POSIX_PIPE_BUF 512 +/* Minimal number of realtime signals reserved for the application. */ +#define _POSIX_RTSIG_MAX 8 + +/* Number of semaphores a process can have. */ +#define _POSIX_SEM_NSEMS_MAX 256 + +/* Maximal value of a semaphore. */ +#define _POSIX_SEM_VALUE_MAX 32767 + +/* Number of pending realtime signals. */ +#define _POSIX_SIGQUEUE_MAX 32 + /* Largest value of a `ssize_t'. */ #define _POSIX_SSIZE_MAX 32767 @@ -85,6 +112,9 @@ /* Maximum number of characters in a tty name. */ #define _POSIX_TTY_NAME_MAX 9 +/* Number of timer for a process. */ +#define _POSIX_TIMER_MAX 32 + /* Maximum length of login name. */ #define _POSIX_LOGIN_NAME_MAX 9 |