mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 16:45:27 +00:00
os: have sendmsg, recvmsg flags be c_int
This commit is contained in:
parent
12650bcda4
commit
9ba65592d6
@ -166,7 +166,7 @@ pub extern "c" fn sendto(
|
||||
dest_addr: ?*const sockaddr,
|
||||
addrlen: socklen_t,
|
||||
) isize;
|
||||
pub extern "c" fn sendmsg(sockfd: fd_t, msg: *const std.x.os.Socket.Message, flags: u32) isize;
|
||||
pub extern "c" fn sendmsg(sockfd: fd_t, msg: *const std.x.os.Socket.Message, flags: c_int) isize;
|
||||
|
||||
pub extern "c" fn recv(sockfd: fd_t, arg1: ?*c_void, arg2: usize, arg3: c_int) isize;
|
||||
pub extern "c" fn recvfrom(
|
||||
@ -177,7 +177,7 @@ pub extern "c" fn recvfrom(
|
||||
noalias src_addr: ?*sockaddr,
|
||||
noalias addrlen: ?*socklen_t,
|
||||
) isize;
|
||||
pub extern "c" fn recvmsg(sockfd: fd_t, msg: *std.x.os.Socket.Message, flags: u32) isize;
|
||||
pub extern "c" fn recvmsg(sockfd: fd_t, msg: *std.x.os.Socket.Message, flags: c_int) isize;
|
||||
|
||||
pub usingnamespace switch (builtin.os.tag) {
|
||||
.netbsd => struct {
|
||||
|
@ -4998,7 +4998,7 @@ pub fn sendmsg(
|
||||
flags: u32,
|
||||
) SendMsgError!usize {
|
||||
while (true) {
|
||||
const rc = system.sendmsg(sockfd, &msg, flags);
|
||||
const rc = system.sendmsg(sockfd, &msg, @intCast(c_int, flags));
|
||||
if (builtin.os.tag == .windows) {
|
||||
if (rc == windows.ws2_32.SOCKET_ERROR) {
|
||||
switch (windows.ws2_32.WSAGetLastError()) {
|
||||
|
@ -1004,7 +1004,7 @@ pub fn sendmsg(fd: i32, msg: *const msghdr_const, flags: u32) usize {
|
||||
if (native_arch == .i386) {
|
||||
return socketcall(SC_sendmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), flags });
|
||||
}
|
||||
return syscall3(.sendmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), flags);
|
||||
return syscall3(.sendmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)));
|
||||
}
|
||||
|
||||
pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize {
|
||||
@ -1058,7 +1058,7 @@ pub fn recvmsg(fd: i32, msg: *msghdr, flags: u32) usize {
|
||||
if (native_arch == .i386) {
|
||||
return socketcall(SC_recvmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), flags });
|
||||
}
|
||||
return syscall3(.recvmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), flags);
|
||||
return syscall3(.recvmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)));
|
||||
}
|
||||
|
||||
pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize {
|
||||
|
@ -87,7 +87,7 @@ pub fn Mixin(comptime Socket: type) type {
|
||||
/// read into the buffer provided.
|
||||
pub fn readVectorized(self: Socket, msg: *Socket.Message, flags: u32) !usize {
|
||||
while (true) {
|
||||
const rc = os.system.recvmsg(self.fd, msg, flags);
|
||||
const rc = os.system.recvmsg(self.fd, msg, @intCast(c_int, flags));
|
||||
return switch (os.errno(rc)) {
|
||||
0 => @intCast(usize, rc),
|
||||
os.EBADF => unreachable, // always a race condition
|
||||
|
Loading…
Reference in New Issue
Block a user