-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Replace uses of syscall.EPOLLET with unix.EPOLLET #85
Comments
syscall.EPOLLET is used at 3 places. However, there is a comment which acknowledges this issue here which makes me question whether the unix pkg was not used on purpose.Can anybody confirm before I send a PR? I am able to compile if I change it to use unix. |
That comment was written before we used the unix package anywhere in gVisor, which is why it isn't used there. Switching to the unix package is fine. That said, there is an opportunity for a bit more cleanup here. TL;DR for below, use the We use syscall constants like
These are cases where the sentry is making system calls to the host Linux kernel to perform some operation. That is the case here. The sentry is making If there were a port of gVisor to another host OS, e.g., FreeBSD, we want to use the appropriate syscall constants for FreeBSD1. The
These are cases where the sandboxed app is making a syscall that the sentry is handling. That is the case here. If we port gVisor to another host OS, we're still running Linux applications inside the sandbox, so using the For these cases, we use the The final use of The existence of a gVisor port to a non-Linux host OS is theoretical at this point, so we have not gone through and replaced all instances of case 2 with the 1 Note that epoll isn't a great example here because it is Linux-specific. A better example would be open flags like |
We no longer use syscall.EPOLLET, but use linux and unix packages as appropriate. |
syscall.EPOLLET
has incorrectly been generated as a negative number on 386/amd64/arm. Due to the Go 1 guarantee it is frozen and cannot be fixed (golang/go#5328). This leads to workarounds where EPOLLET is negated before it is used. Unfortunately on other platforms it has the correct, positive, value making the negation incorrect.Can
unix.EPOLLET
be used instead (https://godoc.org/golang.org/x/sys/unix#pkg-constants)? It is correct on all platforms.(@ydjainopensource ran into this while investigating #79)
The text was updated successfully, but these errors were encountered: