|
ru.unix.bsd- RU.UNIX.BSD ------------------------------------------------------------------ From : Eugene Grosbein 2:5006/1 11 Aug 2007 18:03:42 To : All Subject : softupdates на / -------------------------------------------------------------------------------- Привет! Казалось бы, простой вопрос: как включить softupdates на / для 6.2-STABLE, если они там отключены? / это UFS2. Это, в частности, даёт ускорение make -j3 installworld на две минуты. А следующий патч учит make понимать TMPDIR и позволяет заставить make -j писать свои временные файлы на, скажем, md0, что даёт ускорение более чем на три минуты и повышает эффективность распараллеливания до 93.6% на dual core Pentium-D 2.8Ghz. Hа машинах с небыстрой дисковой подсистемой ускорение в абсолютном выражении должно быть ещё больше. - --- usr.bin/make/job.c.orig 2007-08-11 09:38:05.000000000 +0800 +++ usr.bin/make/job.c 2007-08-11 09:52:43.000000000 +0800 @@ -118,6 +118,7 @@ #include <errno.h> #include <fcntl.h> #include <inttypes.h> +#include <limits.h> #include <string.h> #include <signal.h> #include <stdlib.h> @@ -141,7 +142,7 @@ #include "util.h" #include "var.h" -#define TMPPAT "/tmp/makeXXXXXXXXXX" +#define TMPPAT "makeXXXXXXXXXX" #ifndef USE_KQUEUE /* @@ -240,7 +241,7 @@ */ struct { /* Name of file to which shell output was rerouted */ - char of_outFile[sizeof(TMPPAT)]; + char of_outFile[PATH_MAX]; /* * Stream open to the output file. Used to funnel all @@ -1576,7 +1577,8 @@ Boolean noExec; /* Set true if we decide not to run the job */ int tfd; /* File descriptor for temp file */ LstNode *ln; - char tfile[sizeof(TMPPAT)]; + char tfile[PATH_MAX]; + char *tdir; if (interrupted) { JobPassSig(interrupted); @@ -1617,6 +1619,9 @@ cmdsOK = TRUE; } + if ( (tdir = getenv("TMPDIR")) == NULL ) + tdir = "/tmp"; + /* * If the -n flag wasn't given, we open up OUR (not the child's) * temporary file to stuff commands in it. The thing is rd/wr so we @@ -1632,7 +1637,7 @@ DieHorribly(); } - strcpy(tfile, TMPPAT); + snprintf(tfile, sizeof(tfile), "%s/%s", tdir, TMPPAT); if ((tfd = mkstemp(tfile)) == -1) Punt("Cannot create temp file: %s", strerror(errno)); job->cmdFILE = fdopen(tfd, "w+"); @@ -1811,7 +1816,7 @@ } else { fprintf(stdout, "Remaking `%s'\n", gn->name); fflush(stdout); - strcpy(job->outFile, TMPPAT); + snprintf(job->outFile, sizeof(job->outFile), "%s/%s", tdir, TMPPAT); if ((job->outFd = mkstemp(job->outFile)) == -1) Punt("cannot create temp file: %s", strerror(errno)); Eugene -- For the Colonel's Lady an' Judy O'Grady Are sisters under their skins! --- slrn/0.9.8.1 (FreeBSD) * Origin: Svyaz Service JSC (2:5006/1@fidonet) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.unix.bsd/260938f62e2ed.html, оценка из 5, голосов 10
|