Skip to content

Commit eeb22c0

Browse files
committed
get/setsockopt: remove fallback
Reverts musl commit 51fd67fcbfa598e2fe1885b517451b84c0bfe3b7.
1 parent a31ee4a commit eeb22c0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

system/lib/libc/musl/src/network/getsockopt.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#include <sys/socket.h>
2+
#ifndef __EMSCRIPTEN__ // XXX Emscripten revert musl commit 51fd67fcbfa598e2fe1885b517451b84c0bfe3b7
23
#include <sys/time.h>
34
#include <errno.h>
5+
#endif
46
#include "syscall.h"
57

68
int getsockopt(int fd, int level, int optname, void *restrict optval, socklen_t *restrict optlen)
79
{
10+
#ifdef __EMSCRIPTEN__ // XXX Emscripten revert musl commit 51fd67fcbfa598e2fe1885b517451b84c0bfe3b7
11+
return socketcall(getsockopt, fd, level, optname, optval, optlen, 0);
12+
#else
813
long tv32[2];
914
struct timeval *tv;
1015

@@ -38,4 +43,5 @@ int getsockopt(int fd, int level, int optname, void *restrict optval, socklen_t
3843
}
3944
}
4045
return __syscall_ret(r);
46+
#endif
4147
}

system/lib/libc/musl/src/network/setsockopt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
#include <sys/socket.h>
2+
#ifndef __EMSCRIPTEN__ // XXX Emscripten revert musl commit 51fd67fcbfa598e2fe1885b517451b84c0bfe3b7
23
#include <sys/time.h>
34
#include <errno.h>
5+
#endif
46
#include "syscall.h"
57

8+
#ifndef __EMSCRIPTEN__ // XXX Emscripten revert musl commit 51fd67fcbfa598e2fe1885b517451b84c0bfe3b7
69
#define IS32BIT(x) !((x)+0x80000000ULL>>32)
710
#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))
11+
#endif
812

913
int setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen)
1014
{
15+
#ifdef __EMSCRIPTEN__ // XXX Emscripten revert musl commit 51fd67fcbfa598e2fe1885b517451b84c0bfe3b7
16+
return socketcall(setsockopt, fd, level, optname, optval, optlen, 0);
17+
#else
1118
const struct timeval *tv;
1219
time_t s;
1320
suseconds_t us;
@@ -43,4 +50,5 @@ int setsockopt(int fd, int level, int optname, const void *optval, socklen_t opt
4350
}
4451
}
4552
return __syscall_ret(r);
53+
#endif
4654
}

0 commit comments

Comments
 (0)