WvStreams
crashtest-nofd.cc
00001 #include "wvcrash.h"
00002 #include <sys/types.h>
00003 #include <sys/socket.h>
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <fcntl.h>
00007 
00008 int main(int argc, char **argv)
00009 {
00010     wvcrash_setup(argv[0], "BLAHBLAH");
00011     
00012     int fd, count = 0;
00013     while ((fd = socket(PF_INET, SOCK_STREAM, 0)) >= 0)
00014     {
00015         fcntl(fd, F_SETFD, 0); // *not* close-on-exec
00016         count++;
00017     }
00018     printf("Got %d sockets.\n", count);
00019     
00020     // all fds are now in use; let's see if wvcrash can handle it!
00021     
00022     abort();
00023     
00024     return 0;
00025 }