Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 2002 12:39:15 +1000
From:      Tim Robbins <tjr@FreeBSD.ORG>
To:        current@FreeBSD.ORG
Subject:   Signal handling changes
Message-ID:  <20020829123915.A78090@dilbert.robbins.dropbear.id.au>

next in thread | raw e-mail | index | archive | help
It looks like there are still problems with SIGSTOP/SIGCONT signal handling.
With a kernel/world from August 24 and using csh or sh (choice of shell
is probably not relevant), running "sleep 30" then suspending it with ^Z
then continuing it with "fg" causes the "sleep" process to exit as soon
as it's continued, instead of sleeping for the remainder of the interval
as it does on 4.6.2.

Here's a test program that demonstrates what I mean.. the sleep(1) call in
the parent process is just to avoid a race and isn't part of the bug.

4.6.2-RELEASE i386
5.0-CURRENT i386 built July 1
5.0-CURRENT alpha built July 19
OpenBSD 2.9 i386
SunOS 5.7 sparc

	$ ./a.out
	30.000000 seconds elapsed


5.0-CURRENT i386 built August 24:

	$ ./a.out
	1.000000 seconds elapsed

(wish I had more datapoints for the `broken' case)


#include <err.h>
#include <signal.h>
#include <time.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
	pid_t pid;
	int status;
	time_t before, after;

	time(&before);
	if ((pid = fork()) == -1)
		err(1, "fork");
	else if (pid == 0) {
		sleep(30);
		_exit(0);
	}

	sleep(1);
	kill(pid, SIGSTOP);
	kill(pid, SIGCONT);
	while (wait(&status) != pid)
		;
	time(&after);
	printf("%f seconds elapsed\n", difftime(after, before));

	exit(0);
}

My first idea was that it had something to do with siginterrupt(), but
errno == 0 after the sleep(3) returns prematurely.


Tim

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020829123915.A78090>