From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 8 20:54:32 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1C6FD16A41F for ; Thu, 8 Sep 2005 20:54:32 +0000 (GMT) (envelope-from victor.cruceru@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9406943D49 for ; Thu, 8 Sep 2005 20:54:31 +0000 (GMT) (envelope-from victor.cruceru@gmail.com) Received: by wproxy.gmail.com with SMTP id 36so1679490wra for ; Thu, 08 Sep 2005 13:54:31 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=hHlm23dthZgYe6/+/ZCzrM1hDN79O/w8yNwbrEqjHeHENlH4oXS/Z1Bl6+XFVrhzBnwn3g0OrIGp3mLYnO7KHG6a99huHRQE4rAg/VWXikL5pHdy47JzvGXwGEstLLpHoZ2Or1FMuyB3rgsrwS+fmHWvYQTJWLkoN9EyswP/vCc= Received: by 10.54.97.2 with SMTP id u2mr1073801wrb; Thu, 08 Sep 2005 13:54:30 -0700 (PDT) Received: by 10.54.103.8 with HTTP; Thu, 8 Sep 2005 13:54:30 -0700 (PDT) Message-ID: <494025505090813545451dae6@mail.gmail.com> Date: Thu, 8 Sep 2005 23:54:30 +0300 From: victor cruceru To: erkan kolemen In-Reply-To: <20050908203521.84843.qmail@web33405.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <494025505090813027dc0d6d3@mail.gmail.com> <20050908203521.84843.qmail@web33405.mail.mud.yahoo.com> Cc: freebsd-hackers@freebsd.org Subject: Re: fok() execve() -> No child processes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: soc-victor@freebsd.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2005 20:54:32 -0000 Well, I suppose that execve is successful. if not you should call _exit() instead of exit() in the child process (you should not return from e_x_e_c if the exec fails) Also your application should not ignore SIGCHLD. See man vfork and especially man wait.=20 victor cruceru On 9/8/05, erkan kolemen wrote: > i tried and still same error. >=20 > thanks. >=20 > --- victor cruceru wrote: >=20 > > Try to replace vfrork with fork and check if you'll > > get the same behavior. > > victor cruceru > > > > > > On 9/8/05, erkan kolemen > > wrote: > > > Following code fails. I debugged it and saw that: > > it > > > produces "No child processes" error while wait(). > > > > > > is it possible, parent still is not start to wait > > but > > > child finished. After that CPU schedules parents. > > It > > > try to start wait but child has finished. > > > > > > is it possible... What can i do for that? > > > > > > static int e_x_e_c(char *cmd[]) > > > { > > > pid_t pid; > > > int stat; > > > > > > switch((pid =3D vfork())) { > > > case -1: > > > syslog(LOG_ERR, "fork: %s", > > > strerror(errno)); > > > return -16; > > > break; > > > case 0: > > > if(execve(cmd[0], cmd, > > NULL) > > > =3D=3D -1) { > > > syslog(LOG_ERR, > > > "execve: %s", strerror(errno)); > > > return -15; > > > } > > > break; > > > default: > > > if (wait(&stat) =3D=3D -1) { > > > slog(1, LOG_ERR); > > > return -14; > > > } > > > > > > if (WIFSIGNALED(stat)) { > > > syslog(LOG_NOTICE, > > "%s > > > is signalled", cmdline[0]); > > > return -13; > > > } > > > > > > if (WIFSTOPPED(stat)) { > > > syslog(LOG_NOTICE, > > "%s > > > is stopped", cmdline[0]); > > > return -12; > > > } > > > > > > if (WIFEXITED(stat)) > > > return > > > WEXITSTATUS(stat); > > > break; > > > } > > > return -11; > > > } > > > > > > > > > > > > > > > > > > > > > ______________________________________________________ > > > Click here to donate to the Hurricane Katrina > > relief effort. > > > http://store.yahoo.com/redcross-donate3/ > > > _______________________________________________ > > > freebsd-hackers@freebsd.org mailing list > > > > > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > > To unsubscribe, send any mail to > > "freebsd-hackers-unsubscribe@freebsd.org" > > > > > >=20 >=20 >=20 >=20 >=20 > ______________________________________________________ > Click here to donate to the Hurricane Katrina relief effort. > http://store.yahoo.com/redcross-donate3/ >