1#!/bin/sh
2# Test for getconf(1).
3# Copyright (C) 2001-2022 Free Software Foundation, Inc.
4# This file is part of the GNU C Library.
5
6# The GNU C Library is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Lesser General Public
8# License as published by the Free Software Foundation; either
9# version 2.1 of the License, or (at your option) any later version.
10
11# The GNU C Library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14# Lesser General Public License for more details.
15
16# You should have received a copy of the GNU Lesser General Public
17# License along with the GNU C Library; if not, see
18# <https://www.gnu.org/licenses/>.
19
20set -e
21
22common_objpfx=$1; shift
23run_getconf=$1; shift
24
25logfile=$common_objpfx/posix/tst-getconf.out
26
27rm -f $logfile
28result=0
29while read name; do
30  printf %s "getconf $name: " >> $logfile
31  ${run_getconf} "$name" < /dev/null 2>> $logfile >> $logfile
32  if test $? -ne 0; then
33    echo "*** $name FAILED" >> $logfile
34    result=1
35  fi
36done <<EOF
37AIO_LISTIO_MAX
38AIO_MAX
39AIO_PRIO_DELTA_MAX
40ARG_MAX
41ATEXIT_MAX
42BC_BASE_MAX
43BC_DIM_MAX
44BC_SCALE_MAX
45BC_STRING_MAX
46CHILD_MAX
47COLL_WEIGHTS_MAX
48DELAYTIMER_MAX
49EXPR_NEST_MAX
50HOST_NAME_MAX
51IOV_MAX
52LINE_MAX
53LOGIN_NAME_MAX
54NGROUPS_MAX
55MQ_OPEN_MAX
56MQ_PRIO_MAX
57OPEN_MAX
58_POSIX_ADVISORY_INFO
59_POSIX_BARRIERS
60_POSIX_ASYNCHRONOUS_IO
61_POSIX_BASE
62_POSIX_C_LANG_SUPPORT
63_POSIX_C_LANG_SUPPORT_R
64_POSIX_CLOCK_SELECTION
65_POSIX_CPUTIME
66_POSIX_DEVICE_IO
67_POSIX_DEVICE_SPECIFIC
68_POSIX_DEVICE_SPECIFIC_R
69_POSIX_FD_MGMT
70_POSIX_FIFO
71_POSIX_FILE_ATTRIBUTES
72_POSIX_FILE_LOCKING
73_POSIX_FILE_SYSTEM
74_POSIX_FSYNC
75_POSIX_JOB_CONTROL
76_POSIX_MAPPED_FILES
77_POSIX_MEMLOCK
78_POSIX_MEMLOCK_RANGE
79_POSIX_MEMORY_PROTECTION
80_POSIX_MESSAGE_PASSING
81_POSIX_MONOTONIC_CLOCK
82_POSIX_MULTI_PROCESS
83_POSIX_NETWORKING
84_POSIX_PIPE
85_POSIX_PRIORITIZED_IO
86_POSIX_PRIORITY_SCHEDULING
87_POSIX_READER_WRITER_LOCKS
88_POSIX_REALTIME_SIGNALS
89_POSIX_REGEXP
90_POSIX_SAVED_IDS
91_POSIX_SEMAPHORES
92_POSIX_SHARED_MEMORY_OBJECTS
93_POSIX_SHELL
94_POSIX_SIGNALS
95_POSIX_SINGLE_PROCESS
96_POSIX_SPAWN
97_POSIX_SPIN_LOCKS
98_POSIX_SPORADIC_SERVER
99_POSIX_SYNCHRONIZED_IO
100_POSIX_SYSTEM_DATABASE
101_POSIX_SYSTEM_DATABASE_R
102_POSIX_THREAD_ATTR_STACKADDR
103_POSIX_THREAD_ATTR_STACKSIZE
104_POSIX_THREAD_CPUTIME
105_POSIX_THREAD_PRIO_INHERIT
106_POSIX_THREAD_PRIO_PROTECT
107_POSIX_THREAD_PRIORITY_SCHEDULING
108_POSIX_THREAD_PROCESS_SHARED
109_POSIX_THREAD_SAFE_FUNCTIONS
110_POSIX_THREAD_SPORADIC_SERVER
111_POSIX_THREADS
112_POSIX_TIMEOUTS
113_POSIX_TIMERS
114_POSIX_TRACE
115_POSIX_TRACE_EVENT_FILTER
116_POSIX_TRACE_INHERIT
117_POSIX_TRACE_LOG
118_POSIX_TYPED_MEMORY_OBJECTS
119_POSIX_USER_GROUPS
120_POSIX_USER_GROUPS_R
121_POSIX_VERSION
122_POSIX_V6_ILP32_OFF32
123_POSIX_V6_ILP32_OFFBIG
124_POSIX_V6_LP64_OFF64
125_POSIX_V6_LPBIG_OFFBIG
126_POSIX_V6_WIDTH_RESTRICTED_ENVS
127POSIX2_C_BIND
128POSIX2_C_DEV
129POSIX2_C_VERSION
130POSIX2_CHAR_TERM
131POSIX2_FORT_DEV
132POSIX2_FORT_RUN
133POSIX2_LOCALEDEF
134POSIX2_PBS
135POSIX2_PBS_ACCOUNTING
136POSIX2_PBS_LOCATE
137POSIX2_PBS_MESSAGE
138POSIX2_PBS_TRACK
139POSIX2_SW_DEV
140POSIX2_UPE
141POSIX2_VERSION
142_REGEX_VERSION
143PAGE_SIZE
144PAGESIZE
145PTHREAD_DESTRUCTOR_ITERATIONS
146PTHREAD_KEYS_MAX
147PTHREAD_STACK_MIN
148PTHREAD_THREADS_MAX
149RE_DUP_MAX
150RTSIG_MAX
151SEM_NSEMS_MAX
152SEM_VALUE_MAX
153SIGQUEUE_MAX
154STREAM_MAX
155SYMLOOP_MAX
156TIMER_MAX
157TTY_NAME_MAX
158TZNAME_MAX
159_XBS5_ILP32_OFF32
160_XBS5_ILP32_OFFBIG
161_XBS5_LP64_OFF64
162_XBS5_LPBIG_OFFBIG
163_XOPEN_CRYPT
164_XOPEN_ENH_I18N
165_XOPEN_LEGACY
166_XOPEN_REALTIME
167_XOPEN_REALTIME_THREADS
168_XOPEN_SHM
169_XOPEN_UNIX
170_XOPEN_VERSION
171_XOPEN_XCU_VERSION
172PATH
173POSIX_V6_ILP32_OFF32_CFLAGS
174POSIX_V6_ILP32_OFF32_LDFLAGS
175POSIX_V6_ILP32_OFF32_LIBS
176POSIX_V6_ILP32_OFF32_LINTFLAGS
177POSIX_V6_ILP32_OFFBIG_CFLAGS
178POSIX_V6_ILP32_OFFBIG_LDFLAGS
179POSIX_V6_ILP32_OFFBIG_LIBS
180POSIX_V6_ILP32_OFFBIG_LINTFLAGS
181POSIX_V6_LP64_OFF64_CFLAGS
182POSIX_V6_LP64_OFF64_LDFLAGS
183POSIX_V6_LP64_OFF64_LIBS
184POSIX_V6_LP64_OFF64_LINTFLAGS
185POSIX_V6_LPBIG_OFFBIG_CFLAGS
186POSIX_V6_LPBIG_OFFBIG_LDFLAGS
187POSIX_V6_LPBIG_OFFBIG_LIBS
188POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
189XBS5_ILP32_OFF32_CFLAGS
190XBS5_ILP32_OFF32_LDFLAGS
191XBS5_ILP32_OFF32_LIBS
192XBS5_ILP32_OFF32_LINTFLAGS
193XBS5_ILP32_OFFBIG_CFLAGS
194XBS5_ILP32_OFFBIG_LDFLAGS
195XBS5_ILP32_OFFBIG_LIBS
196XBS5_ILP32_OFFBIG_LINTFLAGS
197XBS5_LP64_OFF64_CFLAGS
198XBS5_LP64_OFF64_LDFLAGS
199XBS5_LP64_OFF64_LIBS
200XBS5_LP64_OFF64_LINTFLAGS
201XBS5_LPBIG_OFFBIG_CFLAGS
202XBS5_LPBIG_OFFBIG_LDFLAGS
203XBS5_LPBIG_OFFBIG_LIBS
204XBS5_LPBIG_OFFBIG_LINTFLAGS
205EOF
206
207while read name; do
208  printf %s "getconf $name /: " >> $logfile
209  ${run_getconf} "$name" / < /dev/null 2>> $logfile >> $logfile
210  if test $? -ne 0; then
211    echo "*** $name FAILED" >> $logfile
212    result=1
213  fi
214done <<EOF
215FILESIZEBITS
216LINK_MAX
217MAX_CANON
218MAX_INPUT
219NAME_MAX
220PATH_MAX
221PIPE_BUF
222POSIX_ALLOC_SIZE_MIN
223POSIX_REC_INCR_XFER_SIZE
224POSIX_REC_MAX_XFER_SIZE
225POSIX_REC_MIN_XFER_SIZE
226POSIX_REC_XFER_ALIGN
227SYMLINK_MAX
228_POSIX_CHOWN_RESTRICTED
229_POSIX_NO_TRUNC
230_POSIX_VDISABLE
231_POSIX_ASYNC_IO
232_POSIX_PRIO_IO
233_POSIX_SYNC_IO
234EOF
235
236exit $result
237
238# Preserve executable bits for this shell script.
239Local Variables:
240eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
241eval:(make-local-variable 'file-mode)
242eval:(setq file-mode (file-modes (buffer-file-name)))
243eval:(make-local-variable 'after-save-hook)
244eval:(add-hook 'after-save-hook 'frobme)
245End:
246