Skip to content

Commit 63191d1

Browse files
committed
---
yaml --- r: 234831 b: refs/heads/tmp c: b2f379c h: refs/heads/master i: 234829: 5fa709d 234827: 230cf07 234823: bcff152 234815: 54aaff5 v: v3
1 parent f2ab180 commit 63191d1

File tree

17 files changed

+704
-87
lines changed

17 files changed

+704
-87
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 0af8e4754632279bf0b6a7143274c5d817f2833d
28+
refs/heads/tmp: b2f379cdc23aec5c5d0d62acfcc5a4a18ebf0e30
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/mk/cfg/x86_64-unknown-netbsd.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# x86_64-unknown-netbsd configuration
2+
CROSS_PREFIX_x86_64-unknown-netbsd=x86_64-unknown-netbsd-
23
CC_x86_64-unknown-netbsd=$(CC)
34
CXX_x86_64-unknown-netbsd=$(CXX)
45
CPP_x86_64-unknown-netbsd=$(CPP)

branches/tmp/src/liblibc/lib.rs

Lines changed: 488 additions & 50 deletions
Large diffs are not rendered by default.

branches/tmp/src/librustc/middle/infer/equate.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use middle::ty::{self, Ty};
1717
use middle::ty::TyVar;
1818
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
1919

20+
/// Ensures `a` is made equal to `b`. Returns `a` on success.
2021
pub struct Equate<'a, 'tcx: 'a> {
2122
fields: CombineFields<'a, 'tcx>
2223
}
@@ -68,7 +69,8 @@ impl<'a, 'tcx> TypeRelation<'a,'tcx> for Equate<'a, 'tcx> {
6869
}
6970

7071
_ => {
71-
combine::super_combine_tys(self.fields.infcx, self, a, b)
72+
try!(combine::super_combine_tys(self.fields.infcx, self, a, b));
73+
Ok(a)
7274
}
7375
}
7476
}

branches/tmp/src/librustc/middle/infer/sub.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use middle::ty::TyVar;
1818
use middle::ty::relate::{Cause, Relate, RelateResult, TypeRelation};
1919
use std::mem;
2020

21-
/// "Greatest lower bound" (common subtype)
21+
/// Ensures `a` is made a subtype of `b`. Returns `a` on success.
2222
pub struct Sub<'a, 'tcx: 'a> {
2323
fields: CombineFields<'a, 'tcx>,
2424
}
@@ -90,7 +90,8 @@ impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Sub<'a, 'tcx> {
9090
}
9191

9292
_ => {
93-
combine::super_combine_tys(self.fields.infcx, self, a, b)
93+
try!(combine::super_combine_tys(self.fields.infcx, self, a, b));
94+
Ok(a)
9495
}
9596
}
9697
}

branches/tmp/src/librustc_privacy/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -847,12 +847,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
847847
ty::ImplContainer(_) => {
848848
self.check_static_method(span, method_def_id, name)
849849
}
850-
// Trait methods are always all public. The only controlling factor
851-
// is whether the trait itself is accessible or not.
852-
ty::TraitContainer(trait_def_id) => {
853-
self.report_error(self.ensure_public(span, trait_def_id,
854-
None, "source trait"));
855-
}
850+
// Trait methods are always accessible if the trait is in scope.
851+
ty::TraitContainer(_) => {}
856852
}
857853
}
858854
}

branches/tmp/src/libstd/os/netbsd/raw.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! NetBSD/OpenBSD-specific raw type definitions
11+
//! NetBSD-specific raw type definitions
1212
1313
#![stable(feature = "raw_ext", since = "1.1.0")]
1414

@@ -17,7 +17,7 @@ use os::unix::raw::{uid_t, gid_t};
1717

