13 releases
0.3.0-alpha.3 | Feb 11, 2020 |
---|---|
0.3.0-alpha.2 | Feb 6, 2020 |
0.3.0-alpha.1 | Jan 28, 2020 |
0.2.8 | Aug 20, 2019 |
0.1.0 | Aug 3, 2018 |
#518 in Unix APIs
4,674 downloads per month
Used in 18 crates
(8 directly)
76KB
2K
SLoC
palaver
Cross-platform polyfills.
This library attempts to provide reliable polyfills for functionality that isn't implemented on all platforms.
palaver
= "Platform Abstraction Layer" + pa·lav·er n. prolonged and tedious fuss.
Functionality
Threading | Description | Linux | macOS | Windows | FreeBSD | NetBSD | iOS | Android |
---|---|---|---|---|---|---|---|---|
gettid() | Get thread ID | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
count() | Number of threads in current process | ✓ | ✓ | ✓ | ✓ | |||
Files | Description | Linux | macOS | Windows | FreeBSD | NetBSD | iOS | Android |
seal_fd() | Make a file descriptor read-only | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
dup_fd() | Duplicate a file descriptor | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
copy_fd() | Copy a file descriptor to a specific offset | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
move_fd() | Move a file descriptor to a specific offset | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
move_fds() | Move file descriptors to specific offsets | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
fd_dir() | Get a path to the file descriptor directory | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
fd_path() | Get a path to a file descriptor | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
FdIter | Iterate all open file descriptors | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
memfd_create() | Create an anonymous file | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
fexecve() | Execute program specified via file descriptor | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
copy() | Copy by looping io::copy | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
copy_sendfile() | Copy using sendfile | ✓ | ✓ | ✓ | ✓ | ✓ | ||
copy_splice() | Copy using splice | ✓ | ✓ | |||||
pipe() | Create a pipe | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Socket | Description | Linux | macOS | Windows | FreeBSD | NetBSD | iOS | Android |
socket() | Create a socket | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
accept() | Accept a connection on a socket | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
is_connected() | Get whether a pending connection is connected | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
unreceived() | Get number of bytes readable | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
unsent() | Get number of bytes that have yet to be acknowledged | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Env | Description | Linux | macOS | Windows | FreeBSD | NetBSD | iOS | Android |
exe() | Opens the current running executable | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
exe_path() | Get a path to the current running executable | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
args() | Get command line arguments | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
vars() | Get environment variables | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Process | Description | Linux | macOS | Windows | FreeBSD | NetBSD | iOS | Android |
count() | Count the processes visible to the current process | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
count_threads() | Count the threads visible to the current process | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
fork() | Fork a process, using process descriptors where available | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
Valgrind | Description | Linux | macOS | Windows | FreeBSD | NetBSD | iOS | Android |
is() | Check if running under Valgrind | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
start_fd() | Get Valgrind's file descriptor range | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ |
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE.txt or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT.txt or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~3MB
~58K SLoC