| 1 | /* Template for the remote job exportation interface to GNU Make. |
| 2 | Copyright (C) 1988-2020 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 | #include "makeint.h" |
| 18 | #include "filedef.h" |
| 19 | #include "job.h" |
| 20 | #include "commands.h" |
| 21 | |
| 22 | |
| 23 | /* Call once at startup even if no commands are run. */ |
| 24 | |
| 25 | void |
| 26 | remote_setup (void) |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | /* Called before exit. */ |
| 31 | |
| 32 | void |
| 33 | remote_cleanup (void) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | /* Return nonzero if the next job should be done remotely. */ |
| 38 | |
| 39 | int |
| 40 | start_remote_job_p (int first_p UNUSED) |
| 41 | { |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | /* Start a remote job running the command in ARGV, |
| 46 | with environment from ENVP. It gets standard input from STDIN_FD. On |
| 47 | failure, return nonzero. On success, return zero, and set *USED_STDIN |
| 48 | to nonzero if it will actually use STDIN_FD, zero if not, set *ID_PTR to |
| 49 | a unique identification, and set *IS_REMOTE to zero if the job is local, |
| 50 | nonzero if it is remote (meaning *ID_PTR is a process ID). */ |
| 51 | |
| 52 | int |
| 53 | start_remote_job (char **argv UNUSED, char **envp UNUSED, int stdin_fd UNUSED, |
| 54 | int *is_remote UNUSED, pid_t *id_ptr UNUSED, |
| 55 | int *used_stdin UNUSED) |
| 56 | { |
| 57 | return -1; |
| 58 | } |
| 59 | |
| 60 | /* Get the status of a dead remote child. Block waiting for one to die |
| 61 | if BLOCK is nonzero. Set *EXIT_CODE_PTR to the exit status, *SIGNAL_PTR |
| 62 | to the termination signal or zero if it exited normally, and *COREDUMP_PTR |
| 63 | nonzero if it dumped core. Return the ID of the child that died, |
| 64 | 0 if we would have to block and !BLOCK, or < 0 if there were none. */ |
| 65 | |
| 66 | int |
| 67 | remote_status (int *exit_code_ptr UNUSED, int *signal_ptr UNUSED, |
| 68 | int *coredump_ptr UNUSED, int block UNUSED) |
| 69 | { |
| 70 | errno = ECHILD; |
| 71 | return -1; |
| 72 | } |
| 73 | |
| 74 | /* Block asynchronous notification of remote child death. |
| 75 | If this notification is done by raising the child termination |
| 76 | signal, do not block that signal. */ |
| 77 | void |
| 78 | block_remote_children (void) |
| 79 | { |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | /* Restore asynchronous notification of remote child death. |
| 84 | If this is done by raising the child termination signal, |
| 85 | do not unblock that signal. */ |
| 86 | void |
| 87 | unblock_remote_children (void) |
| 88 | { |
| 89 | return; |
| 90 | } |
| 91 | |
| 92 | /* Send signal SIG to child ID. Return 0 if successful, -1 if not. */ |
| 93 | int |
| 94 | remote_kill (pid_t id UNUSED, int sig UNUSED) |
| 95 | { |
| 96 | return -1; |
| 97 | } |