1 /* wait.c -- functions for getting wait status values.
3 Copyright 2011 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file.
7 We use C code to extract the wait status so that we can easily be
13 extern _Bool Exited (uint32_t *w)
14 __asm__ ("syscall.Exited.N18_syscall.WaitStatus");
19 return WIFEXITED (*w) != 0;
22 extern _Bool Signaled (uint32_t *w)
23 __asm__ ("syscall.Signaled.N18_syscall.WaitStatus");
26 Signaled (uint32_t *w)
28 return WIFSIGNALED (*w) != 0;
31 extern _Bool Stopped (uint32_t *w)
32 __asm__ ("syscall.Stopped.N18_syscall.WaitStatus");
37 return WIFSTOPPED (*w) != 0;
40 extern _Bool Continued (uint32_t *w)
41 __asm__ ("syscall.Continued.N18_syscall.WaitStatus");
44 Continued (uint32_t *w)
46 return WIFCONTINUED (*w) != 0;
49 extern _Bool CoreDump (uint32_t *w)
50 __asm__ ("syscall.CoreDump.N18_syscall.WaitStatus");
53 CoreDump (uint32_t *w)
55 return WCOREDUMP (*w) != 0;
58 extern int ExitStatus (uint32_t *w)
59 __asm__ ("syscall.ExitStatus.N18_syscall.WaitStatus");
62 ExitStatus (uint32_t *w)
66 return WEXITSTATUS (*w);
69 extern int Signal (uint32_t *w)
70 __asm__ ("syscall.Signal.N18_syscall.WaitStatus");
75 if (!WIFSIGNALED (*w))
80 extern int StopSignal (uint32_t *w)
81 __asm__ ("syscall.StopSignal.N18_syscall.WaitStatus");
84 StopSignal (uint32_t *w)
91 extern int TrapCause (uint32_t *w)
92 __asm__ ("syscall.TrapCause.N18_syscall.WaitStatus");
95 TrapCause (uint32_t *w __attribute__ ((unused)))
100 if (!WIFSTOPPED (*w) || WSTOPSIG (*w) != SIGTRAP)