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.294 by root, Sat Apr 9 19:34:05 2022 UTC vs.
Revision 1.295 by root, Mon Sep 5 00:03:32 2022 UTC

1093 return ts->tv_sec + ts->tv_nsec * 1e-9; 1093 return ts->tv_sec + ts->tv_nsec * 1e-9;
1094} 1094}
1095 1095
1096/*****************************************************************************/ 1096/*****************************************************************************/
1097 1097
1098/* extract a ref-to-array of strings into a temporary c style string vector */
1099static char **
1100extract_stringvec (SV *sv, const char *croakmsg)
1101{
1102 if (!SvROK (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV)
1103 croak (croakmsg);
1104
1105 AV *av = (AV *)SvRV (sv);
1106 int i, nelem = av_len (av) + 1;
1107 char **vecp = (char **)SvPVX (sv_2mortal (newSV (sizeof (char *) * (nelem + 1))));
1108
1109 for (i = 0; i < nelem; ++i)
1110 {
1111 SV **e = av_fetch (av, i, 0);
1112
1113 if (e && *e)
1114 vecp[i] = SvPVbyte_nolen (*e);
1115 else
1116 vecp[i] = "";
1117 }
1118
1119 vecp[nelem] = 0;
1120
1121 return vecp;
1122}
1123
1124/*****************************************************************************/
1125
1098XS(boot_IO__AIO) ecb_cold; 1126XS(boot_IO__AIO) ecb_cold;
1099 1127
1100MODULE = IO::AIO PACKAGE = IO::AIO 1128MODULE = IO::AIO PACKAGE = IO::AIO
1101 1129
1102PROTOTYPES: ENABLE 1130PROTOTYPES: ENABLE
2809#endif 2837#endif
2810 2838
2811 XPUSHs (newmortalFH (fd, O_RDWR)); 2839 XPUSHs (newmortalFH (fd, O_RDWR));
2812} 2840}
2813 2841
2842int
2843fexecve (SV *fh, SV *args, SV *envs = &PL_sv_undef)
2844 CODE:
2845{
2846 int fd = PerlIO_fileno (IoIFP (sv_2io (fh)));
2847 char **envp, **argv;
2848 argv = extract_stringvec (args, "IO::AIO::fexecve: args must be an array of strings");
2849 if (!SvOK (envs))
2850 {
2851 extern char **environ;
2852 envp = environ;
2853 }
2854 else
2855 envp = extract_stringvec (envs, "IO::AIO::fexecve: envs must be an array of strings");
2856#if _POSIX_VERSION >= 200809L
2857 RETVAL = fexecve (fd, argv, envp);
2858#else
2859 RETVAL = (errno = ENOSYS, -1);
2860#endif
2861}
2862 OUTPUT: RETVAL
2863
2814UV 2864UV
2815get_fdlimit () 2865get_fdlimit ()
2816 CODE: 2866 CODE:
2817#if HAVE_RLIMITS 2867#if HAVE_RLIMITS
2818 struct rlimit rl; 2868 struct rlimit rl;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines