summaryrefslogtreecommitdiff
path: root/src/vtcol.rs
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2021-11-15 20:30:13 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2021-11-15 20:14:17 +0100
commit1a8e9bba39ed97634ae61ad146653071da666143 (patch)
tree57887cfc05454d537d5dd6a932ea33e85422756c /src/vtcol.rs
parent3d5a3545f7d900177ecee5046d6660f878d96537 (diff)
downloadvtcol-1a8e9bba39ed97634ae61ad146653071da666143.tar.gz
drop bespoke ioctl() wrapper
Diffstat (limited to 'src/vtcol.rs')
-rw-r--r--src/vtcol.rs19
1 files changed, 3 insertions, 16 deletions
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<vtcol::Fd>
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 {