job.h revision 1.85
1/*	$NetBSD: job.h,v 1.85 2025/07/06 07:11:31 rillig Exp $	*/
2
3/*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 *    may be used to endorse or promote products derived from this software
20 *    without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 *	from: @(#)job.h	8.1 (Berkeley) 6/6/93
35 */
36
37/*
38 * Copyright (c) 1988, 1989 by Adam de Boor
39 * Copyright (c) 1989 by Berkeley Softworks
40 * All rights reserved.
41 *
42 * This code is derived from software contributed to Berkeley by
43 * Adam de Boor.
44 *
45 * Redistribution and use in source and binary forms, with or without
46 * modification, are permitted provided that the following conditions
47 * are met:
48 * 1. Redistributions of source code must retain the above copyright
49 *    notice, this list of conditions and the following disclaimer.
50 * 2. Redistributions in binary form must reproduce the above copyright
51 *    notice, this list of conditions and the following disclaimer in the
52 *    documentation and/or other materials provided with the distribution.
53 * 3. All advertising materials mentioning features or use of this software
54 *    must display the following acknowledgement:
55 *	This product includes software developed by the University of
56 *	California, Berkeley and its contributors.
57 * 4. Neither the name of the University nor the names of its contributors
58 *    may be used to endorse or promote products derived from this software
59 *    without specific prior written permission.
60 *
61 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
62 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
63 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
64 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
65 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
66 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
67 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
69 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
70 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
71 * SUCH DAMAGE.
72 *
73 *	from: @(#)job.h	8.1 (Berkeley) 6/6/93
74 */
75
76/* Run jobs in parallel mode. */
77
78#ifndef MAKE_JOB_H
79#define MAKE_JOB_H
80
81typedef struct Job Job;
82
83extern char *shellPath;
84extern const char *shellName;
85extern char *shellErrFlag;
86
87extern int jobTokensRunning;	/* tokens currently "out" */
88
89void Shell_Init(void);
90const char *Shell_GetNewline(void) MAKE_ATTR_USE;
91
92void TokenPool_Init(int, int, int);
93bool TokenPool_Take(void) MAKE_ATTR_USE;
94void TokenPool_Return(void);
95
96void Job_Touch(GNode *, bool);
97bool Job_CheckCommands(GNode *, void (*abortProc)(const char *, ...))
98    MAKE_ATTR_USE;
99void Job_CatchChildren(void);
100void Job_CatchOutput(void);
101void Job_Make(GNode *);
102void Job_Init(void);
103bool Job_ParseShell(char *) MAKE_ATTR_USE;
104int Job_MakeDotEnd(void);
105#ifdef CLEANUP
106void Job_End(void);
107#endif
108void Job_Wait(void);
109void Job_AbortAll(void);
110void Job_SetPrefix(void);
111bool Job_RunTarget(const char *, const char *);
112void Job_FlagsToString(const Job *, char *, size_t);
113int Job_TempFile(const char *, char *, size_t) MAKE_ATTR_USE;
114#ifdef USE_META
115struct BuildMon *Job_BuildMon(Job *) MAKE_ATTR_USE;
116#endif
117GNode *Job_Node(Job *) MAKE_ATTR_USE;
118int Job_Pid(Job *) MAKE_ATTR_USE;
119
120#endif
121