Mail Archives: cygwin-developers/1998/05/27/23:15:44
Tim Newsham wrote:
> > There is also a SetHandle function that would do this on a Win32 basis, but
> > I believe it is only available for NT 4 and beyond.
>
> On a related note:
>
> Is there any way to get a hold of a handle given the unix-type
> file descriptor in cygwin?
>
The only way I know now is
handle=get_osfhandle(fd);
SetHandleInformation(handle,...);
But this works on NT only - W95 doesn't support SetHandleInformation() call. The good solution I see in new fcntl call:
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONINHERIT);
On this call fcntl() should duplicate original fd's handle to non-inherittable, close original handle and set_handle() to duplicated.
--
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia.
- Raw text -