From 1a8e9bba39ed97634ae61ad146653071da666143 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 15 Nov 2021 20:30:13 +0100 Subject: drop bespoke ioctl() wrapper --- src/vtcol.rs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src/vtcol.rs') diff --git a/src/vtcol.rs b/src/vtcol.rs index 707f96d..2c41d7b 100644 --- a/src/vtcol.rs +++ b/src/vtcol.rs @@ -265,19 +265,6 @@ impl<'a> Job } } /* [impl Job] */ -/* Rust appears to come with two wrappers for ``ioctl(2)``, but neither can be utilized for our - * purposes. The one in ``sys`` is part of a private (seriously‽) whereas the one in the - * ``libc`` module is defined as taking variable arguments and therefore cannot be called from - * Rust. Wrapping C is still a bit awkward, as it seems. - */ -extern "C" { - pub fn ioctl( - d: libc::c_int, - request: libc::c_int, - data: *mut libc::c_void, - ) -> libc::c_int; -} - const CONSOLE_PATHS: [&str; 6] = [ "/proc/self/fd/0", "/dev/tty", @@ -302,10 +289,10 @@ fn fd_of_path(path: &std::path::Path) -> Option let mut tty_type: libc::c_char = 0; let res = unsafe { - ioctl( + libc::ioctl( fd, - vtcol::KDGKBTYPE as libc::c_int, - std::mem::transmute(&mut tty_type), + vtcol::KDGKBTYPE, + &mut tty_type as *mut _ ) }; if res < 0 { -- cgit v1.2.3