Skip to main content

LINUX_IOCTL

Struct LINUX_IOCTL 

Source
pub struct LINUX_IOCTL;
Available on crate feature linux only.
Expand description

๐Ÿง ๐Ÿ“ Linux ioctl constants.


๐Ÿ“ sys/os/linux/io


Implementationsยง

Sourceยง

impl LINUX_IOCTL

ยงGet and set terminal attributes


Source

pub const TCGETS: c_ulong = 0x5401

Get the current serial port settings.

Argument: struct termios *argp

Source

pub const TCSETS: c_ulong = 0x5402

Set the current serial port settings.

Argument: const struct termios *argp

Source

pub const TCSETSW: c_ulong = 0x5403

Allow the output buffer to drain, and set the current serial port settings.

Argument: const struct termios *argp

Source

pub const TCSETSF: c_ulong = 0x5404

Allow the output buffer to drain, discard pending input, and set the current serial port settings.

Argument: const struct termios *argp

Source

pub const TCGETS2: c_ulong = 0x802c_542a

Get the current serial port settings. (termios2)

Argument: struct termios2 *argp

Source

pub const TCSETS2: c_ulong = 0x402c_542b

Set the current serial port settings. (termios2)

Argument: const struct termios2 *argp

Source

pub const TCSETSW2: c_ulong = 0x402c_542c

Allow the output buffer to drain, and set the current serial port settings. (termios2)

Argument: const struct termios2 *argp

Source

pub const TCSETSF2: c_ulong = 0x402c_542d

Allow the output buffer to drain, discard pending input, and set the current serial port settings. (termios2)

Argument: const struct termios2 *argp

Source

pub const TCGETA: c_ulong = 0x5405

Get the current serial port settings. (termio)

Argument: struct termio *argp

Source

pub const TCSETA: c_ulong = 0x5406

Set the current serial port settings. (termio)

Argument: const struct termio *argp

Source

pub const TCSETAW: c_ulong = 0x5407

Allow the output buffer to drain, and set the current serial port settings. (termio)

Argument: const struct termio *argp

Source

pub const TCSETAF: c_ulong = 0x5408

Allow the output buffer to drain, discard pending input, and set the current serial port settings. (termio)

Argument: const struct termio *argp

Sourceยง

impl LINUX_IOCTL

ยงSoftware flow control


Source

pub const TCXONC: c_ulong = 0x540A

Equivalent to tcflow(fd, arg).

Argument: int arg

See tcflow(3) for the argument values TCOOFF, TCOON, TCIOFF, TCION.

Source

pub const TCOOFF: c_int = 0

Suspends output.

Source

pub const TCOON: c_int = 1

Resumes suspended output.

Source

pub const TCIOFF: c_int = 2

Sends a STOP character to the terminal, to stop the terminal from sending any further input.

Source

pub const TCION: c_int = 3

Sends a START character to the terminal, to tell the terminal that it can resume sending input.

Sourceยง

impl LINUX_IOCTL

ยงExclusive mode


Source

pub const TIOCEXCL: c_ulong = 0x540C

Put the terminal into exclusive mode.

No further open(2) operations on the terminal are permitted. (They fail with EBUSY, except for a process with the CAP_SYS_ADMIN capability.)

Source

pub const TIOCNXCL: c_ulong = 0x540D

Disable exclusive mode.

Source

pub const TIOCGEXCL: c_ulong = 0x8004_5440

(since Linux 3.8) If the terminal is currently in exclusive mode, place a nonzero value in the location pointed to by argp; otherwise, place zero in *argp.

Sourceยง

impl LINUX_IOCTL

ยงFaking input


Source

pub const TIOCSTI: c_ulong = 0x5412

Insert the given byte in the input queue.

Argument: const char *argp

Sourceยง

impl LINUX_IOCTL

ยงGet and set window size


Source

pub const TIOCGWINSZ: c_ulong = 0x5413

Get window size.

Argument: struct winsize *argp

Source

