From 632f9f18e59a1632ec616d0270f22b8a8958792b Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Thu, 22 Nov 2018 18:43:45 -0700
Subject: [PATCH] fpending

---
 core_io                 | 2 +-
 src/header/stdio/mod.rs | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/core_io b/core_io
index eb7204830..a4ddc3806 160000
--- a/core_io
+++ b/core_io
@@ -1 +1 @@
-Subproject commit eb7204830786d7cbb776c6a878c7a59569840484
+Subproject commit a4ddc38063ddb2f2ff1b17f772b8b50f7f3baecd
diff --git a/src/header/stdio/mod.rs b/src/header/stdio/mod.rs
index e94884a90..4f5953b78 100644
--- a/src/header/stdio/mod.rs
+++ b/src/header/stdio/mod.rs
@@ -390,6 +390,13 @@ pub extern "C" fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FI
     }
 }
 
+#[no_mangle]
+pub extern "C" fn __fpending(stream: *mut FILE) -> size_t {
+    let mut stream = unsafe { &mut *stream }.lock();
+
+    stream.writer.inner.buf.len() as size_t
+}
+
 /// Insert a character into the stream
 #[no_mangle]
 pub extern "C" fn fputc(c: c_int, stream: *mut FILE) -> c_int {
-- 
GitLab