1 | /* solaris */ |
1 | /* solaris */ |
2 | #define _POSIX_PTHREAD_SEMANTICS 1 |
2 | #define _POSIX_PTHREAD_SEMANTICS 1 |
3 | |
3 | |
4 | #if __linux |
4 | #if __linux && !defined(_GNU_SOURCE) |
5 | # define _GNU_SOURCE |
5 | # define _GNU_SOURCE |
6 | #endif |
6 | #endif |
7 | |
7 | |
|
|
8 | /* just in case */ |
8 | #define _REENTRANT 1 |
9 | #define _REENTRANT 1 |
9 | |
10 | |
10 | #include <errno.h> |
11 | #include <errno.h> |
11 | |
12 | |
12 | #include "EXTERN.h" |
13 | #include "EXTERN.h" |
… | |
… | |
42 | # else |
43 | # else |
43 | # error sendfile support requested but not available |
44 | # error sendfile support requested but not available |
44 | # endif |
45 | # endif |
45 | #endif |
46 | #endif |
46 | |
47 | |
|
|
48 | /* number of seconds after which idle threads exit */ |
|
|
49 | #define IDLE_TIMEOUT 10 |
|
|
50 | |
47 | /* used for struct dirent, AIX doesn't provide it */ |
51 | /* used for struct dirent, AIX doesn't provide it */ |
48 | #ifndef NAME_MAX |
52 | #ifndef NAME_MAX |
49 | # define NAME_MAX 4096 |
53 | # define NAME_MAX 4096 |
|
|
54 | #endif |
|
|
55 | |
|
|
56 | #ifndef PTHREAD_STACK_MIN |
|
|
57 | /* care for broken platforms, e.g. windows */ |
|
|
58 | # define PTHREAD_STACK_MIN 16384 |
50 | #endif |
59 | #endif |
51 | |
60 | |
52 | #if __ia64 |
61 | #if __ia64 |
53 | # define STACKSIZE 65536 |
62 | # define STACKSIZE 65536 |
54 | #elif __i386 || __x86_64 /* 16k is unreasonably high :( */ |
63 | #elif __i386 || __x86_64 /* 16k is unreasonably high :( */ |
55 | # define STACKSIZE PTHREAD_STACK_MIN |
64 | # define STACKSIZE PTHREAD_STACK_MIN |
56 | #else |
65 | #else |
57 | # define STACKSIZE 16384 |
66 | # define STACKSIZE 16384 |
|
|
67 | #endif |
|
|
68 | |
|
|
69 | /* wether word reads are potentially non-atomic. |
|
|
70 | * this is conservatice, likely most arches this runs |
|
|
71 | * on have atomic word read/writes. |
|
|
72 | */ |
|
|
73 | #ifndef WORDACCESS_UNSAFE |
|
|
74 | # if __i386 || __x86_64 |
|
|
75 | # define WORDACCESS_UNSAFE 0 |
|
|
76 | # else |
|
|
77 | # define WORDACCESS_UNSAFE 1 |
|
|
78 | # endif |
58 | #endif |
79 | #endif |
59 | |
80 | |
60 | /* buffer size for various temporary buffers */ |
81 | /* buffer size for various temporary buffers */ |
61 | #define AIO_BUFSIZE 65536 |
82 | #define AIO_BUFSIZE 65536 |
62 | |
83 | |
… | |
… | |
74 | REQ_READ, REQ_WRITE, REQ_READAHEAD, |
95 | REQ_READ, REQ_WRITE, REQ_READAHEAD, |
75 | REQ_SENDFILE, |
96 | REQ_SENDFILE, |
76 | REQ_STAT, REQ_LSTAT, REQ_FSTAT, |
97 | REQ_STAT, REQ_LSTAT, REQ_FSTAT, |
77 | REQ_FSYNC, REQ_FDATASYNC, |
98 | REQ_FSYNC, REQ_FDATASYNC, |
78 | REQ_UNLINK, REQ_RMDIR, REQ_RENAME, |
99 | REQ_UNLINK, REQ_RMDIR, REQ_RENAME, |
79 | REQ_READDIR, |
100 | REQ_MKNOD, REQ_READDIR, |
80 | REQ_LINK, REQ_SYMLINK, |
101 | REQ_LINK, REQ_SYMLINK, |
81 | REQ_GROUP, REQ_NOP, |
102 | REQ_GROUP, REQ_NOP, |
82 | REQ_BUSY, |
103 | REQ_BUSY, |
83 | }; |
104 | }; |
84 | |
105 | |
… | |
… | |
124 | DEFAULT_PRI = 0, |
145 | DEFAULT_PRI = 0, |
125 | PRI_BIAS = -PRI_MIN, |
146 | PRI_BIAS = -PRI_MIN, |
126 | NUM_PRI = PRI_MAX + PRI_BIAS + 1, |
147 | NUM_PRI = PRI_MAX + PRI_BIAS + 1, |
127 | }; |
148 | }; |
128 | |
149 | |
|
|
150 | #define AIO_TICKS ((1000000 + 1023) >> 10) |
|
|
151 | |
|
|
152 | static unsigned int max_poll_time = 0; |
|
|
153 | static unsigned int max_poll_reqs = 0; |
|
|
154 | |
|
|
155 | /* calculcate time difference in ~1/AIO_TICKS of a second */ |
|
|
156 | static int tvdiff (struct timeval *tv1, struct timeval *tv2) |
|
|
157 | { |
|
|
158 | return (tv2->tv_sec - tv1->tv_sec ) * AIO_TICKS |
|
|
159 | + ((tv2->tv_usec - tv1->tv_usec) >> 10); |
|
|
160 | } |
|
|
161 | |
129 | static int next_pri = DEFAULT_PRI + PRI_BIAS; |
162 | static int next_pri = DEFAULT_PRI + PRI_BIAS; |
130 | |
163 | |
131 | static int started, wanted; |
164 | static unsigned int started, idle, wanted; |
132 | static volatile int nreqs; |
|
|
133 | static int max_outstanding = 1<<30; |
|
|
134 | static int respipe [2]; |
|
|
135 | |
165 | |
136 | #if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) |
166 | #if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) |
137 | # define AIO_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP |
167 | # define AIO_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP |
138 | #else |
168 | #else |
139 | # define AIO_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER |
169 | # define AIO_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER |
140 | #endif |
170 | #endif |
141 | |
171 | |
142 | #define LOCK(mutex) pthread_mutex_lock (&(mutex)) |
172 | #define LOCK(mutex) pthread_mutex_lock (&(mutex)) |
143 | #define UNLOCK(mutex) pthread_mutex_unlock (&(mutex)) |
173 | #define UNLOCK(mutex) pthread_mutex_unlock (&(mutex)) |
144 | |
174 | |
145 | /* worker threasd management */ |
175 | /* worker threads management */ |
146 | static pthread_mutex_t wrklock = AIO_MUTEX_INIT; |
176 | static pthread_mutex_t wrklock = AIO_MUTEX_INIT; |
147 | |
177 | |
148 | typedef struct worker { |
178 | typedef struct worker { |
149 | /* locked by wrklock */ |
179 | /* locked by wrklock */ |
150 | struct worker *prev, *next; |
180 | struct worker *prev, *next; |
… | |
… | |
180 | wrk->prev->next = wrk->next; |
210 | wrk->prev->next = wrk->next; |
181 | |
211 | |
182 | free (wrk); |
212 | free (wrk); |
183 | } |
213 | } |
184 | |
214 | |
|
|
215 | static volatile unsigned int nreqs, nready, npending; |
|
|
216 | static volatile unsigned int max_idle = 4; |
|
|
217 | static volatile unsigned int max_outstanding = 0xffffffff; |
|
|
218 | static int respipe [2]; |
|
|
219 | |
185 | static pthread_mutex_t reslock = AIO_MUTEX_INIT; |
220 | static pthread_mutex_t reslock = AIO_MUTEX_INIT; |
186 | static pthread_mutex_t reqlock = AIO_MUTEX_INIT; |
221 | static pthread_mutex_t reqlock = AIO_MUTEX_INIT; |
187 | static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER; |
222 | static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER; |
|
|
223 | |
|
|
224 | #if WORDACCESS_UNSAFE |
|
|
225 | |
|
|
226 | static unsigned int get_nready () |
|
|
227 | { |
|
|
228 | unsigned int retval; |
|
|
229 | |
|
|
230 | LOCK (reqlock); |
|
|
231 | retval = nready; |
|
|
232 | UNLOCK (reqlock); |
|
|
233 | |
|
|
234 | return retval; |
|
|
235 | } |
|
|
236 | |
|
|
237 | static unsigned int get_npending () |
|
|
238 | { |
|
|
239 | unsigned int retval; |
|
|
240 | |
|
|
241 | LOCK (reslock); |
|
|
242 | retval = npending; |
|
|
243 | UNLOCK (reslock); |
|
|
244 | |
|
|
245 | return retval; |
|
|
246 | } |
|
|
247 | |
|
|
248 | static unsigned int get_nthreads () |
|
|
249 | { |
|
|
250 | unsigned int retval; |
|
|
251 | |
|
|
252 | LOCK (wrklock); |
|
|
253 | retval = started; |
|
|
254 | UNLOCK (wrklock); |
|
|
255 | |
|
|
256 | return retval; |
|
|
257 | } |
|
|
258 | |
|
|
259 | #else |
|
|
260 | |
|
|
261 | # define get_nready() nready |
|
|
262 | # define get_npending() npending |
|
|
263 | # define get_nthreads() started |
|
|
264 | |
|
|
265 | #endif |
188 | |
266 | |
189 | /* |
267 | /* |
190 | * a somewhat faster data structure might be nice, but |
268 | * a somewhat faster data structure might be nice, but |
191 | * with 8 priorities this actually needs <20 insns |
269 | * with 8 priorities this actually needs <20 insns |
192 | * per shift, the most expensive operation. |
270 | * per shift, the most expensive operation. |
… | |
… | |
238 | } |
316 | } |
239 | |
317 | |
240 | abort (); |
318 | abort (); |
241 | } |
319 | } |
242 | |
320 | |
|
|
321 | static int poll_cb (); |
243 | static void req_invoke (aio_req req); |
322 | static void req_invoke (aio_req req); |
244 | static void req_free (aio_req req); |
323 | static void req_free (aio_req req); |
245 | static void req_cancel (aio_req req); |
324 | static void req_cancel (aio_req req); |
246 | |
325 | |
247 | /* must be called at most once */ |
326 | /* must be called at most once */ |
… | |
… | |
312 | req_invoke (grp); |
391 | req_invoke (grp); |
313 | req_free (grp); |
392 | req_free (grp); |
314 | } |
393 | } |
315 | } |
394 | } |
316 | |
395 | |
317 | static void poll_wait () |
|
|
318 | { |
|
|
319 | fd_set rfd; |
|
|
320 | |
|
|
321 | while (nreqs) |
|
|
322 | { |
|
|
323 | int size; |
|
|
324 | #if !(__i386 || __x86_64) /* safe without sempahore on these archs */ |
|
|
325 | LOCK (reslock); |
|
|
326 | #endif |
|
|
327 | size = res_queue.size; |
|
|
328 | #if !(__i386 || __x86_64) /* safe without sempahore on these archs */ |
|
|
329 | UNLOCK (reslock); |
|
|
330 | #endif |
|
|
331 | |
|
|
332 | if (size) |
|
|
333 | return; |
|
|
334 | |
|
|
335 | FD_ZERO(&rfd); |
|
|
336 | FD_SET(respipe [0], &rfd); |
|
|
337 | |
|
|
338 | select (respipe [0] + 1, &rfd, 0, 0, 0); |
|
|
339 | } |
|
|
340 | } |
|
|
341 | |
|
|
342 | static void req_invoke (aio_req req) |
396 | static void req_invoke (aio_req req) |
343 | { |
397 | { |
344 | dSP; |
398 | dSP; |
345 | |
399 | |
346 | if (!(req->flags & FLAG_CANCELLED) && SvOK (req->callback)) |
400 | if (!(req->flags & FLAG_CANCELLED) && SvOK (req->callback)) |
347 | { |
401 | { |
348 | errno = req->errorno; |
|
|
349 | |
|
|
350 | ENTER; |
402 | ENTER; |
351 | SAVETMPS; |
403 | SAVETMPS; |
352 | PUSHMARK (SP); |
404 | PUSHMARK (SP); |
353 | EXTEND (SP, 1); |
405 | EXTEND (SP, 1); |
354 | |
406 | |
… | |
… | |
419 | default: |
471 | default: |
420 | PUSHs (sv_2mortal (newSViv (req->result))); |
472 | PUSHs (sv_2mortal (newSViv (req->result))); |
421 | break; |
473 | break; |
422 | } |
474 | } |
423 | |
475 | |
|
|
476 | errno = req->errorno; |
424 | |
477 | |
425 | PUTBACK; |
478 | PUTBACK; |
426 | call_sv (req->callback, G_VOID | G_EVAL); |
479 | call_sv (req->callback, G_VOID | G_EVAL); |
427 | SPAGAIN; |
480 | SPAGAIN; |
428 | |
481 | |
… | |
… | |
490 | req->flags |= FLAG_CANCELLED; |
543 | req->flags |= FLAG_CANCELLED; |
491 | |
544 | |
492 | req_cancel_subs (req); |
545 | req_cancel_subs (req); |
493 | } |
546 | } |
494 | |
547 | |
495 | static int poll_cb () |
|
|
496 | { |
|
|
497 | dSP; |
|
|
498 | int count = 0; |
|
|
499 | int do_croak = 0; |
|
|
500 | aio_req req; |
|
|
501 | |
|
|
502 | for (;;) |
|
|
503 | { |
|
|
504 | LOCK (reslock); |
|
|
505 | req = reqq_shift (&res_queue); |
|
|
506 | |
|
|
507 | if (req) |
|
|
508 | { |
|
|
509 | if (!res_queue.size) |
|
|
510 | { |
|
|
511 | /* read any signals sent by the worker threads */ |
|
|
512 | char buf [32]; |
|
|
513 | while (read (respipe [0], buf, 32) == 32) |
|
|
514 | ; |
|
|
515 | } |
|
|
516 | } |
|
|
517 | |
|
|
518 | UNLOCK (reslock); |
|
|
519 | |
|
|
520 | if (!req) |
|
|
521 | break; |
|
|
522 | |
|
|
523 | --nreqs; |
|
|
524 | |
|
|
525 | if (req->type == REQ_QUIT) |
|
|
526 | started--; |
|
|
527 | else if (req->type == REQ_GROUP && req->length) |
|
|
528 | { |
|
|
529 | req->fd = 1; /* mark request as delayed */ |
|
|
530 | continue; |
|
|
531 | } |
|
|
532 | else |
|
|
533 | { |
|
|
534 | if (req->type == REQ_READ) |
|
|
535 | SvCUR_set (req->data, req->dataoffset + (req->result > 0 ? req->result : 0)); |
|
|
536 | |
|
|
537 | if (req->data2ptr && (req->type == REQ_READ || req->type == REQ_WRITE)) |
|
|
538 | SvREADONLY_off (req->data); |
|
|
539 | |
|
|
540 | if (req->statdata) |
|
|
541 | { |
|
|
542 | PL_laststype = req->type == REQ_LSTAT ? OP_LSTAT : OP_STAT; |
|
|
543 | PL_laststatval = req->result; |
|
|
544 | PL_statcache = *(req->statdata); |
|
|
545 | } |
|
|
546 | |
|
|
547 | req_invoke (req); |
|
|
548 | |
|
|
549 | count++; |
|
|
550 | } |
|
|
551 | |
|
|
552 | req_free (req); |
|
|
553 | } |
|
|
554 | |
|
|
555 | return count; |
|
|
556 | } |
|
|
557 | |
|
|
558 | static void *aio_proc(void *arg); |
548 | static void *aio_proc(void *arg); |
559 | |
549 | |
560 | static void start_thread (void) |
550 | static void start_thread (void) |
561 | { |
551 | { |
562 | sigset_t fullsigset, oldsigset; |
552 | sigset_t fullsigset, oldsigset; |
… | |
… | |
568 | croak ("unable to allocate worker thread data"); |
558 | croak ("unable to allocate worker thread data"); |
569 | |
559 | |
570 | pthread_attr_init (&attr); |
560 | pthread_attr_init (&attr); |
571 | pthread_attr_setstacksize (&attr, STACKSIZE); |
561 | pthread_attr_setstacksize (&attr, STACKSIZE); |
572 | pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); |
562 | pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); |
|
|
563 | #ifdef PTHREAD_SCOPE_PROCESS |
|
|
564 | pthread_attr_setscope (&attr, PTHREAD_SCOPE_PROCESS); |
|
|
565 | #endif |
573 | |
566 | |
574 | sigfillset (&fullsigset); |
567 | sigfillset (&fullsigset); |
575 | |
568 | |
576 | LOCK (wrklock); |
569 | LOCK (wrklock); |
577 | sigprocmask (SIG_SETMASK, &fullsigset, &oldsigset); |
570 | sigprocmask (SIG_SETMASK, &fullsigset, &oldsigset); |
… | |
… | |
580 | { |
573 | { |
581 | wrk->prev = &wrk_first; |
574 | wrk->prev = &wrk_first; |
582 | wrk->next = wrk_first.next; |
575 | wrk->next = wrk_first.next; |
583 | wrk_first.next->prev = wrk; |
576 | wrk_first.next->prev = wrk; |
584 | wrk_first.next = wrk; |
577 | wrk_first.next = wrk; |
585 | started++; |
578 | ++started; |
586 | } |
579 | } |
587 | else |
580 | else |
588 | free (wrk); |
581 | free (wrk); |
589 | |
582 | |
590 | sigprocmask (SIG_SETMASK, &oldsigset, 0); |
583 | sigprocmask (SIG_SETMASK, &oldsigset, 0); |
591 | UNLOCK (wrklock); |
584 | UNLOCK (wrklock); |
592 | } |
585 | } |
593 | |
586 | |
|
|
587 | static void maybe_start_thread () |
|
|
588 | { |
|
|
589 | if (get_nthreads () >= wanted) |
|
|
590 | return; |
|
|
591 | |
|
|
592 | /* todo: maybe use idle here, but might be less exact */ |
|
|
593 | if (0 <= (int)get_nthreads () + (int)get_npending () - (int)nreqs) |
|
|
594 | return; |
|
|
595 | |
|
|
596 | start_thread (); |
|
|
597 | } |
|
|
598 | |
594 | static void req_send (aio_req req) |
599 | static void req_send (aio_req req) |
595 | { |
600 | { |
596 | while (started < wanted && nreqs >= started) |
|
|
597 | start_thread (); |
|
|
598 | |
|
|
599 | ++nreqs; |
601 | ++nreqs; |
|
|
602 | |
|
|
603 | LOCK (reqlock); |
|
|
604 | ++nready; |
|
|
605 | reqq_push (&req_queue, req); |
|
|
606 | pthread_cond_signal (&reqwait); |
|
|
607 | UNLOCK (reqlock); |
|
|
608 | |
|
|
609 | maybe_start_thread (); |
|
|
610 | } |
|
|
611 | |
|
|
612 | static void end_thread (void) |
|
|
613 | { |
|
|
614 | aio_req req; |
|
|
615 | |
|
|
616 | Newz (0, req, 1, aio_cb); |
|
|
617 | |
|
|
618 | req->type = REQ_QUIT; |
|
|
619 | req->pri = PRI_MAX + PRI_BIAS; |
600 | |
620 | |
601 | LOCK (reqlock); |
621 | LOCK (reqlock); |
602 | reqq_push (&req_queue, req); |
622 | reqq_push (&req_queue, req); |
603 | pthread_cond_signal (&reqwait); |
623 | pthread_cond_signal (&reqwait); |
604 | UNLOCK (reqlock); |
624 | UNLOCK (reqlock); |
605 | |
625 | |
606 | if (nreqs > max_outstanding) |
626 | LOCK (wrklock); |
607 | for (;;) |
627 | --started; |
608 | { |
628 | UNLOCK (wrklock); |
609 | poll_cb (); |
|
|
610 | |
|
|
611 | if (nreqs <= max_outstanding) |
|
|
612 | break; |
|
|
613 | |
|
|
614 | poll_wait (); |
|
|
615 | } |
|
|
616 | } |
629 | } |
617 | |
630 | |
618 | static void end_thread (void) |
631 | static void set_max_idle (int nthreads) |
619 | { |
632 | { |
620 | aio_req req; |
633 | if (WORDACCESS_UNSAFE) LOCK (reqlock); |
621 | |
634 | max_idle = nthreads <= 0 ? 1 : nthreads; |
622 | Newz (0, req, 1, aio_cb); |
635 | if (WORDACCESS_UNSAFE) UNLOCK (reqlock); |
623 | |
|
|
624 | req->type = REQ_QUIT; |
|
|
625 | req->pri = PRI_MAX + PRI_BIAS; |
|
|
626 | |
|
|
627 | req_send (req); |
|
|
628 | } |
636 | } |
629 | |
637 | |
630 | static void min_parallel (int nthreads) |
638 | static void min_parallel (int nthreads) |
631 | { |
639 | { |
632 | if (wanted < nthreads) |
640 | if (wanted < nthreads) |
633 | wanted = nthreads; |
641 | wanted = nthreads; |
634 | } |
642 | } |
635 | |
643 | |
636 | static void max_parallel (int nthreads) |
644 | static void max_parallel (int nthreads) |
637 | { |
645 | { |
638 | int cur = started; |
|
|
639 | |
|
|
640 | if (wanted > nthreads) |
646 | if (wanted > nthreads) |
641 | wanted = nthreads; |
647 | wanted = nthreads; |
642 | |
648 | |
643 | while (cur > wanted) |
|
|
644 | { |
|
|
645 | end_thread (); |
|
|
646 | cur--; |
|
|
647 | } |
|
|
648 | |
|
|
649 | while (started > wanted) |
649 | while (started > wanted) |
|
|
650 | end_thread (); |
|
|
651 | } |
|
|
652 | |
|
|
653 | static void poll_wait () |
|
|
654 | { |
|
|
655 | fd_set rfd; |
|
|
656 | |
|
|
657 | while (nreqs) |
|
|
658 | { |
|
|
659 | int size; |
|
|
660 | if (WORDACCESS_UNSAFE) LOCK (reslock); |
|
|
661 | size = res_queue.size; |
|
|
662 | if (WORDACCESS_UNSAFE) UNLOCK (reslock); |
|
|
663 | |
|
|
664 | if (size) |
|
|
665 | return; |
|
|
666 | |
|
|
667 | maybe_start_thread (); |
|
|
668 | |
|
|
669 | FD_ZERO(&rfd); |
|
|
670 | FD_SET(respipe [0], &rfd); |
|
|
671 | |
|
|
672 | select (respipe [0] + 1, &rfd, 0, 0, 0); |
650 | { |
673 | } |
|
|
674 | } |
|
|
675 | |
|
|
676 | static int poll_cb () |
|
|
677 | { |
|
|
678 | dSP; |
|
|
679 | int count = 0; |
|
|
680 | int maxreqs = max_poll_reqs; |
|
|
681 | int do_croak = 0; |
|
|
682 | struct timeval tv_start, tv_now; |
|
|
683 | aio_req req; |
|
|
684 | |
|
|
685 | if (max_poll_time) |
|
|
686 | gettimeofday (&tv_start, 0); |
|
|
687 | |
|
|
688 | for (;;) |
|
|
689 | { |
|
|
690 | for (;;) |
|
|
691 | { |
|
|
692 | maybe_start_thread (); |
|
|
693 | |
|
|
694 | LOCK (reslock); |
|
|
695 | req = reqq_shift (&res_queue); |
|
|
696 | |
|
|
697 | if (req) |
|
|
698 | { |
|
|
699 | --npending; |
|
|
700 | |
|
|
701 | if (!res_queue.size) |
|
|
702 | { |
|
|
703 | /* read any signals sent by the worker threads */ |
|
|
704 | char buf [32]; |
|
|
705 | while (read (respipe [0], buf, 32) == 32) |
|
|
706 | ; |
|
|
707 | } |
|
|
708 | } |
|
|
709 | |
|
|
710 | UNLOCK (reslock); |
|
|
711 | |
|
|
712 | if (!req) |
|
|
713 | break; |
|
|
714 | |
|
|
715 | --nreqs; |
|
|
716 | |
|
|
717 | if (req->type == REQ_GROUP && req->length) |
|
|
718 | { |
|
|
719 | req->fd = 1; /* mark request as delayed */ |
|
|
720 | continue; |
|
|
721 | } |
|
|
722 | else |
|
|
723 | { |
|
|
724 | if (req->type == REQ_READ) |
|
|
725 | SvCUR_set (req->data, req->dataoffset + (req->result > 0 ? req->result : 0)); |
|
|
726 | |
|
|
727 | if (req->data2ptr && (req->type == REQ_READ || req->type == REQ_WRITE)) |
|
|
728 | SvREADONLY_off (req->data); |
|
|
729 | |
|
|
730 | if (req->statdata) |
|
|
731 | { |
|
|
732 | PL_laststype = req->type == REQ_LSTAT ? OP_LSTAT : OP_STAT; |
|
|
733 | PL_laststatval = req->result; |
|
|
734 | PL_statcache = *(req->statdata); |
|
|
735 | } |
|
|
736 | |
|
|
737 | req_invoke (req); |
|
|
738 | |
|
|
739 | count++; |
|
|
740 | } |
|
|
741 | |
|
|
742 | req_free (req); |
|
|
743 | |
|
|
744 | if (maxreqs && !--maxreqs) |
|
|
745 | break; |
|
|
746 | |
|
|
747 | if (max_poll_time) |
|
|
748 | { |
|
|
749 | gettimeofday (&tv_now, 0); |
|
|
750 | |
|
|
751 | if (tvdiff (&tv_start, &tv_now) >= max_poll_time) |
|
|
752 | break; |
|
|
753 | } |
|
|
754 | } |
|
|
755 | |
|
|
756 | if (nreqs <= max_outstanding) |
|
|
757 | break; |
|
|
758 | |
651 | poll_wait (); |
759 | poll_wait (); |
652 | poll_cb (); |
760 | |
|
|
761 | ++maxreqs; |
653 | } |
762 | } |
|
|
763 | |
|
|
764 | return count; |
654 | } |
765 | } |
655 | |
766 | |
656 | static void create_pipe () |
767 | static void create_pipe () |
657 | { |
768 | { |
658 | if (pipe (respipe)) |
769 | if (pipe (respipe)) |
… | |
… | |
713 | #if !HAVE_FDATASYNC |
824 | #if !HAVE_FDATASYNC |
714 | # define fdatasync fsync |
825 | # define fdatasync fsync |
715 | #endif |
826 | #endif |
716 | |
827 | |
717 | #if !HAVE_READAHEAD |
828 | #if !HAVE_READAHEAD |
718 | # define readahead aio_readahead |
829 | # define readahead(fd,offset,count) aio_readahead (fd, offset, count, self) |
719 | |
830 | |
720 | static ssize_t readahead (int fd, off_t offset, size_t count) |
831 | static ssize_t aio_readahead (int fd, off_t offset, size_t count, worker *self) |
721 | { |
832 | { |
722 | dBUF; |
833 | dBUF; |
723 | |
834 | |
724 | while (count > 0) |
835 | while (count > 0) |
725 | { |
836 | { |
… | |
… | |
730 | count -= len; |
841 | count -= len; |
731 | } |
842 | } |
732 | |
843 | |
733 | errno = 0; |
844 | errno = 0; |
734 | } |
845 | } |
|
|
846 | |
735 | #endif |
847 | #endif |
736 | |
848 | |
737 | #if !HAVE_READDIR_R |
849 | #if !HAVE_READDIR_R |
738 | # define readdir_r aio_readdir_r |
850 | # define readdir_r aio_readdir_r |
739 | |
851 | |
… | |
… | |
784 | { |
896 | { |
785 | off_t sbytes; |
897 | off_t sbytes; |
786 | res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0); |
898 | res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0); |
787 | |
899 | |
788 | if (res < 0 && sbytes) |
900 | if (res < 0 && sbytes) |
789 | /* maybe only on EAGAIN only: as usual, the manpage leaves you guessing */ |
901 | /* maybe only on EAGAIN: as usual, the manpage leaves you guessing */ |
790 | res = sbytes; |
902 | res = sbytes; |
791 | } |
903 | } |
792 | |
904 | |
793 | # elif __hpux |
905 | # elif __hpux |
794 | res = sendfile (ofd, ifd, offset, count, 0, 0); |
906 | res = sendfile (ofd, ifd, offset, count, 0, 0); |
… | |
… | |
874 | int errorno; |
986 | int errorno; |
875 | |
987 | |
876 | LOCK (wrklock); |
988 | LOCK (wrklock); |
877 | self->dirp = dirp = opendir (req->dataptr); |
989 | self->dirp = dirp = opendir (req->dataptr); |
878 | self->dbuf = u = malloc (sizeof (*u)); |
990 | self->dbuf = u = malloc (sizeof (*u)); |
|
|
991 | req->data2ptr = names = malloc (memlen); |
879 | UNLOCK (wrklock); |
992 | UNLOCK (wrklock); |
880 | |
|
|
881 | req->data2ptr = names = malloc (memlen); |
|
|
882 | |
993 | |
883 | if (dirp && u && names) |
994 | if (dirp && u && names) |
884 | for (;;) |
995 | for (;;) |
885 | { |
996 | { |
886 | errno = 0; |
997 | errno = 0; |
… | |
… | |
922 | /*****************************************************************************/ |
1033 | /*****************************************************************************/ |
923 | |
1034 | |
924 | static void *aio_proc (void *thr_arg) |
1035 | static void *aio_proc (void *thr_arg) |
925 | { |
1036 | { |
926 | aio_req req; |
1037 | aio_req req; |
927 | int type; |
1038 | struct timespec ts; |
928 | worker *self = (worker *)thr_arg; |
1039 | worker *self = (worker *)thr_arg; |
929 | |
1040 | |
930 | do |
1041 | /* try to distribute timeouts somewhat evenly */ |
|
|
1042 | ts.tv_nsec = (((unsigned long)self + (unsigned long)ts.tv_sec) & 1023UL) |
|
|
1043 | * (1000000000UL / 1024UL); |
|
|
1044 | |
|
|
1045 | for (;;) |
931 | { |
1046 | { |
|
|
1047 | ts.tv_sec = time (0) + IDLE_TIMEOUT; |
|
|
1048 | |
932 | LOCK (reqlock); |
1049 | LOCK (reqlock); |
933 | |
1050 | |
934 | for (;;) |
1051 | for (;;) |
935 | { |
1052 | { |
936 | self->req = req = reqq_shift (&req_queue); |
1053 | self->req = req = reqq_shift (&req_queue); |
937 | |
1054 | |
938 | if (req) |
1055 | if (req) |
939 | break; |
1056 | break; |
940 | |
1057 | |
|
|
1058 | ++idle; |
|
|
1059 | |
|
|
1060 | if (pthread_cond_timedwait (&reqwait, &reqlock, &ts) |
|
|
1061 | == ETIMEDOUT) |
|
|
1062 | { |
|
|
1063 | if (idle > max_idle) |
|
|
1064 | { |
|
|
1065 | --idle; |
|
|
1066 | UNLOCK (reqlock); |
|
|
1067 | LOCK (wrklock); |
|
|
1068 | --started; |
|
|
1069 | UNLOCK (wrklock); |
|
|
1070 | goto quit; |
|
|
1071 | } |
|
|
1072 | |
|
|
1073 | /* we are allowed to idle, so do so without any timeout */ |
941 | pthread_cond_wait (&reqwait, &reqlock); |
1074 | pthread_cond_wait (&reqwait, &reqlock); |
|
|
1075 | ts.tv_sec = time (0) + IDLE_TIMEOUT; |
|
|
1076 | } |
|
|
1077 | |
|
|
1078 | --idle; |
942 | } |
1079 | } |
|
|
1080 | |
|
|
1081 | --nready; |
943 | |
1082 | |
944 | UNLOCK (reqlock); |
1083 | UNLOCK (reqlock); |
945 | |
1084 | |
946 | errno = 0; /* strictly unnecessary */ |
1085 | errno = 0; /* strictly unnecessary */ |
947 | type = req->type; /* remember type for QUIT check */ |
|
|
948 | |
1086 | |
949 | if (!(req->flags & FLAG_CANCELLED)) |
1087 | if (!(req->flags & FLAG_CANCELLED)) |
950 | switch (type) |
1088 | switch (req->type) |
951 | { |
1089 | { |
952 | case REQ_READ: req->result = pread (req->fd, req->dataptr, req->length, req->offset); break; |
1090 | case REQ_READ: req->result = pread (req->fd, req->dataptr, req->length, req->offset); break; |
953 | case REQ_WRITE: req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); break; |
1091 | case REQ_WRITE: req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); break; |
954 | |
1092 | |
955 | case REQ_READAHEAD: req->result = readahead (req->fd, req->offset, req->length); break; |
1093 | case REQ_READAHEAD: req->result = readahead (req->fd, req->offset, req->length); break; |
… | |
… | |
964 | case REQ_UNLINK: req->result = unlink (req->dataptr); break; |
1102 | case REQ_UNLINK: req->result = unlink (req->dataptr); break; |
965 | case REQ_RMDIR: req->result = rmdir (req->dataptr); break; |
1103 | case REQ_RMDIR: req->result = rmdir (req->dataptr); break; |
966 | case REQ_RENAME: req->result = rename (req->data2ptr, req->dataptr); break; |
1104 | case REQ_RENAME: req->result = rename (req->data2ptr, req->dataptr); break; |
967 | case REQ_LINK: req->result = link (req->data2ptr, req->dataptr); break; |
1105 | case REQ_LINK: req->result = link (req->data2ptr, req->dataptr); break; |
968 | case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break; |
1106 | case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break; |
|
|
1107 | case REQ_MKNOD: req->result = mknod (req->data2ptr, req->mode, (dev_t)req->offset); break; |
969 | |
1108 | |
970 | case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; |
1109 | case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; |
971 | case REQ_FSYNC: req->result = fsync (req->fd); break; |
1110 | case REQ_FSYNC: req->result = fsync (req->fd); break; |
972 | case REQ_READDIR: scandir_ (req, self); break; |
1111 | case REQ_READDIR: scandir_ (req, self); break; |
973 | |
1112 | |
… | |
… | |
981 | req->result = select (0, 0, 0, 0, &tv); |
1120 | req->result = select (0, 0, 0, 0, &tv); |
982 | } |
1121 | } |
983 | |
1122 | |
984 | case REQ_GROUP: |
1123 | case REQ_GROUP: |
985 | case REQ_NOP: |
1124 | case REQ_NOP: |
|
|
1125 | break; |
|
|
1126 | |
986 | case REQ_QUIT: |
1127 | case REQ_QUIT: |
987 | break; |
1128 | goto quit; |
988 | |
1129 | |
989 | default: |
1130 | default: |
990 | req->result = ENOSYS; |
1131 | req->result = ENOSYS; |
991 | break; |
1132 | break; |
992 | } |
1133 | } |
993 | |
1134 | |
994 | req->errorno = errno; |
1135 | req->errorno = errno; |
995 | |
1136 | |
996 | LOCK (reslock); |
1137 | LOCK (reslock); |
997 | |
1138 | |
|
|
1139 | ++npending; |
|
|
1140 | |
998 | if (!reqq_push (&res_queue, req)) |
1141 | if (!reqq_push (&res_queue, req)) |
999 | /* write a dummy byte to the pipe so fh becomes ready */ |
1142 | /* write a dummy byte to the pipe so fh becomes ready */ |
1000 | write (respipe [1], &respipe, 1); |
1143 | write (respipe [1], &respipe, 1); |
1001 | |
1144 | |
1002 | self->req = 0; |
1145 | self->req = 0; |
1003 | worker_clear (self); |
1146 | worker_clear (self); |
1004 | |
1147 | |
1005 | UNLOCK (reslock); |
1148 | UNLOCK (reslock); |
1006 | } |
1149 | } |
1007 | while (type != REQ_QUIT); |
|
|
1008 | |
1150 | |
|
|
1151 | quit: |
1009 | LOCK (wrklock); |
1152 | LOCK (wrklock); |
1010 | worker_free (self); |
1153 | worker_free (self); |
1011 | UNLOCK (wrklock); |
1154 | UNLOCK (wrklock); |
1012 | |
1155 | |
1013 | return 0; |
1156 | return 0; |
… | |
… | |
1060 | |
1203 | |
1061 | worker_clear (wrk); |
1204 | worker_clear (wrk); |
1062 | worker_free (wrk); |
1205 | worker_free (wrk); |
1063 | } |
1206 | } |
1064 | |
1207 | |
1065 | started = 0; |
1208 | started = 0; |
|
|
1209 | idle = 0; |
1066 | nreqs = 0; |
1210 | nreqs = 0; |
|
|
1211 | nready = 0; |
|
|
1212 | npending = 0; |
1067 | |
1213 | |
1068 | close (respipe [0]); |
1214 | close (respipe [0]); |
1069 | close (respipe [1]); |
1215 | close (respipe [1]); |
1070 | create_pipe (); |
1216 | create_pipe (); |
1071 | |
1217 | |
… | |
… | |
1098 | PROTOTYPES: ENABLE |
1244 | PROTOTYPES: ENABLE |
1099 | |
1245 | |
1100 | BOOT: |
1246 | BOOT: |
1101 | { |
1247 | { |
1102 | HV *stash = gv_stashpv ("IO::AIO", 1); |
1248 | HV *stash = gv_stashpv ("IO::AIO", 1); |
|
|
1249 | |
1103 | newCONSTSUB (stash, "EXDEV", newSViv (EXDEV)); |
1250 | newCONSTSUB (stash, "EXDEV", newSViv (EXDEV)); |
1104 | newCONSTSUB (stash, "O_RDONLY", newSViv (O_RDONLY)); |
1251 | newCONSTSUB (stash, "O_RDONLY", newSViv (O_RDONLY)); |
1105 | newCONSTSUB (stash, "O_WRONLY", newSViv (O_WRONLY)); |
1252 | newCONSTSUB (stash, "O_WRONLY", newSViv (O_WRONLY)); |
|
|
1253 | newCONSTSUB (stash, "O_CREAT", newSViv (O_CREAT)); |
|
|
1254 | newCONSTSUB (stash, "O_TRUNC", newSViv (O_TRUNC)); |
|
|
1255 | newCONSTSUB (stash, "S_IFIFO", newSViv (S_IFIFO)); |
1106 | |
1256 | |
1107 | create_pipe (); |
1257 | create_pipe (); |
1108 | pthread_atfork (atfork_prepare, atfork_parent, atfork_child); |
1258 | pthread_atfork (atfork_prepare, atfork_parent, atfork_child); |
1109 | } |
1259 | } |
1110 | |
1260 | |
1111 | void |
1261 | void |
1112 | min_parallel (nthreads) |
1262 | max_poll_reqs (int nreqs) |
1113 | int nthreads |
|
|
1114 | PROTOTYPE: $ |
1263 | PROTOTYPE: $ |
|
|
1264 | CODE: |
|
|
1265 | max_poll_reqs = nreqs; |
1115 | |
1266 | |
1116 | void |
1267 | void |
1117 | max_parallel (nthreads) |
1268 | max_poll_time (double nseconds) |
1118 | int nthreads |
|
|
1119 | PROTOTYPE: $ |
1269 | PROTOTYPE: $ |
|
|
1270 | CODE: |
|
|
1271 | max_poll_time = nseconds * AIO_TICKS; |
|
|
1272 | |
|
|
1273 | void |
|
|
1274 | min_parallel (int nthreads) |
|
|
1275 | PROTOTYPE: $ |
|
|
1276 | |
|
|
1277 | void |
|
|
1278 | max_parallel (int nthreads) |
|
|
1279 | PROTOTYPE: $ |
|
|
1280 | |
|
|
1281 | void |
|
|
1282 | max_idle (int nthreads) |
|
|
1283 | PROTOTYPE: $ |
|
|
1284 | CODE: |
|
|
1285 | set_max_idle (nthreads); |
1120 | |
1286 | |
1121 | int |
1287 | int |
1122 | max_outstanding (nreqs) |
1288 | max_outstanding (int maxreqs) |
1123 | int nreqs |
1289 | PROTOTYPE: $ |
1124 | PROTOTYPE: $ |
|
|
1125 | CODE: |
1290 | CODE: |
1126 | RETVAL = max_outstanding; |
1291 | RETVAL = max_outstanding; |
1127 | max_outstanding = nreqs; |
1292 | max_outstanding = maxreqs; |
|
|
1293 | OUTPUT: |
|
|
1294 | RETVAL |
1128 | |
1295 | |
1129 | void |
1296 | void |
1130 | aio_open (pathname,flags,mode,callback=&PL_sv_undef) |
1297 | aio_open (pathname,flags,mode,callback=&PL_sv_undef) |
1131 | SV * pathname |
1298 | SV * pathname |
1132 | int flags |
1299 | int flags |
… | |
… | |
1347 | |
1514 | |
1348 | REQ_SEND; |
1515 | REQ_SEND; |
1349 | } |
1516 | } |
1350 | |
1517 | |
1351 | void |
1518 | void |
|
|
1519 | aio_mknod (pathname,mode,dev,callback=&PL_sv_undef) |
|
|
1520 | SV * pathname |
|
|
1521 | SV * callback |
|
|
1522 | UV mode |
|
|
1523 | UV dev |
|
|
1524 | PPCODE: |
|
|
1525 | { |
|
|
1526 | dREQ; |
|
|
1527 | |
|
|
1528 | req->type = REQ_MKNOD; |
|
|
1529 | req->data = newSVsv (pathname); |
|
|
1530 | req->dataptr = SvPVbyte_nolen (req->data); |
|
|
1531 | req->mode = (mode_t)mode; |
|
|
1532 | req->offset = dev; |
|
|
1533 | |
|
|
1534 | REQ_SEND; |
|
|
1535 | } |
|
|
1536 | |
|
|
1537 | void |
1352 | aio_busy (delay,callback=&PL_sv_undef) |
1538 | aio_busy (delay,callback=&PL_sv_undef) |
1353 | double delay |
1539 | double delay |
1354 | SV * callback |
1540 | SV * callback |
1355 | PPCODE: |
1541 | PPCODE: |
1356 | { |
1542 | { |
… | |
… | |
1387 | req->type = REQ_NOP; |
1573 | req->type = REQ_NOP; |
1388 | |
1574 | |
1389 | REQ_SEND; |
1575 | REQ_SEND; |
1390 | } |
1576 | } |
1391 | |
1577 | |
1392 | void |
1578 | int |
1393 | aioreq_pri (int pri = DEFAULT_PRI) |
1579 | aioreq_pri (int pri = 0) |
1394 | CODE: |
1580 | PROTOTYPE: ;$ |
|
|
1581 | CODE: |
|
|
1582 | RETVAL = next_pri - PRI_BIAS; |
|
|
1583 | if (items > 0) |
|
|
1584 | { |
1395 | if (pri < PRI_MIN) pri = PRI_MIN; |
1585 | if (pri < PRI_MIN) pri = PRI_MIN; |
1396 | if (pri > PRI_MAX) pri = PRI_MAX; |
1586 | if (pri > PRI_MAX) pri = PRI_MAX; |
1397 | next_pri = pri + PRI_BIAS; |
1587 | next_pri = pri + PRI_BIAS; |
|
|
1588 | } |
|
|
1589 | OUTPUT: |
|
|
1590 | RETVAL |
1398 | |
1591 | |
1399 | void |
1592 | void |
1400 | aioreq_nice (int nice = 0) |
1593 | aioreq_nice (int nice = 0) |
1401 | CODE: |
1594 | CODE: |
1402 | nice = next_pri - nice; |
1595 | nice = next_pri - nice; |
1403 | if (nice < PRI_MIN) nice = PRI_MIN; |
1596 | if (nice < PRI_MIN) nice = PRI_MIN; |
1404 | if (nice > PRI_MAX) nice = PRI_MAX; |
1597 | if (nice > PRI_MAX) nice = PRI_MAX; |
1405 | next_pri = nice + PRI_BIAS; |
1598 | next_pri = nice + PRI_BIAS; |
1406 | |
1599 | |
1407 | void |
1600 | void |
1408 | flush () |
1601 | flush () |
1409 | PROTOTYPE: |
1602 | PROTOTYPE: |
1410 | CODE: |
1603 | CODE: |
1411 | while (nreqs) |
1604 | while (nreqs) |
1412 | { |
1605 | { |
1413 | poll_wait (); |
1606 | poll_wait (); |
1414 | poll_cb (); |
1607 | poll_cb (0); |
1415 | } |
1608 | } |
1416 | |
1609 | |
1417 | void |
1610 | void |
1418 | poll() |
1611 | poll() |
1419 | PROTOTYPE: |
1612 | PROTOTYPE: |
1420 | CODE: |
1613 | CODE: |
1421 | if (nreqs) |
1614 | if (nreqs) |
1422 | { |
1615 | { |
1423 | poll_wait (); |
1616 | poll_wait (); |
1424 | poll_cb (); |
1617 | poll_cb (0); |
1425 | } |
1618 | } |
1426 | |
1619 | |
1427 | int |
1620 | int |
1428 | poll_fileno() |
1621 | poll_fileno() |
1429 | PROTOTYPE: |
1622 | PROTOTYPE: |
… | |
… | |
1453 | CODE: |
1646 | CODE: |
1454 | RETVAL = nreqs; |
1647 | RETVAL = nreqs; |
1455 | OUTPUT: |
1648 | OUTPUT: |
1456 | RETVAL |
1649 | RETVAL |
1457 | |
1650 | |
|
|
1651 | int |
|
|
1652 | nready() |
|
|
1653 | PROTOTYPE: |
|
|
1654 | CODE: |
|
|
1655 | RETVAL = get_nready (); |
|
|
1656 | OUTPUT: |
|
|
1657 | RETVAL |
|
|
1658 | |
|
|
1659 | int |
|
|
1660 | npending() |
|
|
1661 | PROTOTYPE: |
|
|
1662 | CODE: |
|
|
1663 | RETVAL = get_npending (); |
|
|
1664 | OUTPUT: |
|
|
1665 | RETVAL |
|
|
1666 | |
|
|
1667 | int |
|
|
1668 | nthreads() |
|
|
1669 | PROTOTYPE: |
|
|
1670 | CODE: |
|
|
1671 | if (WORDACCESS_UNSAFE) LOCK (wrklock); |
|
|
1672 | RETVAL = started; |
|
|
1673 | if (WORDACCESS_UNSAFE) UNLOCK (wrklock); |
|
|
1674 | OUTPUT: |
|
|
1675 | RETVAL |
|
|
1676 | |
1458 | PROTOTYPES: DISABLE |
1677 | PROTOTYPES: DISABLE |
1459 | |
1678 | |
1460 | MODULE = IO::AIO PACKAGE = IO::AIO::REQ |
1679 | MODULE = IO::AIO PACKAGE = IO::AIO::REQ |
1461 | |
1680 | |
1462 | void |
1681 | void |
… | |
… | |
1513 | void |
1732 | void |
1514 | result (aio_req grp, ...) |
1733 | result (aio_req grp, ...) |
1515 | CODE: |
1734 | CODE: |
1516 | { |
1735 | { |
1517 | int i; |
1736 | int i; |
|
|
1737 | AV *av; |
|
|
1738 | |
|
|
1739 | grp->errorno = errno; |
|
|
1740 | |
1518 | AV *av = newAV (); |
1741 | av = newAV (); |
1519 | |
1742 | |
1520 | for (i = 1; i < items; ++i ) |
1743 | for (i = 1; i < items; ++i ) |
1521 | av_push (av, newSVsv (ST (i))); |
1744 | av_push (av, newSVsv (ST (i))); |
1522 | |
1745 | |
1523 | SvREFCNT_dec (grp->data); |
1746 | SvREFCNT_dec (grp->data); |
1524 | grp->data = (SV *)av; |
1747 | grp->data = (SV *)av; |
1525 | } |
1748 | } |
|
|
1749 | |
|
|
1750 | void |
|
|
1751 | errno (aio_req grp, int errorno = errno) |
|
|
1752 | CODE: |
|
|
1753 | grp->errorno = errorno; |
1526 | |
1754 | |
1527 | void |
1755 | void |
1528 | limit (aio_req grp, int limit) |
1756 | limit (aio_req grp, int limit) |
1529 | CODE: |
1757 | CODE: |
1530 | grp->fd2 = limit; |
1758 | grp->fd2 = limit; |