pub const TIOCSWINSZ: c_ulong = 0x5414

Set window size.

Argument: const struct winsize *argp

Sourceยง

impl LINUX_IOCTL

ยงModem control


Source

pub const TIOCMGET: c_ulong = 0x5415

Get the status of modem bits.

Argument: int *argp

Source

pub const TIOCMBIS: c_ulong = 0x5416

Set the indicated modem bits.

Argument: const int *argp

Source

pub const TIOCMBIC: c_ulong = 0x5417

Clear the indicated modem bits.

Argument: const int *argp

Source

pub const TIOCMSET: c_ulong = 0x5418

Set the status of modem bits.

Argument: const int *argp

Source

pub const TIOCM_LE: c_int = 0x001

DSR (data set ready/line enable)

Source

pub const TIOCM_DTR: c_int = 0x002

DTR (data terminal ready)

Source

pub const TIOCM_RTS: c_int = 0x004

RTS (request to send)

Source

pub const TIOCM_ST: c_int = 0x008

Secondary TXD (transmit)

Source

pub const TIOCM_SR: c_int = 0x010

Secondary RXD (receive)

Source

pub const TIOCM_CTS: c_int = 0x020

CTS (clear to send)

Source

pub const TIOCM_CAR: c_int = 0x040

DCD (data carrier detect)

Source

pub const TIOCM_CD: c_int = Self::TIOCM_CAR

Source

pub const TIOCM_RNG: c_int = 0x080

RNG (ring)

Source

pub const TIOCM_RI: c_int = Self::TIOCM_RNG

Source

pub const TIOCM_DSR: c_int = 0x100

DSR (data set ready)

Sourceยง

impl LINUX_IOCTL

ยงMarking a line as local


Source

pub const TIOCGSOFTCAR: c_ulong = 0x5419

(โ€œGet software carrier flagโ€)

Get the status of the CLOCAL flag in the c_cflag field of the termios structure.

Argument: int *argp

Source

pub const TIOCSSOFTCAR: c_ulong = 0x541A

(โ€œSet software carrier flagโ€)

Set the CLOCAL flag in the termios structure when *argp is nonzero, and clear it otherwise.

Argument: const int *argp

Sourceยง

impl LINUX_IOCTL

ยงBuffer count and flushing


Source

pub const FIONREAD: c_ulong = 0x541B

Get the number of bytes in the input buffer.

Source

pub const TIOCINQ: c_ulong = Self::FIONREAD

Same as FIONREAD.

Source

pub const TIOCOUTQ: c_ulong = 0x5411

Get the number of bytes in the output buffer.

Source

pub const TCFLSH: c_ulong = 0x540B

See tcflush(3) for the argument values TCIFLUSH, TCOFLUSH, TCIOFLUSH.

Equivalent to tcflush(fd, arg).

Source

pub const TIOCSERGETLSR: c_ulong = 0x5459

Get line status register.

Status register has TIOCSER_TEMT bit set when output buffer is empty and also hardware transmitter is physically empty.

Sourceยง

impl LINUX_IOCTL

ยงLinux-specific


Source

pub const TIOCLINUX: c_ulong = 0x541C

Linux-specific ioctls.

The action of the following ioctls depends on the first byte in the struct pointed to by argp, referred to here as the subcode. These are legal only for the superuser or the owner of the current terminal. Symbolic subcodes are available in <linux/tiocl.h> since Linux 2.5.71.

See https://man7.org/linux/man-pages/man2/ioctl_console.2.html.

Sourceยง

impl LINUX_IOCTL

ยงRedirecting console output


Source

pub const TIOCCONS: c_ulong = 0x541D

Redirect output that would have gone to /dev/console or /dev/tty0 to the given terminal.

Argument: void

If that was a pseudoterminal master, send it to the slave. Before Linux 2.6.10, anybody can do this as long as the output was not redirected yet; since Linux 2.6.10, only a process with the CAP_SYS_ADMIN capability may do this. If output was redirected already, then EBUSY is returned, but redirection can be stopped by using this ioctl with fd pointing at /dev/console or /dev/tty0.

