| ... | @@ -859,12 +859,14 @@ pub const Kevent = extern struct { | ... | @@ -859,12 +859,14 @@ pub const Kevent = extern struct { |
| 859 | // to make sure the struct is laid out the same. These values were | 859 | // to make sure the struct is laid out the same. These values were |
| 860 | // produced from C code using the offsetof macro. | 860 | // produced from C code using the offsetof macro. |
| 861 | comptime { | 861 | comptime { |
| 862 | assert(@offsetOf(Kevent, "ident") == 0); | 862 | if (builtin.target.isDarwin()) { |
| 863 | assert(@offsetOf(Kevent, "filter") == 8); | 863 | assert(@offsetOf(Kevent, "ident") == 0); |
| 864 | assert(@offsetOf(Kevent, "flags") == 10); | 864 | assert(@offsetOf(Kevent, "filter") == 8); |
| 865 | assert(@offsetOf(Kevent, "fflags") == 12); | 865 | assert(@offsetOf(Kevent, "flags") == 10); |
| 866 | assert(@offsetOf(Kevent, "data") == 16); | 866 | assert(@offsetOf(Kevent, "fflags") == 12); |
| 867 | assert(@offsetOf(Kevent, "udata") == 24); | 867 | assert(@offsetOf(Kevent, "data") == 16); |
| | 868 | assert(@offsetOf(Kevent, "udata") == 24); |
| | 869 | } |
| 868 | } | 870 | } |
| 869 | | 871 | |
| 870 | pub const kevent64_s = extern struct { | 872 | pub const kevent64_s = extern struct { |
| ... | @@ -881,13 +883,15 @@ pub const kevent64_s = extern struct { | ... | @@ -881,13 +883,15 @@ pub const kevent64_s = extern struct { |
| 881 | // to make sure the struct is laid out the same. These values were | 883 | // to make sure the struct is laid out the same. These values were |
| 882 | // produced from C code using the offsetof macro. | 884 | // produced from C code using the offsetof macro. |
| 883 | comptime { | 885 | comptime { |
| 884 | assert(@offsetOf(kevent64_s, "ident") == 0); | 886 | if (builtin.target.isDarwin()) { |
| 885 | assert(@offsetOf(kevent64_s, "filter") == 8); | 887 | assert(@offsetOf(kevent64_s, "ident") == 0); |
| 886 | assert(@offsetOf(kevent64_s, "flags") == 10); | 888 | assert(@offsetOf(kevent64_s, "filter") == 8); |
| 887 | assert(@offsetOf(kevent64_s, "fflags") == 12); | 889 | assert(@offsetOf(kevent64_s, "flags") == 10); |
| 888 | assert(@offsetOf(kevent64_s, "data") == 16); | 890 | assert(@offsetOf(kevent64_s, "fflags") == 12); |
| 889 | assert(@offsetOf(kevent64_s, "udata") == 24); | 891 | assert(@offsetOf(kevent64_s, "data") == 16); |
| 890 | assert(@offsetOf(kevent64_s, "ext") == 32); | 892 | assert(@offsetOf(kevent64_s, "udata") == 24); |
| | 893 | assert(@offsetOf(kevent64_s, "ext") == 32); |
| | 894 | } |
| 891 | } | 895 | } |
| 892 | | 896 | |
| 893 | pub const mach_port_t = c_uint; | 897 | pub const mach_port_t = c_uint; |
| ... | @@ -1779,7 +1783,7 @@ pub const E = enum(u16) { | ... | @@ -1779,7 +1783,7 @@ pub const E = enum(u16) { |
| 1779 | }; | 1783 | }; |
| 1780 | | 1784 | |
| 1781 | pub fn getKernError(err: kern_return_t) KernE { | 1785 | pub fn getKernError(err: kern_return_t) KernE { |
| 1782 | return @intToEnum(KernE, err); | 1786 | return @intToEnum(KernE, @truncate(u8, @intCast(usize, err))); |
| 1783 | } | 1787 | } |
| 1784 | | 1788 | |
| 1785 | /// Kernel return values | 1789 | /// Kernel return values |