Correct the device major ID for pty slave
This commit is contained in:
parent
a41db92b4e
commit
49485058ec
|
|
@ -80,6 +80,9 @@ impl PtyDriver {
|
|||
}
|
||||
|
||||
impl TtyDriver for PtyDriver {
|
||||
// Reference: <https://elixir.bootlin.com/linux/v6.17/source/include/uapi/linux/major.h#L147>.
|
||||
const DEVICE_MAJOR_ID: u32 = 136;
|
||||
|
||||
fn push_output(&self, chs: &[u8]) -> Result<usize> {
|
||||
if self.is_closed() {
|
||||
return_errno_with_message!(Errno::EIO, "the pty master has been closed");
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ use crate::prelude::*;
|
|||
///
|
||||
/// [`Tty`]: super::Tty
|
||||
pub trait TtyDriver: Send + Sync + 'static {
|
||||
/// The device major ID.
|
||||
const DEVICE_MAJOR_ID: u32;
|
||||
|
||||
/// Pushes characters into the output buffer.
|
||||
///
|
||||
/// This method returns the number of bytes pushed or fails with an error if no bytes can be
|
||||
|
|
|
|||
|
|
@ -387,6 +387,6 @@ impl<D: TtyDriver> Device for Tty<D> {
|
|||
}
|
||||
|
||||
fn id(&self) -> DeviceId {
|
||||
DeviceId::new(4, self.index)
|
||||
DeviceId::new(D::DEVICE_MAJOR_ID, self.index)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ pub struct ConsoleDriver {
|
|||
}
|
||||
|
||||
impl TtyDriver for ConsoleDriver {
|
||||
// Reference: <https://elixir.bootlin.com/linux/v6.17/source/include/uapi/linux/major.h#L18>.
|
||||
const DEVICE_MAJOR_ID: u32 = 4;
|
||||
|
||||
fn push_output(&self, chs: &[u8]) -> Result<usize> {
|
||||
self.console.send(chs);
|
||||
Ok(chs.len())
|
||||
|
|
|
|||
Loading…
Reference in New Issue