00001 /* 00002 POSIX System Capabilities 00003 AUP2, Sec. 1.5.4 (not in book) 00004 Not written by Marc Rochkind. 00005 00006 The Example Files are provided "as is," without any warranty; 00007 without even the implied warranty of merchantability or fitness 00008 for a particular purpose. The author and his publisher are not 00009 responsible for any damages, direct or incidental, resulting 00010 from the use or non-use of these Example Files. 00011 00012 The Example Files may contain defects, and some contain deliberate 00013 coding mistakes that were included for educational reasons. 00014 You are responsible for determining if and how the Example Files 00015 are to be used. 00016 00017 */ 00018 #if defined(FREEBSD) || defined(DARWIN) /* won't compile on FREEBSD or DARWIN */ 00019 /* Didn't use BSD_DERIVED, because it's possible 00020 that a system like that will work. 00021 */ 00022 #include "defs.h" 00023 00024 int main(void) 00025 { 00026 printf("Not supported on FreeBSD.\n"); 00027 exit(EXIT_FAILURE); 00028 } 00029 #else 00030 /* 00031 This program was NOT written by Marc Rochkind. It was downloaded 00032 from: 00033 00034 http://www.comptechdoc.org/os/linux/programming/c/linux_pgc.html 00035 00036 and is part of "Linux C and C++ Programmer's Guide" 00037 00038 Everything below the horizontal line came from that site. 00039 00040 (MJR changed C++ comments to C and %ld to %ld) 00041 00042 -------------------------------------------------------------- 00043 00044 POSIX System Capabilities 00045 This section explains how to determine if various parts of POSIX are supported by your system. The easiest way to do this is to look at /usr/include/unistd.h on the system. This file will define the _POSIX_SOURCE versions. It may include other header files which include POSIX definitions. One that you should look at is /usr/include/bits/posix_opt.h which should have most of the POSIX definitions. All the below parameters are listed there. However, the most sure way is to run the below program. This is because the /usr/include/inistd.h file may not be the only one available and it may not be used by your system. Also you need to be aware your kernel may not support all the listed functions. It will depend on the library used to compile it and the options used at the compile time. The kernel will have a great affect on the support of POSIX.4 functions since it controls memory allocation and processes, including the signals between them. 00046 00047 The Test Program 00048 The program listing below will output values based on what your system supports. I call it "posixtst.c". This is a tar and gz version of the source and binary program with a small README file with install instructions. posixtst-1.0.0 00049 */ 00050 #define _POSIX_SOURCE 00051 #define _POSIX_C_SOURCE 199309 00052 #include <unistd.h> 00053 #include <stdio.h> /* mjr */ 00054 long val; 00055 int errno; 00056 00057 int main(void) /* mjr */ 00058 { 00059 #ifndef _POSIX_VERSION 00060 printf("No support for POSIX on this system!\n"); 00061 #else /*see what POSIX version*/ 00062 printf("POSIX_VERSION = %ld.\n",_POSIX_VERSION); 00063 printf("POSIX2_VERSION = %ld.\n",_POSIX2_VERSION); 00064 printf("POSIX2_C_VERSION = %ld.\n",_POSIX2_C_VERSION); 00065 #if _POSIX_VERSION == 199009 00066 printf("This system supports POSIX.1 without support for POSIX.4.\n"); 00067 #else 00068 #if _POSIX_VERSION >= 199309 00069 printf ("This system supports POSIX.1 and POSIX.4. \n"); 00070 #else 00071 printf("This system supports a strange POSIX version between 199009 and 199309.\n"); 00072 #endif 00073 /*DO POSIX.4 tests*/ 00074 printf ("POSIX.4 Options Test Results:\n"); 00075 #ifdef _POSIX_REALTIME_SIGNALS 00076 printf(" POSIX.4 Additional real time signals are supported.\n"); 00077 #ifdef _POSIX_RTSIG_MAX 00078 printf(" _POSIX_RTSIG_MAX=%ld Max real time signals.\n",_POSIX_RTSIG_MAX); 00079 #else 00080 printf(" No _POSIX_RTSIG_MAX value exists.\n"); 00081 #endif 00082 #ifdef _POSIX_SIGQUEUE_MAX 00083 printf(" _POSIX_SIGQUEUE_MAX=%ld Max real time signals at once per process.\n",_POSIX_RTQUEUE_MAX); 00084 #else 00085 printf(" No _POSIX_SIGQUEUE_MAX value exists.\n"); 00086 #endif 00087 #else 00088 printf(" POSIX.4 Additional real time signals are not supported.\n"); 00089 #endif 00090 #ifdef _POSIX_PRIORITY_SCHEDULING 00091 printf(" POSIX.4 Priority scheduling is supported.\n"); 00092 #else 00093 printf(" POSIX.4 Priority scheduling is not supported.\n"); 00094 #endif 00095 #ifdef _POSIX_TIMERS 00096 printf(" POSIX.4 Clocks and timers are supported.\n"); 00097 #ifdef _POSIX_TIMER_MAX 00098 printf(" _POSIX_TIMER_MAX=%ld Max number of concurrent timers a process can have.\n",_POSIX_TIMER_MAX); 00099 #else 00100 printf(" No _POSIX_TIMER_MAX value exists.\n"); 00101 #endif 00102 #ifdef _POSIX_DELAYTIMER_MAX 00103 printf(" _POSIX_DELAYTIMER_MAX=%ld Max number of times a timer can have a detectable overrun.\n",_POSIX_DELAYTIMER_MAX); 00104 #else 00105 printf(" No _POSIX_DELAYTIMER_MAX value exists.\n"); 00106 #endif 00107 #else 00108 printf(" POSIX.4 Clocks and timers are not supported.\n"); 00109 #endif 00110 #ifdef _POSIX_ASYNCHRONOUS_IO 00111 printf(" POSIX.4 Asynchronous I/O is supported.\n"); 00112 #ifdef _POSIX_AIO_LISTIO_MAX 00113 printf(" _POSIX_AIO_LISTIO_MAX=%ld Max operations in one call\n",_POSIX_AIO_LISTIO_MAX); 00114 #else 00115 printf(" No _POSIX_AIO_LISTIO_MAX value exists.\n"); 00116 #endif 00117 #ifdef _POSIX_AIO_MAX 00118 printf(" _POSIX_AIO_MAX=%ld Max concurrent Async I/Os\n",_POSIX_AIO_MAX); 00119 #else 00120 printf(" No _POSIX_AIO_MAX value exists.\n"); 00121 #endif 00122 #else 00123 printf(" POSIX.4 Asynchronous I/O is not supported.\n"); 00124 #endif 00125 #ifdef _POSIX_SYNCHRONIZED_IO /*Only supported if Asynchronous I/O is supported*/ 00126 printf(" POSIX.4 Synchronized I/O is supported.\n"); 00127 #else 00128 printf(" POSIX.4 Synchronized I/O is not supported.\n"); 00129 #endif 00130 #ifdef _POSIX_PRIORITIZED_IO 00131 printf(" POSIX.4 Prioritized asynchronous I/O is supported.\n"); 00132 #ifdef _POSIX_AIO_PRIO_DELTA_MAX 00133 printf(" _POSIX_AIO_PRIO_DELTA_MAX=%ld Max amount AIO priority can be decreased.\n",_POSIX_AIO_PRIO_DELTA_MAX); 00134 #else 00135 printf(" No _POSIX_AIO_PRIO_DELTA_MAX value exists.\n"); 00136 #endif 00137 #else 00138 printf(" POSIX.4 Prioritized asynchronous I/O is not supported.\n"); 00139 #endif 00140 #ifdef _POSIX_FSYNC 00141 printf(" POSIX.4 The fsync function is supported.\n"); 00142 #else 00143 printf(" POSIX.4 The fsync function is not supported.\n"); 00144 #endif 00145 #ifdef _POSIX_MAPPED_FILES 00146 printf(" POSIX.4 Mapping files as memory is supported.\n"); 00147 #else 00148 printf(" POSIX.4 Mapping files as memory is not supported.\n"); 00149 #endif 00150 #ifdef _POSIX_MEMLOCK 00151 printf(" POSIX.4 Locking memory is supported.\n"); 00152 #else 00153 printf(" POSIX.4 Locking memory is not supported.\n"); 00154 #endif 00155 #ifdef _POSIX_MEMLOCK_RANGE 00156 printf(" POSIX.4 Locking memory ranges is supported.\n"); 00157 #else 00158 printf(" POSIX.4 Locking memory ranges is not supported.\n"); 00159 #endif 00160 #ifdef _POSIX_MEMORY_PROTECTION 00161 printf(" POSIX.4 Setting memory protection is supported.\n"); 00162 #else 00163 printf(" POSIX.4 Setting memory protection is not supported.\n"); 00164 #endif 00165 #ifdef _POSIX_MESSAGE_PASSING 00166 printf(" POSIX.4 Message Queues are supported.\n"); 00167 #ifdef _POSIX_MQ_OPEN_MAX 00168 printf(" _POSIX_MQ_OPEN_MAX=%ld Max # of message queues per process.\n",_POSIX_MQ_OPEN_MAX); 00169 #else 00170 printf(" No _POSIX_MQ_OPEN_MAX value exists.\n"); 00171 #endif 00172 #ifdef _POSIX_MQ_PRIO_MAX 00173 printf(" _POSIX_MQ_PRIO_MAX=%ld Max # of message priorities.\n",_POSIX_MQ_PRIO_MAX); 00174 #else 00175 printf(" No _POSIX_MQ_PRIO_MAX value exists.\n"); 00176 #endif 00177 #else 00178 printf(" POSIX.4 Message Queues are not supported.\n"); 00179 #endif 00180 #ifdef _POSIX_SEMAPHORES 00181 printf(" POSIX.4 Semaphores are supported.\n"); 00182 #ifdef _POSIX_SEM_NSEMS_MAX 00183 printf(" _POSIX_SEM_NSEMS_MAX=%ld Max # of open semaphores per process.\n",_POSIX_SEM_NSEMS_MAX); 00184 #else 00185 printf(" No _POSIX_SEM_NSEMS_MAX value exists.\n"); 00186 #endif 00187 #ifdef _POSIX_SEM_VALUE_MAX 00188 printf(" _POSIX_SEM_VALUE_MAX=%ld Maximum semaphore value.\n",_POSIX_SEM_VALUE_MAX); 00189 #else 00190 printf(" No _POSIX_SEM_VALUE_MAX value exists.\n"); 00191 #endif 00192 #else 00193 printf(" POSIX.4 Semaphores are not supported.\n"); 00194 #endif 00195 #ifdef _POSIX_SHARED_MEMORY_OBJECTS 00196 printf(" POSIX.4 Shared memory objects are supported.\n"); 00197 #else 00198 printf(" POSIX.4 Shared memory objects are not supported.\n"); 00199 #endif 00200 00201 #ifdef _POSIX_THREADS 00202 printf(" POSIX.1c pthreads are supported.\n"); 00203 #else 00204 printf(" POSIX.1c pthreads are not supported.\n"); 00205 #endif 00206 #ifdef _POSIX_THREAD_ATTR_STACKADDRTHREAD_ATTR_STACKADDR 00207 printf(" POSIX.4 Thread stack address attribute option is supported.\n"); 00208 #else 00209 printf(" POSIX.4 Thread stack address attribute option is not supported.\n"); 00210 #endif 00211 #ifdef _POSIX_THREAD_ATTR_STACKSIZE 00212 printf(" POSIX.4 Thread stack size attribute option is supported.\n"); 00213 #else 00214 printf(" POSIX.4 Thread stack size attribute option is not supported.\n"); 00215 #endif 00216 #ifdef _POSIX_THREAD_SAFE_FUNCTIONS 00217 printf(" POSIX.4 Thread-safe functions are supported.\n"); 00218 #else 00219 printf(" POSIX.4 Thread-safe functions are not supported.\n"); 00220 #endif 00221 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING 00222 printf(" POSIX.1c thread execution scheduling is supported.\n"); 00223 #else 00224 printf(" POSIX.1c thread execution scheduling is not supported.\n"); 00225 #endif 00226 #ifdef _POSIX_THREAD_PRIO_INHERIT 00227 printf(" POSIX.4 Thread priority inheritance option is supported.\n"); 00228 #else 00229 printf(" POSIX.4 Thread priority inheritance option is not supported.\n"); 00230 #endif 00231 #ifdef _POSIX_THREAD_PROCESS_SHARED 00232 printf(" POSIX.4 Process-shared synchronization is supported.\n"); 00233 #else 00234 printf(" POSIX.4 Process-shared synchronization is not supported.\n"); 00235 #endif 00236 #ifdef _POSIX_POSIX_PII 00237 printf(" Protocol-independent interfaces are supported.\n"); 00238 #else 00239 printf(" Protocol-independent interfaces are not supported.\n"); 00240 #endif 00241 #ifdef _POSIX_PII_XTI 00242 printf(" XTI protocol-indep. interfaces are supported.\n"); 00243 #else 00244 printf(" XTI protocol-indep. interfaces are not supported.\n"); 00245 #endif 00246 #ifdef _POSIX_PII_SOCKET 00247 printf(" Socket protocol-indep. interfaces are supported.\n"); 00248 #else 00249 printf(" Socket protocol-indep. interfaces are not supported.\n"); 00250 #endif 00251 #ifdef _POSIX_PII_INTERNET 00252 printf(" Internet family of protocols is supported.\n"); 00253 #else 00254 printf(" Internet family of protocols is not supported.\n"); 00255 #endif 00256 #ifdef _POSIX_PII_INTERNET_STREAM 00257 printf(" Connection-mode Internet protocol is supported.\n"); 00258 #else 00259 printf(" Connection-mode Internet protocol is not supported.\n"); 00260 #endif 00261 #ifdef _POSIX_PII_INTERNET_DGRAM 00262 printf(" Connectionless Internet protocol is supported.\n"); 00263 #else 00264 printf(" Connectionless Internet protocol is not supported.\n"); 00265 #endif 00266 #ifdef _POSIX_PII_OSI 00267 printf(" ISO/OSI family of protocols is supported.\n"); 00268 #else 00269 printf(" ISO/OSI family of protocols is not supported.\n"); 00270 #endif 00271 #ifdef _POSIX_PII_OSI_COTS 00272 printf(" Connection-mode ISO/OSI service is supported.\n"); 00273 #else 00274 printf(" Connection-mode ISO/OSI service is not supported.\n"); 00275 #endif 00276 #ifdef _POSIX_PII_OSI_CLTS 00277 printf(" Connectionless ISO/OSI service is supported.\n"); 00278 #else 00279 printf(" Connectionless ISO/OSI service is not supported.\n"); 00280 #endif 00281 #ifdef _POSIX_POLL 00282 printf(" Implementation supports `poll' function.\n"); 00283 #else 00284 printf(" poll function is not supported.\n"); 00285 #endif 00286 #ifdef _POSIX_SELECT 00287 printf(" Implementation supports `select' and `pselect'.\n"); 00288 #else 00289 printf(" Implementation does not support `select' and `pselect'.\n"); 00290 #endif 00291 #ifdef _XOPEN_REALTIME 00292 printf(" X/Open realtime support is available.\n"); 00293 #else 00294 printf(" X/Open realtime support is not available..\n"); 00295 #endif 00296 #ifdef _XOPEN_REALTIME_THREADS 00297 printf(" X/Open realtime thread support is available.\n"); 00298 #else 00299 printf(" X/Open realtime thread support is not available.\n"); 00300 #endif 00301 #ifdef _XOPEN_SHM 00302 printf(" XPG4.2 Shared memory interface is supported.\n"); 00303 #else 00304 printf(" XPG4.2 Shared memory interface is not supported.\n"); 00305 #endif 00306 #ifdef _XBS5_ILP32_OFF32 00307 printf(" 32-bit int, long, pointer, and off_t types are supported.\n"); 00308 #else 00309 printf(" 32-bit int, long, pointer, and off_t types are not supported.\n"); 00310 #endif 00311 #ifdef _XBS5_ILP32_OFFBIG 00312 printf(" 32-bit int, long, and pointer and off_t with at least 64 bits is supported.\n"); 00313 #else 00314 printf(" 32-bit int, long, and pointer and off_t with at least 64 bits is not supported.\n"); 00315 #endif 00316 #ifdef _XBS5_LP64_OFF64 00317 printf(" 32-bit int, and 64-bit long, pointer, and off_t types are supported.\n"); 00318 #else 00319 printf(" 32-bit int, and 64-bit long, pointer, and off_t types are not supported.\n"); 00320 #endif 00321 #ifdef _XBS5_LPBIG_OFFBIG 00322 printf(" 32 bits int and long, pointer, and off_t with at least 64 bits are supported.\n"); 00323 #else 00324 printf(" 32 bits int and long, pointer, and off_t with at least 64 bits are not supported.\n"); 00325 #endif 00326 00327 00328 #endif 00329 /*Do POSIX.1 tests*/ 00330 printf ("POSIX.1 Options Test Results:\n"); 00331 #ifdef _POSIX_JOB_CONTROL 00332 printf(" POSIX.1 Job control is supported.\n"); 00333 #else 00334 printf(" POSIX.1 Job control is not supported.\n"); 00335 #endif 00336 #ifdef _POSIX_CHOWN_RESTRICTED 00337 printf(" POSIX.1 Chown restrictions are supported.\n"); 00338 #else 00339 printf(" POSIX.1 Chown restrictions are not supported.\n"); 00340 #endif 00341 #ifdef _POSIX_SAVED_IDS 00342 printf(" POSIX.1 Process saved IDs are supported.\n"); 00343 #else 00344 printf(" POSIX.1 Process saved IDs are not supported.\n"); 00345 #endif 00346 #ifdef _POSIX_NO_TRUNC 00347 printf(" POSIX.1 Long pathname errors are supported.\n"); 00348 #else 00349 printf(" POSIX.1 Long pathname errors are not supported.\n"); 00350 #endif 00351 #ifdef _POSIX_VDISABLE 00352 printf(" POSIX.1 Some terminal charactistics disabling is supported.\n"); 00353 #else 00354 printf(" POSIX.1 Some terminal charactistics disabling is not supported.\n"); 00355 #endif 00356 #ifdef NGROUPS_MAX 00357 printf(" POSIX.1 Supplementary group IDs is supported.\n"); 00358 #else 00359 printf(" POSIX.1 Supplementary group IDs is not supported.\n"); 00360 #endif 00361 00362 #endif 00363 00364 /*System Run time testing*/ 00365 printf("\nSystem run time tests:\n"); 00366 errno=0; 00367 val=sysconf(_SC_JOB_CONTROL); 00368 if ((val == -1) && (errno)) 00369 { 00370 printf("Bad option _SC_JOB_CONTROL\n"); 00371 } 00372 else if ((val == -1) && (!errno)) 00373 { 00374 printf("POSIX.1 JOB CONTROL not Supported.\n"); 00375 } 00376 else 00377 { 00378 printf("POSIX.1 JOB CONTROL Supported.\n"); 00379 } 00380 errno=0; 00381 val=sysconf(_SC_SAVED_IDS); 00382 if ((val == -1) && (errno)) 00383 { 00384 printf("Bad option _SC_SAVED_IDS\n"); 00385 } 00386 else if ((val == -1) && (!errno)) 00387 { 00388 printf("POSIX.1 SAVED IDS not Supported.\n"); 00389 } 00390 else 00391 { 00392 printf("POSIX.1 SAVED IDS Supported.\n"); 00393 } 00394 errno=0; 00395 val=sysconf(_SC_VERSION); 00396 if ((val == -1) && (errno)) 00397 { 00398 printf("Bad option _SC_VERSION\n"); 00399 } 00400 else if ((val == -1) && (!errno)) 00401 { 00402 printf("POSIX.1 VERSION not Supported.\n"); 00403 } 00404 else 00405 { 00406 printf("POSIX.1 VERSION Supported.\n"); 00407 } 00408 00409 val=sysconf(_SC_ARG_MAX); 00410 if (val == -1) 00411 { 00412 printf("Bad option _SC_ARG_MAX\n"); 00413 } 00414 else 00415 { 00416 printf("POSIX.1 ARG MAX Value=%ld.\n",val); 00417 } 00418 val=sysconf(_SC_CHILD_MAX); 00419 if (val == -1) 00420 { 00421 printf("Bad option _SC_CHILD_MAX\n"); 00422 } 00423 else 00424 { 00425 printf("POSIX.1 CHILD MAX Value=%ld.\n",val); 00426 } 00427 val=sysconf(_SC_CLK_TCK); 00428 if (val == -1) 00429 { 00430 printf("Bad option _SC_CLK_TCK\n"); 00431 } 00432 else 00433 { 00434 printf("POSIX.1 CLK TCK Value=%ld.\n",val); 00435 } 00436 val=sysconf(_SC_NGROUPS_MAX); 00437 if (val == -1) 00438 { 00439 printf("Bad option _SC_NGROUPS_MAX\n"); 00440 } 00441 else 00442 { 00443 printf("POSIX.1 NGROUPS MAX Value=%ld.\n",val); 00444 } 00445 val=sysconf(_SC_OPEN_MAX); 00446 if (val == -1) 00447 { 00448 printf("Bad option _SC_OPEN_MAX\n"); 00449 } 00450 else 00451 { 00452 printf("POSIX.1 OPEN MAX Value=%ld.\n",val); 00453 } 00454 val=sysconf(_SC_STREAM_MAX); 00455 if (val == -1) 00456 { 00457 printf("Bad option _SC_STREAM_MAX\n"); 00458 } 00459 else 00460 { 00461 printf("POSIX.1 STREAM MAX Value=%ld.\n",val); 00462 } 00463 val=sysconf(_SC_TZNAME_MAX); 00464 if (val == -1) 00465 { 00466 printf("Bad option _SC_TZNAME_MAX\n"); 00467 } 00468 else 00469 { 00470 printf("POSIX.1 TZNAME MAX Value=%ld.\n",val); 00471 } 00472 00473 00474 errno=0; 00475 val=sysconf(_SC_ASYNCHRONOUS_IO); 00476 if ((val == -1) && (errno)) 00477 { 00478 printf("Bad option _SC_ASYNCHRONOUS_IO\n"); 00479 } 00480 else if ((val == -1) && (!errno)) 00481 { 00482 printf("POSIX.4 ASYNCHRONOUS IO not Supported.\n"); 00483 } 00484 else 00485 { 00486 printf("POSIX.4 ASYNCHRONOUS IO Supported.\n"); 00487 } 00488 errno=0; 00489 val=sysconf(_SC_MAPPED_FILES); 00490 if ((val == -1) && (errno)) 00491 { 00492 printf("Bad option _SC_MAPPED_FILES\n"); 00493 } 00494 else if ((val == -1) && (!errno)) 00495 { 00496 printf("POSIX.4 MAPPED FILES not Supported.\n"); 00497 } 00498 else 00499 { 00500 printf("POSIX.4 MAPPED FILES Supported.\n"); 00501 } 00502 errno=0; 00503 val=sysconf(_SC_MEMLOCK_RANGE); 00504 if ((val == -1) && (errno)) 00505 { 00506 printf("Bad option _SC_MEMLOCK_RANGE\n"); 00507 } 00508 else if ((val == -1) && (!errno)) 00509 { 00510 printf("POSIX.4 MEMLOCK RANGE not Supported.\n"); 00511 } 00512 else 00513 { 00514 printf("POSIX.4 MEMLOCK RANGE Supported.\n"); 00515 } 00516 errno=0; 00517 val=sysconf(_SC_MEMORY_PROTECTION); 00518 if ((val == -1) && (errno)) 00519 { 00520 printf("Bad option _SC_MEMORY_PROTECTION\n"); 00521 } 00522 else if ((val == -1) && (!errno)) 00523 { 00524 printf("POSIX.4 MEMORY PROTECTION not Supported.\n"); 00525 } 00526 else 00527 { 00528 printf("POSIX.4 MEMORY PROTECTION Supported.\n"); 00529 } 00530 errno=0; 00531 val=sysconf(_SC_MESSAGE_PASSING); 00532 if ((val == -1) && (errno)) 00533 { 00534 printf("Bad option _SC_MESSAGE_PASSING\n"); 00535 } 00536 else if ((val == -1) && (!errno)) 00537 { 00538 printf("POSIX.4 MESSAGE PASSING not Supported.\n"); 00539 } 00540 else 00541 { 00542 printf("POSIX.4 MESSAGE PASSING Supported.\n"); 00543 } 00544 errno=0; 00545 val=sysconf(_SC_PRIORITIZED_IO); 00546 if ((val == -1) && (errno)) 00547 { 00548 printf("Bad option _SC_PRIORITIZED_IO\n"); 00549 } 00550 else if ((val == -1) && (!errno)) 00551 { 00552 printf("POSIX.4 PRIORITIZED IO not Supported.\n"); 00553 } 00554 else 00555 { 00556 printf("POSIX.4 PRIORITIZED IO Supported.\n"); 00557 } 00558 errno=0; 00559 val=sysconf(_SC_PRIORITY_SCHEDULING); 00560 if ((val == -1) && (errno)) 00561 { 00562 printf("Bad option _SC_PRIORITY_SCHEDULING\n"); 00563 } 00564 else if ((val == -1) && (!errno)) 00565 { 00566 printf("POSIX.4 PRIORITY SCHEDULING not Supported.\n"); 00567 } 00568 else 00569 { 00570 printf("POSIX.4 PRIORITY SCHEDULING Supported.\n"); 00571 } 00572 errno=0; 00573 val=sysconf(_SC_REALTIME_SIGNALS); 00574 if ((val == -1) && (errno)) 00575 { 00576 printf("Bad option _SC_REALTIME_SIGNALS\n"); 00577 } 00578 else if ((val == -1) && (!errno)) 00579 { 00580 printf("POSIX.4 REALTIME SIGNALS not Supported.\n"); 00581 } 00582 else 00583 { 00584 printf("POSIX.4 REALTIME SIGNALS Supported.\n"); 00585 } 00586 errno=0; 00587 val=sysconf(_SC_SEMAPHORES); 00588 if ((val == -1) && (errno)) 00589 { 00590 printf("Bad option _SC_SEMAPHORES\n"); 00591 } 00592 else if ((val == -1) && (!errno)) 00593 { 00594 printf("POSIX.4 SEMAPHORES not Supported.\n"); 00595 } 00596 else 00597 { 00598 printf("POSIX.4 SEMAPHORES Supported.\n"); 00599 } 00600 errno=0; 00601 val=sysconf(_SC_FSYNC); 00602 if ((val == -1) && (errno)) 00603 { 00604 printf("Bad option _SC_FSYNC\n"); 00605 } 00606 else if ((val == -1) && (!errno)) 00607 { 00608 printf("POSIX.4 FSYNC not Supported.\n"); 00609 } 00610 else 00611 { 00612 printf("POSIX.4 FSYNC Supported.\n"); 00613 } 00614 errno=0; 00615 val=sysconf(_SC_SHARED_MEMORY_OBJECTS); 00616 if ((val == -1) && (errno)) 00617 { 00618 printf("Bad option _SC_SHARED_MEMORY_OBJECTS\n"); 00619 } 00620 else if ((val == -1) && (!errno)) 00621 { 00622 printf("POSIX.4 SHARED_MEMORY_OBJECTS not Supported.\n"); 00623 } 00624 else 00625 { 00626 printf("POSIX.4 SHARED_MEMORY_OBJECTS Supported.\n"); 00627 } 00628 errno=0; 00629 val=sysconf(_SC_SYNCHRONIZED_IO); 00630 if ((val == -1) && (errno)) 00631 { 00632 printf("Bad option _SC_SYNCHRONIZED_IO\n"); 00633 } 00634 else if ((val == -1) && (!errno)) 00635 { 00636 printf("POSIX.4 SYNCHRONIZED IO not Supported.\n"); 00637 } 00638 else 00639 { 00640 printf("POSIX.4 SYNCHRONIZED IO Supported.\n"); 00641 } 00642 errno=0; 00643 val=sysconf(_SC_TIMERS); 00644 if ((val == -1) && (errno)) 00645 { 00646 printf("Bad option _SC_TIMERS\n"); 00647 } 00648 else if ((val == -1) && (!errno)) 00649 { 00650 printf("POSIX.4 TIMERS not Supported.\n"); 00651 } 00652 else 00653 { 00654 printf("POSIX.4 TIMERS Supported.\n"); 00655 } 00656 00657 val=sysconf(_SC_AIO_LISTIO_MAX); 00658 if (val == -1) 00659 { 00660 printf("Bad option _SC_AIO_LISTIO_MAX\n"); 00661 } 00662 else 00663 { 00664 printf("POSIX.4 AIO LISTIO MAX Value=%ld.\n",val); 00665 } 00666 val=sysconf(_SC_AIO_MAX); 00667 if (val == -1) 00668 { 00669 printf("Bad option _SC_AIO_MAX\n"); 00670 } 00671 else 00672 { 00673 printf("POSIX.4 AIO MAX Value=%ld.\n",val); 00674 } 00675 val=sysconf(_SC_AIO_PRIO_DELTA_MAX); 00676 if (val == -1) 00677 { 00678 printf("Bad option _SC_AIO_PRIO_DELTA_MAX\n"); 00679 } 00680 else 00681 { 00682 printf("POSIX.4 AIO PRIO DELTA MAX Value=%ld.\n",val); 00683 } 00684 val=sysconf(_SC_DELAYTIMER_MAX); 00685 if (val == -1) 00686 { 00687 printf("Bad option _SC_DELAYTIMER_MAX\n"); 00688 } 00689 else 00690 { 00691 printf("POSIX.4 DELAYTIMER MAX Value=%ld.\n",val); 00692 } 00693 val=sysconf(_SC_MQ_OPEN_MAX); 00694 if (val == -1) 00695 { 00696 printf("Bad option _SC_MQ_OPEN_MAX\n"); 00697 } 00698 else 00699 { 00700 printf("POSIX.4 MQ OPEN MAX Value=%ld.\n",val); 00701 } 00702 val=sysconf(_SC_MQ_PRIO_MAX); 00703 if (val == -1) 00704 { 00705 printf("Bad option _SC_MQ_PRIO_MAX\n"); 00706 } 00707 else 00708 { 00709 printf("POSIX.4 MQ PRIO MAX Value=%ld.\n",val); 00710 } 00711 val=sysconf(_SC_PAGESIZE); 00712 if (val == -1) 00713 { 00714 printf("Bad option _SC_PAGESIZE\n"); 00715 } 00716 else 00717 { 00718 printf("POSIX.4 PAGESIZE Value=%ld.\n",val); 00719 } 00720 val=sysconf(_SC_RTSIG_MAX); 00721 if (val == -1) 00722 { 00723 printf("Bad option _SC_RTSIG_MAX\n"); 00724 } 00725 else 00726 { 00727 printf("POSIX.4 RTSIG MAX Value=%ld.\n",val); 00728 } 00729 val=sysconf(_SC_SEM_NSEMS_MAX); 00730 if (val == -1) 00731 { 00732 printf("Bad option _SC_SEM_NSEMS_MAX\n"); 00733 } 00734 else 00735 { 00736 printf("POSIX.4 SEM NSEMS MAX Value=%ld.\n",val); 00737 } 00738 val=sysconf(_SC_SEM_VALUE_MAX); 00739 if (val == -1) 00740 { 00741 printf("Bad option _SC_SEM_VALUE_MAX\n"); 00742 } 00743 else 00744 { 00745 printf("POSIX.4 SEM VALUE MAX Value=%ld.\n",val); 00746 } 00747 val=sysconf(_SC_SIGQUEUE_MAX); 00748 if (val == -1) 00749 { 00750 printf("Bad option _SC_SIGQUEUE_MAX\n"); 00751 } 00752 else 00753 { 00754 printf("POSIX.4 SIGQUEUE MAX Value=%ld.\n",val); 00755 } 00756 val=sysconf(_SC_TIMER_MAX); 00757 if (val == -1) 00758 { 00759 printf("Bad option _SC_TIMER_MAX\n"); 00760 } 00761 else 00762 { 00763 printf("POSIX.4 TIMER MAX Value=%ld.\n",val); 00764 } 00765 return 0; /* mjr */ 00766 } /*end of main*/ 00767 00768 #if 0 00769 Other system limits 00770 The "/usr/include/limits.h" file defines the various limits for the system such as SEM_NSEMS_MAX which is the maximum number of semaphores that one process can have open at a time. This file includes the following: 00771 00772 #ifdef __USE_POSIX 00773 /* POSIX adds things to <limits.h>. */ 00774 # include <bits/posix1_lim.h> 00775 #endif 00776 00777 #ifdef __USE_POSIX2 00778 # include <bits/posix2_lim.h> 00779 #endif 00780 00781 #ifdef __USE_XOPEN 00782 # include <bits/xopen_lim.h< 00783 #endif 00784 00785 00786 Which means, the files "/usr/include/bits/posix1_lim.h" and "/usr/include/bits/posix2_lim.h" define the system limits. 00787 #endif 00788 00789 #endif /* FREEBSD */