| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const linux = std.os.linux; | 2 | const linux = std.os.linux; |
| 3 | const builtin = @import("builtin"); | 3 | const builtin = @import("builtin"); |
| | 4 | const arch = builtin.target.cpu.arch; |
| 4 | | 5 | |
| 5 | comptime { | 6 | comptime { |
| 6 | std.debug.assert(builtin.target.os.tag == .linux); | 7 | std.debug.assert(builtin.target.os.tag == .linux); |
| ... | @@ -2864,99 +2865,37 @@ pub const AT = struct { | ... | @@ -2864,99 +2865,37 @@ pub const AT = struct { |
| 2864 | }; | 2865 | }; |
| 2865 | | 2866 | |
| 2866 | pub const O = struct { | 2867 | pub const O = struct { |
| 2867 | pub usingnamespace switch (builtin.target.cpu.arch) { | 2868 | pub const CREAT = if (arch != .mips64el) 0o100 else 0o400; |
| 2868 | // generic | 2869 | pub const EXCL = if (arch != .mips64el) 0o200 else 0o2000; |
| 2869 | .x86_64, | 2870 | pub const NOCTTY = if (arch != .mips64el) 0o400 else 0o4000; |
| 2870 | .riscv64, | 2871 | pub const TRUNC = 0o1000; |
| 2871 | => struct { | 2872 | pub const APPEND = if (arch != .mips64el) 0o2000 else 0o010; |
| 2872 | pub const CREAT = 0o100; | 2873 | pub const NONBLOCK = if (arch != .mips64el) 0o4000 else 0o200; |
| 2873 | pub const EXCL = 0o200; | 2874 | pub const DSYNC = if (arch != .mips64el) 0o10000 else 0o020; |
| 2874 | pub const NOCTTY = 0o400; | 2875 | pub const SYNC = if (arch != .mips64el) 0o4010000 else 0o40020; |
| 2875 | pub const TRUNC = 0o1000; | 2876 | pub const RSYNC = if (arch != .mips64el) 0o4010000 else 0o40020; |
| 2876 | pub const APPEND = 0o2000; | 2877 | pub const DIRECTORY = if (arch == .aarch64 or arch == .powerpc64le) 0o40000 else 0o200000; |
| 2877 | pub const NONBLOCK = 0o4000; | 2878 | pub const NOFOLLOW = if (arch == .aarch64 or arch == .powerpc64le) 0o100000 else 0o400000; |
| 2878 | pub const DSYNC = 0o10000; | 2879 | pub const CLOEXEC = 0o2000000; |
| 2879 | pub const SYNC = 0o4010000; | 2880 | pub const ASYNC = if (arch != .mips64el) 0o20000 else 0o10000; |
| 2880 | pub const RSYNC = 0o4010000; | 2881 | pub const DIRECT = switch (arch) { |
| 2881 | pub const DIRECTORY = 0o200000; | 2882 | .x86_64, .riscv64 => 0o40000, // generic |
| 2882 | pub const NOFOLLOW = 0o400000; | 2883 | .aarch64 => 0o200000, |
| 2883 | pub const CLOEXEC = 0o2000000; | 2884 | .powerpc64le => 0o400000, |
| 2884 | pub const ASYNC = 0o20000; | 2885 | .mips64el => 0o100000, |
| 2885 | pub const DIRECT = 0o40000; | 2886 | else => @compileError("TODO"), |
| 2886 | pub const LARGEFILE = 0o100000; | 2887 | }; |
| 2887 | pub const NOATIME = 0o1000000; | 2888 | pub const LARGEFILE = switch (arch) { |
| 2888 | pub const PATH = 0o10000000; | 2889 | .x86_64, .riscv64 => 0o100000, // generic |
| 2889 | pub const TMPFILE = 0o20200000; | 2890 | .aarch64 => 0o400000, |
| 2890 | pub const NDELAY = O.NONBLOCK; | 2891 | .powerpc64le => 0o200000, |
| 2891 | }, | 2892 | .mips64el => 0o20000, |
| 2892 | .aarch64, | | |
| 2893 | => struct { | | |
| 2894 | pub const CREAT = 0o100; | | |
| 2895 | pub const EXCL = 0o200; | | |
| 2896 | pub const NOCTTY = 0o400; | | |
| 2897 | pub const TRUNC = 0o1000; | | |
| 2898 | pub const APPEND = 0o2000; | | |
| 2899 | pub const NONBLOCK = 0o4000; | | |
| 2900 | pub const DSYNC = 0o10000; | | |
| 2901 | pub const SYNC = 0o4010000; | | |
| 2902 | pub const RSYNC = 0o4010000; | | |
| 2903 | pub const DIRECTORY = 0o40000; | | |
| 2904 | pub const NOFOLLOW = 0o100000; | | |
| 2905 | pub const CLOEXEC = 0o2000000; | | |
| 2906 | pub const ASYNC = 0o20000; | | |
| 2907 | pub const DIRECT = 0o200000; | | |
| 2908 | pub const LARGEFILE = 0o400000; | | |
| 2909 | pub const NOATIME = 0o1000000; | | |
| 2910 | pub const PATH = 0o10000000; | | |
| 2911 | pub const TMPFILE = 0o20040000; | | |
| 2912 | pub const NDELAY = O.NONBLOCK; | | |
| 2913 | }, | | |
| 2914 | .powerpc64le, | | |
| 2915 | => struct { | | |
| 2916 | pub const CREAT = 0o100; | | |
| 2917 | pub const EXCL = 0o200; | | |
| 2918 | pub const NOCTTY = 0o400; | | |
| 2919 | pub const TRUNC = 0o1000; | | |
| 2920 | pub const APPEND = 0o2000; | | |
| 2921 | pub const NONBLOCK = 0o4000; | | |
| 2922 | pub const DSYNC = 0o10000; | | |
| 2923 | pub const SYNC = 0o4010000; | | |
| 2924 | pub const RSYNC = 0o4010000; | | |
| 2925 | pub const DIRECTORY = 0o40000; | | |
| 2926 | pub const NOFOLLOW = 0o100000; | | |
| 2927 | pub const CLOEXEC = 0o2000000; | | |
| 2928 | pub const ASYNC = 0o20000; | | |
| 2929 | pub const DIRECT = 0o400000; | | |
| 2930 | pub const LARGEFILE = 0o200000; | | |
| 2931 | pub const NOATIME = 0o1000000; | | |
| 2932 | pub const PATH = 0o10000000; | | |
| 2933 | pub const TMPFILE = 0o20040000; | | |
| 2934 | pub const NDELAY = O.NONBLOCK; | | |
| 2935 | }, | | |
| 2936 | .mips64el, | | |
| 2937 | => struct { | | |
| 2938 | pub const CREAT = 0o400; | | |
| 2939 | pub const EXCL = 0o2000; | | |
| 2940 | pub const NOCTTY = 0o4000; | | |
| 2941 | pub const TRUNC = 0o1000; | | |
| 2942 | pub const APPEND = 0o010; | | |
| 2943 | pub const NONBLOCK = 0o200; | | |
| 2944 | pub const DSYNC = 0o020; | | |
| 2945 | pub const SYNC = 0o40020; | | |
| 2946 | pub const RSYNC = 0o40020; | | |
| 2947 | pub const DIRECTORY = 0o200000; | | |
| 2948 | pub const NOFOLLOW = 0o400000; | | |
| 2949 | pub const CLOEXEC = 0o2000000; | | |
| 2950 | pub const ASYNC = 0o10000; | | |
| 2951 | pub const DIRECT = 0o100000; | | |
| 2952 | pub const LARGEFILE = 0o20000; | | |
| 2953 | pub const NOATIME = 0o1000000; | | |
| 2954 | pub const PATH = 0o10000000; | | |
| 2955 | pub const TMPFILE = 0o20200000; | | |
| 2956 | pub const NDELAY = O.NONBLOCK; | | |
| 2957 | }, | | |
| 2958 | else => @compileError("TODO"), | 2893 | else => @compileError("TODO"), |
| 2959 | }; | 2894 | }; |
| | 2895 | pub const NOATIME = 0o1000000; |
| | 2896 | pub const PATH = 0o10000000; |
| | 2897 | pub const TMPFILE = if (arch == .aarch64 or arch == .powerpc64le) 0o20040000 else 0o20200000; |
| | 2898 | pub const NDELAY = O.NONBLOCK; |
| 2960 | pub const SEARCH = O.PATH; | 2899 | pub const SEARCH = O.PATH; |
| 2961 | pub const EXEC = O.PATH; | 2900 | pub const EXEC = O.PATH; |
| 2962 | pub const TTY_INIT = 0; | 2901 | pub const TTY_INIT = 0; |