dcuddeback / ioctl-rs Goto Github PK
View Code? Open in Web Editor NEWRust bindings for system ioctls.
License: MIT License
Rust bindings for system ioctls.
License: MIT License
In C:
#include <sys/ioctl.h>
int ioctl(int d, unsigned long request, ...);
Library (at least inside os::linux
):
extern "C" {
pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int;
}
I believe request
should be a c_uint
, otherwise ioctls >= 0x8000_0000
or higher will cause overflow warnings.
For example, from man tty_ioctl
:
Controlling terminal
TIOCSCTTY int arg
Make the given terminal the controlling terminal of the calling process. The calling process must be a session leader and not have a controlling terminal already. For this case, arg should be specified as zero.
If this terminal is already the controlling terminal of a different session group, then the ioctl fails with EPERM, unless the caller has the CAP_SYS_ADMIN capability and arg equals 1, in which case the terminal is
stolen, and all processes that had it as controlling terminal lose it.
TIOCNOTTY void
If the given terminal was the controlling terminal of the calling process, give up this controlling terminal. If the process was session leader, then send SIGHUP and SIGCONT to the foreground process group and all pro‐
cesses in the current session lose their controlling terminal.
Process group and session ID
TIOCGPGRP pid_t *argp
When successful, equivalent to *argp = tcgetpgrp(fd).
Get the process group ID of the foreground process group on this terminal.
TIOCSPGRP const pid_t *argp
Equivalent to tcsetpgrp(fd, *argp).
Set the foreground process group ID of this terminal.
TIOCGSID pid_t *argp
Get the session ID of the given terminal. This will fail with ENOTTY in case the terminal is not a master pseudoterminal and not our controlling terminal. Strange.
tiocsctty()
, tiocnotty()
, tiocgpgrp()
, etc. are missing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.