mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 21:16:44 +00:00 
			
		
		
		
	 cf6d6050f7
			
		
	
	
		cf6d6050f7
		
	
	
	
	
		
			
			* The WASI targets deal with the `main` symbol a bit differently than native so some `codegen` and `assembly` tests have been ignored. * All `ignore-emscripten` directives have been updated to `ignore-wasm32` to be more clear that all wasm targets are ignored and it's not just Emscripten. * Most `ignore-wasm32-bare` directives are now gone. * Some ignore directives for wasm were switched to `needs-unwind` instead. * Many `ignore-wasm32*` directives are removed as the tests work with WASI as opposed to `wasm32-unknown-unknown`.
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ run-pass
 | |
| // Previously memory for alternate signal stack have been unmapped during
 | |
| // main thread exit while still being in use by signal handlers. This test
 | |
| // triggers this situation by sending signal from atexit handler.
 | |
| //
 | |
| //@ ignore-wasm32 no signals
 | |
| //@ ignore-windows
 | |
| //@ ignore-sgx no libc
 | |
| //@ ignore-vxworks no SIGWINCH in user space
 | |
| //@ ignore-nto no SA_ONSTACK
 | |
| 
 | |
| #![feature(rustc_private)]
 | |
| extern crate libc;
 | |
| 
 | |
| use libc::*;
 | |
| 
 | |
| unsafe extern "C" fn signal_handler(signum: c_int, _: *mut siginfo_t, _: *mut c_void) {
 | |
|     assert_eq!(signum, SIGWINCH);
 | |
| }
 | |
| 
 | |
| extern "C" fn send_signal() {
 | |
|     unsafe {
 | |
|         raise(SIGWINCH);
 | |
|     }
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     unsafe {
 | |
|         // Install signal handler that runs on alternate signal stack.
 | |
|         let mut action: sigaction = std::mem::zeroed();
 | |
|         action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _;
 | |
|         action.sa_sigaction = signal_handler as sighandler_t;
 | |
|         sigaction(SIGWINCH, &action, std::ptr::null_mut());
 | |
| 
 | |
|         // Send SIGWINCH on exit.
 | |
|         atexit(send_signal);
 | |
|     }
 | |
| }
 |