Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit c7321df

Browse files
ibaradlang-bot
authored andcommitted
Fix Issue 22669 - OpenBSD: Sync socket.d
1 parent a499111 commit c7321df

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

src/core/sys/posix/sys/socket.d

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,9 +1136,9 @@ else version (OpenBSD)
11361136
{
11371137
ubyte ss_len;
11381138
sa_family_t ss_family;
1139-
byte[6] __ss_pad1;
1139+
ubyte[6] __ss_pad1;
11401140
long __ss_align;
1141-
byte[240] __ss_pad2;
1141+
ubyte[240] __ss_pad2;
11421142
}
11431143

11441144
struct msghdr
@@ -1161,20 +1161,25 @@ else version (OpenBSD)
11611161

11621162
enum : uint
11631163
{
1164-
SCM_RIGHTS = 0x01
1164+
SCM_RIGHTS = 0x01,
1165+
SCM_TIMESTAMP = 0x04
11651166
}
11661167

11671168
private // <sys/_types.h>
11681169
{
1169-
extern (D) size_t _ALIGN(size_t p) { return (p + _ALIGNBYTES) & ~_ALIGNBYTES; }
1170+
enum _ALIGNBYTES = c_long.sizeof - 1;
1171+
extern (D) size_t _ALIGN(size_t p) pure nothrow @nogc
1172+
{
1173+
return (p + _ALIGNBYTES) & ~_ALIGNBYTES;
1174+
}
11701175
}
11711176

1172-
extern (D) ubyte* CMSG_DATA(cmsghdr* cmsg)
1177+
extern (D) ubyte* CMSG_DATA(cmsghdr* cmsg) pure nothrow @nogc
11731178
{
11741179
return cast(ubyte*) cmsg + _ALIGN(cmsghdr.sizeof);
11751180
}
11761181

1177-
extern (D) cmsghdr* CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg)
1182+
extern (D) cmsghdr* CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg) pure nothrow @nogc
11781183
{
11791184
if (cast(ubyte*) cmsg + _ALIGN(cmsg.cmsg_len) + _ALIGN(cmsghdr.sizeof) >
11801185
cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen)
@@ -1183,11 +1188,24 @@ else version (OpenBSD)
11831188
return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN(cmsg.cmsg_len));
11841189
}
11851190

1186-
extern (D) cmsghdr* CMSG_FIRSTHDR(msghdr* mhdr)
1191+
extern (D) cmsghdr* CMSG_FIRSTHDR(msghdr* mhdr) pure nothrow @nogc
11871192
{
11881193
return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null;
11891194
}
11901195

1196+
extern (D)
1197+
{
1198+
size_t CMSG_LEN(size_t len) pure nothrow @nogc
1199+
{
1200+
return _ALIGN(cmsghdr.sizeof) + len;
1201+
}
1202+
}
1203+
1204+
extern (D) size_t CMSG_SPACE(size_t len) pure nothrow @nogc
1205+
{
1206+
return _ALIGN(cmsghdr.sizeof) + _ALIGN(len);
1207+
}
1208+
11911209
struct linger
11921210
{
11931211
int l_onoff;

0 commit comments

Comments
 (0)