- 论坛徽章:
- 0
|
在阅读apue时,程序- #include <errno.h>
- #include<stdio.h>
- #include<unistd.h>
- #include <limits.h>
- #ifdef OPEN_MAX
- static long openmax = OPEN_MAX;
- #else
- static long openmax = 0;
- #endif
- /*
- * * If OPEN_MAX is indeterminate, we're not
- * * guaranteed that this is adequate.
- * */
- #define OPEN_MAX_GUESS 256
- main(void)
- {
- if (openmax == 0) { /* first time through */
- errno = 0;
- if ((openmax = sysconf(_SC_OPEN_MAX)) < 0) {
- if (errno == 0)
- openmax = OPEN_MAX_GUESS; /* it's indeterminate */
- else
- printf("sysconf error for _SC_OPEN_MAX");
- }
- }
- printf("%d",openmax);
- }
复制代码
结果是1024,但是并没有在limit.h和unistd.h中找到定义。 |
|