425 /*
426 Avo_DmakeCommand *tmp_dmake_command;
427
428 tmp_dmake_command = new Avo_DmakeCommand(orig_cmd_line, cmd_options);
429 dmake_job_msg->appendCmd(tmp_dmake_command);
430 delete tmp_dmake_command;
431 */
432 dmake_job_msg->appendCmd(new Avo_DmakeCommand(orig_cmd_line, cmd_options));
433 }
434 #endif
435
436 #ifdef TEAMWARE_MAKE_CMN
437 #define MAXJOBS_ADJUST_RFE4694000
438
439 #ifdef MAXJOBS_ADJUST_RFE4694000
440
441 #include <unistd.h> /* sysconf(_SC_NPROCESSORS_ONLN) */
442 #include <sys/ipc.h> /* ftok() */
443 #include <sys/shm.h> /* shmget(), shmat(), shmdt(), shmctl() */
444 #include <semaphore.h> /* sem_init(), sem_trywait(), sem_post(), sem_destroy() */
445 #if defined(linux)
446 #define LOADAVG_1MIN 0
447 #else
448 #include <sys/loadavg.h> /* getloadavg() */
449 #endif /* linux */
450
451 /*
452 * adjust_pmake_max_jobs (int pmake_max_jobs)
453 *
454 * Parameters:
455 * pmake_max_jobs - max jobs limit set by user
456 *
457 * External functions used:
458 * sysconf()
459 * getloadavg()
460 */
461 static int
462 adjust_pmake_max_jobs (int pmake_max_jobs)
463 {
464 static int ncpu = 0;
465 double loadavg[3];
466 int adjustment;
467 int adjusted_max_jobs;
468
469 if (ncpu <= 0) {
2157 if (length >= MAXPATHLEN*MB_LEN_MAX/2) { // sizeof(mbs_buffer) / 2
2158 cmd = tmp_mbs_buffer = getmem((length * MB_LEN_MAX * 2) + 1);
2159 (void) wcstombs(tmp_mbs_buffer, to, (length * MB_LEN_MAX * 2) + 1);
2160 } else {
2161 WCSTOMBS(mbs_buffer, to);
2162 cmd = mbs_buffer;
2163 }
2164 char *mbst, *mbend;
2165 if ((length > 0) &&
2166 !silent_flag) {
2167 for (mbst = cmd; (mbend = strstr(mbst, "\\\n")) != NULL; mbst = mbend + 2) {
2168 *mbend = '\0';
2169 DO_CHECK(fprintf(scrfp, NOCATGETS("/usr/bin/printf '%%s\\n' %s\\\\\n"), mbst));
2170 *mbend = '\\';
2171 }
2172 DO_CHECK(fprintf(scrfp, NOCATGETS("/usr/bin/printf '%%s\\n' %s\n"), mbst));
2173 }
2174 if (!do_not_exec_rule ||
2175 !working_on_targets ||
2176 always_exec) {
2177 #if defined(linux)
2178 if (0 != strcmp(shell->string_mb, (char*)NOCATGETS("/bin/sh"))) {
2179 DO_CHECK(fprintf(scrfp, NOCATGETS("%s -c %s\n"), shell->string_mb, cmd));
2180 } else
2181 #endif
2182 DO_CHECK(fprintf(scrfp, NOCATGETS("%s -ce %s\n"), shell->string_mb, cmd));
2183 DO_CHECK(fputs(NOCATGETS("__DMAKECMDEXITSTAT=$?\nif [ ${__DMAKECMDEXITSTAT} -ne 0 ]; then\n"), scrfp));
2184 if (ignore) {
2185 DO_CHECK(fprintf(scrfp, NOCATGETS("\techo %s ${__DMAKECMDEXITSTAT} %s\n"),
2186 catgets(catd, 1, 343, "\"*** Error code"),
2187 catgets(catd, 1, 344, "(ignored)\"")));
2188 } else {
2189 DO_CHECK(fprintf(scrfp, NOCATGETS("\techo %s ${__DMAKECMDEXITSTAT}\n"),
2190 catgets(catd, 1, 342, "\"*** Error code\"")));
2191 }
2192 if (silent_flag) {
2193 DO_CHECK(fprintf(scrfp, NOCATGETS("\techo %s\n"),
2194 catgets(catd, 1, 345, "The following command caused the error:")));
2195 for (mbst = cmd; (mbend = strstr(mbst, "\\\n")) != NULL; mbst = mbend + 2) {
2196 *mbend = '\0';
2197 DO_CHECK(fprintf(scrfp, NOCATGETS("\t/usr/bin/printf '%%s\\n' %s\\\\\n"), mbst));
2198 *mbend = '\\';
2199 }
2200 DO_CHECK(fprintf(scrfp, NOCATGETS("\t/usr/bin/printf '%%s\\n' %s\n"), mbst));
2201 }
|
425 /*
426 Avo_DmakeCommand *tmp_dmake_command;
427
428 tmp_dmake_command = new Avo_DmakeCommand(orig_cmd_line, cmd_options);
429 dmake_job_msg->appendCmd(tmp_dmake_command);
430 delete tmp_dmake_command;
431 */
432 dmake_job_msg->appendCmd(new Avo_DmakeCommand(orig_cmd_line, cmd_options));
433 }
434 #endif
435
436 #ifdef TEAMWARE_MAKE_CMN
437 #define MAXJOBS_ADJUST_RFE4694000
438
439 #ifdef MAXJOBS_ADJUST_RFE4694000
440
441 #include <unistd.h> /* sysconf(_SC_NPROCESSORS_ONLN) */
442 #include <sys/ipc.h> /* ftok() */
443 #include <sys/shm.h> /* shmget(), shmat(), shmdt(), shmctl() */
444 #include <semaphore.h> /* sem_init(), sem_trywait(), sem_post(), sem_destroy() */
445 #include <sys/loadavg.h> /* getloadavg() */
446
447 /*
448 * adjust_pmake_max_jobs (int pmake_max_jobs)
449 *
450 * Parameters:
451 * pmake_max_jobs - max jobs limit set by user
452 *
453 * External functions used:
454 * sysconf()
455 * getloadavg()
456 */
457 static int
458 adjust_pmake_max_jobs (int pmake_max_jobs)
459 {
460 static int ncpu = 0;
461 double loadavg[3];
462 int adjustment;
463 int adjusted_max_jobs;
464
465 if (ncpu <= 0) {
2153 if (length >= MAXPATHLEN*MB_LEN_MAX/2) { // sizeof(mbs_buffer) / 2
2154 cmd = tmp_mbs_buffer = getmem((length * MB_LEN_MAX * 2) + 1);
2155 (void) wcstombs(tmp_mbs_buffer, to, (length * MB_LEN_MAX * 2) + 1);
2156 } else {
2157 WCSTOMBS(mbs_buffer, to);
2158 cmd = mbs_buffer;
2159 }
2160 char *mbst, *mbend;
2161 if ((length > 0) &&
2162 !silent_flag) {
2163 for (mbst = cmd; (mbend = strstr(mbst, "\\\n")) != NULL; mbst = mbend + 2) {
2164 *mbend = '\0';
2165 DO_CHECK(fprintf(scrfp, NOCATGETS("/usr/bin/printf '%%s\\n' %s\\\\\n"), mbst));
2166 *mbend = '\\';
2167 }
2168 DO_CHECK(fprintf(scrfp, NOCATGETS("/usr/bin/printf '%%s\\n' %s\n"), mbst));
2169 }
2170 if (!do_not_exec_rule ||
2171 !working_on_targets ||
2172 always_exec) {
2173 DO_CHECK(fprintf(scrfp, NOCATGETS("%s -ce %s\n"), shell->string_mb, cmd));
2174 DO_CHECK(fputs(NOCATGETS("__DMAKECMDEXITSTAT=$?\nif [ ${__DMAKECMDEXITSTAT} -ne 0 ]; then\n"), scrfp));
2175 if (ignore) {
2176 DO_CHECK(fprintf(scrfp, NOCATGETS("\techo %s ${__DMAKECMDEXITSTAT} %s\n"),
2177 catgets(catd, 1, 343, "\"*** Error code"),
2178 catgets(catd, 1, 344, "(ignored)\"")));
2179 } else {
2180 DO_CHECK(fprintf(scrfp, NOCATGETS("\techo %s ${__DMAKECMDEXITSTAT}\n"),
2181 catgets(catd, 1, 342, "\"*** Error code\"")));
2182 }
2183 if (silent_flag) {
2184 DO_CHECK(fprintf(scrfp, NOCATGETS("\techo %s\n"),
2185 catgets(catd, 1, 345, "The following command caused the error:")));
2186 for (mbst = cmd; (mbend = strstr(mbst, "\\\n")) != NULL; mbst = mbend + 2) {
2187 *mbend = '\0';
2188 DO_CHECK(fprintf(scrfp, NOCATGETS("\t/usr/bin/printf '%%s\\n' %s\\\\\n"), mbst));
2189 *mbend = '\\';
2190 }
2191 DO_CHECK(fprintf(scrfp, NOCATGETS("\t/usr/bin/printf '%%s\\n' %s\n"), mbst));
2192 }
|