Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Aug 2001 10:46:22 +0800
From:      "David Xu" <davidx@viasoft.com.cn>
To:        <freebsd-questions@freebsd.org>
Subject:   F_DUPFD close-on-exec flag and Posix compatible
Message-ID:  <007f01c131c7$20b2db90$6201a8c0@davidwnt>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_007C_01C1320A.2C9D90B0
Content-Type: text/plain;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable

Hi,

  I have found our fcntl manual says :

  F_DUPFD    Return a new descriptor as follows:

                    o   Lowest numbered available descriptor greater =
than or
                        equal to arg.
                    o   Same object references as the original =
descriptor.
                    o   New descriptor shares the same file offset if =
the
                        object was a file.
                    o   Same access mode (read, write or read/write).
                    o   Same file status flags (i.e., both file =
descriptors
                        share the same file status flags).
                    o   The close-on-exec flag associated with the new =
file
                        descriptor is set to remain open across =
execve(2) sys-
                        tem calls.

it seems close-on-exec flag is not compatible with Posix standard, Posix =
says
the close-on-exec flag for new descriptor is clear.

--
David Xu


------=_NextPart_000_007C_01C1320A.2C9D90B0
Content-Type: text/html;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dgb2312" http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3018.900" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Hi,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>&nbsp; I have found our fcntl manual says =
:</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;F_DUPFD&nbsp;&nbsp;&nbsp; Return a new =
descriptor=20
as follows:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
o&nbsp;&nbsp; Lowest numbered available descriptor greater than=20
or<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
equal to=20
arg.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
o&nbsp;&nbsp; Same object references as the original=20
descriptor.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
o&nbsp;&nbsp; New descriptor shares the same file offset if=20
the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

object was a=20
file.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
o&nbsp;&nbsp; Same access mode (read, write or=20
read/write).<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
o&nbsp;&nbsp; Same file status flags (i.e., both file=20
descriptors<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
share the same file status=20
flags).<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
o&nbsp;&nbsp; The close-on-exec flag associated with the new=20
file<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
descriptor is set to remain open across execve(2)=20
sys-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
tem calls.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>it seems close-on-exec flag is not compatible with =
Posix=20
standard, Posix says</FONT></DIV>
<DIV><FONT size=3D2>the close-on-exec flag for new descriptor is=20
clear.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>--</FONT></DIV>
<DIV><FONT size=3D2>David Xu</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_007C_01C1320A.2C9D90B0--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?007f01c131c7$20b2db90$6201a8c0>