| author | |
| committer | |
| log | 2d2734172484871eb56705e77acca50a8c83d8ae |
| tree | 278d83eae31e9c2703fa3c5bb89778455695daab |
| parent | 17cb69cebcb05bbc9d9f7cf01c41a97b71f8a499 |
6 files changed, 106 insertions(+), 51 deletions(-)
src/os.cpp+1-1| ... | @@ -839,7 +839,7 @@ static int os_exec_process_posix(const char *exe, ZigList<const char *> &args, | ... | @@ -839,7 +839,7 @@ static int os_exec_process_posix(const char *exe, ZigList<const char *> &args, |
| 839 | if ((err = pipe(stderr_pipe))) | 839 | if ((err = pipe(stderr_pipe))) |
| 840 | zig_panic("pipe failed"); | 840 | zig_panic("pipe failed"); |
| 841 | 841 | ||
| 842 | pid_t pid = vfork(); | 842 | pid_t pid = fork(); |
| 843 | if (pid == -1) | 843 | if (pid == -1) |
| 844 | zig_panic("fork failed: %s", strerror(errno)); | 844 | zig_panic("fork failed: %s", strerror(errno)); |
| 845 | if (pid == 0) { | 845 | if (pid == 0) { |
std/fmt/index.zig+7| ... | @@ -1034,6 +1034,13 @@ test "fmt.format" { | ... | @@ -1034,6 +1034,13 @@ test "fmt.format" { |
| 1034 | const result = try bufPrint(buf1[0..], "f64: {}\n", math.nan_f64); | 1034 | const result = try bufPrint(buf1[0..], "f64: {}\n", math.nan_f64); |
| 1035 | assert(mem.eql(u8, result, "f64: nan\n")); | 1035 | assert(mem.eql(u8, result, "f64: nan\n")); |
| 1036 | } | 1036 | } |
| 1037 | if (builtin.arch != builtin.Arch.armv8) { | ||
| 1038 | // negative nan is not defined by IEE 754, | ||
| 1039 | // and ARM thus normalizes it to positive nan | ||
| 1040 | var buf1: [32]u8 = undefined; | ||
| 1041 | const result = try bufPrint(buf1[0..], "f64: {}\n", -math.nan_f64); | ||
| 1042 | assert(mem.eql(u8, result, "f64: -nan\n")); | ||
| 1043 | } | ||
| 1037 | { | 1044 | { |
| 1038 | var buf1: [32]u8 = undefined; | 1045 | var buf1: [32]u8 = undefined; |
| 1039 | const result = try bufPrint(buf1[0..], "f64: {}\n", math.inf_f64); | 1046 | const result = try bufPrint(buf1[0..], "f64: {}\n", math.inf_f64); |
std/os/index.zig+1-1| ... | @@ -633,7 +633,7 @@ fn posixExecveErrnoToErr(err: usize) PosixExecveError { | ... | @@ -633,7 +633,7 @@ fn posixExecveErrnoToErr(err: usize) PosixExecveError { |
| 633 | }; | 633 | }; |
| 634 | } | 634 | } |
| 635 | 635 | ||
| 636 | pub var linux_elf_aux_maybe: ?[*]std.elf.Auxv = undefined; | 636 | pub var linux_elf_aux_maybe: ?[*]std.elf.Auxv = null; |
| 637 | pub var posix_environ_raw: [][*]u8 = undefined; | 637 | pub var posix_environ_raw: [][*]u8 = undefined; |
| 638 | 638 | ||
| 639 | /// See std.elf for the constants. | 639 | /// See std.elf for the constants. |
std/os/linux/arm64.zig+48| ... | @@ -281,6 +281,54 @@ pub const SYS_statx = 291; | ... | @@ -281,6 +281,54 @@ pub const SYS_statx = 291; |
| 281 | pub const SYS_io_pgetevents = 292; | 281 | pub const SYS_io_pgetevents = 292; |
| 282 | pub const SYS_syscalls = 293; | 282 | pub const SYS_syscalls = 293; |
| 283 | 283 | ||
| 284 | pub const O_CREAT = 0o100; | ||
| 285 | pub const O_EXCL = 0o200; | ||
| 286 | pub const O_NOCTTY = 0o400; | ||
| 287 | pub const O_TRUNC = 0o1000; | ||
| 288 | pub const O_APPEND = 0o2000; | ||
| 289 | pub const O_NONBLOCK = 0o4000; | ||
| 290 | pub const O_DSYNC = 0o10000; | ||
| 291 | pub const O_SYNC = 0o4010000; | ||
| 292 | pub const O_RSYNC = 0o4010000; | ||
| 293 | pub const O_DIRECTORY = 0o200000; | ||
| 294 | pub const O_NOFOLLOW = 0o400000; | ||
| 295 | pub const O_CLOEXEC = 0o2000000; | ||
| 296 | |||
| 297 | pub const O_ASYNC = 0o20000; | ||
| 298 | pub const O_DIRECT = 0o40000; | ||
| 299 | pub const O_LARGEFILE = 0; | ||
| 300 | pub const O_NOATIME = 0o1000000; | ||
| 301 | pub const O_PATH = 0o10000000; | ||
| 302 | pub const O_TMPFILE = 0o20200000; | ||
| 303 | pub const O_NDELAY = O_NONBLOCK; | ||
| 304 | |||
| 305 | pub const F_DUPFD = 0; | ||
| 306 | pub const F_GETFD = 1; | ||
| 307 | pub const F_SETFD = 2; | ||
| 308 | pub const F_GETFL = 3; | ||
| 309 | pub const F_SETFL = 4; | ||
| 310 | |||
| 311 | pub const F_SETOWN = 8; | ||
| 312 | pub const F_GETOWN = 9; | ||
| 313 | pub const F_SETSIG = 10; | ||
| 314 | pub const F_GETSIG = 11; | ||
| 315 | |||
| 316 | pub const F_GETLK = 5; | ||
| 317 | pub const F_SETLK = 6; | ||
| 318 | pub const F_SETLKW = 7; | ||
| 319 | |||
| 320 | pub const F_SETOWN_EX = 15; | ||
| 321 | pub const F_GETOWN_EX = 16; | ||
| 322 | |||
| 323 | pub const F_GETOWNER_UIDS = 17; | ||
| 324 | |||
| 325 | pub const AT_FDCWD = -100; | ||
| 326 | pub const AT_SYMLINK_NOFOLLOW = 0x100; | ||
| 327 | pub const AT_REMOVEDIR = 0x200; | ||
| 328 | pub const AT_SYMLINK_FOLLOW = 0x400; | ||
| 329 | pub const AT_NO_AUTOMOUNT = 0x800; | ||
| 330 | pub const AT_EMPTY_PATH = 0x1000; | ||
| 331 | |||
| 284 | pub const VDSO_USEFUL = true; | 332 | pub const VDSO_USEFUL = true; |
| 285 | pub const VDSO_CGT_SYM = "__kernel_clock_gettime"; | 333 | pub const VDSO_CGT_SYM = "__kernel_clock_gettime"; |
| 286 | pub const VDSO_CGT_VER = "LINUX_2.6.39"; | 334 | pub const VDSO_CGT_VER = "LINUX_2.6.39"; |
std/os/linux/index.zig+1-49| ... | @@ -625,54 +625,6 @@ pub const S_IWOTH = 0o002; | ... | @@ -625,54 +625,6 @@ pub const S_IWOTH = 0o002; |
| 625 | pub const S_IXOTH = 0o001; | 625 | pub const S_IXOTH = 0o001; |
| 626 | pub const S_IRWXO = 0o007; | 626 | pub const S_IRWXO = 0o007; |
| 627 | 627 | ||
| 628 | pub const O_CREAT = 0o100; | ||
| 629 | pub const O_EXCL = 0o200; | ||
| 630 | pub const O_NOCTTY = 0o400; | ||
| 631 | pub const O_TRUNC = 0o1000; | ||
| 632 | pub const O_APPEND = 0o2000; | ||
| 633 | pub const O_NONBLOCK = 0o4000; | ||
| 634 | pub const O_DSYNC = 0o10000; | ||
| 635 | pub const O_SYNC = 0o4010000; | ||
| 636 | pub const O_RSYNC = 0o4010000; | ||
| 637 | pub const O_DIRECTORY = 0o200000; | ||
| 638 | pub const O_NOFOLLOW = 0o400000; | ||
| 639 | pub const O_CLOEXEC = 0o2000000; | ||
| 640 | |||
| 641 | pub const O_ASYNC = 0o20000; | ||
| 642 | pub const O_DIRECT = 0o40000; | ||
| 643 | pub const O_LARGEFILE = 0; | ||
| 644 | pub const O_NOATIME = 0o1000000; | ||
| 645 | pub const O_PATH = 0o10000000; | ||
| 646 | pub const O_TMPFILE = 0o20200000; | ||
| 647 | pub const O_NDELAY = O_NONBLOCK; | ||
| 648 | |||
| 649 | pub const F_DUPFD = 0; | ||
| 650 | pub const F_GETFD = 1; | ||
| 651 | pub const F_SETFD = 2; | ||
| 652 | pub const F_GETFL = 3; | ||
| 653 | pub const F_SETFL = 4; | ||
| 654 | |||
| 655 | pub const F_SETOWN = 8; | ||
| 656 | pub const F_GETOWN = 9; | ||
| 657 | pub const F_SETSIG = 10; | ||
| 658 | pub const F_GETSIG = 11; | ||
| 659 | |||
| 660 | pub const F_GETLK = 5; | ||
| 661 | pub const F_SETLK = 6; | ||
| 662 | pub const F_SETLKW = 7; | ||
| 663 | |||
| 664 | pub const F_SETOWN_EX = 15; | ||
| 665 | pub const F_GETOWN_EX = 16; | ||
| 666 | |||
| 667 | pub const F_GETOWNER_UIDS = 17; | ||
| 668 | |||
| 669 | pub const AT_FDCWD = -100; | ||
| 670 | pub const AT_SYMLINK_NOFOLLOW = 0x100; | ||
| 671 | pub const AT_REMOVEDIR = 0x200; | ||
| 672 | pub const AT_SYMLINK_FOLLOW = 0x400; | ||
| 673 | pub const AT_NO_AUTOMOUNT = 0x800; | ||
| 674 | pub const AT_EMPTY_PATH = 0x1000; | ||
| 675 | |||
| 676 | pub fn S_ISREG(m: u32) bool { | 628 | pub fn S_ISREG(m: u32) bool { |
| 677 | return m & S_IFMT == S_IFREG; | 629 | return m & S_IFMT == S_IFREG; |
| 678 | } | 630 | } |
| ... | @@ -1272,7 +1224,7 @@ pub fn accept4(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t, flags: | ... | @@ -1272,7 +1224,7 @@ pub fn accept4(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t, flags: |
| 1272 | } | 1224 | } |
| 1273 | 1225 | ||
| 1274 | pub fn fstat(fd: i32, stat_buf: *Stat) usize { | 1226 | pub fn fstat(fd: i32, stat_buf: *Stat) usize { |
| 1275 | return fstatat(fd, c"", stat_buf, AT_EMPTY_PATH); | 1227 | return syscall2(SYS_fstat, @intCast(usize, fd), @ptrToInt(stat_buf)); |
| 1276 | } | 1228 | } |
| 1277 | 1229 | ||
| 1278 | // TODO https://github.com/ziglang/zig/issues/265 | 1230 | // TODO https://github.com/ziglang/zig/issues/265 |
std/os/linux/x86_64.zig+48| ... | @@ -332,6 +332,54 @@ pub const SYS_userfaultfd = 323; | ... | @@ -332,6 +332,54 @@ pub const SYS_userfaultfd = 323; |
| 332 | pub const SYS_membarrier = 324; | 332 | pub const SYS_membarrier = 324; |
| 333 | pub const SYS_mlock2 = 325; | 333 | pub const SYS_mlock2 = 325; |
| 334 | 334 | ||
| 335 | pub const O_CREAT = 0o100; | ||
| 336 | pub const O_EXCL = 0o200; | ||
| 337 | pub const O_NOCTTY = 0o400; | ||
| 338 | pub const O_TRUNC = 0o1000; | ||
| 339 | pub const O_APPEND = 0o2000; | ||
| 340 | pub const O_NONBLOCK = 0o4000; | ||
| 341 | pub const O_DSYNC = 0o10000; | ||
| 342 | pub const O_SYNC = 0o4010000; | ||
| 343 | pub const O_RSYNC = 0o4010000; | ||
| 344 | pub const O_DIRECTORY = 0o200000; | ||
| 345 | pub const O_NOFOLLOW = 0o400000; | ||
| 346 | pub const O_CLOEXEC = 0o2000000; | ||
| 347 | |||
| 348 | pub const O_ASYNC = 0o20000; | ||
| 349 | pub const O_DIRECT = 0o40000; | ||
| 350 | pub const O_LARGEFILE = 0; | ||
| 351 | pub const O_NOATIME = 0o1000000; | ||
| 352 | pub const O_PATH = 0o10000000; | ||
| 353 | pub const O_TMPFILE = 0o20200000; | ||
| 354 | pub const O_NDELAY = O_NONBLOCK; | ||
| 355 | |||
| 356 | pub const F_DUPFD = 0; | ||
| 357 | pub const F_GETFD = 1; | ||
| 358 | pub const F_SETFD = 2; | ||
| 359 | pub const F_GETFL = 3; | ||
| 360 | pub const F_SETFL = 4; | ||
| 361 | |||
| 362 | pub const F_SETOWN = 8; | ||
| 363 | pub const F_GETOWN = 9; | ||
| 364 | pub const F_SETSIG = 10; | ||
| 365 | pub const F_GETSIG = 11; | ||
| 366 | |||
| 367 | pub const F_GETLK = 5; | ||
| 368 | pub const F_SETLK = 6; | ||
| 369 | pub const F_SETLKW = 7; | ||
| 370 | |||
| 371 | pub const F_SETOWN_EX = 15; | ||
| 372 | pub const F_GETOWN_EX = 16; | ||
| 373 | |||
| 374 | pub const F_GETOWNER_UIDS = 17; | ||
| 375 | |||
| 376 | pub const AT_FDCWD = -100; | ||
| 377 | pub const AT_SYMLINK_NOFOLLOW = 0x100; | ||
| 378 | pub const AT_REMOVEDIR = 0x200; | ||
| 379 | pub const AT_SYMLINK_FOLLOW = 0x400; | ||
| 380 | pub const AT_NO_AUTOMOUNT = 0x800; | ||
| 381 | pub const AT_EMPTY_PATH = 0x1000; | ||
| 382 | |||
| 335 | pub const VDSO_USEFUL = true; | 383 | pub const VDSO_USEFUL = true; |
| 336 | pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; | 384 | pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; |
| 337 | pub const VDSO_CGT_VER = "LINUX_2.6"; | 385 | pub const VDSO_CGT_VER = "LINUX_2.6"; |