summaryrefslogtreecommitdiff
path: root/src/syscall/zsyscall_freebsd_386.go
Commit message (Collapse)AuthorAgeFilesLines
* syscall: restore original NOFILE rlimit in child processIan Lance Taylor2023-03-151-1/+1
| | | | | | | | | | | | | If we increased the NOFILE rlimit when starting the program, restore the original rlimit when forking a child process. For #46279 Change-Id: Ia5d2af9ef435e5932965c15eec2e428d2130d230 Reviewed-on: https://go-review.googlesource.com/c/go/+/476097 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Ian Lance Taylor <iant@google.com>
* syscall: remove FreeBSD 11 and below 64bit inode compatibility shimsYuval Pavel Zholkover2022-09-161-119/+7
| | | | | | | | | | | | | Update #53280 Change-Id: Iaa7c0cf5dbefaa8e14c2de499f99755911c17672 Reviewed-on: https://go-review.googlesource.com/c/go/+/411596 Reviewed-by: Meng Zhuo <mzh@golangcn.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Yuval Pavel Zholkover <paulzhol@gmail.com> Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
* syscall: add race annotations to Pread and PwriteIan Lance Taylor2022-03-121-2/+2
| | | | | | | | | | | Fixes #51618 Change-Id: Ife894d8c313dce8c4929f40fa0ac90a069f77a89 Reviewed-on: https://go-review.googlesource.com/c/go/+/391954 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
* all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox2021-10-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* all: go fmt std cmd (but revert vendor)Russ Cox2021-02-201-0/+1
| | | | | | | | | | | | | | | | Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: fix Getdirentries on 32-bit freebsd 12Keith Randall2019-06-101-1/+1
| | | | | | | | | | | | | | | | 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. Fixes #32498 Change-Id: Ie22c0d301c6091bd20e813432928b24ab95cc314 Reviewed-on: https://go-review.googlesource.com/c/go/+/181377 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* os: add support for long path names on freebsd RemoveAllTobias Klauser2018-11-011-0/+15
| | | | | | | | | | | | | | | | | | | Follow CL 146020 and enable RemoveAll based on Unlinkat and Openat on freebsd. Since the layout of syscall.Stat_t changes in FreeBSD 12, Fstatat needs a compatibility wrapper akin to Fstatat in x/sys/unix. See CL 138595 and CL 136816 for details. Updates #27029 Change-Id: I8851a5b7fa658eaa6e69a1693150b16d9a68f36a Reviewed-on: https://go-review.googlesource.com/c/146597 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: FreeBSD 12 ino64 supportYuval Pavel Zholkover2018-10-051-7/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is similar to CL 136816 for x/sys/unix, changing the FreeBSD ABI to use 64-bit inodes in Stat_t, Statfs_t, and Dirent types. The changes are forward compatible, that is FreeBSD 10.x, 11.x continue to use their current sysnum numbers. The affected types are converted to the new layout (with some overhead). Thus the same statically linked binary should work using the native sysnums (without any conversion) on FreeBSD 12. Breaking API changes in package syscall are: Mknod takes a uint64 (C dev_t) instead of int. Stat_t: Dev, Ino, Nlink, Rdev, Gen became uint64. Atimespec, Mtimespec, Ctimespec, Birthtimespec renamed to Atim, Mtim, Ctim, Birthtim respectively. Statfs_t: Mntonname and Mntfromname changed from [88]int8 to [1024]int8 arrays. Dirent: Fileno became uint64, Namlen uint16 and an additional field Off int64 (currently unused) was added. The following commands were run to generate ztypes_* and zsyscall_* on FreeBSD-12.0-ALPHA6 systems (GOARCH=386 were run on the same amd64 host): GOOS=freebsd GOARCH=amd64 ./mksyscall.pl -tags freebsd,amd64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go |gofmt >zsyscall_freebsd_amd64.go GOOS=freebsd GOARCH=amd64 go tool cgo -godefs types_freebsd.go | GOOS=freebsd GOARCH=amd64 go run mkpost.go >ztypes_freebsd_amd64.go GOOS=freebsd GOARCH=386 ./mksyscall.pl -l32 -tags freebsd,386 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go |gofmt >zsyscall_freebsd_386.go GOOS=freebsd GOARCH=386 go tool cgo -godefs types_freebsd.go | GOOS=freebsd GOARCH=386 go run mkpost.go >ztypes_freebsd_386.go GOOS=freebsd GOARCH=arm ./mksyscall.pl -l32 -arm -tags freebsd,arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go |gofmt >zsyscall_freebsd_arm.go GOOS=freebsd GOARCH=arm go tool cgo -godefs -- -fsigned-char types_freebsd.go | GOOS=freebsd GOARCH=arm go run mkpost.go >ztypes_freebsd_arm.go The Kevent struct was changed to use the FREEBSD_COMPAT11 version always (requiring the COMPAT_FREEBSD11 kernel option FreeBSD-12, this is the default). The definitions of ifData were not updated, their functionality in has have been replaced by vendored golang.org/x/net/route. freebsdVersion initialization was dropped from init() in favor of a sync.Once based wrapper - supportsABI(). Updates #22448. Change-Id: I359b756e2849c036d7ed7f75dbd6ec836e0b90b4 Reviewed-on: https://go-review.googlesource.com/c/138595 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall, internal/syscall: follow convention for generated code commentTobias Klauser2018-06-141-1/+1
| | | | | | | | | | | | Follow the convertion (https://golang.org/s/generatedcode) for generated code. Change-Id: I4ac8b99ac45f25dd2399d048ea831489e5394984 Reviewed-on: https://go-review.googlesource.com/118821 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: support Getwd on all BSDsTobias Klauser2018-02-131-0/+17
| | | | | | | | | | | | | | | | | | | | | All supported BSDs provide the SYS___GETCWD syscall which can be used to implement syscall.Getwd. With this change os.Getwd can use a single syscall instead of falling back to the current kludge solution on the BSDs. This doesn't add any new exported functions to the frozen syscall package, only ImplementsGetwd changes to true for dragonfly, freebsd, netbsd and openbsd. As suggested by Ian, this follows CL 83755 which did the same for golang.org/x/sys/unix. Also, an entry for netbsd/arm is added to mkall.sh which was used to generate the syscall wrappers there. Change-Id: I84da1ec61a6b8625443699a63cde556b6442ad41 Reviewed-on: https://go-review.googlesource.com/84484 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: drop support for FreeBSD 9 or belowMikio Hara2017-11-281-12/+0
| | | | | | | | | | | | | | | This change drops the support for FreeBSD 9 or below and simplifies platform-dependent code for the sake of maintenance. Updates #7187. Fixes #11412. Updates #16064. Updates #18854. Fixes #19072. Change-Id: I9129130aafbfc7d0d7e9b674b6fc6cb31b7381be Reviewed-on: https://go-review.googlesource.com/64910 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: make Exit call runtime.exitAlex Brainman2017-09-271-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | syscall.Exit and runtime.exit do the same thing. Why duplicate code? CL 45115 fixed bug where windows runtime.exit was correct, but syscall.Exit was broken. So CL 45115 fixed windows syscall.Exit by calling runtime.exit. Austin suggested that all OSes should do the same, and this CL implements his idea. While making changes, I discovered that nacl syscall.Exit returned error func Exit(code int) (err error) and I changed it into func Exit(code int) like all other OSes. I assumed it was a mistake and it is OK to do because cmd/api does not complain about it. Also I changed plan9 runtime.exit to accept int32 just like all other OSes do. Change-Id: I12f6022ad81406566cf9befcc6edc382eebd413b Reviewed-on: https://go-review.googlesource.com/66170 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: David du Colombier <0intro@gmail.com>
* syscall: add missing int flag argument to utimensatYuval Pavel Zholkover2017-08-151-2/+2
| | | | | | | | | | Fixes #21437 Change-Id: I55fbf5114ae1bb7f4aa1a20450e8d5309756cd5b Reviewed-on: https://go-review.googlesource.com/55430 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: add utimensat and use it for UtimesNano on BSD and SolarisTobias Klauser2017-08-141-0/+15
| | | | | | | | | | | | | | | | | | All the BSDs and Solaris support the utimensat syscall, but Darwin doesn't. Account for that by adding the //sys lines not to syscall_bsd.go but the individual OS's syscall_*.go files and implement utimensat on Darwin as just returning ENOSYS, such that UtimesNano will fall back to use utimes as it currently does unconditionally. This also adds the previously missing utimensat syscall number for FreeBSD and Dragonfly. Fixes #16480 Change-Id: I367454c6168eb1f7150b988fa16cf02abff42f34 Reviewed-on: https://go-review.googlesource.com/55130 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
* syscall, os: fix FreeBSD 9 buildBrad Fitzpatrick2017-03-211-0/+12
| | | | | | | | | | | | | | | | | | | I broke FreeBSD 9 in https://golang.org/cl/38426 by using Pipe2. We still want to support FreeBSD 9 for one last release (Go 1.9 will be the last), and FreeBSD 9 doesn't have Pipe2. So this still uses Pipe2, but falls back to Pipe on error. Updates #18854 Updates #19072 Change-Id: I1de90fb83606c93fb84b4b86fba31e207a702835 Reviewed-on: https://go-review.googlesource.com/38430 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall, os: use pipe2 syscall on FreeBSD instead of pipeBrad Fitzpatrick2017-03-211-4/+2
| | | | | | | | | | | | | | | | | The pipe2 syscall exists in all officially supported FreeBSD versions: 10, 11 and future 12. The pipe syscall no longer exists in 11 and 12. To build and run Go on these versions, kernel needs COMPAT_FREEBSD10 option. Based on Gleb Smirnoff's https://golang.org/cl/38422 Fixes #18854 Change-Id: I8e201ee1b15dca10427c3093b966025d160aaf61 Reviewed-on: https://go-review.googlesource.com/38426 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: remove "use" function and calls from generated code.Sameer Ajmani2017-02-091-33/+2
| | | | | | | | | | | | | | | | Update syscall code generators to set build tags. Regenerate zsyscall files, which makes the following changes: - remove calls to "use" - update build tags, adding missing ones in some cases - "stat" renamed to "st" in some cases - "libc_Utimes" renamed "libc_utimes" in one case I'll mirror this change to x/sys/unix once committed. Change-Id: Ic07e0ae1433dd133eb57e8dd2a3b86a62aab4eda Reviewed-on: https://go-review.googlesource.com/36616 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: fix missing use of use function in sysctlMikio Hara2016-05-151-0/+1
| | | | | | | | | | Updates #13372. Change-Id: Id2402a781474e9d0bb0901c5844adbd899f76cbd Reviewed-on: https://go-review.googlesource.com/23123 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: add explicit build tagsShenghou Ma2015-05-151-0/+2
| | | | | | | | | | | | | | | | | Auto-generated using the following bash script: for i in z*_*_*.go; do goosgoarch=`basename ${i/${i/_*/}_/} .go` goos=${goosgoarch/_*/} goarch=${goosgoarch/*_/} echo $i $goos $goarch [ "$goos" = "windows" ] && continue sed -i -e "/^package /i\/\/ +build $goarch,$goos\n" "$i" done Change-Id: I756fee551d1698080e4591fed8f058ae0450aaa5 Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/10113 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: apply the errno allocation fix to other operating systemsBrad Fitzpatrick2015-03-271-97/+97
| | | | | | | | | | | | | | | | | | | | | | | | | The previously-submitted https://go-review.googlesource.com/#/c/6701 didn't include dragonfly, freebsd, nacl, netbsd, openbsd, or solaris. (or things like darwin/arm or ppc64 or arm64) So do them all. Note I had to copy the function into tables_nacl.go. I found that preferable to creating a new file just to have suitable build tags. It's likely this function will be mirrored to plan9 and windows later too, each of the 4 with their own policy of which error values are common. The corresponding x/sys CL for this CL is https://golang.org/cl/8190 but it excludes nacl (not in x/sys) and solaris (already broken). Update Issue #8859 Change-Id: I91902615692b29b69c905edd9e126a26337294f6 Reviewed-on: https://go-review.googlesource.com/8192 Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: change Dup,Dup2,Dup3 to use Syscall, not RawSyscallIan Lance Taylor2015-03-261-2/+2
| | | | | | | | | | | | | | | | | This avoids hanging when a Go program uses a FUSE filesystem and the dup system call has to close a file descriptor. When dup uses RawSyscall then the goroutine calling dup will occupy a scheduler slot (a p structure) during the call, and may block waiting for some other goroutine to respond to the close call on the FUSE filesystem. Changing to Syscall avoids the problem. This makes Dup a tiny bit slower but is quite unlikely to make a difference for any real programs. Fixes #10202. Change-Id: If6490a8f9b3c9cfed6acbfb4bfd1eaeac62ced17 Reviewed-on: https://go-review.googlesource.com/8095 Reviewed-by: Rob Pike <r@golang.org>
* syscall: keep allocated C string live across call to SyscallRuss Cox2014-09-081-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given: p := alloc() fn_taking_ptr(p) p is NOT recorded as live at the call to fn_taking_ptr: it's not needed by the code following the call. p was passed to fn_taking_ptr, and fn_taking_ptr must keep it alive as long as it needs it. In practice, fn_taking_ptr will keep its own arguments live for as long as the function is executing. But if instead you have: p := alloc() i := uintptr(unsafe.Pointer(p)) fn_taking_int(i) p is STILL NOT recorded as live at the call to fn_taking_int: it's not needed by the code following the call. fn_taking_int is responsible for keeping its own arguments live, but fn_taking_int is written to take an integer, so even though fn_taking_int does keep its argument live, that argument does not keep the allocated memory live, because the garbage collector does not dereference integers. The shorter form: p := alloc() fn_taking_int(uintptr(unsafe.Pointer(p))) and the even shorter form: fn_taking_int(uintptr(unsafe.Pointer(alloc()))) are both the same as the 3-line form above. syscall.Syscall is like fn_taking_int: it is written to take a list of integers, and yet those integers are sometimes pointers. If there is no other copy of those pointers being kept live, the memory they point at may be garbage collected during the call to syscall.Syscall. This is happening on Solaris: for whatever reason, the timing is such that the garbage collector manages to free the string argument to the open(2) system call before the system call has been invoked. Change the system call wrappers to insert explicit references that will keep the allocations alive in the original frame (and therefore preserve the memory) until after syscall.Syscall has returned. Should fix Solaris flakiness. This is not a problem for cgo, because cgo wrappers have correctly typed arguments. LGTM=iant, khr, aram, rlh R=iant, khr, bradfitz, aram, rlh CC=dvyukov, golang-codereviews, r https://golang.org/cl/139360044
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+1298
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.