@zigc/lib 0.17.0-dev.44 → 0.17.0-dev.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/c/math.zig +28 -17
- package/compiler_rt/cos.zig +0 -2
- package/compiler_rt/exp.zig +0 -2
- package/compiler_rt/exp2.zig +0 -2
- package/compiler_rt/fabs.zig +0 -2
- package/compiler_rt/fma.zig +0 -2
- package/compiler_rt/fmax.zig +0 -2
- package/compiler_rt/fmin.zig +0 -2
- package/compiler_rt/fmod.zig +0 -2
- package/compiler_rt/log.zig +0 -2
- package/compiler_rt/log10.zig +0 -2
- package/compiler_rt/log2.zig +0 -2
- package/compiler_rt/round.zig +0 -2
- package/compiler_rt/sin.zig +0 -2
- package/compiler_rt/sincos.zig +0 -2
- package/compiler_rt/sqrt.zig +0 -2
- package/compiler_rt/tan.zig +0 -2
- package/compiler_rt/trunc.zig +0 -2
- package/package.json +1 -1
- package/std/Io/Dispatch.zig +3 -13
- package/std/Io/Threaded.zig +157 -23
- package/std/Io/Uring.zig +11 -13
- package/std/Io/net.zig +11 -11
- package/std/Io.zig +19 -10
- package/std/Target.zig +0 -2
- package/std/c/haiku.zig +3 -0
- package/std/c.zig +12 -2
- package/std/debug.zig +1 -1
- package/std/zig/LibCInstallation.zig +1 -0
package/c/math.zig
CHANGED
|
@@ -116,13 +116,9 @@ fn atanf(x: f32) callconv(.c) f32 {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
fn atanl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
119
|
-
return switch (@typeInfo(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
64 => math.atan(@as(f64, @floatCast(x))),
|
|
123
|
-
80 => math.atan(@as(f80, @floatCast(x))),
|
|
124
|
-
128 => math.atan(@as(f128, @floatCast(x))),
|
|
125
|
-
else => unreachable,
|
|
119
|
+
return switch (@typeInfo(c_longdouble).float.bits) {
|
|
120
|
+
64 => std.c.atan(x),
|
|
121
|
+
else => math.atan(x),
|
|
126
122
|
};
|
|
127
123
|
}
|
|
128
124
|
|
|
@@ -143,7 +139,10 @@ fn copysignf(x: f32, y: f32) callconv(.c) f32 {
|
|
|
143
139
|
}
|
|
144
140
|
|
|
145
141
|
fn copysignl(x: c_longdouble, y: c_longdouble) callconv(.c) c_longdouble {
|
|
146
|
-
return
|
|
142
|
+
return switch (@typeInfo(c_longdouble).float.bits) {
|
|
143
|
+
64 => std.c.copysign(x, y),
|
|
144
|
+
else => math.copysign(x, y),
|
|
145
|
+
};
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
fn cosh(x: f64) callconv(.c) f64 {
|
|
@@ -183,15 +182,18 @@ fn fdimf(x: f32, y: f32) callconv(.c) f32 {
|
|
|
183
182
|
}
|
|
184
183
|
|
|
185
184
|
fn fdiml(x: c_longdouble, y: c_longdouble) callconv(.c) c_longdouble {
|
|
186
|
-
return
|
|
185
|
+
return switch (@typeInfo(c_longdouble).float.bits) {
|
|
186
|
+
64 => std.c.fdim(x, y),
|
|
187
|
+
else => fdimGeneric(c_longdouble, x, y),
|
|
188
|
+
};
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
fn finite(x: f64) callconv(.c) c_int {
|
|
190
|
-
return
|
|
192
|
+
return @intFromBool(math.isFinite(x));
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
fn finitef(x: f32) callconv(.c) c_int {
|
|
194
|
-
return
|
|
196
|
+
return @intFromBool(math.isFinite(x));
|
|
195
197
|
}
|
|
196
198
|
|
|
197
199
|
fn frexpGeneric(comptime T: type, x: T, e: *c_int) T {
|
|
@@ -222,7 +224,10 @@ fn frexpf(x: f32, e: *c_int) callconv(.c) f32 {
|
|
|
222
224
|
}
|
|
223
225
|
|
|
224
226
|
fn frexpl(x: c_longdouble, e: *c_int) callconv(.c) c_longdouble {
|
|
225
|
-
return
|
|
227
|
+
return switch (@typeInfo(c_longdouble).float.bits) {
|
|
228
|
+
64 => std.c.frexp(x, e),
|
|
229
|
+
else => frexpGeneric(c_longdouble, x, e),
|
|
230
|
+
};
|
|
226
231
|
}
|
|
227
232
|
|
|
228
233
|
fn hypot(x: f64, y: f64) callconv(.c) f64 {
|
|
@@ -234,19 +239,22 @@ fn hypotf(x: f32, y: f32) callconv(.c) f32 {
|
|
|
234
239
|
}
|
|
235
240
|
|
|
236
241
|
fn hypotl(x: c_longdouble, y: c_longdouble) callconv(.c) c_longdouble {
|
|
237
|
-
return
|
|
242
|
+
return switch (@typeInfo(c_longdouble).float.bits) {
|
|
243
|
+
64 => std.c.hypot(x, y),
|
|
244
|
+
else => math.hypot(x, y),
|
|
245
|
+
};
|
|
238
246
|
}
|
|
239
247
|
|
|
240
248
|
fn isnan(x: f64) callconv(.c) c_int {
|
|
241
|
-
return
|
|
249
|
+
return @intFromBool(math.isNan(x));
|
|
242
250
|
}
|
|
243
251
|
|
|
244
252
|
fn isnanf(x: f32) callconv(.c) c_int {
|
|
245
|
-
return
|
|
253
|
+
return @intFromBool(math.isNan(x));
|
|
246
254
|
}
|
|
247
255
|
|
|
248
256
|
fn isnanl(x: c_longdouble) callconv(.c) c_int {
|
|
249
|
-
return
|
|
257
|
+
return @intFromBool(math.isNan(x));
|
|
250
258
|
}
|
|
251
259
|
|
|
252
260
|
fn lrint(x: f64) callconv(.c) c_long {
|
|
@@ -290,7 +298,10 @@ fn modff(x: f32, iptr: *f32) callconv(.c) f32 {
|
|
|
290
298
|
}
|
|
291
299
|
|
|
292
300
|
fn modfl(x: c_longdouble, iptr: *c_longdouble) callconv(.c) c_longdouble {
|
|
293
|
-
return
|
|
301
|
+
return switch (@typeInfo(c_longdouble).float.bits) {
|
|
302
|
+
64 => std.c.modf(x, iptr),
|
|
303
|
+
else => modfGeneric(c_longdouble, x, iptr),
|
|
304
|
+
};
|
|
294
305
|
}
|
|
295
306
|
|
|
296
307
|
fn testModf(comptime T: type) !void {
|
package/compiler_rt/cos.zig
CHANGED
|
@@ -173,8 +173,6 @@ pub fn cosq(x: f128) callconv(.c) f128 {
|
|
|
173
173
|
|
|
174
174
|
pub fn cosl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
175
175
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
176
|
-
16 => return cosh(x),
|
|
177
|
-
32 => return cosf(x),
|
|
178
176
|
64 => return cos(x),
|
|
179
177
|
80 => return cosx(x),
|
|
180
178
|
128 => return cosq(x),
|
package/compiler_rt/exp.zig
CHANGED
|
@@ -198,8 +198,6 @@ const expq = @import("exp_f128.zig").exp;
|
|
|
198
198
|
|
|
199
199
|
pub fn expl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
200
200
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
201
|
-
16 => return __exph(x),
|
|
202
|
-
32 => return expf(x),
|
|
203
201
|
64 => return exp(x),
|
|
204
202
|
80 => return __expx(x),
|
|
205
203
|
128 => return expq(x),
|
package/compiler_rt/exp2.zig
CHANGED
|
@@ -165,8 +165,6 @@ pub const exp2q = @import("exp_f128.zig").exp2;
|
|
|
165
165
|
|
|
166
166
|
pub fn exp2l(x: c_longdouble) callconv(.c) c_longdouble {
|
|
167
167
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
168
|
-
16 => return __exp2h(x),
|
|
169
|
-
32 => return exp2f(x),
|
|
170
168
|
64 => return exp2(x),
|
|
171
169
|
80 => return __exp2x(x),
|
|
172
170
|
128 => return exp2q(x),
|
package/compiler_rt/fabs.zig
CHANGED
|
@@ -38,8 +38,6 @@ pub fn fabsq(a: f128) callconv(.c) f128 {
|
|
|
38
38
|
|
|
39
39
|
pub fn fabsl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
40
40
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
41
|
-
16 => return __fabsh(x),
|
|
42
|
-
32 => return fabsf(x),
|
|
43
41
|
64 => return fabs(x),
|
|
44
42
|
80 => return __fabsx(x),
|
|
45
43
|
128 => return fabsq(x),
|
package/compiler_rt/fma.zig
CHANGED
|
@@ -151,8 +151,6 @@ pub fn fmaq(x: f128, y: f128, z: f128) callconv(.c) f128 {
|
|
|
151
151
|
|
|
152
152
|
pub fn fmal(x: c_longdouble, y: c_longdouble, z: c_longdouble) callconv(.c) c_longdouble {
|
|
153
153
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
154
|
-
16 => return __fmah(x, y, z),
|
|
155
|
-
32 => return fmaf(x, y, z),
|
|
156
154
|
64 => return fma(x, y, z),
|
|
157
155
|
80 => return __fmax(x, y, z),
|
|
158
156
|
128 => return fmaq(x, y, z),
|
package/compiler_rt/fmax.zig
CHANGED
|
@@ -39,8 +39,6 @@ pub fn fmaxq(x: f128, y: f128) callconv(.c) f128 {
|
|
|
39
39
|
|
|
40
40
|
pub fn fmaxl(x: c_longdouble, y: c_longdouble) callconv(.c) c_longdouble {
|
|
41
41
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
42
|
-
16 => return __fmaxh(x, y),
|
|
43
|
-
32 => return fmaxf(x, y),
|
|
44
42
|
64 => return fmax(x, y),
|
|
45
43
|
80 => return __fmaxx(x, y),
|
|
46
44
|
128 => return fmaxq(x, y),
|
package/compiler_rt/fmin.zig
CHANGED
|
@@ -39,8 +39,6 @@ pub fn fminq(x: f128, y: f128) callconv(.c) f128 {
|
|
|
39
39
|
|
|
40
40
|
pub fn fminl(x: c_longdouble, y: c_longdouble) callconv(.c) c_longdouble {
|
|
41
41
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
42
|
-
16 => return __fminh(x, y),
|
|
43
|
-
32 => return fminf(x, y),
|
|
44
42
|
64 => return fmin(x, y),
|
|
45
43
|
80 => return __fminx(x, y),
|
|
46
44
|
128 => return fminq(x, y),
|
package/compiler_rt/fmod.zig
CHANGED
|
@@ -251,8 +251,6 @@ pub fn fmodq(a: f128, b: f128) callconv(.c) f128 {
|
|
|
251
251
|
|
|
252
252
|
pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.c) c_longdouble {
|
|
253
253
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
254
|
-
16 => return __fmodh(a, b),
|
|
255
|
-
32 => return fmodf(a, b),
|
|
256
254
|
64 => return fmod(a, b),
|
|
257
255
|
80 => return __fmodx(a, b),
|
|
258
256
|
128 => return fmodq(a, b),
|
package/compiler_rt/log.zig
CHANGED
|
@@ -443,8 +443,6 @@ pub fn logq(a: f128) callconv(.c) f128 {
|
|
|
443
443
|
|
|
444
444
|
pub fn logl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
445
445
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
446
|
-
16 => return __logh(x),
|
|
447
|
-
32 => return logf(x),
|
|
448
446
|
64 => return log(x),
|
|
449
447
|
80 => return __logx(x),
|
|
450
448
|
128 => return logq(x),
|
package/compiler_rt/log10.zig
CHANGED
|
@@ -177,8 +177,6 @@ pub fn log10q(a: f128) callconv(.c) f128 {
|
|
|
177
177
|
|
|
178
178
|
pub fn log10l(x: c_longdouble) callconv(.c) c_longdouble {
|
|
179
179
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
180
|
-
16 => return __log10h(x),
|
|
181
|
-
32 => return log10f(x),
|
|
182
180
|
64 => return log10(x),
|
|
183
181
|
80 => return __log10x(x),
|
|
184
182
|
128 => return log10q(x),
|
package/compiler_rt/log2.zig
CHANGED
|
@@ -170,8 +170,6 @@ pub fn log2q(a: f128) callconv(.c) f128 {
|
|
|
170
170
|
|
|
171
171
|
pub fn log2l(x: c_longdouble) callconv(.c) c_longdouble {
|
|
172
172
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
173
|
-
16 => return __log2h(x),
|
|
174
|
-
32 => return log2f(x),
|
|
175
173
|
64 => return log2(x),
|
|
176
174
|
80 => return __log2x(x),
|
|
177
175
|
128 => return log2q(x),
|
package/compiler_rt/round.zig
CHANGED
|
@@ -142,8 +142,6 @@ pub fn roundq(x_: f128) callconv(.c) f128 {
|
|
|
142
142
|
|
|
143
143
|
pub fn roundl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
144
144
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
145
|
-
16 => return __roundh(x),
|
|
146
|
-
32 => return roundf(x),
|
|
147
145
|
64 => return round(x),
|
|
148
146
|
80 => return __roundx(x),
|
|
149
147
|
128 => return roundq(x),
|
package/compiler_rt/sin.zig
CHANGED
|
@@ -189,8 +189,6 @@ pub fn sinq(x: f128) callconv(.c) f128 {
|
|
|
189
189
|
|
|
190
190
|
pub fn sinl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
191
191
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
192
|
-
16 => return sinh(x),
|
|
193
|
-
32 => return sinf(x),
|
|
194
192
|
64 => return sin(x),
|
|
195
193
|
80 => return sinx(x),
|
|
196
194
|
128 => return sinq(x),
|
package/compiler_rt/sincos.zig
CHANGED
|
@@ -292,8 +292,6 @@ pub fn sincosq(x: f128, r_sin: *f128, r_cos: *f128) callconv(.c) void {
|
|
|
292
292
|
|
|
293
293
|
pub fn sincosl(x: c_longdouble, r_sin: *c_longdouble, r_cos: *c_longdouble) callconv(.c) void {
|
|
294
294
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
295
|
-
16 => return sincosh(x, r_sin, r_cos),
|
|
296
|
-
32 => return sincosf(x, r_sin, r_cos),
|
|
297
295
|
64 => return sincos(x, r_sin, r_cos),
|
|
298
296
|
80 => return sincosx(x, r_sin, r_cos),
|
|
299
297
|
128 => return sincosq(x, r_sin, r_cos),
|
package/compiler_rt/sqrt.zig
CHANGED
|
@@ -481,8 +481,6 @@ fn _Qp_sqrt(c: *f128, a: *f128) callconv(.c) void {
|
|
|
481
481
|
|
|
482
482
|
pub fn sqrtl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
483
483
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
484
|
-
16 => return __sqrth(x),
|
|
485
|
-
32 => return sqrtf(x),
|
|
486
484
|
64 => return sqrt(x),
|
|
487
485
|
80 => return __sqrtx(x),
|
|
488
486
|
128 => return sqrtq(x),
|
package/compiler_rt/tan.zig
CHANGED
|
@@ -164,8 +164,6 @@ pub fn tanq(x: f128) callconv(.c) f128 {
|
|
|
164
164
|
|
|
165
165
|
pub fn tanl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
166
166
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
167
|
-
16 => return tanh(x),
|
|
168
|
-
32 => return tanf(x),
|
|
169
167
|
64 => return tan(x),
|
|
170
168
|
80 => return tanx(x),
|
|
171
169
|
128 => return tanq(x),
|
package/compiler_rt/trunc.zig
CHANGED
|
@@ -99,8 +99,6 @@ pub fn truncq(x: f128) callconv(.c) f128 {
|
|
|
99
99
|
|
|
100
100
|
pub fn truncl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
101
101
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
102
|
-
16 => return __trunch(x),
|
|
103
|
-
32 => return truncf(x),
|
|
104
102
|
64 => return trunc(x),
|
|
105
103
|
80 => return __truncx(x),
|
|
106
104
|
128 => return truncq(x),
|
package/package.json
CHANGED
package/std/Io/Dispatch.zig
CHANGED
|
@@ -459,7 +459,6 @@ pub fn io(ev: *Evented) Io {
|
|
|
459
459
|
.netConnectUnix = netConnectUnixUnavailable,
|
|
460
460
|
.netSocketCreatePair = netSocketCreatePairUnavailable,
|
|
461
461
|
.netSend = netSendUnavailable,
|
|
462
|
-
.netRead = netReadUnavailable,
|
|
463
462
|
.netWrite = netWriteUnavailable,
|
|
464
463
|
.netWriteFile = netWriteFileUnavailable,
|
|
465
464
|
.netClose = netClose,
|
|
@@ -1713,6 +1712,7 @@ fn operate(userdata: ?*anyopaque, operation: Io.Operation) Io.Cancelable!Io.Oper
|
|
|
1713
1712
|
},
|
|
1714
1713
|
.device_io_control => |*o| return .{ .device_io_control = try deviceIoControl(o) },
|
|
1715
1714
|
.net_receive => @panic("TODO implement net_receive operation"),
|
|
1715
|
+
.net_read => @panic("TODO implement net_read operation"),
|
|
1716
1716
|
}
|
|
1717
1717
|
}
|
|
1718
1718
|
|
|
@@ -2134,6 +2134,7 @@ fn batchDrainSubmitted(
|
|
|
2134
2134
|
},
|
|
2135
2135
|
.device_io_control => {},
|
|
2136
2136
|
.net_receive => @panic("TODO implement batched net_receive"),
|
|
2137
|
+
.net_read => @panic("TODO implement batched net_read"),
|
|
2137
2138
|
};
|
|
2138
2139
|
if (concurrency) return error.ConcurrencyUnavailable;
|
|
2139
2140
|
break :result try operate(ev, storage.submission.operation);
|
|
@@ -2193,6 +2194,7 @@ fn batchSourceEvent(context: ?*anyopaque) callconv(.c) void {
|
|
|
2193
2194
|
},
|
|
2194
2195
|
.device_io_control => unreachable,
|
|
2195
2196
|
.net_receive => @panic("TODO implement batched net_receive"),
|
|
2197
|
+
.net_read => @panic("TODO implement batched net_read"),
|
|
2196
2198
|
};
|
|
2197
2199
|
|
|
2198
2200
|
switch (pending.node.prev) {
|
|
@@ -4877,18 +4879,6 @@ fn netSendUnavailable(
|
|
|
4877
4879
|
return .{ error.NetworkDown, 0 };
|
|
4878
4880
|
}
|
|
4879
4881
|
|
|
4880
|
-
fn netReadUnavailable(
|
|
4881
|
-
userdata: ?*anyopaque,
|
|
4882
|
-
fd: net.Socket.Handle,
|
|
4883
|
-
data: [][]u8,
|
|
4884
|
-
) net.Stream.Reader.Error!usize {
|
|
4885
|
-
const ev: *Evented = @ptrCast(@alignCast(userdata));
|
|
4886
|
-
_ = ev;
|
|
4887
|
-
_ = fd;
|
|
4888
|
-
_ = data;
|
|
4889
|
-
return error.NetworkDown;
|
|
4890
|
-
}
|
|
4891
|
-
|
|
4892
4882
|
fn netWriteUnavailable(
|
|
4893
4883
|
userdata: ?*anyopaque,
|
|
4894
4884
|
handle: net.Socket.Handle,
|
package/std/Io/Threaded.zig
CHANGED
|
@@ -1943,10 +1943,6 @@ pub fn io(t: *Threaded) Io {
|
|
|
1943
1943
|
.windows => netShutdownWindows,
|
|
1944
1944
|
else => netShutdownPosix,
|
|
1945
1945
|
},
|
|
1946
|
-
.netRead = switch (native_os) {
|
|
1947
|
-
.windows => netReadWindows,
|
|
1948
|
-
else => netReadPosix,
|
|
1949
|
-
},
|
|
1950
1946
|
.netWrite = switch (native_os) {
|
|
1951
1947
|
.windows => netWriteWindows,
|
|
1952
1948
|
else => netWritePosix,
|
|
@@ -2566,6 +2562,12 @@ fn operate(userdata: ?*anyopaque, operation: Io.Operation) Io.Cancelable!Io.Oper
|
|
|
2566
2562
|
};
|
|
2567
2563
|
break :o .{ null, 1 };
|
|
2568
2564
|
} },
|
|
2565
|
+
.net_read => |o| return .{
|
|
2566
|
+
.net_read = netRead(o.socket_handle, o.data) catch |err| switch (err) {
|
|
2567
|
+
error.Canceled => |e| return e,
|
|
2568
|
+
else => |e| e,
|
|
2569
|
+
},
|
|
2570
|
+
},
|
|
2569
2571
|
}
|
|
2570
2572
|
}
|
|
2571
2573
|
|
|
@@ -2621,6 +2623,14 @@ fn batchAwaitAsync(userdata: ?*anyopaque, b: *Io.Batch) Io.Cancelable!void {
|
|
|
2621
2623
|
};
|
|
2622
2624
|
poll_len += 1;
|
|
2623
2625
|
},
|
|
2626
|
+
.net_read => |o| {
|
|
2627
|
+
poll_buffer[poll_len] = .{
|
|
2628
|
+
.fd = o.socket_handle,
|
|
2629
|
+
.events = posix.POLL.IN | posix.POLL.ERR,
|
|
2630
|
+
.revents = 0,
|
|
2631
|
+
};
|
|
2632
|
+
poll_len += 1;
|
|
2633
|
+
},
|
|
2624
2634
|
}
|
|
2625
2635
|
index = submission.node.next;
|
|
2626
2636
|
}
|
|
@@ -2798,6 +2808,7 @@ fn batchAwaitConcurrent(userdata: ?*anyopaque, b: *Io.Batch, timeout: Io.Timeout
|
|
|
2798
2808
|
storage.* = .{ .completion = .{ .node = .{ .next = .none }, .result = result } };
|
|
2799
2809
|
b.completed.tail = index;
|
|
2800
2810
|
},
|
|
2811
|
+
.net_read => |o| try poll_storage.add(o.socket_handle, posix.POLL.IN | posix.POLL.ERR),
|
|
2801
2812
|
}
|
|
2802
2813
|
index = submission.node.next;
|
|
2803
2814
|
}
|
|
@@ -2993,6 +3004,7 @@ fn batchApc(
|
|
|
2993
3004
|
.file_write_streaming => .{ .file_write_streaming = ntWriteFileResult(iosb) },
|
|
2994
3005
|
.device_io_control => .{ .device_io_control = iosb.* },
|
|
2995
3006
|
.net_receive => unreachable,
|
|
3007
|
+
.net_read => unreachable,
|
|
2996
3008
|
};
|
|
2997
3009
|
storage.* = .{ .completion = .{ .node = .{ .next = .none }, .result = result } };
|
|
2998
3010
|
},
|
|
@@ -3201,6 +3213,16 @@ fn batchDrainSubmittedWindows(t: *Threaded, b: *Io.Batch, concurrency: bool) (Io
|
|
|
3201
3213
|
.net_receive = netReceiveWindows(t, o.socket_handle, o.message_buffer, o.data_buffer, o.flags),
|
|
3202
3214
|
});
|
|
3203
3215
|
},
|
|
3216
|
+
.net_read => |*o| {
|
|
3217
|
+
// TODO integrate with overlapped I/O or equivalent to avoid this error
|
|
3218
|
+
if (concurrency) return error.ConcurrencyUnavailable;
|
|
3219
|
+
batchCompleteBlockingWindows(b, operation_userdata, .{
|
|
3220
|
+
.net_read = netRead(o.socket_handle, o.data) catch |err| switch (err) {
|
|
3221
|
+
error.Canceled => |e| return e,
|
|
3222
|
+
else => |e| e,
|
|
3223
|
+
},
|
|
3224
|
+
});
|
|
3225
|
+
},
|
|
3204
3226
|
}
|
|
3205
3227
|
index = submission.node.next;
|
|
3206
3228
|
}
|
|
@@ -5345,7 +5367,7 @@ fn dirOpenDirHaiku(
|
|
|
5345
5367
|
.NOMEM => return error.SystemResources,
|
|
5346
5368
|
.NOTDIR => return error.NotDir,
|
|
5347
5369
|
.PERM => return error.PermissionDenied,
|
|
5348
|
-
.BUSY => return
|
|
5370
|
+
.BUSY => |err| return errnoBug(err),
|
|
5349
5371
|
else => |err| return posix.unexpectedErrno(err),
|
|
5350
5372
|
}
|
|
5351
5373
|
},
|
|
@@ -5791,10 +5813,119 @@ fn dirReadIllumos(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) D
|
|
|
5791
5813
|
}
|
|
5792
5814
|
|
|
5793
5815
|
fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir.Reader.Error!usize {
|
|
5794
|
-
|
|
5795
|
-
_ =
|
|
5796
|
-
|
|
5797
|
-
|
|
5816
|
+
const t: *Threaded = @ptrCast(@alignCast(userdata));
|
|
5817
|
+
_ = t;
|
|
5818
|
+
var buffer_index: usize = 0;
|
|
5819
|
+
while (buffer.len - buffer_index != 0) {
|
|
5820
|
+
if (dr.end - dr.index == 0) {
|
|
5821
|
+
// Refill the buffer, unless we've already created references to
|
|
5822
|
+
// buffered data.
|
|
5823
|
+
if (buffer_index != 0) break;
|
|
5824
|
+
if (dr.state == .reset) {
|
|
5825
|
+
const syscall: Syscall = try .start();
|
|
5826
|
+
while (true) {
|
|
5827
|
+
const rc = posix.system._kern_rewind_dir(dr.dir.handle);
|
|
5828
|
+
switch (@as(posix.E, @enumFromInt(@min(rc, 0)))) {
|
|
5829
|
+
.SUCCESS => {
|
|
5830
|
+
syscall.finish();
|
|
5831
|
+
break;
|
|
5832
|
+
},
|
|
5833
|
+
.INTR => {
|
|
5834
|
+
try syscall.checkCancel();
|
|
5835
|
+
continue;
|
|
5836
|
+
},
|
|
5837
|
+
else => |e| {
|
|
5838
|
+
syscall.finish();
|
|
5839
|
+
switch (e) {
|
|
5840
|
+
else => |err| return posix.unexpectedErrno(err),
|
|
5841
|
+
}
|
|
5842
|
+
},
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
dr.state = .reading;
|
|
5846
|
+
}
|
|
5847
|
+
const syscall: Syscall = try .start();
|
|
5848
|
+
const n: usize = while (true) {
|
|
5849
|
+
const rc = posix.system._kern_read_dir(dr.dir.handle, dr.buffer.ptr, dr.buffer.len, @truncate(dr.buffer.len / @sizeOf(posix.system.DirEnt)));
|
|
5850
|
+
switch (@as(posix.E, @enumFromInt(@min(rc, 0)))) {
|
|
5851
|
+
.SUCCESS => {
|
|
5852
|
+
syscall.finish();
|
|
5853
|
+
break @intCast(rc);
|
|
5854
|
+
},
|
|
5855
|
+
.INTR => {
|
|
5856
|
+
try syscall.checkCancel();
|
|
5857
|
+
continue;
|
|
5858
|
+
},
|
|
5859
|
+
else => |e| {
|
|
5860
|
+
syscall.finish();
|
|
5861
|
+
switch (e) {
|
|
5862
|
+
else => |err| return posix.unexpectedErrno(err),
|
|
5863
|
+
}
|
|
5864
|
+
},
|
|
5865
|
+
}
|
|
5866
|
+
};
|
|
5867
|
+
if (n == 0) {
|
|
5868
|
+
dr.state = .finished;
|
|
5869
|
+
return 0;
|
|
5870
|
+
}
|
|
5871
|
+
dr.index = 0;
|
|
5872
|
+
// _kern_read_dir returns entry count, but Dir.Reader is designed for byte count
|
|
5873
|
+
dr.end = 0;
|
|
5874
|
+
var i: usize = 0;
|
|
5875
|
+
while (i < n) : (i += 1) {
|
|
5876
|
+
const entry = @as(*align(1) posix.system.DirEnt, @ptrCast(&dr.buffer[dr.end]));
|
|
5877
|
+
dr.end += entry.reclen;
|
|
5878
|
+
}
|
|
5879
|
+
}
|
|
5880
|
+
const entry = @as(*align(1) posix.system.DirEnt, @ptrCast(&dr.buffer[dr.index]));
|
|
5881
|
+
const next_index = dr.index + entry.reclen;
|
|
5882
|
+
dr.index = next_index;
|
|
5883
|
+
|
|
5884
|
+
const name = std.mem.sliceTo(@as([*:0]u8, @ptrCast(&entry.name)), 0);
|
|
5885
|
+
if (std.mem.eql(u8, name, ".") or std.mem.eql(u8, name, "..") or entry.ino == 0) continue;
|
|
5886
|
+
|
|
5887
|
+
// haiku dirent doesn't expose type, so we have to call stat to get it.
|
|
5888
|
+
var stat: std.c.Stat = undefined;
|
|
5889
|
+
{
|
|
5890
|
+
const syscall: Syscall = try .start();
|
|
5891
|
+
while (true) {
|
|
5892
|
+
const rc = posix.system._kern_read_stat(dr.dir.handle, name, false, &stat, @sizeOf(std.c.Stat));
|
|
5893
|
+
switch (@as(posix.E, @enumFromInt(@min(rc, 0)))) {
|
|
5894
|
+
.SUCCESS => {
|
|
5895
|
+
syscall.finish();
|
|
5896
|
+
break;
|
|
5897
|
+
},
|
|
5898
|
+
.INTR => {
|
|
5899
|
+
try syscall.checkCancel();
|
|
5900
|
+
continue;
|
|
5901
|
+
},
|
|
5902
|
+
else => |e| {
|
|
5903
|
+
syscall.finish();
|
|
5904
|
+
switch (e) {
|
|
5905
|
+
else => |err| return posix.unexpectedErrno(err),
|
|
5906
|
+
}
|
|
5907
|
+
},
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
}
|
|
5911
|
+
|
|
5912
|
+
const entry_kind: File.Kind = switch (stat.mode & posix.S.IFMT) {
|
|
5913
|
+
posix.S.IFBLK => .block_device,
|
|
5914
|
+
posix.S.IFCHR => .character_device,
|
|
5915
|
+
posix.S.IFDIR => .directory,
|
|
5916
|
+
posix.S.IFIFO => .named_pipe,
|
|
5917
|
+
posix.S.IFLNK => .sym_link,
|
|
5918
|
+
posix.S.IFREG => .file,
|
|
5919
|
+
else => .unknown,
|
|
5920
|
+
};
|
|
5921
|
+
buffer[buffer_index] = .{
|
|
5922
|
+
.name = name,
|
|
5923
|
+
.kind = entry_kind,
|
|
5924
|
+
.inode = entry.ino,
|
|
5925
|
+
};
|
|
5926
|
+
buffer_index += 1;
|
|
5927
|
+
}
|
|
5928
|
+
return buffer_index;
|
|
5798
5929
|
}
|
|
5799
5930
|
|
|
5800
5931
|
fn dirReadWindows(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir.Reader.Error!usize {
|
|
@@ -9812,7 +9943,10 @@ fn fileReadPositionalPosix(file: File, data: []const []u8, offset: u64) File.Rea
|
|
|
9812
9943
|
if (have_preadv) {
|
|
9813
9944
|
const syscall: Syscall = try .start();
|
|
9814
9945
|
while (true) {
|
|
9815
|
-
const rc =
|
|
9946
|
+
const rc = if (native_os == .haiku)
|
|
9947
|
+
posix.system.readv_pos(file.handle, @bitCast(offset), dest.ptr, @intCast(dest.len))
|
|
9948
|
+
else
|
|
9949
|
+
preadv_sym(file.handle, dest.ptr, @intCast(dest.len), @bitCast(offset));
|
|
9816
9950
|
switch (posix.errno(rc)) {
|
|
9817
9951
|
.SUCCESS => {
|
|
9818
9952
|
syscall.finish();
|
|
@@ -9846,7 +9980,7 @@ fn fileReadPositionalPosix(file: File, data: []const []u8, offset: u64) File.Rea
|
|
|
9846
9980
|
|
|
9847
9981
|
const syscall: Syscall = try .start();
|
|
9848
9982
|
while (true) {
|
|
9849
|
-
const rc =
|
|
9983
|
+
const rc = pread_sym(file.handle, dest[0].base, @intCast(dest[0].len), @bitCast(offset));
|
|
9850
9984
|
switch (posix.errno(rc)) {
|
|
9851
9985
|
.SUCCESS => {
|
|
9852
9986
|
syscall.finish();
|
|
@@ -10550,7 +10684,10 @@ fn fileWritePositional(
|
|
|
10550
10684
|
|
|
10551
10685
|
const syscall: Syscall = try .start();
|
|
10552
10686
|
while (true) {
|
|
10553
|
-
const rc =
|
|
10687
|
+
const rc = if (native_os == .haiku)
|
|
10688
|
+
posix.system.writev_pos(file.handle, @bitCast(offset), &iovecs, @intCast(iovlen))
|
|
10689
|
+
else
|
|
10690
|
+
pwritev_sym(file.handle, &iovecs, @intCast(iovlen), @bitCast(offset));
|
|
10554
10691
|
switch (posix.errno(rc)) {
|
|
10555
10692
|
.SUCCESS => {
|
|
10556
10693
|
syscall.finish();
|
|
@@ -12549,11 +12686,14 @@ fn deferAcceptAfd(t: *Threaded, listen_handle: net.Socket.Handle, info: windows.
|
|
|
12549
12686
|
}
|
|
12550
12687
|
}
|
|
12551
12688
|
|
|
12552
|
-
fn
|
|
12689
|
+
fn netRead(socket_handle: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usize {
|
|
12553
12690
|
if (!have_networking) return error.NetworkDown;
|
|
12554
|
-
const t: *Threaded = @ptrCast(@alignCast(userdata));
|
|
12555
|
-
_ = t;
|
|
12556
12691
|
|
|
12692
|
+
if (is_windows) return netReadWindows(socket_handle, data);
|
|
12693
|
+
return netReadPosix(socket_handle, data);
|
|
12694
|
+
}
|
|
12695
|
+
|
|
12696
|
+
fn netReadPosix(fd: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usize {
|
|
12557
12697
|
var iovecs_buffer: [max_iovecs_len]posix.iovec = undefined;
|
|
12558
12698
|
var i: usize = 0;
|
|
12559
12699
|
for (data) |buf| {
|
|
@@ -12590,7 +12730,6 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net.
|
|
|
12590
12730
|
.NOMEM => return error.SystemResources,
|
|
12591
12731
|
.NOTCONN => return error.SocketUnconnected,
|
|
12592
12732
|
.CONNRESET => return error.ConnectionResetByPeer,
|
|
12593
|
-
.TIMEDOUT => return error.Timeout,
|
|
12594
12733
|
.NOTCAPABLE => return error.AccessDenied,
|
|
12595
12734
|
else => |err| return posix.unexpectedErrno(err),
|
|
12596
12735
|
}
|
|
@@ -12622,7 +12761,6 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net.
|
|
|
12622
12761
|
.NOMEM => return error.SystemResources,
|
|
12623
12762
|
.NOTCONN => return error.SocketUnconnected,
|
|
12624
12763
|
.CONNRESET => return error.ConnectionResetByPeer,
|
|
12625
|
-
.TIMEDOUT => return error.Timeout,
|
|
12626
12764
|
.PIPE => return error.SocketUnconnected,
|
|
12627
12765
|
.NETDOWN => return error.NetworkDown,
|
|
12628
12766
|
else => |err| return posix.unexpectedErrno(err),
|
|
@@ -12632,11 +12770,7 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net.
|
|
|
12632
12770
|
}
|
|
12633
12771
|
}
|
|
12634
12772
|
|
|
12635
|
-
fn netReadWindows(
|
|
12636
|
-
if (!have_networking) return error.NetworkDown;
|
|
12637
|
-
const t: *Threaded = @ptrCast(@alignCast(userdata));
|
|
12638
|
-
_ = t;
|
|
12639
|
-
|
|
12773
|
+
fn netReadWindows(socket_handle: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usize {
|
|
12640
12774
|
var iovecs: [max_iovecs_len]windows.AFD.WSABUF(.@"var") = undefined;
|
|
12641
12775
|
var len: u32 = 0;
|
|
12642
12776
|
for (data) |buf| {
|
|
@@ -14063,7 +14197,7 @@ pub fn posixSocketModeProtocol(family: posix.sa_family_t, mode: net.Socket.Mode,
|
|
|
14063
14197
|
.dgram => posix.SOCK.DGRAM,
|
|
14064
14198
|
.seqpacket => posix.SOCK.SEQPACKET,
|
|
14065
14199
|
.raw => posix.SOCK.RAW,
|
|
14066
|
-
.rdm => posix.SOCK.RDM,
|
|
14200
|
+
.rdm => if (@hasDecl(posix.SOCK, "RDM")) posix.SOCK.RDM else return error.OptionUnsupported,
|
|
14067
14201
|
},
|
|
14068
14202
|
if (protocol) |p| @intFromEnum(p) else if (is_windows) switch (family) {
|
|
14069
14203
|
posix.AF.UNIX => switch (mode) {
|
package/std/Io/Uring.zig
CHANGED
|
@@ -779,7 +779,6 @@ pub fn io(ev: *Evented) Io {
|
|
|
779
779
|
.netConnectUnix = netConnectUnixUnavailable,
|
|
780
780
|
.netSocketCreatePair = netSocketCreatePairUnavailable,
|
|
781
781
|
.netSend = netSendUnavailable,
|
|
782
|
-
.netRead = netReadUnavailable,
|
|
783
782
|
.netWrite = netWriteUnavailable,
|
|
784
783
|
.netWriteFile = netWriteFileUnavailable,
|
|
785
784
|
.netClose = netClose,
|
|
@@ -2105,6 +2104,12 @@ fn operate(userdata: ?*anyopaque, operation: Io.Operation) Io.Cancelable!Io.Oper
|
|
|
2105
2104
|
};
|
|
2106
2105
|
},
|
|
2107
2106
|
},
|
|
2107
|
+
.net_read => |o| .{
|
|
2108
|
+
.net_read = r: {
|
|
2109
|
+
_ = o;
|
|
2110
|
+
break :r error.NetworkDown; // TODO
|
|
2111
|
+
},
|
|
2112
|
+
},
|
|
2108
2113
|
};
|
|
2109
2114
|
}
|
|
2110
2115
|
|
|
@@ -2392,6 +2397,10 @@ fn batchDrainSubmitted(
|
|
|
2392
2397
|
_ = o;
|
|
2393
2398
|
@panic("TODO implement batchDrainSubmitted for net_receive");
|
|
2394
2399
|
},
|
|
2400
|
+
.net_read => |o| {
|
|
2401
|
+
_ = o;
|
|
2402
|
+
@panic("TODO implement batchDrainSubmitted for net_read");
|
|
2403
|
+
},
|
|
2395
2404
|
})) |result| {
|
|
2396
2405
|
switch (batch.completed.tail) {
|
|
2397
2406
|
.none => batch.completed.head = index,
|
|
@@ -2493,6 +2502,7 @@ fn batchDrainReady(batch: *Io.Batch) Io.Timeout.Error!void {
|
|
|
2493
2502
|
},
|
|
2494
2503
|
.device_io_control => unreachable,
|
|
2495
2504
|
.net_receive => @panic("TODO"),
|
|
2505
|
+
.net_read => @panic("TODO"),
|
|
2496
2506
|
})) |result| {
|
|
2497
2507
|
switch (batch.completed.tail) {
|
|
2498
2508
|
.none => batch.completed.head = index,
|
|
@@ -5142,18 +5152,6 @@ fn netReceive(
|
|
|
5142
5152
|
}
|
|
5143
5153
|
}
|
|
5144
5154
|
|
|
5145
|
-
fn netReadUnavailable(
|
|
5146
|
-
userdata: ?*anyopaque,
|
|
5147
|
-
fd: net.Socket.Handle,
|
|
5148
|
-
data: [][]u8,
|
|
5149
|
-
) net.Stream.Reader.Error!usize {
|
|
5150
|
-
const ev: *Evented = @ptrCast(@alignCast(userdata));
|
|
5151
|
-
_ = ev;
|
|
5152
|
-
_ = fd;
|
|
5153
|
-
_ = data;
|
|
5154
|
-
return error.NetworkDown;
|
|
5155
|
-
}
|
|
5156
|
-
|
|
5157
5155
|
fn netWriteUnavailable(
|
|
5158
5156
|
userdata: ?*anyopaque,
|
|
5159
5157
|
handle: net.Socket.Handle,
|
package/std/Io/net.zig
CHANGED
|
@@ -1245,6 +1245,15 @@ pub const Stream = struct {
|
|
|
1245
1245
|
|
|
1246
1246
|
const max_iovecs_len = 8;
|
|
1247
1247
|
|
|
1248
|
+
/// This is a low-level API that calls the `Io` interface function directly.
|
|
1249
|
+
/// For a higher level API, see `reader`.
|
|
1250
|
+
pub fn read(s: *const Stream, io: Io, data: [][]u8) Reader.Error!usize {
|
|
1251
|
+
return (try io.operate(.{ .net_read = .{
|
|
1252
|
+
.socket_handle = s.socket.handle,
|
|
1253
|
+
.data = data,
|
|
1254
|
+
} })).net_read;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1248
1257
|
pub fn close(s: *const Stream, io: Io) void {
|
|
1249
1258
|
io.vtable.netClose(io.userdata, (&s.socket.handle)[0..1]);
|
|
1250
1259
|
}
|
|
@@ -1259,16 +1268,7 @@ pub const Stream = struct {
|
|
|
1259
1268
|
stream: Stream,
|
|
1260
1269
|
err: ?Error,
|
|
1261
1270
|
|
|
1262
|
-
pub const Error =
|
|
1263
|
-
SystemResources,
|
|
1264
|
-
ConnectionResetByPeer,
|
|
1265
|
-
Timeout,
|
|
1266
|
-
SocketUnconnected,
|
|
1267
|
-
/// The file descriptor does not hold the required rights to read
|
|
1268
|
-
/// from it.
|
|
1269
|
-
AccessDenied,
|
|
1270
|
-
NetworkDown,
|
|
1271
|
-
} || Io.Cancelable || Io.UnexpectedError;
|
|
1271
|
+
pub const Error = Io.Operation.NetRead.Error || Io.Cancelable;
|
|
1272
1272
|
|
|
1273
1273
|
pub fn init(stream: Stream, io: Io, buffer: []u8) Reader {
|
|
1274
1274
|
return .{
|
|
@@ -1302,7 +1302,7 @@ pub const Stream = struct {
|
|
|
1302
1302
|
const dest_n, const data_size = try io_r.writableVector(&iovecs_buffer, data);
|
|
1303
1303
|
const dest = iovecs_buffer[0..dest_n];
|
|
1304
1304
|
assert(dest[0].len > 0);
|
|
1305
|
-
const n =
|
|
1305
|
+
const n = r.stream.read(io, dest) catch |err| {
|
|
1306
1306
|
r.err = err;
|
|
1307
1307
|
return error.ReadFailed;
|
|
1308
1308
|
};
|
package/std/Io.zig
CHANGED
|
@@ -243,8 +243,6 @@ pub const VTable = struct {
|
|
|
243
243
|
netConnectUnix: *const fn (?*anyopaque, *const net.UnixAddress) net.UnixAddress.ConnectError!net.Socket.Handle,
|
|
244
244
|
netSocketCreatePair: *const fn (?*anyopaque, net.Socket.CreatePairOptions) net.Socket.CreatePairError![2]net.Socket,
|
|
245
245
|
netSend: *const fn (?*anyopaque, net.Socket.Handle, []net.OutgoingMessage, net.SendFlags) struct { ?net.Socket.SendError, usize },
|
|
246
|
-
/// Returns 0 on end of stream.
|
|
247
|
-
netRead: *const fn (?*anyopaque, src: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usize,
|
|
248
246
|
netWrite: *const fn (?*anyopaque, dest: net.Socket.Handle, header: []const u8, data: []const []const u8, splat: usize) net.Stream.Writer.Error!usize,
|
|
249
247
|
netWriteFile: *const fn (?*anyopaque, net.Socket.Handle, header: []const u8, *Io.File.Reader, Io.Limit) net.Stream.Writer.WriteFileError!usize,
|
|
250
248
|
netClose: *const fn (?*anyopaque, handle: []const net.Socket.Handle) void,
|
|
@@ -261,6 +259,7 @@ pub const Operation = union(enum) {
|
|
|
261
259
|
/// other systems this tag is unreachable.
|
|
262
260
|
device_io_control: DeviceIoControl,
|
|
263
261
|
net_receive: NetReceive,
|
|
262
|
+
net_read: NetRead,
|
|
264
263
|
|
|
265
264
|
pub const Tag = @typeInfo(Operation).@"union".tag_type.?;
|
|
266
265
|
|
|
@@ -386,6 +385,23 @@ pub const Operation = union(enum) {
|
|
|
386
385
|
pub const Result = struct { ?net.Socket.ReceiveError, usize };
|
|
387
386
|
};
|
|
388
387
|
|
|
388
|
+
pub const NetRead = struct {
|
|
389
|
+
socket_handle: net.Socket.Handle,
|
|
390
|
+
data: [][]u8,
|
|
391
|
+
|
|
392
|
+
pub const Error = error{
|
|
393
|
+
SystemResources,
|
|
394
|
+
ConnectionResetByPeer,
|
|
395
|
+
SocketUnconnected,
|
|
396
|
+
/// The file descriptor does not hold the required rights to read
|
|
397
|
+
/// from it.
|
|
398
|
+
AccessDenied,
|
|
399
|
+
NetworkDown,
|
|
400
|
+
} || Io.UnexpectedError;
|
|
401
|
+
|
|
402
|
+
pub const Result = Error!usize;
|
|
403
|
+
};
|
|
404
|
+
|
|
389
405
|
pub const Result = Result: {
|
|
390
406
|
const operation_fields = @typeInfo(Operation).@"union".fields;
|
|
391
407
|
var field_names: [operation_fields.len][]const u8 = undefined;
|
|
@@ -2626,7 +2642,6 @@ pub const failing: std.Io = .{
|
|
|
2626
2642
|
.netConnectUnix = failingNetConnectUnix,
|
|
2627
2643
|
.netSocketCreatePair = failingNetSocketCreatePair,
|
|
2628
2644
|
.netSend = failingNetSend,
|
|
2629
|
-
.netRead = failingNetRead,
|
|
2630
2645
|
.netWrite = failingNetWrite,
|
|
2631
2646
|
.netWriteFile = failingNetWriteFile,
|
|
2632
2647
|
.netClose = unreachableNetClose,
|
|
@@ -2774,6 +2789,7 @@ pub fn failingOperate(userdata: ?*anyopaque, operation: Operation) Cancelable!Op
|
|
|
2774
2789
|
.file_write_streaming => .{ .file_write_streaming = error.InputOutput },
|
|
2775
2790
|
.device_io_control => unreachable,
|
|
2776
2791
|
.net_receive => .{ .net_receive = .{ error.NetworkDown, 0 } },
|
|
2792
|
+
.net_read => .{ .net_read = error.NetworkDown },
|
|
2777
2793
|
};
|
|
2778
2794
|
}
|
|
2779
2795
|
|
|
@@ -3377,13 +3393,6 @@ pub fn failingNetSend(userdata: ?*anyopaque, handle: net.Socket.Handle, messages
|
|
|
3377
3393
|
return .{ error.NetworkDown, 0 };
|
|
3378
3394
|
}
|
|
3379
3395
|
|
|
3380
|
-
pub fn failingNetRead(userdata: ?*anyopaque, src: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usize {
|
|
3381
|
-
_ = userdata;
|
|
3382
|
-
_ = src;
|
|
3383
|
-
_ = data;
|
|
3384
|
-
return error.NetworkDown;
|
|
3385
|
-
}
|
|
3386
|
-
|
|
3387
3396
|
pub fn failingNetWrite(userdata: ?*anyopaque, dest: net.Socket.Handle, header: []const u8, data: []const []const u8, splat: usize) net.Stream.Writer.Error!usize {
|
|
3388
3397
|
_ = userdata;
|
|
3389
3398
|
_ = dest;
|
package/std/Target.zig
CHANGED
|
@@ -3082,8 +3082,6 @@ pub fn cTypeByteSize(t: *const Target, c_type: CType) u16 {
|
|
|
3082
3082
|
=> @divExact(cTypeBitSize(t, c_type), 8),
|
|
3083
3083
|
|
|
3084
3084
|
.longdouble => switch (cTypeBitSize(t, c_type)) {
|
|
3085
|
-
16 => 2,
|
|
3086
|
-
32 => 4,
|
|
3087
3085
|
64 => 8,
|
|
3088
3086
|
80 => @intCast(std.mem.alignForward(usize, 10, cTypeAlignment(t, .longdouble))),
|
|
3089
3087
|
128 => 16,
|
package/std/c/haiku.zig
CHANGED
|
@@ -6,6 +6,7 @@ const iovec = std.posix.iovec;
|
|
|
6
6
|
const iovec_const = std.posix.iovec_const;
|
|
7
7
|
const socklen_t = std.c.socklen_t;
|
|
8
8
|
const fd_t = std.c.fd_t;
|
|
9
|
+
const off_t = std.c.off_t;
|
|
9
10
|
const PATH_MAX = std.c.PATH_MAX;
|
|
10
11
|
const uid_t = std.c.uid_t;
|
|
11
12
|
const gid_t = std.c.gid_t;
|
|
@@ -28,6 +29,8 @@ pub extern "root" fn _kern_open_dir(fd: fd_t, path: [*:0]const u8) fd_t;
|
|
|
28
29
|
pub extern "root" fn _kern_read_dir(fd: fd_t, buffer: [*]u8, bufferSize: usize, maxCount: u32) isize;
|
|
29
30
|
pub extern "root" fn _kern_rewind_dir(fd: fd_t) status_t;
|
|
30
31
|
pub extern "root" fn _kern_read_stat(fd: fd_t, path: [*:0]const u8, traverseLink: bool, stat: *std.c.Stat, statSize: usize) status_t;
|
|
32
|
+
pub extern "root" fn readv_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec, count: i32) isize;
|
|
33
|
+
pub extern "root" fn writev_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec_const, count: i32) isize;
|
|
31
34
|
|
|
32
35
|
pub const area_info = extern struct {
|
|
33
36
|
area: u32,
|
package/std/c.zig
CHANGED
|
@@ -3260,8 +3260,8 @@ pub const Sigaction = switch (native_os) {
|
|
|
3260
3260
|
|
|
3261
3261
|
/// signal handler
|
|
3262
3262
|
handler: extern union {
|
|
3263
|
-
handler: handler_fn,
|
|
3264
|
-
sigaction: sigaction_fn,
|
|
3263
|
+
handler: ?handler_fn,
|
|
3264
|
+
sigaction: ?sigaction_fn,
|
|
3265
3265
|
},
|
|
3266
3266
|
|
|
3267
3267
|
/// signal mask to apply
|
|
@@ -11102,6 +11102,14 @@ pub const ioctl = switch (native_os) {
|
|
|
11102
11102
|
else => private.ioctl,
|
|
11103
11103
|
};
|
|
11104
11104
|
|
|
11105
|
+
// Math
|
|
11106
|
+
pub extern "c" fn atan(x: f64) callconv(.c) f64;
|
|
11107
|
+
pub extern "c" fn copysign(x: f64, y: f64) callconv(.c) f64;
|
|
11108
|
+
pub extern "c" fn fdim(x: f64, y: f64) callconv(.c) f64;
|
|
11109
|
+
pub extern "c" fn frexp(x: f64, e: *c_int) callconv(.c) f64;
|
|
11110
|
+
pub extern "c" fn hypot(x: f64, y: f64) callconv(.c) f64;
|
|
11111
|
+
pub extern "c" fn modf(x: f64, iptr: *f64) callconv(.c) f64;
|
|
11112
|
+
|
|
11105
11113
|
// OS-specific bits. These are protected from being used on the wrong OS by
|
|
11106
11114
|
// comptime assertions inside each OS-specific file.
|
|
11107
11115
|
|
|
@@ -11142,6 +11150,8 @@ pub const _kern_open_dir = haiku._kern_open_dir;
|
|
|
11142
11150
|
pub const _kern_read_dir = haiku._kern_read_dir;
|
|
11143
11151
|
pub const _kern_read_stat = haiku._kern_read_stat;
|
|
11144
11152
|
pub const _kern_rewind_dir = haiku._kern_rewind_dir;
|
|
11153
|
+
pub const readv_pos = haiku.readv_pos;
|
|
11154
|
+
pub const writev_pos = haiku.writev_pos;
|
|
11145
11155
|
pub const area_id = haiku.area_id;
|
|
11146
11156
|
pub const area_info = haiku.area_info;
|
|
11147
11157
|
pub const directory_which = haiku.directory_which;
|
package/std/debug.zig
CHANGED
|
@@ -1576,12 +1576,12 @@ fn handleSegfaultPosix(sig: posix.SIG, info: *const posix.siginfo_t, ctx_ptr: ?*
|
|
|
1576
1576
|
.tvos,
|
|
1577
1577
|
.visionos,
|
|
1578
1578
|
.watchos,
|
|
1579
|
+
.haiku,
|
|
1579
1580
|
=> @intFromPtr(info.addr),
|
|
1580
1581
|
.linux,
|
|
1581
1582
|
=> @intFromPtr(info.fields.sigfault.addr),
|
|
1582
1583
|
.netbsd,
|
|
1583
1584
|
=> @intFromPtr(info.info.reason.fault.addr),
|
|
1584
|
-
.haiku,
|
|
1585
1585
|
.openbsd,
|
|
1586
1586
|
=> @intFromPtr(info.data.fault.addr),
|
|
1587
1587
|
.illumos,
|
|
@@ -459,6 +459,7 @@ fn findNativeCrtDirPosix(self: *LibCInstallation, gpa: Allocator, io: Io, args:
|
|
|
459
459
|
|
|
460
460
|
fn findNativeGccDirHaiku(self: *LibCInstallation, gpa: Allocator, io: Io, args: FindNativeOptions) FindError!void {
|
|
461
461
|
self.gcc_dir = try ccPrintFileName(gpa, io, .{
|
|
462
|
+
.environ_map = args.environ_map,
|
|
462
463
|
.search_basename = "crtbeginS.o",
|
|
463
464
|
.want_dirname = .only_dir,
|
|
464
465
|
.verbose = args.verbose,
|