Commit Graph

76 Commits

Author SHA1 Message Date
Luca Bruno
d9f1b3df60
unistd: add fexecve()
This adds fexecve() to `nix::unistd`. It is available in libc since 0.2.29.

Ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html
2017-08-18 08:12:36 +00:00
Nicolas Dusart
f14c5862b1 add poll module for all platforms 2017-07-26 10:04:53 +02:00
Alan Somers
ce04f1ce80 Fix thread safety issues in pty and termios tests
ptsname(3) returns a pointer to a global variable, so it isn't
thread-safe.  Protect it with a mutex.
2017-07-19 22:59:47 -06:00
Bryant Mairs
74ea3c7220 Remove signalfd feature in favor of conditional compilation
Note that this is now only available for Linux as support is missing in libc
for Android (see rust-lang/libc#671).

As part of this work the SIGUSR2 signal mutex was altered to be a general
signal mutex. This is because all signal handling is shared across all threads
in the Rust test harness, so if you alter one signal, depending on whether it's
additive or may overwrite the mask for other signals, it could break the other
ones. Instead of putting this on the user, just broaden the scope of the mutex
so that any altering of signal handling needs to use it.
2017-07-18 13:04:31 -07:00
Alan Somers
64f798492c Fix thread safety issues in aio, chdir, and wait tests
They have four problems:

* The chdir tests change the process's cwd, which is global.  Protect them
  all with a mutex.

* The wait tests will reap any subprocess, and several tests create
  subprocesses.  Protect them all with a mutex so only one
  subprocess-creating test will run at a time.

* When a multithreaded test forks, the child process can sometimes block in
  the stack unwinding code.  It blocks on a mutex that was held by a
  different thread in the parent, but that thread doesn't exist in the
  child, so a deadlock results.  Fix this by immediately calling
  std::process:exit in the child processes.

* My previous attempt at thread safety in the aio tests didn't work, because
  anonymous MutexGuards drop immediately.  Fix this by naming the
  SIGUSR2_MTX MutexGuards.

Fixes #251
2017-07-16 13:29:27 -06:00
Alan Somers
a50b476578 Fix double close bugs in test_lseek and test_lseek64
std::fs::File closes the underlying file descriptor on Drop, without
checking for errors.  test_lseek and test_lseek64 also manually close
the file descriptor.  That works for single threaded test runs.  But for
multithreaded runs, it causes EBADF errors in other tests.  Fix the
tests by consuming the File with into_raw_fd(), so its drop method will
never be called.

Also, fix a potential short read bug in the same tests.
2017-07-09 11:38:40 -06:00
Kelvin Ly
45b7b1bd1a Add openpty() 2017-06-12 08:34:16 -04:00
Bryant Mairs
4e97520799 Add various pty functions
* grantpt
  * ptsname/ptsname_r
  * posix_openpt
  * unlockpt
2017-05-16 20:40:25 -07:00
Alan Somers
46ed256ff6 tests should protect concurrent access to signal handlers
Adds a mutex to protect access to SIGUSR2 signal handlers by the AIO
tests.

Fixes #578
2017-04-15 15:31:20 -06:00
Alan Somers
34a5c280ed Improve portability of test_getsockname
test_getsockname used an IPv4 socket and assumed that localhost was
"127.0.0.1".  But that assumption doesn't hold on IPv6-only hosts or on
shared-IP FreeBSD jails.  Unfortunately, the Rust standard library
doesn't provide a good way to resolve localhost.  So change the test to
use a unix-domain socket instead.
2016-11-18 21:56:08 -07:00
Kamal Marhubi
c381997c0a linux: Add splice(2), tee(2), vmsplice(2) 2016-02-14 23:41:57 -05:00
Kamal Marhubi
4680d50a8a linux: Add sendfile(2) 2016-02-12 21:12:14 -05:00
Kamal Marhubi
beec2f4443 Add test for if_nametoindex 2016-01-27 17:18:58 -05:00
Utkarsh Kukreti
cec5c6157b Add everything from poll.h. 2016-01-25 17:50:39 -05:00
Kamal Marhubi
4450b96399 Use tempdir for temporary files in tests 2016-01-13 09:56:14 -08:00
Corey Richardson
23332d6e8d Fix tests 2015-08-12 19:29:21 -05:00
Carl Lerche
ecbaadde52 Run 32 bit CI builds 2015-07-09 16:28:51 -07:00
Markus Jais
8127b4dd6d Basic Posix MQ support 2015-04-27 13:37:18 -07:00
Florian Hartwig
e5ae756203 'derive(Copy)' needs Clone now 2015-04-03 20:55:39 +02:00
Carl Lerche
c252b4d534 Use libc from crates.io 2015-03-25 18:41:57 -07:00
Carl Lerche
0d5ea0b16d Track Rust master 2015-03-25 10:52:05 -07:00
Carl Lerche
2b60633c8b Track Rust nightlies 2015-03-19 15:08:45 -07:00
Carl Lerche
0e369e931f Fix deprecation warnings 2015-03-16 15:39:51 -07:00
Carl Lerche
8a7cd5675d Large cleanup, mostly of socket functions 2015-02-25 12:24:43 -08:00
Carl Lerche
6af51aa232 Fix uio and add SockAddr conversions 2015-02-21 22:42:10 -08:00
Carl Lerche
60ccee778b Cleanup readv & writev + tests 2015-02-21 14:33:27 -08:00