[PATCH] Update to libaio?

Jeff Moyer jmoyer at redhat.com
Mon Jan 7 21:25:07 UTC 2008


Rusty Russell <rusty at rustcorp.com.au> writes:

> I recently tried to use libaio (0.3.106), and discovered it didn't have
> eventfd support.  Or preadv/pwritev support.  And the testsuite didn't
> compile.  Or work.

> Anyway, it's shipped by the distros, so I figure it's worth patching.
> I'm cc'ing Ben in the hope he's still maintaining it.  If not I'll
> find a home somewhere for it.

Thanks for doing this, Rusty.  I have a few comments below.

> diff -ur libaio-0.3.106/ChangeLog libaio-0.3.106-aio_abi/ChangeLog
> --- libaio-0.3.106/ChangeLog	2002-10-01 08:09:56.000000000 +1000
> +++ libaio-0.3.106-aio_abi/ChangeLog	2008-01-03 17:48:48.000000000 +1100
> @@ -1,3 +1,14 @@
> +rusty-v1
> +	- Make tests compile again on modern systems (warnings + -Werror)
> +	- Add 'make partcheck' and don't require manual setup for testing.
> +	- Change test harness to compile against this dir, not global install
> +	- Fix 5.t for archs where PROT_WRITE mappings are readable.
> +	- Allow sending of SIGXFSZ on aio over limits
> +	- Explicitly specify bash for runtests.sh
> +	- Remove (never-merged?) io_prep_poll

Well, I believe this was supported in Red Hat AS2.1 and RHEL 3.

> +	- Add io_prep_preadv and io_prep_pwritev
> +	- Add eventfd support (io_set_eventfd).
> +
>  0.4.0
>  	- remove libredhat-kernel
>  	- add rough outline for man pages
> diff -ur libaio-0.3.106/harness/cases/5.t libaio-0.3.106-aio_abi/harness/cases/5.t
> --- libaio-0.3.106/harness/cases/5.t	2002-04-20 10:26:22.000000000 +1000
> +++ libaio-0.3.106-aio_abi/harness/cases/5.t	2008-01-03 16:29:37.000000000 +1100
> @@ -3,6 +3,7 @@
>  */
>  #include "aio_setup.h"
>  #include <sys/mman.h>
> +#include <errno.h>
>  
>  int test_main(void)
>  {
> @@ -40,7 +41,13 @@
>  	assert(buf != (char *)-1);
>  
>  	status |= attempt_rw(rwfd, buf, SIZE,  0,  READ, SIZE);
> -	status |= attempt_rw(rwfd, buf, SIZE,  0, WRITE, -EFAULT);
> +
> +	/* Whether PROT_WRITE is readable is arch-dependent.  So compare
> +	 * against pread result. */
> +	res = write(rwfd, buf, SIZE);
> +	if (res < 0)
> +		res = -errno;
> +	status |= attempt_rw(rwfd, buf, SIZE,  0, WRITE, res);

Am I missing something, or does the code change do the opposite of
what your comment suggests?

> diff -ur libaio-0.3.106/harness/cases/8.t libaio-0.3.106-aio_abi/harness/cases/8.t
> --- libaio-0.3.106/harness/cases/8.t	2008-01-03 15:13:05.000000000 +1100
> +++ libaio-0.3.106-aio_abi/harness/cases/8.t	2008-01-03 18:47:23.000000000 +1100
> @@ -2,44 +2,23 @@
>  - Ditto for the above three tests at the offset maximum (largest
>    possible ext2/3 file size.) (8.t)
>   */
> -#include <sys/vfs.h>
> -
> -#define EXT2_OLD_SUPER_MAGIC	0xEF51
> -#define EXT2_SUPER_MAGIC	0xEF53
> +#include <sys/types.h>
> +#include <unistd.h>
>  
>  long long get_fs_limit(int fd)
>  {
> -	struct statfs s;
> -	int res;
> -	long long lim = 0;
> -
> -	res = fstatfs(fd, &s);		assert(res == 0);
> +	long long min = 0, max = 100000000000000ULL;
> +	char c = 0;

How did you choose this upper bound?

Thanks,

Jeff




More information about the Ubuntu-devel-discuss mailing list