enum {
+ EINTR = 0x4,
+ EFAULT = 0xe,
+
PROT_NONE = 0x0,
PROT_READ = 0x1,
PROT_WRITE = 0x2,
UMTX_OP_WAIT_UINT = 0xb,
UMTX_OP_WAKE = 0x3,
- EINTR = 0x4,
-
SIGHUP = 0x1,
SIGINT = 0x2,
SIGQUIT = 0x3,
ITIMER_REAL = 0x0,
ITIMER_VIRTUAL = 0x1,
ITIMER_PROF = 0x2,
+
+ EV_ADD = 0x1,
+ EV_DELETE = 0x2,
+ EV_CLEAR = 0x20,
+ EV_RECEIPT = 0x40,
+ EV_ERROR = 0x4000,
+ EVFILT_READ = -0x1,
+ EVFILT_WRITE = -0x2,
};
typedef struct Rtprio Rtprio;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
+typedef struct Kevent Kevent;
#pragma pack on
Timeval it_value;
};
+struct Kevent {
+ uint32 ident;
+ int16 filter;
+ uint16 flags;
+ uint32 fflags;
+ int32 data;
+ byte *udata;
+};
+
#pragma pack off
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build darwin freebsd,amd64 freebsd,386 linux netbsd openbsd windows
+// +build darwin freebsd linux netbsd openbsd windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build darwin freebsd,amd64 freebsd,386 netbsd openbsd
+// +build darwin freebsd netbsd openbsd
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
MOVW.CS R8, (R8)
RET
+// int32 runtime·kqueue(void)
+TEXT runtime·kqueue(SB),NOSPLIT,$0
+ SWI $362 // sys_kqueue
+ RSB.CS $0, R0
+ RET
+
+// int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout)
+TEXT runtime·kevent(SB),NOSPLIT,$8
+ MOVW 0(FP), R0 // kq
+ MOVW 4(FP), R1 // changelist
+ MOVW 8(FP), R2 // nchanges
+ MOVW 12(FP), R3 // eventlist
+ MOVW 16(FP), R4 // nevents
+ MOVW R4, 4(R13)
+ MOVW 20(FP), R4 // timeout
+ MOVW R4, 8(R13)
+ ADD $4, R13 // pass arg 5 and 6 on stack
+ SWI $363 // sys_kevent
+ RSB.CS $0, R0
+ SUB $4, R13
+ RET
+
+// void runtime·closeonexec(int32 fd)
+TEXT runtime·closeonexec(SB),NOSPLIT,$0
+ MOVW 0(FP), R0 // fd
+ MOVW $2, R1 // F_SETFD
+ MOVW $1, R2 // FD_CLOEXEC
+ SWI $92 // sys_fcntl
+ RET
+
TEXT runtime·casp(SB),NOSPLIT,$0
B runtime·cas(SB)