tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[PATCH] make: Use macro FD_CLOEXEC instead of its raw value
Hi,
find attached a patch for usr.bin/make that makes it use the constant
FD_CLOEXEC instead of just passing its value 1 to fcntl().
I guess we can expect that our build platforms have FD_CLOEXEC these
days, right? Otherwise we can define FD_CLOEXEC ourselves (make.h?) if
it's missing.
Thanks,
Tilman
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 182b1c8..8e74ce5 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -412,8 +412,8 @@ JobCreatePipe(Job *job, int minfd)
}
/* Set close-on-exec flag for both */
- (void)fcntl(job->jobPipe[0], F_SETFD, 1);
- (void)fcntl(job->jobPipe[1], F_SETFD, 1);
+ (void)fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC);
+ (void)fcntl(job->jobPipe[1], F_SETFD, FD_CLOEXEC);
/*
* We mark the input side of the pipe non-blocking; we poll(2) the
@@ -1582,7 +1582,7 @@ JobStart(GNode *gn, int flags)
if (job->cmdFILE == NULL) {
Punt("Could not fdopen %s", tfile);
}
- (void)fcntl(FILENO(job->cmdFILE), F_SETFD, 1);
+ (void)fcntl(FILENO(job->cmdFILE), F_SETFD, FD_CLOEXEC);
/*
* Send the commands to the command file, flush all its buffers then
* rewind and remove the thing.
@@ -2835,8 +2835,8 @@ Job_ServerStart(int max_tokens, int jp_0, int jp_1)
/* Pipe passed in from parent */
tokenWaitJob.inPipe = jp_0;
tokenWaitJob.outPipe = jp_1;
- (void)fcntl(jp_0, F_SETFD, 1);
- (void)fcntl(jp_1, F_SETFD, 1);
+ (void)fcntl(jp_0, F_SETFD, FD_CLOEXEC);
+ (void)fcntl(jp_1, F_SETFD, FD_CLOEXEC);
return;
}
diff --git a/usr.bin/make/meta.c b/usr.bin/make/meta.c
index 3f2b884..aa889a7 100644
--- a/usr.bin/make/meta.c
+++ b/usr.bin/make/meta.c
@@ -144,8 +144,8 @@ filemon_open(BuildMon *pbm)
err(1, "Could not set filemon file descriptor!");
}
/* we don't need these once we exec */
- (void)fcntl(pbm->mon_fd, F_SETFD, 1);
- (void)fcntl(pbm->filemon_fd, F_SETFD, 1);
+ (void)fcntl(pbm->mon_fd, F_SETFD, FD_CLOEXEC);
+ (void)fcntl(pbm->filemon_fd, F_SETFD, FD_CLOEXEC);
}
/*
@@ -1423,8 +1423,8 @@ meta_compat_start(void)
if (pipe(childPipe) < 0)
Punt("Cannot create pipe: %s", strerror(errno));
/* Set close-on-exec flag for both */
- (void)fcntl(childPipe[0], F_SETFD, 1);
- (void)fcntl(childPipe[1], F_SETFD, 1);
+ (void)fcntl(childPipe[0], F_SETFD, FD_CLOEXEC);
+ (void)fcntl(childPipe[1], F_SETFD, FD_CLOEXEC);
}
void
Home |
Main Index |
Thread Index |
Old Index