diff --git a/src/header/termios/mod.rs b/src/header/termios/mod.rs
index 4ffa7f1860143d94590246028e3547804b07895a..9c8bb7bd36d426caa56b35dd36599e102f804c93 100644
--- a/src/header/termios/mod.rs
+++ b/src/header/termios/mod.rs
@@ -145,6 +145,15 @@ pub unsafe extern "C" fn cfsetospeed(termios_p: *mut termios, speed: speed_t) ->
     -1
 }
 
+#[no_mangle]
+pub unsafe extern "C" fn cfsetspeed(termios_p: *mut termios, speed: speed_t) -> c_int {
+    let r = cfsetispeed(termios_p, speed);
+    if r < 0 {
+        return r;
+    }
+    cfsetospeed(termios_p, speed)
+}
+
 #[no_mangle]
 pub unsafe extern "C" fn tcflush(fd: c_int, queue: c_int) -> c_int {
     sys_ioctl::ioctl(fd, sys_ioctl::TCFLSH, queue as *mut c_void)