Only in Linux-AIO-1.3/: AIO.bs Only in Linux-AIO-1.3/: AIO.c Only in Linux-AIO-1.3/: AIO.o diff -ur Linux-AIO-1.1/AIO.pm Linux-AIO-1.3/AIO.pm --- Linux-AIO-1.1/AIO.pm 2004-05-06 08:00:38.000000000 -0700 +++ Linux-AIO-1.3/AIO.pm 2004-07-15 11:48:12.000000000 -0700 @@ -18,6 +18,10 @@ thread support in your libc or perl, and the threads created by this module will not be visible to the pthreads library. +NOTICE: the threads created by this module will automatically be killed +when the thread calling min_parallel exits. Make sure you only ever call +min_parallel from the same thread that loaded this module. + Although the module will work with threads, it is not reentrant, so use appropriate locking yourself. @@ -30,9 +34,9 @@ use base 'Exporter'; BEGIN { - $VERSION = 1.1; + $VERSION = 1.3; - @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat); + @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink); @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel nreqs); require XSLoader; @@ -103,6 +107,10 @@ error when stat'ing a large file, the results will be silently truncated unless perl itself is compiled with large file support. +=item aio_unlink $pathname, $callback + +Asynchronously unlink a file + =cut min_parallel 1; diff -ur Linux-AIO-1.1/AIO.xs Linux-AIO-1.3/AIO.xs --- Linux-AIO-1.1/AIO.xs 2004-05-06 17:57:04.000000000 -0700 +++ Linux-AIO-1.3/AIO.xs 2004-07-15 12:05:13.000000000 -0700 @@ -24,7 +24,8 @@ #define STACKSIZE 1024 /* yeah */ -enum { REQ_QUIT, REQ_OPEN, REQ_CLOSE, REQ_READ, REQ_WRITE, REQ_STAT, REQ_LSTAT, REQ_FSTAT}; +enum { REQ_QUIT, REQ_OPEN, REQ_CLOSE, REQ_READ, REQ_WRITE, REQ_STAT, REQ_LSTAT, + REQ_FSTAT, REQ_UNLINK }; typedef struct { char stack[STACKSIZE]; @@ -68,7 +69,7 @@ if (clone (aio_proc, &(thr->stack[STACKSIZE]), - CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND, + CLONE_VM|CLONE_FS|CLONE_FILES, thr) >= 0) started++; else @@ -233,6 +234,7 @@ #undef errno #include +#include static int aio_proc (void *thr_arg) @@ -256,7 +258,10 @@ _syscall2(int,lstat64, const char *, filename, struct stat64 *, buf) _syscall2(int,fstat64, int, fd, struct stat64 *, buf) + _syscall1(int,unlink,char *,pathname) + sigprocmask (SIG_SETMASK, &fullsigset, 0); + prctl (PR_SET_PDEATHSIG, SIGKILL); /* then loop */ while (read (reqpipe[0], (void *)&req, sizeof (req)) == sizeof (req)) @@ -273,6 +278,7 @@ case REQ_STAT: req->result = stat64 (req->dataptr, req->statdata); break; case REQ_LSTAT: req->result = lstat64 (req->dataptr, req->statdata); break; case REQ_FSTAT: req->result = fstat64 (req->fd, req->statdata); break; + case REQ_UNLINK: req->result = unlink (req->dataptr); break; case REQ_QUIT: default: @@ -362,6 +368,26 @@ send_req (req); void +aio_unlink(pathname,callback) + SV * pathname + SV * callback + PROTOTYPE: $$ + CODE: + aio_req req; + + Newz (0, req, 1, aio_cb); + + if (!req) + croak ("out of memory during aio_req allocation"); + + req->type = REQ_UNLINK; + req->data = newSVsv (pathname); + req->dataptr = SvPV_nolen (req->data); + req->callback = SvREFCNT_inc (callback); + + send_req (req); + +void aio_close(fh,callback) InputStream fh SV * callback diff -ur Linux-AIO-1.1/Changes Linux-AIO-1.3/Changes --- Linux-AIO-1.1/Changes 2004-05-06 17:57:42.000000000 -0700 +++ Linux-AIO-1.3/Changes 2004-07-15 11:47:37.000000000 -0700 @@ -1,5 +1,14 @@ Revision history for Linux::AIO +BUG: main program crash => threads stay around. maybe clone(filenhandles)? + +1.3 + - added unlink support (Brad Fitzpatrick ) + +1.2 + - do not clone signal handlers. + - when the parent thread dies, kill the child threads. + 1.1 Fri May 7 02:57:36 CEST 2004 - the number of outstanding requests was limited by the pipe buffer size. this limit has been removed. diff -ur Linux-AIO-1.1/META.yml Linux-AIO-1.3/META.yml --- Linux-AIO-1.1/META.yml 2004-05-06 17:57:43.000000000 -0700 +++ Linux-AIO-1.3/META.yml 2004-07-15 11:44:38.000000000 -0700 @@ -1,10 +1,10 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Linux-AIO -version: 1.1 +version: 1.3 version_from: AIO.pm installdirs: site requires: distribution_type: module -generated_by: ExtUtils::MakeMaker version 6.17 +generated_by: ExtUtils::MakeMaker version 6.21 Only in Linux-AIO-1.3/: Makefile diff -ur Linux-AIO-1.1/README Linux-AIO-1.3/README --- Linux-AIO-1.1/README 2004-05-06 17:57:44.000000000 -0700 +++ Linux-AIO-1.3/README 2004-05-08 16:30:51.000000000 -0700 @@ -15,6 +15,10 @@ thread support in your libc or perl, and the threads created by this module will not be visible to the pthreads library. + NOTICE: the threads created by this module will automatically be killed + when the thread calling min_parallel exits. Make sure you only ever call + min_parallel from the same thread that loaded this module. + Although the module will work with threads, it is not reentrant, so use appropriate locking yourself. Only in Linux-AIO-1.3/: blib Only in Linux-AIO-1.3/: build-stamp Only in Linux-AIO-1.3/: debian Only in Linux-AIO-1.3/: install-stamp Only in Linux-AIO-1.3/: pm_to_blib Only in Linux-AIO-1.3/: unlinktest.pl