Subject: /bin/sh "Cannot vfork" behaviour
To: None <tech-userlevel@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-userlevel
Date: 10/27/2003 11:14:25
What is the following command supposed to do if the maxproc limit is
exceeded?

	$ /bin/sh -c "set -x ; ulimit -p 1 ; date || exit 75" ; \
			echo status=$?
	+ ulimit -p 1
	+ date
	Cannot vfork
	status=2

Is it a bug that the exit status is 2 rather than 75?

By the way, the following command works as I expected:

	$ /bin/sh -c "set -x ; es=75 ; trap 'exit \$es' 0 ; \
			ulimit -p 1 ; date && es=0" ; echo status=$?
	+ es=75
	+ trap exit $es 0
	+ ulimit -p 1
	+ date
	Cannot vfork
	+ exit 75
	status=75

--apb (Alan Barrett)