1818
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64;
1919
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u32;
20-
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = i32;
20+
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64;
2121
#[stable(feature = "raw_ext", since = "1.1.0")] pub type fflags_t = u32;
2222
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
2323
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32;
@@ -55,6 +55,10 @@ pub struct stat {
5555
#[stable(feature = "raw_ext", since = "1.1.0")]
5656
pub st_ctime_nsec: c_long,
5757
#[stable(feature = "raw_ext", since = "1.1.0")]
58+
pub st_birthtime: time_t,
59+
#[stable(feature = "raw_ext", since = "1.1.0")]
60+
pub st_birthtime_nsec: c_long,
61+
#[stable(feature = "raw_ext", since = "1.1.0")]
5862
pub st_size: off_t,
5963
#[stable(feature = "raw_ext", since = "1.1.0")]
6064
pub st_blocks: blkcnt_t,
@@ -64,8 +68,5 @@ pub struct stat {
6468
pub st_flags: fflags_t,
6569
#[stable(feature = "raw_ext", since = "1.1.0")]
6670
pub st_gen: u32,
67-
#[stable(feature = "raw_ext", since = "1.1.0")]
68-
pub st_birthtime: time_t,
69-
#[stable(feature = "raw_ext", since = "1.1.0")]
70-
pub st_birthtime_nsec: c_long,
71+
st_spare: [u32; 2],
7172
}

branches/tmp/src/libstd/sys/common/unwind/mod.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,17 @@ pub unsafe fn try<F: FnOnce()>(f: F) -> Result<(), Box<Any + Send>> {
148148
// care of exposing correctly.
149149
unsafe fn inner_try(f: fn(*mut u8), data: *mut u8)
150150
-> Result<(), Box<Any + Send>> {
151-
let prev = PANICKING.with(|s| s.get());
152-
PANICKING.with(|s| s.set(false));
153-
let ep = intrinsics::try(f, data);
154-
PANICKING.with(|s| s.set(prev));
155-
if ep.is_null() {
156-
Ok(())
157-
} else {
158-
Err(imp::cleanup(ep))
159-
}
151+
PANICKING.with(|s| {
152+
let prev = s.get();
153+
s.set(false);
154+
let ep = intrinsics::try(f, data);
155+
s.set(prev);
156+
if ep.is_null() {
157+
Ok(())
158+
} else {
159+
Err(imp::cleanup(ep))
160+
}
161+
})
160162
}
161163

162164
fn try_fn<F: FnOnce()>(opt_closure: *mut u8) {

branches/tmp/src/libstd/sys/unix/c.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 70;
6161
target_os = "dragonfly"))]
6262
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 71;
6363
#[cfg(any(target_os = "bitrig",
64-
target_os = "netbsd",
6564
target_os = "openbsd"))]
6665
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 101;
66+
#[cfg(target_os = "netbsd")]
67+
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 48;
6768
#[cfg(target_os = "android")]
6869
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 0x0048;
6970

@@ -131,26 +132,31 @@ extern {
131132

132133
pub fn raise(signum: libc::c_int) -> libc::c_int;
133134

135+
#[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
134136
pub fn sigaction(signum: libc::c_int,
135137
act: *const sigaction,
136138
oldact: *mut sigaction) -> libc::c_int;
137139

140+
#[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
138141
pub fn sigaltstack(ss: *const sigaltstack,
139142
oss: *mut sigaltstack) -> libc::c_int;
140143

141144
#[cfg(not(target_os = "android"))]
145+
#[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
142146
pub fn sigemptyset(set: *mut sigset_t) -> libc::c_int;
143147

144148
pub fn pthread_sigmask(how: libc::c_int, set: *const sigset_t,
145149
oldset: *mut sigset_t) -> libc::c_int;
146150

147151
#[cfg(not(target_os = "ios"))]
152+
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
148153
pub fn getpwuid_r(uid: libc::uid_t,
149154
pwd: *mut passwd,
150155
buf: *mut libc::c_char,
151156
buflen: libc::size_t,
152157
result: *mut *mut passwd) -> libc::c_int;
153158

159+
#[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
154160
pub fn utimes(filename: *const libc::c_char,
155161
times: *const libc::timeval) -> libc::c_int;
156162
pub fn gai_strerror(errcode: libc::c_int) -> *const libc::c_char;
@@ -347,12 +353,12 @@ mod signal_os {
347353
#[cfg(any(target_os = "macos",
348354
target_os = "ios"))]
349355
pub type sigset_t = u32;
350-
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
356+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd"))]
351357
#[repr(C)]
352358
pub struct sigset_t {
353359
bits: [u32; 4],
354360
}
355-
#[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"))]
361+
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
356362
pub type sigset_t = libc::c_uint;
357363

