~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/3rdparty/qtcsh/tc.wait.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * tc.wait.h: <sys/wait.h> for machines that don't have it or have it and
 
3
 *            is incorrect.
 
4
 */
 
5
/*-
 
6
 * Copyright (c) 1980, 1991 The Regents of the University of California.
 
7
 * All rights reserved.
 
8
 *
 
9
 * Redistribution and use in source and binary forms, with or without
 
10
 * modification, are permitted provided that the following conditions
 
11
 * are met:
 
12
 * 1. Redistributions of source code must retain the above copyright
 
13
 *    notice, this list of conditions and the following disclaimer.
 
14
 * 2. Redistributions in binary form must reproduce the above copyright
 
15
 *    notice, this list of conditions and the following disclaimer in the
 
16
 *    documentation and/or other materials provided with the distribution.
 
17
 * 3. All advertising materials mentioning features or use of this software
 
18
 *    must display the following acknowledgement:
 
19
 *      This product includes software developed by the University of
 
20
 *      California, Berkeley and its contributors.
 
21
 * 4. Neither the name of the University nor the names of its contributors
 
22
 *    may be used to endorse or promote products derived from this software
 
23
 *    without specific prior written permission.
 
24
 *
 
25
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 
26
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
27
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
28
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 
29
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
30
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 
31
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
32
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
33
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 
34
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
35
 * SUCH DAMAGE.
 
36
 */
 
37
#ifndef _h_tc_wait
 
38
#define _h_tc_wait
 
39
 
 
40
/*
 
41
 * a little complicated #include <sys/wait.h>! :-(
 
42
 * We try to use the system's wait.h when we can...
 
43
 */
 
44
 
 
45
#if SYSVREL > 0 && !defined(linux)
 
46
# ifdef hpux
 
47
#  ifndef __hpux
 
48
#   define NEEDwait
 
49
#  else
 
50
#   ifndef POSIX
 
51
#    define _BSD
 
52
#   endif
 
53
#   ifndef _CLASSIC_POSIX_TYPES
 
54
#    define _CLASSIC_POSIX_TYPES
 
55
#   endif
 
56
#   include <sys/wait.h> /* 7.0 fixed it again */
 
57
#  endif /* __hpux */
 
58
# else /* hpux */
 
59
#  if (defined(OREO) || defined(IRIS4D) || defined(POSIX)) && !defined(_VMS_POSIX)
 
60
#   include <sys/wait.h>
 
61
#  else /* OREO || IRIS4D || POSIX */
 
62
#   define NEEDwait
 
63
#  endif /* OREO || IRIS4D || POSIX */
 
64
# endif /* hpux */
 
65
#else /* SYSVREL == 0 || linux */
 
66
# ifdef _MINIX
 
67
#  undef NEEDwait
 
68
#  include "mi.wait.h"
 
69
# else
 
70
#  ifndef WINNT
 
71
#   include <sys/wait.h>
 
72
#  endif /* WINNT */
 
73
# endif /* _MINIX */
 
74
#endif /* SYSVREL == 0 || linux */
 
75
 
 
76
#ifdef NEEDwait
 
77
/*
 
78
 *      This wait is for big-endians and little endians
 
79
 */
 
80
union wait {
 
81
    int     w_status;
 
82
# ifdef _SEQUENT_
 
83
    struct {
 
84
        unsigned short w_Termsig:7;
 
85
        unsigned short w_Coredump:1;
 
86
        unsigned short w_Retcode:8;
 
87
    }       w_T;
 
88
    struct {
 
89
        unsigned short w_Stopval:8;
 
90
        unsigned short w_Stopsig:8;
 
91
    }       w_S;
 
92
};
 
93
 
 
94
#  define w_termsig     w_T.w_Termsig
 
95
#  define w_coredump    w_T.w_Coredump
 
96
#  define w_retcode     w_T.w_Retcode
 
97
#  define w_stopval     w_S.w_Stopval
 
98
#  define w_stopsig     w_S.w_Stopsig
 
99
# else /* _SEQUENT_ */
 
100
#  if defined(vax) || defined(i386) || defined(_I386)
 
101
    union {
 
102
        struct {
 
103
            unsigned int w_Termsig:7;
 
104
            unsigned int w_Coredump:1;
 
105
            unsigned int w_Retcode:8;
 
106
            unsigned int w_Dummy:16;
 
107
        }       w_T;
 
108
        struct {
 
109
            unsigned int w_Stopval:8;
 
110
            unsigned int w_Stopsig:8;
 
111
            unsigned int w_Dummy:16;
 
112
        }       w_S;
 
113
    }       w_P;
 
114
#  else /* mc68000 || sparc || ??? */
 
115
#    if defined(_CRAY) || defined(ANY_OTHER_64BIT_MACHINE)
 
116
#      define DUMMY_BITS        48
 
117
#    else /* _CRAY */
 
118
#      define DUMMY_BITS        16
 
119
#    endif /* _CRAY */
 
120
    union {
 
121
        struct {
 
122
            unsigned int w_Dummy:DUMMY_BITS;
 
123
            unsigned int w_Retcode:8;
 
124
            unsigned int w_Coredump:1;
 
125
            unsigned int w_Termsig:7;
 
126
        }       w_T;
 
127
        struct {
 
128
            unsigned int w_Dummy:DUMMY_BITS;
 
129
            unsigned int w_Stopsig:8;
 
130
            unsigned int w_Stopval:8;
 
131
        }       w_S;
 
132
    }       w_P;
 
133
#  endif /* vax || i386 || _I386 */
 
134
};
 
135
 
 
136
#  define w_termsig     w_P.w_T.w_Termsig
 
137
#  define w_coredump    w_P.w_T.w_Coredump
 
138
#  define w_retcode     w_P.w_T.w_Retcode
 
139
#  define w_stopval     w_P.w_S.w_Stopval
 
140
#  define w_stopsig     w_P.w_S.w_Stopsig
 
141
# endif /* _SEQUENT_ */
 
142
 
 
143
 
 
144
# ifndef WNOHANG
 
145
#  define WNOHANG       1       /* dont hang in wait */
 
146
# endif
 
147
 
 
148
# ifndef WUNTRACED
 
149
#  define WUNTRACED     2       /* tell about stopped, untraced children */
 
150
# endif
 
151
 
 
152
# define WSTOPPED 0177
 
153
# define WIFSTOPPED(x)  ((x).w_stopval == WSTOPPED)
 
154
# define WIFSIGNALED(x) (((x).w_stopval != WSTOPPED) && ((x).w_termsig != 0))
 
155
 
 
156
#endif /* NEEDwait */
 
157
 
 
158
#endif /* _h_tc_wait */