diff options
author | Ian Lance Taylor <iant@golang.org> | 2023-03-29 09:01:23 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2023-03-29 09:01:23 -0700 |
commit | 6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced (patch) | |
tree | 1deecdcfbf185c7044bc861d0ace51285c96cb62 /libgo/runtime | |
parent | 795cffe109e28b248a54b8ee583cbae48368c2a7 (diff) | |
parent | aa8f4242efc99f24de73c59d53996f28db28c13f (diff) | |
download | gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.zip gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.tar.gz gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.tar.bz2 |
Merge from trunk revision aa8f4242efc99f24de73c59d53996f28db28c13f.
Diffstat (limited to 'libgo/runtime')
-rw-r--r-- | libgo/runtime/go-signal.c | 18 | ||||
-rw-r--r-- | libgo/runtime/go-strerror.c | 37 |
2 files changed, 55 insertions, 0 deletions
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c index 528d9b6..aa1b630 100644 --- a/libgo/runtime/go-signal.c +++ b/libgo/runtime/go-signal.c @@ -183,6 +183,24 @@ setSigactionHandler(struct sigaction* sa, uintptr handler) sa->sa_sigaction = (void*)(handler); } +#ifdef __linux__ + +// Workaround for https://sourceware.org/bugzilla/show_bug.cgi?id=27417 +#ifndef sigev_notify_thread_id + #define sigev_notify_thread_id _sigev_un._tid +#endif + +void setSigeventTID(struct sigevent*, int32_t) + __asm__ (GOSYM_PREFIX "runtime.setSigeventTID"); + +void +setSigeventTID(struct sigevent *sev, int32_t v) +{ + sev->sigev_notify_thread_id = v; +} + +#endif // defined(__linux__) + // C code to fetch values from the siginfo_t and ucontext_t pointers // passed to a signal handler. diff --git a/libgo/runtime/go-strerror.c b/libgo/runtime/go-strerror.c new file mode 100644 index 0000000..8ff5ffb --- /dev/null +++ b/libgo/runtime/go-strerror.c @@ -0,0 +1,37 @@ +/* go-strerror.c -- wrapper around XSI-compliant strerror_r. + + Copyright 2022 The Go Authors. All rights reserved. + Use of this source code is governed by a BSD-style + license that can be found in the LICENSE file. */ + +/* There are two version of strerror_r on GNU/Linux: a GNU-specific + and an XSI-compliant version. The former version is only available + on glibc. Since glibc 2.13, the XSI-compliant version is also + provided by glibc if _GNU_SOURCE is not defined. Since the + entirety of gofrontend is compiled with _GNU_SOURCE, this file + exists to selectively undefine it and provides an alias to the + XSI-compliant version of strerror_r(3). */ + +#if defined(__linux__) || defined(__gnu_hurd__) + +/* Force selection of XSI-compliant strerror_r by glibc. */ +#undef XOPEN_SOURCE +#define XOPEN_SOURCE 600 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200112L +#undef _GNU_SOURCE + +#endif /* defined(__linux__) || defined(__gnu_hurd__) */ + +#include <string.h> + +#ifndef HAVE_STRERROR_R +// Provided by go-nosys.c if not provided by libc itself. +extern int strerror_r (int, char *, size_t); +#endif + +int +go_strerror (int errnum, char *buf, size_t buflen) +{ + return strerror_r (errnum, buf, buflen); +} |