25
26 #ifdef DISTRIBUTED
27 /*
28 * dist.cc
29 *
30 * Deal with the distributed processing
31 */
32
33 #include <avo/err.h>
34 #include <avo/find_dir.h>
35 #include <avo/util.h>
36 #include <dm/Avo_AcknowledgeMsg.h>
37 #include <dm/Avo_DoJobMsg.h>
38 #include <dm/Avo_JobResultMsg.h>
39 #include <mk/defs.h>
40 #include <mksh/misc.h> /* getmem() */
41 #include <rw/pstream.h>
42 #include <rw/queuecol.h>
43 #include <rw/xdrstrea.h>
44 #include <signal.h>
45 #ifdef linux
46 #include <sstream>
47 using namespace std;
48 #else
49 #include <strstream.h>
50 #endif
51 #include <sys/stat.h> /* stat() */
52 #include <sys/types.h>
53 #include <sys/wait.h>
54 #include <unistd.h>
55 #include <errno.h>
56
57 /*
58 * Defined macros
59 */
60
61 #define AVO_BLOCK_INTERUPTS sigfillset(&newset) ; \
62 sigprocmask(SIG_SETMASK, &newset, &oldset)
63
64 #define AVO_UNBLOCK_INTERUPTS \
65 sigprocmask(SIG_SETMASK, &oldset, &newset)
66
67
68 /*
69 * typedefs & structs
70 */
247 }
248 MBSTOWCS(wcs_buffer, NOCATGETS("DMAKE_ODIR"));
249 dmake_name = GETNAME(wcs_buffer, FIND_LENGTH);
250 if (((prop = get_prop(dmake_name->prop, macro_prop)) != NULL) &&
251 ((dmake_value = prop->body.macro.value) != NULL)) {
252 (void) sprintf(&rxm_command[strlen(rxm_command)],
253 NOCATGETS(" -o %s"),
254 dmake_value->string_mb);
255 } else {
256 length = 2 + strlen(NOCATGETS("DMAKE_ODIR"));
257 env = getmem(length);
258 (void) sprintf(env,
259 "%s=",
260 NOCATGETS("DMAKE_ODIR"));
261 (void) putenv(env);
262 }
263
264 (void) sprintf(&rxm_command[strlen(rxm_command)],
265 NOCATGETS(" %d %d"),
266 pipe1[0], pipe2[1]);
267 #ifdef linux
268 execl(NOCATGETS("/bin/sh"),
269 #else
270 execl(NOCATGETS("/usr/bin/sh"),
271 #endif
272 NOCATGETS("sh"),
273 NOCATGETS("-c"),
274 rxm_command,
275 (char *)NULL);
276 _exit(127);
277 }
278 }
279
280 /*
281 * static void
282 * set_dmake_env_vars()
283 *
284 * Sets the DMAKE_* environment variables for rxm and rxs.
285 * DMAKE_PWD
286 * DMAKE_NPWD
287 * DMAKE_UMASK
288 * DMAKE_SHELL
289 */
290 static void
291 set_dmake_env_vars()
|
25
26 #ifdef DISTRIBUTED
27 /*
28 * dist.cc
29 *
30 * Deal with the distributed processing
31 */
32
33 #include <avo/err.h>
34 #include <avo/find_dir.h>
35 #include <avo/util.h>
36 #include <dm/Avo_AcknowledgeMsg.h>
37 #include <dm/Avo_DoJobMsg.h>
38 #include <dm/Avo_JobResultMsg.h>
39 #include <mk/defs.h>
40 #include <mksh/misc.h> /* getmem() */
41 #include <rw/pstream.h>
42 #include <rw/queuecol.h>
43 #include <rw/xdrstrea.h>
44 #include <signal.h>
45 #include <strstream.h>
46 #include <sys/stat.h> /* stat() */
47 #include <sys/types.h>
48 #include <sys/wait.h>
49 #include <unistd.h>
50 #include <errno.h>
51
52 /*
53 * Defined macros
54 */
55
56 #define AVO_BLOCK_INTERUPTS sigfillset(&newset) ; \
57 sigprocmask(SIG_SETMASK, &newset, &oldset)
58
59 #define AVO_UNBLOCK_INTERUPTS \
60 sigprocmask(SIG_SETMASK, &oldset, &newset)
61
62
63 /*
64 * typedefs & structs
65 */
242 }
243 MBSTOWCS(wcs_buffer, NOCATGETS("DMAKE_ODIR"));
244 dmake_name = GETNAME(wcs_buffer, FIND_LENGTH);
245 if (((prop = get_prop(dmake_name->prop, macro_prop)) != NULL) &&
246 ((dmake_value = prop->body.macro.value) != NULL)) {
247 (void) sprintf(&rxm_command[strlen(rxm_command)],
248 NOCATGETS(" -o %s"),
249 dmake_value->string_mb);
250 } else {
251 length = 2 + strlen(NOCATGETS("DMAKE_ODIR"));
252 env = getmem(length);
253 (void) sprintf(env,
254 "%s=",
255 NOCATGETS("DMAKE_ODIR"));
256 (void) putenv(env);
257 }
258
259 (void) sprintf(&rxm_command[strlen(rxm_command)],
260 NOCATGETS(" %d %d"),
261 pipe1[0], pipe2[1]);
262 execl(NOCATGETS("/usr/bin/sh"),
263 NOCATGETS("sh"),
264 NOCATGETS("-c"),
265 rxm_command,
266 (char *)NULL);
267 _exit(127);
268 }
269 }
270
271 /*
272 * static void
273 * set_dmake_env_vars()
274 *
275 * Sets the DMAKE_* environment variables for rxm and rxs.
276 * DMAKE_PWD
277 * DMAKE_NPWD
278 * DMAKE_UMASK
279 * DMAKE_SHELL
280 */
281 static void
282 set_dmake_env_vars()
|