Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 6601 invoked by uid 6000); 12 Oct 1998 16:21:59 -0000 Received: (qmail 6347 invoked from network); 12 Oct 1998 16:21:53 -0000 Received: from smtp3.ny.us.ibm.com (198.133.22.42) by taz.hyperreal.org with SMTP; 12 Oct 1998 16:21:53 -0000 Received: from relay2.server.ibm.com (relay2.server.ibm.com [9.14.2.99]) by smtp3.ny.us.ibm.com (8.8.7/8.8.7) with ESMTP id MAA12780 for ; Mon, 12 Oct 1998 12:04:53 -0400 Received: from US.IBM.COM (d03lms03.boulder.ibm.com [9.99.80.13]) by relay2.server.ibm.com (8.8.7/8.8.7) with SMTP id MAA29702 for ; Mon, 12 Oct 1998 12:17:43 -0400 Received: by US.IBM.COM (Soft-Switch LMS 2.0) with snapi via D03AU017 id 5030300026184792; Mon, 12 Oct 1998 12:30:41 -0400 From: Joe Moenich To: Subject: [PATCH] TPF http_main.c Message-ID: <5030300026184792000002L022*@MHS> Date: Mon, 12 Oct 1998 12:30:41 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org TPF implementation of select, ignore alarms, provide an out if user att= empts to run standalone with this implementation. Include TPF in inetd path of = REALMAIN. Index: http_main.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /apache/apache/src/main/http_main.c,v retrieving revision 1.1.1.1 diff -a -b -C3 -r1.1.1.1 http_main.c *** http_main.c 1998/10/12 09:15:41 1.1.1.1 --- http_main.c 1998/10/12 09:18:10 *************** *** 116,122 **** #endif #ifdef WIN32 #include "../os/win32/getopt.h" ! #elif !defined(BEOS) #include #endif --- 116,122 ---- #endif #ifdef WIN32 #include "../os/win32/getopt.h" ! #elif !defined(BEOS) && !defined(TPF) #include #endif *************** *** 1102,1107 **** --- 1102,1108 ---- * which is itself being cleared); we have to support that here. */ + #ifndef TPF API_EXPORT(void) ap_block_alarms(void) { ++alarms_blocked; *************** *** 1129,1134 **** --- 1130,1136 ---- } } } + #endif /* TPF */ static APACHE_TLS void (*volatile alarm_fn) (int) =3D NULL; *************** *** 2174,2180 **** --- 2176,2186 ---- tv.tv_sec =3D waittime / 1000000; tv.tv_usec =3D waittime % 1000000; waittime =3D waittime * 4; + #ifdef TPF + ap_select(NULL, 0, 0, 0, tv.tv_sec*1000000); + #else ap_select(0, NULL, NULL, NULL, &tv); + #endif /* TPF */ /* now see who is done */ not_dead_yet =3D 0; *************** *** 2354,2360 **** --- 2360,2370 ---- #endif tv.tv_sec =3D SCOREBOARD_MAINTENANCE_INTERVAL / 1000000; tv.tv_usec =3D SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; + #ifdef TPF + ap_select(NULL, 0, 0, 0, tv.tv_sec * 1000000); + #else ap_select(0, NULL, NULL, NULL, &tv); + #endif /* TPF */ return -1; #endif /* WIN32 */ } *************** *** 2781,2787 **** int x; chdir("/"); ! #if !defined(MPE) && !defined(OS2) /* Don't detach for MPE because child processes can't survive the dea= th of the parent. */ if ((x =3D fork()) > 0) --- 2791,2797 ---- int x; chdir("/"); ! #if !defined(MPE) && !defined(OS2) && !defined(TPF) /* Don't detach for MPE because child processes can't survive the dea= th of the parent. */ if ((x =3D fork()) > 0) *************** *** 2805,2812 **** fprintf(stderr, "httpd: setpgrp or getpgrp failed\n"); exit(1); } ! #elif defined(OS2) ! /* OS/2 don't support process group IDs */ pgrp =3D getpid(); #elif defined(MPE) /* MPE uses negative pid for process group */ --- 2815,2822 ---- fprintf(stderr, "httpd: setpgrp or getpgrp failed\n"); exit(1); } ! #elif defined(OS2) || defined(TPF) ! /* OS/2 and TPF don't support process group IDs */ pgrp =3D getpid(); #elif defined(MPE) /* MPE uses negative pid for process group */ *************** *** 3616,3622 **** --- 3626,3636 ---- if (ap_listeners->next !=3D ap_listeners) { /* more than one socket */ memcpy(&main_fds, &listenfds, sizeof(fd_set)); + #ifdef TPF + srv =3D ap_select(&main_fds.fds_bits[0], listenmaxfd, 0, 0, 0= ); + #else srv =3D ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, NUL= L); + #endif /* TPF */ if (srv < 0 && errno !=3D EINTR) { /* Single Unix documents select as returning errnos *************** *** 4097,4103 **** --- 4111,4127 ---- idle_count, total_non_dead); } for (i =3D 0; i < free_length; ++i) { + #ifdef TPF + if(make_child(server_conf, free_slots[i], now) =3D=3D -1) { + if(free_length =3D=3D 1) { + shutdown_pending =3D 1; + ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, + "No active child processes: shutting down"); + } + } + #else make_child(server_conf, free_slots[i], now); + #endif /* TPF */ } /* the next time around we want to spawn twice as many if thi= s * wasn't good enough, but not if we've just done a graceful *************** *** 4422,4427 **** --- 4446,4453 ---- { int c; int configtestonly =3D 0; + int sock_in; + int sock_out; #ifdef SecureWare if (set_auth_parameters(argc, argv) < 0) *************** *** 4447,4452 **** --- 4473,4479 ---- ap_setup_prelinked_modules(); + #ifndef TPF while ((c =3D getopt(argc, argv, "D:C:c:Xd:f:vVhlL:St" #ifdef DEBUG_SIGSTOP *************** *** 4515,4520 **** --- 4542,4548 ---- usage(argv[0]); } } + #endif /* TPF */ ap_suexec_enabled =3D init_suexec(); server_conf =3D ap_read_config(pconf, ptrans, ap_server_confname)= ; *************** *** 4570,4602 **** exit(0); } l =3D sizeof(sa_client); ! if ((getpeername(fileno(stdin), &sa_client, &l)) < 0) { /* get peername will fail if the input isn't a socket */ perror("getpeername"); memset(&sa_client, '\0', sizeof(sa_client)); } l =3D sizeof(sa_server); ! if (getsockname(fileno(stdin), &sa_server, &l) < 0) { perror("getsockname"); fprintf(stderr, "Error getting local address\n"); exit(1); } server_conf->port =3D ntohs(((struct sockaddr_in *) &sa_server)= ->sin_port cio =3D ap_bcreate(ptrans, B_RDWR | B_SOCKET); ! #ifdef MPE ! /* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), = whereas ! HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (= fd 1). ! Go figure. SR 5003355016 has been submitted to request that the e= xisting ! functionality be documented, and then to enhance the functionality= to be ! like HPUX. */ ! ! cio->fd =3D fileno(stdin); ! #else ! cio->fd =3D fileno(stdout); conn =3D new_connection(ptrans, server_conf, cio, (struct sockaddr_in *) &sa_client, (struct sockaddr_in *) &sa_server, -1= ); --- 4598,4643 ---- exit(0); } + #ifdef TPF + signal(SIGALRM, alrm_handler); + ecbptr()->ebrout =3D PRIMECRAS; + #endif /* TPF */ + + #ifdef TPF + /* TPF only passes the incoming socket number from the internet daemo= n + in ebw000 */ + sock_in =3D * (int*)(&(ecbptr()->ebw000)); + sock_out =3D * (int*)(&(ecbptr()->ebw000)); + #elif defined(MPE) + /* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), = whereas + HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (= fd 1). + Go figure. SR 5003355016 has been submitted to request that the e= xisting + functionality be documented, and then to enhance the functionality= to be + like HPUX. */ + sock_in =3D fileno(stdin); + sock_out =3D fileno(stdin); + #else + sock_in =3D fileno(stdin); + sock_out =3D fileno(stdout); + #endif + l =3D sizeof(sa_client); ! if ((getpeername(sock_in, &sa_client, &l)) < 0) { /* get peername will fail if the input isn't a socket */ perror("getpeername"); memset(&sa_client, '\0', sizeof(sa_client)); } l =3D sizeof(sa_server); ! if (getsockname(sock_in, &sa_server, &l) < 0) { perror("getsockname"); fprintf(stderr, "Error getting local address\n"); exit(1); } server_conf->port =3D ntohs(((struct sockaddr_in *) &sa_server)->= sin_port); cio =3D ap_bcreate(ptrans, B_RDWR | B_SOCKET); ! cio->fd =3D sock_out; ! cio->fd_in =3D sock_in; conn =3D new_connection(ptrans, server_conf, cio, (struct sockaddr_in *) &sa_client, (struct sockaddr_in *) &sa_server, -1); Joe Moenich moenich@us.ibm.com 303 773-5483 tie-line 656-7487 =