-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: add runtime.fcntl link directives #4481
base: dev
Are you sure you want to change the base?
Conversation
Signed-off-by: leongross <leon.gross@9elements.com>
Signed-off-by: leongross <leon.gross@9elements.com>
aaf0e21
to
0dc68ce
Compare
//go:linkname syscall_fcntl runtime/runtime.fcntl | ||
func syscall_fcntl(fd, cmd, arg int32) (ret int32, errno int32) { | ||
// https://cs.opensource.google/go/go/+/master:src/runtime/os_linux.go;l=452?q=runtime.fcntl&ss=go%2Fgo | ||
r, _, err := Syscall6(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you trying to do a direct system call in syscall_libc.go? Syscall6
and the like are only supported on Windows and Linux, not on many other systems.
What about calling the libc function fcntl
instead?
func fcntl(fd, cmd, arg int32) (ret int32, errno int32){ | ||
return 0, 0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bad idea. It should not just ignore the call and return without an error.
Is this intended to call syscall_fcntl
perhaps?
And then, any reason not to call the libc function instead (like with syscall_Getpagesize
for example).
@@ -212,6 +212,13 @@ func Truncate(path string, length int64) (err error) { | |||
return | |||
} | |||
|
|||
//go:linkname syscall_fcntl runtime/runtime.fcntl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant runtime.fcntl
?
//go:linkname syscall_fcntl runtime/runtime.fcntl | |
//go:linkname syscall_fcntl runtime.fcntl |
Building u-root commands with tinygo (see u-root/u-root#2979) returns linking errors for the system runtime function
runtime.fcntl
. This PR intends to fix this issue. Affected u-root cmdlets: