… | |
… | |
8 | #include "autoconf/config.h" |
8 | #include "autoconf/config.h" |
9 | |
9 | |
10 | #include <pthread.h> |
10 | #include <pthread.h> |
11 | |
11 | |
12 | #include <stddef.h> |
12 | #include <stddef.h> |
|
|
13 | #include <errno.h> |
|
|
14 | #include <sys/time.h> |
|
|
15 | #include <sys/select.h> |
13 | #include <sys/types.h> |
16 | #include <sys/types.h> |
14 | #include <sys/stat.h> |
17 | #include <sys/stat.h> |
15 | #include <limits.h> |
18 | #include <limits.h> |
16 | #include <unistd.h> |
19 | #include <unistd.h> |
17 | #include <fcntl.h> |
20 | #include <fcntl.h> |
… | |
… | |
49 | REQ_OPEN, REQ_CLOSE, |
52 | REQ_OPEN, REQ_CLOSE, |
50 | REQ_READ, REQ_WRITE, REQ_READAHEAD, |
53 | REQ_READ, REQ_WRITE, REQ_READAHEAD, |
51 | REQ_SENDFILE, |
54 | REQ_SENDFILE, |
52 | REQ_STAT, REQ_LSTAT, REQ_FSTAT, |
55 | REQ_STAT, REQ_LSTAT, REQ_FSTAT, |
53 | REQ_FSYNC, REQ_FDATASYNC, |
56 | REQ_FSYNC, REQ_FDATASYNC, |
54 | REQ_UNLINK, REQ_RMDIR, |
57 | REQ_UNLINK, REQ_RMDIR, REQ_RENAME, |
55 | REQ_READDIR, |
58 | REQ_READDIR, |
56 | REQ_SYMLINK, |
59 | REQ_LINK, REQ_SYMLINK, |
|
|
60 | REQ_SLEEP, |
|
|
61 | REQ_GROUP, |
57 | }; |
62 | }; |
58 | |
63 | |
|
|
64 | #define AIO_REQ_KLASS "IO::AIO::REQ" |
|
|
65 | #define AIO_GRP_KLASS "IO::AIO::GRP" |
|
|
66 | |
59 | typedef struct aio_cb { |
67 | typedef struct aio_cb |
|
|
68 | { |
|
|
69 | struct aio_cb *grp, *grp_prev, *grp_next; |
|
|
70 | |
60 | struct aio_cb *volatile next; |
71 | struct aio_cb *volatile next; |
61 | |
72 | |
62 | int type; |
73 | SV *self; /* the perl counterpart of this request, if any */ |
63 | |
74 | |
64 | /* should receive a cleanup, with unions */ |
75 | SV *data, *callback; |
65 | int fd, fd2; |
76 | SV *fh, *fh2; |
|
|
77 | void *dataptr, *data2ptr; |
|
|
78 | Stat_t *statdata; |
66 | off_t offset; |
79 | off_t offset; |
67 | size_t length; |
80 | size_t length; |
68 | ssize_t result; |
81 | ssize_t result; |
|
|
82 | |
|
|
83 | int type; |
|
|
84 | int fd, fd2; |
|
|
85 | int errorno; |
|
|
86 | STRLEN dataoffset; |
69 | mode_t mode; /* open */ |
87 | mode_t mode; /* open */ |
70 | int errorno; |
88 | unsigned char cancelled; |
71 | SV *data, *callback; |
|
|
72 | SV *fh, *fh2; |
|
|
73 | void *dataptr, *data2ptr; |
|
|
74 | STRLEN dataoffset; |
|
|
75 | |
|
|
76 | Stat_t *statdata; |
|
|
77 | } aio_cb; |
89 | } aio_cb; |
78 | |
90 | |
79 | typedef aio_cb *aio_req; |
91 | typedef aio_cb *aio_req; |
|
|
92 | typedef aio_cb *aio_req_ornot; |
80 | |
93 | |
81 | static int started, wanted; |
94 | static int started, wanted; |
82 | static volatile int nreqs; |
95 | static volatile int nreqs; |
83 | static int max_outstanding = 1<<30; |
96 | static int max_outstanding = 1<<30; |
84 | static int respipe [2]; |
97 | static int respipe [2]; |
… | |
… | |
88 | static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER; |
101 | static pthread_cond_t reqwait = PTHREAD_COND_INITIALIZER; |
89 | |
102 | |
90 | static volatile aio_req reqs, reqe; /* queue start, queue end */ |
103 | static volatile aio_req reqs, reqe; /* queue start, queue end */ |
91 | static volatile aio_req ress, rese; /* queue start, queue end */ |
104 | static volatile aio_req ress, rese; /* queue start, queue end */ |
92 | |
105 | |
93 | static void free_req (aio_req req) |
106 | static void req_free (aio_req req); |
94 | { |
|
|
95 | if (req->data) |
|
|
96 | SvREFCNT_dec (req->data); |
|
|
97 | |
107 | |
98 | if (req->fh) |
108 | /* must be called at most once */ |
99 | SvREFCNT_dec (req->fh); |
109 | static SV *req_sv (aio_req req, const char *klass) |
|
|
110 | { |
|
|
111 | req->self = (SV *)newHV (); |
|
|
112 | sv_magic (req->self, 0, PERL_MAGIC_ext, (char *)req, 0); |
100 | |
113 | |
101 | if (req->fh2) |
114 | return sv_2mortal (sv_bless (newRV_inc (req->self), gv_stashpv (klass, 1))); |
102 | SvREFCNT_dec (req->fh2); |
|
|
103 | |
|
|
104 | if (req->statdata) |
|
|
105 | Safefree (req->statdata); |
|
|
106 | |
|
|
107 | if (req->callback) |
|
|
108 | SvREFCNT_dec (req->callback); |
|
|
109 | |
|
|
110 | if (req->type == REQ_READDIR && req->result >= 0) |
|
|
111 | free (req->data2ptr); |
|
|
112 | |
|
|
113 | Safefree (req); |
|
|
114 | } |
115 | } |
115 | |
116 | |
116 | static void |
117 | static aio_req SvAIO_REQ (SV *sv) |
117 | poll_wait () |
118 | { |
|
|
119 | if (!sv_derived_from (sv, AIO_REQ_KLASS) || !SvROK (sv)) |
|
|
120 | croak ("object of class " AIO_REQ_KLASS " expected"); |
|
|
121 | |
|
|
122 | MAGIC *mg = mg_find (SvRV (sv), PERL_MAGIC_ext); |
|
|
123 | |
|
|
124 | return mg ? (aio_req)mg->mg_ptr : 0; |
|
|
125 | } |
|
|
126 | |
|
|
127 | static void poll_wait () |
118 | { |
128 | { |
119 | if (nreqs && !ress) |
129 | if (nreqs && !ress) |
120 | { |
130 | { |
121 | fd_set rfd; |
131 | fd_set rfd; |
122 | FD_ZERO(&rfd); |
132 | FD_ZERO(&rfd); |
… | |
… | |
124 | |
134 | |
125 | select (respipe [0] + 1, &rfd, 0, 0, 0); |
135 | select (respipe [0] + 1, &rfd, 0, 0, 0); |
126 | } |
136 | } |
127 | } |
137 | } |
128 | |
138 | |
129 | static int |
139 | static void req_invoke (aio_req req) |
130 | poll_cb () |
140 | { |
|
|
141 | dSP; |
|
|
142 | int errorno = errno; |
|
|
143 | |
|
|
144 | if (req->cancelled || !SvOK (req->callback)) |
|
|
145 | return; |
|
|
146 | |
|
|
147 | errno = req->errorno; |
|
|
148 | |
|
|
149 | ENTER; |
|
|
150 | PUSHMARK (SP); |
|
|
151 | EXTEND (SP, 1); |
|
|
152 | |
|
|
153 | switch (req->type) |
|
|
154 | { |
|
|
155 | case REQ_READDIR: |
|
|
156 | { |
|
|
157 | SV *rv = &PL_sv_undef; |
|
|
158 | |
|
|
159 | if (req->result >= 0) |
|
|
160 | { |
|
|
161 | char *buf = req->data2ptr; |
|
|
162 | AV *av = newAV (); |
|
|
163 | |
|
|
164 | while (req->result) |
|
|
165 | { |
|
|
166 | SV *sv = newSVpv (buf, 0); |
|
|
167 | |
|
|
168 | av_push (av, sv); |
|
|
169 | buf += SvCUR (sv) + 1; |
|
|
170 | req->result--; |
|
|
171 | } |
|
|
172 | |
|
|
173 | rv = sv_2mortal (newRV_noinc ((SV *)av)); |
|
|
174 | } |
|
|
175 | |
|
|
176 | PUSHs (rv); |
|
|
177 | } |
|
|
178 | break; |
|
|
179 | |
|
|
180 | case REQ_OPEN: |
|
|
181 | { |
|
|
182 | /* convert fd to fh */ |
|
|
183 | SV *fh; |
|
|
184 | |
|
|
185 | PUSHs (sv_2mortal (newSViv (req->result))); |
|
|
186 | PUTBACK; |
|
|
187 | call_pv ("IO::AIO::_fd2fh", G_SCALAR | G_EVAL); |
|
|
188 | SPAGAIN; |
|
|
189 | |
|
|
190 | fh = SvREFCNT_inc (POPs); |
|
|
191 | |
|
|
192 | PUSHMARK (SP); |
|
|
193 | XPUSHs (sv_2mortal (fh)); |
|
|
194 | } |
|
|
195 | break; |
|
|
196 | |
|
|
197 | case REQ_GROUP: |
|
|
198 | if (req->data) |
|
|
199 | { |
|
|
200 | int i; |
|
|
201 | AV *av = (AV *)req->data; |
|
|
202 | |
|
|
203 | EXTEND (SP, AvFILL (av) + 1); |
|
|
204 | for (i = 0; i <= AvFILL (av); ++i) |
|
|
205 | PUSHs (*av_fetch (av, i, 0)); |
|
|
206 | } |
|
|
207 | break; |
|
|
208 | |
|
|
209 | case REQ_SLEEP: |
|
|
210 | break; |
|
|
211 | |
|
|
212 | default: |
|
|
213 | PUSHs (sv_2mortal (newSViv (req->result))); |
|
|
214 | break; |
|
|
215 | } |
|
|
216 | |
|
|
217 | |
|
|
218 | PUTBACK; |
|
|
219 | call_sv (req->callback, G_VOID | G_EVAL); |
|
|
220 | SPAGAIN; |
|
|
221 | |
|
|
222 | if (SvTRUE (ERRSV)) |
|
|
223 | { |
|
|
224 | req_free (req); |
|
|
225 | croak (0); |
|
|
226 | } |
|
|
227 | |
|
|
228 | LEAVE; |
|
|
229 | |
|
|
230 | errno = errorno; |
|
|
231 | } |
|
|
232 | |
|
|
233 | static void req_free (aio_req req) |
|
|
234 | { |
|
|
235 | if (req->grp) |
|
|
236 | { |
|
|
237 | aio_req grp = req->grp; |
|
|
238 | |
|
|
239 | /* unlink request */ |
|
|
240 | req->grp_next->grp_prev = req->grp_prev; |
|
|
241 | req->grp_prev->grp_next = req->grp_next; |
|
|
242 | |
|
|
243 | if (grp->grp_next == grp && grp->fd) |
|
|
244 | { |
|
|
245 | req_invoke (grp); |
|
|
246 | req_free (grp); |
|
|
247 | } |
|
|
248 | } |
|
|
249 | |
|
|
250 | if (req->self) |
|
|
251 | { |
|
|
252 | sv_unmagic (req->self, PERL_MAGIC_ext); |
|
|
253 | SvREFCNT_dec (req->self); |
|
|
254 | } |
|
|
255 | |
|
|
256 | if (req->data) |
|
|
257 | SvREFCNT_dec (req->data); |
|
|
258 | |
|
|
259 | if (req->fh) |
|
|
260 | SvREFCNT_dec (req->fh); |
|
|
261 | |
|
|
262 | if (req->fh2) |
|
|
263 | SvREFCNT_dec (req->fh2); |
|
|
264 | |
|
|
265 | if (req->statdata) |
|
|
266 | Safefree (req->statdata); |
|
|
267 | |
|
|
268 | if (req->callback) |
|
|
269 | SvREFCNT_dec (req->callback); |
|
|
270 | |
|
|
271 | if (req->type == REQ_READDIR && req->result >= 0) |
|
|
272 | free (req->data2ptr); |
|
|
273 | |
|
|
274 | Safefree (req); |
|
|
275 | } |
|
|
276 | |
|
|
277 | static void req_cancel (aio_req req) |
|
|
278 | { |
|
|
279 | req->cancelled = 1; |
|
|
280 | |
|
|
281 | if (req->type == REQ_GROUP) |
|
|
282 | { |
|
|
283 | aio_req sub; |
|
|
284 | |
|
|
285 | for (sub = req->grp_next; sub != req; sub = sub->grp_next) |
|
|
286 | req_cancel (sub); |
|
|
287 | } |
|
|
288 | } |
|
|
289 | |
|
|
290 | static int poll_cb () |
131 | { |
291 | { |
132 | dSP; |
292 | dSP; |
133 | int count = 0; |
293 | int count = 0; |
134 | int do_croak = 0; |
294 | int do_croak = 0; |
135 | aio_req req; |
295 | aio_req req; |
… | |
… | |
161 | |
321 | |
162 | nreqs--; |
322 | nreqs--; |
163 | |
323 | |
164 | if (req->type == REQ_QUIT) |
324 | if (req->type == REQ_QUIT) |
165 | started--; |
325 | started--; |
|
|
326 | else if (req->type == REQ_GROUP && req->grp_next != req) |
|
|
327 | { |
|
|
328 | req->fd = 1; /* mark request as delayed */ |
|
|
329 | continue; |
|
|
330 | } |
166 | else |
331 | else |
167 | { |
332 | { |
168 | int errorno = errno; |
|
|
169 | errno = req->errorno; |
|
|
170 | |
|
|
171 | if (req->type == REQ_READ) |
333 | if (req->type == REQ_READ) |
172 | SvCUR_set (req->data, req->dataoffset + (req->result > 0 ? req->result : 0)); |
334 | SvCUR_set (req->data, req->dataoffset + (req->result > 0 ? req->result : 0)); |
173 | |
335 | |
174 | if (req->data2ptr && (req->type == REQ_READ || req->type == REQ_WRITE)) |
336 | if (req->data2ptr && (req->type == REQ_READ || req->type == REQ_WRITE)) |
175 | SvREADONLY_off (req->data); |
337 | SvREADONLY_off (req->data); |
… | |
… | |
179 | PL_laststype = req->type == REQ_LSTAT ? OP_LSTAT : OP_STAT; |
341 | PL_laststype = req->type == REQ_LSTAT ? OP_LSTAT : OP_STAT; |
180 | PL_laststatval = req->result; |
342 | PL_laststatval = req->result; |
181 | PL_statcache = *(req->statdata); |
343 | PL_statcache = *(req->statdata); |
182 | } |
344 | } |
183 | |
345 | |
184 | ENTER; |
346 | req_invoke (req); |
185 | PUSHMARK (SP); |
|
|
186 | |
347 | |
187 | if (req->type == REQ_READDIR) |
|
|
188 | { |
|
|
189 | SV *rv = &PL_sv_undef; |
|
|
190 | |
|
|
191 | if (req->result >= 0) |
|
|
192 | { |
|
|
193 | char *buf = req->data2ptr; |
|
|
194 | AV *av = newAV (); |
|
|
195 | |
|
|
196 | while (req->result) |
|
|
197 | { |
|
|
198 | SV *sv = newSVpv (buf, 0); |
|
|
199 | |
|
|
200 | av_push (av, sv); |
|
|
201 | buf += SvCUR (sv) + 1; |
|
|
202 | req->result--; |
|
|
203 | } |
|
|
204 | |
|
|
205 | rv = sv_2mortal (newRV_noinc ((SV *)av)); |
|
|
206 | } |
|
|
207 | |
|
|
208 | XPUSHs (rv); |
|
|
209 | } |
|
|
210 | else |
|
|
211 | { |
|
|
212 | XPUSHs (sv_2mortal (newSViv (req->result))); |
|
|
213 | |
|
|
214 | if (req->type == REQ_OPEN) |
|
|
215 | { |
|
|
216 | /* convert fd to fh */ |
|
|
217 | SV *fh; |
|
|
218 | |
|
|
219 | PUTBACK; |
|
|
220 | call_pv ("IO::AIO::_fd2fh", G_SCALAR | G_EVAL); |
|
|
221 | SPAGAIN; |
|
|
222 | |
|
|
223 | fh = SvREFCNT_inc (POPs); |
|
|
224 | |
|
|
225 | PUSHMARK (SP); |
|
|
226 | XPUSHs (sv_2mortal (fh)); |
|
|
227 | } |
|
|
228 | } |
|
|
229 | |
|
|
230 | if (SvOK (req->callback)) |
|
|
231 | { |
|
|
232 | PUTBACK; |
|
|
233 | call_sv (req->callback, G_VOID | G_EVAL); |
|
|
234 | SPAGAIN; |
|
|
235 | |
|
|
236 | if (SvTRUE (ERRSV)) |
|
|
237 | { |
|
|
238 | free_req (req); |
|
|
239 | croak (0); |
|
|
240 | } |
|
|
241 | } |
|
|
242 | |
|
|
243 | LEAVE; |
|
|
244 | |
|
|
245 | errno = errorno; |
|
|
246 | count++; |
348 | count++; |
247 | } |
349 | } |
248 | |
350 | |
249 | free_req (req); |
351 | req_free (req); |
250 | } |
352 | } |
251 | |
353 | |
252 | return count; |
354 | return count; |
253 | } |
355 | } |
254 | |
356 | |
255 | static void *aio_proc(void *arg); |
357 | static void *aio_proc(void *arg); |
256 | |
358 | |
257 | static void |
|
|
258 | start_thread (void) |
359 | static void start_thread (void) |
259 | { |
360 | { |
260 | sigset_t fullsigset, oldsigset; |
361 | sigset_t fullsigset, oldsigset; |
261 | pthread_t tid; |
362 | pthread_t tid; |
262 | pthread_attr_t attr; |
363 | pthread_attr_t attr; |
263 | |
364 | |
… | |
… | |
272 | started++; |
373 | started++; |
273 | |
374 | |
274 | sigprocmask (SIG_SETMASK, &oldsigset, 0); |
375 | sigprocmask (SIG_SETMASK, &oldsigset, 0); |
275 | } |
376 | } |
276 | |
377 | |
277 | static void |
378 | static void req_send (aio_req req) |
278 | send_req (aio_req req) |
|
|
279 | { |
379 | { |
280 | while (started < wanted && nreqs >= started) |
380 | while (started < wanted && nreqs >= started) |
281 | start_thread (); |
381 | start_thread (); |
282 | |
382 | |
283 | nreqs++; |
383 | nreqs++; |
… | |
… | |
307 | |
407 | |
308 | poll_wait (); |
408 | poll_wait (); |
309 | } |
409 | } |
310 | } |
410 | } |
311 | |
411 | |
312 | static void |
412 | static void end_thread (void) |
313 | end_thread (void) |
|
|
314 | { |
413 | { |
315 | aio_req req; |
414 | aio_req req; |
316 | Newz (0, req, 1, aio_cb); |
415 | Newz (0, req, 1, aio_cb); |
317 | req->type = REQ_QUIT; |
416 | req->type = REQ_QUIT; |
318 | |
417 | |
319 | send_req (req); |
418 | req_send (req); |
320 | } |
419 | } |
321 | |
420 | |
322 | static void min_parallel (int nthreads) |
421 | static void min_parallel (int nthreads) |
323 | { |
422 | { |
324 | if (wanted < nthreads) |
423 | if (wanted < nthreads) |
… | |
… | |
369 | * normal read/write by using a mutex. slows down execution a lot, |
468 | * normal read/write by using a mutex. slows down execution a lot, |
370 | * but that's your problem, not mine. |
469 | * but that's your problem, not mine. |
371 | */ |
470 | */ |
372 | static pthread_mutex_t preadwritelock = PTHREAD_MUTEX_INITIALIZER; |
471 | static pthread_mutex_t preadwritelock = PTHREAD_MUTEX_INITIALIZER; |
373 | |
472 | |
374 | static ssize_t |
473 | static ssize_t pread (int fd, void *buf, size_t count, off_t offset) |
375 | pread (int fd, void *buf, size_t count, off_t offset) |
|
|
376 | { |
474 | { |
377 | ssize_t res; |
475 | ssize_t res; |
378 | off_t ooffset; |
476 | off_t ooffset; |
379 | |
477 | |
380 | pthread_mutex_lock (&preadwritelock); |
478 | pthread_mutex_lock (&preadwritelock); |
… | |
… | |
385 | pthread_mutex_unlock (&preadwritelock); |
483 | pthread_mutex_unlock (&preadwritelock); |
386 | |
484 | |
387 | return res; |
485 | return res; |
388 | } |
486 | } |
389 | |
487 | |
390 | static ssize_t |
|
|
391 | pwrite (int fd, void *buf, size_t count, off_t offset) |
488 | static ssize_t pwrite (int fd, void *buf, size_t count, off_t offset) |
392 | { |
489 | { |
393 | ssize_t res; |
490 | ssize_t res; |
394 | off_t ooffset; |
491 | off_t ooffset; |
395 | |
492 | |
396 | pthread_mutex_lock (&preadwritelock); |
493 | pthread_mutex_lock (&preadwritelock); |
… | |
… | |
409 | #endif |
506 | #endif |
410 | |
507 | |
411 | #if !HAVE_READAHEAD |
508 | #if !HAVE_READAHEAD |
412 | # define readahead aio_readahead |
509 | # define readahead aio_readahead |
413 | |
510 | |
414 | static ssize_t |
|
|
415 | readahead (int fd, off_t offset, size_t count) |
511 | static ssize_t readahead (int fd, off_t offset, size_t count) |
416 | { |
512 | { |
417 | char readahead_buf[4096]; |
513 | char readahead_buf[4096]; |
418 | |
514 | |
419 | while (count > 0) |
515 | while (count > 0) |
420 | { |
516 | { |
… | |
… | |
432 | #if !HAVE_READDIR_R |
528 | #if !HAVE_READDIR_R |
433 | # define readdir_r aio_readdir_r |
529 | # define readdir_r aio_readdir_r |
434 | |
530 | |
435 | static pthread_mutex_t readdirlock = PTHREAD_MUTEX_INITIALIZER; |
531 | static pthread_mutex_t readdirlock = PTHREAD_MUTEX_INITIALIZER; |
436 | |
532 | |
437 | static int |
|
|
438 | readdir_r (DIR *dirp, struct dirent *ent, struct dirent **res) |
533 | static int readdir_r (DIR *dirp, struct dirent *ent, struct dirent **res) |
439 | { |
534 | { |
440 | struct dirent *e; |
535 | struct dirent *e; |
441 | int errorno; |
536 | int errorno; |
442 | |
537 | |
443 | pthread_mutex_lock (&readdirlock); |
538 | pthread_mutex_lock (&readdirlock); |
… | |
… | |
459 | return e ? 0 : -1; |
554 | return e ? 0 : -1; |
460 | } |
555 | } |
461 | #endif |
556 | #endif |
462 | |
557 | |
463 | /* sendfile always needs emulation */ |
558 | /* sendfile always needs emulation */ |
464 | static ssize_t |
|
|
465 | sendfile_ (int ofd, int ifd, off_t offset, size_t count) |
559 | static ssize_t sendfile_ (int ofd, int ifd, off_t offset, size_t count) |
466 | { |
560 | { |
467 | ssize_t res; |
561 | ssize_t res; |
468 | |
562 | |
469 | if (!count) |
563 | if (!count) |
470 | return 0; |
564 | return 0; |
… | |
… | |
552 | |
646 | |
553 | return res; |
647 | return res; |
554 | } |
648 | } |
555 | |
649 | |
556 | /* read a full directory */ |
650 | /* read a full directory */ |
557 | static int |
|
|
558 | scandir_ (const char *path, void **namesp) |
651 | static int scandir_ (const char *path, void **namesp) |
559 | { |
652 | { |
560 | DIR *dirp = opendir (path); |
653 | DIR *dirp = opendir (path); |
561 | union |
654 | union |
562 | { |
655 | { |
563 | struct dirent d; |
656 | struct dirent d; |
… | |
… | |
617 | return res; |
710 | return res; |
618 | } |
711 | } |
619 | |
712 | |
620 | /*****************************************************************************/ |
713 | /*****************************************************************************/ |
621 | |
714 | |
622 | static void * |
|
|
623 | aio_proc (void *thr_arg) |
715 | static void *aio_proc (void *thr_arg) |
624 | { |
716 | { |
625 | aio_req req; |
717 | aio_req req; |
626 | int type; |
718 | int type; |
627 | |
719 | |
628 | do |
720 | do |
… | |
… | |
647 | |
739 | |
648 | pthread_mutex_unlock (&reqlock); |
740 | pthread_mutex_unlock (&reqlock); |
649 | |
741 | |
650 | errno = 0; /* strictly unnecessary */ |
742 | errno = 0; /* strictly unnecessary */ |
651 | |
743 | |
652 | type = req->type; |
744 | if (!req->cancelled) |
653 | |
|
|
654 | switch (type) |
745 | switch (req->type) |
655 | { |
746 | { |
656 | case REQ_READ: req->result = pread (req->fd, req->dataptr, req->length, req->offset); break; |
747 | case REQ_READ: req->result = pread (req->fd, req->dataptr, req->length, req->offset); break; |
657 | case REQ_WRITE: req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); break; |
748 | case REQ_WRITE: req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); break; |
658 | |
749 | |
659 | case REQ_READAHEAD: req->result = readahead (req->fd, req->offset, req->length); break; |
750 | case REQ_READAHEAD: req->result = readahead (req->fd, req->offset, req->length); break; |
660 | case REQ_SENDFILE: req->result = sendfile_ (req->fd, req->fd2, req->offset, req->length); break; |
751 | case REQ_SENDFILE: req->result = sendfile_ (req->fd, req->fd2, req->offset, req->length); break; |
661 | |
752 | |
662 | case REQ_STAT: req->result = stat (req->dataptr, req->statdata); break; |
753 | case REQ_STAT: req->result = stat (req->dataptr, req->statdata); break; |
663 | case REQ_LSTAT: req->result = lstat (req->dataptr, req->statdata); break; |
754 | case REQ_LSTAT: req->result = lstat (req->dataptr, req->statdata); break; |
664 | case REQ_FSTAT: req->result = fstat (req->fd , req->statdata); break; |
755 | case REQ_FSTAT: req->result = fstat (req->fd , req->statdata); break; |
665 | |
756 | |
666 | case REQ_OPEN: req->result = open (req->dataptr, req->fd, req->mode); break; |
757 | case REQ_OPEN: req->result = open (req->dataptr, req->fd, req->mode); break; |
667 | case REQ_CLOSE: req->result = close (req->fd); break; |
758 | case REQ_CLOSE: req->result = close (req->fd); break; |
668 | case REQ_UNLINK: req->result = unlink (req->dataptr); break; |
759 | case REQ_UNLINK: req->result = unlink (req->dataptr); break; |
669 | case REQ_RMDIR: req->result = rmdir (req->dataptr); break; |
760 | case REQ_RMDIR: req->result = rmdir (req->dataptr); break; |
|
|
761 | case REQ_RENAME: req->result = rename (req->data2ptr, req->dataptr); break; |
|
|
762 | case REQ_LINK: req->result = link (req->data2ptr, req->dataptr); break; |
670 | case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break; |
763 | case REQ_SYMLINK: req->result = symlink (req->data2ptr, req->dataptr); break; |
671 | |
764 | |
672 | case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; |
765 | case REQ_FDATASYNC: req->result = fdatasync (req->fd); break; |
673 | case REQ_FSYNC: req->result = fsync (req->fd); break; |
766 | case REQ_FSYNC: req->result = fsync (req->fd); break; |
674 | case REQ_READDIR: req->result = scandir_ (req->dataptr, &req->data2ptr); break; |
767 | case REQ_READDIR: req->result = scandir_ (req->dataptr, &req->data2ptr); break; |
675 | |
768 | |
|
|
769 | case REQ_SLEEP: |
|
|
770 | { |
|
|
771 | struct timeval tv; |
|
|
772 | |
|
|
773 | tv.tv_sec = req->fd; |
|
|
774 | tv.tv_usec = req->fd2; |
|
|
775 | |
|
|
776 | req->result = select (0, 0, 0, 0, &tv); |
|
|
777 | } |
|
|
778 | |
676 | case REQ_QUIT: |
779 | case REQ_QUIT: |
677 | break; |
780 | break; |
678 | |
781 | |
679 | default: |
782 | default: |
680 | req->result = ENOSYS; |
783 | req->result = ENOSYS; |
681 | break; |
784 | break; |
682 | } |
785 | } |
683 | |
786 | |
684 | req->errorno = errno; |
787 | req->errorno = errno; |
685 | |
788 | |
686 | pthread_mutex_lock (&reslock); |
789 | pthread_mutex_lock (&reslock); |
687 | |
790 | |
… | |
… | |
741 | |
844 | |
742 | while (reqs) |
845 | while (reqs) |
743 | { |
846 | { |
744 | prv = reqs; |
847 | prv = reqs; |
745 | reqs = prv->next; |
848 | reqs = prv->next; |
746 | free_req (prv); |
849 | req_free (prv); |
747 | } |
850 | } |
748 | |
851 | |
749 | reqs = reqe = 0; |
852 | reqs = reqe = 0; |
750 | |
853 | |
751 | while (ress) |
854 | while (ress) |
752 | { |
855 | { |
753 | prv = ress; |
856 | prv = ress; |
754 | ress = prv->next; |
857 | ress = prv->next; |
755 | free_req (prv); |
858 | req_free (prv); |
756 | } |
859 | } |
757 | |
860 | |
758 | ress = rese = 0; |
861 | ress = rese = 0; |
759 | |
862 | |
760 | close (respipe [0]); |
863 | close (respipe [0]); |
… | |
… | |
766 | |
869 | |
767 | #define dREQ \ |
870 | #define dREQ \ |
768 | aio_req req; \ |
871 | aio_req req; \ |
769 | \ |
872 | \ |
770 | if (SvOK (callback) && !SvROK (callback)) \ |
873 | if (SvOK (callback) && !SvROK (callback)) \ |
771 | croak ("clalback must be undef or of reference type"); \ |
874 | croak ("callback must be undef or of reference type"); \ |
772 | \ |
875 | \ |
773 | Newz (0, req, 1, aio_cb); \ |
876 | Newz (0, req, 1, aio_cb); \ |
774 | if (!req) \ |
877 | if (!req) \ |
775 | croak ("out of memory during aio_req allocation"); \ |
878 | croak ("out of memory during aio_req allocation"); \ |
776 | \ |
879 | \ |
777 | req->callback = newSVsv (callback); |
880 | req->callback = newSVsv (callback) |
|
|
881 | |
|
|
882 | #define REQ_SEND \ |
|
|
883 | req_send (req); \ |
|
|
884 | \ |
|
|
885 | if (GIMME_V != G_VOID) \ |
|
|
886 | XPUSHs (req_sv (req, AIO_REQ_KLASS)); |
778 | |
887 | |
779 | MODULE = IO::AIO PACKAGE = IO::AIO |
888 | MODULE = IO::AIO PACKAGE = IO::AIO |
780 | |
889 | |
781 | PROTOTYPES: ENABLE |
890 | PROTOTYPES: ENABLE |
782 | |
891 | |
783 | BOOT: |
892 | BOOT: |
784 | { |
893 | { |
|
|
894 | HV *stash = gv_stashpv ("IO::AIO", 1); |
|
|
895 | newCONSTSUB (stash, "EXDEV", newSViv (EXDEV)); |
|
|
896 | newCONSTSUB (stash, "O_RDONLY", newSViv (O_RDONLY)); |
|
|
897 | newCONSTSUB (stash, "O_WRONLY", newSViv (O_WRONLY)); |
|
|
898 | |
785 | create_pipe (); |
899 | create_pipe (); |
786 | pthread_atfork (atfork_prepare, atfork_parent, atfork_child); |
900 | pthread_atfork (atfork_prepare, atfork_parent, atfork_child); |
787 | } |
901 | } |
788 | |
902 | |
789 | void |
903 | void |
790 | min_parallel(nthreads) |
904 | min_parallel (nthreads) |
791 | int nthreads |
905 | int nthreads |
792 | PROTOTYPE: $ |
906 | PROTOTYPE: $ |
793 | |
907 | |
794 | void |
908 | void |
795 | max_parallel(nthreads) |
909 | max_parallel (nthreads) |
796 | int nthreads |
910 | int nthreads |
797 | PROTOTYPE: $ |
911 | PROTOTYPE: $ |
798 | |
912 | |
799 | int |
913 | int |
800 | max_outstanding(nreqs) |
914 | max_outstanding (nreqs) |
801 | int nreqs |
915 | int nreqs |
802 | PROTOTYPE: $ |
916 | PROTOTYPE: $ |
803 | CODE: |
917 | CODE: |
804 | RETVAL = max_outstanding; |
918 | RETVAL = max_outstanding; |
805 | max_outstanding = nreqs; |
919 | max_outstanding = nreqs; |
806 | |
920 | |
807 | void |
921 | void |
808 | aio_open(pathname,flags,mode,callback=&PL_sv_undef) |
922 | aio_open (pathname,flags,mode,callback=&PL_sv_undef) |
809 | SV * pathname |
923 | SV * pathname |
810 | int flags |
924 | int flags |
811 | int mode |
925 | int mode |
812 | SV * callback |
926 | SV * callback |
813 | PROTOTYPE: $$$;$ |
927 | PROTOTYPE: $$$;$ |
814 | CODE: |
928 | PPCODE: |
815 | { |
929 | { |
816 | dREQ; |
930 | dREQ; |
817 | |
931 | |
818 | req->type = REQ_OPEN; |
932 | req->type = REQ_OPEN; |
819 | req->data = newSVsv (pathname); |
933 | req->data = newSVsv (pathname); |
820 | req->dataptr = SvPVbyte_nolen (req->data); |
934 | req->dataptr = SvPVbyte_nolen (req->data); |
821 | req->fd = flags; |
935 | req->fd = flags; |
822 | req->mode = mode; |
936 | req->mode = mode; |
823 | |
937 | |
824 | send_req (req); |
938 | REQ_SEND; |
825 | } |
939 | } |
826 | |
940 | |
827 | void |
941 | void |
828 | aio_close(fh,callback=&PL_sv_undef) |
942 | aio_close (fh,callback=&PL_sv_undef) |
829 | SV * fh |
943 | SV * fh |
830 | SV * callback |
944 | SV * callback |
831 | PROTOTYPE: $;$ |
945 | PROTOTYPE: $;$ |
832 | ALIAS: |
946 | ALIAS: |
833 | aio_close = REQ_CLOSE |
947 | aio_close = REQ_CLOSE |
834 | aio_fsync = REQ_FSYNC |
948 | aio_fsync = REQ_FSYNC |
835 | aio_fdatasync = REQ_FDATASYNC |
949 | aio_fdatasync = REQ_FDATASYNC |
836 | CODE: |
950 | PPCODE: |
837 | { |
951 | { |
838 | dREQ; |
952 | dREQ; |
839 | |
953 | |
840 | req->type = ix; |
954 | req->type = ix; |
841 | req->fh = newSVsv (fh); |
955 | req->fh = newSVsv (fh); |
842 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
956 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
843 | |
957 | |
844 | send_req (req); |
958 | REQ_SEND (req); |
845 | } |
959 | } |
846 | |
960 | |
847 | void |
961 | void |
848 | aio_read(fh,offset,length,data,dataoffset,callback=&PL_sv_undef) |
962 | aio_read (fh,offset,length,data,dataoffset,callback=&PL_sv_undef) |
849 | SV * fh |
963 | SV * fh |
850 | UV offset |
964 | UV offset |
851 | UV length |
965 | UV length |
852 | SV * data |
966 | SV * data |
853 | UV dataoffset |
967 | UV dataoffset |
854 | SV * callback |
968 | SV * callback |
855 | ALIAS: |
969 | ALIAS: |
856 | aio_read = REQ_READ |
970 | aio_read = REQ_READ |
857 | aio_write = REQ_WRITE |
971 | aio_write = REQ_WRITE |
858 | PROTOTYPE: $$$$$;$ |
972 | PROTOTYPE: $$$$$;$ |
859 | CODE: |
973 | PPCODE: |
860 | { |
974 | { |
861 | aio_req req; |
975 | aio_req req; |
862 | STRLEN svlen; |
976 | STRLEN svlen; |
863 | char *svptr = SvPVbyte (data, svlen); |
977 | char *svptr = SvPVbyte (data, svlen); |
864 | |
978 | |
… | |
… | |
902 | { |
1016 | { |
903 | SvREADONLY_on (data); |
1017 | SvREADONLY_on (data); |
904 | req->data2ptr = (void *)data; |
1018 | req->data2ptr = (void *)data; |
905 | } |
1019 | } |
906 | |
1020 | |
907 | send_req (req); |
1021 | REQ_SEND; |
908 | } |
1022 | } |
909 | } |
1023 | } |
910 | |
1024 | |
911 | void |
1025 | void |
912 | aio_sendfile(out_fh,in_fh,in_offset,length,callback=&PL_sv_undef) |
1026 | aio_sendfile (out_fh,in_fh,in_offset,length,callback=&PL_sv_undef) |
913 | SV * out_fh |
1027 | SV * out_fh |
914 | SV * in_fh |
1028 | SV * in_fh |
915 | UV in_offset |
1029 | UV in_offset |
916 | UV length |
1030 | UV length |
917 | SV * callback |
1031 | SV * callback |
918 | PROTOTYPE: $$$$;$ |
1032 | PROTOTYPE: $$$$;$ |
919 | CODE: |
1033 | PPCODE: |
920 | { |
1034 | { |
921 | dREQ; |
1035 | dREQ; |
922 | |
1036 | |
923 | req->type = REQ_SENDFILE; |
1037 | req->type = REQ_SENDFILE; |
924 | req->fh = newSVsv (out_fh); |
1038 | req->fh = newSVsv (out_fh); |
… | |
… | |
926 | req->fh2 = newSVsv (in_fh); |
1040 | req->fh2 = newSVsv (in_fh); |
927 | req->fd2 = PerlIO_fileno (IoIFP (sv_2io (in_fh))); |
1041 | req->fd2 = PerlIO_fileno (IoIFP (sv_2io (in_fh))); |
928 | req->offset = in_offset; |
1042 | req->offset = in_offset; |
929 | req->length = length; |
1043 | req->length = length; |
930 | |
1044 | |
931 | send_req (req); |
1045 | REQ_SEND; |
932 | } |
1046 | } |
933 | |
1047 | |
934 | void |
1048 | void |
935 | aio_readahead(fh,offset,length,callback=&PL_sv_undef) |
1049 | aio_readahead (fh,offset,length,callback=&PL_sv_undef) |
936 | SV * fh |
1050 | SV * fh |
937 | UV offset |
1051 | UV offset |
938 | IV length |
1052 | IV length |
939 | SV * callback |
1053 | SV * callback |
940 | PROTOTYPE: $$$;$ |
1054 | PROTOTYPE: $$$;$ |
941 | CODE: |
1055 | PPCODE: |
942 | { |
1056 | { |
943 | dREQ; |
1057 | dREQ; |
944 | |
1058 | |
945 | req->type = REQ_READAHEAD; |
1059 | req->type = REQ_READAHEAD; |
946 | req->fh = newSVsv (fh); |
1060 | req->fh = newSVsv (fh); |
947 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
1061 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
948 | req->offset = offset; |
1062 | req->offset = offset; |
949 | req->length = length; |
1063 | req->length = length; |
950 | |
1064 | |
951 | send_req (req); |
1065 | REQ_SEND; |
952 | } |
1066 | } |
953 | |
1067 | |
954 | void |
1068 | void |
955 | aio_stat(fh_or_path,callback=&PL_sv_undef) |
1069 | aio_stat (fh_or_path,callback=&PL_sv_undef) |
956 | SV * fh_or_path |
1070 | SV * fh_or_path |
957 | SV * callback |
1071 | SV * callback |
958 | ALIAS: |
1072 | ALIAS: |
959 | aio_stat = REQ_STAT |
1073 | aio_stat = REQ_STAT |
960 | aio_lstat = REQ_LSTAT |
1074 | aio_lstat = REQ_LSTAT |
961 | CODE: |
1075 | PPCODE: |
962 | { |
1076 | { |
963 | dREQ; |
1077 | dREQ; |
964 | |
1078 | |
965 | New (0, req->statdata, 1, Stat_t); |
1079 | New (0, req->statdata, 1, Stat_t); |
966 | if (!req->statdata) |
1080 | if (!req->statdata) |
967 | { |
1081 | { |
968 | free_req (req); |
1082 | req_free (req); |
969 | croak ("out of memory during aio_req->statdata allocation"); |
1083 | croak ("out of memory during aio_req->statdata allocation"); |
970 | } |
1084 | } |
971 | |
1085 | |
972 | if (SvPOK (fh_or_path)) |
1086 | if (SvPOK (fh_or_path)) |
973 | { |
1087 | { |
… | |
… | |
980 | req->type = REQ_FSTAT; |
1094 | req->type = REQ_FSTAT; |
981 | req->fh = newSVsv (fh_or_path); |
1095 | req->fh = newSVsv (fh_or_path); |
982 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh_or_path))); |
1096 | req->fd = PerlIO_fileno (IoIFP (sv_2io (fh_or_path))); |
983 | } |
1097 | } |
984 | |
1098 | |
985 | send_req (req); |
1099 | REQ_SEND; |
986 | } |
1100 | } |
987 | |
1101 | |
988 | void |
1102 | void |
989 | aio_unlink(pathname,callback=&PL_sv_undef) |
1103 | aio_unlink (pathname,callback=&PL_sv_undef) |
990 | SV * pathname |
1104 | SV * pathname |
991 | SV * callback |
1105 | SV * callback |
992 | ALIAS: |
1106 | ALIAS: |
993 | aio_unlink = REQ_UNLINK |
1107 | aio_unlink = REQ_UNLINK |
994 | aio_rmdir = REQ_RMDIR |
1108 | aio_rmdir = REQ_RMDIR |
|
|
1109 | aio_readdir = REQ_READDIR |
995 | CODE: |
1110 | PPCODE: |
996 | { |
1111 | { |
997 | dREQ; |
1112 | dREQ; |
998 | |
1113 | |
999 | req->type = ix; |
1114 | req->type = ix; |
1000 | req->data = newSVsv (pathname); |
1115 | req->data = newSVsv (pathname); |
1001 | req->dataptr = SvPVbyte_nolen (req->data); |
1116 | req->dataptr = SvPVbyte_nolen (req->data); |
1002 | |
1117 | |
1003 | send_req (req); |
1118 | REQ_SEND; |
1004 | } |
1119 | } |
1005 | |
1120 | |
1006 | void |
1121 | void |
1007 | aio_symlink(oldpath,newpath,callback=&PL_sv_undef) |
1122 | aio_link (oldpath,newpath,callback=&PL_sv_undef) |
1008 | SV * oldpath |
1123 | SV * oldpath |
1009 | SV * newpath |
1124 | SV * newpath |
1010 | SV * callback |
1125 | SV * callback |
|
|
1126 | ALIAS: |
|
|
1127 | aio_link = REQ_LINK |
|
|
1128 | aio_symlink = REQ_SYMLINK |
|
|
1129 | aio_rename = REQ_RENAME |
1011 | CODE: |
1130 | PPCODE: |
1012 | { |
1131 | { |
1013 | dREQ; |
1132 | dREQ; |
1014 | |
1133 | |
1015 | req->type = REQ_SYMLINK; |
1134 | req->type = ix; |
1016 | req->fh = newSVsv (oldpath); |
1135 | req->fh = newSVsv (oldpath); |
1017 | req->data2ptr = SvPVbyte_nolen (req->fh); |
1136 | req->data2ptr = SvPVbyte_nolen (req->fh); |
1018 | req->data = newSVsv (newpath); |
1137 | req->data = newSVsv (newpath); |
1019 | req->dataptr = SvPVbyte_nolen (req->data); |
1138 | req->dataptr = SvPVbyte_nolen (req->data); |
1020 | |
1139 | |
1021 | send_req (req); |
1140 | REQ_SEND; |
1022 | } |
1141 | } |
1023 | |
1142 | |
1024 | void |
1143 | void |
1025 | aio_readdir(pathname,callback=&PL_sv_undef) |
1144 | aio_sleep (delay,callback=&PL_sv_undef) |
1026 | SV * pathname |
1145 | double delay |
1027 | SV * callback |
1146 | SV * callback |
1028 | CODE: |
1147 | PPCODE: |
1029 | { |
1148 | { |
1030 | dREQ; |
1149 | dREQ; |
1031 | |
1150 | |
1032 | req->type = REQ_READDIR; |
1151 | req->type = REQ_SLEEP; |
1033 | req->data = newSVsv (pathname); |
1152 | req->fd = delay < 0. ? 0 : delay; |
1034 | req->dataptr = SvPVbyte_nolen (req->data); |
1153 | req->fd2 = delay < 0. ? 0 : 1000. * (delay - req->fd); |
1035 | |
|
|
1036 | send_req (req); |
|
|
1037 | } |
|
|
1038 | |
1154 | |
|
|
1155 | REQ_SEND; |
|
|
1156 | } |
|
|
1157 | |
1039 | void |
1158 | void |
|
|
1159 | aio_group (callback=&PL_sv_undef) |
|
|
1160 | SV * callback |
|
|
1161 | PROTOTYPE: ;$ |
|
|
1162 | PPCODE: |
|
|
1163 | { |
|
|
1164 | dREQ; |
|
|
1165 | req->type = REQ_GROUP; |
|
|
1166 | req->grp_next = req; |
|
|
1167 | req->grp_prev = req; |
|
|
1168 | |
|
|
1169 | req_send (req); |
|
|
1170 | XPUSHs (req_sv (req, AIO_GRP_KLASS)); |
|
|
1171 | } |
|
|
1172 | |
|
|
1173 | void |
1040 | flush() |
1174 | flush () |
1041 | PROTOTYPE: |
1175 | PROTOTYPE: |
1042 | CODE: |
1176 | CODE: |
1043 | while (nreqs) |
1177 | while (nreqs) |
1044 | { |
1178 | { |
1045 | poll_wait (); |
1179 | poll_wait (); |
… | |
… | |
1085 | CODE: |
1219 | CODE: |
1086 | RETVAL = nreqs; |
1220 | RETVAL = nreqs; |
1087 | OUTPUT: |
1221 | OUTPUT: |
1088 | RETVAL |
1222 | RETVAL |
1089 | |
1223 | |
|
|
1224 | PROTOTYPES: DISABLE |
|
|
1225 | |
|
|
1226 | MODULE = IO::AIO PACKAGE = IO::AIO::REQ |
|
|
1227 | |
|
|
1228 | void |
|
|
1229 | cancel (aio_req_ornot req) |
|
|
1230 | PROTOTYPE: |
|
|
1231 | CODE: |
|
|
1232 | req_cancel (req); |
|
|
1233 | |
|
|
1234 | MODULE = IO::AIO PACKAGE = IO::AIO::GRP |
|
|
1235 | |
|
|
1236 | void |
|
|
1237 | add (aio_req grp, ...) |
|
|
1238 | PPCODE: |
|
|
1239 | { |
|
|
1240 | int i; |
|
|
1241 | |
|
|
1242 | for (i = 1; i < items; ++i ) |
|
|
1243 | { |
|
|
1244 | if (GIMME_V != G_VOID) |
|
|
1245 | XPUSHs (sv_2mortal (newSVsv (ST (i)))); |
|
|
1246 | |
|
|
1247 | aio_req req = SvAIO_REQ (ST (i)); |
|
|
1248 | |
|
|
1249 | if (req) |
|
|
1250 | { |
|
|
1251 | req->grp_prev = grp; |
|
|
1252 | req->grp_next = grp->grp_next; |
|
|
1253 | grp->grp_next->grp_prev = req; |
|
|
1254 | grp->grp_next = req; |
|
|
1255 | |
|
|
1256 | req->grp = grp; |
|
|
1257 | } |
|
|
1258 | } |
|
|
1259 | } |
|
|
1260 | |
|
|
1261 | void |
|
|
1262 | result (aio_req grp, ...) |
|
|
1263 | CODE: |
|
|
1264 | { |
|
|
1265 | int i; |
|
|
1266 | AV *av = newAV (); |
|
|
1267 | |
|
|
1268 | if (grp->data) |
|
|
1269 | SvREFCNT_dec (grp->data); |
|
|
1270 | |
|
|
1271 | for (i = 1; i < items; ++i ) |
|
|
1272 | av_push (av, newSVsv (ST (i))); |
|
|
1273 | |
|
|
1274 | grp->data = (SV *)av; |
|
|
1275 | } |
|
|
1276 | |