mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
std: add msghdr_const
As `iovec_const` is to `iovec`, `msghdr_const` is to `msghdr`
This commit is contained in:
parent
9babcac7a6
commit
217b95da31
@ -58,6 +58,23 @@ pub const msghdr = extern struct {
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
pub const msghdr_const = extern struct {
|
||||
/// optional address
|
||||
msg_name: ?*const sockaddr,
|
||||
/// size of address
|
||||
msg_namelen: socklen_t,
|
||||
/// scatter/gather array
|
||||
msg_iov: [*]iovec_const,
|
||||
/// # elements in msg_iov
|
||||
msg_iovlen: i32,
|
||||
/// ancillary data
|
||||
msg_control: ?*c_void,
|
||||
/// ancillary data buffer len
|
||||
msg_controllen: socklen_t,
|
||||
/// flags on received message
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
pub const Stat = extern struct {
|
||||
dev: u64,
|
||||
ino: u64,
|
||||
|
||||
@ -58,6 +58,23 @@ pub const msghdr = extern struct {
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
pub const msghdr_const = extern struct {
|
||||
/// optional address
|
||||
msg_name: ?*const sockaddr,
|
||||
/// size of address
|
||||
msg_namelen: socklen_t,
|
||||
/// scatter/gather array
|
||||
msg_iov: [*]iovec_const,
|
||||
/// # elements in msg_iov
|
||||
msg_iovlen: i32,
|
||||
/// ancillary data
|
||||
msg_control: ?*c_void,
|
||||
/// ancillary data buffer len
|
||||
msg_controllen: socklen_t,
|
||||
/// flags on received message
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
pub const Stat = extern struct {
|
||||
dev: u64,
|
||||
mode: u32,
|
||||
|
||||
@ -1213,7 +1213,7 @@ pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noal
|
||||
return syscall5(SYS_getsockopt, @bitCast(usize, isize(fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen));
|
||||
}
|
||||
|
||||
pub fn sendmsg(fd: i32, msg: *const msghdr, flags: u32) usize {
|
||||
pub fn sendmsg(fd: i32, msg: *msghdr_const, flags: u32) usize {
|
||||
return syscall3(SYS_sendmsg, @bitCast(usize, isize(fd)), @ptrToInt(msg), flags);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ const std = @import("../../std.zig");
|
||||
const linux = std.os.linux;
|
||||
const socklen_t = linux.socklen_t;
|
||||
const iovec = linux.iovec;
|
||||
const iovec_const = linux.iovec_const;
|
||||
|
||||
pub const SYS_io_setup = 0;
|
||||
pub const SYS_io_destroy = 1;
|
||||
@ -426,6 +427,18 @@ pub const msghdr = extern struct {
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
pub const msghdr_const = extern struct {
|
||||
msg_name: ?*const sockaddr,
|
||||
msg_namelen: socklen_t,
|
||||
msg_iov: [*]iovec_const,
|
||||
msg_iovlen: i32,
|
||||
__pad1: i32,
|
||||
msg_control: ?*c_void,
|
||||
msg_controllen: socklen_t,
|
||||
__pad2: socklen_t,
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
/// Renamed to Stat to not conflict with the stat function.
|
||||
pub const Stat = extern struct {
|
||||
dev: u64,
|
||||
|
||||
@ -3,6 +3,7 @@ const linux = std.os.linux;
|
||||
const sockaddr = linux.sockaddr;
|
||||
const socklen_t = linux.socklen_t;
|
||||
const iovec = linux.iovec;
|
||||
const iovec_const = linux.iovec_const;
|
||||
|
||||
pub const SYS_read = 0;
|
||||
pub const SYS_write = 1;
|
||||
@ -495,6 +496,18 @@ pub const msghdr = extern struct {
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
pub const msghdr_const = extern struct {
|
||||
msg_name: ?*const sockaddr,
|
||||
msg_namelen: socklen_t,
|
||||
msg_iov: [*]iovec_const,
|
||||
msg_iovlen: i32,
|
||||
__pad1: i32,
|
||||
msg_control: ?*c_void,
|
||||
msg_controllen: socklen_t,
|
||||
__pad2: socklen_t,
|
||||
msg_flags: i32,
|
||||
};
|
||||
|
||||
/// Renamed to Stat to not conflict with the stat function.
|
||||
pub const Stat = extern struct {
|
||||
dev: u64,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user