Skip to content

Commit e2a2efb

Browse files
committed
add libc wrapper
Signed-off-by: leongross <[email protected]>
1 parent c728e03 commit e2a2efb

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

GNUmakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ endif
926926
@cp -rp lib/musl/src/env build/release/tinygo/lib/musl/src
927927
@cp -rp lib/musl/src/errno build/release/tinygo/lib/musl/src
928928
@cp -rp lib/musl/src/exit build/release/tinygo/lib/musl/src
929+
@cp -rp lib/musl/src/fcntl build/release/tinygo/lib/musl/src
929930
@cp -rp lib/musl/src/include build/release/tinygo/lib/musl/src
930931
@cp -rp lib/musl/src/internal build/release/tinygo/lib/musl/src
931932
@cp -rp lib/musl/src/legacy build/release/tinygo/lib/musl/src

builder/musl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ var libMusl = Library{
116116
"env/*.c",
117117
"errno/*.c",
118118
"exit/*.c",
119+
"fcntl/*.c",
119120
"internal/defsysinfo.c",
120121
"internal/libc.c",
121122
"internal/syscall_ret.c",

src/runtime/os_linux.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,12 @@ func hardwareRand() (n uint64, ok bool) {
139139
//
140140
//export getrandom
141141
func libc_getrandom(buf unsafe.Pointer, buflen uintptr, flags uint32) uint32
142+
143+
// int fcntl(int fd, int cmd, int arg);
144+
//
145+
// export fcntl
146+
func libc_fcntl(fd int, cmd int, arg int) (ret int)
147+
148+
func fcntl(fd int, cmd int, arg int) int {
149+
return libc_fcntl(fd, cmd, arg)
150+
}

0 commit comments

Comments
 (0)