This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XWinrc configurable server (menus/icons)


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()...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]