XWinrc configurable server (menus/icons)

Harold L Hunt II huntharo@msu.edu
Wed Aug 6 17:07:00 GMT 2003


The for loop that you have is the way I have seen it done before.

Harold

Earle F. Philhower, III wrote:

> Howdy Harold...
> 
> ..
> 
>>>You may still be correct with your worries, I'm sure there's a file 
>>>descriptor
>>>that the OS is dup2()'ing there you don't want.  FWIW I'm execl()'ing
>>>/bin/sh -c  <command string>
>>
>>Hmm... that is a good point.  We have the Win32 message queue file 
>>handle open, a feature Cygwin provides, so that we get bumped each time 
>>a message hits the queue.  After the fork shouldn't you be looping 
>>through all file descriptors and closing all but stdin, stdout, and stderr?
> 
> ..
> 
> That's the exact thing I was thinking about, but unfortunately I haven't
> got a clue how to get a list of all open file descriptors under cygwin.
> There's a Solaris function fdwalk(), but I don't think that's POSIX standard
> or even available on cygwin.  I suppose after the fork() you could do:
>   struct rlimit rl;
>   int i;
>   getrlimit(RLIMIT_NOFILE, &rl);
>   for (i = STDERR_FILENO+1; i < rl.rlim_max; i++)
>        (void) close(i);
> but that seems wasteful to iterate over rlim_max...
> 
> ..
> 
>>Okay.  Does this mean you are going to implement the search-n-replace or 
>>not?  Just want to know whether or not to wait for it.
> 
> 
> I like the put_env() idea that folks are suggesting, but I think it'd probably
> still be worthwhile to also do the string substitution.  It's not that big of a
> deal to add both.  Tonight I'll give that a go, adding the put_env() call in
> the LoadPrefs as well as a %display% substitution in LoadPrefs()...



More information about the Cygwin-xfree mailing list