| author | |
| committer | |
| log | 4236ca40cd21895590c580c9a1f56423c2c2f167 |
| tree | 985980b12ea138851de0a35e5ab905ded84e3db1 |
| parent | 5fb36d2600b686a5132b42c4824f99dc2412f037 |
| parent | bf4fda4db6bd442580725b0d533e26f781763623 |
| signature |
Small fixes for SerenityOS3 files changed, 24 insertions(+), 5 deletions(-)
lib/std/c.zig+1-1| ... | @@ -7147,7 +7147,7 @@ pub const dirent = switch (native_os) { | ... | @@ -7147,7 +7147,7 @@ pub const dirent = switch (native_os) { |
| 7147 | off: off_t, | 7147 | off: off_t, |
| 7148 | reclen: c_ushort, | 7148 | reclen: c_ushort, |
| 7149 | type: u8, | 7149 | type: u8, |
| 7150 | name: [256:0]u8, | 7150 | name: [255:0]u8, |
| 7151 | }, | 7151 | }, |
| 7152 | else => void, | 7152 | else => void, |
| 7153 | }; | 7153 | }; |
lib/std/posix.zig+21-4| ... | @@ -192,10 +192,27 @@ pub const iovec_const = extern struct { | ... | @@ -192,10 +192,27 @@ pub const iovec_const = extern struct { |
| 192 | len: usize, | 192 | len: usize, |
| 193 | }; | 193 | }; |
| 194 | 194 | ||
| 195 | pub const ACCMODE = enum(u2) { | 195 | pub const ACCMODE = switch (native_os) { |
| 196 | RDONLY = 0, | 196 | // POSIX has a note about the access mode values: |
| 197 | WRONLY = 1, | 197 | // |
| 198 | RDWR = 2, | 198 | // In historical implementations the value of O_RDONLY is zero. Because of |
| 199 | // that, it is not possible to detect the presence of O_RDONLY and another | ||
| 200 | // option. Future implementations should encode O_RDONLY and O_WRONLY as | ||
| 201 | // bit flags so that: O_RDONLY | O_WRONLY == O_RDWR | ||
| 202 | // | ||
| 203 | // In practice SerenityOS is the only system supported by Zig that | ||
| 204 | // implements this suggestion. | ||
| 205 | // https://github.com/SerenityOS/serenity/blob/4adc51fdf6af7d50679c48b39362e062f5a3b2cb/Kernel/API/POSIX/fcntl.h#L28-L30 | ||
| 206 | .serenity => enum(u2) { | ||
| 207 | RDONLY = 1, | ||
| 208 | WRONLY = 2, | ||
| 209 | RDWR = 3, | ||
| 210 | }, | ||
| 211 | else => enum(u2) { | ||
| 212 | RDONLY = 0, | ||
| 213 | WRONLY = 1, | ||
| 214 | RDWR = 2, | ||
| 215 | }, | ||
| 199 | }; | 216 | }; |
| 200 | 217 | ||
| 201 | pub const TCSA = enum(c_uint) { | 218 | pub const TCSA = enum(c_uint) { |
src/target.zig+2| ... | @@ -414,6 +414,8 @@ pub fn libcFullLinkFlags(target: *const std.Target) []const []const u8 { | ... | @@ -414,6 +414,8 @@ pub fn libcFullLinkFlags(target: *const std.Target) []const []const u8 { |
| 414 | .android, .androideabi, .ohos, .ohoseabi => &.{ "-lm", "-lc", "-ldl" }, | 414 | .android, .androideabi, .ohos, .ohoseabi => &.{ "-lm", "-lc", "-ldl" }, |
| 415 | else => &.{ "-lm", "-lpthread", "-lc", "-ldl", "-lrt", "-lutil" }, | 415 | else => &.{ "-lm", "-lpthread", "-lc", "-ldl", "-lrt", "-lutil" }, |
| 416 | }, | 416 | }, |
| 417 | // On SerenityOS libc includes libm, libpthread, libdl, and libssp. | ||
| 418 | .serenity => &.{"-lc"}, | ||
| 417 | else => &.{}, | 419 | else => &.{}, |
| 418 | }; | 420 | }; |
| 419 | return result; | 421 | return result; |