11.85Srillig/*	$NetBSD: job.h,v 1.85 2025/07/06 07:11:31 rillig Exp $	*/
21.4Schristos
31.1Scgd/*
41.1Scgd * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
51.20Sagc * All rights reserved.
61.20Sagc *
71.20Sagc * This code is derived from software contributed to Berkeley by
81.20Sagc * Adam de Boor.
91.20Sagc *
101.20Sagc * Redistribution and use in source and binary forms, with or without
111.20Sagc * modification, are permitted provided that the following conditions
121.20Sagc * are met:
131.20Sagc * 1. Redistributions of source code must retain the above copyright
141.20Sagc *    notice, this list of conditions and the following disclaimer.
151.20Sagc * 2. Redistributions in binary form must reproduce the above copyright
161.20Sagc *    notice, this list of conditions and the following disclaimer in the
171.20Sagc *    documentation and/or other materials provided with the distribution.
181.20Sagc * 3. Neither the name of the University nor the names of its contributors
191.20Sagc *    may be used to endorse or promote products derived from this software
201.20Sagc *    without specific prior written permission.
211.20Sagc *
221.20Sagc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231.20Sagc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241.20Sagc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251.20Sagc * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261.20Sagc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271.20Sagc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281.20Sagc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291.20Sagc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301.20Sagc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311.20Sagc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321.20Sagc * SUCH DAMAGE.
331.20Sagc *
341.20Sagc *	from: @(#)job.h	8.1 (Berkeley) 6/6/93
351.20Sagc */
361.20Sagc
371.20Sagc/*
381.1Scgd * Copyright (c) 1988, 1989 by Adam de Boor
391.1Scgd * Copyright (c) 1989 by Berkeley Softworks
401.1Scgd * All rights reserved.
411.1Scgd *
421.1Scgd * This code is derived from software contributed to Berkeley by
431.1Scgd * Adam de Boor.
441.1Scgd *
451.1Scgd * Redistribution and use in source and binary forms, with or without
461.1Scgd * modification, are permitted provided that the following conditions
471.1Scgd * are met:
481.1Scgd * 1. Redistributions of source code must retain the above copyright
491.1Scgd *    notice, this list of conditions and the following disclaimer.
501.1Scgd * 2. Redistributions in binary form must reproduce the above copyright
511.1Scgd *    notice, this list of conditions and the following disclaimer in the
521.1Scgd *    documentation and/or other materials provided with the distribution.
531.1Scgd * 3. All advertising materials mentioning features or use of this software
541.1Scgd *    must display the following acknowledgement:
551.1Scgd *	This product includes software developed by the University of
561.1Scgd *	California, Berkeley and its contributors.
571.1Scgd * 4. Neither the name of the University nor the names of its contributors
581.1Scgd *    may be used to endorse or promote products derived from this software
591.1Scgd *    without specific prior written permission.
601.1Scgd *
611.1Scgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
621.1Scgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
631.1Scgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
641.1Scgd * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
651.1Scgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
661.1Scgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
671.1Scgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
681.1Scgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
691.1Scgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
701.1Scgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
711.1Scgd * SUCH DAMAGE.
721.1Scgd *
731.5Schristos *	from: @(#)job.h	8.1 (Berkeley) 6/6/93
741.1Scgd */
751.1Scgd
761.78Srillig/* Run jobs in parallel mode. */
771.52Srillig
781.44Srillig#ifndef MAKE_JOB_H
791.44Srillig#define MAKE_JOB_H
801.1Scgd
811.82Srilligtypedef struct Job Job;
821.1Scgd
831.79Srilligextern char *shellPath;
841.19Ssjgextern const char *shellName;
851.42Ssjgextern char *shellErrFlag;
861.19Ssjg
871.54Srilligextern int jobTokensRunning;	/* tokens currently "out" */
881.11Ssommerfe
891.19Ssjgvoid Shell_Init(void);
901.74Srilligconst char *Shell_GetNewline(void) MAKE_ATTR_USE;
911.83Srillig
921.83Srilligvoid TokenPool_Init(int, int, int);
931.83Srilligbool TokenPool_Take(void) MAKE_ATTR_USE;
941.83Srilligvoid TokenPool_Return(void);
951.83Srillig
961.73Srilligvoid Job_Touch(GNode *, bool);
971.74Srilligbool Job_CheckCommands(GNode *, void (*abortProc)(const char *, ...))
981.74Srillig    MAKE_ATTR_USE;
991.32Sdslvoid Job_CatchChildren(void);
1001.16Swizvoid Job_CatchOutput(void);
1011.16Swizvoid Job_Make(GNode *);
1021.27Sdslvoid Job_Init(void);
1031.74Srilligbool Job_ParseShell(char *) MAKE_ATTR_USE;
1041.85Srilligint Job_MakeDotEnd(void);
1051.80Srillig#ifdef CLEANUP
1061.16Swizvoid Job_End(void);
1071.80Srillig#endif
1081.16Swizvoid Job_Wait(void);
1091.16Swizvoid Job_AbortAll(void);
1101.34Ssjgvoid Job_SetPrefix(void);
1111.73Srilligbool Job_RunTarget(const char *, const char *);
1121.66Srilligvoid Job_FlagsToString(const Job *, char *, size_t);
1131.74Srilligint Job_TempFile(const char *, char *, size_t) MAKE_ATTR_USE;
1141.82Srillig#ifdef USE_META
1151.82Srilligstruct BuildMon *Job_BuildMon(Job *) MAKE_ATTR_USE;
1161.82Srillig#endif
1171.82SrilligGNode *Job_Node(Job *) MAKE_ATTR_USE;
1181.82Srilligint Job_Pid(Job *) MAKE_ATTR_USE;
1191.3Scgd
1201.75Srillig#endif
121