1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * A copy of the CDDL is also available via the Internet at 11 * http://www.opensource.org/licenses/cddl1.txt 12 * See the License for the specific language governing permissions 13 * and limitations under the License. 14 * 15 * When distributing Covered Code, include this CDDL HEADER in each 16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17 * If applicable, add the following below this CDDL HEADER, with the 18 * fields enclosed by brackets "[]" replaced with your own identifying 19 * information: Portions Copyright [yyyy] [name of copyright owner] 20 * 21 * CDDL HEADER END 22 */ 23 24 /* 25 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms. 27 */ 28 29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 30 /* All Rights Reserved */ 31 32 #if defined(sun) 33 #pragma ident "@(#)jobs.c 1.28 07/05/14 SMI" 34 #endif 35 36 #ifndef _JOBS_H 37 #define _JOBS_H 38 39 /* 40 * Copyright 2008-2020 J. Schilling 41 * 42 * @(#)jobs.h 1.2 20/10/06 2008-2020 J. Schilling 43 */ 44 45 /* 46 * Job control for UNIX Shell 47 */ 48 49 #ifdef SCHILY_INCLUDES 50 #include <schily/ioctl.h> /* Must be before termios.h BSD botch */ 51 #include <schily/termios.h> 52 #include <schily/types.h> 53 #include <schily/utypes.h> 54 #ifdef DO_TIME 55 #include <schily/time.h> 56 #include <schily/resource.h> 57 #endif 58 #else 59 #include <sys/termio.h> 60 #include <sys/types.h> 61 #ifdef DO_TIME 62 #include <sys/resource.h> 63 #endif 64 #endif 65 66 /* 67 * one of these for each active job 68 */ 69 struct job 70 { 71 struct job *j_nxtp; /* next job in job ID order */ 72 struct job *j_curp; /* next job in job currency order */ 73 struct termios j_stty; /* termio save area when job stops */ 74 #ifdef DO_TIME 75 struct timeval j_start; /* job start time */ 76 struct rusage j_rustart; /* resource usage at start of job */ 77 #endif 78 pid_t j_pid; /* job leader's process ID */ 79 pid_t j_pgid; /* job's process group ID */ 80 pid_t j_tgid; /* job's foreground process group ID */ 81 UInt32_t j_jid; /* job ID */ 82 Int32_t j_xval; /* exit code, or exit or stop signal */ 83 Int16_t j_xcode; /* exit or stop reason */ 84 Int16_t j_xsig; /* exit signal, typicalle SIGCHLD */ 85 UInt16_t j_flag; /* various status flags defined below */ 86 char *j_pwd; /* job's working directory */ 87 char *j_cmd; /* cmd used to invoke this job */ 88 }; 89 90 /* 91 * defines for j_flag 92 */ 93 #define J_DUMPED 0001 /* job has core dumped */ 94 #define J_NOTIFY 0002 /* job has changed status */ 95 #define J_SAVETTY 0004 /* job was stopped in foreground, and its */ 96 /* termio settings were saved */ 97 #define J_STOPPED 0010 /* job has been stopped */ 98 #define J_SIGNALED 0020 /* job has received signal; j_xval has it */ 99 #define J_DONE 0040 /* job has finished */ 100 #define J_RUNNING 0100 /* job is currently running */ 101 #define J_FOREGND 0200 /* job was put in foreground by shell */ 102 #define J_BLTIN 0400 /* job was a shell builtin */ 103 #define J_REPORTED 01000 /* job was "reported" via wait(1) */ 104 105 /* 106 * From jobs.c: 107 */ 108 #ifdef DO_TIME 109 extern void ruget __PR((struct rusage *rup)); 110 #endif 111 112 #endif /* _JOBS_H */ 113