OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [syscall/] [wait.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
/* wait.c -- functions for getting wait status values.
2
 
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.
6
 
7
   We use C code to extract the wait status so that we can easily be
8
   OS-independent.  */
9
 
10
#include <stdint.h>
11
#include <sys/wait.h>
12
 
13
extern _Bool Exited (uint32_t *w)
14
  __asm__ ("libgo_syscall.syscall.Exited.N32_libgo_syscall.syscall.WaitStatus");
15
 
16
_Bool
17
Exited (uint32_t *w)
18
{
19
  return WIFEXITED (*w) != 0;
20
}
21
 
22
extern _Bool Signaled (uint32_t *w)
23
  __asm__ ("libgo_syscall.syscall.Signaled.N32_libgo_syscall.syscall.WaitStatus");
24
 
25
_Bool
26
Signaled (uint32_t *w)
27
{
28
  return WIFSIGNALED (*w) != 0;
29
}
30
 
31
extern _Bool Stopped (uint32_t *w)
32
  __asm__ ("libgo_syscall.syscall.Stopped.N32_libgo_syscall.syscall.WaitStatus");
33
 
34
_Bool
35
Stopped (uint32_t *w)
36
{
37
  return WIFSTOPPED (*w) != 0;
38
}
39
 
40
extern _Bool Continued (uint32_t *w)
41
  __asm__ ("libgo_syscall.syscall.Continued.N32_libgo_syscall.syscall.WaitStatus");
42
 
43
_Bool
44
Continued (uint32_t *w)
45
{
46
  return WIFCONTINUED (*w) != 0;
47
}
48
 
49
extern _Bool CoreDump (uint32_t *w)
50
  __asm__ ("libgo_syscall.syscall.CoreDump.N32_libgo_syscall.syscall.WaitStatus");
51
 
52
_Bool
53
CoreDump (uint32_t *w)
54
{
55
  return WCOREDUMP (*w) != 0;
56
}
57
 
58
extern int ExitStatus (uint32_t *w)
59
  __asm__ ("libgo_syscall.syscall.ExitStatus.N32_libgo_syscall.syscall.WaitStatus");
60
 
61
int
62
ExitStatus (uint32_t *w)
63
{
64
  if (!WIFEXITED (*w))
65
    return -1;
66
  return WEXITSTATUS (*w);
67
}
68
 
69
extern int Signal (uint32_t *w)
70
  __asm__ ("libgo_syscall.syscall.Signal.N32_libgo_syscall.syscall.WaitStatus");
71
 
72
int
73
Signal (uint32_t *w)
74
{
75
  if (!WIFSIGNALED (*w))
76
    return -1;
77
  return WTERMSIG (*w);
78
}
79
 
80
extern int StopSignal (uint32_t *w)
81
  __asm__ ("libgo_syscall.syscall.StopSignal.N32_libgo_syscall.syscall.WaitStatus");
82
 
83
int
84
StopSignal (uint32_t *w)
85
{
86
  if (!WIFSTOPPED (*w))
87
    return -1;
88
  return WSTOPSIG (*w);
89
}
90
 
91
extern int TrapCause (uint32_t *w)
92
  __asm__ ("libgo_syscall.syscall.TrapCause.N32_libgo_syscall.syscall.WaitStatus");
93
 
94
int
95
TrapCause (uint32_t *w __attribute__ ((unused)))
96
{
97
#ifndef __linux__
98
  return -1;
99
#else
100
  if (!WIFSTOPPED (*w) || WSTOPSIG (*w) != SIGTRAP)
101
    return -1;
102
  return *w >> 16;
103
#endif
104
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.