From owner-freebsd-questions Fri Dec 14 11:31: 7 2001 Delivered-To: freebsd-questions@freebsd.org Received: from gamma.root-servers.ch (gamma.root-servers.ch [195.49.62.126]) by hub.freebsd.org (Postfix) with SMTP id 0B14037B41B for ; Fri, 14 Dec 2001 11:30:47 -0800 (PST) Received: (qmail 28015 invoked from network); 14 Dec 2001 19:30:40 -0000 Received: from dclient217-162-128-224.hispeed.ch (HELO athlon550) (217.162.128.224) by 0 with SMTP; 14 Dec 2001 19:30:40 -0000 Date: Fri, 14 Dec 2001 20:31:44 +0100 From: Gabriel Ambuehl X-Mailer: The Bat! (v1.53bis) Educational Organization: BUZ Internet Services X-Priority: 3 (Normal) Message-ID: <84888543528.20011214203144@buz.ch> To: questions@freebsd.org Subject: Question about shutdown of TCP daemons... MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- Hello, I've there got an app which consists of two daemons, d1 and d2, both are the same binary just running two different compartments (they get created by two successive fork()s from inital process) now d2 got a SOAP RPC (Easysoap++) installed in order to respond to queries over SOAP and listens on port 6060. The queries come from two sides: 1) from children of d1, which report some processing results to d2 to be stored 2) from clients of d2, which want to obtain the data of d1 So far, everything is working charmingly but now I need to add a SOAP RPC call that will reload the config of both daemons from the initial config file. I came up with something like: d2: [...] kill(d1_pid, SIGHUP); return_soap_query(); //the client wants to see something, else it //won't be happy at all so we can't just exit(0) return 1; } which lets d1 execute: void sighup(int signo) { kill(d2_pid, SIGKILL); //d2 exits, which should allow other people //to bind to port 6060 if(fork()==0) { /*child*/ cout << getpid() << endl; setsid(); for (int i=0; i==1024; i++) { close(i); } execv(original_argv[0], original_argv); } _exit(0); } Now while both exit and a new instance is loaded by the execv, the new d2 isn't able to bind to port 6060 since it is still occupied by something (which is also what nmap says) and it will only become free after d2 exited stating it isn't able to bind to port. What am I doing wrong? TIA & best regards, Gabriel PS: On the cli, #killall app && ./app config.file will do just fine, whereas in the app, system("killall app && ./app config.file"); won't do any good except killing all instances of app. -----BEGIN PGP SIGNATURE----- Version: PGP 6.5i iQEVAwUBPBpFlcZa2WpymlDxAQFz2AgAnZvBWyS26Fv54c11YpuIPzdVGEqsguWd AVCAXvORnCC/j4SPuH2qjNiApiGQXQwCljjCUVp7ZuSjGLyErY6GGMTsVEsM+NbK WptariCO/2pxlZySXhNt04dGZ/sczYzpeBLIU9znAHgYH3QmM6Sn+Y6xS4BXh9CJ VUvIjArSFkmbuAA+eClKZ6fVdEyUrmMBcjnMqHcybIzbfJNTiQTvDMakHvdbufg+ zGUDgfMCoyWerB2MSA8n7z9cnhDjrBnPYW+jFoFyZAm+Pz1MWdjzrap14lmLp4VG 2r73g7uLC8UhH2h57N0QkUyEh745zduSssB5ZQboxVcWUZ3699WO1Q== =T4ga -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message