1 /* Template for the remote job exportation interface to GNU Make.
2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
4 2010 Free Software Foundation, Inc.
5 This file is part of GNU Make.
6 
7 GNU Make is free software; you can redistribute it and/or modify it under the
8 terms of the GNU General Public License as published by the Free Software
9 Foundation; either version 3 of the License, or (at your option) any later
10 version.
11 
12 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License along with
17 this program.  If not, see <http://www.gnu.org/licenses/>.  */
18 
19 #include "make.h"
20 #include "filedef.h"
21 #include "job.h"
22 #include "commands.h"
23 
24 
25 char *remote_description = 0;
26 
27 /* Call once at startup even if no commands are run.  */
28 
29 void
remote_setup(void)30 remote_setup (void)
31 {
32 }
33 
34 /* Called before exit.  */
35 
36 void
remote_cleanup(void)37 remote_cleanup (void)
38 {
39 }
40 
41 /* Return nonzero if the next job should be done remotely.  */
42 
43 int
start_remote_job_p(int first_p UNUSED)44 start_remote_job_p (int first_p UNUSED)
45 {
46   return 0;
47 }
48 
49 /* Start a remote job running the command in ARGV,
50    with environment from ENVP.  It gets standard input from STDIN_FD.  On
51    failure, return nonzero.  On success, return zero, and set *USED_STDIN
52    to nonzero if it will actually use STDIN_FD, zero if not, set *ID_PTR to
53    a unique identification, and set *IS_REMOTE to zero if the job is local,
54    nonzero if it is remote (meaning *ID_PTR is a process ID).  */
55 
56 int
start_remote_job(char ** argv UNUSED,char ** envp UNUSED,int stdin_fd UNUSED,int * is_remote UNUSED,int * id_ptr UNUSED,int * used_stdin UNUSED)57 start_remote_job (char **argv UNUSED, char **envp UNUSED, int stdin_fd UNUSED,
58                   int *is_remote UNUSED, int *id_ptr UNUSED,
59                   int *used_stdin UNUSED)
60 {
61   return -1;
62 }
63 
64 /* Get the status of a dead remote child.  Block waiting for one to die
65    if BLOCK is nonzero.  Set *EXIT_CODE_PTR to the exit status, *SIGNAL_PTR
66    to the termination signal or zero if it exited normally, and *COREDUMP_PTR
67    nonzero if it dumped core.  Return the ID of the child that died,
68    0 if we would have to block and !BLOCK, or < 0 if there were none.  */
69 
70 int
remote_status(int * exit_code_ptr UNUSED,int * signal_ptr UNUSED,int * coredump_ptr UNUSED,int block UNUSED)71 remote_status (int *exit_code_ptr UNUSED, int *signal_ptr UNUSED,
72                int *coredump_ptr UNUSED, int block UNUSED)
73 {
74   errno = ECHILD;
75   return -1;
76 }
77 
78 /* Block asynchronous notification of remote child death.
79    If this notification is done by raising the child termination
80    signal, do not block that signal.  */
81 void
block_remote_children(void)82 block_remote_children (void)
83 {
84   return;
85 }
86 
87 /* Restore asynchronous notification of remote child death.
88    If this is done by raising the child termination signal,
89    do not unblock that signal.  */
90 void
unblock_remote_children(void)91 unblock_remote_children (void)
92 {
93   return;
94 }
95 
96 /* Send signal SIG to child ID.  Return 0 if successful, -1 if not.  */
97 int
remote_kill(int id UNUSED,int sig UNUSED)98 remote_kill (int id UNUSED, int sig UNUSED)
99 {
100   return -1;
101 }
102