Skip to content

Commit 7f55e7d

Browse files
committed
Add a couple more missing pieces to libc and os.
1 parent b7d3874 commit 7f55e7d

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

src/etc/libc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#define put_type(N,T) \
2727
printf(" type %s = %c%d;\n", N, S(T), B(T))
2828

29+
#define put_ftype(N,T) \
30+
printf(" type %s = f%d;\n", N, B(T))
31+
2932
#define CT(T) ((((T)-1)<0) ? "int" : "uint")
3033
#define CS(T) ((((T)-1)<0) ? "" : "_u")
3134
#define put_const(N,T) \
@@ -48,6 +51,9 @@ void c95_types() {
4851
put_type("c_long", long);
4952
put_type("c_ulong", unsigned long);
5053

54+
put_ftype("c_float", float);
55+
put_ftype("c_double", double);
56+
5157
put_type("size_t", size_t);
5258
put_type("ptrdiff_t", ptrdiff_t);
5359

src/libcore/libc.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export types, funcs, consts;
8686
// you can write more-platform-agnostic code if you stick to just these
8787
// symbols.
8888

89-
export c_double, c_void, FILE, fpos_t;
89+
export c_float, c_double, c_void, FILE, fpos_t;
9090
export DIR, dirent;
9191
export c_char, c_schar, c_uchar;
9292
export c_short, c_ushort, c_int, c_uint, c_long, c_ulong;
@@ -123,7 +123,6 @@ mod types {
123123
// Standard types that are opaque or common, so are not per-target.
124124
mod common {
125125
mod c95 {
126-
type c_double = float;
127126
enum c_void {}
128127
enum FILE {}
129128
enum fpos_t {}
@@ -154,6 +153,8 @@ mod types {
154153
type c_uint = u32;
155154
type c_long = i32;
156155
type c_ulong = u32;
156+
type c_float = f32;
157+
type c_double = f64;
157158
type size_t = u32;
158159
type ptrdiff_t = i32;
159160
type clock_t = i32;
@@ -196,6 +197,8 @@ mod types {
196197
type c_uint = u32;
197198
type c_long = i64;
198199
type c_ulong = u64;
200+
type c_float = f32;
201+
type c_double = f64;
199202
type size_t = u64;
200203
type ptrdiff_t = i64;
201204
type clock_t = i64;
@@ -241,6 +244,8 @@ mod types {
241244
type c_uint = u32;
242245
type c_long = i64;
243246
type c_ulong = u64;
247+
type c_float = f32;
248+
type c_double = f64;
244249
type size_t = u64;
245250
type ptrdiff_t = i64;
246251
type clock_t = i32;
@@ -286,6 +291,8 @@ mod types {
286291
type c_uint = u32;
287292
type c_long = i32;
288293
type c_ulong = u32;
294+
type c_float = f32;
295+
type c_double = f64;
289296
type size_t = u32;
290297
type ptrdiff_t = i32;
291298
type clock_t = i32;
@@ -358,6 +365,8 @@ mod types {
358365
type c_uint = u32;
359366
type c_long = i32;
360367
type c_ulong = u32;
368+
type c_float = f32;
369+
type c_double = f64;
361370
type size_t = u32;
362371
type ptrdiff_t = i32;
363372
type clock_t = u32;
@@ -400,6 +409,8 @@ mod types {
400409
type c_uint = u32;
401410
type c_long = i64;
402411
type c_ulong = u64;
412+
type c_float = f32;
413+
type c_double = f64;
403414
type size_t = u64;
404415
type ptrdiff_t = i64;
405416
type clock_t = u64;
@@ -841,6 +852,9 @@ mod funcs {
841852

842853
#[link_name = "_fdopen"]
843854
fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
855+
856+
#[link_name = "_fileno"]
857+
fn fileno(stream: *FILE) -> c_int;
844858
}
845859

846860
#[nolink]
@@ -942,6 +956,7 @@ mod funcs {
942956
fn popen(command: *c_char, mode: *c_char) -> *FILE;
943957
fn pclose(stream: *FILE) -> c_int;
944958
fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
959+
fn fileno(stream: *FILE) -> c_int;
945960
}
946961

947962
#[nolink]

src/libcore/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import option = option::t;
2424
import getcwd = rustrt::rust_getcwd;
2525
import consts::*;
2626

27-
export close, fclose;
27+
export close, fclose, fsync_fd;
2828
export env, getenv, setenv, fdopen, pipe;
2929
export getcwd, dll_filename, self_exe_path;
3030
export exe_suffix, dll_suffix, sysname;

0 commit comments

Comments
 (0)