-
Notifications
You must be signed in to change notification settings - Fork 18k
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
syscall: use prlimit64, not prlimit #2492
Labels
Comments
The Rlimit struct is provided by src/pkg/syscall/ztypes_$GOOS_$GOARCH.go that is generated with cgo -godefs types_linux.go It's possible that this was done on a 64-bit Linux machine or a machine with the different headers to yours. I'm not sure how that would have happened. Can you try regenerating ztypes_linux_386.go on your machine and tell us what the diff is? Owner changed to @adg. Status changed to WaitingForReply. |
there is a rlimit and rlimit64, struct rlimit { rlim_t rlim_cur; rlim_t rlim_max; }; struct rlimit64 { rlim64_t rlim_cur; rlim64_t rlim_max; }; with accompanying syscalls, extern int getrlimit (__rlimit_resource_t __resource, struct rlimit *__rlimits) __asm__ ("" "getrlimit64") __attribute__ ((__nothrow__)) extern int getrlimit64 (__rlimit_resource_t __resource, struct rlimit64 *__rlimits) __attribute__ ((__nothrow__)); could it be that cgo matches the 64 bit type to the 32bit call? |
and here is the header of types_linux.go expanded with gcc -E Attachments:
|
I did some more digging. The problem is that the Go types_linux.go defines: #define _FILE_OFFSET_BITS 64 this causes the source to be compiled with 64 bits rlim_t; the getrlimit() call is then aliased to prlimit() (strace identifies it as prlimit64). The correct solution is to implement Go's Getrlimit on Linux in terms of SYS_PRLIMIT64 How does one do that in the source code of the syscall package? |
If it is just a matter of calling a different syscall (no parameters change), then change //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) to //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_PRLIMIT64 and run mkall.sh -syscalls. If you need to do some kind of conversion of the arguments, delete that line, add //sysnb prlimit64(whatever) (err error) run mkall.sh -syscalls, and then edit syscall_linux.go to define func Getrlimit in terms of prlimit64. Russ |
This issue was closed by revision 8b7d39e. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: