Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 1999 06:34:22 -0700 (PDT)
From:      kwchen@lucent.com
To:        freebsd-gnats-submit@freebsd.org
Subject:   kern/13075: signal is not posted for async I/O on raw devices
Message-ID:  <19990811133422.4197A14D2E@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         13075
>Category:       kern
>Synopsis:       signal is not posted for async I/O on raw devices
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 11 06:40:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     K. Herman Chen
>Release:        FreeBSD 3.2-RELEASE #6
>Organization:
Lucent Technologies
>Environment:
FreeBSD marlin 3.2-RELEASE FreeBSD 3.2-RELEASE #6: Mon Jul 19
 16:16:40 EDT 1999     lin@tampa:/usr/src/sys/compile/SMASH-CS-32  i386
>Description:
The following program (~60 lines) does not get a SIGUSR1 when used with a raw device,
but does get the signal with a block device. It will wait forever for a
signal (pause()); doing "kill -30 <pid>" from shell prompt will cause it
to execute sigusr1() and display the data it just read and the data seemed
correct.

BTW, how do I identify a specific AIO job with each signal? Are signals
queued in FreeBSD? Thanks very much.

#include <stdio.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <time.h>
#include <aio.h>

aiocb_t         myaiocb;
siginfo_t       siginfo;
char            buf[10240];

sig_t
sigusr1(int signo)
{
        int i;
        printf("in sigusr1(), signo = %d\n", signo);
        printf("aio_error(myaiocb): %d\n", aio_error(&myaiocb));
#if 0
        printf("aio buffer after read: %s\n", buf);
        for (i = 0; i < 500; i++) printf(" %c", buf[i]);
        printf("\n");
}

main(argc, argv)
int     argc;
char**  argv;
{
        int rtn;
        int fd;

        /* signal is not posted on raw partition, but okay on block device */
        fd = open("/dev/rwd0s4e", O_RDONLY);
        /* fd = open("/dev/wd0s4e", O_RDONLY);  this works. */
        if (fd < 0) {
                perror("open failed");
                exit(1);
        }
        printf("open succeeded ...\n");
        signal(SIGUSR1, (sig_t) sigusr1);
        myaiocb.aio_fildes = fd;
        myaiocb.aio_buf = buf;
        myaiocb.aio_nbytes = 2048;

        myaiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
        myaiocb.aio_sigevent.sigev_signo = SIGUSR1;
        myaiocb.aio_sigevent.sigev_value.sival_int = 123;

        printf("calling aio_read ...\n");
        rtn = aio_read(&myaiocb);
        if (rtn < 0) {
                perror("aio_read failed");
                exit(1);
        }
        printf("aio_read succeeded\n");

        /* normally get EINPROGRESS */
        printf("aio_error(myaiocb): %d\n", aio_error(&myaiocb));

        pause();
}

>How-To-Repeat:
The above program will wait forever for a signal.
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


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




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