Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bccaf45

Browse files
authoredJul 30, 2019
Rollup merge of rust-lang#63099 - josephlr:vxworks, r=alexcrichton
vxworks: Remove Linux-specific comments. It looks like the VxWorks fork inadvertently left in some Linux-specific workaround comments in `libstd`, these can be removed. Came up when looking into rust-lang#62516 CC: @BaoshanPang
2 parents 94db68e + 0cdd693 commit bccaf45

File tree

3 files changed

+1
-25
lines changed

3 files changed

+1
-25
lines changed
 

‎src/libstd/sys/vxworks/fs.rs

+1-16
Original file line numberDiff line numberDiff line change
@@ -287,22 +287,7 @@ impl File {
287287
let fd = cvt_r(|| unsafe {
288288
open(path.as_ptr(), flags, opts.mode as c_int)
289289
})?;
290-
let fd = FileDesc::new(fd);
291-
// Currently the standard library supports Linux 2.6.18 which did not
292-
// have the O_CLOEXEC flag (passed above). If we're running on an older
293-
// Linux kernel then the flag is just ignored by the OS. After we open
294-
// the first file, we check whether it has CLOEXEC set. If it doesn't,
295-
// we will explicitly ask for a CLOEXEC fd for every further file we
296-
// open, if it does, we will skip that step.
297-
//
298-
// The CLOEXEC flag, however, is supported on versions of macOS/BSD/etc
299-
// that we support, so we only do this on Linux currently.
300-
fn ensure_cloexec(_: &FileDesc) -> io::Result<()> {
301-
Ok(())
302-
}
303-
304-
ensure_cloexec(&fd)?;
305-
Ok(File(fd))
290+
Ok(File(FileDesc::new(fd)))
306291
}
307292

308293
pub fn file_attr(&self) -> io::Result<FileAttr> {

‎src/libstd/sys/vxworks/net.rs

-4
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ impl Socket {
141141

142142
pub fn accept(&self, storage: *mut sockaddr, len: *mut socklen_t)
143143
-> io::Result<Socket> {
144-
// Unfortunately the only known way right now to accept a socket and
145-
// atomically set the CLOEXEC flag is to use the `accept4` syscall on
146-
// Linux. This was added in 2.6.28, however, and because we support
147-
// 2.6.18 we must detect this support dynamically.
148144
let fd = cvt_r(|| unsafe {
149145
libc::accept(self.0.raw(), storage, len)
150146
})?;

‎src/libstd/sys/vxworks/pipe.rs

-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
1111
static INVALID: AtomicBool = AtomicBool::new(false);
1212

1313
let mut fds = [0; 2];
14-
15-
// Unfortunately the only known way right now to create atomically set the
16-
// CLOEXEC flag is to use the `pipe2` syscall on Linux. This was added in
17-
// 2.6.27, however, and because we support 2.6.18 we must detect this
18-
// support dynamically.
1914
cvt(unsafe { libc::pipe(fds.as_mut_ptr()) })?;
2015

2116
let fd0 = FileDesc::new(fds[0]);

0 commit comments

Comments
 (0)
Please sign in to comment.