Sourceยง

impl LINUX_IOCTL

ยงPseudoterminal ioctls


Source

pub const TIOCPKT: c_ulong = 0x5420

Enable (when *argp is nonzero) or disable packet mode.

Argument: const int *argp

Can be applied to the master side of a pseudoterminal only (and will return ENOTTY otherwise).

In packet mode, each subsequent read(2) will return a packet that either contains a single nonzero control byte, or has a single byte containing zero (โ€˜\0โ€™) followed by data written on the slave side of the pseudoterminal.

If the first byte is not TIOCPKT_DATA (0), it is an OR of one or more of the following bits:

  • TIOCPKT_FLUSHREAD The read queue for the terminal is flushed.
  • TIOCPKT_FLUSHWRITE The write queue for the terminal is flushed.
  • TIOCPKT_STOP Output to the terminal is stopped.
  • TIOCPKT_START Output to the terminal is restarted.
  • TIOCPKT_DOSTOP The start and stop characters are ^S/^Q.
  • TIOCPKT_NOSTOP The start and stop characters are not ^S/^Q.
Source

pub const TIOCSPTLCK: c_ulong = 0x4004_5431

Set (if *argp is nonzero) or remove (if *argp is zero) the lock on the pseudoterminal slave device.

Argument: int *argp

Source

pub const TIOCGPKT: c_ulong = 0x8004_5438

Return the current packet mode setting in the integer pointed to by argp.

Argument: const int *argp

Source

pub const TIOCGPTLCK: c_ulong = 0x8004_5439

Place the current lock state of the pseudoterminal slave device in the location pointed to by argp.

Argument: int *argp

Source

pub const TIOCGPTPEER: c_ulong = 0x5441

Open and return a new file descriptor that refers to the peer pseudoterminal slave device.

Argument: int flags

Given a file descriptor in fd that refers to a pseudoterminal master, open (with the given open(2)-style flags) and return a new file descriptor that refers to the peer pseudoterminal slave device.

This operation can be performed regardless of whether the pathname of the slave device is accessible through the calling processโ€™s mount namespace.

Sourceยง

impl LINUX_IOCTL

ยงControlling terminal


Source

pub const TIOCSCTTY: c_ulong = 0x540E

Make the given terminal the controlling terminal of the calling process.

Argument: int arg

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.

Source

pub const TIOCNOTTY: c_ulong = 0x5422

Give up this controlling terminal.

Argument: void

If the process was session leader, then send SIGHUP and SIGCONT to the foreground process group and all processes in the current session lose their controlling terminal.

Sourceยง

impl LINUX_IOCTL

ยงLine discipline


Source

pub const TIOCSETD: c_ulong = 0x5423

Get the line discipline of the terminal.

Argument: int *argp

Source

pub const TIOCGETD: c_ulong = 0x5424

Set the line discipline of the terminal.

Argument: const int *argp

Sourceยง

impl LINUX_IOCTL

ยงSending a break


Source

pub const TCSBRK: c_ulong = 0x5409

Equivalent to tcsendbreak(fd, arg).

Argument: int arg

If the terminal is using asynchronous serial data transmission, and arg is zero, then send a break (a stream of zero bits) for between 0.25 and 0.5 seconds. If the terminal is not using asynchronous serial data transmission, then either a break is sent, or the function returns without doing anything. When arg is nonzero, nobody knows what will happen.

Source

pub const TCSBRKP: c_ulong = 0x5425

So-called โ€œPOSIX versionโ€ of TCSBRK.

It treats nonzero arg as a time interval measured in deciseconds, and does nothing when the driver does not support breaks.

Argument: int arg

Source

pub const TIOCSBRK: c_ulong = 0x5427

Turn break on, that is, start sending zero bits.

Argument: void

Source

pub const TIOCCBRK: c_ulong = 0x5428

