Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Sep 2005 23:02:03 +0300
From:      victor cruceru <victor.cruceru@gmail.com>
To:        erkan kolemen <erkankolemen@yahoo.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: fok() execve() -> No child processes
Message-ID:  <494025505090813027dc0d6d3@mail.gmail.com>
In-Reply-To: <20050908194020.21635.qmail@web33415.mail.mud.yahoo.com>
References:  <20050908194020.21635.qmail@web33415.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Try to replace vfrork with fork and check if you'll get the same behavior.
victor cruceru


On 9/8/05, erkan kolemen <erkankolemen@yahoo.com> wrote:
> Following code fails. I debugged it and saw that: it
> produces "No child processes" error while wait().
>=20
> 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.
>=20
> is it possible... What can i do for that?
>=20
> static int e_x_e_c(char *cmd[])
> {
>        pid_t pid;
>        int stat;
>=20
>        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;
>                        }
>=20
>                        if (WIFSIGNALED(stat)) {
>                                syslog(LOG_NOTICE, "%s
> is signalled", cmdline[0]);
>                                return -13;
>                        }
>=20
>                        if (WIFSTOPPED(stat)) {
>                                syslog(LOG_NOTICE, "%s
> is stopped", cmdline[0]);
>                                return -12;
>                        }
>=20
>                        if (WIFEXITED(stat))
>                                return
> WEXITSTATUS(stat);
>                        break;
>        }
>        return -11;
> }
>=20
>=20
>=20
>=20
>=20
> ______________________________________________________
> 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=
"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?494025505090813027dc0d6d3>