2007-07-22 Roland McGrath <roland@frob.com>

* sysdeps/mach/hurd/bits/fcntl.h [__USE_GNU] (O_CLOEXEC): New macro.
	* hurd/port2fd.c (_hurd_port2fd): Implement O_CLOEXEC.
This commit is contained in:
Roland McGrath 2007-07-22 22:43:02 +00:00
parent c942388dad
commit 626a51fd5c
2 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc.
/* Copyright (C) 1994, 1997, 1999, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -55,7 +55,7 @@ _hurd_port2fd (struct hurd_fd *d, io_t dport, int flags)
mach_port_t old
= _hurd_userlink_clear (&d->port.users) ? d->port.port : MACH_PORT_NULL;
d->port.port = dport;
d->flags = 0;
d->flags = (flags & O_CLOEXEC) ? FD_CLOEXEC : 0;
if (old != MACH_PORT_NULL)
__mach_port_deallocate (__mach_task_self (), old);
}

View File

@ -1,5 +1,6 @@
/* O_*, F_*, FD_* bit values for GNU.
Copyright (C) 1993,94,96,97,98,99,2000,01,04 Free Software Foundation, Inc.
Copyright (C) 1993,1994,1996,1997,1998,1999,2000,2001,2004,2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -70,6 +71,7 @@
#define O_SYNC O_FSYNC
#ifdef __USE_GNU
# define O_NOATIME 0x0800 /* Don't set access time on read (owner). */
# define O_CLOEXEC 0x00010000 /* Set FD_CLOEXEC. */
#endif
#ifdef __USE_MISC
# define O_SHLOCK 0x00020000 /* Open with shared file lock. */