summaryrefslogtreecommitdiff
path: root/cygwin
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2005-02-10 12:04:35 -0800
committerH.Merijn Brand <h.m.brand@xs4all.nl>2005-02-11 09:32:50 +0000
commit49fd6edc755e0fc505e10cdb1d5025c747291b4c (patch)
tree7a54e500da1a04559186a4beb5c2d7f80027a01e /cygwin
parenta758b0b5fd9985d853637e2aa988519329533771 (diff)
downloadperl-49fd6edc755e0fc505e10cdb1d5025c747291b4c.tar.gz
Re: [PATCH] Re: perl winpid?
Message-ID: <20050211040434.GA3824@efn.org> p4raw-id: //depot/perl@23961
Diffstat (limited to 'cygwin')
-rw-r--r--cygwin/cygwin.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/cygwin/cygwin.c b/cygwin/cygwin.c
index 0e9d07d35e..ceb2e816db 100644
--- a/cygwin/cygwin.c
+++ b/cygwin/cygwin.c
@@ -9,6 +9,7 @@
#include <unistd.h>
#include <process.h>
+#include <sys/cygwin.h>
/*
* pp_system() implemented via spawn()
@@ -155,6 +156,39 @@ XS(Cygwin_cwd)
XSRETURN_UNDEF;
}
+static
+XS(XS_Cygwin_pid_to_winpid)
+{
+ dXSARGS;
+ if (items != 1)
+ Perl_croak(aTHX_ "Usage: Cygwin::pid_to_winpid(pid)");
+ pid_t pid = (pid_t)SvIV(ST(0));
+ pid_t RETVAL;
+ dXSTARG;
+ 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;
+ if (items != 1)
+ Perl_croak(aTHX_ "Usage: Cygwin::winpid_to_pid(pid)");
+ pid_t pid = (pid_t)SvIV(ST(0));
+ pid_t RETVAL;
+ dXSTARG;
+ if ((RETVAL = cygwin32_winpid_to_pid(pid)) > 0) {
+ XSprePUSH; PUSHi((IV)RETVAL);
+ XSRETURN(1);
+ }
+ XSRETURN_UNDEF;
+}
+
+
void
init_os_extras(void)
{
@@ -162,4 +196,6 @@ 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);
}