/* # # Tool for generating the list of possible sysconf arguments # # $Id: genlist.c,v 1.1.1.1 2003/12/13 11:17:03 nemies Exp $ # # Copyright (C) 2003 Kees Cook # kees@outflux.net, http://outflux.net/ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # http://www.gnu.org/copyleft/gpl.html # */ #include "sysconf.h" struct check_list_t { char * name; char * category; char * type; }; #define SC "SYSCONF", "RET_NUM" #define CS "CONFSTR", "RET_STR" #define PC "PATHCONF", "RET_NUM" struct check_list_t check_list[]={ /* this list was generated on Linux with: * perl -ne 'next unless (/^\s*(_(SC|PC|CS)[^,\s]+),?$/); \ * print "\t{ \"$1\", $2 },\n"' \ * /usr/includebits/confname.h */ { "_PC_LINK_MAX", PC }, { "_PC_MAX_CANON", PC }, { "_PC_MAX_INPUT", PC }, { "_PC_NAME_MAX", PC }, { "_PC_PATH_MAX", PC }, { "_PC_PIPE_BUF", PC }, { "_PC_CHOWN_RESTRICTED", PC }, { "_PC_NO_TRUNC", PC }, { "_PC_VDISABLE", PC }, { "_PC_SYNC_IO", PC }, { "_PC_ASYNC_IO", PC }, { "_PC_PRIO_IO", PC }, { "_PC_SOCK_MAXBUF", PC }, { "_PC_FILESIZEBITS", PC }, { "_PC_REC_INCR_XFER_SIZE", PC }, { "_PC_REC_MAX_XFER_SIZE", PC }, { "_PC_REC_MIN_XFER_SIZE", PC }, { "_PC_REC_XFER_ALIGN", PC }, { "_PC_ALLOC_SIZE_MIN", PC }, { "_PC_SYMLINK_MAX", PC }, { "_PC_2_SYMLINKS", PC }, { "_SC_ARG_MAX", SC }, { "_SC_CHILD_MAX", SC }, { "_SC_CLK_TCK", SC }, { "_SC_NGROUPS_MAX", SC }, { "_SC_OPEN_MAX", SC }, { "_SC_STREAM_MAX", SC }, { "_SC_TZNAME_MAX", SC }, { "_SC_JOB_CONTROL", SC }, { "_SC_SAVED_IDS", SC }, { "_SC_REALTIME_SIGNALS", SC }, { "_SC_PRIORITY_SCHEDULING", SC }, { "_SC_TIMERS", SC }, { "_SC_ASYNCHRONOUS_IO", SC }, { "_SC_PRIORITIZED_IO", SC }, { "_SC_SYNCHRONIZED_IO", SC }, { "_SC_FSYNC", SC }, { "_SC_MAPPED_FILES", SC }, { "_SC_MEMLOCK", SC }, { "_SC_MEMLOCK_RANGE", SC }, { "_SC_MEMORY_PROTECTION", SC }, { "_SC_MESSAGE_PASSING", SC }, { "_SC_SEMAPHORES", SC }, { "_SC_SHARED_MEMORY_OBJECTS", SC }, { "_SC_AIO_LISTIO_MAX", SC }, { "_SC_AIO_MAX", SC }, { "_SC_AIO_PRIO_DELTA_MAX", SC }, { "_SC_DELAYTIMER_MAX", SC }, { "_SC_MQ_OPEN_MAX", SC }, { "_SC_MQ_PRIO_MAX", SC }, { "_SC_VERSION", SC }, { "_SC_PAGESIZE", SC }, { "_SC_RTSIG_MAX", SC }, { "_SC_SEM_NSEMS_MAX", SC }, { "_SC_SEM_VALUE_MAX", SC }, { "_SC_SIGQUEUE_MAX", SC }, { "_SC_TIMER_MAX", SC }, { "_SC_BC_BASE_MAX", SC }, { "_SC_BC_DIM_MAX", SC }, { "_SC_BC_SCALE_MAX", SC }, { "_SC_BC_STRING_MAX", SC }, { "_SC_COLL_WEIGHTS_MAX", SC }, { "_SC_EQUIV_CLASS_MAX", SC }, { "_SC_EXPR_NEST_MAX", SC }, { "_SC_LINE_MAX", SC }, { "_SC_RE_DUP_MAX", SC }, { "_SC_CHARCLASS_NAME_MAX", SC }, { "_SC_2_VERSION", SC }, { "_SC_2_C_BIND", SC }, { "_SC_2_C_DEV", SC }, { "_SC_2_FORT_DEV", SC }, { "_SC_2_FORT_RUN", SC }, { "_SC_2_SW_DEV", SC }, { "_SC_2_LOCALEDEF", SC }, { "_SC_PII", SC }, { "_SC_PII_XTI", SC }, { "_SC_PII_SOCKET", SC }, { "_SC_PII_INTERNET", SC }, { "_SC_PII_OSI", SC }, { "_SC_POLL", SC }, { "_SC_SELECT", SC }, { "_SC_UIO_MAXIOV", SC }, { "_SC_PII_INTERNET_STREAM", SC }, { "_SC_PII_INTERNET_DGRAM", SC }, { "_SC_PII_OSI_COTS", SC }, { "_SC_PII_OSI_CLTS", SC }, { "_SC_PII_OSI_M", SC }, { "_SC_T_IOV_MAX", SC }, { "_SC_THREADS", SC }, { "_SC_THREAD_SAFE_FUNCTIONS", SC }, { "_SC_GETGR_R_SIZE_MAX", SC }, { "_SC_GETPW_R_SIZE_MAX", SC }, { "_SC_LOGIN_NAME_MAX", SC }, { "_SC_TTY_NAME_MAX", SC }, { "_SC_THREAD_DESTRUCTOR_ITERATIONS", SC }, { "_SC_THREAD_KEYS_MAX", SC }, { "_SC_THREAD_STACK_MIN", SC }, { "_SC_THREAD_THREADS_MAX", SC }, { "_SC_THREAD_ATTR_STACKADDR", SC }, { "_SC_THREAD_ATTR_STACKSIZE", SC }, { "_SC_THREAD_PRIORITY_SCHEDULING", SC }, { "_SC_THREAD_PRIO_INHERIT", SC }, { "_SC_THREAD_PRIO_PROTECT", SC }, { "_SC_THREAD_PROCESS_SHARED", SC }, { "_SC_NPROCESSORS_CONF", SC }, { "_SC_NPROCESSORS_ONLN", SC }, { "_SC_PHYS_PAGES", SC }, { "_SC_AVPHYS_PAGES", SC }, { "_SC_ATEXIT_MAX", SC }, { "_SC_PASS_MAX", SC }, { "_SC_XOPEN_VERSION", SC }, { "_SC_XOPEN_XCU_VERSION", SC }, { "_SC_XOPEN_UNIX", SC }, { "_SC_XOPEN_CRYPT", SC }, { "_SC_XOPEN_ENH_I18N", SC }, { "_SC_XOPEN_SHM", SC }, { "_SC_2_CHAR_TERM", SC }, { "_SC_2_C_VERSION", SC }, { "_SC_2_UPE", SC }, { "_SC_XOPEN_XPG2", SC }, { "_SC_XOPEN_XPG3", SC }, { "_SC_XOPEN_XPG4", SC }, { "_SC_CHAR_BIT", SC }, { "_SC_CHAR_MAX", SC }, { "_SC_CHAR_MIN", SC }, { "_SC_INT_MAX", SC }, { "_SC_INT_MIN", SC }, { "_SC_LONG_BIT", SC }, { "_SC_WORD_BIT", SC }, { "_SC_MB_LEN_MAX", SC }, { "_SC_NZERO", SC }, { "_SC_SSIZE_MAX", SC }, { "_SC_SCHAR_MAX", SC }, { "_SC_SCHAR_MIN", SC }, { "_SC_SHRT_MAX", SC }, { "_SC_SHRT_MIN", SC }, { "_SC_UCHAR_MAX", SC }, { "_SC_UINT_MAX", SC }, { "_SC_ULONG_MAX", SC }, { "_SC_USHRT_MAX", SC }, { "_SC_NL_ARGMAX", SC }, { "_SC_NL_LANGMAX", SC }, { "_SC_NL_MSGMAX", SC }, { "_SC_NL_NMAX", SC }, { "_SC_NL_SETMAX", SC }, { "_SC_NL_TEXTMAX", SC }, { "_SC_XBS5_ILP32_OFF32", SC }, { "_SC_XBS5_ILP32_OFFBIG", SC }, { "_SC_XBS5_LP64_OFF64", SC }, { "_SC_XBS5_LPBIG_OFFBIG", SC }, { "_SC_XOPEN_LEGACY", SC }, { "_SC_XOPEN_REALTIME", SC }, { "_SC_XOPEN_REALTIME_THREADS", SC }, { "_SC_ADVISORY_INFO", SC }, { "_SC_BARRIERS", SC }, { "_SC_BASE", SC }, { "_SC_C_LANG_SUPPORT", SC }, { "_SC_C_LANG_SUPPORT_R", SC }, { "_SC_CLOCK_SELECTION", SC }, { "_SC_CPUTIME", SC }, { "_SC_THREAD_CPUTIME", SC }, { "_SC_DEVICE_IO", SC }, { "_SC_DEVICE_SPECIFIC", SC }, { "_SC_DEVICE_SPECIFIC_R", SC }, { "_SC_FD_MGMT", SC }, { "_SC_FIFO", SC }, { "_SC_PIPE", SC }, { "_SC_FILE_ATTRIBUTES", SC }, { "_SC_FILE_LOCKING", SC }, { "_SC_FILE_SYSTEM", SC }, { "_SC_MONOTONIC_CLOCK", SC }, { "_SC_MULTI_PROCESS", SC }, { "_SC_SINGLE_PROCESS", SC }, { "_SC_NETWORKING", SC }, { "_SC_READER_WRITER_LOCKS", SC }, { "_SC_SPIN_LOCKS", SC }, { "_SC_REGEXP", SC }, { "_SC_REGEX_VERSION", SC }, { "_SC_SHELL", SC }, { "_SC_SIGNALS", SC }, { "_SC_SPAWN", SC }, { "_SC_SPORADIC_SERVER", SC }, { "_SC_THREAD_SPORADIC_SERVER", SC }, { "_SC_SYSTEM_DATABASE", SC }, { "_SC_SYSTEM_DATABASE_R", SC }, { "_SC_TIMEOUTS", SC }, { "_SC_TYPED_MEMORY_OBJECTS", SC }, { "_SC_USER_GROUPS", SC }, { "_SC_USER_GROUPS_R", SC }, { "_SC_2_PBS", SC }, { "_SC_2_PBS_ACCOUNTING", SC }, { "_SC_2_PBS_LOCATE", SC }, { "_SC_2_PBS_MESSAGE", SC }, { "_SC_2_PBS_TRACK", SC }, { "_SC_SYMLOOP_MAX", SC }, { "_SC_STREAMS", SC }, { "_SC_2_PBS_CHECKPOINT", SC }, { "_SC_V6_ILP32_OFF32", SC }, { "_SC_V6_ILP32_OFFBIG", SC }, { "_SC_V6_LP64_OFF64", SC }, { "_SC_V6_LPBIG_OFFBIG", SC }, { "_SC_HOST_NAME_MAX", SC }, { "_SC_TRACE", SC }, { "_SC_TRACE_EVENT_FILTER", SC }, { "_SC_TRACE_INHERIT", SC }, { "_SC_TRACE_LOG", SC }, { "_CS_V6_WIDTH_RESTRICTED_ENVS", CS }, { "_CS_GNU_LIBC_VERSION", CS }, { "_CS_GNU_LIBPTHREAD_VERSION", CS }, { "_CS_LFS_LDFLAGS", CS }, { "_CS_LFS_LIBS", CS }, { "_CS_LFS_LINTFLAGS", CS }, { "_CS_LFS64_CFLAGS", CS }, { "_CS_LFS64_LDFLAGS", CS }, { "_CS_LFS64_LIBS", CS }, { "_CS_LFS64_LINTFLAGS", CS }, { "_CS_XBS5_ILP32_OFF32_LDFLAGS", CS }, { "_CS_XBS5_ILP32_OFF32_LIBS", CS }, { "_CS_XBS5_ILP32_OFF32_LINTFLAGS", CS }, { "_CS_XBS5_ILP32_OFFBIG_CFLAGS", CS }, { "_CS_XBS5_ILP32_OFFBIG_LDFLAGS", CS }, { "_CS_XBS5_ILP32_OFFBIG_LIBS", CS }, { "_CS_XBS5_ILP32_OFFBIG_LINTFLAGS", CS }, { "_CS_XBS5_LP64_OFF64_CFLAGS", CS }, { "_CS_XBS5_LP64_OFF64_LDFLAGS", CS }, { "_CS_XBS5_LP64_OFF64_LIBS", CS }, { "_CS_XBS5_LP64_OFF64_LINTFLAGS", CS }, { "_CS_XBS5_LPBIG_OFFBIG_CFLAGS", CS }, { "_CS_XBS5_LPBIG_OFFBIG_LDFLAGS", CS }, { "_CS_XBS5_LPBIG_OFFBIG_LIBS", CS }, { "_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS", CS }, { "_CS_POSIX_V6_ILP32_OFF32_CFLAGS", CS }, { "_CS_POSIX_V6_ILP32_OFF32_LDFLAGS", CS }, { "_CS_POSIX_V6_ILP32_OFF32_LIBS", CS }, { "_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS", CS }, { "_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS", CS }, { "_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS", CS }, { "_CS_POSIX_V6_ILP32_OFFBIG_LIBS", CS }, { "_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS", CS }, { "_CS_POSIX_V6_LP64_OFF64_CFLAGS", CS }, { "_CS_POSIX_V6_LP64_OFF64_LDFLAGS", CS }, { "_CS_POSIX_V6_LP64_OFF64_LIBS", CS }, { "_CS_POSIX_V6_LP64_OFF64_LINTFLAGS", CS }, { "_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS", CS }, { "_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS", CS }, { "_CS_POSIX_V6_LPBIG_OFFBIG_LIBS", CS }, { "_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", CS }, { NULL, NULL, NULL }, }; int main() { int i; for (i=0;check_list[i].name;i++) { printf("#ifdef %s\n",check_list[i].name); printf("\t{ %s, \"%s\", %s, %s },\n", check_list[i].name, check_list[i].name, check_list[i].category, check_list[i].type); printf("#else\n"); printf("# warning \"%s is missing from your unistd.h file!\"\n", check_list[i].name); printf("#endif\n"); } return 0; }