@@ -80,7 +80,7 @@ impl Eq for general::__kernel_timespec {}
8080
8181#[ cfg( feature = "general" ) ]
8282pub mod cmsg_macros {
83- use crate :: ctypes:: { c_long, c_uint , c_uchar } ;
83+ use crate :: ctypes:: { c_long, c_uchar , c_uint } ;
8484 use crate :: general:: { cmsghdr, msghdr} ;
8585 use core:: mem:: size_of;
8686 use core:: ptr;
@@ -117,14 +117,16 @@ pub mod cmsg_macros {
117117 // Once the provenance rules are set in stone, it will be a good idea to give this function a once-over.
118118
119119 let cmsg_len = ( * cmsg) . cmsg_len ;
120- let next_cmsg = ( cmsg as * mut u8 ) . offset ( CMSG_ALIGN ( cmsg_len as _ ) as isize ) as * mut cmsghdr ;
120+ let next_cmsg =
121+ ( cmsg as * mut u8 ) . offset ( CMSG_ALIGN ( cmsg_len as _ ) as isize ) as * mut cmsghdr ;
121122 let max = ( ( * mhdr) . msg_control as usize ) + ( ( * mhdr) . msg_controllen as usize ) ;
122123
123124 if cmsg_len < size_of :: < cmsghdr > ( ) as _ {
124125 return ptr:: null_mut ( ) ;
125126 }
126127
127- if next_cmsg. offset ( 1 ) as usize > max || next_cmsg as usize + CMSG_ALIGN ( cmsg_len as _ ) as usize > max
128+ if next_cmsg. offset ( 1 ) as usize > max
129+ || next_cmsg as usize + CMSG_ALIGN ( cmsg_len as _ ) as usize > max
128130 {
129131 return ptr:: null_mut ( ) ;
130132 }
@@ -168,6 +170,25 @@ pub mod select_macros {
168170 }
169171}
170172
173+ #[ cfg( feature = "general" ) ]
174+ pub mod signal_macros {
175+ pub const SIG_DFL : super :: general:: __kernel_sighandler_t = None ;
176+
177+ /// Rust doesn't currently permit us to use `transmute` to convert the
178+ /// `SIG_IGN` value into a function pointer in a `const` initializer, so
179+ /// we make it a function instead.
180+ ///
181+ // TODO: In Rust 1.56 we can make this a `const fn`.
182+ #[ inline]
183+ pub fn sig_ign ( ) -> super :: general:: __kernel_sighandler_t {
184+ // Safety: This creates an invalid pointer, but the pointer type
185+ // includes `unsafe`, which covers the safety of calling it.
186+ Some ( unsafe {
187+ core:: mem:: transmute :: < usize , unsafe extern "C" fn ( crate :: ctypes:: c_int ) > ( 1 )
188+ } )
189+ }
190+ }
191+
171192// The rest of this file is auto-generated!
172193#[ cfg( feature = "errno" ) ]
173194#[ cfg( target_arch = "arm" ) ]
0 commit comments