|
- #include <fcntl.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- int
- main(void)
- {
- unsigned int max[1028];
- unsigned count;
- for(count=3;count<1028;count++) {
- if((max[count]=open("/etc/fstab",O_RDONLY))<0) {
- printf(" create descriptor %d error\n",max[count]);
- return(1);
- }else
- printf("descriptor is %d\n",max[count]);
- }
- printf("done\n");
- return(0);
- }
- #./a.out
- ..........................
- ..........................
- descriptor is 1022
- descriptor is 1023
- descriptor is -1
- descriptor is -1
- descriptor is -1
- descriptor is -1
- done
复制代码
RedHat 9.0的FD_SETSIZE的值是1024.
|
|