diff --git a/src/header/_aio/mod.rs b/src/header/_aio/mod.rs index b75ba38f78..2dbbc70938 100644 --- a/src/header/_aio/mod.rs +++ b/src/header/_aio/mod.rs @@ -3,7 +3,7 @@ //! See . use crate::{ - header::{bits_timespec::timespec, signal::sigevent}, + header::{signal::sigevent, time::timespec}, platform::types::{c_int, c_void}, }; diff --git a/src/header/bits_timespec/cbindgen.toml b/src/header/bits_timespec/cbindgen.toml index 817170d32f..2f0ec9eb01 100644 --- a/src/header/bits_timespec/cbindgen.toml +++ b/src/header/bits_timespec/cbindgen.toml @@ -12,10 +12,11 @@ # - sys/select.h (not currently imported, needed for pselect, no TODO) # - sys/stat.h # - sys/time.h -# -# include sys/types.h to get time_t for timespec -sys_includes = ["sys/types.h"] -include_guard = "_RELIBC_BITS_TIME_H" +# - time.h (where it should be defined) +after_includes = """ +#include +""" +include_guard = "_RELIBC_BITS_TIMESPEC_H" language = "C" style = "Tag" no_includes = true diff --git a/src/header/netdb/lookup.rs b/src/header/netdb/lookup.rs index f32805f8cf..13caecef2d 100644 --- a/src/header/netdb/lookup.rs +++ b/src/header/netdb/lookup.rs @@ -12,7 +12,6 @@ use crate::{ use crate::header::{ bits_arpainet::htons, bits_socklen_t::socklen_t, - bits_timespec::timespec, errno::*, netinet_in::{IPPROTO_UDP, in_addr, sockaddr_in}, sys_socket::{ @@ -20,7 +19,7 @@ use crate::header::{ constants::{AF_INET, SOCK_DGRAM}, sockaddr, }, - time, + time::{self, timespec}, }; use super::{ diff --git a/src/header/poll/mod.rs b/src/header/poll/mod.rs index 6e55399aba..215f9e19f4 100644 --- a/src/header/poll/mod.rs +++ b/src/header/poll/mod.rs @@ -8,13 +8,13 @@ use crate::{ fs::File, header::{ bits_sigset_t::sigset_t, - bits_timespec::timespec, errno::EBADF, sys_epoll::{ EPOLL_CLOEXEC, EPOLL_CTL_ADD, EPOLLERR, EPOLLHUP, EPOLLIN, EPOLLNVAL, EPOLLOUT, EPOLLPRI, EPOLLRDBAND, EPOLLRDNORM, EPOLLWRBAND, EPOLLWRNORM, epoll_create1, epoll_ctl, epoll_data, epoll_event, epoll_pwait, }, + time::timespec, }, platform::{ self, diff --git a/src/header/pthread/mod.rs b/src/header/pthread/mod.rs index c742a425ff..eba7e347f2 100644 --- a/src/header/pthread/mod.rs +++ b/src/header/pthread/mod.rs @@ -7,7 +7,7 @@ use core::{cell::Cell, ptr::NonNull}; use crate::{ error::Errno, - header::{bits_timespec::timespec, sched::*}, + header::{sched::*, time::timespec}, platform::{ Pal, Sys, types::{ diff --git a/src/header/sched/mod.rs b/src/header/sched/mod.rs index bcdd34696c..f72f213791 100644 --- a/src/header/sched/mod.rs +++ b/src/header/sched/mod.rs @@ -4,7 +4,7 @@ use crate::{ error::ResultExt, - header::bits_timespec::timespec, + header::time::timespec, platform::{ Pal, Sys, types::{c_int, pid_t}, diff --git a/src/header/semaphore/mod.rs b/src/header/semaphore/mod.rs index 0ca2fa9ef1..763301d7af 100644 --- a/src/header/semaphore/mod.rs +++ b/src/header/semaphore/mod.rs @@ -3,10 +3,7 @@ //! See . use crate::{ - header::{ - bits_timespec::timespec, - time::{CLOCK_MONOTONIC, CLOCK_REALTIME}, - }, + header::time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec}, platform::types::{c_char, c_int, c_long, c_uint, clockid_t}, }; diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs index f0495739ed..d95eabc093 100644 --- a/src/header/signal/mod.rs +++ b/src/header/signal/mod.rs @@ -8,7 +8,7 @@ use cbitset::BitSet; use crate::{ error::{Errno, ResultExt}, - header::{bits_sigset_t::sigset_t, bits_timespec::timespec, errno, setjmp}, + header::{bits_sigset_t::sigset_t, errno, setjmp, time::timespec}, platform::{ self, ERRNO, Pal, PalSignal, Sys, types::{ diff --git a/src/header/sys_stat/mod.rs b/src/header/sys_stat/mod.rs index 29ca8fa532..df1417a5bd 100644 --- a/src/header/sys_stat/mod.rs +++ b/src/header/sys_stat/mod.rs @@ -6,8 +6,8 @@ use crate::{ c_str::CStr, error::ResultExt, header::{ - bits_timespec::timespec, fcntl::{O_NOFOLLOW, O_PATH}, + time::timespec, }, out::Out, platform::{ diff --git a/src/header/sys_time/mod.rs b/src/header/sys_time/mod.rs index 43b27324a9..c6c468525a 100644 --- a/src/header/sys_time/mod.rs +++ b/src/header/sys_time/mod.rs @@ -9,7 +9,7 @@ use crate::{ c_str::CStr, error::ResultExt, - header::{bits_timespec::timespec, sys_select::timeval}, + header::{sys_select::timeval, time::timespec}, out::Out, platform::{ Pal, PalSignal, Sys, diff --git a/src/header/time/mod.rs b/src/header/time/mod.rs index 04d6b60e89..5e8637c33d 100644 --- a/src/header/time/mod.rs +++ b/src/header/time/mod.rs @@ -6,7 +6,6 @@ use crate::{ c_str::{CStr, CString}, error::{Errno, ResultExt}, header::{ - bits_timespec::timespec, errno::{EFAULT, ENOMEM, EOVERFLOW, ETIMEDOUT}, signal::sigevent, stdlib::getenv, @@ -30,6 +29,8 @@ use chrono::{ use chrono_tz::{OffsetComponents, OffsetName, Tz}; use core::{cell::OnceCell, convert::TryFrom, mem, ptr}; +pub use crate::header::bits_timespec::timespec; + pub use self::constants::*; pub mod constants; diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs index c4058d3d05..fdd1ff0dd3 100644 --- a/src/header/unistd/mod.rs +++ b/src/header/unistd/mod.rs @@ -16,7 +16,6 @@ use crate::{ error::{Errno, ResultExt}, header::{ bits_sigset_t::sigset_t, - bits_timespec::timespec, crypt::{crypt_data, crypt_r}, errno::{self, ENAMETOOLONG}, fcntl, limits, @@ -25,6 +24,7 @@ use crate::{ sys_ioctl, sys_resource, sys_select::timeval, sys_time, sys_utsname, termios, + time::timespec, }, out::Out, platform::{ diff --git a/src/header/utime/mod.rs b/src/header/utime/mod.rs index 88e10e1062..8488264eae 100644 --- a/src/header/utime/mod.rs +++ b/src/header/utime/mod.rs @@ -8,7 +8,7 @@ use crate::{ c_str::CStr, error::ResultExt, - header::bits_timespec::timespec, + header::time::timespec, platform::{ Pal, Sys, types::{c_char, c_int, time_t}, diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs index a33576e5f6..cd316a9953 100644 --- a/src/platform/linux/mod.rs +++ b/src/platform/linux/mod.rs @@ -6,7 +6,6 @@ use crate::{ c_str::CStr, error::{Errno, Result}, header::{ - bits_timespec::timespec, dirent::dirent, errno::{EINVAL, EIO}, fcntl::{AT_EMPTY_PATH, AT_FDCWD, AT_REMOVEDIR}, @@ -17,7 +16,7 @@ use crate::{ sys_statvfs::statvfs, sys_time::timezone, sys_utsname::utsname, - time::itimerspec, + time::{itimerspec, timespec}, unistd::{SEEK_CUR, SEEK_SET}, }, ld_so::tcb::OsSpecific, diff --git a/src/platform/linux/signal.rs b/src/platform/linux/signal.rs index ef748a36e7..5e590c506f 100644 --- a/src/platform/linux/signal.rs +++ b/src/platform/linux/signal.rs @@ -16,12 +16,11 @@ use crate::{ error::{Errno, Result}, header::{ bits_sigset_t::sigset_t, - bits_timespec::timespec, signal::{ SA_RESTORER, SI_QUEUE, SIGALRM, SIGEV_SIGNAL, sigaction, sigevent, siginfo_t, sigval, stack_t, }, - time, + time::{self, timespec}, }, out::Out, platform::{self, Pal, types::timer_t}, diff --git a/src/platform/pal/mod.rs b/src/platform/pal/mod.rs index ad31680e0b..25d7351fbe 100644 --- a/src/platform/pal/mod.rs +++ b/src/platform/pal/mod.rs @@ -5,7 +5,6 @@ use crate::{ c_str::CStr, error::{Errno, Result}, header::{ - bits_timespec::timespec, fcntl::{AT_EMPTY_PATH, AT_FDCWD}, signal::sigevent, sys_resource::{rlimit, rusage}, @@ -14,7 +13,7 @@ use crate::{ sys_statvfs::statvfs, sys_time::timezone, sys_utsname::utsname, - time::itimerspec, + time::{itimerspec, timespec}, }, ld_so::tcb::OsSpecific, out::Out, diff --git a/src/platform/pal/signal.rs b/src/platform/pal/signal.rs index 1eeba0fa1e..a3ad8df46a 100644 --- a/src/platform/pal/signal.rs +++ b/src/platform/pal/signal.rs @@ -8,8 +8,8 @@ use crate::{ error::{Errno, Result}, header::{ bits_sigset_t::sigset_t, - bits_timespec::timespec, signal::{sigaction, siginfo_t, sigval, stack_t}, + time::timespec, }, }; diff --git a/src/platform/redox/event.rs b/src/platform/redox/event.rs index b02f641ce9..a3fe2254ff 100644 --- a/src/platform/redox/event.rs +++ b/src/platform/redox/event.rs @@ -2,8 +2,8 @@ use core::mem::size_of; use crate::header::{ bits_sigset_t::sigset_t, - bits_timespec::timespec, fcntl::{O_CLOEXEC, O_CREAT, O_RDWR}, + time::timespec, }; use super::libredox::RawResult; diff --git a/src/platform/redox/libredox.rs b/src/platform/redox/libredox.rs index a67f0452a7..dd9f5c1490 100644 --- a/src/platform/redox/libredox.rs +++ b/src/platform/redox/libredox.rs @@ -12,8 +12,7 @@ use syscall::{ use crate::{ header::{ - bits_iovec::iovec, bits_timespec::timespec, errno::EINVAL, signal::sigaction, - sys_stat::UTIME_NOW, + bits_iovec::iovec, errno::EINVAL, signal::sigaction, sys_stat::UTIME_NOW, time::timespec, }, out::Out, platform::{PalSignal, pal::Pal, types::*}, diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index fe4979a38f..8b5560e70b 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -27,7 +27,6 @@ use crate::{ error::{Errno, Result}, fs::File, header::{ - bits_timespec::timespec, errno::{ EBADF, EBADFD, EEXIST, EFAULT, EFBIG, EINTR, EINVAL, EIO, ENAMETOOLONG, ENOENT, ENOMEM, ENOSYS, EOPNOTSUPP, EPERM, @@ -50,7 +49,7 @@ use crate::{ sys_statvfs::statvfs, sys_time::timezone, sys_utsname::{UTSLENGTH, utsname}, - time::{TIMER_ABSTIME, itimerspec, timer_internal_t}, + time::{TIMER_ABSTIME, itimerspec, timer_internal_t, timespec}, unistd::{F_OK, R_OK, SEEK_CUR, SEEK_SET, W_OK, X_OK}, }, io::{self, BufReader, prelude::*}, diff --git a/src/platform/redox/signal.rs b/src/platform/redox/signal.rs index d414c6d1ed..597c4fa791 100644 --- a/src/platform/redox/signal.rs +++ b/src/platform/redox/signal.rs @@ -8,13 +8,12 @@ use crate::{ error::{Errno, Result}, header::{ bits_sigset_t::sigset_t, - bits_timespec::timespec, errno::{EINVAL, ENOSYS}, signal::{ SIG_BLOCK, SIG_DFL, SIG_IGN, SIG_SETMASK, SIG_UNBLOCK, SIGALRM, SIGEV_SIGNAL, SS_DISABLE, SS_ONSTACK, sigaction, sigevent, siginfo_t, sigval, stack_t, ucontext_t, }, - time::{itimerspec, timer_internal_t}, + time::{itimerspec, timer_internal_t, timespec}, }, out::Out, sync::Mutex, diff --git a/src/platform/redox/timer.rs b/src/platform/redox/timer.rs index 4db21f26f4..34ec81b168 100644 --- a/src/platform/redox/timer.rs +++ b/src/platform/redox/timer.rs @@ -3,10 +3,9 @@ use syscall::Error; use crate::{ error::{Errno, Result}, header::{ - bits_timespec::timespec, errno::EIO, signal::{SIGEV_SIGNAL, SIGEV_THREAD}, - time::timer_internal_t, + time::{timer_internal_t, timespec}, }, out::Out, platform::{Pal, Sys, sys::event, types::c_void}, diff --git a/src/sync/cond.rs b/src/sync/cond.rs index fd29aa91b2..fdc15c0fe8 100644 --- a/src/sync/cond.rs +++ b/src/sync/cond.rs @@ -3,10 +3,9 @@ use crate::{ error::Errno, header::{ - bits_timespec::timespec, errno::{EINVAL, ETIMEDOUT}, pthread::*, - time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec_realtime_to_monotonic}, + time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec, timespec_realtime_to_monotonic}, }, platform::types::clockid_t, }; diff --git a/src/sync/mod.rs b/src/sync/mod.rs index 9edda90ece..630922b55c 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -20,8 +20,8 @@ pub use self::{ use crate::{ error::Errno, header::{ - bits_timespec::timespec, errno::{EAGAIN, EINTR, ETIMEDOUT}, + time::timespec, }, out::Out, platform::{Pal, Sys, types::c_int}, diff --git a/src/sync/pthread_mutex.rs b/src/sync/pthread_mutex.rs index 29bad634ae..dd6170d79f 100644 --- a/src/sync/pthread_mutex.rs +++ b/src/sync/pthread_mutex.rs @@ -5,7 +5,7 @@ use core::{ use crate::{ error::Errno, - header::{bits_timespec::timespec, errno::*, pthread::*}, + header::{errno::*, pthread::*, time::timespec}, }; use crate::platform::{Pal, Sys, types::c_int}; diff --git a/src/sync/rwlock.rs b/src/sync/rwlock.rs index 73b367a3db..cfd834b8d9 100644 --- a/src/sync/rwlock.rs +++ b/src/sync/rwlock.rs @@ -7,9 +7,8 @@ use core::{ use crate::{ error::{Errno, Result}, header::{ - bits_timespec::timespec, errno::{EINVAL, ETIMEDOUT}, - time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec_realtime_to_monotonic}, + time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec, timespec_realtime_to_monotonic}, }, platform::types::clockid_t, pthread::Pshared, diff --git a/src/sync/semaphore.rs b/src/sync/semaphore.rs index 8052bfaaa2..b3ae2f04b9 100644 --- a/src/sync/semaphore.rs +++ b/src/sync/semaphore.rs @@ -2,10 +2,7 @@ //TODO: improve implementation use crate::{ - header::{ - bits_timespec::timespec, - time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec_realtime_to_monotonic}, - }, + header::time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec, timespec_realtime_to_monotonic}, platform::types::{c_uint, clockid_t}, };