1*a8c56be4SSimon J. Gerraty /* $NetBSD: job.h,v 1.85 2025/07/06 07:11:31 rillig Exp $ */ 23955d011SMarcel Moolenaar 33955d011SMarcel Moolenaar /* 43955d011SMarcel Moolenaar * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 53955d011SMarcel Moolenaar * All rights reserved. 63955d011SMarcel Moolenaar * 73955d011SMarcel Moolenaar * This code is derived from software contributed to Berkeley by 83955d011SMarcel Moolenaar * Adam de Boor. 93955d011SMarcel Moolenaar * 103955d011SMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 113955d011SMarcel Moolenaar * modification, are permitted provided that the following conditions 123955d011SMarcel Moolenaar * are met: 133955d011SMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 143955d011SMarcel Moolenaar * notice, this list of conditions and the following disclaimer. 153955d011SMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 163955d011SMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 173955d011SMarcel Moolenaar * documentation and/or other materials provided with the distribution. 183955d011SMarcel Moolenaar * 3. Neither the name of the University nor the names of its contributors 193955d011SMarcel Moolenaar * may be used to endorse or promote products derived from this software 203955d011SMarcel Moolenaar * without specific prior written permission. 213955d011SMarcel Moolenaar * 223955d011SMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 233955d011SMarcel Moolenaar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 243955d011SMarcel Moolenaar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 253955d011SMarcel Moolenaar * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 263955d011SMarcel Moolenaar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 273955d011SMarcel Moolenaar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 283955d011SMarcel Moolenaar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 293955d011SMarcel Moolenaar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 303955d011SMarcel Moolenaar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 313955d011SMarcel Moolenaar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 323955d011SMarcel Moolenaar * SUCH DAMAGE. 333955d011SMarcel Moolenaar * 343955d011SMarcel Moolenaar * from: @(#)job.h 8.1 (Berkeley) 6/6/93 353955d011SMarcel Moolenaar */ 363955d011SMarcel Moolenaar 373955d011SMarcel Moolenaar /* 383955d011SMarcel Moolenaar * Copyright (c) 1988, 1989 by Adam de Boor 393955d011SMarcel Moolenaar * Copyright (c) 1989 by Berkeley Softworks 403955d011SMarcel Moolenaar * All rights reserved. 413955d011SMarcel Moolenaar * 423955d011SMarcel Moolenaar * This code is derived from software contributed to Berkeley by 433955d011SMarcel Moolenaar * Adam de Boor. 443955d011SMarcel Moolenaar * 453955d011SMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 463955d011SMarcel Moolenaar * modification, are permitted provided that the following conditions 473955d011SMarcel Moolenaar * are met: 483955d011SMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 493955d011SMarcel Moolenaar * notice, this list of conditions and the following disclaimer. 503955d011SMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 513955d011SMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 523955d011SMarcel Moolenaar * documentation and/or other materials provided with the distribution. 533955d011SMarcel Moolenaar * 3. All advertising materials mentioning features or use of this software 543955d011SMarcel Moolenaar * must display the following acknowledgement: 553955d011SMarcel Moolenaar * This product includes software developed by the University of 563955d011SMarcel Moolenaar * California, Berkeley and its contributors. 573955d011SMarcel Moolenaar * 4. Neither the name of the University nor the names of its contributors 583955d011SMarcel Moolenaar * may be used to endorse or promote products derived from this software 593955d011SMarcel Moolenaar * without specific prior written permission. 603955d011SMarcel Moolenaar * 613955d011SMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 623955d011SMarcel Moolenaar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 633955d011SMarcel Moolenaar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 643955d011SMarcel Moolenaar * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 653955d011SMarcel Moolenaar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 663955d011SMarcel Moolenaar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 673955d011SMarcel Moolenaar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 683955d011SMarcel Moolenaar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 693955d011SMarcel Moolenaar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 703955d011SMarcel Moolenaar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 713955d011SMarcel Moolenaar * SUCH DAMAGE. 723955d011SMarcel Moolenaar * 733955d011SMarcel Moolenaar * from: @(#)job.h 8.1 (Berkeley) 6/6/93 743955d011SMarcel Moolenaar */ 753955d011SMarcel Moolenaar 76d5e0a182SSimon J. Gerraty /* Run jobs in parallel mode. */ 77956e45f6SSimon J. Gerraty 782c3632d1SSimon J. Gerraty #ifndef MAKE_JOB_H 792c3632d1SSimon J. Gerraty #define MAKE_JOB_H 803955d011SMarcel Moolenaar 810b46a53aSSimon J. Gerraty typedef struct Job Job; 823955d011SMarcel Moolenaar 8322619282SSimon J. Gerraty extern char *shellPath; 843955d011SMarcel Moolenaar extern const char *shellName; 8551ee2c1cSSimon J. Gerraty extern char *shellErrFlag; 863955d011SMarcel Moolenaar 873955d011SMarcel Moolenaar extern int jobTokensRunning; /* tokens currently "out" */ 883955d011SMarcel Moolenaar 893955d011SMarcel Moolenaar void Shell_Init(void); 909f45a3c8SSimon J. Gerraty const char *Shell_GetNewline(void) MAKE_ATTR_USE; 910b46a53aSSimon J. Gerraty 920b46a53aSSimon J. Gerraty void TokenPool_Init(int, int, int); 930b46a53aSSimon J. Gerraty bool TokenPool_Take(void) MAKE_ATTR_USE; 940b46a53aSSimon J. Gerraty void TokenPool_Return(void); 950b46a53aSSimon J. Gerraty 96b0c40a00SSimon J. Gerraty void Job_Touch(GNode *, bool); 979f45a3c8SSimon J. Gerraty bool Job_CheckCommands(GNode *, void (*abortProc)(const char *, ...)) 989f45a3c8SSimon J. Gerraty MAKE_ATTR_USE; 993955d011SMarcel Moolenaar void Job_CatchChildren(void); 1003955d011SMarcel Moolenaar void Job_CatchOutput(void); 1013955d011SMarcel Moolenaar void Job_Make(GNode *); 1023955d011SMarcel Moolenaar void Job_Init(void); 1039f45a3c8SSimon J. Gerraty bool Job_ParseShell(char *) MAKE_ATTR_USE; 104*a8c56be4SSimon J. Gerraty int Job_MakeDotEnd(void); 10522619282SSimon J. Gerraty #ifdef CLEANUP 1063955d011SMarcel Moolenaar void Job_End(void); 10722619282SSimon J. Gerraty #endif 1083955d011SMarcel Moolenaar void Job_Wait(void); 1093955d011SMarcel Moolenaar void Job_AbortAll(void); 1103955d011SMarcel Moolenaar void Job_SetPrefix(void); 111b0c40a00SSimon J. Gerraty bool Job_RunTarget(const char *, const char *); 11206b9b3e0SSimon J. Gerraty void Job_FlagsToString(const Job *, char *, size_t); 1139f45a3c8SSimon J. Gerraty int Job_TempFile(const char *, char *, size_t) MAKE_ATTR_USE; 1140b46a53aSSimon J. Gerraty #ifdef USE_META 1150b46a53aSSimon J. Gerraty struct BuildMon *Job_BuildMon(Job *) MAKE_ATTR_USE; 1160b46a53aSSimon J. Gerraty #endif 1170b46a53aSSimon J. Gerraty GNode *Job_Node(Job *) MAKE_ATTR_USE; 1180b46a53aSSimon J. Gerraty int Job_Pid(Job *) MAKE_ATTR_USE; 1193955d011SMarcel Moolenaar 1209f45a3c8SSimon J. Gerraty #endif 121