~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to include/unionwait.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* unionwait.h -- definitions for using a `union wait' on systems without
 
2
   one. */
 
3
 
 
4
/* Copyright (C) 1996 Free Software Foundation, Inc.
 
5
 
 
6
   This file is part of GNU Bash, the Bourne Again SHell.
 
7
 
 
8
   Bash is free software: you can redistribute it and/or modify
 
9
   it under the terms of the GNU General Public License as published by
 
10
   the Free Software Foundation, either version 3 of the License, or
 
11
   (at your option) any later version.
 
12
 
 
13
   Bash is distributed in the hope that it will be useful,
 
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
   GNU General Public License for more details.
 
17
 
 
18
   You should have received a copy of the GNU General Public License
 
19
   along with Bash.  If not, see <http://www.gnu.org/licenses/>.
 
20
*/
 
21
 
 
22
#ifndef _UNIONWAIT_H
 
23
#define _UNIONWAIT_H
 
24
 
 
25
#if !defined (WORDS_BIGENDIAN)
 
26
union wait
 
27
  {
 
28
    int w_status;               /* used in syscall */
 
29
 
 
30
    /* Terminated process status. */
 
31
    struct
 
32
      {
 
33
        unsigned short
 
34
          w_Termsig  : 7,       /* termination signal */
 
35
          w_Coredump : 1,       /* core dump indicator */
 
36
          w_Retcode  : 8,       /* exit code if w_termsig==0 */
 
37
          w_Fill1    : 16;      /* high 16 bits unused */
 
38
      } w_T;
 
39
 
 
40
    /* Stopped process status.  Returned
 
41
       only for traced children unless requested
 
42
       with the WUNTRACED option bit. */
 
43
    struct
 
44
      {
 
45
        unsigned short
 
46
          w_Stopval : 8,        /* == W_STOPPED if stopped */
 
47
          w_Stopsig : 8,        /* actually zero on XENIX */
 
48
          w_Fill2   : 16;       /* high 16 bits unused */
 
49
      } w_S;
 
50
  };
 
51
 
 
52
#else  /* WORDS_BIGENDIAN */
 
53
 
 
54
/* This is for big-endian machines like the IBM RT, HP 9000, or Sun-3 */
 
55
 
 
56
union wait
 
57
  {
 
58
    int w_status;               /* used in syscall */
 
59
 
 
60
    /* Terminated process status. */
 
61
    struct
 
62
      {
 
63
        unsigned short w_Fill1    : 16; /* high 16 bits unused */
 
64
        unsigned       w_Retcode  : 8;  /* exit code if w_termsig==0 */
 
65
        unsigned       w_Coredump : 1;  /* core dump indicator */
 
66
        unsigned       w_Termsig  : 7;  /* termination signal */
 
67
      } w_T;
 
68
 
 
69
    /* Stopped process status.  Returned
 
70
       only for traced children unless requested
 
71
       with the WUNTRACED option bit. */
 
72
    struct
 
73
      {
 
74
        unsigned short w_Fill2   : 16;  /* high 16 bits unused */
 
75
        unsigned       w_Stopsig : 8;   /* signal that stopped us */
 
76
        unsigned       w_Stopval : 8;   /* == W_STOPPED if stopped */
 
77
      } w_S;
 
78
  };
 
79
 
 
80
#endif /* WORDS_BIGENDIAN */
 
81
 
 
82
#define w_termsig  w_T.w_Termsig
 
83
#define w_coredump w_T.w_Coredump
 
84
#define w_retcode  w_T.w_Retcode
 
85
#define w_stopval  w_S.w_Stopval
 
86
#define w_stopsig  w_S.w_Stopsig
 
87
 
 
88
#define WSTOPPED       0177
 
89
#define WIFSTOPPED(x)  ((x).w_stopval == WSTOPPED)
 
90
#define WIFEXITED(x)   ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
 
91
#define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0)
 
92
 
 
93
#define WTERMSIG(x)    ((x).w_termsig)
 
94
#define WSTOPSIG(x)    ((x).w_stopsig)
 
95
#define WEXITSTATUS(x) ((x).w_retcode)
 
96
#define WIFCORED(x)    ((x).w_coredump)
 
97
 
 
98
#endif /* _UNIONWAIT_H */