Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
/* Declarations for operating system interfaces for GNU Make.
|
|
|
|
Copyright (C) 2016 Free Software Foundation, Inc.
|
|
|
|
This file is part of GNU Make.
|
|
|
|
|
|
|
|
GNU Make is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 3 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
|
|
|
|
/* This section provides OS-specific functions to support the jobserver. */
|
|
|
|
|
|
|
|
#ifdef MAKE_JOBSERVER
|
|
|
|
|
|
|
|
/* Returns 1 if the jobserver is enabled, else 0. */
|
2016-05-01 19:52:58 +00:00
|
|
|
unsigned int jobserver_enabled (void);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Called in the master instance to set up the jobserver initially. */
|
2016-04-04 05:23:04 +00:00
|
|
|
unsigned int jobserver_setup (int job_slots);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Called in a child instance to connect to the jobserver. */
|
2016-04-04 05:23:04 +00:00
|
|
|
unsigned int jobserver_parse_auth (const char* auth);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Returns an allocated buffer used to pass to child instances. */
|
2016-05-01 19:52:58 +00:00
|
|
|
char *jobserver_get_auth (void);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Clear this instance's jobserver configuration. */
|
2016-05-01 19:52:58 +00:00
|
|
|
void jobserver_clear (void);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Recover all the jobserver tokens and return the number we got. */
|
2016-05-01 19:52:58 +00:00
|
|
|
unsigned int jobserver_acquire_all (void);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Release a jobserver token. If it fails and is_fatal is 1, fatal. */
|
|
|
|
void jobserver_release (int is_fatal);
|
|
|
|
|
|
|
|
/* Notify the jobserver that a child exited. */
|
2016-05-01 19:52:58 +00:00
|
|
|
void jobserver_signal (void);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Get ready to start a non-recursive child. */
|
2016-05-01 19:52:58 +00:00
|
|
|
void jobserver_pre_child (int);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Complete starting a non-recursive child. */
|
2016-05-01 19:52:58 +00:00
|
|
|
void jobserver_post_child (int);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Set up to acquire a new token. */
|
2016-05-01 19:52:58 +00:00
|
|
|
void jobserver_pre_acquire (void);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
/* Wait until we can acquire a jobserver token.
|
|
|
|
TIMEOUT is 1 if we have other jobs waiting for the load to go down;
|
|
|
|
in this case we won't wait forever, so we can check the load.
|
|
|
|
Returns 1 if we got a token, or 0 if we stopped waiting due to a child
|
|
|
|
exiting or a timeout. */
|
2016-04-04 05:23:04 +00:00
|
|
|
unsigned int jobserver_acquire (int timeout);
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2016-04-02 20:29:48 +00:00
|
|
|
#define jobserver_enabled() (0)
|
2016-04-04 05:23:04 +00:00
|
|
|
#define jobserver_setup(_slots) (0)
|
|
|
|
#define jobserver_parse_auth(_auth) (0)
|
2016-04-02 20:29:48 +00:00
|
|
|
#define jobserver_get_auth() (NULL)
|
|
|
|
#define jobserver_clear() (void)(0)
|
|
|
|
#define jobserver_release(_fatal) (void)(0)
|
|
|
|
#define jobserver_acquire_all() (0)
|
|
|
|
#define jobserver_signal() (void)(0)
|
|
|
|
#define jobserver_pre_child(_r) (void)(0)
|
|
|
|
#define jobserver_post_child(_r) (void)(0)
|
|
|
|
#define jobserver_pre_acquire() (void)(0)
|
|
|
|
#define jobserver_acquire(_tmout) (0)
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
|
|
|
|
#endif
|
2016-03-13 06:12:07 +00:00
|
|
|
|
|
|
|
/* Create a "bad" file descriptor for stdin when parallel jobs are run. */
|
|
|
|
#if !defined(VMD) && !defined(WINDOWS32) && !defined(_AMIGA) && !defined(__MSDOS__)
|
2016-05-01 19:52:58 +00:00
|
|
|
int get_bad_stdin (void);
|
2016-03-13 06:12:07 +00:00
|
|
|
#else
|
|
|
|
# define get_bad_stdin() (-1)
|
|
|
|
#endif
|