Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435#include "bind.h"#include "../base.h"#include "../errno.h"#include <linux-syscalls/linux.h>#include "../../../../../platform-include/sys/errno.h"#include "duct.h"
extern void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n);
long sys_bind(int fd, const void* name, int socklen){ int ret; struct sockaddr_fixup* fixed;
if (socklen > 512) return -EINVAL;
fixed = __builtin_alloca(socklen); memcpy(fixed, name, socklen);
fixed->linux_family = sfamily_bsd_to_linux(fixed->bsd_family);
#ifdef __NR_socketcall ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_BIND, ((long[6]) { fd, fixed, socklen }));#else ret = LINUX_SYSCALL(__NR_bind, fd, fixed, socklen);#endif
if (ret < 0) ret = errno_linux_to_bsd(ret);
return ret;}