Turn break off, that is, stop sending zero bits.

Argument: void

Sourceยง

impl LINUX_IOCTL

ยงProcess group and session ID
Source

pub const TIOCGSID: c_ulong = 0x5429

Get the session ID of the given terminal.

Argument: pid_t *argp

This fails with the error ENOTTY if the terminal is not a master pseudoterminal and not our controlling terminal.

Source

pub const TIOCGPGRP: c_ulong = 0x540F

Get the process group ID of the foreground process group on this terminal.

Argument: pid_t *argp

Source

pub const TIOCSPGRP: c_ulong = 0x5410

Set the foreground process group ID of this terminal.

Argument: const pid_t *argp

Sourceยง

impl LINUX_IOCTL

ยงMiscellaneous


Source

pub const FIONBIO: c_ulong = 0x5421

Set non-blocking I/O mode if the argument is non-zero.

In non-blocking mode, read(2) or write(2) calls return -1 and set errno to EAGAIN immediately when no data is available.

Source

pub const TIOCGSERIAL: c_ulong = 0x541E

Source

pub const TIOCSSERIAL: c_ulong = 0x541F

Source

pub const TIOCGRS485: c_ulong = 0x542E

Source

pub const TIOCSRS485: c_ulong = 0x542F

Source

pub const TIOCGPTN: c_ulong = 0x8004_5430

Source

pub const TIOCGDEV: c_ulong = 0x8004_5432

Source

pub const TCGETX: c_ulong = 0x5432

Source

pub const TCSETX: c_ulong = 0x5433

Source

pub const TCSETXF: c_ulong = 0x5434

Source

pub const TCSETXW: c_ulong = 0x5435

Source

pub const TIOCSIG: c_ulong = 0x4004_5436

Source

pub const TIOCVHANGUP: c_ulong = 0x5437

Source

pub const FIONCLEX: c_ulong = 0x5450

Source

pub const FIOCLEX: c_ulong = 0x5451

Source

pub const FIOASYNC: c_ulong = 0x5452

Source

pub const TIOCSERCONFIG: c_ulong = 0x5453

Source

pub const TIOCSERGWILD: c_ulong = 0x5454

Source

pub const TIOCSERSWILD: c_ulong = 0x5455

Source

pub const TIOCGLCKTRMIOS: c_ulong = 0x5456

Source

pub const TIOCSLCKTRMIOS: c_ulong = 0x5457

Source

pub const TIOCSERGSTRUCT: c_ulong = 0x5458

Source

pub const TIOCSERGETMULTI: c_ulong = 0x545A

Source

pub const TIOCSERSETMULTI: c_ulong = 0x545B

Source

pub const TIOCMIWAIT: c_ulong = 0x545C

Source

pub const TIOCGICOUNT: c_ulong = 0x545D

Source

pub const BLKIOMIN: c_ulong = 0x1278

Source

pub const BLKIOOPT: c_ulong = 0x1279

Source

pub const BLKSSZGET: c_ulong = 0x1268

Source

pub const BLKPBSZGET: c_ulong = 0x127B

Trait Implementationsยง

Sourceยง

impl Debug for LINUX_IOCTL

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> AnyExt for T
where T: Any + ?Sized,

Sourceยง

fn type_id() -> TypeId

Returns the TypeId of Self. Read more
Sourceยง

fn type_of(&self) -> TypeId

Returns the TypeId of self. Read more
Sourceยง

fn type_name(&self) -> &'static str โ“˜

Returns the type name of self. Read more
Sourceยง

fn type_is<T: 'static>(&self) -> bool

Returns true if Self is of type T. Read more
Sourceยง

fn type_hash(&self) -> u64

Returns a deterministic hash of the TypeId of Self.
Sourceยง

fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64

Returns a deterministic hash of the TypeId of Self using a custom hasher.
Sourceยง

fn as_any_ref(&self) -> &dyn Any
where Self: Sized,

Upcasts &self as &dyn Any. Read more
Sourceยง

