diff options
| author | bors <bors@rust-lang.org> | 2017-10-21 09:37:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-10-21 09:37:11 +0000 |
| commit | d532ba7c627a558410e3f21efbb149540c1461e9 (patch) | |
| tree | dc5c75af77c97fc5d441dcf4cf56af9dd78d0314 /src/libstd | |
| parent | 7f06055d60c3d2a2d75de8264ac9f626f97ebcdd (diff) | |
| parent | e57ee3d0bf8d8b11feccab49432d4c5e8fc3a3ca (diff) | |
| download | rust-d532ba7c627a558410e3f21efbb149540c1461e9.tar.gz rust-d532ba7c627a558410e3f21efbb149540c1461e9.zip | |
Auto merge of #45391 - malbarbo:x32-1, r=alexcrichton
Update libc and some fixes for x86_64-unknown-linux-gnux32
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sys/unix/condvar.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/unix/thread.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/time.rs | 4 |
4 files changed, 8 insertions, 7 deletions
diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs index 89a44b97657..4f878d8ad1f 100644 --- a/src/libstd/sys/unix/condvar.rs +++ b/src/libstd/sys/unix/condvar.rs @@ -92,14 +92,15 @@ impl Condvar { assert_eq!(r, 0); // Nanosecond calculations can't overflow because both values are below 1e9. - let nsec = dur.subsec_nanos() as libc::c_long + now.tv_nsec as libc::c_long; + let nsec = dur.subsec_nanos() + now.tv_nsec as u32; + let sec = saturating_cast_to_time_t(dur.as_secs()) .checked_add((nsec / 1_000_000_000) as libc::time_t) .and_then(|s| s.checked_add(now.tv_sec)); let nsec = nsec % 1_000_000_000; let timeout = sec.map(|s| { - libc::timespec { tv_sec: s, tv_nsec: nsec } + libc::timespec { tv_sec: s, tv_nsec: nsec as _} }).unwrap_or(TIMESPEC_MAX); let r = libc::pthread_cond_timedwait(self.inner.get(), mutex::raw(mutex), diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index c4616c3b395..a1ca839dc18 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -132,14 +132,14 @@ impl FileAttr { pub fn modified(&self) -> io::Result<SystemTime> { Ok(SystemTime::from(libc::timespec { tv_sec: self.stat.st_mtime as libc::time_t, - tv_nsec: self.stat.st_mtime_nsec as libc::c_long, + tv_nsec: self.stat.st_mtime_nsec as _, })) } pub fn accessed(&self) -> io::Result<SystemTime> { Ok(SystemTime::from(libc::timespec { tv_sec: self.stat.st_atime as libc::time_t, - tv_nsec: self.stat.st_atime_nsec as libc::c_long, + tv_nsec: self.stat.st_atime_nsec as _, })) } diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 6c4a3324296..cc889454ce9 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -149,7 +149,7 @@ impl Thread { pub fn sleep(dur: Duration) { let mut secs = dur.as_secs(); - let mut nsecs = dur.subsec_nanos() as libc::c_long; + let mut nsecs = dur.subsec_nanos() as _; // If we're awoken with a signal then the return value will be -1 and // nanosleep will fill in `ts` with the remaining time. diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index c1bea95ce91..837cd7292e2 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -60,7 +60,7 @@ impl Timespec { Timespec { t: libc::timespec { tv_sec: secs, - tv_nsec: nsec as libc::c_long, + tv_nsec: nsec as _, }, } } @@ -83,7 +83,7 @@ impl Timespec { Timespec { t: libc::timespec { tv_sec: secs, - tv_nsec: nsec as libc::c_long, + tv_nsec: nsec as _, }, } } |
