- types_linux.go: Use the kernel-defined termios structure, *not* the
LIBC-defined one. The LIBC termios structure cannot be safely used
to do tty-related ioctls on all architectures (e.g. ppc64,
ppc64le). The kernel termios structure, and the associated
macros/constants, are defined in: "asm/termbits.h" which is included
by "linux/termios.h". The LIBC termios structure is defined in
"bits/termios.h" which is included by "termios.h". These structures
are *not* the same.
For systems that have both "struct termios" and "struct termios2"
use the latter to define the Termios type. This is ok, since the
"struct termios2" memory layout is compatible with "struct termios"
(with a couple of fields added at the end). This way, type Termios
can be used with both: the "old-style" TCSETS[FW], TCGETS ioctls,
*and* with the new TCSETS[FW]2, TCGETS2 ioctls. The new ioctls allow
configuring arbitrary baudrates.
The new Termios definitions (kernel-compatible) have the same fields
as the old ones (LIBC-derived) so there should be no user-code
compatibility issues.
Change-Id: I3c1484c60f45b28e13404765c01616c33063afd5
Reviewed-on: https://go-review.googlesource.com/17185
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- mkerrors.sh: Included several termios-related constants that were
missing. Also included definitions of tty-related ioctl numbers for
linux.
- zerrors_linux_*: the files have been generated using
"./mkerrors.sh". After their automatic generation the files have
been manually edited to remove changes that were not due to this
patch.
Change-Id: I0463112542a5c1c41583007003b652375f9ce572
Reviewed-on: https://go-review.googlesource.com/17184
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Add support for optional sysctl arguments which is required to support
sysctls that require more than the mib identifer args as returned from
nametomib such as kern.proc.pid.
Add SysctlUint64 which allows sysctls that return 64 bit ints to be
queried.
Add SysctlRaw which allows sysctls that return structs or other
unsupported types to be queried.
Change-Id: If0fa23935ee09496f2df210364d8988ccd0f3db6
Reviewed-on: https://go-review.googlesource.com/14955
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Update the generated types and errors for FreeBSD by running mkall.sh
and ensuring no values where removed.
Change-Id: I5b82b1896b64f1b33d569dcaa477bb88641dfa8d
Reviewed-on: https://go-review.googlesource.com/15011
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Clang is much more common now so use the OS cc instead of forcing gcc
by default.
Change-Id: I1dd34c7ba56c91794ee57042dd8ac024fdd649d8
Reviewed-on: https://go-review.googlesource.com/15010
Reviewed-by: Rob Pike <r@golang.org>
The existing code has no way to manipulate termios or winsize structures
on solaris. This change adds IoctlGetXXX and IoctlSetXXX functions for
int, termios, termio, and winsize. The embedded awk script in
mkerrors.sh has additional patterns to generate the needed ioctl
constants for these calls.
Fixesgolang/go#12574
Change-Id: Ic62a8c698d42c8ca379c90f71e9f27635e7d03b5
Reviewed-on: https://go-review.googlesource.com/14587
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Various syscalls offered by x/sys/unix on Linux are not available on
Solaris and should be, such as Mkfifo, Getwd(), Futimes() and others.
In particular, all of the *at() variants of existing functions were
added where appropriate.
Getgroups() was fixed to use the correct value for its sanity check on
the maximum number of groups.
Utimesnano() was updated to use the native Solaris utimensat function
for setting nanosecond-precision time.
Utimes() was updated to have the same error semantics and checking as
other platforms.
Getgroups(), anysocktoaddr(), and Recvmsg() were fixed to check the
return value before assuming syscall failure instead of relying solely
on errno being set.
mksyscall_solaris.pl needed some updates to better match the output of
the one found in syscall.
mkerrors.sh needed some updates to work out of the box on Solaris,
matching those recently done to the one in syscall.
The signatures (names) of some function parameters were changed to be
consistent with other platforms for the sake of documentation.
Fixes#8609
Change-Id: I9e4e2fee6d3ecfad9f4d845a5702ffde5166e804
Reviewed-on: https://go-review.googlesource.com/14643
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
In preparation for issues such as #10180, Getpagesize() needs to be
fixed to return the actual system's page size instead of assuming it's
always 4096.
This is particularly important for future platform support on Solaris.
Fixes#12076
Change-Id: I78205165909529215fe93ed6ba56e9c3ee1c2abb
Reviewed-on: https://go-review.googlesource.com/14483
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
These are already exposed on Linux. I believe they were left out of
darwin because fchmodat didn't exist on older versions of XNU.
Change-Id: I166f2b23270937c1b6cc3bd73e7f7b72d2d488e9
Reviewed-on: https://go-review.googlesource.com/14092
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This makes the script resistant to changes in the SDK location, which
apparently happens from time to time.
While I was at it, made another cosmetic touch-up: use a .gitignore file
to stop `git status` from showing the _obj/ directory generated by
mkall.sh.
Change-Id: Ia706114d94e324ab443f6f5d6aa7c0c9f8a84620
Reviewed-on: https://go-review.googlesource.com/14192
Reviewed-by: Ian Lance Taylor <iant@golang.org>
I did this on OS X 10.10.5 (14F27) using the OS X 10.10 SDK included in
Xcode 6.4 (6E35b) for syscall numbers. I believe this SDK is intended
for 64-bit Macs, but the syscall numbers aren't likely to vary. See also
the discussion in this thread:
https://groups.google.com/d/topic/golang-dev/738LXeykFsM/discussion
This commit contains the same SYS_SYSCTL -> SYS___SYSCTL workaround
found in commit 9ef4b6c; see its description for more info.
Change-Id: I952ae56032033b49f8910281c68dcc72abb2d106
Reviewed-on: https://go-review.googlesource.com/14151
Reviewed-by: Ian Lance Taylor <iant@golang.org>
I did this on OS X 10.10.5 (14F27) using the iOS SDK included in Xcode
6.4 (6E35b). This commit contains the same SYS_SYSCTL -> SYS___SYSCTL
workaround found in commit 9ef4b6c; see its description for more info.
Change-Id: I4dddc2a6d030ce297ee711f4430ec9db3abcda50
Reviewed-on: https://go-review.googlesource.com/14094
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
I did this on OS X 10.10.5 (14F27) using the 10.10 SDK included in Xcode
6.4 (6E35b). This required removing a C include from mkerrors.sh, since
it doesn't exist on either of my two systems.
I spot checked the syscall number changes against this definitive list,
which is for approximately my kernel version:
http://www.opensource.apple.com/source/xnu/xnu-2782.20.48/bsd/kern/syscalls.master
Everything I examined checked out, including the removed syscalls being
marked as "old" or being described in comments as no longer existing.
There is one exception to the output being cleanly autogenerated: I have
manually renamed SYS_SYSCTL back to SYS___SYSCTL, the name used
previously and still used by syscall_bsd.go. Because it would distract
from this CL, I will fix this in an upcoming CL.
Change-Id: I0168f608cab714aa5981b3e7d08d8fd84888d0d5
Reviewed-on: https://go-review.googlesource.com/14006
Reviewed-by: Ian Lance Taylor <iant@golang.org>
CL 9184 changed the runtime and syscall packages to link Solaris binaries
directly instead of using dlopen/dlsym but failed to update sys/unix to
reflect these changes. This changes the Solaris port to use direct linking
as supported by Go 1.5.
Fixesgolang/go#10086
Change-Id: I6747ed939775b18fd967f81853c7d84537aa3842
Reviewed-on: https://go-review.googlesource.com/13400
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Updates #11918
Replace calls to lchown(2) with fchownat(2) for linux/arm64 as the former
is not suppored.
This is a companion to CL 12833 which is ready to be applied to the main
repo, and verified by CL 12834 which can be applied once this change and
CL 12833 have landed.
Change-Id: I63de3d0da1e4b4e1f253e51e0ed8e0cd0e56d63a
Reviewed-on: https://go-review.googlesource.com/12837
Reviewed-by: Rob Pike <r@golang.org>
It seems some Windows versions requires you to be
an Administrator to manage services. Just google for
"openscmanager access denied windows 2008" or similar.
Fixesgolang/go#11156.
Change-Id: I4b09d244a61179ece7a1319234e5c3199423cbe9
Reviewed-on: https://go-review.googlesource.com/10933
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Go1.4 does not recognize arm64 and ppc64le as valid GOARCH values, so
we need explicit build tags.
Change-Id: I1a886c132ae398d9f92b2c2b33d2a4827bbdb9d4
Reviewed-on: https://go-review.googlesource.com/10083
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This copies http://golang.org/cl/8723 from the syscall package.
Quoting the original CL:
This is clumsy, but currently cover tool fails as:
$ go test -run=none -cover syscall
syscall_linux_amd64.go:15: can only use //go:noescape with external func imp
FAIL syscall [build failed]
This happens because cover tool mishandles //go: comments.
r and gri said that fixing cover is infeasible due to go/ast limitations.
So at least fix the offending code so that coverage works.
This come up in context of coverage-guided fuzzing which works best
with program-wide coverage.
Change-Id: Id9e243968a4eb7ae75a585877fdf3192c89e419c
Reviewed-on: https://go-review.googlesource.com/10035
Reviewed-by: Rob Pike <r@golang.org>
This brings over three CLs from the main syscall package:
http://golang.org/cl/5833http://golang.org/cl/5835http://golang.org/cl/5837
Pipe, Pipe2, and Dup2 are moved from syscall_linux.go to the GOARCH
specific variants. On 386 and amd64, Linux kernel version 2.6.23 (the
documented minimum Linux kernel version the Go distribution supports)
does not support the pipe2 system call, so Pipe continues to call
pipe. On ARM, Pipe now calls pipe2.
Several system calls are reimplemented in terms of the *at syscalls,
passing AT_FDCWD to indicate that pathnames are to be interpreted
relative to the current directory. The *at syscalls were added in
Linux kernel version 2.6.16.
This is in preparation for arm64 support, as the arm64 Linux kernel
does not provide the traditional syscall variants.
Change-Id: Id6bc6097dc5f4324cd9e429c5e1f3a411a08ce42
Reviewed-on: https://go-review.googlesource.com/10032
Reviewed-by: Rob Pike <r@golang.org>