Skip to content

Commit 61b5229

Browse files
committed
splice undeclared patch (need test)
1 parent cfbc218 commit 61b5229

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ipt2socks.c

+14
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@
2828

2929
#define IPT2SOCKS_VERSION "ipt2socks v1.1.2 <https://github.com/zfl9/ipt2socks>"
3030

31+
#ifndef SPLICE_F_MOVE
32+
#include <sys/syscall.h>
33+
34+
#undef SPLICE_F_MOVE
35+
#define SPLICE_F_MOVE 1
36+
37+
#undef SPLICE_F_NONBLOCK
38+
#define SPLICE_F_NONBLOCK 2
39+
40+
ssize_t splice(int fdin, __off64_t *offin, int fdout, __off64_t *offout, size_t len, unsigned int flags) {
41+
return syscall(__NR_splice, fdin, offin, fdout, offout, len, flags);
42+
}
43+
#endif
44+
3145
enum {
3246
OPT_ENABLE_TCP = 0x01 << 0, // enable tcp proxy
3347
OPT_ENABLE_UDP = 0x01 << 1, // enable udp proxy

0 commit comments

Comments
 (0)