#include <unistd.h>
#include <process.h>
+#include <sys/cygwin.h>
/*
* pp_system() implemented via spawn()
Sigsave_t ihand,qhand;
int childpid, result, status;
- rsignal_save(SIGINT, SIG_IGN, &ihand);
- rsignal_save(SIGQUIT, SIG_IGN, &qhand);
+ rsignal_save(SIGINT, (Sighandler_t) SIG_IGN, &ihand);
+ rsignal_save(SIGQUIT, (Sighandler_t) SIG_IGN, &qhand);
childpid = spawnvp(_P_NOWAIT,path,argv);
if (childpid < 0) {
status = -1;
return do_spawnvp("sh",command);
}
- New (1303,PL_Argv,(s-cmd)/2+2,char*);
+ Newx (PL_Argv,(s-cmd)/2+2,char*);
PL_Cmd=savepvn (cmd,s-cmd);
a=PL_Argv;
for (s=PL_Cmd; *s;) {
Perl_croak(aTHX_ "Usage: Cwd::cwd()");
if((cwd = getcwd(NULL, -1))) {
ST(0) = sv_2mortal(newSVpv(cwd, 0));
- safesysfree(cwd);
+ free(cwd);
#ifndef INCOMPLETE_TAINTS
SvTAINTED_on(ST(0));
#endif
XSRETURN_UNDEF;
}
+static
+XS(XS_Cygwin_pid_to_winpid)
+{
+ dXSARGS;
+ dXSTARG;
+ pid_t pid, RETVAL;
+
+ if (items != 1)
+ Perl_croak(aTHX_ "Usage: Cygwin::pid_to_winpid(pid)");
+
+ pid = (pid_t)SvIV(ST(0));
+
+ if ((RETVAL = cygwin_internal(CW_CYGWIN_PID_TO_WINPID, pid)) > 0) {
+ XSprePUSH; PUSHi((IV)RETVAL);
+ XSRETURN(1);
+ }
+ XSRETURN_UNDEF;
+}
+
+static
+XS(XS_Cygwin_winpid_to_pid)
+{
+ dXSARGS;
+ dXSTARG;
+ pid_t pid, RETVAL;
+
+ if (items != 1)
+ Perl_croak(aTHX_ "Usage: Cygwin::winpid_to_pid(pid)");
+
+ pid = (pid_t)SvIV(ST(0));
+
+ if ((RETVAL = cygwin32_winpid_to_pid(pid)) > 0) {
+ XSprePUSH; PUSHi((IV)RETVAL);
+ XSRETURN(1);
+ }
+ XSRETURN_UNDEF;
+}
+
+
void
init_os_extras(void)
{
dTHX;
newXS("Cwd::cwd", Cygwin_cwd, file);
+ newXS("Cygwin::winpid_to_pid", XS_Cygwin_winpid_to_pid, file);
+ newXS("Cygwin::pid_to_winpid", XS_Cygwin_pid_to_winpid, file);
}