* rt/aio_misc.c: Set errno at correct place.
+ * rt/aio_fsync.c: Test OP parameter for correct values.
+
1999-08-04 Andreas Schwab <schwab@suse.de>
* sysdeps/unix/sysv/linux/alpha/getsysstats.c (GET_NPROCS_PARSER):
#include <aio.h>
/* And undo the hack. */
#undef aio_fsync64
+#include <errno.h>
#include "aio_misc.h"
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);
/* 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 <drepper@cygnus.com>, 1997.
newp = get_elem ();
if (newp == NULL)
{
- __set_errno (EAGAIN);
pthread_mutex_unlock (&__aio_requests_mutex);
+ __set_errno (EAGAIN);
return NULL;
}
newp->aiocbp = aiocbp;
/* 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 <drepper@cygnus.com>, 1997.
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);
}
/* 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 <drepper@cygnus.com>, 1997.
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);
}
/* 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 <drepper@cygnus.com>, 1997.
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);
}
/* 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 <drepper@cygnus.com>, 1997.
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);
}