fn as_any_mut(&mut self) -> &mut dyn Any
where Self: Sized,

Upcasts &mut self as &mut dyn Any. Read more
Sourceยง

fn as_any_box(self: Box<Self>) -> Box<dyn Any>
where Self: Sized,

Available on crate feature alloc only.
Upcasts Box<self> as Box<dyn Any>. Read more
Sourceยง

fn downcast_ref<T: 'static>(&self) -> Option<&T> โ“˜

Available on crate feature unsafe_layout and non-crate feature safe_code only.
Returns some shared reference to the inner value if it is of type T. Read more
Sourceยง

fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> โ“˜

Available on crate feature unsafe_layout and non-crate feature safe_code only.
Returns some exclusive reference to the inner value if it is of type T. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> ByteSized for T

Sourceยง

const BYTE_ALIGN: usize = _

The alignment of this type in bytes.
Sourceยง

const BYTE_SIZE: usize = _

The size of this type in bytes.
Sourceยง

fn byte_align(&self) -> usize

Returns the alignment of this type in bytes.
Sourceยง

fn byte_size(&self) -> usize

Returns the size of this type in bytes. Read more
Sourceยง

fn ptr_size_ratio(&self) -> [usize; 2]

Returns the size ratio between Ptr::BYTES and BYTE_SIZE. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> Hook for T

Sourceยง

fn hook<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Hooks a mutation step into the value and returns it. Read more
Sourceยง

fn tap<F>(self, f: F) -> Self
where F: FnOnce(&Self),

Taps into the value for observation and returns it unchanged. Read more
Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> MemExt for T
where T: ?Sized,

Sourceยง

const NEEDS_DROP: bool = _

Know whether dropping values of this type matters, in compile-time.
Sourceยง

fn mem_align_of<T>() -> usize

Returns the minimum alignment of the type in bytes. Read more
Sourceยง

fn mem_align_of_val(&self) -> usize

Returns the alignment of the pointed-to value in bytes. Read more
Sourceยง

fn mem_size_of<T>() -> usize

Returns the size of a type in bytes. Read more
Sourceยง

fn mem_size_of_val(&self) -> usize

Returns the size of the pointed-to value in bytes. Read more
Sourceยง

fn mem_copy(&self) -> Self
where Self: Copy,

Bitwise-copies a value. Read more
Sourceยง

fn mem_needs_drop(&self) -> bool

Returns true if dropping values of this type matters. Read more
Sourceยง

fn mem_drop(self)
where Self: Sized,

Drops self by running its destructor. Read more
Sourceยง

fn mem_forget(self)
where Self: Sized,

Forgets about self without running its destructor. Read more
Sourceยง

fn mem_replace(&mut self, other: Self) -> Self
where Self: Sized,

Replaces self with other, returning the previous value of self. Read more
Sourceยง

fn mem_take(&mut self) -> Self
where Self: Default,

Replaces self with its default value, returning the previous value of self. Read more
Sourceยง

fn mem_swap(&mut self, other: &mut Self)
where Self: Sized,

Swaps the value of self and other without deinitializing either one. Read more
Sourceยง

unsafe fn mem_zeroed<T>() -> T

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Sourceยง

unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Sourceยง

fn mem_as_bytes(&self) -> &[u8] โ“˜
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &[u8]. Read more
Sourceยง

fn mem_as_bytes_mut(&mut self) -> &mut [u8] โ“˜
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &mut [u8]. Read more
Sourceยง

impl<T, R> Morph<R> for T
where T: ?Sized,

Sourceยง

fn morph<F>(self, f: F) -> R
where F: FnOnce(Self) -> R, Self: Sized,

Morphs the value into a new one and returns it. Read more
Sourceยง

fn morph_ref<F>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Morphs the value by shared reference and returns the result. Read more
Sourceยง

fn morph_mut<F>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Morphs the value by exclusive reference and returns the result. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> โ“˜

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> โ“˜

Performs the conversion.