From owner-freebsd-bugs Thu Nov 12 12:09:58 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA15727 for freebsd-bugs-outgoing; Thu, 12 Nov 1998 12:09:58 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA15720 for ; Thu, 12 Nov 1998 12:09:57 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id MAA21851; Thu, 12 Nov 1998 12:10:01 -0800 (PST) Received: (from nobody@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA14968; Thu, 12 Nov 1998 12:03:59 -0800 (PST) (envelope-from nobody) Message-Id: <199811122003.MAA14968@hub.freebsd.org> Date: Thu, 12 Nov 1998 12:03:59 -0800 (PST) From: info@highwind.com To: freebsd-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: www-1.0 Subject: kern/8669: aio_write() and aio_read() do not work AT ALL. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 8669 >Category: kern >Synopsis: aio_write() and aio_read() do not work AT ALL. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 12 12:10:00 PST 1998 >Last-Modified: >Originator: Robert Fleischman >Organization: HighWind Software >Release: 3.0 >Environment: FreeBSD zonda.highwind.com 3.0-19980831-SNAP FreeBSD 3.0-19980831-SNAP #0: Mon Aug 31 14:03:19 GMT 1998 root@make.ican.net:/usr/src/sys/compile/GENERIC i386 Also, we have a VERY recent libc_r >Description: It appears that aio_read() and aio_write() do not work. Besides not having a man page, they don't pay any attention to the offset parameter. This makes it impossible to use them. >How-To-Repeat: /***************************************************************************** File: aioTest.c Contents: Simple Test of the aio_write() function Created: 12-Nov-1998 gcc -o aioTest aioTest.c -Wall -Werror *****************************************************************************/ #include #include #include #include #ifdef solaris #include #else #include #endif #include #include #include int main(int argc, char **argv) { int fd; char before[10], after[11], y; struct aiocb token; const struct aiocb *tlist; /* Open the test file */ fd = open("test", O_RDWR | O_CREAT | O_TRUNC, 0666); assert(fd != -1); /* Write 10 x's */ memset(before, 'x', 10); assert(write(fd, &before, 10) == 10); /* Use aio_write() to write a 'y' at offset 5 */ y = 'Y'; memset(&token, 0, sizeof(struct aiocb)); token.aio_fildes = fd; token.aio_offset = 5; token.aio_buf = &y; token.aio_nbytes = 1; token.aio_sigevent.sigev_notify = SIGEV_NONE; /* Enqueue the write */ assert(aio_write(&token) == 0); /* Wait for completion */ tlist = &token; assert(aio_suspend(&tlist, 1, 0) == 0); /* Ensure the write worked! */ assert(aio_return(&token) == 1); /* Read back the whole file */ memset(after, 0, 11); assert(lseek(fd, 0, SEEK_SET) == 0); assert(read(fd, &after, 10) == 10); printf("%s\n", after); return EXIT_SUCCESS; } >Fix: No idea. However, this test program above SHOULD print a "Y" in that printout. It appears that the program simply appends a "Y" instead of writing it in the correct place. Without aio_read() and aio_write() doing threaded offset reads and write is impossible (We don't have pwrite/pread yet!) >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message