2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: jobs.h /main/3 1995/11/01 16:40:45 rswiston $ */
24 /***************************************************************
26 * AT&T - PROPRIETARY *
28 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
29 * AT&T BELL LABORATORIES *
30 * AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
31 * ACCORDANCE WITH APPLICABLE AGREEMENTS *
33 * Copyright (c) 1995 AT&T Corp. *
34 * Unpublished & Not for Publication *
35 * All Rights Reserved *
37 * The copyright notice above does not evidence any *
38 * actual or intended publication of such source code *
40 * This software was created by the *
41 * Advanced Software Technology Department *
42 * AT&T Bell Laboratories *
44 * For further information contact *
45 * {research,attmail}!dgk *
47 ***************************************************************/
49 /* : : generated by proto : : */
52 #if !defined(__PROTO__)
53 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
54 #if defined(__cplusplus)
55 #define __MANGLE__ "C"
60 #define __PROTO__(x) x
62 #define __PARAM__(n,o) n
63 #if !defined(__STDC__) && !defined(__cplusplus)
64 #if !defined(c_plusplus)
75 #define __PROTO__(x) ()
76 #define __OTORP__(x) x
77 #define __PARAM__(n,o) o
85 #if defined(__cplusplus) || defined(c_plusplus)
86 #define __VARARG__ ...
90 #if defined(__STDARG__)
91 #define __VA_START__(p,a) va_start(p,a)
93 #define __VA_START__(p,a) va_start(p)
98 * Interface to job control for shell
99 * written by David Korn
110 #include "FEATURE/options"
113 #if defined(SIGCLD) && !defined(SIGCHLD)
114 # define SIGCHLD SIGCLD
118 # include "terminal.h"
121 extern __MANGLE__ int tty_ld, ntty_ld;
122 # define OTTYDISC tty_ld
123 # define NTTYDISC ntty_ld
124 # endif /* FIOLOOKLD */
128 # define SH_MONITOR 0
130 # define job_reset(x)
135 struct process *p_nxtjob; /* next job structure */
136 struct process *p_nxtproc; /* next process in current job */
137 pid_t p_pid; /* process id */
138 pid_t p_pgrp; /* process group */
139 pid_t p_fgrp; /* process group when stopped */
140 short p_job; /* job number of process */
141 unsigned short p_exit; /* exit value or signal number */
142 unsigned char p_flag; /* flags - see below */
143 int p_env; /* subshell environment number */
145 off_t p_name; /* history file offset for command */
146 struct termios p_stty; /* terminal state for job */
152 struct process *pwlist; /* head of process list */
153 pid_t curpgid; /* current process gid id */
154 pid_t parent; /* set by fork() */
155 pid_t mypid; /* process id of shell */
156 pid_t mypgid; /* process group id of shell */
157 pid_t mytgid; /* terminal group id of shell */
158 int numpost; /* number of posted jobs */
159 short fd; /* tty descriptor number */
161 int suspend; /* suspend character */
162 int linedisc; /* line dicipline */
164 char in_critical; /* set when in critical region */
165 char jobcontrol; /* turned on for real job control */
166 char waitsafe; /* wait will not block */
167 char waitall; /* wait for all jobs in pipe */
168 char toclear; /* job table needs clearing */
169 unsigned char *freejobs; /* free jobs numbers */
172 /* flags for joblist */
178 extern __MANGLE__ struct jobs job;
181 extern __MANGLE__ const char e_jobusage[];
182 extern __MANGLE__ const char e_kill[];
183 extern __MANGLE__ const char e_done[];
184 extern __MANGLE__ const char e_running[];
185 extern __MANGLE__ const char e_coredump[];
186 extern __MANGLE__ const char e_killcolon[];
187 extern __MANGLE__ const char e_no_proc[];
188 extern __MANGLE__ const char e_no_job[];
189 extern __MANGLE__ const char e_jobsrunning[];
190 extern __MANGLE__ const char e_nlspace[];
191 extern __MANGLE__ const char e_access[];
192 extern __MANGLE__ const char e_terminate[];
193 extern __MANGLE__ const char e_no_jctl[];
195 extern __MANGLE__ const char e_no_start[];
198 extern __MANGLE__ const char e_newtty[];
199 extern __MANGLE__ const char e_oldtty[];
200 #endif /* NTTYDISC */
204 * The following are defined in jobs.c
207 extern __MANGLE__ void job_clear __PROTO__((void));
208 extern __MANGLE__ void job_bwait __PROTO__((char**));
209 extern __MANGLE__ int job_walk __PROTO__((Sfio_t*,int(*)(struct process*,int),int,char*[]));
210 extern __MANGLE__ int job_kill __PROTO__((struct process*,int));
211 extern __MANGLE__ void job_wait __PROTO__((pid_t));
212 extern __MANGLE__ int job_post __PROTO__((pid_t,pid_t));
213 extern __MANGLE__ int job_chksave __PROTO__((pid_t));
215 extern __MANGLE__ void job_init __PROTO__((int));
216 extern __MANGLE__ int job_close __PROTO__((void));
217 extern __MANGLE__ int job_list __PROTO__((struct process*,int));
218 extern __MANGLE__ int job_terminate __PROTO__((struct process*,int));
219 extern __MANGLE__ int job_switch __PROTO__((struct process*,int));
221 # define job_init(flag)
222 # define job_close() (0)
226 #endif /* !JOB_NFLAG */