diff options
Diffstat (limited to 'src/pkg/runtime/os_openbsd.c')
-rw-r--r-- | src/pkg/runtime/os_openbsd.c | 51 |
1 files changed, 5 insertions, 46 deletions
diff --git a/src/pkg/runtime/os_openbsd.c b/src/pkg/runtime/os_openbsd.c index 4ce102ec2..18377a047 100644 --- a/src/pkg/runtime/os_openbsd.c +++ b/src/pkg/runtime/os_openbsd.c @@ -7,6 +7,7 @@ #include "os_GOOS.h" #include "signal_unix.h" #include "stack.h" +#include "../../cmd/ld/textflag.h" enum { @@ -59,11 +60,11 @@ runtime·semacreate(void) return 1; } +#pragma textflag NOSPLIT int32 runtime·semasleep(int64 ns) { Timespec ts; - int64 secs; // spin-mutex lock while(runtime·xchg(&m->waitsemalock, 1)) @@ -78,12 +79,9 @@ runtime·semasleep(int64 ns) runtime·thrsleep(&m->waitsemacount, 0, nil, &m->waitsemalock, nil); else { ns += runtime·nanotime(); - secs = ns/1000000000LL; - // Avoid overflow - if(secs >= 1LL<<31) - secs = (1LL<<31) - 1; - ts.tv_sec = secs; - ts.tv_nsec = ns%1000000000LL; + // NOTE: tv_nsec is int64 on amd64, so this assumes a little-endian system. + ts.tv_nsec = 0; + ts.tv_sec = runtime·timediv(ns, 1000000000, (int32*)&ts.tv_nsec); runtime·thrsleep(&m->waitsemacount, CLOCK_REALTIME, &ts, &m->waitsemalock, nil); } // reacquire lock @@ -251,45 +249,6 @@ runtime·memlimit(void) return 0; } -void -runtime·setprof(bool on) -{ - USED(on); -} - -static int8 badcallback[] = "runtime: cgo callback on thread not created by Go.\n"; - -// This runs on a foreign stack, without an m or a g. No stack split. -#pragma textflag 7 -void -runtime·badcallback(void) -{ - runtime·write(2, badcallback, sizeof badcallback - 1); -} - -static int8 badsignal[] = "runtime: signal received on thread not created by Go: "; - -// This runs on a foreign stack, without an m or a g. No stack split. -#pragma textflag 7 -void -runtime·badsignal(int32 sig) -{ - int32 len; - - if (sig == SIGPROF) { - return; // Ignore SIGPROFs intended for a non-Go thread. - } - runtime·write(2, badsignal, sizeof badsignal - 1); - if (0 <= sig && sig < NSIG) { - // Can't call findnull() because it will split stack. - for(len = 0; runtime·sigtab[sig].name[len]; len++) - ; - runtime·write(2, runtime·sigtab[sig].name, len); - } - runtime·write(2, "\n", 1); - runtime·exit(1); -} - extern void runtime·sigtramp(void); typedef struct sigaction { |