Hang on ctrl+Z after the MPSAFE tsleep/wakeup commit

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Thu Dec 1 05:04:17 PST 2005


Hello.
After the following commit, stopping a user process with SIGSTOP
does not give control to the shell:
http://leaf.dragonflybsd.org/mailarchive/commits/2005-11/msg00109.html
It only happens with a program which does fork() inside it.  Here's
a simple program to demonstrate this.

$ cat a.c
#include <sys/types.h>
#include <sys/wait.h>
#include <err.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
main(int ac __unused, char **av)
{
	pid_t pid;
	int rc = -1;

	switch ((pid = fork())) {
	case -1:		/* error */
		err(1, "fork");
		break;
	case 0:			/* child */
		return execvp(av[1], av + 1);
	default:
		wait(&rc);
		break;
	}
	if (rc != 0)
		errx(1, "child returned %d", rc);
	return 0;
}

$ gcc -g -Wall a.c && ./a.out cat
(press ctrl+Z here, and it accepts no other signals until you send
SIGCONT to the child process from another screen)

`ps' command shows that the stuck processes are marked as "TL+"
(meaning that they didn't give up even after having been stopped?).





More information about the Bugs mailing list