From owner-freebsd-hackers Mon Jan 29 18:23: 7 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from panther.cs.ucla.edu (Panther.CS.UCLA.EDU [131.179.128.25]) by hub.freebsd.org (Postfix) with ESMTP id 9E93337B698 for ; Mon, 29 Jan 2001 18:22:48 -0800 (PST) Received: from localhost (joe@localhost) by panther.cs.ucla.edu (8.9.1/UCLACS-5.0) with ESMTP id SAA23741 for ; Mon, 29 Jan 2001 18:22:48 -0800 (PST) Date: Mon, 29 Jan 2001 18:22:47 -0800 (PST) From: Joe Albowicz To: freebsd-hackers@freebsd.org Subject: aio_read gives ENOSYS Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I'm trying to write a sample program to use aio. However, I'm getting back "function not implemented." I *know* I must be doing something stupid, but I can't seem to find info on the web. Help! My code (that works on a Sun box) is below. The only difference was "-lrt" on Sun. Note that I'm using "4.2-STABLE" and the io in question is for a scsi disk. Thanks in advance! Joe ******* #include #include #include #include #include #include #include #include #include #include #include #include void create_file(); void aio_handler(int signo, siginfo_t * info, void * data) { printf("aio_handler!!!\n"); } int main(int argc, char * argv[]) { int ret_val; //create_file(); aiocb iocb; struct sigaction sa; sa.sa_flags = SA_SIGINFO; sigemptyset(&sa.sa_mask); sa.sa_sigaction = aio_handler; sigaction(SIGUSR1, &sa, NULL); int buff[1000]; int fh = open("test_file", O_RDONLY); assert(fh > 0); printf("Setting up aio_read()\n"); iocb.aio_fildes = fh; iocb.aio_offset = 0; iocb.aio_buf = &buff[0]; iocb.aio_nbytes = sizeof(int) * 400; iocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL; iocb.aio_sigevent.sigev_signo = SIGUSR1; ret_val = aio_read(&iocb); printf("aio_read() == %d\n", ret_val); if(ret_val == -1) printf("Error: %s\n", strerror(errno)); sleep(10); close(fh); } void create_file() { int result; system("rm -f test_file"); int fh = open("test_file", O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IROTH); assert(fh != -1); for(int i = 0; i < 10 * 4096; i++) { result = write(fh, &i, sizeof(i)); assert(result != -1); } close(fh); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message