]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/blob - tests/unistd_test.cpp
Merge "bionic/test: migrate sysconf tests from system/extras to bionic/tests"
[android-sdk/platform-bionic.git] / tests / unistd_test.cpp
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
17 #include <gtest/gtest.h>
18 #include "BionicDeathTest.h"
19 #include "ScopedSignalHandler.h"
20 #include "TemporaryFile.h"
22 #include <errno.h>
23 #include <fcntl.h>
24 #include <limits.h>
25 #include <stdint.h>
26 #include <sys/param.h>
27 #include <sys/syscall.h>
28 #include <sys/types.h>
29 #include <sys/utsname.h>
30 #include <sys/wait.h>
31 #include <unistd.h>
33 static void* get_brk() {
34   return sbrk(0);
35 }
37 static void* page_align(uintptr_t addr) {
38   uintptr_t mask = sysconf(_SC_PAGE_SIZE) - 1;
39   return reinterpret_cast<void*>((addr + mask) & ~mask);
40 }
42 TEST(unistd, brk) {
43   void* initial_break = get_brk();
45   // The kernel aligns the break to a page.
46   void* new_break = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(initial_break) + 1);
47   ASSERT_EQ(0, brk(new_break));
48   ASSERT_GE(get_brk(), new_break);
50   new_break = page_align(reinterpret_cast<uintptr_t>(initial_break) + sysconf(_SC_PAGE_SIZE));
51   ASSERT_EQ(0, brk(new_break));
52   ASSERT_EQ(get_brk(), new_break);
53 }
55 TEST(unistd, brk_ENOMEM) {
56   ASSERT_EQ(-1, brk(reinterpret_cast<void*>(-1)));
57   ASSERT_EQ(ENOMEM, errno);
58 }
60 #if defined(__GLIBC__)
61 #define SBRK_MIN INTPTR_MIN
62 #define SBRK_MAX INTPTR_MAX
63 #else
64 #define SBRK_MIN PTRDIFF_MIN
65 #define SBRK_MAX PTRDIFF_MAX
66 #endif
68 TEST(unistd, sbrk_ENOMEM) {
69 #if defined(__BIONIC__) && !defined(__LP64__)
70   // There is no way to guarantee that all overflow conditions can be tested
71   // without manipulating the underlying values of the current break.
72   extern void* __bionic_brk;
74   class ScopedBrk {
75   public:
76     ScopedBrk() : saved_brk_(__bionic_brk) {}
77     virtual ~ScopedBrk() { __bionic_brk = saved_brk_; }
79   private:
80     void* saved_brk_;
81   };
83   ScopedBrk scope_brk;
85   // Set the current break to a point that will cause an overflow.
86   __bionic_brk = reinterpret_cast<void*>(static_cast<uintptr_t>(PTRDIFF_MAX) + 2);
88   // Can't increase by so much that we'd overflow.
89   ASSERT_EQ(reinterpret_cast<void*>(-1), sbrk(PTRDIFF_MAX));
90   ASSERT_EQ(ENOMEM, errno);
92   // Set the current break to a point that will cause an overflow.
93   __bionic_brk = reinterpret_cast<void*>(static_cast<uintptr_t>(PTRDIFF_MAX));
95   ASSERT_EQ(reinterpret_cast<void*>(-1), sbrk(PTRDIFF_MIN));
96   ASSERT_EQ(ENOMEM, errno);
98   __bionic_brk = reinterpret_cast<void*>(static_cast<uintptr_t>(PTRDIFF_MAX) - 1);
100   ASSERT_EQ(reinterpret_cast<void*>(-1), sbrk(PTRDIFF_MIN + 1));
101   ASSERT_EQ(ENOMEM, errno);
102 #else
103   class ScopedBrk {
104   public:
105     ScopedBrk() : saved_brk_(get_brk()) {}
106     virtual ~ScopedBrk() { brk(saved_brk_); }
108   private:
109     void* saved_brk_;
110   };
112   ScopedBrk scope_brk;
114   uintptr_t cur_brk = reinterpret_cast<uintptr_t>(get_brk());
115   if (cur_brk < static_cast<uintptr_t>(-(SBRK_MIN+1))) {
116     // Do the overflow test for a max negative increment.
117     ASSERT_EQ(reinterpret_cast<void*>(-1), sbrk(SBRK_MIN));
118 #if defined(__BIONIC__)
119     // GLIBC does not set errno in overflow case.
120     ASSERT_EQ(ENOMEM, errno);
121 #endif
122   }
124   uintptr_t overflow_brk = static_cast<uintptr_t>(SBRK_MAX) + 2;
125   if (cur_brk < overflow_brk) {
126     // Try and move the value to PTRDIFF_MAX + 2.
127     cur_brk = reinterpret_cast<uintptr_t>(sbrk(overflow_brk));
128   }
129   if (cur_brk >= overflow_brk) {
130     ASSERT_EQ(reinterpret_cast<void*>(-1), sbrk(SBRK_MAX));
131 #if defined(__BIONIC__)
132     // GLIBC does not set errno in overflow case.
133     ASSERT_EQ(ENOMEM, errno);
134 #endif
135   }
136 #endif
139 TEST(unistd, truncate) {
140   TemporaryFile tf;
141   ASSERT_EQ(0, close(tf.fd));
142   ASSERT_EQ(0, truncate(tf.filename, 123));
144   struct stat sb;
145   ASSERT_EQ(0, stat(tf.filename, &sb));
146   ASSERT_EQ(123, sb.st_size);
149 TEST(unistd, truncate64) {
150   TemporaryFile tf;
151   ASSERT_EQ(0, close(tf.fd));
152   ASSERT_EQ(0, truncate64(tf.filename, 123));
154   struct stat sb;
155   ASSERT_EQ(0, stat(tf.filename, &sb));
156   ASSERT_EQ(123, sb.st_size);
159 TEST(unistd, ftruncate) {
160   TemporaryFile tf;
161   ASSERT_EQ(0, ftruncate(tf.fd, 123));
162   ASSERT_EQ(0, close(tf.fd));
164   struct stat sb;
165   ASSERT_EQ(0, stat(tf.filename, &sb));
166   ASSERT_EQ(123, sb.st_size);
169 TEST(unistd, ftruncate64) {
170   TemporaryFile tf;
171   ASSERT_EQ(0, ftruncate64(tf.fd, 123));
172   ASSERT_EQ(0, close(tf.fd));
174   struct stat sb;
175   ASSERT_EQ(0, stat(tf.filename, &sb));
176   ASSERT_EQ(123, sb.st_size);
179 static bool g_pause_test_flag = false;
180 static void PauseTestSignalHandler(int) {
181   g_pause_test_flag = true;
184 TEST(unistd, pause) {
185   ScopedSignalHandler handler(SIGALRM, PauseTestSignalHandler);
187   alarm(1);
188   ASSERT_FALSE(g_pause_test_flag);
189   ASSERT_EQ(-1, pause());
190   ASSERT_TRUE(g_pause_test_flag);
193 TEST(unistd, read) {
194   int fd = open("/proc/version", O_RDONLY);
195   ASSERT_TRUE(fd != -1);
197   char buf[5];
198   ASSERT_EQ(5, read(fd, buf, 5));
199   ASSERT_EQ(buf[0], 'L');
200   ASSERT_EQ(buf[1], 'i');
201   ASSERT_EQ(buf[2], 'n');
202   ASSERT_EQ(buf[3], 'u');
203   ASSERT_EQ(buf[4], 'x');
204   close(fd);
207 TEST(unistd, read_EBADF) {
208   // read returns ssize_t which is 64-bits on LP64, so it's worth explicitly checking that
209   // our syscall stubs correctly return a 64-bit -1.
210   char buf[1];
211   ASSERT_EQ(-1, read(-1, buf, sizeof(buf)));
212   ASSERT_EQ(EBADF, errno);
215 TEST(unistd, syscall_long) {
216   // Check that syscall(3) correctly returns long results.
217   // https://code.google.com/p/android/issues/detail?id=73952
218   // We assume that the break is > 4GiB, but this is potentially flaky.
219   uintptr_t p = reinterpret_cast<uintptr_t>(sbrk(0));
220   ASSERT_EQ(p, static_cast<uintptr_t>(syscall(__NR_brk, 0)));
223 TEST(unistd, alarm) {
224   ASSERT_EQ(0U, alarm(0));
227 TEST(unistd, _exit) {
228   int pid = fork();
229   ASSERT_NE(-1, pid) << strerror(errno);
231   if (pid == 0) {
232     _exit(99);
233   }
235   int status;
236   ASSERT_EQ(pid, waitpid(pid, &status, 0));
237   ASSERT_TRUE(WIFEXITED(status));
238   ASSERT_EQ(99, WEXITSTATUS(status));
241 TEST(unistd, getenv_unsetenv) {
242   ASSERT_EQ(0, setenv("test-variable", "hello", 1));
243   ASSERT_STREQ("hello", getenv("test-variable"));
244   ASSERT_EQ(0, unsetenv("test-variable"));
245   ASSERT_TRUE(getenv("test-variable") == NULL);
248 TEST(unistd, unsetenv_EINVAL) {
249   EXPECT_EQ(-1, unsetenv(""));
250   EXPECT_EQ(EINVAL, errno);
251   EXPECT_EQ(-1, unsetenv("a=b"));
252   EXPECT_EQ(EINVAL, errno);
255 TEST(unistd, setenv_EINVAL) {
256   EXPECT_EQ(-1, setenv(NULL, "value", 0));
257   EXPECT_EQ(EINVAL, errno);
258   EXPECT_EQ(-1, setenv(NULL, "value", 1));
259   EXPECT_EQ(EINVAL, errno);
260   EXPECT_EQ(-1, setenv("", "value", 0));
261   EXPECT_EQ(EINVAL, errno);
262   EXPECT_EQ(-1, setenv("", "value", 1));
263   EXPECT_EQ(EINVAL, errno);
264   EXPECT_EQ(-1, setenv("a=b", "value", 0));
265   EXPECT_EQ(EINVAL, errno);
266   EXPECT_EQ(-1, setenv("a=b", "value", 1));
267   EXPECT_EQ(EINVAL, errno);
270 TEST(unistd, setenv) {
271   ASSERT_EQ(0, unsetenv("test-variable"));
273   char a[] = "a";
274   char b[] = "b";
275   char c[] = "c";
277   // New value.
278   EXPECT_EQ(0, setenv("test-variable", a, 0));
279   EXPECT_STREQ(a, getenv("test-variable"));
281   // Existing value, no overwrite.
282   EXPECT_EQ(0, setenv("test-variable", b, 0));
283   EXPECT_STREQ(a, getenv("test-variable"));
285   // Existing value, overwrite.
286   EXPECT_EQ(0, setenv("test-variable", c, 1));
287   EXPECT_STREQ(c, getenv("test-variable"));
288   // But the arrays backing the values are unchanged.
289   EXPECT_EQ('a', a[0]);
290   EXPECT_EQ('b', b[0]);
291   EXPECT_EQ('c', c[0]);
293   ASSERT_EQ(0, unsetenv("test-variable"));
296 TEST(unistd, putenv) {
297   ASSERT_EQ(0, unsetenv("a"));
299   char* s1 = strdup("a=b");
300   ASSERT_EQ(0, putenv(s1));
302   ASSERT_STREQ("b", getenv("a"));
303   s1[2] = 'c';
304   ASSERT_STREQ("c", getenv("a"));
306   char* s2 = strdup("a=b");
307   ASSERT_EQ(0, putenv(s2));
309   ASSERT_STREQ("b", getenv("a"));
310   ASSERT_EQ('c', s1[2]);
312   ASSERT_EQ(0, unsetenv("a"));
313   free(s1);
314   free(s2);
317 TEST(unistd, clearenv) {
318   extern char** environ;
320   // Guarantee that environ is not initially empty...
321   ASSERT_EQ(0, setenv("test-variable", "a", 1));
323   // Stash a copy.
324   std::vector<char*> old_environ;
325   for (size_t i = 0; environ[i] != NULL; ++i) {
326     old_environ.push_back(strdup(environ[i]));
327   }
329   ASSERT_EQ(0, clearenv());
331   EXPECT_TRUE(environ == NULL || environ[0] == NULL);
332   EXPECT_EQ(NULL, getenv("test-variable"));
333   EXPECT_EQ(0, setenv("test-variable", "post-clear", 1));
334   EXPECT_STREQ("post-clear", getenv("test-variable"));
336   // Put the old environment back.
337   for (size_t i = 0; i < old_environ.size(); ++i) {
338     EXPECT_EQ(0, putenv(old_environ[i]));
339   }
341   // Check it wasn't overwritten.
342   EXPECT_STREQ("a", getenv("test-variable"));
344   EXPECT_EQ(0, unsetenv("test-variable"));
347 static void TestFsyncFunction(int (*fn)(int)) {
348   int fd;
350   // Can't sync an invalid fd.
351   errno = 0;
352   EXPECT_EQ(-1, fn(-1));
353   EXPECT_EQ(EBADF, errno);
355   // It doesn't matter whether you've opened a file for write or not.
356   TemporaryFile tf;
357   ASSERT_NE(-1, tf.fd);
359   EXPECT_EQ(0, fn(tf.fd));
361   ASSERT_NE(-1, fd = open(tf.filename, O_RDONLY));
362   EXPECT_EQ(0, fn(fd));
363   close(fd);
365   ASSERT_NE(-1, fd = open(tf.filename, O_RDWR));
366   EXPECT_EQ(0, fn(fd));
367   close(fd);
369   // The fd can even be a directory.
370   ASSERT_NE(-1, fd = open("/", O_RDONLY));
371   EXPECT_EQ(0, fn(fd));
372   close(fd);
374   // But some file systems may choose to be fussy...
375   errno = 0;
376   ASSERT_NE(-1, fd = open("/proc/version", O_RDONLY));
377   EXPECT_EQ(-1, fn(fd));
378   EXPECT_EQ(EINVAL, errno);
379   close(fd);
382 TEST(unistd, fdatasync) {
383   TestFsyncFunction(fdatasync);
386 TEST(unistd, fsync) {
387   TestFsyncFunction(fsync);
390 static void AssertGetPidCorrect() {
391   // The loop is just to make manual testing/debugging with strace easier.
392   pid_t getpid_syscall_result = syscall(__NR_getpid);
393   for (size_t i = 0; i < 128; ++i) {
394     ASSERT_EQ(getpid_syscall_result, getpid());
395   }
398 TEST(unistd, getpid_caching_and_fork) {
399   pid_t parent_pid = getpid();
400   ASSERT_EQ(syscall(__NR_getpid), parent_pid);
402   pid_t fork_result = fork();
403   ASSERT_NE(fork_result, -1);
404   if (fork_result == 0) {
405     // We're the child.
406     AssertGetPidCorrect();
407     ASSERT_EQ(parent_pid, getppid());
408     _exit(123);
409   } else {
410     // We're the parent.
411     ASSERT_EQ(parent_pid, getpid());
413     int status;
414     ASSERT_EQ(fork_result, waitpid(fork_result, &status, 0));
415     ASSERT_TRUE(WIFEXITED(status));
416     ASSERT_EQ(123, WEXITSTATUS(status));
417   }
420 static int GetPidCachingCloneStartRoutine(void*) {
421   AssertGetPidCorrect();
422   return 123;
425 TEST(unistd, getpid_caching_and_clone) {
426   pid_t parent_pid = getpid();
427   ASSERT_EQ(syscall(__NR_getpid), parent_pid);
429   void* child_stack[1024];
430   int clone_result = clone(GetPidCachingCloneStartRoutine, &child_stack[1024], CLONE_NEWNS | SIGCHLD, NULL);
431   if (clone_result == -1 && errno == EPERM && getuid() != 0) {
432     GTEST_LOG_(INFO) << "This test only works if you have permission to CLONE_NEWNS; try running as root.\n";
433     return;
434   }
435   ASSERT_NE(clone_result, -1);
437   ASSERT_EQ(parent_pid, getpid());
439   int status;
440   ASSERT_EQ(clone_result, waitpid(clone_result, &status, 0));
441   ASSERT_TRUE(WIFEXITED(status));
442   ASSERT_EQ(123, WEXITSTATUS(status));
445 static void* GetPidCachingPthreadStartRoutine(void*) {
446   AssertGetPidCorrect();
447   return NULL;
450 TEST(unistd, getpid_caching_and_pthread_create) {
451   pid_t parent_pid = getpid();
453   pthread_t t;
454   ASSERT_EQ(0, pthread_create(&t, NULL, GetPidCachingPthreadStartRoutine, NULL));
456   ASSERT_EQ(parent_pid, getpid());
458   void* result;
459   ASSERT_EQ(0, pthread_join(t, &result));
460   ASSERT_EQ(NULL, result);
463 class unistd_DeathTest : public BionicDeathTest {};
465 TEST_F(unistd_DeathTest, abort) {
466   ASSERT_EXIT(abort(), testing::KilledBySignal(SIGABRT), "");
469 TEST(unistd, sethostname) {
470   // The permissions check happens before the argument check, so this will
471   // fail for a different reason if you're running as root than if you're
472   // not, but it'll fail either way. Checking that we have the symbol is about
473   // all we can do for sethostname(2).
474   ASSERT_EQ(-1, sethostname("", -1));
477 TEST(unistd, gethostname) {
478   char hostname[HOST_NAME_MAX + 1];
479   memset(hostname, 0, sizeof(hostname));
481   // Can we get the hostname with a big buffer?
482   ASSERT_EQ(0, gethostname(hostname, HOST_NAME_MAX));
484   // Can we get the hostname with a right-sized buffer?
485   errno = 0;
486   ASSERT_EQ(0, gethostname(hostname, strlen(hostname) + 1));
488   // Does uname(2) agree?
489   utsname buf;
490   ASSERT_EQ(0, uname(&buf));
491   ASSERT_EQ(0, strncmp(hostname, buf.nodename, SYS_NMLN));
492   ASSERT_GT(strlen(hostname), 0U);
494   // Do we correctly detect truncation?
495   errno = 0;
496   ASSERT_EQ(-1, gethostname(hostname, strlen(hostname)));
497   ASSERT_EQ(ENAMETOOLONG, errno);
500 TEST(unistd, pathconf_fpathconf) {
501   TemporaryFile tf;
502   long rc = 0L;
503   // As a file system's block size is always power of 2, the configure values
504   // for ALLOC and XFER should be power of 2 as well.
505   rc = pathconf(tf.filename, _PC_ALLOC_SIZE_MIN);
506   ASSERT_TRUE(rc > 0 && powerof2(rc));
507   rc = pathconf(tf.filename, _PC_REC_MIN_XFER_SIZE);
508   ASSERT_TRUE(rc > 0 && powerof2(rc));
509   rc = pathconf(tf.filename, _PC_REC_XFER_ALIGN);
510   ASSERT_TRUE(rc > 0 && powerof2(rc));
512   rc = fpathconf(tf.fd, _PC_ALLOC_SIZE_MIN);
513   ASSERT_TRUE(rc > 0 && powerof2(rc));
514   rc = fpathconf(tf.fd, _PC_REC_MIN_XFER_SIZE);
515   ASSERT_TRUE(rc > 0 && powerof2(rc));
516   rc = fpathconf(tf.fd, _PC_REC_XFER_ALIGN);
517   ASSERT_TRUE(rc > 0 && powerof2(rc));
520 #define verifySysconf(name, ret) \
521 {\
522   errno = 0;\
523   ret = sysconf(name);\
524   ASSERT_TRUE((0 == errno) && (-1 != ret)) << "name=" << #name << ", ret=" << ret << ", Error Message: " << strerror(errno);\
525 }\
527 TEST(unistd, sysconf) {
528   long ret;
530   verifySysconf(_SC_MONOTONIC_CLOCK, ret);
531   ASSERT_GT(ret, 0);
532   verifySysconf(_SC_ARG_MAX, ret);
533   ASSERT_GT(ret, 0);
534   verifySysconf(_SC_CHILD_MAX, ret);
535   ASSERT_GT(ret, 0);
536   verifySysconf(_SC_CLK_TCK, ret);
537   ASSERT_GT(ret, 0);
538   verifySysconf(_SC_LINE_MAX, ret);
539   ASSERT_GT(ret, 1);
540   verifySysconf(_SC_NGROUPS_MAX, ret);
541   ASSERT_GT(ret, 0);
542   verifySysconf(_SC_OPEN_MAX, ret);
543   ASSERT_GT(ret, 1);
544   verifySysconf(_SC_2_C_BIND, ret);
545   ASSERT_GT(ret, 0);
546   verifySysconf(_SC_2_C_VERSION, ret);
547   verifySysconf(_SC_JOB_CONTROL, ret);
548   ASSERT_EQ(1, ret);
549   verifySysconf(_SC_SAVED_IDS, ret);
550   ASSERT_EQ(1, ret);
551   verifySysconf(_SC_VERSION, ret);
552   verifySysconf(_SC_RE_DUP_MAX, ret);
553   verifySysconf(_SC_STREAM_MAX, ret);
554   ASSERT_GT(ret, 0);
555   verifySysconf(_SC_TZNAME_MAX, ret);
556   verifySysconf(_SC_XOPEN_VERSION, ret);
557   verifySysconf(_SC_ATEXIT_MAX, ret);
558   ASSERT_GT(ret, 1);
559   verifySysconf(_SC_IOV_MAX, ret);
560   ASSERT_GT(ret, 0);
561   verifySysconf(_SC_PAGESIZE, ret);
562   ASSERT_GE(ret, 1);
563   verifySysconf(_SC_PAGE_SIZE, ret);
564   ASSERT_GE(ret, 1);
565   verifySysconf(_SC_XOPEN_UNIX, ret);
566   verifySysconf(_SC_DELAYTIMER_MAX, ret);
567   ASSERT_GT(ret, 0);
568   verifySysconf(_SC_MQ_OPEN_MAX, ret);
569   verifySysconf(_SC_MQ_PRIO_MAX, ret);
570   ASSERT_GT(ret ,0);
571   verifySysconf(_SC_RTSIG_MAX, ret);
572   verifySysconf(_SC_SEM_NSEMS_MAX, ret);
573   verifySysconf(_SC_SEM_VALUE_MAX, ret);
574   verifySysconf(_SC_SIGQUEUE_MAX, ret);
575   ASSERT_GT(ret, 0);
576   verifySysconf(_SC_TIMER_MAX, ret);
577   verifySysconf(_SC_FSYNC, ret);
578   verifySysconf(_SC_MAPPED_FILES, ret);
579   verifySysconf(_SC_PRIORITY_SCHEDULING, ret);
580   verifySysconf(_SC_SEMAPHORES, ret);
581   verifySysconf(_SC_SYNCHRONIZED_IO, ret);
582   verifySysconf(_SC_TIMERS, ret);
583   verifySysconf(_SC_GETGR_R_SIZE_MAX, ret);
584   verifySysconf(_SC_GETPW_R_SIZE_MAX, ret);
585   verifySysconf(_SC_LOGIN_NAME_MAX, ret);
586   verifySysconf(_SC_THREAD_DESTRUCTOR_ITERATIONS, ret);
587   verifySysconf(_SC_THREAD_KEYS_MAX, ret);
588   verifySysconf(_SC_THREAD_STACK_MIN, ret);
589   verifySysconf(_SC_THREAD_THREADS_MAX, ret);
590   verifySysconf(_SC_TTY_NAME_MAX, ret);
591   ASSERT_GT(ret, 0);
592   verifySysconf(_SC_THREADS, ret);
593   verifySysconf(_SC_THREAD_PRIO_INHERIT, ret);
594   verifySysconf(_SC_THREAD_PRIO_PROTECT, ret);
595   verifySysconf(_SC_NPROCESSORS_CONF, ret);
596   verifySysconf(_SC_NPROCESSORS_ONLN, ret);
597   verifySysconf(_SC_PHYS_PAGES, ret);
598   verifySysconf(_SC_AVPHYS_PAGES, ret);
600   //  TODO: keep following names check here
601   //  so that we can enable them when the error fixed
603   /* when call sysconf with following name,
604      the system call will report error "Function not implemented"
606   verifySysconf(_SC_BC_BASE_MAX, ret);
607   verifySysconf(_SC_BC_DIM_MAX, ret);
608   verifySysconf(_SC_BC_SCALE_MAX, ret);
609   verifySysconf(_SC_BC_STRING_MAX, ret);
610   verifySysconf(_SC_COLL_WEIGHTS_MAX, ret);
611   verifySysconf(_SC_EXPR_NEST_MAX, ret);
612   verifySysconf(_SC_XOPEN_SHM, ret);
613   verifySysconf(_SC_XBS5_ILP32_OFF32, ret);
614   verifySysconf(_SC_XBS5_ILP32_OFFBIG, ret);
615   verifySysconf(_SC_XBS5_LP64_OFF64, ret);
616   verifySysconf(_SC_XBS5_LPBIG_OFFBIG, ret);
617   verifySysconf(_SC_AIO_LISTIO_MAX, ret);
618   verifySysconf(_SC_AIO_MAX, ret);
619   verifySysconf(_SC_AIO_PRIO_DELTA_MAX, ret);
620   verifySysconf(_SC_ASYNCHRONOUS_IO, ret);
621   verifySysconf(_SC_MEMLOCK, ret);
622   verifySysconf(_SC_MEMLOCK_RANGE, ret);
623   verifySysconf(_SC_MEMORY_PROTECTION, ret);
624   verifySysconf(_SC_MESSAGE_PASSING, ret);
625   verifySysconf(_SC_PRIORITIZED_IO, ret);
626   verifySysconf(_SC_SHARED_MEMORY_OBJECTS, ret);
627   verifySysconf(_SC_THREAD_SAFE_FUNCTIONS, ret);
629   */
631   /* when following names are checked,
632      the return value of sysconf is -1,
633      which means following name are invalid.
635   verifySysconf(_SC_2_C_DEV, ret);
636   verifySysconf(_SC_2_FORT_DEV, ret);
637   verifySysconf(_SC_2_FORT_RUN, ret);
638   verifySysconf(_SC_2_LOCALEDEF, ret);
639   verifySysconf(_SC_2_SW_DEV, ret);
640   verifySysconf(_SC_2_UPE, ret);
641   verifySysconf(_SC_2_VERSION, ret);
642   verifySysconf(_SC_XOPEN_CRYPT, ret);
643   verifySysconf(_SC_XOPEN_ENH_I18N, ret);
644   verifySysconf(_SC_XOPEN_XCU_VERSION, ret);
645   verifySysconf(_SC_XOPEN_REALTIME, ret);
646   verifySysconf(_SC_XOPEN_REALTIME_THREADS, ret);
647   verifySysconf(_SC_XOPEN_LEGACY, ret);
648   verifySysconf(_SC_THREAD_ATTR_STACKADDR, ret);
649   verifySysconf(_SC_THREAD_ATTR_STACKSIZE, ret);
650   verifySysconf(_SC_REALTIME_SIGNALS, ret);
652   */