From owner-freebsd-questions@FreeBSD.ORG Wed Jul 27 14:39:20 2005 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0A37E16A420 for ; Wed, 27 Jul 2005 14:39:20 +0000 (GMT) (envelope-from benlutz@datacomm.ch) Received: from maxlor.mine.nu (c-213-160-32-54.customer.ggaweb.ch [213.160.32.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 578DA43D49 for ; Wed, 27 Jul 2005 14:39:19 +0000 (GMT) (envelope-from benlutz@datacomm.ch) Received: from localhost (localhost [127.0.0.1]) by maxlor.mine.nu (Postfix) with ESMTP id 7A40A3A1; Wed, 27 Jul 2005 16:39:18 +0200 (CEST) Received: from maxlor.mine.nu ([127.0.0.1]) by localhost (midgard [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21344-09; Wed, 27 Jul 2005 16:39:17 +0200 (CEST) Received: from merlin.intranet (merlin.intranet [10.0.0.16]) by maxlor.mine.nu (Postfix) with ESMTP id 48C1EC1; Wed, 27 Jul 2005 16:39:17 +0200 (CEST) From: Benjamin Lutz To: questions@freebsd.org Date: Wed, 27 Jul 2005 16:39:12 +0200 User-Agent: KMail/1.8.1 MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1266737.UTpq9LBA3a"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200507271639.17254.benlutz@datacomm.ch> X-Virus-Scanned: by amavisd-new at maxlor.mine.nu Cc: andre@sneakymustard.com Subject: Problems with make -j X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2005 14:39:20 -0000 --nextPart1266737.UTpq9LBA3a Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello, As a pet project I've started to change /etc/rc so it uses make(1) to=20 execute the scripts in /etc/rc.d instead of executing them one after the=20 other like the standard /etc/rc does. The goal of the project is to speed=20 up boot time by executing rc.d scripts in parallel. Now, if I don't specify a -j parameter this works just fine. I've written=20 a script that generates a Makefile with all the rc.d dependencies in it,=20 and using that the system boots just fine. As soon as I add a -j parameter to make, even -j 1, things break though.=20 Scripts (eg, rc.subr) are being spewed to the screen several times, and=20 execution hangs at /etc/rc.d/adjkerntz (I think). I can pipe all this to=20 a log file with > make.log 2>&1. By the time make gets to adjkerntz and I=20 ctrl-c it, the logfile is slightly above 3MB. Can anyone tell me why make behaves like this? If I had to guess I'd say=20 something's happening to the file descriptors, or something that make=20 needs for -j to work has not been set up. Btw, I have set up a memory=20 disk in /etc/tmp that make can use for -j (and I've patched make to use=20 that patch). Here's what I use in /etc/rc now: =3D=3D=3D=3D=3D SNIPPET START =3D=3D=3D=3D=3D RC_MAKE=3D"1" if [ -z "$RC_MAKE" ]; then =A0 =A0 =A0 =A0 skip=3D"-s nostart" =A0 =A0 =A0 =A0 [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && \ =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0skip=3D"$skip -s nojail" =A0 =A0 =A0 =A0 files=3D`rcorder ${skip} /etc/rc.d/* 2>/dev/null` =A0 =A0 =A0 =A0 for _rc_elem in ${files}; do =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 run_rc_script ${_rc_elem} ${_boot} =A0 =A0 =A0 =A0 done else =A0 =A0 =A0 =A0 skip=3D"-DSKIP -DNOSTART" =A0 =A0 =A0 =A0 [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && \ =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0skip=3D"$skip -DNOJAIL" =A0 =A0 =A0 =A0 /sbin/mdmfs -M -S -o sync -s 5m md0 /etc/tmp =A0 =A0 =A0 =A0 /bin/rc_make -i -f /etc/Makefile ${skip} PARAM=3D${_boot} =A0 =A0 =A0 =A0 /sbin/umount /dev/md0 =A0 =A0 =A0 =A0 /sbin/mdconfig -d -u md0 fi =3D=3D=3D=3D=3D SNIPPET END =3D=3D=3D=3D=3D Here's two example targets from the /etc/Makefile: =3D=3D=3D=3D=3D SNIPPET START =3D=3D=3D=3D=3D abi! LOGIN archdep =2Eifdef !KEEP || NOJAIL =2Eifdef !SKIP || (!NOJAIL) =A0 =A0 =A0 =A0 . /etc/rc.subr && run_rc_script /etc/rc.d/abi ${PARAM} =2Eendif =2Eendif accounting! mountcritremote =2Eifdef !KEEP || NOJAIL =2Eifdef !SKIP || (!NOJAIL) =A0 =A0 =A0 =A0 . /etc/rc.subr && run_rc_script /etc/rc.d/accounting ${PARA= M} =2Eendif =2Eendif =3D=3D=3D=3D=3D SNIPPET END =3D=3D=3D=3D=3D This currently works. As soon as I add "-j 1" or "-j 2" to the rc_make=20 call above, I get the behaviour described above. Note that rc_make is standard make(1) except that TMPPAT has been changed=20 from /tmp to /etc/tmp. Cheers Benjamin --nextPart1266737.UTpq9LBA3a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQBC55yVgShs4qbRdeQRAnNqAJ0Rn+sldnmhKz8lCmRQvntJ2/W7/wCfd710 3hVqvfU0LcbVw3Apl1kuBWU= =CtOa -----END PGP SIGNATURE----- --nextPart1266737.UTpq9LBA3a--