]> git.lizzy.rs Git - rust.git/commitdiff
Add a couple more missing pieces to libc and os.
authorGraydon Hoare <graydon@mozilla.com>
Sat, 10 Mar 2012 00:19:18 +0000 (16:19 -0800)
committerGraydon Hoare <graydon@mozilla.com>
Sat, 10 Mar 2012 00:38:23 +0000 (16:38 -0800)
src/etc/libc.c
src/libcore/libc.rs
src/libcore/os.rs

index a91c445208888047612beef1fc2e1a919014ca55..d3fd0671b42f4735876226392ef842a66293903c 100644 (file)
@@ -26,6 +26,9 @@
 #define put_type(N,T) \
         printf("        type %s = %c%d;\n", N, S(T), B(T))
 
+#define put_ftype(N,T) \
+        printf("        type %s = f%d;\n", N, B(T))
+
 #define CT(T) ((((T)-1)<0) ? "int" : "uint")
 #define CS(T) ((((T)-1)<0) ? "" : "_u")
 #define put_const(N,T)                            \
@@ -48,6 +51,9 @@ void c95_types() {
   put_type("c_long", long);
   put_type("c_ulong", unsigned long);
 
+  put_ftype("c_float", float);
+  put_ftype("c_double", double);
+
   put_type("size_t", size_t);
   put_type("ptrdiff_t", ptrdiff_t);
 
index 4e8389d34fcaa78a680422da7ab479029eff89e1..56774e3f7702a960dc9b11e3f9d95129c150aabd 100644 (file)
@@ -86,7 +86,7 @@
 // you can write more-platform-agnostic code if you stick to just these
 // symbols.
 
-export c_double, c_void, FILE, fpos_t;
+export c_float, c_double, c_void, FILE, fpos_t;
 export DIR, dirent;
 export c_char, c_schar, c_uchar;
 export c_short, c_ushort, c_int, c_uint, c_long, c_ulong;
@@ -123,7 +123,6 @@ mod types {
     // Standard types that are opaque or common, so are not per-target.
     mod common {
         mod c95 {
-            type c_double = float;
             enum c_void {}
             enum FILE {}
             enum fpos_t {}
@@ -154,6 +153,8 @@ mod c95 {
                 type c_uint = u32;
                 type c_long = i32;
                 type c_ulong = u32;
+                type c_float = f32;
+                type c_double = f64;
                 type size_t = u32;
                 type ptrdiff_t = i32;
                 type clock_t = i32;
@@ -196,6 +197,8 @@ mod c95 {
                 type c_uint = u32;
                 type c_long = i64;
                 type c_ulong = u64;
+                type c_float = f32;
+                type c_double = f64;
                 type size_t = u64;
                 type ptrdiff_t = i64;
                 type clock_t = i64;
@@ -241,6 +244,8 @@ mod c95 {
                 type c_uint = u32;
                 type c_long = i64;
                 type c_ulong = u64;
+                type c_float = f32;
+                type c_double = f64;
                 type size_t = u64;
                 type ptrdiff_t = i64;
                 type clock_t = i32;
@@ -286,6 +291,8 @@ mod c95 {
                 type c_uint = u32;
                 type c_long = i32;
                 type c_ulong = u32;
+                type c_float = f32;
+                type c_double = f64;
                 type size_t = u32;
                 type ptrdiff_t = i32;
                 type clock_t = i32;
@@ -358,6 +365,8 @@ mod c95 {
                 type c_uint = u32;
                 type c_long = i32;
                 type c_ulong = u32;
+                type c_float = f32;
+                type c_double = f64;
                 type size_t = u32;
                 type ptrdiff_t = i32;
                 type clock_t = u32;
@@ -400,6 +409,8 @@ mod c95 {
                 type c_uint = u32;
                 type c_long = i64;
                 type c_ulong = u64;
+                type c_float = f32;
+                type c_double = f64;
                 type size_t = u64;
                 type ptrdiff_t = i64;
                 type clock_t = u64;
@@ -841,6 +852,9 @@ mod posix88 {
 
             #[link_name = "_fdopen"]
             fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
+
+            #[link_name = "_fileno"]
+            fn fileno(stream: *FILE) -> c_int;
         }
 
         #[nolink]
@@ -942,6 +956,7 @@ mod posix88 {
             fn popen(command: *c_char, mode: *c_char) -> *FILE;
             fn pclose(stream: *FILE) -> c_int;
             fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
+            fn fileno(stream: *FILE) -> c_int;
         }
 
         #[nolink]
index f6b36f71bde3e6ee9bd8cb8051380cf46ace3f5c..43192afca8e7b276e0f5489fe986fd93f9d1d41d 100644 (file)
@@ -24,7 +24,7 @@
 import getcwd = rustrt::rust_getcwd;
 import consts::*;
 
-export close, fclose;
+export close, fclose, fsync_fd;
 export env, getenv, setenv, fdopen, pipe;
 export getcwd, dll_filename, self_exe_path;
 export exe_suffix, dll_suffix, sysname;