1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.channel.uring;
17
18 import io.netty.util.internal.PlatformDependent;
19
20
21
22
23
24
25
26
27
28
29
30 final class CmsgHdr {
31
32 private CmsgHdr() { }
33
34 static void write(long cmsghdrAddress, long cmsgHdrDataAddress,
35 int cmsgLen, int cmsgLevel, int cmsgType, short segmentSize) {
36 if (Native.SIZEOF_SIZE_T == 4) {
37 PlatformDependent.putInt(cmsghdrAddress + Native.CMSG_OFFSETOF_CMSG_LEN, cmsgLen);
38 } else {
39 assert Native.SIZEOF_SIZE_T == 8;
40 PlatformDependent.putLong(cmsghdrAddress + Native.CMSG_OFFSETOF_CMSG_LEN, cmsgLen);
41 }
42 PlatformDependent.putInt(cmsghdrAddress + Native.CMSG_OFFSETOF_CMSG_LEVEL, cmsgLevel);
43 PlatformDependent.putInt(cmsghdrAddress + Native.CMSG_OFFSETOF_CMSG_TYPE, cmsgType);
44 PlatformDependent.putShort(cmsgHdrDataAddress, segmentSize);
45 }
46 }