From owner-freebsd-bugs@FreeBSD.ORG Tue Mar 17 04:20:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71865106566B for ; Tue, 17 Mar 2009 04:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 6006C8FC15 for ; Tue, 17 Mar 2009 04:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n2H4K3jn076804 for ; Tue, 17 Mar 2009 04:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n2H4K3uU076803; Tue, 17 Mar 2009 04:20:03 GMT (envelope-from gnats) Date: Tue, 17 Mar 2009 04:20:03 GMT Message-Id: <200903170420.n2H4K3uU076803@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Nate Eldredge Cc: Subject: Re: amd64/132677: error calling fork execvp X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Nate Eldredge List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2009 04:20:03 -0000 The following reply was made to PR kern/132677; it has been noted by GNATS. From: Nate Eldredge To: ron Cc: freebsd-gnats-submit@freebsd.org, freebsd-amd64@freebsd.org Subject: Re: amd64/132677: error calling fork execvp Date: Mon, 16 Mar 2009 20:53:49 -0700 (PDT) On Sun, 15 Mar 2009, ron wrote: > hello, > > calling execvp(2) works fine. > > however calling > > pid = fork() > if (pid == 0) > execvp(2) > > returns error 22 (invalid value) > > calling > > pid = fork() > if (pid == 0) > execve(3) > > works fine Can you be more specific? In particular, could you send a complete source that can be compiled and run, and that shows the problem? I can't reproduce a problem here. I am running 7.1 on amd64, and the following program works as expected. #include #include #include #include #include int main(void) { pid_t pid; pid = fork(); if (pid == 0) { char *argv[] = { "echo", "Hello, world!", NULL }; execvp("echo", argv); perror("execvp failed"); _exit(1); } else if (pid > 0) { int status; if (waitpid(pid, &status, 0) == -1) { perror("waitpid"); exit(1); } if (WIFEXITED(status)) printf("Child exited with status %d\n", WEXITSTATUS(status)); else if (WIFSIGNALED(status)) printf("Child killed by signal %d\n", WTERMSIG(status)); else printf("Impossible status!\n"); } else if (pid < 0) { perror("fork"); exit(1); } return 0; } The output is: Hello, world! Child exited with status 0 Perhaps there is something wrong in a different part of your test program. -- Nate Eldredge neldredge@math.ucsd.edu