@@ -19,7 +19,8 @@ pub type pthread_t = *mut ::c_void;
19
19
pub type pthread_attr_t = * mut :: c_void ;
20
20
pub type pthread_cond_t = * mut :: c_void ;
21
21
pub type pthread_condattr_t = * mut :: c_void ;
22
- // Must be usize due to libstd/sys_common/thread_local.rs, should be *mut ::c_void
22
+ // Must be usize due to libstd/sys_common/thread_local.rs,
23
+ // should technically be *mut ::c_void
23
24
pub type pthread_key_t = usize ;
24
25
pub type pthread_mutex_t = * mut :: c_void ;
25
26
pub type pthread_mutexattr_t = * mut :: c_void ;
143
144
pub ss_family: :: sa_family_t,
144
145
__ss_padding: [
145
146
u8 ;
146
- 128 - :: core:: mem:: size_of:: <sa_family_t>( ) - :: core:: mem:: size_of:: <c_ulong>( )
147
+ 128 -
148
+ :: core:: mem:: size_of:: <sa_family_t>( ) -
149
+ :: core:: mem:: size_of:: <c_ulong>( )
147
150
] ,
148
151
__ss_align: :: c_ulong,
149
152
}
@@ -302,11 +305,6 @@ pub const O_SYMLINK: ::c_int = 0x4000_0000;
302
305
// TODO: Fix negative values missing from includes
303
306
pub const O_NOFOLLOW : :: c_int = -0x8000_0000 ;
304
307
305
- // malloc.h
306
- extern {
307
- pub fn memalign ( align : :: size_t , size : :: size_t ) -> * mut :: c_void ;
308
- }
309
-
310
308
// netdb.h
311
309
pub const EAI_SYSTEM : :: c_int = -11 ;
312
310
@@ -348,19 +346,6 @@ pub const PTHREAD_MUTEX_INITIALIZER: ::pthread_mutex_t = -1isize as *mut _;
348
346
pub const PTHREAD_COND_INITIALIZER : :: pthread_cond_t = -1isize as * mut _ ;
349
347
pub const PTHREAD_RWLOCK_INITIALIZER : :: pthread_rwlock_t = -1isize as * mut _ ;
350
348
pub const PTHREAD_STACK_MIN : :: size_t = 4096 ;
351
- extern {
352
- pub fn pthread_atfork ( prepare : :: Option < unsafe extern fn ( ) > ,
353
- parent : :: Option < unsafe extern fn ( ) > ,
354
- child : :: Option < unsafe extern fn ( ) > ) -> :: c_int ;
355
- pub fn pthread_create ( tid : * mut :: pthread_t ,
356
- attr : * const :: pthread_attr_t ,
357
- start : extern fn ( * mut :: c_void ) -> * mut :: c_void ,
358
- arg : * mut :: c_void ) -> :: c_int ;
359
- // TODO: relibc {
360
- pub fn pthread_condattr_setclock ( attr : * mut pthread_condattr_t ,
361
- clock_id : :: clockid_t ) -> :: c_int ;
362
- // }
363
- }
364
349
365
350
// signal.h
366
351
pub const SIG_BLOCK : :: c_int = 0 ;
@@ -398,11 +383,6 @@ pub const SIGIO: ::c_int = 29;
398
383
pub const SIGPWR : :: c_int = 30 ;
399
384
pub const SIGSYS : :: c_int = 31 ;
400
385
pub const NSIG : :: c_int = 32 ;
401
- extern {
402
- pub fn pthread_sigmask ( how : :: c_int ,
403
- set : * const :: sigset_t ,
404
- oldset : * mut :: sigset_t ) -> :: c_int ;
405
- }
406
386
407
387
// sys/epoll.h
408
388
pub const EPOLL_CLOEXEC : :: c_int = 0x0100_0000 ;
@@ -425,18 +405,6 @@ pub const EPOLLEXCLUSIVE: ::c_int = 0;
425
405
pub const EPOLLWAKEUP : :: c_int = 0 ;
426
406
pub const EPOLLONESHOT : :: c_int = 0 ;
427
407
pub const EPOLLET : :: c_int = 0 ;
428
- extern {
429
- pub fn epoll_create ( size : :: c_int ) -> :: c_int ;
430
- pub fn epoll_create1 ( flags : :: c_int ) -> :: c_int ;
431
- pub fn epoll_wait ( epfd : :: c_int ,
432
- events : * mut :: epoll_event ,
433
- maxevents : :: c_int ,
434
- timeout : :: c_int ) -> :: c_int ;
435
- pub fn epoll_ctl ( epfd : :: c_int ,
436
- op : :: c_int ,
437
- fd : :: c_int ,
438
- event : * mut :: epoll_event ) -> :: c_int ;
439
- }
440
408
441
409
// sys/stat.h
442
410
pub const S_IFMT : :: c_int = 0o0_170_000 ;
@@ -479,9 +447,6 @@ pub const TIOCGPGRP: ::c_ulong = 0x540F;
479
447
pub const TIOCSPGRP : :: c_ulong = 0x5410 ;
480
448
pub const TIOCGWINSZ : :: c_ulong = 0x5413 ;
481
449
pub const TIOCSWINSZ : :: c_ulong = 0x5414 ;
482
- extern {
483
- pub fn ioctl ( fd : :: c_int , request : :: c_ulong , ...) -> :: c_int ;
484
- }
485
450
486
451
// sys/select.h
487
452
pub const FD_SETSIZE : usize = 1024 ;
@@ -507,23 +472,6 @@ pub const SO_SNDTIMEO: ::c_int = 21;
507
472
pub const SOCK_STREAM : :: c_int = 1 ;
508
473
pub const SOCK_DGRAM : :: c_int = 2 ;
509
474
pub const SOL_SOCKET : :: c_int = 1 ;
510
- extern {
511
- pub fn bind ( socket : :: c_int , address : * const :: sockaddr ,
512
- address_len : :: socklen_t ) -> :: c_int ;
513
- pub fn recvfrom ( socket : :: c_int , buf : * mut :: c_void , len : :: size_t ,
514
- flags : :: c_int , addr : * mut :: sockaddr ,
515
- addrlen : * mut :: socklen_t ) -> :: ssize_t ;
516
- }
517
-
518
- // sys/uio.h
519
- extern {
520
- pub fn readv ( fd : :: c_int ,
521
- iov : * const :: iovec ,
522
- iovcnt : :: c_int ) -> :: ssize_t ;
523
- pub fn writev ( fd : :: c_int ,
524
- iov : * const :: iovec ,
525
- iovcnt : :: c_int ) -> :: ssize_t ;
526
- }
527
475
528
476
// sys/wait.h
529
477
pub const WNOHANG : :: c_int = 1 ;
@@ -534,9 +482,6 @@ pub const NCCS: usize = 32;
534
482
// time.h
535
483
pub const CLOCK_REALTIME : :: c_int = 1 ;
536
484
pub const CLOCK_MONOTONIC : :: c_int = 4 ;
537
- extern {
538
- pub fn clock_gettime ( clk_id : :: clockid_t , tp : * mut :: timespec ) -> :: c_int ;
539
- }
540
485
541
486
// unistd.h
542
487
pub const _SC_PAGESIZE: :: c_int = 30 ;
@@ -590,3 +535,57 @@ cfg_if! {
590
535
// Unknown target_pointer_width
591
536
}
592
537
}
538
+
539
+ extern {
540
+ // malloc.h
541
+ pub fn memalign ( align : :: size_t , size : :: size_t ) -> * mut :: c_void ;
542
+
543
+ // pthread.h
544
+ pub fn pthread_atfork ( prepare : :: Option < unsafe extern fn ( ) > ,
545
+ parent : :: Option < unsafe extern fn ( ) > ,
546
+ child : :: Option < unsafe extern fn ( ) > ) -> :: c_int ;
547
+ pub fn pthread_create ( tid : * mut :: pthread_t ,
548
+ attr : * const :: pthread_attr_t ,
549
+ start : extern fn ( * mut :: c_void ) -> * mut :: c_void ,
550
+ arg : * mut :: c_void ) -> :: c_int ;
551
+ pub fn pthread_condattr_setclock ( attr : * mut pthread_condattr_t ,
552
+ clock_id : :: clockid_t ) -> :: c_int ;
553
+
554
+ // signal.h
555
+ pub fn pthread_sigmask ( how : :: c_int ,
556
+ set : * const :: sigset_t ,
557
+ oldset : * mut :: sigset_t ) -> :: c_int ;
558
+
559
+ // sys/epoll.h
560
+ pub fn epoll_create ( size : :: c_int ) -> :: c_int ;
561
+ pub fn epoll_create1 ( flags : :: c_int ) -> :: c_int ;
562
+ pub fn epoll_wait ( epfd : :: c_int ,
563
+ events : * mut :: epoll_event ,
564
+ maxevents : :: c_int ,
565
+ timeout : :: c_int ) -> :: c_int ;
566
+ pub fn epoll_ctl ( epfd : :: c_int ,
567
+ op : :: c_int ,
568
+ fd : :: c_int ,
569
+ event : * mut :: epoll_event ) -> :: c_int ;
570
+
571
+ // sys/ioctl.h
572
+ pub fn ioctl ( fd : :: c_int , request : :: c_ulong , ...) -> :: c_int ;
573
+
574
+ // sys/socket.h
575
+ pub fn bind ( socket : :: c_int , address : * const :: sockaddr ,
576
+ address_len : :: socklen_t ) -> :: c_int ;
577
+ pub fn recvfrom ( socket : :: c_int , buf : * mut :: c_void , len : :: size_t ,
578
+ flags : :: c_int , addr : * mut :: sockaddr ,
579
+ addrlen : * mut :: socklen_t ) -> :: ssize_t ;
580
+
581
+ // sys/uio.h
582
+ pub fn readv ( fd : :: c_int ,
583
+ iov : * const :: iovec ,
584
+ iovcnt : :: c_int ) -> :: ssize_t ;
585
+ pub fn writev ( fd : :: c_int ,
586
+ iov : * const :: iovec ,
587
+ iovcnt : :: c_int ) -> :: ssize_t ;
588
+
589
+ // time.h
590
+ pub fn clock_gettime ( clk_id : :: clockid_t , tp : * mut :: timespec ) -> :: c_int ;
591
+ }
0 commit comments