@@ -19,7 +19,8 @@ pub type pthread_t = *mut ::c_void;
1919pub type pthread_attr_t = * mut :: c_void ;
2020pub type pthread_cond_t = * mut :: c_void ;
2121pub 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
2324pub type pthread_key_t = usize ;
2425pub type pthread_mutex_t = * mut :: c_void ;
2526pub type pthread_mutexattr_t = * mut :: c_void ;
143144 pub ss_family: :: sa_family_t,
144145 __ss_padding: [
145146 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>( )
147150 ] ,
148151 __ss_align: :: c_ulong,
149152 }
@@ -302,11 +305,6 @@ pub const O_SYMLINK: ::c_int = 0x4000_0000;
302305// TODO: Fix negative values missing from includes
303306pub const O_NOFOLLOW : :: c_int = -0x8000_0000 ;
304307
305- // malloc.h
306- extern {
307- pub fn memalign ( align : :: size_t , size : :: size_t ) -> * mut :: c_void ;
308- }
309-
310308// netdb.h
311309pub const EAI_SYSTEM : :: c_int = -11 ;
312310
@@ -348,19 +346,6 @@ pub const PTHREAD_MUTEX_INITIALIZER: ::pthread_mutex_t = -1isize as *mut _;
348346pub const PTHREAD_COND_INITIALIZER : :: pthread_cond_t = -1isize as * mut _ ;
349347pub const PTHREAD_RWLOCK_INITIALIZER : :: pthread_rwlock_t = -1isize as * mut _ ;
350348pub 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- }
364349
365350// signal.h
366351pub const SIG_BLOCK : :: c_int = 0 ;
@@ -398,11 +383,6 @@ pub const SIGIO: ::c_int = 29;
398383pub const SIGPWR : :: c_int = 30 ;
399384pub const SIGSYS : :: c_int = 31 ;
400385pub 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- }
406386
407387// sys/epoll.h
408388pub const EPOLL_CLOEXEC : :: c_int = 0x0100_0000 ;
@@ -425,18 +405,6 @@ pub const EPOLLEXCLUSIVE: ::c_int = 0;
425405pub const EPOLLWAKEUP : :: c_int = 0 ;
426406pub const EPOLLONESHOT : :: c_int = 0 ;
427407pub 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- }
440408
441409// sys/stat.h
442410pub const S_IFMT : :: c_int = 0o0_170_000 ;
@@ -479,9 +447,6 @@ pub const TIOCGPGRP: ::c_ulong = 0x540F;
479447pub const TIOCSPGRP : :: c_ulong = 0x5410 ;
480448pub const TIOCGWINSZ : :: c_ulong = 0x5413 ;
481449pub const TIOCSWINSZ : :: c_ulong = 0x5414 ;
482- extern {
483- pub fn ioctl ( fd : :: c_int , request : :: c_ulong , ...) -> :: c_int ;
484- }
485450
486451// sys/select.h
487452pub const FD_SETSIZE : usize = 1024 ;
@@ -507,23 +472,6 @@ pub const SO_SNDTIMEO: ::c_int = 21;
507472pub const SOCK_STREAM : :: c_int = 1 ;
508473pub const SOCK_DGRAM : :: c_int = 2 ;
509474pub 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- }
527475
528476// sys/wait.h
529477pub const WNOHANG : :: c_int = 1 ;
@@ -534,9 +482,6 @@ pub const NCCS: usize = 32;
534482// time.h
535483pub const CLOCK_REALTIME : :: c_int = 1 ;
536484pub const CLOCK_MONOTONIC : :: c_int = 4 ;
537- extern {
538- pub fn clock_gettime ( clk_id : :: clockid_t , tp : * mut :: timespec ) -> :: c_int ;
539- }
540485
541486// unistd.h
542487pub const _SC_PAGESIZE: :: c_int = 30 ;
@@ -590,3 +535,57 @@ cfg_if! {
590535 // Unknown target_pointer_width
591536 }
592537}
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