From owner-freebsd-amd64@FreeBSD.ORG Tue Mar 17 04:14:41 2009 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A73B2106564A; Tue, 17 Mar 2009 04:14:41 +0000 (UTC) (envelope-from neldredge@math.ucsd.edu) Received: from euclid.ucsd.edu (euclid.ucsd.edu [132.239.145.52]) by mx1.freebsd.org (Postfix) with ESMTP id 863618FC19; Tue, 17 Mar 2009 04:14:41 +0000 (UTC) (envelope-from neldredge@math.ucsd.edu) Received: from zeno.ucsd.edu (zeno.ucsd.edu [132.239.145.22]) by euclid.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id n2H3rno27201; Mon, 16 Mar 2009 20:53:49 -0700 (PDT) Received: from localhost (neldredg@localhost) by zeno.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id n2H3rnK05366; Mon, 16 Mar 2009 20:53:49 -0700 (PDT) X-Authentication-Warning: zeno.ucsd.edu: neldredg owned process doing -bs Date: Mon, 16 Mar 2009 20:53:49 -0700 (PDT) From: Nate Eldredge X-X-Sender: neldredg@zeno.ucsd.edu To: ron In-Reply-To: <200903152251.n2FMpnRk014352@www.freebsd.org> Message-ID: References: <200903152251.n2FMpnRk014352@www.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-gnats-submit@freebsd.org, freebsd-amd64@freebsd.org Subject: Re: amd64/132677: error calling fork execvp X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2009 04:14:42 -0000 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