Skip to content

Commit b2259dc

Browse files
committed
runtime: add syscalls needed for android/386 logging
Update golang#9327. Change-Id: I27ef973190d9ae652411caf3739414b5d46ca7d2 Reviewed-on: https://go-review.googlesource.com/16679 Reviewed-by: David Crawshaw <[email protected]>
1 parent 05c4c6e commit b2259dc

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/runtime/sys_linux_386.s

+31
Original file line numberDiff line numberDiff line change
@@ -518,3 +518,34 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
518518
MOVL $1, DX // FD_CLOEXEC
519519
INVOKE_SYSINFO
520520
RET
521+
522+
// int access(const char *name, int mode)
523+
TEXT runtime·access(SB),NOSPLIT,$0
524+
MOVL $33, AX // syscall - access
525+
MOVL name+0(FP), BX
526+
MOVL mode+4(FP), CX
527+
INVOKE_SYSINFO
528+
MOVL AX, ret+8(FP)
529+
RET
530+
531+
// int connect(int fd, const struct sockaddr *addr, socklen_t addrlen)
532+
TEXT runtime·connect(SB),NOSPLIT,$0-16
533+
// connect is implemented as socketcall(NR_socket, 3, *(rest of args))
534+
// stack already should have fd, addr, addrlen.
535+
MOVL $102, AX // syscall - socketcall
536+
MOVL $3, BX // connect
537+
LEAL fd+0(FP), CX
538+
INVOKE_SYSINFO
539+
MOVL AX, ret+12(FP)
540+
RET
541+
542+
// int socket(int domain, int type, int protocol)
543+
TEXT runtime·socket(SB),NOSPLIT,$0-16
544+
// socket is implemented as socketcall(NR_socket, 1, *(rest of args))
545+
// stack already should have domain, type, protocol.
546+
MOVL $102, AX // syscall - socketcall
547+
MOVL $1, BX // socket
548+
LEAL domain+0(FP), CX
549+
INVOKE_SYSINFO
550+
MOVL AX, ret+12(FP)
551+
RET

0 commit comments

Comments
 (0)