358364
// This structure has more fields, but we're not all that interested in

branches/tmp/src/libstd/sys/unix/os.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,12 @@ pub fn current_exe() -> io::Result<PathBuf> {
213213
::fs::read_link("/proc/curproc/file")
214214
}
215215

216-
#[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"))]
216+
#[cfg(target_os = "netbsd")]
217+
pub fn current_exe() -> io::Result<PathBuf> {
218+
::fs::read_link("/proc/curproc/exe")
219+
}
220+
221+
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
217222
pub fn current_exe() -> io::Result<PathBuf> {
218223
use sync::StaticMutex;
219224
static LOCK: StaticMutex = StaticMutex::new();

branches/tmp/src/libstd/sys/unix/process.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ mod tests {
452452

453453
#[cfg(not(target_os = "android"))]
454454
extern {
455+
#[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
455456
fn sigaddset(set: *mut c::sigset_t, signum: libc::c_int) -> libc::c_int;
456457
}
457458

branches/tmp/src/libstd/sys/unix/sync.rs

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern {
4040
pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> libc::c_int;
4141
pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> libc::c_int;
4242
pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> libc::c_int;
43+
#[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")]
4344
pub fn gettimeofday(tp: *mut libc::timeval,
4445
tz: *mut libc::c_void) -> libc::c_int;
4546

@@ -55,7 +56,6 @@ extern {
5556
#[cfg(any(target_os = "freebsd",
5657
target_os = "dragonfly",
5758
target_os = "bitrig",
58-
target_os = "netbsd",
5959
target_os = "openbsd"))]
6060
mod os {
6161
use libc;
@@ -249,3 +249,67 @@ mod os {
249249
};
250250
pub const PTHREAD_MUTEX_RECURSIVE: libc::c_int = 1;
251251
}
252+
253+
#[cfg(target_os = "netbsd")]
254+
mod os {
255+
use libc;
256+
257+
// size of the type minus width of the magic and alignment field
258+
#[cfg(target_arch = "x86_64")]
259+
const __PTHREAD_MUTEX_SIZE__: usize = 48 - 4 - 8;
260+
261+
#[cfg(target_arch = "x86_64")]
262+
const __PTHREAD_MUTEXATTR_SIZE__: usize = 16 - 8; // no magic field
263+
264+
#[cfg(target_arch = "x86_64")]
265+
const __PTHREAD_COND_SIZE__: usize = 40 - 4 - 8;
266+
267+
#[cfg(target_arch = "x86_64")]
268+
const __PTHREAD_RWLOCK_SIZE__: usize = 64 - 4 - 8;
269+
270+
const _PTHREAD_MUTEX_MAGIC_INIT: libc::c_uint = 0x33330003;
271+
const _PTHREAD_COND_MAGIC_INIT: libc::c_uint = 0x55550005;
272+
const _PTHREAD_RWLOCK_MAGIC_INIT: libc::c_uint = 0x99990009;
273+
274+
#[repr(C)]
275+
pub struct pthread_mutex_t {
276+
__magic: libc::c_uint,
277+
__opaque: [u8; __PTHREAD_MUTEX_SIZE__],
278+
__align: libc::c_longlong,
279+
}
280+
#[repr(C)]
281+
pub struct pthread_mutexattr_t {
282+
__opaque: [u8; __PTHREAD_MUTEXATTR_SIZE__],
283+
__align: libc::c_longlong,
284+
}
285+
#[repr(C)]
286+
pub struct pthread_cond_t {
287+
__magic: libc::c_uint,
288+
__opaque: [u8; __PTHREAD_COND_SIZE__],
289+
__align: libc::c_longlong,
290+
}
291+
#[repr(C)]
292+
pub struct pthread_rwlock_t {
293+
__magic: libc::c_uint,
294+
__opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
295+
__align: libc::c_longlong,
296+
}
297+
298+
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
299+
__magic: _PTHREAD_MUTEX_MAGIC_INIT,
300+
__opaque: [0; __PTHREAD_MUTEX_SIZE__],
301+
__align: 0,
302+
};
303+
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
304+
__magic: _PTHREAD_COND_MAGIC_INIT,
305+
__opaque: [0; __PTHREAD_COND_SIZE__],
306+
__align: 0,
307+
};
308+
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
309+
__magic: _PTHREAD_RWLOCK_MAGIC_INIT,
310+
__opaque: [0; __PTHREAD_RWLOCK_SIZE__],
311+
__align: 0,
312+
};
313+
314+
pub const PTHREAD_MUTEX_RECURSIVE: libc::c_int = 2;
315+
}

