mirror of
https://github.com/ziglang/zig.git
synced 2024-11-16 17:15:37 +00:00
Set the Storage socket sizes to be system defined
Some systems (Solaris, OpenBSD, AIX) change their definitions of sockaddr_storage to be larger than 128 bytes. This comment adds a new constant in the `sockaddr` that defines the size for every system. Fixes #9759
This commit is contained in:
parent
db940a2c81
commit
506f24cac2
@ -291,6 +291,7 @@ pub const sockaddr = extern struct {
|
||||
family: sa_family_t,
|
||||
data: [14]u8,
|
||||
|
||||
pub const SS_MAXSIZE = 128;
|
||||
pub const storage = std.x.os.Socket.Address.Native.Storage;
|
||||
pub const in = extern struct {
|
||||
len: u8 = @sizeOf(in),
|
||||
|
@ -465,6 +465,7 @@ pub const sockaddr = extern struct {
|
||||
family: u8,
|
||||
data: [14]u8,
|
||||
|
||||
pub const SS_MAXSIZE = 128;
|
||||
pub const storage = std.x.os.Socket.Address.Native.Storage;
|
||||
|
||||
pub const in = extern struct {
|
||||
|
@ -323,6 +323,7 @@ pub const sockaddr = extern struct {
|
||||
/// actually longer; address value
|
||||
data: [14]u8,
|
||||
|
||||
pub const SS_MAXSIZE = 128;
|
||||
pub const storage = std.x.os.Socket.Address.Native.Storage;
|
||||
|
||||
pub const in = extern struct {
|
||||
|
@ -339,6 +339,7 @@ pub const sockaddr = extern struct {
|
||||
/// actually longer; address value
|
||||
data: [14]u8,
|
||||
|
||||
pub const SS_MAXSIZE = 128;
|
||||
pub const storage = std.x.os.Socket.Address.Native.Storage;
|
||||
|
||||
pub const in = extern struct {
|
||||
|
@ -476,6 +476,7 @@ pub const sockaddr = extern struct {
|
||||
/// actually longer; address value
|
||||
data: [14]u8,
|
||||
|
||||
pub const SS_MAXSIZE = 128;
|
||||
pub const storage = std.x.os.Socket.Address.Native.Storage;
|
||||
|
||||
pub const in = extern struct {
|
||||
|
@ -279,6 +279,7 @@ pub const sockaddr = extern struct {
|
||||
/// actually longer; address value
|
||||
data: [14]u8,
|
||||
|
||||
pub const SS_MAXSIZE = 256;
|
||||
pub const storage = std.x.os.Socket.Address.Native.Storage;
|
||||
|
||||
pub const in = extern struct {
|
||||
|
@ -2923,6 +2923,7 @@ pub const sockaddr = extern struct {
|
||||
family: sa_family_t,
|
||||
data: [14]u8,
|
||||
|
||||
pub const SS_MAXSIZE = 128;
|
||||
pub const storage = std.x.os.Socket.Address.Native.Storage;
|
||||
|
||||
/// IPv4 socket address
|
||||
|
@ -1105,6 +1105,7 @@ pub const sockaddr = extern struct {
|
||||
family: ADDRESS_FAMILY,
|
||||
data: [14]u8,
|
||||
|
||||
pub const SS_MAXSIZE = 128;
|
||||
pub const storage = std.x.os.Socket.Address.Native.Storage;
|
||||
|
||||
/// IPv4 socket address
|
||||
|
@ -37,7 +37,7 @@ pub const Socket = struct {
|
||||
|
||||
/// POSIX `sockaddr.storage`. The expected size and alignment is specified in IETF RFC 2553.
|
||||
pub const Storage = extern struct {
|
||||
pub const expected_size = 128;
|
||||
pub const expected_size = os.sockaddr.SS_MAXSIZE;
|
||||
pub const expected_alignment = 8;
|
||||
|
||||
pub const padding_size = expected_size -
|
||||
|
Loading…
Reference in New Issue
Block a user