1 | /* Declarations for operating system interfaces for GNU Make.
|
---|
2 | Copyright (C) 2016 Free Software Foundation, Inc.
|
---|
3 | This file is part of GNU Make.
|
---|
4 |
|
---|
5 | GNU Make is free software; you can redistribute it and/or modify it under the
|
---|
6 | terms of the GNU General Public License as published by the Free Software
|
---|
7 | Foundation; either version 3 of the License, or (at your option) any later
|
---|
8 | version.
|
---|
9 |
|
---|
10 | GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
---|
11 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
---|
12 | A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License along with
|
---|
15 | this program. If not, see <http://www.gnu.org/licenses/>. */
|
---|
16 |
|
---|
17 |
|
---|
18 | /* This section provides OS-specific functions to support the jobserver. */
|
---|
19 |
|
---|
20 | #ifdef MAKE_JOBSERVER
|
---|
21 |
|
---|
22 | /* Returns 1 if the jobserver is enabled, else 0. */
|
---|
23 | unsigned int jobserver_enabled (void);
|
---|
24 |
|
---|
25 | /* Called in the master instance to set up the jobserver initially. */
|
---|
26 | unsigned int jobserver_setup (int job_slots);
|
---|
27 |
|
---|
28 | /* Called in a child instance to connect to the jobserver. */
|
---|
29 | unsigned int jobserver_parse_auth (const char* auth);
|
---|
30 |
|
---|
31 | /* Returns an allocated buffer used to pass to child instances. */
|
---|
32 | char *jobserver_get_auth (void);
|
---|
33 |
|
---|
34 | /* Clear this instance's jobserver configuration. */
|
---|
35 | void jobserver_clear (void);
|
---|
36 |
|
---|
37 | /* Recover all the jobserver tokens and return the number we got. */
|
---|
38 | unsigned int jobserver_acquire_all (void);
|
---|
39 |
|
---|
40 | /* Release a jobserver token. If it fails and is_fatal is 1, fatal. */
|
---|
41 | void jobserver_release (int is_fatal);
|
---|
42 |
|
---|
43 | /* Notify the jobserver that a child exited. */
|
---|
44 | void jobserver_signal (void);
|
---|
45 |
|
---|
46 | /* Get ready to start a non-recursive child. */
|
---|
47 | void jobserver_pre_child (int);
|
---|
48 |
|
---|
49 | /* Complete starting a non-recursive child. */
|
---|
50 | void jobserver_post_child (int);
|
---|
51 |
|
---|
52 | /* Set up to acquire a new token. */
|
---|
53 | void jobserver_pre_acquire (void);
|
---|
54 |
|
---|
55 | /* Wait until we can acquire a jobserver token.
|
---|
56 | TIMEOUT is 1 if we have other jobs waiting for the load to go down;
|
---|
57 | in this case we won't wait forever, so we can check the load.
|
---|
58 | Returns 1 if we got a token, or 0 if we stopped waiting due to a child
|
---|
59 | exiting or a timeout. */
|
---|
60 | unsigned int jobserver_acquire (int timeout);
|
---|
61 |
|
---|
62 | #else
|
---|
63 |
|
---|
64 | #define jobserver_enabled() (0)
|
---|
65 | #define jobserver_setup(_slots) (0)
|
---|
66 | #define jobserver_parse_auth(_auth) (0)
|
---|
67 | #define jobserver_get_auth() (NULL)
|
---|
68 | #define jobserver_clear() (void)(0)
|
---|
69 | #define jobserver_release(_fatal) (void)(0)
|
---|
70 | #define jobserver_acquire_all() (0)
|
---|
71 | #define jobserver_signal() (void)(0)
|
---|
72 | #define jobserver_pre_child(_r) (void)(0)
|
---|
73 | #define jobserver_post_child(_r) (void)(0)
|
---|
74 | #define jobserver_pre_acquire() (void)(0)
|
---|
75 | #define jobserver_acquire(_tmout) (0)
|
---|
76 |
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | /* Create a "bad" file descriptor for stdin when parallel jobs are run. */
|
---|
80 | #if !defined(VMD) && !defined(WINDOWS32) && !defined(_AMIGA) && !defined(__MSDOS__)
|
---|
81 | int get_bad_stdin (void);
|
---|
82 | #else
|
---|
83 | # define get_bad_stdin() (-1)
|
---|
84 | #endif
|
---|