-
Notifications
You must be signed in to change notification settings - Fork 739
Expand file tree
/
Copy pathshim.c
More file actions
81 lines (69 loc) · 2.53 KB
/
shim.c
File metadata and controls
81 lines (69 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
#ifdef __FreeBSD__
#include <CNIOFreeBSD.h>
#include <err.h>
#include <sysexits.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <sys/uio.h>
#include "dirent.h"
int CNIOFreeBSD_sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, int flags) {
return sendmmsg(sockfd, msgvec, vlen, flags);
}
int CNIOFreeBSD_recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, struct timespec *timeout) {
return recvmmsg(sockfd, msgvec, vlen, flags, timeout);
}
struct cmsghdr *CNIOFreeBSD_CMSG_FIRSTHDR(const struct msghdr *mhdr) {
assert(mhdr != NULL);
return CMSG_FIRSTHDR(mhdr);
}
struct cmsghdr *CNIOFreeBSD_CMSG_NXTHDR(const struct msghdr *mhdr, const struct cmsghdr *cmsg) {
assert(mhdr != NULL);
assert(cmsg != NULL); // Not required by Darwin but Linux needs this so we should match.
return CMSG_NXTHDR(mhdr, cmsg);
}
const void *CNIOFreeBSD_CMSG_DATA(const struct cmsghdr *cmsg) {
assert(cmsg != NULL);
return CMSG_DATA(cmsg);
}
void *CNIOFreeBSD_CMSG_DATA_MUTABLE(struct cmsghdr *cmsg) {
assert(cmsg != NULL);
return CMSG_DATA(cmsg);
}
size_t CNIOFreeBSD_CMSG_LEN(size_t payloadSizeBytes) {
return CMSG_LEN(payloadSizeBytes);
}
size_t CNIOFreeBSD_CMSG_SPACE(size_t payloadSizeBytes) {
return CMSG_SPACE(payloadSizeBytes);
}
const int CNIOFreeBSD_IPTOS_ECN_NOTECT = IPTOS_ECN_NOTECT;
const int CNIOFreeBSD_IPTOS_ECN_MASK = IPTOS_ECN_MASK;
const int CNIOFreeBSD_IPTOS_ECN_ECT0 = IPTOS_ECN_ECT0;
const int CNIOFreeBSD_IPTOS_ECN_ECT1 = IPTOS_ECN_ECT1;
const int CNIOFreeBSD_IPTOS_ECN_CE = IPTOS_ECN_CE;
const int CNIOFreeBSD_IPV6_RECVPKTINFO = IPV6_RECVPKTINFO;
const int CNIOFreeBSD_IPV6_PKTINFO = IPV6_PKTINFO;
const int CNIOFreeBSD_AT_EMPTY_PATH = AT_EMPTY_PATH;
// const unsigned long CNIOFreeBSD_IOCTL_VM_SOCKETS_GET_LOCAL_CID = IOCTL_VM_SOCKETS_GET_LOCAL_CID;
const char* CNIOFreeBSD_dirent_dname(struct dirent* ent) {
return ent->d_name;
}
#endif // __APPLE__