ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.xs
(Generate patch)

Comparing IO-AIO/AIO.xs (file contents):
Revision 1.267 by root, Sat Aug 25 19:25:32 2018 UTC vs.
Revision 1.274 by root, Sun Mar 10 12:16:48 2019 UTC

3#include <errno.h> 3#include <errno.h>
4 4
5#include "EXTERN.h" 5#include "EXTERN.h"
6#include "perl.h" 6#include "perl.h"
7#include "XSUB.h" 7#include "XSUB.h"
8#include "perliol.h"
8 9
9#if !defined mg_findext 10#if !defined mg_findext
10# define mg_findext(sv,type,vtbl) mg_find (sv, type) 11# define mg_findext(sv,type,vtbl) mg_find (sv, type)
11#endif 12#endif
12 13
17#include <sys/socket.h> 18#include <sys/socket.h>
18#include <sys/stat.h> 19#include <sys/stat.h>
19#include <limits.h> 20#include <limits.h>
20#include <fcntl.h> 21#include <fcntl.h>
21#include <sched.h> 22#include <sched.h>
22
23#if HAVE_SYS_MKDEV_H
24# include <sys/mkdev.h>
25#elif HAVE_SYS_SYSMACROS_H
26# include <sys/sysmacros.h>
27#endif
28
29#if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
30# include <sys/mman.h>
31#endif
32 23
33/* the incompetent fool that created musl keeps __linux__, refuses 24/* the incompetent fool that created musl keeps __linux__, refuses
34 * to implement any linux standard apis, and also has no way to test 25 * to implement any linux standard apis, and also has no way to test
35 * for his broken iplementation. don't complain to me if this fails 26 * for his broken iplementation. don't complain to me if this fails
36 * for you. 27 * for you.
116 107
117/*****************************************************************************/ 108/*****************************************************************************/
118 109
119#include "config.h" 110#include "config.h"
120 111
112#if HAVE_SYS_MKDEV_H
113# include <sys/mkdev.h>
114#elif HAVE_SYS_SYSMACROS_H
115# include <sys/sysmacros.h>
116#endif
117
118#if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
119# include <sys/mman.h>
120#endif
121
122#if HAVE_SYS_UIO_H
123# include <sys/uio.h>
124#endif
125
121#if HAVE_ST_XTIMENSEC 126#if HAVE_ST_XTIMENSEC
122# define ATIMENSEC PL_statcache.st_atimensec 127# define ATIMENSEC PL_statcache.st_atimensec
123# define MTIMENSEC PL_statcache.st_mtimensec 128# define MTIMENSEC PL_statcache.st_mtimensec
124# define CTIMENSEC PL_statcache.st_ctimensec 129# define CTIMENSEC PL_statcache.st_ctimensec
125#elif HAVE_ST_XTIMESPEC 130#elif HAVE_ST_XTIMESPEC
815#endif 820#endif
816 } 821 }
817 else 822 else
818 PUSHs (sv_result); 823 PUSHs (sv_result);
819 break; 824 break;
825
826#if 0
827 case EIO_CLOSE:
828 PerlIOUnix_refcnt_dec (req->int1);
829 break;
830#endif
820 831
821 case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ 832 case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */
822 if (req->result > 0) 833 if (req->result > 0)
823 SvIV_set (sv_result, 0); 834 SvIV_set (sv_result, 0);
824 /* FALLTHROUGH */ 835 /* FALLTHROUGH */
1273 const_eio (SEEK_CUR) 1284 const_eio (SEEK_CUR)
1274 const_eio (SEEK_END) 1285 const_eio (SEEK_END)
1275 1286
1276 const_eio (MCL_FUTURE) 1287 const_eio (MCL_FUTURE)
1277 const_eio (MCL_CURRENT) 1288 const_eio (MCL_CURRENT)
1289 const_eio (MCL_ONFAULT)
1278 1290
1279 const_eio (MS_ASYNC) 1291 const_eio (MS_ASYNC)
1280 const_eio (MS_INVALIDATE) 1292 const_eio (MS_INVALIDATE)
1281 const_eio (MS_SYNC) 1293 const_eio (MS_SYNC)
1282 1294
1472aio_close (SV *fh, SV *callback = &PL_sv_undef) 1484aio_close (SV *fh, SV *callback = &PL_sv_undef)
1473 PPCODE: 1485 PPCODE:
1474{ 1486{
1475 int fd = s_fileno_croak (fh, 0); 1487 int fd = s_fileno_croak (fh, 0);
1476 dREQ; 1488 dREQ;
1489#if 0
1490 /* partially duplicate logic in s_fileno */
1491 SvGETMAGIC (fh);
1477 1492
1493 if (SvROK (fh))
1494 {
1495 fh = SvRV (fh);
1496 SvGETMAGIC (fh);
1497 }
1498
1499 if (SvTYPE (fh) == SVt_PVGV)
1500 {
1501 /* perl filehandle */
1502 PerlIOUnix_refcnt_inc (fd);
1503 do_close ((GV *)fh, 1);
1504
1505 req->type = EIO_CLOSE;
1506 req->int1 = fd;
1507 /*req->sv2 = newSVsv (fh);*/ /* since we stole the fd, no need to keep the fh */
1508 }
1509 else
1510#endif
1511 {
1512 /* fd number */
1478 req->type = EIO_DUP2; 1513 req->type = EIO_DUP2;
1479 req->int1 = close_fd; 1514 req->int1 = close_fd;
1480 req->sv2 = newSVsv (fh); 1515 req->sv2 = newSVsv (fh);
1481 req->int2 = fd; 1516 req->int2 = fd;
1517 }
1482 1518
1483 REQ_SEND; 1519 REQ_SEND;
1484} 1520}
1485 1521
1486void 1522void
2244} 2280}
2245 OUTPUT: 2281 OUTPUT:
2246 RETVAL 2282 RETVAL
2247 2283
2248int 2284int
2285mlockall (int flags)
2286 PROTOTYPE: $;
2287 CODE:
2288 RETVAL = eio_mlockall_sync (flags);
2289 OUTPUT:
2290 RETVAL
2291
2292int
2249munlockall () 2293munlockall ()
2250 CODE: 2294 CODE:
2251#if _POSIX_MEMLOCK 2295#if _POSIX_MEMLOCK
2252 munlockall (); 2296 munlockall ();
2253#else 2297#else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines