| ... | ... | @@ -3282,12 +3282,9 @@ pub fn setsockopt(fd: fd_t, level: u32, optname: u32, opt: []const u8) SetSockOp |
| 3282 | 3282 | } |
| 3283 | 3283 | } |
| 3284 | 3284 | |
| 3285 | | // TODO support for non-null terminated strings? |
| 3286 | | pub fn memfd_createC(name: [*:0]const u8, flags: usize) !fd_t { |
| 3287 | | if (builtin.os != .linux) @compileError("memfd_create() not implemented for this target"); |
| 3288 | | |
| 3289 | | const rc = linux.memfd_create(name, flags); |
| 3290 | | switch (linux.getErrno(rc)) { |
| 3285 | pub fn memfd_createC(name: [*:0]const u8, flags: u32) !fd_t { |
| 3286 | const rc = system.memfd_create(name, flags); |
| 3287 | switch (errno(rc)) { |
| 3291 | 3288 | 0 => return @intCast(fd_t, rc), |
| 3292 | 3289 | EFAULT => unreachable, // name has invalid memory |
| 3293 | 3290 | EINVAL => unreachable, // name/flags are faulty |
| ... | ... | @@ -3309,7 +3306,7 @@ fn toMemFdPath(name: []const u8) ![MFD_MAX_NAME_LEN:0]u8 { |
| 3309 | 3306 | return path_with_null; |
| 3310 | 3307 | } |
| 3311 | 3308 | |
| 3312 | | pub fn memfd_create(name: []const u8, flags: usize) !fd_t { |
| 3309 | pub fn memfd_create(name: []const u8, flags: u32) !fd_t { |
| 3313 | 3310 | const name_t = try toMemFdPath(name); |
| 3314 | 3311 | return try memfd_createC(&name_t, flags); |
| 3315 | 3312 | } |