aboutsummaryrefslogtreecommitdiff
path: root/libgo/sysinfo.c
AgeCommit message (Collapse)AuthorFilesLines
2022-07-30libgo: use SYS_timer_settime32Ian Lance Taylor1-0/+5
Musl defines SYS_timer_settime32, not SYS_timer_settime, on 32-bit systems. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/420222
2022-07-13libgo: don't include <linux/fs.h> when building gen-sysinfo.goIan Lance Taylor1-3/+0
Removing this doesn't change anything at least with glibc 2.33. The include was added in https://go.dev/cl/6100049 but it's not clear why. Fixes PR go/106266 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/417294
2022-06-17libgo: permit loff_t and off_t to be macrosIan Lance Taylor1-1/+14
They are macros in musl libc, rather than typedefs, and -fgo-dump-spec doesn't handle that case. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/412075
2020-12-20libgo: adjust sysinfo scripts for changed -fdump-go-specNikhil Benesch1-0/+1
The -fdump-go-spec flag to GCC recently changed to be more fastidious about handling incomplete types. This caused some breakage in mk[r]sysinfo.sh on Solaris. This commit adjusts for the new behavior. Specifically: * Types that refer to _in6_addr may be hidden behind a typedef and can no longer be filtered out with `grep -v in6_addr`. Instead just rewrite the definition of _in6_addr to [16]byte wherever it appears. * timestruc_t is now (correctly) emitted as an alias for timespec, so this case is handled specially. * stdio.h is included in sysinfo.c to avoid emitting an incomplete definition of the FILE type. * Dummy definitions for _u?pad128_t are now emitted automatically, which conflict with the definitions installed by mk[r]sysinfo.sh. These definitions were actually dead code, so just remove them. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/278672
2020-11-30libgo: define SO_RCVTIMEO on 32-bit GNU/LinuxIan Lance Taylor1-0/+3
Fixes golang/go#42872 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273892
2020-10-28libgo: handle linking to NetBSD's versioned symbolsNikhil Benesch1-0/+4
On NetBSD, for backwards compatibility, various libc symbols are renamed to a symbol with a version suffix. For example, this is the (abbreviated) definition of sigaction: int sigaction(...) __asm__ ("__sigaction14") This poses a challenge for libgo, which attempts to link sigaction by way of an "//extern" comment: //extern sigaction func sigaction(...) This results in a reference to the deprecated compatibility symbol "sigaction", rather than the desired "__sigaction14" symbol. This patch introduces a new "//extern-sysinfo" comment to handle this situation. The new mklinknames.awk script scans a package for these comments and outputs a "//go:linkname" directive that links the wrapper to the correct versioned symbol, as determined by parsing the __asm__ annotation on the function's declaration in gen-sysinfo.go. For now, only the following packages are scanned by mklinknames.awk: os os/user runtime syscall gotools/: * Makefile.am (check-runtime): Add runtime_linknames.go to --extrafiles. * Makefile.in: Regenerate. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/265125
2020-10-14libgo: export NetBSD-specific types in mksysinfo.shNikhil Benesch1-0/+54
The syscall package depends on many NetBSD-specific types on NetBSD. Teach mksysinfo.sh to export these types. This alone is not sufficient to get the syscall package to compile on NetBSD, but it's a start. Note that the IfMsgHdr type is recapitalized to IfMsghdr, which requires changes in the AIX port. The new capitalization is what's used by upstream in existing NetBSD-specific code and is more consistent with the capitalization of other C structs with the "hdr" suffix. Updates golang/go#38538. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261739
2020-09-22runtime, net: fix build errors on AIXClément Chigot1-0/+8
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/235158
2020-09-15libgo: additional type/const references in sysinfo.cThan McIntosh1-0/+2
Add a few more explicit references to enumeration constants (RUSAGE_SELF, DT_UNKNOWN) in sysinfo.c to insure that their hosting enums are emitted into DWARF, when using a clang host compiler during the gollvm build. Updates golang/go#41382. Updates golang/go#41404. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254941
2019-09-19libgo: support gollvm build on arm64 linuxIan Lance Taylor1-0/+4
This CL serves as part of an initial change for enabling gollvm building on arm64 linux, the rest of the change will be covered by another one to the gollvm repo. Incorporate type definition of 'uint128' to 'runtime' and 'syscall' packges, the change is not specific to arm64 linux but made available for all platforms. Verified by building and unit-testing gollvm on linux x86-64 and arm64. Verified by building and checking gccgo on linux x86-64 and arm64. Fixes golang/go#33711 Change-Id: I4720c7d810cfd4ef720962fb4104c5641b2459c0 From-SVN: r275919
2018-06-22syscall: remove UstatIan Lance Taylor1-3/+0
glibc 2.28 removes ustat.h and the ustat function entirely, which breaks syscall.Ustat. Updates golang/go#25990 Reviewed-on: https://go-review.googlesource.com/120535 From-SVN: r261896
2018-05-02libgo: add type/const references to sysinfo.cIan Lance Taylor1-0/+209
This patch adds explicit references to various types and constants defined by the header files included by sysinfo.c (used to drive the generation of gen-sysinfo.go as part of the libgo build via the GCC "-fdump-go-spec" option). The intent is to enable clients to gather the same info generated by "-fdump-go-spec" by instead reading the generated DWARF from a sysinfo.o object file compiled with "-g". Some compilers (notably clang) try to omit DWARF records for a given type unless there is an explicit use of it in the translation unit; the additional references are to insure that everything we want to see in the DWARF shows up. Reviewed-on: https://go-review.googlesource.com/99063 From-SVN: r259868
2017-07-18re PR go/81324 (libgo does not build with glibc 2.18)Ian Lance Taylor1-0/+4
PR go/81324 sysinfo.c: ignore ptrace_peeksiginfo_args from <linux/ptrace.h> With some versions of glibc and GNU/Linux ptrace_pseeksiginfo_args is defined in both <sys/ptrace.h> and <linux/ptrace.h>. We don't actually care about the struct, so use a #define to avoid a redefinition error. This fixes https://gcc.gnu.org/PR81324. Reviewed-on: https://go-review.googlesource.com/49290 From-SVN: r250324
2017-06-26libgo: redefine ia64 struct names around linux/ptrace.hIan Lance Taylor1-0/+5
Avoid https://sourceware.org/bugzilla/show_bug.cgi?id=762. Patch by Andreas Schwab. Reviewed-on: https://go-review.googlesource.com/46711 From-SVN: r249662
2017-06-21libgo, syscall: fix ptrace implementation on MIPSIan Lance Taylor1-0/+3
On MIPS, the correct structure for PtraceRegs is 'struct pt_regs' which is declared in linux/ptrace.h. Previously no PtraceRegs structure was created on MIPS because 'struct user_regs_struct' doesn't exist there. Fallback to using pt_regs when the PtraceRegs structure is generated in mksysinfo.sh, then adjust syscall_linux_mipsx.go to read the program counter from the correct field. In addition, implement PtraceGetRegs and PtraceSetRegs on all 3 ABI variants. syscall_linux_mips64x.go can now be removed since the ptrace code on all 3 ABIs is identical. Reviewed-on: https://go-review.googlesource.com/46150 From-SVN: r249472
2016-11-18runtime, reflect: rewrite Go to FFI type conversion in GoIan Lance Taylor1-0/+4
As we move toward the Go 1.7 garbage collector, it's essential that all allocation of values that can contain Go pointers be done using the correct type descriptor. That is simplest if we do all such allocation in Go code. This rewrites the code that converts from a Go type to a libffi CIF into Go. Reviewed-on: https://go-review.googlesource.com/33353 From-SVN: r242578
2016-10-18runtime: copy netpoll code from Go 1.7 runtimeIan Lance Taylor1-0/+13
Reviewed-on: https://go-review.googlesource.com/31325 From-SVN: r241307
2016-09-30runtime: copy internal locking code from Go 1.7 runtimeIan Lance Taylor1-0/+3
Remove the old locking code written in C. Add a shell script mkrsysinfo.sh to generate the runtime_sysinfo.go file, so that we can get Go copies of the system time structures and other types. Tweak the compiler so that when compiling the runtime package the address operator does not cause local variables to escape. When the gc compiler compiles the runtime, an escaping local variable is treated as an error. We should implement that, instead of this change, when escape analysis is turned on. Tweak the compiler so that the generated C header does not include names that start with an underscore followed by a non-upper-case letter, except for the special cases of _defer and _panic. Otherwise we translate C types to Go in runtime_sysinfo.go and then generate those Go types back as C types in runtime.inc, which is useless and painful for the C code. Change entersyscall and friends to take a dummy argument, as the gc versions do, to simplify calls from the shared code. Reviewed-on: https://go-review.googlesource.com/30079 From-SVN: r240657
2016-09-27libgo: separate mksysinfo inputs into separate Makefile targetsIan Lance Taylor1-0/+259
This is a step toward a version of mksysinfo that generates information for the runtime package. This will be used to generate the runtime_sysinfo.go file, which is currently directly generated by a Makefile target. Reviewed-on: https://go-review.googlesource.com/29683 From-SVN: r240560