mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 23:00:07 +00:00
Update.
2003-07-24 Jakub Jelinek <jakub@redhat.com> * sysdeps/pthread/aio_cancel.c (aio_cancel): Return AIO_ALLDONE if aiocbp != NULL and has already completed. Return -1/EINVAL if aiocbp->aio_fildes does not match fildes.
This commit is contained in:
parent
02ade8d6b0
commit
7b787f8516
@ -1,3 +1,9 @@
|
||||
2003-07-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* sysdeps/pthread/aio_cancel.c (aio_cancel): Return AIO_ALLDONE
|
||||
if aiocbp != NULL and has already completed. Return -1/EINVAL if
|
||||
aiocbp->aio_fildes does not match fildes.
|
||||
|
||||
2003-07-24 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* timezone/zic.c (rpytime): Replace cheap overflow check with a
|
||||
|
@ -31,7 +31,7 @@ rtld-all:
|
||||
ifeq ($(subdir),elf)
|
||||
|
||||
ifndef rtld-subdirs
|
||||
error This is makefile is a subroutine of elf/Makefile not to be used directly
|
||||
error This makefile is a subroutine of elf/Makefile not to be used directly
|
||||
endif
|
||||
|
||||
include ../Makeconfig
|
||||
|
@ -1,3 +1,10 @@
|
||||
2003-07-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* tst-cancel17.c (do_test): Check if aio_cancel failed.
|
||||
Don't reuse struct aiocb A if it failed.
|
||||
Write fpathconf (fds[1], _PC_PIPE_BUF) + 2 bytes using aio_write,
|
||||
not just one byte, as that does not block.
|
||||
|
||||
2003-07-22 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* sysdeps/pthread/unwind-resume.c: New file.
|
||||
|
@ -98,7 +98,7 @@ do_test (void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct aiocb a;
|
||||
struct aiocb a, a2, *ap;
|
||||
char mem[1];
|
||||
memset (&a, '\0', sizeof (a));
|
||||
a.aio_fildes = fds[0];
|
||||
@ -214,22 +214,37 @@ do_test (void)
|
||||
}
|
||||
|
||||
puts ("in-time cancellation succeeded");
|
||||
aio_cancel (fds[0], &a);
|
||||
|
||||
ap = &a;
|
||||
if (aio_cancel (fds[0], &a) != AIO_CANCELED)
|
||||
{
|
||||
puts ("aio_cancel failed");
|
||||
/* If aio_cancel failed, we cannot reuse aiocb a. */
|
||||
ap = &a2;
|
||||
}
|
||||
|
||||
|
||||
cl_called = 0;
|
||||
|
||||
memset (&a, '\0', sizeof (a));
|
||||
a.aio_fildes = fds[1];
|
||||
a.aio_buf = mem;
|
||||
a.aio_nbytes = sizeof (mem);
|
||||
if (aio_write (&a) != 0)
|
||||
size_t len2 = fpathconf (fds[1], _PC_PIPE_BUF) + sizeof (mem) + 1;
|
||||
char *mem2 = malloc (len2);
|
||||
if (mem2 == NULL)
|
||||
{
|
||||
puts ("could not allocate memory for pipe write");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset (ap, '\0', sizeof (*ap));
|
||||
ap->aio_fildes = fds[1];
|
||||
ap->aio_buf = mem2;
|
||||
ap->aio_nbytes = len2;
|
||||
if (aio_write (ap) != 0)
|
||||
{
|
||||
puts ("aio_write failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pthread_create (&th, NULL, tf, &a) != 0)
|
||||
if (pthread_create (&th, NULL, tf, ap) != 0)
|
||||
{
|
||||
puts ("3rd create failed");
|
||||
return 1;
|
||||
@ -262,18 +277,18 @@ do_test (void)
|
||||
|
||||
if (cl_called == 0)
|
||||
{
|
||||
printf ("tf cleanup handler not called\n");
|
||||
puts ("tf cleanup handler not called");
|
||||
return 1;
|
||||
}
|
||||
if (cl_called > 1)
|
||||
{
|
||||
printf ("tf cleanup handler called more than once\n");
|
||||
puts ("tf cleanup handler called more than once");
|
||||
return 1;
|
||||
}
|
||||
|
||||
cl_called = 0;
|
||||
|
||||
if (pthread_create (&th, NULL, tf2, &a) != 0)
|
||||
if (pthread_create (&th, NULL, tf2, ap) != 0)
|
||||
{
|
||||
puts ("4th create failed");
|
||||
return 1;
|
||||
@ -306,12 +321,12 @@ do_test (void)
|
||||
|
||||
if (cl_called == 0)
|
||||
{
|
||||
printf ("tf2 cleanup handler not called\n");
|
||||
puts ("tf2 cleanup handler not called");
|
||||
return 1;
|
||||
}
|
||||
if (cl_called > 1)
|
||||
{
|
||||
printf ("tf2 cleanup handler called more than once\n");
|
||||
puts ("tf2 cleanup handler called more than once");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,13 @@ aio_cancel (fildes, aiocbp)
|
||||
{
|
||||
/* If the AIO request is not for this descriptor it has no value
|
||||
to look for the request block. */
|
||||
if (aiocbp->aio_fildes == fildes)
|
||||
if (aiocbp->aio_fildes != fildes)
|
||||
{
|
||||
pthread_mutex_unlock (&__aio_requests_mutex);
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
else if (aiocbp->__error_code == EINPROGRESS)
|
||||
{
|
||||
struct requestlist *last = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user