int have_asynchio (void) { #if defined (_POSIX_ASYNCHRONOUS_IO) // POSIX Asynch IO is present in this system. #if defined (_POSIX_ASYNC_IO) // If this is defined and it is not -1, POSIX_ASYNCH is supported // everywhere in the system. #if _POSIX_ASYNC_IO == -1 printf ("_POSIX_ASYNC_IO = -1.. ASYNCH IO NOT supported at all\n"); return -1; #else /* Not _POSIX_ASYNC_IO == -1 */ printf ("_POSIX_ASYNC_IO = %d\n ASYNCH IO is supported FULLY\n", _POSIX_ASYNC_IO); #endif /* _POSIX_ASYNC_IO == -1 */ #else /* Not defined _POSIX_ASYNC_IO */ printf ("_POSIX_ASYNC_IO is not defined.\n"); printf ("AIO might *not* be supported on some paths\n"); #endif /* _POSIX_ASYNC_IO */ // System defined POSIX Values. printf ("System claims to have POSIX_ASYNCHRONOUS_IO\n"); printf ("_POSIX_AIO_LISTIO_MAX = %d\n", _POSIX_AIO_LISTIO_MAX); printf ("_POSIX_AIO_MAX = %d\n", _POSIX_AIO_MAX); // Check and print the run time values. do_sysconf (); return 0; #else /* Not _POSIX_ASYNCHRONOUS_IO */ printf ("No support._POSIX_ASYNCHRONOUS_IO itself is not defined\n"); return -1; #endif /* _POSIX_ASYNCHRONOUS_IO */ }
int main(int argc, char **argv) { int c, key, valid; const char *name, *vflag, *alt_path; intmax_t limitval; vflag = NULL; while ((c = getopt(argc, argv, "v:")) != -1) { switch (c) { case 'v': vflag = optarg; break; default: usage(); } } if ((name = argv[optind]) == NULL) usage(); if (vflag != NULL) { if ((valid = find_progenv(vflag, &alt_path)) == 0) errx(EX_USAGE, "invalid programming environment %s", vflag); if (valid > 0 && alt_path != NULL) { if (argv[optind + 1] == NULL) execl(alt_path, "getconf", argv[optind], (char *)NULL); else execl(alt_path, "getconf", argv[optind], argv[optind + 1], (char *)NULL); err(EX_OSERR, "execl: %s", alt_path); } if (valid < 0) errx(EX_UNAVAILABLE, "environment %s is not available", vflag); } if (argv[optind + 1] == NULL) { /* confstr or sysconf */ if ((valid = find_limit(name, &limitval)) != 0) { if (valid > 0) printf("%" PRIdMAX "\n", limitval); else printf("undefined\n"); return 0; } if ((valid = find_confstr(name, &key)) != 0) { if (valid > 0) do_confstr(name, key); else printf("undefined\n"); } else { valid = find_sysconf(name, &key); if (valid > 0) { do_sysconf(name, key); } else if (valid < 0) { printf("undefined\n"); } else errx(EX_USAGE, "no such configuration parameter `%s'", name); } } else { valid = find_pathconf(name, &key); if (valid != 0) { if (valid > 0) do_pathconf(name, key, argv[optind + 1]); else printf("undefined\n"); } else errx(EX_USAGE, "no such path configuration parameter `%s'", name); } return 0; }
static int have_asynchio (void) { #if defined (_POSIX_ASYNCHRONOUS_IO) #if defined (_POSIX_ASYNC_IO) #if _POSIX_ASYNC_IO == -1 ACE_DEBUG ((LM_DEBUG, "_POSIX_ASYNC_IO = -1.. ASYNCH IO NOT supported at all\n")); return -1; #else /* Not _POSIX_ASYNC_IO == -1 */ ACE_DEBUG ((LM_DEBUG, "_POSIX_ASYNC_IO = %d\n ASYNCH IO is supported FULLY\n", _POSIX_ASYNC_IO)); #endif /* _POSIX_ASYNC_IO == -1 */ #else /* Not defined _POSIX_ASYNC_IO */ ACE_ERROR ((LM_DEBUG, "_POSIX_ASYNC_IO is not defined.\n")); ACE_DEBUG ((LM_DEBUG, "AIO might *not* be supported on all the paths\n")); #endif /* _POSIX_ASYNC_IO */ // System defined POSIX Values. ACE_DEBUG ((LM_DEBUG, "System claims to have POSIX_ASYNCHRONOUS_IO\n")); #if defined(_POSIX_AIO_LISTIO_MAX) ACE_DEBUG ((LM_DEBUG, "Number of operations in one listio: " "Minimum value is 2: " "_POSIX_AIO_LISTIO_MAX = %d\n", _POSIX_AIO_LISTIO_MAX)); #else ACE_DEBUG ((LM_DEBUG, "No value for _POSIX_AIO_LISTIO_MAX\n")); #endif #if defined(_POSIX_AIO_MAX) ACE_DEBUG ((LM_DEBUG, "Number of simultaneous asynchronous I/Os: " "Minimum is 1: " "_POSIX_AIO_MAX = %d\n", _POSIX_AIO_MAX)); #else ACE_DEBUG ((LM_DEBUG, "No value for _POSIX_AIO_MAX\n")); #endif // @@ Debugging. ACE_DEBUG ((LM_DEBUG, "Before do_sysconf : Errno %d\n", errno)); // Check and print the run time values. do_sysconf (); // @@ Debugging. ACE_DEBUG ((LM_DEBUG, "After do_sysconf: Errno : %d\n", errno)); return 0; #else /* Not _POSIX_ASYNCHRONOUS_IO */ ACE_DEBUG ((LM_DEBUG, "No support._POSIX_ASYNCHRONOUS_IO itself is not defined\n")); return -1; #endif /* _POSIX_ASYNCHRONOUS_IO */ }