kBuild的更動 3138 路徑 vendor/gnumake/current/remote-cstms.c
- 時間撮記:
- 2018-3-12 下午07:32:29 (7 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
vendor/gnumake/current/remote-cstms.c
r2596 r3138 4 4 the Make maintainers. 5 5 6 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 7 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 8 2010 Free Software Foundation, Inc. 6 Copyright (C) 1988-2016 Free Software Foundation, Inc. 9 7 This file is part of GNU Make. 10 8 … … 21 19 this program. If not, see <http://www.gnu.org/licenses/>. */ 22 20 23 #include "make.h" 24 #include "job.h" 21 #include "makeint.h" 25 22 #include "filedef.h" 26 23 #include "commands.h" … … 35 32 char *remote_description = "Customs"; 36 33 37 /* File name of the Customs `export' client command.34 /* File name of the Customs 'export' client command. 38 35 A full path name can be used to avoid some path-searching overhead. */ 39 #define EXPORT_COMMAND"/usr/local/bin/export"36 #define EXPORT_COMMAND "/usr/local/bin/export" 40 37 41 38 /* ExportPermit gotten by start_remote_job_p, and used by start_remote_job. */ … … 80 77 81 78 /* For secure Customs, make is installed setuid root and 82 79 Customs requires a privileged source port be used. */ 83 80 make_access (); 84 81 85 82 if (ISDB (DB_JOBS)) 86 Rpc_Debug (1);83 Rpc_Debug (1); 87 84 88 85 /* Ping the daemon once to see if it is there. */ … … 93 90 94 91 if (starting_directory == 0) 95 96 92 /* main couldn't figure it out. */ 93 inited = -1; 97 94 else 98 99 100 101 102 103 104 105 106 107 108 95 { 96 /* Normalize the current directory path name to something 97 that should work on all machines exported to. */ 98 99 normalized_cwd = xmalloc (GET_PATH_MAX); 100 strcpy (normalized_cwd, starting_directory); 101 if (Customs_NormPath (normalized_cwd, GET_PATH_MAX) < 0) 102 /* Path normalization failure means using Customs 103 won't work, but it's not really an error. */ 104 inited = -1; 105 } 109 106 } 110 107 … … 114 111 njobs = job_slots_used; 115 112 if (!first_p) 116 njobs -= 1; 113 njobs -= 1; /* correction for being called from reap_children() */ 117 114 118 115 /* the first job should run locally, or, if the -l flag is given, we use … … 157 154 if (retsock < 0) 158 155 { 159 error (NILF, "exporting: Couldn't create return socket.");156 O (error, NILF, "exporting: Couldn't create return socket."); 160 157 return 1; 161 158 } … … 176 173 /* Create a WayBill to give to the server. */ 177 174 len = Customs_MakeWayBill (&permit, normalized_cwd, argv[0], argv, 178 179 180 /* Modify the waybill as if the remote child had done `child_access ()'. */175 envp, retport, waybill); 176 177 /* Modify the waybill as if the remote child had done 'child_access ()'. */ 181 178 { 182 179 WayBill *wb = (WayBill *) waybill; … … 192 189 sin.sin_addr = permit.addr; 193 190 status = Rpc_Call (sock, &sin, (Rpc_Proc) CUSTOMS_IMPORT, 194 len, (Rpc_Opaque) waybill, 195 sizeof(msg), (Rpc_Opaque) msg, 196 1, &timeout); 197 198 host = gethostbyaddr((char *)&permit.addr, sizeof(permit.addr), AF_INET); 199 200 if (status != RPC_SUCCESS) 201 { 202 (void) close (retsock); 203 (void) close (sock); 204 error (NILF, "exporting to %s: %s", 205 host ? host->h_name : inet_ntoa (permit.addr), 206 Rpc_ErrorMessage (status)); 207 return 1; 208 } 209 else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0') 210 { 211 (void) close (retsock); 212 (void) close (sock); 213 error (NILF, "exporting to %s: %s", 214 host ? host->h_name : inet_ntoa (permit.addr), 215 msg); 216 return 1; 217 } 218 else 219 { 220 error (NILF, "*** exported to %s (id %u)", 221 host ? host->h_name : inet_ntoa (permit.addr), 222 permit.id); 223 } 224 225 fflush (stdout); 226 fflush (stderr); 191 len, (Rpc_Opaque) waybill, 192 sizeof (msg), (Rpc_Opaque) msg, 193 1, &timeout); 194 195 host = gethostbyaddr ((char *)&permit.addr, sizeof(permit.addr), AF_INET); 196 197 { 198 const char *hnm = host ? host->h_name : inet_ntoa (permit.addr); 199 size_t hlen = strlen (hnm); 200 201 if (status != RPC_SUCCESS) 202 { 203 const char *err = Rpc_ErrorMessage (status); 204 (void) close (retsock); 205 (void) close (sock); 206 error (NILF, hlen + strlen (err), 207 "exporting to %s: %s", hnm, err); 208 return 1; 209 } 210 else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0') 211 { 212 (void) close (retsock); 213 (void) close (sock); 214 error (NILF, hlen + strlen (msg), "exporting to %s: %s", hnm, msg); 215 return 1; 216 } 217 else 218 { 219 error (NILF, hlen + INTSTR_LENGTH, 220 "*** exported to %s (id %u)", hnm, permit.id); 221 } 222 223 fflush (stdout); 224 fflush (stderr); 225 } 227 226 228 227 pid = vfork (); … … 230 229 { 231 230 /* The fork failed! */ 232 perror_with_name (" vfork", "");231 perror_with_name ("fork", ""); 233 232 return 1; 234 233 } 235 234 else if (pid == 0) 236 235 { 237 /* Child side. Run `export' to handle the connection. */236 /* Child side. Run 'export' to handle the connection. */ 238 237 static char sock_buf[20], retsock_buf[20], id_buf[20]; 239 238 static char *new_argv[6] = 240 239 { EXPORT_COMMAND, "-id", sock_buf, retsock_buf, id_buf, 0 }; 241 240 242 241 /* Set up the arguments. */ … … 247 246 /* Get the right stdin. */ 248 247 if (stdin_fd != 0) 249 248 (void) dup2 (stdin_fd, 0); 250 249 251 250 /* Unblock signals in the child. */ … … 256 255 } 257 256 258 /* Parent side. Return the `export' process's ID. */257 /* Parent side. Return the 'export' process's ID. */ 259 258 (void) close (retsock); 260 259 (void) close (sock);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器