@@ -3250,6 +3250,61 @@ f! {
3250
3250
dev |= ( minor & 0xffffff00 ) << 12 ;
3251
3251
dev
3252
3252
}
3253
+
3254
+ pub fn CMSG_DATA ( cmsg: * const cmsghdr) -> * mut c_uchar {
3255
+ cmsg. offset( 1 ) as * mut c_uchar
3256
+ }
3257
+
3258
+ pub fn CMSG_NXTHDR ( mhdr: * const msghdr, cmsg: * const cmsghdr)
3259
+ -> * mut cmsghdr
3260
+ {
3261
+ if ( ( * cmsg) . cmsg_len as :: size_t) < :: mem:: size_of:: <cmsghdr>( ) {
3262
+ 0 as * mut cmsghdr
3263
+ } else if __CMSG_NEXT( cmsg) . add( :: mem:: size_of:: <cmsghdr>( ) )
3264
+ >= __MHDR_END( mhdr) {
3265
+ 0 as * mut cmsghdr
3266
+ } else {
3267
+ __CMSG_NEXT( cmsg) . cast( )
3268
+ }
3269
+ }
3270
+
3271
+ pub fn CMSG_FIRSTHDR ( mhdr: * const msghdr) -> * mut cmsghdr {
3272
+ if ( * mhdr) . msg_controllen as :: size_t >= :: mem:: size_of:: <cmsghdr>( ) {
3273
+ ( * mhdr) . msg_control. cast( )
3274
+ } else {
3275
+ 0 as * mut cmsghdr
3276
+ }
3277
+ }
3278
+
3279
+ pub fn CMSG_ALIGN ( len: :: size_t) -> :: size_t {
3280
+ ( len + :: mem:: size_of:: <:: size_t>( ) - 1 )
3281
+ & !( :: mem:: size_of:: <:: size_t>( ) - 1 )
3282
+ }
3283
+
3284
+ pub fn CMSG_SPACE ( len: :: c_uint) -> :: c_uint {
3285
+ ( CMSG_ALIGN ( len as :: size_t) + CMSG_ALIGN ( :: mem:: size_of:: <cmsghdr>( ) ) )
3286
+ as :: c_uint
3287
+ }
3288
+
3289
+ pub fn CMSG_LEN ( len: :: c_uint) -> :: c_uint {
3290
+ ( CMSG_ALIGN ( :: mem:: size_of:: <cmsghdr>( ) ) + len as :: size_t) as :: c_uint
3291
+ }
3292
+ }
3293
+
3294
+ fn __CMSG_LEN ( cmsg : * const cmsghdr ) -> :: ssize_t {
3295
+ ( ( unsafe { ( * cmsg) . cmsg_len as :: size_t } + :: mem:: size_of :: < :: c_long > ( )
3296
+ - 1 )
3297
+ & !( :: mem:: size_of :: < :: c_long > ( ) - 1 ) ) as :: ssize_t
3298
+ }
3299
+
3300
+ fn __CMSG_NEXT ( cmsg : * const cmsghdr ) -> * mut c_uchar {
3301
+ ( unsafe { cmsg. offset ( __CMSG_LEN ( cmsg) ) } ) as * mut c_uchar
3302
+ }
3303
+
3304
+ fn __MHDR_END ( mhdr : * const msghdr ) -> * mut c_uchar {
3305
+ unsafe {
3306
+ ( * mhdr) . msg_control . offset ( ( * mhdr) . msg_controllen as isize )
3307
+ } . cast ( )
3253
3308
}
3254
3309
3255
3310
// EXTERN_FN
0 commit comments