@@ -209,11 +209,13 @@ libc_bitflags! {
209
209
#[ cfg_attr( docsrs, doc( cfg( all( ) ) ) ) ]
210
210
MAP_ALIGNMENT_64PB ;
211
211
/// Right operand value for the page alignment bitshift calculation
212
- #[ cfg( any( target_os = "netbsd" , target_os = "freebsd" ) ) ]
212
+ /// FIXME: not present in libc for FreeBSD
213
+ #[ cfg( target_os = "netbsd" ) ]
213
214
#[ cfg_attr( docsrs, doc( cfg( all( ) ) ) ) ]
214
215
MAP_ALIGNMENT_SHIFT ;
215
216
/// Mask to get the page alignment (as `(flags & align mask) >> align shift`)
216
- #[ cfg( any( target_os = "netbsd" , target_os = "freebsd" ) ) ]
217
+ #[ cfg( target_os = "netbsd" ) ]
218
+ /// FIXME: not present in libc for FreeBSD
217
219
#[ cfg_attr( docsrs, doc( cfg( all( ) ) ) ) ]
218
220
MAP_ALIGNMENT_MASK ;
219
221
}
@@ -643,7 +645,17 @@ pub fn shm_unlink<P: ?Sized + NixPath>(name: &P) -> Result<()> {
643
645
/// For more information, see [`mmap(2)`].
644
646
///
645
647
/// [`mmap(2)`]: https://man.freebsd.org/cgi/man.cgi?mmap(2)
646
- #[ cfg( any ( target_os = "netbsd" , target_os = "freebsd" ) ) ]
648
+ #[ cfg( target_os = "netbsd" ) ]
647
649
pub const fn map_aligned ( v : u32 ) -> u32 {
648
650
v << MapFlags :: MAP_ALIGNMENT_SHIFT . bits ( )
649
651
}
652
+
653
+ /// Handy call to get the alignment set by `map_aligned`.
654
+ ///
655
+ /// For more information, see [`mmap(2)`].
656
+ ///
657
+ /// [`mmap(2)`]: https://man.freebsd.org/cgi/man.cgi?mmap(2)
658
+ #[ cfg( target_os = "netbsd" ) ]
659
+ pub const fn map_alignment ( flags : u32 ) -> u32 {
660
+ ( flags & MapFlags :: MAP_ALIGNMENT_MASK . bits ( ) as u32 ) >> MapFlags :: MAP_ALIGNMENT_SHIFT . bits ( )
661
+ }
0 commit comments