O_CLOEXEC
{ "cloexec", O_CLOEXEC, C_IFLAG|C_OFLAG },
ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC);
n = open_history_file(name, O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC);
f |= O_CLOEXEC;
if ((pos & O_CLOEXEC) && !(f & O_CLOEXEC))
if ((neg & O_CLOEXEC) && (f & O_CLOEXEC))
pos &= ~O_CLOEXEC;
neg &= ~O_CLOEXEC;
f &= ~O_CLOEXEC;
#ifdef O_CLOEXEC
newfd = dup3(from, to, O_CLOEXEC);
#ifndef O_CLOEXEC
{ "cloexec", 2, O_CLOEXEC },
#ifdef O_CLOEXEC
oflag |= O_CLOEXEC;
#ifdef O_CLOEXEC
if (oflag & O_CLOEXEC)
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | O_CLOEXEC);
if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1)
switch (flags & (O_CLOEXEC|O_CLOFORK)) {
case O_CLOEXEC|O_CLOFORK:
case O_CLOEXEC:
#ifndef O_CLOEXEC
O_RDWR | O_SHLOCK | O_TRUNC | O_CLOEXEC)
#ifndef O_CLOEXEC
if ((fd = open(file, flags | O_CLOEXEC, mode)) == -1)
#if O_CLOEXEC == 0
if (oldfd < 0 && (fd = open(path, O_RDONLY | O_CLOEXEC)) == -1)
#ifndef O_CLOEXEC
if ((sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC, 0)) == -1)
if ((p->fts_symfd = open(".", O_RDONLY | O_CLOEXEC, 0))
open(".", O_RDONLY | O_CLOEXEC, 0)) == -1) {
if ((fd = open(".", O_RDONLY | O_CLOEXEC, 0)) == -1)
if ((capdbp = dbopen(pbuf, O_RDONLY | O_CLOEXEC, 0,
fd = open(*db_p, O_RDONLY | O_CLOEXEC, 0);
O_RDWR | O_CLOEXEC)) == -1) {
if ((fd = open(name, O_RDONLY | O_CLOEXEC)) == -1) {
fd = open(name, O_RDONLY | O_CLOEXEC, 0);
if ((fd = open(name, O_RDONLY|O_DIRECTORY|O_NONBLOCK|O_CLOEXEC)) == -1)
int flags = strchr(*type, 'e') ? O_CLOEXEC : 0;
fd = open(file, O_WRONLY|O_APPEND|O_SHLOCK|O_CLOEXEC);
if ((fd = open(file, O_CREAT|O_WRONLY|O_EXLOCK|O_CLOEXEC, 0644)) == -1)
db = dbopen(fname, O_RDONLY|O_SHLOCK|O_CLOEXEC, 0, DB_HASH, NULL);
db = dbopen(fname, O_RDWR|O_CREAT|O_EXLOCK|O_CLOEXEC, 0644, DB_HASH, NULL);
O_WRONLY | O_NONBLOCK | O_CLOEXEC, 0)) >= 0) {
#define OPEN_FLAGS (O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC)
if ((fd = open(filename, O_RDONLY | O_CLOEXEC)) < 0)
f = open(filename, O_RDONLY | O_CLOEXEC, 0666);
if ((fd = open(path, O_RDONLY|O_CLOEXEC)) == -1)
ext->kq = kqueue1(O_CLOEXEC);
if ((kq = kqueue1(O_CLOEXEC)) == -1) {
o |= O_CLOEXEC;
O_CLOEXEC | O_CLOFORK)) != 0) {
{ if ((fdzero = open(_PATH_DEVZERO, O_RDWR | O_CLOEXEC, 0000)) == -1) \
__clockctl_fd = open(_PATH_CLOCKCTL, O_WRONLY | O_CLOEXEC, 0);
__clockctl_fd = open(_PATH_CLOCKCTL, O_WRONLY | O_CLOEXEC, 0);
__clockctl_fd = open(_PATH_CLOCKCTL, O_WRONLY | O_CLOEXEC, 0);
__clockctl_fd = open(_PATH_CLOCKCTL, O_WRONLY | O_CLOEXEC, 0);
int oflags = (O_RDONLY | O_BINARY | O_CLOEXEC | O_CLOFORK
| O_BINARY | O_CLOEXEC | O_CLOFORK | O_DIRECTORY));
#ifndef O_CLOEXEC
if ((fd = open(YPBINDLOCK, O_RDONLY | O_CLOEXEC)) == -1)
if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1) {
kd->nlfd = open(_PATH_KSYMS, O_RDONLY | O_CLOEXEC, 0);
if ((kd->nlfd = open(uf, O_RDONLY | O_CLOEXEC, 0)) < 0) {
if ((kd->pmfd = open(mf, flag | O_CLOEXEC, 0)) < 0) {
if ((kd->vmfd = open(_PATH_KMEM, flag | O_CLOEXEC, 0)) < 0) {
if ((kd->swfd = open(sf, flag | O_CLOEXEC, 0)) < 0) {
nvmm_fd = open("/dev/nvmm", O_RDONLY | O_CLOEXEC);
nvmm_fd = open("/dev/nvmm", O_WRONLY | O_CLOEXEC);
return open(path, oflag | O_CLOEXEC | O_NOFOLLOW, mode);
#ifdef O_CLOEXEC
opts |= O_CLOEXEC;
#ifndef O_CLOEXEC
fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC);
if ((flags & ~(O_CLOEXEC|O_NONBLOCK)) != 0)
res |= cvtto_bsd_mask(lflags, LINUX_O_CLOEXEC, O_CLOEXEC);
res |= cvtto_linux_mask(bflags, O_CLOEXEC, LINUX_O_CLOEXEC);
if ((flags & ~O_CLOEXEC) != 0)
if ((flags & ~(O_CLOEXEC|O_NONBLOCK)) != 0)
if ((flags & ~(O_CLOEXEC|O_NONBLOCK)) != 0)
if (!(flags & O_CLOEXEC))
fd_set_exclose(curlwp, fd, (flag & O_CLOEXEC) != 0);
if (flags & ~(O_CLOEXEC|O_CLOFORK|O_NONBLOCK|O_NOSIGPIPE))
fd_set_exclose(curlwp, newfd, (flags & O_CLOEXEC) != 0);
fd_set_exclose(l, fd, (flags & O_CLOEXEC) != 0);
SCARG(&kqa, flags) |= O_CLOEXEC;
if (flags & ~(O_CLOEXEC|O_CLOFORK|O_NONBLOCK|O_NOSIGPIPE))
fd_set_exclose(l, fildes[0], (flags & O_CLOEXEC) != 0);
fd_set_exclose(l, fildes[1], (flags & O_CLOEXEC) != 0);
fd_set_exclose(l, *fd, (flags & O_CLOEXEC) != 0);
O_CLOEXEC : 0) |
if (flags & ~(O_CLOEXEC|O_CLOFORK|O_NONBLOCK|O_NOSIGPIPE))
if (flags & O_CLOEXEC)
fd_set_exclose(l, fd, (flags & O_CLOEXEC) != 0);
if (flags & O_CLOEXEC)
#define EPOLL_CLOEXEC O_CLOEXEC
#define EFD_CLOEXEC O_CLOEXEC
O_DIRECTORY|O_CLOEXEC|O_CLOFORK|O_NOSIGPIPE|\
#define TFD_CLOEXEC O_CLOEXEC
RL(fd3 = dup3(STDIN_FILENO, 3, O_CLOEXEC));
RL(fd = kqueue1(O_CLOEXEC));
RL(fd = open("file", O_RDWR|O_CREAT|O_CLOEXEC, 0644));
RL(pipe2(fd, O_CLOEXEC));
RL(pipe2(fd, O_CLOEXEC));
RL(fd = open("/dev/drvctl", O_RDONLY|O_CLOEXEC));
RL(fd2 = open("/dev/null", O_WRONLY, O_CLOEXEC));
RL(pipe2(fd, O_CLOEXEC));
O_SYNC, O_CLOEXEC
O_SYNC, O_CLOEXEC
ATF_REQUIRE_ERRNO(EINVAL, dup3(fd, fd, O_CLOEXEC) == -1);
ATF_REQUIRE_ERRNO(EINVAL, dup3(-1, -1, O_CLOEXEC) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup3(fd, -1, O_CLOEXEC) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup3(-1, fd, O_CLOEXEC) == -1);
res.rlim_cur + 1, O_CLOEXEC) == -1);
fd = dup3(fd1, fd2, O_CLOEXEC);
err = pipe2(filedes, O_CLOEXEC);
run(O_CLOEXEC);
if (flags & O_CLOEXEC) {
if ((fdm = posix_openpt(O_RDWR|O_NONBLOCK|O_CLOEXEC|O_CLOFORK)) == -1) {
RL(accept4(sock, NULL, NULL, O_CLOEXEC));
#ifndef O_CLOEXEC
if ((dotfd = open(".", O_RDONLY | O_CLOEXEC, 0)) == -1)
ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC);
ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC);
if (pipe2(pi, O_CLOEXEC) == -1)
O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_SYNC|O_CLOEXEC, 0);
if (pipe2(p, O_CLOEXEC) == -1)
if ((fd = open(fname, flags | O_CLOEXEC, 0600)) != -1 &&
image = open(tempname, O_RDWR | O_CLOEXEC);
if (pipe2(p, O_CLOEXEC) < 0)
for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR|O_CLOEXEC)) == -1; i++) {
if (pipe2(ktrpipe, O_CLOEXEC|O_NONBLOCK) == -1) {
fd = open(dev, O_RDWR | O_CLOEXEC);
autofs_fd = open(AUTOFS_PATH, O_RDWR | O_CLOEXEC);
autofs_fd = open(AUTOFS_PATH, O_RDWR | O_CLOEXEC);
r = pipe2(detach_msg_pipe, O_CLOEXEC|O_NOSIGPIPE);