site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com You need a small test case that exhibits the failure. -- Terry
but you didn't provide a version number It was in my original post: Is there something else that's needed and how do I get it? Norm -----Original Message----- From: Terry Lambert [mailto:tlambert@apple.com] Sent: Thursday, July 05, 2007 8:04 PM To: Norm Green Cc: darwin-dev@lists.apple.com Subject: Re: dup2() Problem You probably need to identify a cut-down test case, and then file a bug via bug reporter. There are a bazillion things it could be (for example, the number of open files you have could exceed the resource limits set on the child, for one, or you could be attempting to dup an O_EXCL fd, etc. etc.), but there's simply not enough information. -- Terry
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... That tells me it's Tiger, a couple of releases back. It should have no problem with the fd and dup2, unless you have something else in the program that's limiting you. On Jul 5, 2007, at 8:43 PM, Norm Green wrote: Darwin pandora.gemstone.com 8.9.3 Darwin Kernel Version 8.9.3: Fri Apr 27 14:50:07 PDT 2007; root:xnu-792.19.5~2/RELEASE_I386 i386 i386 You may also want to use fileno(stdout), instead of using STDOUT_FILENO -- but you didn't provide a version number or any of the other information you'd be required to submit a bug report, like a compilable test case, so I can't tell if this would be necessary or not. On Jul 5, 2007, at 7:46 PM, Norm Green wrote:
Yes. The open call is returning a positive int and stdout has not
been closed (it works fine in the parent process). Like I said,
this code is very old and has always worked correctly on other unixes.
Norm
-----Original Message-----
From: Justin C. Walker [mailto:justin@mac.com]
Sent: Thursday, July 05, 2007 6:57 PM
To: darwin-dev@lists.apple.com list
Subject: Re: dup2() Problem
On Jul 5, 2007, at 18:10 , Norm Green wrote:
Hi,
I'm having a problem on Darwin i386 using dup2() in a child
process. This is after a fork() call but before execve() call.
After the fork I do:
int logfd = open(logName, O_WRONLY|O_APPEND|O_CREAT,
0644);
dup2(logfd, STDOUT_FILENO);
The open() call succeeds but the dup2() call always fails with
errno=9, which suggests one of the args is not an open fd. I'm
sure I'm not closing either in my code.
I think errno == 9 suggests that one of the values is bad, not that
one of the file descriptors is closed. The man page implies that
'newd' may be open or closed before the dup2() call. Have you really
checked the value of each argument?
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Enhancement of the Director's Income
--------
When LuteFisk is outlawed,
Only outlaws will have LuteFisk
--------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (Darwin-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/norm.green%40gemstone.com
This email sent to norm.green@gemstone.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (Darwin-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/tlambert%40apple.com
This email sent to tlambert@apple.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert