Revision 1.16 |
Revision 1.19 |
Line 109 |
Line 109 |
int bufsize = SENDBUFSIZE; #endif int backlog; 
|
int bufsize = SENDBUFSIZE; #endif int backlog; 
|
|
int numforks = 1;
|
/* * Takashi had hardcoded MAX_OPEN_FD into defines.h to 1024, but that
|
/* * Takashi had hardcoded MAX_OPEN_FD into defines.h to 1024, but that
|
Line 131 |
Line 132 |
} /* Parse command line options */
|
} /* Parse command line options */
|
while (-1 != (c = getopt(argc, argv, "b:c:dr:p:v"))) {
|
while (-1 != (c = getopt(argc, argv, "b:c:df:r:p:v"))) {
|
switch (c) { case 'b': backlog = atoi(optarg);
|
switch (c) { case 'b': backlog = atoi(optarg);
|
Line 141 |
Line 142 |
break; case 'd': stay_in_foreground = 1;
|
break; case 'd': stay_in_foreground = 1;
|
|
break;
case 'f':
numforks = atoi(optarg);
|
break; case 'r': server_root = strdup(optarg);
|
break; case 'r': server_root = strdup(optarg);
|
Line 157 |
Line 161 |
break; default: fprintf(stderr, "Usage: %s [-c <cfg file>] [-d] [-p <port>] "
|
break; default: fprintf(stderr, "Usage: %s [-c <cfg file>] [-d] [-p <port>] "
|
"[-r <dir>]\n", argv[0]);
|
"[-r <dir>] [-f <numprocs>] [-b <backlog>]\n", argv[0]);
|
exit(1); } }
|
exit(1); } }
|
Line 201 |
Line 205 |
printf("\n" PACKAGE_STRING "\n"); printf("Send feedback and bugreports to " PACKAGE_BUGREPORT "\n");
|
printf("\n" PACKAGE_STRING "\n"); printf("Send feedback and bugreports to " PACKAGE_BUGREPORT "\n");
|
|
if (numforks > 1)
printf("Forked %d CoW processes.\n", numforks);
|
if (stay_in_foreground)
|
if (stay_in_foreground)
|
printf("Hit CTRL-C to stop the server.\n\n");
|
printf("Hit CTRL-C to stop the foreground server.\n\n");
|
if (verbose) { printf("Using server port = %d\n", server_port); printf("Using server root = %s\n", server_root);
|
if (verbose) { printf("Using server port = %d\n", server_port); printf("Using server root = %s\n", server_root);
|
Line 299 |
Line 305 |
exit(1); }
|
exit(1); }
|
|
/* Fork off extra processes so that we can handle more connections (FD's) */
while (--numforks > 0) {
int pid;
if ((pid = fork()) < 0) {
perror("fork");
exit(1);
} else if (pid == 0) {
break;
}
}
|
/* loop for requests */ for (;;) { #ifndef ENABLE_503
|
/* loop for requests */ for (;;) { #ifndef ENABLE_503
|
Line 314 |
Line 331 |
continue; } else { perror("accept");
|
continue; } else { perror("accept");
|
|
printf("errno = %d\n", errno);
|
myexit(sr); } }
|
myexit(sr); } }
|
Line 485 |
Line 503 |
pth_attr_set(attr, PTH_ATTR_NAME, "hand"); pth_attr_set(attr, PTH_ATTR_PRIO, PTH_PRIO_MAX); for (i = 0; i < cow_nohands; i++) {
|
pth_attr_set(attr, PTH_ATTR_NAME, "hand"); pth_attr_set(attr, PTH_ATTR_PRIO, PTH_PRIO_MAX); for (i = 0; i < cow_nohands; i++) {
|
if (0 > (int)pth_spawn(attr, hand, (void *)NULL)) {
|
if (0 > (int)pth_spawn(attr, hand, (void *)i)) {
|
perror("Failed to spawn handler"); exit(errno); }
|
perror("Failed to spawn handler"); exit(errno); }
|
Line 497 |
Line 515 |
pth_barrier_reach(&init_bar); }
|
pth_barrier_reach(&init_bar); }
|