Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
syscall: Getdirentries needs a 64-bit base #32498
Currently the signature of
Unfortunately, on freebsd12, the system call used to implement this writes 64 bits to
On freebsd11, the manpage says:
On freebsd12, the manpage says:
So at least on freebsd, we need to change the signature to:
I think we should change it everywhere (freebsd, netbsd, openbsd, dragonfly, darwin), just for consistency.
The other option to avoid a breaking change is to have the freebsd 12 implementation allocate a
I suspect we'll encounter this more frequently in the future, it might be worth biting the bullet now.
We've run into this before, perhaps on Darwin? The following comment is in
FreeBSD 12 switched to 64-bit inodes, I missed the long => off_t change here.
OpenBSD dropped getdirentries in 5.5:
NetBSD still uses long *basep, and it is marked deprecated in the manpage:
On both OpenBSD and NetBSD, we ignore basep is altogether:
Dragonfly also has a long *basep parameter, but the BUGS section is very instructive:
…ack"" This reverts CL 180761 Reason for revert: Reinstate the stack-allocated defer CL. There was nothing wrong with the CL proper, but stack allocation of defers exposed two other issues. Issue #32477: Fix has been submitted as CL 181258. Issue #32498: Possible fix is CL 181377 (not submitted yet). Change-Id: I32b3365d5026600069291b068bbba6cb15295eb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/181378 Reviewed-by: Brad Fitzpatrick <firstname.lastname@example.org>
On freebsd 12, the system call for getdirentries writes 64 bits to *basep, even on 32-bit systems. Accomodate that by providing a uint64 to the system call and copy the base to/from that uint64. The uint64 seems to be a virtual file offset, so failing if the high bits are not zero should be fine for reasonable-sized directories. Update golang/go#32498 Change-Id: I4451894aff4e353c9f009c06ad2fdd5578dfd9f8 Reviewed-on: https://go-review.googlesource.com/c/sys/+/181500 Run-TryBot: Keith Randall <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Tobias Klauser <email@example.com>
Call Seek if basep is not nil to read the current dir offset. Return EIO error if the offset doesn't fit into a 32-bit uintptr. Make Getdents public. Update golang/go#32498 Change-Id: Idfbc48d3fc3a6cc8a979242681e8882d39998285 Reviewed-on: https://go-review.googlesource.com/c/sys/+/182319 Run-TryBot: Tobias Klauser <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Tobias Klauser <firstname.lastname@example.org>