branches/tmp/src/libstd/sys/unix/thread.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ impl Thread {
102102
#[cfg(any(target_os = "freebsd",
103103
target_os = "dragonfly",
104104
target_os = "bitrig",
105-
target_os = "netbsd",
106105
target_os = "openbsd"))]
107106
pub fn set_name(name: &str) {
108107
extern {
@@ -126,6 +125,21 @@ impl Thread {
126125
}
127126
}
128127

128+
#[cfg(target_os = "netbsd")]
129+
pub fn set_name(name: &str) {
130+
extern {
131+
fn pthread_setname_np(thread: libc::pthread_t,
132+
name: *const libc::c_char,
133+
arg: *mut libc::c_void) -> libc::c_int;
134+
}
135+
let cname = CString::new(&b"%s"[..]).unwrap();
136+
let carg = CString::new(name).unwrap();
137+
unsafe {
138+
pthread_setname_np(pthread_self(), cname.as_ptr(),
139+
carg.as_ptr() as *mut libc::c_void);
140+
}
141+
}
142+
129143
pub fn sleep(dur: Duration) {
130144
let mut ts = libc::timespec {
131145
tv_sec: dur.as_secs() as libc::time_t,
@@ -191,13 +205,12 @@ pub mod guard {
191205

192206
#[cfg(any(target_os = "macos",
193207
target_os = "bitrig",
194-
target_os = "netbsd",
195208
target_os = "openbsd"))]
196209
unsafe fn get_stack_start() -> Option<*mut libc::c_void> {
197210
current().map(|s| s as *mut libc::c_void)
198211
}
199212

200-
#[cfg(any(target_os = "linux", target_os = "android"))]
213+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "netbsd"))]
201214
unsafe fn get_stack_start() -> Option<*mut libc::c_void> {
202215
use super::pthread_attr_init;
203216

@@ -263,7 +276,7 @@ pub mod guard {
263276
pthread_get_stacksize_np(pthread_self())) as usize)
264277
}
265278

266-
#[cfg(any(target_os = "openbsd", target_os = "netbsd", target_os = "bitrig"))]
279+
#[cfg(any(target_os = "openbsd", target_os = "bitrig"))]
267280
pub unsafe fn current() -> Option<usize> {
268281
#[repr(C)]
269282
struct stack_t {
@@ -290,7 +303,7 @@ pub mod guard {
290303
})
291304
}
292305

293-
#[cfg(any(target_os = "linux", target_os = "android"))]
306+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "netbsd"))]
294307
pub unsafe fn current() -> Option<usize> {
295308
use super::pthread_attr_init;
296309

@@ -307,13 +320,17 @@ pub mod guard {
307320
let mut size = 0;
308321
assert_eq!(pthread_attr_getstack(&attr, &mut stackaddr, &mut size), 0);
309322

310-
ret = Some(stackaddr as usize + guardsize as usize);
323+
ret = if cfg!(target_os = "netbsd") {
324+
Some(stackaddr as usize)
325+
} else {
326+
Some(stackaddr as usize + guardsize as usize)
327+
};
311328
}
312329
assert_eq!(pthread_attr_destroy(&mut attr), 0);
313330
ret
314331
}
315332

316-
#[cfg(any(target_os = "linux", target_os = "android"))]
333+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "netbsd"))]
317334
extern {
318335
fn pthread_getattr_np(native: libc::pthread_t,
319336
attr: *mut libc::pthread_attr_t) -> libc::c_int;

branches/tmp/src/libstd/sys/unix/time.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ mod inner {
8686
#[link(name = "rt")]
8787
extern {}
8888

89+
8990
extern {
91+
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
9092
fn clock_gettime(clk_id: libc::c_int, tp: *mut libc::timespec) -> libc::c_int;
9193
}
9294

0 commit comments

Comments
 (0)