@@ -233,7 +233,7 @@ struct ErrnoProtector(libc::c_int);
233
233
impl ErrnoProtector {
234
234
fn new ( ) -> Self {
235
235
unsafe {
236
- #[ cfg( target_os = "android" ) ]
236
+ #[ cfg( any ( target_os = "android" , target_os = "netbsd" ) ) ]
237
237
{
238
238
let errno = * libc:: __errno ( ) ;
239
239
Self ( errno)
@@ -255,7 +255,7 @@ impl ErrnoProtector {
255
255
impl Drop for ErrnoProtector {
256
256
fn drop ( & mut self ) {
257
257
unsafe {
258
- #[ cfg( target_os = "android" ) ]
258
+ #[ cfg( any ( target_os = "android" , target_os = "netbsd" ) ) ]
259
259
{
260
260
* libc:: __errno ( ) = self . 0 ;
261
261
}
@@ -304,9 +304,13 @@ extern "C" fn perf_signal_handler(
304
304
let addr =
305
305
unsafe { ( * ucontext) . uc_mcontext . gregs [ libc:: REG_RIP as usize ] as usize } ;
306
306
307
- #[ cfg( all ( target_arch = "x86_64" , target_os = "freebsd" ) ) ]
307
+ #[ cfg( target_os = "freebsd" ) ]
308
308
let addr = unsafe { ( * ucontext) . uc_mcontext . mc_rip as usize } ;
309
309
310
+ #[ cfg( all( target_arch = "x86_64" , target_os = "netbsd" ) ) ]
311
+ let addr =
312
+ unsafe { ( * ucontext) . uc_mcontext . __gregs [ libc:: _REG_RIP as usize ] as usize } ;
313
+
310
314
#[ cfg( all( target_arch = "x86_64" , target_os = "macos" ) ) ]
311
315
let addr = unsafe {
312
316
let mcontext = ( * ucontext) . uc_mcontext ;
@@ -323,7 +327,7 @@ extern "C" fn perf_signal_handler(
323
327
) ) ]
324
328
let addr = unsafe { ( * ucontext) . uc_mcontext . pc as usize } ;
325
329
326
- #[ cfg( all( target_arch = "aarch64" , target_os = "freebsd" ) ) ]
330
+ #[ cfg( all( target_arch = "aarch64" , any ( target_os = "freebsd" , target_os = "netbsd" ) ) ) ]
327
331
let addr = unsafe { ( * ucontext) . mc_gpregs . gp_elr as usize } ;
328
332
329
333
#[ cfg( all( target_arch = "aarch64" , target_os = "macos" ) ) ]
0 commit comments