diff options
author | Theo Schlossnagle <jesus@omniti.com> | 2013-03-31 04:00:15 +0000 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2013-04-03 17:34:56 -0400 |
commit | b075ad5b007248d50e4c2e838b460c9c7cfd9fad (patch) | |
tree | 2df4132aec9c5613e95766e82631e06c8b048d1f /usr/src/uts/common/syscall/open.c | |
parent | 3cc3202e63472d673bcac160bfb86d1865dd9fe7 (diff) | |
download | illumos-joyent-b075ad5b007248d50e4c2e838b460c9c7cfd9fad.tar.gz |
3665 Implement O_CLOEXEC as an open() flag
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/uts/common/syscall/open.c')
-rw-r--r-- | usr/src/uts/common/syscall/open.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/usr/src/uts/common/syscall/open.c b/usr/src/uts/common/syscall/open.c index 6559900158..edb04c824b 100644 --- a/usr/src/uts/common/syscall/open.c +++ b/usr/src/uts/common/syscall/open.c @@ -27,6 +27,9 @@ /* All Rights Reserved */ /* + * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. + */ +/* * Portions of this source code were derived from Berkeley 4.3 BSD * under license from the Regents of the University of California. */ @@ -226,6 +229,9 @@ noxattr: * falloc reserved. */ setf(fd, fp); + if ((filemode & FCLOEXEC) != 0) { + f_setfd(fd, FD_CLOEXEC); + } return (fd); } else { /* @@ -252,6 +258,9 @@ noxattr: fp->f_count++; mutex_exit(&fp->f_tlock); setf(fd, fp); + if ((filemode & FCLOEXEC) != 0) { + f_setfd(fd, FD_CLOEXEC); + } releasef(dupfd); } return (fd); |