File tree 3 files changed +12
-8
lines changed
3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 70;
74
74
#[ cfg( any( target_os = "macos" ,
75
75
target_os = "freebsd" ) ) ]
76
76
pub const _SC_GETPW_R_SIZE_MAX: libc:: c_int = 71 ;
77
+ #[ cfg( target_os = "openbsd" ) ]
78
+ pub const _SC_GETPW_R_SIZE_MAX: libc:: c_int = 101 ;
77
79
#[ cfg( target_os = "android" ) ]
78
80
pub const _SC_GETPW_R_SIZE_MAX: libc:: c_int = 0x0048 ;
79
81
@@ -91,7 +93,8 @@ pub struct passwd {
91
93
92
94
#[ repr( C ) ]
93
95
#[ cfg( any( target_os = "macos" ,
94
- target_os = "freebsd" ) ) ]
96
+ target_os = "freebsd" ,
97
+ target_os = "openbsd" ) ) ]
95
98
pub struct passwd {
96
99
pub pw_name : * mut libc:: c_char ,
97
100
pub pw_passwd : * mut libc:: c_char ,
Original file line number Diff line number Diff line change @@ -197,23 +197,23 @@ pub fn current_exe() -> IoResult<Path> {
197
197
}
198
198
199
199
#[ cfg( target_os = "openbsd" ) ]
200
- pub fn load_self ( ) -> Option < Vec < u8 > > {
200
+ pub fn current_exe ( ) -> IoResult < Path > {
201
201
use sync:: { StaticMutex , MUTEX_INIT } ;
202
202
203
203
static LOCK : StaticMutex = MUTEX_INIT ;
204
204
205
205
extern {
206
- fn rust_load_self ( ) -> * const c_char ;
206
+ fn rust_current_exe ( ) -> * const c_char ;
207
207
}
208
208
209
209
let _guard = LOCK . lock ( ) ;
210
210
211
211
unsafe {
212
- let v = rust_load_self ( ) ;
212
+ let v = rust_current_exe ( ) ;
213
213
if v. is_null ( ) {
214
- None
214
+ Err ( IoError :: last_error ( ) )
215
215
} else {
216
- Some ( ffi:: c_str_to_bytes ( & v) . to_vec ( ) )
216
+ Ok ( Path :: new ( ffi:: c_str_to_bytes ( & v) . to_vec ( ) ) )
217
217
}
218
218
}
219
219
}
@@ -333,7 +333,8 @@ pub fn args() -> Args {
333
333
#[ cfg( any( target_os = "linux" ,
334
334
target_os = "android" ,
335
335
target_os = "freebsd" ,
336
- target_os = "dragonfly" ) ) ]
336
+ target_os = "dragonfly" ,
337
+ target_os = "openbsd" ) ) ]
337
338
pub fn args ( ) -> Args {
338
339
use rt;
339
340
let bytes = rt:: args:: clone ( ) . unwrap_or ( Vec :: new ( ) ) ;
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ int *__dfly_error(void) { return __error(); }
204
204
#include <sys/sysctl.h>
205
205
#include <limits.h>
206
206
207
- const char * rust_load_self () {
207
+ const char * rust_current_exe () {
208
208
static char * self = NULL ;
209
209
210
210
if (self == NULL ) {
You can’t perform that action at this time.
0 commit comments