|
|
1 | #define _REENTRANT 1 |
|
|
2 | #include <errno.h> |
|
|
3 | |
1 | #include "EXTERN.h" |
4 | #include "EXTERN.h" |
2 | #include "perl.h" |
5 | #include "perl.h" |
3 | #include "XSUB.h" |
6 | #include "XSUB.h" |
4 | |
7 | |
5 | #include "autoconf/config.h" |
8 | #include "autoconf/config.h" |
… | |
… | |
9 | |
12 | |
10 | #include <unistd.h> |
13 | #include <unistd.h> |
11 | #include <fcntl.h> |
14 | #include <fcntl.h> |
12 | #include <signal.h> |
15 | #include <signal.h> |
13 | #include <sched.h> |
16 | #include <sched.h> |
14 | |
|
|
15 | #ifndef _REENTRANT |
|
|
16 | # define _REENTRANT 1 |
|
|
17 | #endif |
|
|
18 | #include <errno.h> |
|
|
19 | |
17 | |
20 | #include <pthread.h> |
18 | #include <pthread.h> |
21 | |
19 | |
22 | typedef void *InputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
20 | typedef void *InputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
23 | typedef void *OutputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
21 | typedef void *OutputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
… | |
… | |
31 | |
29 | |
32 | enum { |
30 | enum { |
33 | REQ_QUIT, |
31 | REQ_QUIT, |
34 | REQ_OPEN, REQ_CLOSE, |
32 | REQ_OPEN, REQ_CLOSE, |
35 | REQ_READ, REQ_WRITE, REQ_READAHEAD, |
33 | REQ_READ, REQ_WRITE, REQ_READAHEAD, |
36 | REQ_STAT, REQ_LSTAT, REQ_FSTAT, REQ_UNLINK, |
34 | REQ_STAT, REQ_LSTAT, REQ_FSTAT, |
37 | REQ_FSYNC, REQ_FDATASYNC, |
35 | REQ_FSYNC, REQ_FDATASYNC, |
|
|
36 | REQ_UNLINK, REQ_RMDIR, |
|
|
37 | REQ_SYMLINK, |
38 | }; |
38 | }; |
39 | |
39 | |
40 | typedef struct aio_cb { |
40 | typedef struct aio_cb { |
41 | struct aio_cb *volatile next; |
41 | struct aio_cb *volatile next; |
42 | |
42 | |
… | |
… | |
47 | size_t length; |
47 | size_t length; |
48 | ssize_t result; |
48 | ssize_t result; |
49 | mode_t mode; /* open */ |
49 | mode_t mode; /* open */ |
50 | int errorno; |
50 | int errorno; |
51 | SV *data, *callback, *fh; |
51 | SV *data, *callback, *fh; |
52 | void *dataptr; |
52 | void *dataptr, *data2ptr; |
53 | STRLEN dataoffset; |
53 | STRLEN dataoffset; |
54 | |
54 | |
55 | Stat_t *statdata; |
55 | Stat_t *statdata; |
56 | } aio_cb; |
56 | } aio_cb; |
57 | |
57 | |
… | |
… | |
62 | static int max_outstanding = 1<<30; |
62 | static int max_outstanding = 1<<30; |
63 | static int respipe [2]; |
63 | static int respipe [2]; |
64 | |
64 | |
65 | static pthread_mutex_t reslock = PTHREAD_MUTEX_INITIALIZER; |
65 | static pthread_mutex_t reslock = PTHREAD_MUTEX_INITIALIZER; |
66 | static pthread_mutex_t reqlock = PTHREAD_MUTEX_INITIALIZER; |
66 | static pthread_mutex_t reqlock = PTHREAD_MUTEX_INITIALIZER; |
|
|
67 | static pthread_mutex_t frklock = PTHREAD_MUTEX_INITIALIZER; |
67 | static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER; |
68 | static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER; |
68 | |
69 | |
69 | static volatile aio_req reqs, reqe; /* queue start, queue end */ |
70 | static volatile aio_req reqs, reqe; /* queue start, queue end */ |
70 | static volatile aio_req ress, rese; /* queue start, queue end */ |
71 | static volatile aio_req ress, rese; /* queue start, queue end */ |
71 | |
72 | |
… | |
… | |
85 | static int |
86 | static int |
86 | poll_cb () |
87 | poll_cb () |
87 | { |
88 | { |
88 | dSP; |
89 | dSP; |
89 | int count = 0; |
90 | int count = 0; |
|
|
91 | int do_croak = 0; |
90 | aio_req req, prv; |
92 | aio_req req, prv; |
91 | |
93 | |
92 | pthread_mutex_lock (&reslock); |
94 | pthread_mutex_lock (&reslock); |
93 | |
95 | |
94 | { |
96 | { |
95 | /* read any signals sent by the worker threads */ |
97 | /* read any signals sent by the worker threads */ |
96 | char buf [32]; |
98 | char buf [32]; |
97 | while (read (respipe [0], buf, 32) > 0) |
99 | while (read (respipe [0], buf, 32) == 32) |
98 | ; |
100 | ; |
99 | } |
101 | } |
100 | |
102 | |
101 | req = ress; |
103 | req = ress; |
102 | ress = rese = 0; |
104 | ress = rese = 0; |
… | |
… | |
157 | PUTBACK; |
159 | PUTBACK; |
158 | call_sv (req->callback, G_VOID | G_EVAL); |
160 | call_sv (req->callback, G_VOID | G_EVAL); |
159 | SPAGAIN; |
161 | SPAGAIN; |
160 | } |
162 | } |
161 | |
163 | |
|
|
164 | do_croak = SvTRUE (ERRSV); |
|
|
165 | |
162 | LEAVE; |
166 | LEAVE; |
163 | |
167 | |
164 | if (req->callback) |
168 | if (req->callback) |
165 | SvREFCNT_dec (req->callback); |
169 | SvREFCNT_dec (req->callback); |
166 | |
170 | |
… | |
… | |
170 | |
174 | |
171 | prv = req; |
175 | prv = req; |
172 | req = req->next; |
176 | req = req->next; |
173 | Safefree (prv); |
177 | Safefree (prv); |
174 | |
178 | |
175 | /* TODO: croak on errors? */ |
179 | if (do_croak) |
|
|
180 | croak (0); |
176 | } |
181 | } |
177 | |
182 | |
178 | return count; |
183 | return count; |
179 | } |
184 | } |
180 | |
185 | |
… | |
… | |
235 | req->type = REQ_QUIT; |
240 | req->type = REQ_QUIT; |
236 | |
241 | |
237 | send_req (req); |
242 | send_req (req); |
238 | } |
243 | } |
239 | |
244 | |
|
|
245 | |
|
|
246 | static void min_parallel (int nthreads) |
|
|
247 | { |
|
|
248 | while (nthreads > started) |
|
|
249 | start_thread (); |
|
|
250 | } |
|
|
251 | |
|
|
252 | static void max_parallel (int nthreads) |
|
|
253 | { |
|
|
254 | int cur = started; |
|
|
255 | while (cur > nthreads) |
|
|
256 | { |
|
|
257 | end_thread (); |
|
|
258 | cur--; |
|
|
259 | } |
|
|
260 | |
|
|
261 | while (started > nthreads) |
|
|
262 | { |
|
|
263 | poll_wait (); |
|
|
264 | poll_cb (); |
|
|
265 | } |
|
|
266 | } |
|
|
267 | |
|
|
268 | static int fork_started; |
|
|
269 | |
|
|
270 | static void atfork_prepare (void) |
|
|
271 | { |
|
|
272 | pthread_mutex_lock (&frklock); |
|
|
273 | |
|
|
274 | fork_started = started; |
|
|
275 | |
|
|
276 | for (;;) { |
|
|
277 | while (nreqs) |
|
|
278 | { |
|
|
279 | poll_wait (); |
|
|
280 | poll_cb (); |
|
|
281 | } |
|
|
282 | |
|
|
283 | max_parallel (0); |
|
|
284 | |
|
|
285 | pthread_mutex_lock (&reqlock); |
|
|
286 | |
|
|
287 | if (!nreqs && !started) |
|
|
288 | break; |
|
|
289 | |
|
|
290 | pthread_mutex_unlock (&reqlock); |
|
|
291 | |
|
|
292 | min_parallel (fork_started); |
|
|
293 | } |
|
|
294 | |
|
|
295 | pthread_mutex_lock (&reslock); |
|
|
296 | |
|
|
297 | assert (!started); |
|
|
298 | assert (!nreqs); |
|
|
299 | assert (!reqs && !reqe); |
|
|
300 | assert (!ress && !rese); |
|
|
301 | } |
|
|
302 | |
|
|
303 | static void atfork_parent (void) |
|
|
304 | { |
|
|
305 | pthread_mutex_unlock (&reslock); |
|
|
306 | min_parallel (fork_started); |
|
|
307 | pthread_mutex_unlock (&reqlock); |
|
|
308 | pthread_mutex_unlock (&frklock); |
|
|
309 | } |
|
|
310 | |
|
|
311 | static void atfork_child (void) |
|
|
312 | { |
|
|
313 | reqs = reqe = 0; |
|
|
314 | |
|
|
315 | atfork_parent (); |
|
|
316 | } |
|
|
317 | |
|
|
318 | /*****************************************************************************/ |
240 | /* work around various missing functions */ |
319 | /* work around various missing functions */ |
241 | |
320 | |
242 | #if !HAVE_PREADWRITE |
321 | #if !HAVE_PREADWRITE |
243 | # define pread aio_pread |
322 | # define pread aio_pread |
244 | # define pwrite aio_pwrite |
323 | # define pwrite aio_pwrite |
… | |
… | |
306 | |
385 | |
307 | errno = 0; |
386 | errno = 0; |
308 | } |
387 | } |
309 | #endif |
388 | #endif |
310 | |
389 | |
|
|
390 | /*****************************************************************************/ |
|
|
391 | |
311 | static void * |
392 | static void * |
312 | aio_proc (void *thr_arg) |
393 | aio_proc (void *thr_arg) |
313 | { |
394 | { |
314 | aio_req req; |
395 | aio_req req; |
315 | int type; |
396 | int type; |
… | |
… | |
352 | case REQ_FSTAT: req->result = fstat (req->fd , req->statdata); break; |
433 | case REQ_FSTAT: req->result = fstat (req->fd , req->statdata); break; |
353 | |
434 | |
354 | case REQ_OPEN: req->result = open (req->dataptr, req->fd, req->mode); break; |
435 | case REQ_OPEN: req->result = open (req->dataptr, req->fd, req->mode); break; |
355 | case REQ_CLOSE: req->result = close (req->fd); break; |
436 | case REQ_CLOSE: req->result = close (req->fd); break; |
356 | case REQ_UNLINK: req->result = unlink (req->dataptr); break; |
437 | case REQ_UNLINK: req->result = unlink (req->dataptr); break; |
|
|
438 | case REQ_RMDIR: req->result = rmdir (req->dataptr); break; |
|
|
439 | case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break; |
357 | |
440 | |
358 | case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; |
441 | case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; |
359 | case REQ_FSYNC: req->result = fsync (req->fd); break; |
442 | case REQ_FSYNC: req->result = fsync (req->fd); break; |
360 | |
443 | |
361 | case REQ_QUIT: |
444 | case REQ_QUIT: |
… | |
… | |
390 | while (type != REQ_QUIT); |
473 | while (type != REQ_QUIT); |
391 | |
474 | |
392 | return 0; |
475 | return 0; |
393 | } |
476 | } |
394 | |
477 | |
|
|
478 | #define dREQ \ |
|
|
479 | aio_req req; \ |
|
|
480 | \ |
|
|
481 | if (SvOK (callback) && !SvROK (callback)) \ |
|
|
482 | croak ("clalback must be undef or of reference type"); \ |
|
|
483 | \ |
|
|
484 | Newz (0, req, 1, aio_cb); \ |
|
|
485 | if (!req) \ |
|
|
486 | croak ("out of memory during aio_req allocation"); \ |
|
|
487 | \ |
|
|
488 | req->callback = SvREFCNT_inc (callback); |
|
|
489 | |
395 | MODULE = IO::AIO PACKAGE = IO::AIO |
490 | MODULE = IO::AIO PACKAGE = IO::AIO |
396 | |
491 | |
397 | PROTOTYPES: ENABLE |
492 | PROTOTYPES: ENABLE |
398 | |
493 | |
399 | BOOT: |
494 | BOOT: |
… | |
… | |
404 | if (fcntl (respipe [0], F_SETFL, O_NONBLOCK)) |
499 | if (fcntl (respipe [0], F_SETFL, O_NONBLOCK)) |
405 | croak ("cannot set result pipe to nonblocking mode"); |
500 | croak ("cannot set result pipe to nonblocking mode"); |
406 | |
501 | |
407 | if (fcntl (respipe [1], F_SETFL, O_NONBLOCK)) |
502 | if (fcntl (respipe [1], F_SETFL, O_NONBLOCK)) |
408 | croak ("cannot set result pipe to nonblocking mode"); |
503 | croak ("cannot set result pipe to nonblocking mode"); |
|
|
504 | |
|
|
505 | pthread_atfork (atfork_prepare, atfork_parent, atfork_child); |
409 | } |
506 | } |
410 | |
507 | |
411 | void |
508 | void |
412 | min_parallel(nthreads) |
509 | min_parallel(nthreads) |
413 | int nthreads |
510 | int nthreads |
414 | PROTOTYPE: $ |
511 | PROTOTYPE: $ |
415 | CODE: |
|
|
416 | while (nthreads > started) |
|
|
417 | start_thread (); |
|
|
418 | |
512 | |
419 | void |
513 | void |
420 | max_parallel(nthreads) |
514 | max_parallel(nthreads) |
421 | int nthreads |
515 | int nthreads |
422 | PROTOTYPE: $ |
516 | PROTOTYPE: $ |
423 | CODE: |
|
|
424 | { |
|
|
425 | int cur = started; |
|
|
426 | while (cur > nthreads) |
|
|
427 | { |
|
|
428 | end_thread (); |
|
|
429 | cur--; |
|
|
430 | } |
|
|
431 | |
|
|
432 | while (started > nthreads) |
|
|
433 | { |
|
|
434 | poll_wait (); |
|
|
435 | poll_cb (); |
|
|
436 | } |
|
|
437 | } |
|
|
438 | |
517 | |
439 | int |
518 | int |
440 | max_outstanding(nreqs) |
519 | max_outstanding(nreqs) |
441 | int nreqs |
520 | int nreqs |
442 | PROTOTYPE: $ |
521 | PROTOTYPE: $ |
… | |
… | |
451 | int mode |
530 | int mode |
452 | SV * callback |
531 | SV * callback |
453 | PROTOTYPE: $$$;$ |
532 | PROTOTYPE: $$$;$ |
454 | CODE: |
533 | CODE: |
455 | { |
534 | { |
456 | aio_req req; |
535 | dREQ; |
457 | |
|
|
458 | Newz (0, req, 1, aio_cb); |
|
|
459 | |
|
|
460 | if (!req) |
|
|
461 | croak ("out of memory during aio_req allocation"); |
|
|
462 | |
536 | |
463 | req->type = REQ_OPEN; |
537 | req->type = REQ_OPEN; |
464 | req->data = newSVsv (pathname); |
538 | req->data = newSVsv (pathname); |
465 | req->dataptr = SvPV_nolen (req->data); |
539 | req->dataptr = SvPVbyte_nolen (req->data); |
466 | req->fd = flags; |
540 | req->fd = flags; |
467 | req->mode = mode; |
541 | req->mode = mode; |
468 | req->callback = SvREFCNT_inc (callback); |
|
|
469 | |
542 | |
470 | send_req (req); |
543 | send_req (req); |
471 | } |
544 | } |
472 | |
545 | |
473 | void |
546 | void |
… | |
… | |
479 | aio_close = REQ_CLOSE |
552 | aio_close = REQ_CLOSE |
480 | aio_fsync = REQ_FSYNC |
553 | aio_fsync = REQ_FSYNC |
481 | aio_fdatasync = REQ_FDATASYNC |
554 | aio_fdatasync = REQ_FDATASYNC |
482 | CODE: |
555 | CODE: |
483 | { |
556 | { |
484 | aio_req req; |
557 | dREQ; |
485 | |
|
|
486 | Newz (0, req, 1, aio_cb); |
|
|
487 | |
|
|
488 | if (!req) |
|
|
489 | croak ("out of memory during aio_req allocation"); |
|
|
490 | |
558 | |
491 | req->type = ix; |
559 | req->type = ix; |
492 | req->fh = newSVsv (fh); |
560 | req->fh = newSVsv (fh); |
493 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
561 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
494 | req->callback = SvREFCNT_inc (callback); |
|
|
495 | |
562 | |
496 | send_req (req); |
563 | send_req (req); |
497 | } |
564 | } |
498 | |
565 | |
499 | void |
566 | void |
… | |
… | |
510 | PROTOTYPE: $$$$$;$ |
577 | PROTOTYPE: $$$$$;$ |
511 | CODE: |
578 | CODE: |
512 | { |
579 | { |
513 | aio_req req; |
580 | aio_req req; |
514 | STRLEN svlen; |
581 | STRLEN svlen; |
515 | char *svptr = SvPV (data, svlen); |
582 | char *svptr = SvPVbyte (data, svlen); |
516 | |
583 | |
517 | SvUPGRADE (data, SVt_PV); |
584 | SvUPGRADE (data, SVt_PV); |
518 | SvPOK_on (data); |
585 | SvPOK_on (data); |
519 | |
586 | |
520 | if (dataoffset < 0) |
587 | if (dataoffset < 0) |
… | |
… | |
536 | } |
603 | } |
537 | |
604 | |
538 | if (length < 0) |
605 | if (length < 0) |
539 | croak ("length must not be negative"); |
606 | croak ("length must not be negative"); |
540 | |
607 | |
541 | Newz (0, req, 1, aio_cb); |
608 | { |
|
|
609 | dREQ; |
542 | |
610 | |
543 | if (!req) |
|
|
544 | croak ("out of memory during aio_req allocation"); |
|
|
545 | |
|
|
546 | req->type = ix; |
611 | req->type = ix; |
547 | req->fh = newSVsv (fh); |
612 | req->fh = newSVsv (fh); |
548 | req->fd = PerlIO_fileno (ix == REQ_READ ? IoIFP (sv_2io (fh)) |
613 | req->fd = PerlIO_fileno (ix == REQ_READ ? IoIFP (sv_2io (fh)) |
549 | : IoOFP (sv_2io (fh))); |
614 | : IoOFP (sv_2io (fh))); |
550 | req->offset = offset; |
615 | req->offset = offset; |
551 | req->length = length; |
616 | req->length = length; |
552 | req->data = SvREFCNT_inc (data); |
617 | req->data = SvREFCNT_inc (data); |
553 | req->dataptr = (char *)svptr + dataoffset; |
618 | req->dataptr = (char *)svptr + dataoffset; |
554 | req->callback = SvREFCNT_inc (callback); |
619 | req->callback = SvREFCNT_inc (callback); |
555 | |
620 | |
556 | send_req (req); |
621 | send_req (req); |
|
|
622 | } |
557 | } |
623 | } |
558 | |
624 | |
559 | void |
625 | void |
560 | aio_readahead(fh,offset,length,callback=&PL_sv_undef) |
626 | aio_readahead(fh,offset,length,callback=&PL_sv_undef) |
561 | SV * fh |
627 | SV * fh |
… | |
… | |
563 | IV length |
629 | IV length |
564 | SV * callback |
630 | SV * callback |
565 | PROTOTYPE: $$$;$ |
631 | PROTOTYPE: $$$;$ |
566 | CODE: |
632 | CODE: |
567 | { |
633 | { |
568 | aio_req req; |
634 | dREQ; |
569 | |
|
|
570 | if (length < 0) |
|
|
571 | croak ("length must not be negative"); |
|
|
572 | |
|
|
573 | Newz (0, req, 1, aio_cb); |
|
|
574 | |
|
|
575 | if (!req) |
|
|
576 | croak ("out of memory during aio_req allocation"); |
|
|
577 | |
635 | |
578 | req->type = REQ_READAHEAD; |
636 | req->type = REQ_READAHEAD; |
579 | req->fh = newSVsv (fh); |
637 | req->fh = newSVsv (fh); |
580 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
638 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
581 | req->offset = offset; |
639 | req->offset = offset; |
582 | req->length = length; |
640 | req->length = length; |
583 | req->callback = SvREFCNT_inc (callback); |
|
|
584 | |
641 | |
585 | send_req (req); |
642 | send_req (req); |
586 | } |
643 | } |
587 | |
644 | |
588 | void |
645 | void |
… | |
… | |
592 | ALIAS: |
649 | ALIAS: |
593 | aio_stat = REQ_STAT |
650 | aio_stat = REQ_STAT |
594 | aio_lstat = REQ_LSTAT |
651 | aio_lstat = REQ_LSTAT |
595 | CODE: |
652 | CODE: |
596 | { |
653 | { |
597 | aio_req req; |
654 | dREQ; |
598 | |
|
|
599 | Newz (0, req, 1, aio_cb); |
|
|
600 | |
|
|
601 | if (!req) |
|
|
602 | croak ("out of memory during aio_req allocation"); |
|
|
603 | |
655 | |
604 | New (0, req->statdata, 1, Stat_t); |
656 | New (0, req->statdata, 1, Stat_t); |
605 | |
|
|
606 | if (!req->statdata) |
657 | if (!req->statdata) |
607 | croak ("out of memory during aio_req->statdata allocation"); |
658 | croak ("out of memory during aio_req->statdata allocation (sorry, i just leaked memory, too)"); |
608 | |
659 | |
609 | if (SvPOK (fh_or_path)) |
660 | if (SvPOK (fh_or_path)) |
610 | { |
661 | { |
611 | req->type = ix; |
662 | req->type = ix; |
612 | req->data = newSVsv (fh_or_path); |
663 | req->data = newSVsv (fh_or_path); |
613 | req->dataptr = SvPV_nolen (req->data); |
664 | req->dataptr = SvPVbyte_nolen (req->data); |
614 | } |
665 | } |
615 | else |
666 | else |
616 | { |
667 | { |
617 | req->type = REQ_FSTAT; |
668 | req->type = REQ_FSTAT; |
618 | req->fh = newSVsv (fh_or_path); |
669 | req->fh = newSVsv (fh_or_path); |
619 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh_or_path))); |
670 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh_or_path))); |
620 | } |
671 | } |
621 | |
672 | |
622 | req->callback = SvREFCNT_inc (callback); |
|
|
623 | |
|
|
624 | send_req (req); |
673 | send_req (req); |
625 | } |
674 | } |
626 | |
675 | |
627 | void |
676 | void |
628 | aio_unlink(pathname,callback=&PL_sv_undef) |
677 | aio_unlink(pathname,callback=&PL_sv_undef) |
629 | SV * pathname |
678 | SV * pathname |
630 | SV * callback |
679 | SV * callback |
|
|
680 | ALIAS: |
|
|
681 | aio_unlink = REQ_UNLINK |
|
|
682 | aio_rmdir = REQ_RMDIR |
631 | CODE: |
683 | CODE: |
632 | { |
684 | { |
633 | aio_req req; |
685 | dREQ; |
634 | |
686 | |
635 | Newz (0, req, 1, aio_cb); |
687 | req->type = ix; |
|
|
688 | req->data = newSVsv (pathname); |
|
|
689 | req->dataptr = SvPVbyte_nolen (req->data); |
636 | |
690 | |
637 | if (!req) |
691 | send_req (req); |
638 | croak ("out of memory during aio_req allocation"); |
692 | } |
|
|
693 | |
|
|
694 | void |
|
|
695 | aio_symlink(oldpath,newpath,callback=&PL_sv_undef) |
|
|
696 | SV * oldpath |
|
|
697 | SV * newpath |
|
|
698 | SV * callback |
|
|
699 | CODE: |
|
|
700 | { |
|
|
701 | dREQ; |
639 | |
702 | |
640 | req->type = REQ_UNLINK; |
703 | req->type = REQ_SYMLINK; |
|
|
704 | req->fh = newSVsv (oldpath); |
|
|
705 | req->data2ptr = SvPVbyte_nolen (req->fh); |
641 | req->data = newSVsv (pathname); |
706 | req->data = newSVsv (newpath); |
642 | req->dataptr = SvPV_nolen (req->data); |
707 | req->dataptr = SvPVbyte_nolen (req->data); |
643 | req->callback = SvREFCNT_inc (callback); |
|
|
644 | |
708 | |
645 | send_req (req); |
709 | send_req (req); |
646 | } |
710 | } |
647 | |
711 | |
648 | void |
712 | void |