| author | |
| committer | |
| log | 5ceec001b5d0feb09f6f7c581b1bdc5d2436bfbe |
| tree | 72762b2d08f4469c7b7ee412e7a0673d1c197fb3 |
| parent | f74dac70b022fb9cbba25865fc9b14021f45b880 |
On include/uapi/linux/close_range.h of the linux src tree,
The C equivalents for the CLOSE_RANGE members are defined like this:
-
/* Unshare the file descriptor table before closing file descriptors. */
#define CLOSE_RANGE_UNSHARE(1U << 1)
/* Set the FD_CLOEXEC bit instead of closing the file descriptor. */
#define CLOSE_RANGE_CLOEXEC(1U << 2)
-
Originally, the zig fields of CLOSE_RANGE were offset by one bit-shift
to the right.
This adds one bit of padding which pushes the Zig members by one
bit-shift to the left, making the Zig struct be aligned with
the linux definitions.1 files changed, 2 insertions(+), 1 deletions(-)
lib/std/os/linux.zig+2-1| ... | ... | @@ -1746,11 +1746,12 @@ pub fn close(fd: fd_t) usize { |
| 1746 | 1746 | } |
| 1747 | 1747 | |
| 1748 | 1748 | pub const CLOSE_RANGE = packed struct(u32) { |
| 1749 | _0: u1 = 0, | |
| 1749 | 1750 | /// Unshare the file descriptor table before closing file descriptors. |
| 1750 | 1751 | UNSHARE: bool, // 0x00000001 |
| 1751 | 1752 | /// Set the FD_CLOEXEC bit instead of closing the file descriptor. |
| 1752 | 1753 | CLOEXEC: bool, // 0x00000002 |
| 1753 | _: u30 = 0, | |
| 1754 | _: u29 = 0, | |
| 1754 | 1755 | }; |
| 1755 | 1756 | |
| 1756 | 1757 | pub fn close_range(first: fd_t, last: fd_t, flags: CLOSE_RANGE) usize { |