From c65652ec7a65d1fb1eb3bc2e84ef2513de92ce72 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 5 Aug 1999 00:21:51 +0000 Subject: [PATCH] Update from main line. --- ChangeLog | 2 ++ rt/aio_fsync.c | 7 +++++++ rt/aio_misc.c | 4 ++-- rt/aio_read.c | 5 +++-- rt/aio_read64.c | 5 +++-- rt/aio_write.c | 5 +++-- rt/aio_write64.c | 5 +++-- 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16678d62366..809dc38ab10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ * rt/aio_misc.c: Set errno at correct place. + * rt/aio_fsync.c: Test OP parameter for correct values. + 1999-08-04 Andreas Schwab * sysdeps/unix/sysv/linux/alpha/getsysstats.c (GET_NPROCS_PARSER): diff --git a/rt/aio_fsync.c b/rt/aio_fsync.c index 72d4837b385..298b4ec87d3 100644 --- a/rt/aio_fsync.c +++ b/rt/aio_fsync.c @@ -28,6 +28,7 @@ #include /* And undo the hack. */ #undef aio_fsync64 +#include #include "aio_misc.h" @@ -35,6 +36,12 @@ int aio_fsync (int op, struct aiocb *aiocbp) { + if (op != O_DSYNC && op != O_SYNC) + { + __set_errno (EINVAL); + return -1; + } + return (__aio_enqueue_request ((aiocb_union *) aiocbp, op == O_SYNC ? LIO_SYNC : LIO_DSYNC) == NULL ? -1 : 0); diff --git a/rt/aio_misc.c b/rt/aio_misc.c index 742a8abaf12..ba0c9d47cf3 100644 --- a/rt/aio_misc.c +++ b/rt/aio_misc.c @@ -1,5 +1,5 @@ /* Handle general operations. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -260,8 +260,8 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation) newp = get_elem (); if (newp == NULL) { - __set_errno (EAGAIN); pthread_mutex_unlock (&__aio_requests_mutex); + __set_errno (EAGAIN); return NULL; } newp->aiocbp = aiocbp; diff --git a/rt/aio_read.c b/rt/aio_read.c index 871ce997670..4b5d4041901 100644 --- a/rt/aio_read.c +++ b/rt/aio_read.c @@ -1,5 +1,5 @@ /* Asynchronous read. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -27,5 +27,6 @@ int aio_read (aiocbp) struct aiocb *aiocbp; { - return __aio_enqueue_request ((aiocb_union *) aiocbp, LIO_READ) != NULL; + return (__aio_enqueue_request ((aiocb_union *) aiocbp, LIO_READ) == NULL + ? -1 : 0); } diff --git a/rt/aio_read64.c b/rt/aio_read64.c index b194dda6db9..0006ad6303a 100644 --- a/rt/aio_read64.c +++ b/rt/aio_read64.c @@ -1,5 +1,5 @@ /* Asynchronous read, 64bit offset version. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -27,5 +27,6 @@ int aio_read64 (aiocbp) struct aiocb64 *aiocbp; { - return __aio_enqueue_request ((aiocb_union *) aiocbp, LIO_READ64) != NULL; + return (__aio_enqueue_request ((aiocb_union *) aiocbp, LIO_READ64) == NULL + ? -1 : 0); } diff --git a/rt/aio_write.c b/rt/aio_write.c index 8801d891106..77ad0a685b1 100644 --- a/rt/aio_write.c +++ b/rt/aio_write.c @@ -1,5 +1,5 @@ /* Asynchronous write. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -27,5 +27,6 @@ int aio_write (aiocbp) struct aiocb *aiocbp; { - return __aio_enqueue_request ((aiocb_union *) aiocbp, LIO_WRITE) != NULL; + return (__aio_enqueue_request ((aiocb_union *) aiocbp, LIO_WRITE) == NULL + ? -1 : 0); } diff --git a/rt/aio_write64.c b/rt/aio_write64.c index 4d599b10621..bc95e50b491 100644 --- a/rt/aio_write64.c +++ b/rt/aio_write64.c @@ -1,5 +1,5 @@ /* Asynchronous write, 64bit offset version. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -27,5 +27,6 @@ int aio_write64 (aiocbp) struct aiocb64 *aiocbp; { - return __aio_enqueue_request ((aiocb_union *) aiocbp, LIO_WRITE64) != NULL; + return (__aio_enqueue_request ((aiocb_union *) aiocbp, LIO_WRITE64) == NULL + ? -1 : 0); } -- 2.47.2