@@ -51,6 +51,16 @@ pub enum __locale_struct {}
51
51
52
52
pub type locale_t = * mut __locale_struct ;
53
53
54
+ s_paren ! {
55
+ // in wasi-libc clockid_t is const struct __clockid* (where __clockid is an opaque struct),
56
+ // but that's an implementation detail that we don't want to have to deal with
57
+ #[ repr( transparent) ]
58
+ pub struct clockid_t( * const u8 ) ;
59
+ }
60
+
61
+ unsafe impl Send for clockid_t { }
62
+ unsafe impl Sync for clockid_t { }
63
+
54
64
s ! {
55
65
#[ repr( align( 8 ) ) ]
56
66
pub struct fpos_t {
@@ -342,6 +352,11 @@ pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
342
352
pub const _SC_IOV_MAX: c_int = 60 ;
343
353
pub const _SC_SYMLOOP_MAX: c_int = 173 ;
344
354
355
+ pub static CLOCK_MONOTONIC : clockid_t = unsafe { clockid_t ( & _CLOCK_MONOTONIC) } ;
356
+ pub static CLOCK_PROCESS_CPUTIME_ID : clockid_t = unsafe { clockid_t ( & _CLOCK_PROCESS_CPUTIME_ID) } ;
357
+ pub static CLOCK_REALTIME : clockid_t = unsafe { clockid_t ( & _CLOCK_REALTIME) } ;
358
+ pub static CLOCK_THREAD_CPUTIME_ID : clockid_t = unsafe { clockid_t ( & _CLOCK_THREAD_CPUTIME_ID) } ;
359
+
345
360
#[ cfg_attr(
346
361
feature = "rustc-dep-of-std" ,
347
362
link( name = "c" , kind = "static" , cfg( target_feature = "crt-static" ) )
@@ -417,15 +432,14 @@ extern "C" {
417
432
pub fn asctime_r ( a : * const tm , b : * mut c_char ) -> * mut c_char ;
418
433
pub fn ctime_r ( a : * const time_t , b : * mut c_char ) -> * mut c_char ;
419
434
435
+ static _CLOCK_MONOTONIC: u8 ;
436
+ static _CLOCK_PROCESS_CPUTIME_ID: u8 ;
437
+ static _CLOCK_REALTIME: u8 ;
438
+ static _CLOCK_THREAD_CPUTIME_ID: u8 ;
420
439
pub fn nanosleep ( a : * const timespec , b : * mut timespec ) -> c_int ;
421
- // pub fn clock_getres(a: clockid_t, b: *mut timespec) -> c_int;
422
- // pub fn clock_gettime(a: clockid_t, b: *mut timespec) -> c_int;
423
- // pub fn clock_nanosleep(
424
- // a: clockid_t,
425
- // a2: c_int,
426
- // b: *const timespec,
427
- // c: *mut timespec,
428
- // ) -> c_int;
440
+ pub fn clock_getres ( a : clockid_t , b : * mut timespec ) -> c_int ;
441
+ pub fn clock_gettime ( a : clockid_t , b : * mut timespec ) -> c_int ;
442
+ pub fn clock_nanosleep ( a : clockid_t , a2 : c_int , b : * const timespec , c : * mut timespec ) -> c_int ;
429
443
430
444
pub fn isalnum ( c : c_int ) -> c_int ;
431
445
pub fn isalpha ( c : c_int ) -> c_int ;
0 commit comments