Deutsch English Français Italiano |
<ve17mc$osk$1@reader1.panix.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail From: cross@spitfire.i.gajendra.net (Dan Cross) Newsgroups: comp.os.vms Subject: Re: Apache + mod_php performance Date: Mon, 7 Oct 2024 18:01:48 -0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <ve17mc$osk$1@reader1.panix.com> References: <vcv0bl$39mnj$1@dont-email.me> <vdp9f6$jbc$1@reader1.panix.com> <20241006181231.0000370b@yahoo.com> <ve13ck$1pl4l$1@dont-email.me> Injection-Date: Mon, 7 Oct 2024 18:01:48 -0000 (UTC) Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80"; logging-data="25492"; mail-complaints-to="abuse@panix.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: cross@spitfire.i.gajendra.net (Dan Cross) Bytes: 4526 Lines: 123 In article <ve13ck$1pl4l$1@dont-email.me>, Mark Berryman <mark@theberrymans.com> wrote: >On 10/6/24 9:12 AM, Michael S wrote: >> On Fri, 4 Oct 2024 17:43:02 -0000 (UTC) >> cross@spitfire.i.gajendra.net (Dan Cross) wrote: >> >>> In article <vdp8kn$a67s$1@dont-email.me>, >>> Dave Froble <davef@tsoft-inc.com> wrote: >>>> On 10/3/2024 7:00 PM, Chris Townley wrote: >>>>> [snip] >>>>> I don't remember George, but we have certainly woken up Dave! ;) >>>>> >>>>> and I am sure the troll is happy... >>>> >>>> I'm not sure whether I've been insulted? >>> >>> I suspect the "troll" reference is to Lawrence. Sadly, Arne can >>> not help himself when it comes to resisting arguing with that >>> clown. >> >> Troll or not, but the question about ability to pass open TCP socket to >> child process (or, may be, to unrelated process) under VMS is a good >> question. >> As a lurker, I am waiting for the expert answer with interest. > >It is most definitely possible as that is precisely what the auxiliary >server in TCPIP Services does. It listens for a connection, then >creates a process to handle it. See the description of TCPIP$C_AUXS in >the TCPIP Services programming documentation. > >As Dave has mentioned, setting SO_SHARE on a socket would be another way >to accomplish this. Neither of these sounds the same as descriptor passing over Unix domain sockets on Unix/Linux; the auxiliary server sounds more like `inetd`, in that there's some service that's listening and accepting connections on some TCP/IP port, and then creating a server to handle each incoming connection. SO_SHARE is different again; it appears that the shared socket must be created before the subprocesses that use it are created. The Unix analogy would be a process that creates a listening socket, and then fork's several processes that all `accept` on that same socket (they will race one another as to which gets to answer complete the `accept` for the next connection). See some example code at the bottom of this post; note this is different from the earlier socket passing example I posted. - Dan C. // Demonstration of a multiple processes accepting // connections on the same bound listening socket. // // Dan Cross <cross@gajendra.net> #include <sys/types.h> #include <sys/socket.h> #include <sys/wait.h> #include <netinet/in.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> int main(void) { int sd, nsd; struct sockaddr_in sa; struct sockaddr_in client; socklen_t clientlen; pid_t pid; sd = socket(AF_INET, SOCK_STREAM, 0); if (sd < 0) { perror("socket"); exit(EXIT_FAILURE); } memset(&sa, 0, sizeof sa); sa.sin_family = AF_INET; sa.sin_port = htons((unsigned short)8200); sa.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(sd, (struct sockaddr *)&sa, sizeof sa) < 0) { perror("bind"); close(sd); exit(EXIT_FAILURE); } if (listen(sd, 255) < 0) { perror("listen"); close(sd); exit(EXIT_FAILURE); } for (int k = 0; k < 3; k++) { pid = fork(); if (pid < 0) { perror("fork"); exit(EXIT_FAILURE); } if (pid > 0) // Parent continue; // Child. pid = getpid(); for (;;) { memset(&client, 0, sizeof client); clientlen = sizeof client; nsd = accept(sd, (struct sockaddr *)&client, &clientlen); if (nsd < 0) { perror("accept"); close(sd); exit(EXIT_FAILURE); } printf("pid %d accepted a connection\n", pid); close(nsd); } } close(sd); for (int k = 0; k < 3; k++) wait(NULL); return EXIT_SUCCESS; }