From owner-svn-src-head@FreeBSD.ORG Sun Oct 11 17:04:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62E591065672; Sun, 11 Oct 2009 17:04:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 502328FC15; Sun, 11 Oct 2009 17:04:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9BH4DZT017948; Sun, 11 Oct 2009 17:04:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9BH4DMu017945; Sun, 11 Oct 2009 17:04:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910111704.n9BH4DMu017945@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 11 Oct 2009 17:04:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197965 - in head/tools/regression/sigqueue: sigqtest1 sigqtest2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Oct 2009 17:04:14 -0000 Author: kib Date: Sun Oct 11 17:04:13 2009 New Revision: 197965 URL: http://svn.freebsd.org/changeset/base/197965 Log: Tweaks for sigqueue tests: - slightly adjust code for style, sort headers. - in sigqtest2, print received signals, to make it easy to see why test failed. - in sigqtest2, job_control_test(), cover a race by adding sleep after child stopped itself to allow for SIGCHLD due to stop and exit to not be coalesced. MFC after: 2 weeks Modified: head/tools/regression/sigqueue/sigqtest1/sigqtest1.c head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Modified: head/tools/regression/sigqueue/sigqtest1/sigqtest1.c ============================================================================== --- head/tools/regression/sigqueue/sigqtest1/sigqtest1.c Sun Oct 11 16:52:24 2009 (r197964) +++ head/tools/regression/sigqueue/sigqtest1/sigqtest1.c Sun Oct 11 17:04:13 2009 (r197965) @@ -1,12 +1,14 @@ /* $FreeBSD$ */ -#include -#include #include #include +#include +#include +#include int received; -void handler(int sig, siginfo_t *si, void *ctx) +void +handler(int sig, siginfo_t *si, void *ctx) { if (si->si_code != SI_QUEUE) errx(1, "si_code != SI_QUEUE"); @@ -15,7 +17,8 @@ void handler(int sig, siginfo_t *si, voi received++; } -int main() +int +main() { struct sigaction sa; union sigval val; Modified: head/tools/regression/sigqueue/sigqtest2/sigqtest2.c ============================================================================== --- head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Sun Oct 11 16:52:24 2009 (r197964) +++ head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Sun Oct 11 17:04:13 2009 (r197965) @@ -1,24 +1,29 @@ /* $FreeBSD$ */ -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include int stop_received; int exit_received; int cont_received; -void job_handler(int sig, siginfo_t *si, void *ctx) +void +job_handler(int sig, siginfo_t *si, void *ctx) { int status; int ret; if (si->si_code == CLD_STOPPED) { + printf("%d: stop received\n", si->si_pid); stop_received = 1; kill(si->si_pid, SIGCONT); } else if (si->si_code == CLD_EXITED) { + printf("%d: exit received\n", si->si_pid); ret = waitpid(si->si_pid, &status, 0); if (ret == -1) errx(1, "waitpid"); @@ -26,11 +31,13 @@ void job_handler(int sig, siginfo_t *si, errx(1, "!WIFEXITED(status)"); exit_received = 1; } else if (si->si_code == CLD_CONTINUED) { + printf("%d: cont received\n", si->si_pid); cont_received = 1; } } -void job_control_test() +void +job_control_test(void) { struct sigaction sa; pid_t pid; @@ -43,9 +50,12 @@ void job_control_test() stop_received = 0; cont_received = 0; exit_received = 0; + fflush(stdout); pid = fork(); if (pid == 0) { + printf("child %d\n", getpid()); kill(getpid(), SIGSTOP); + sleep(2); exit(1); } @@ -60,11 +70,13 @@ void job_control_test() printf("job control test OK.\n"); } -void rtsig_handler(int sig, siginfo_t *si, void *ctx) +void +rtsig_handler(int sig, siginfo_t *si, void *ctx) { } -int main() +int +main() { struct sigaction sa; sigset_t set;