[pypy-svn] r30514 - pypy/dist/pypy/translator/c/src
arigo at codespeak.net
arigo at codespeak.net
Tue Jul 25 12:33:04 CEST 2006
Author: arigo
Date: Tue Jul 25 12:33:02 2006
New Revision: 30514
Modified:
pypy/dist/pypy/translator/c/src/ll_os.h
Log:
Windows compatibility (untested code!).
Modified: pypy/dist/pypy/translator/c/src/ll_os.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_os.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_os.h Tue Jul 25 12:33:02 2006
@@ -196,6 +196,7 @@
#ifdef LL_NEED_OS_PIPE
RPyPIPE_RESULT* LL_os_pipe(void) {
+#if !defined(MS_WINDOWS)
int filedes[2];
int error = pipe(filedes);
if (error != 0) {
@@ -203,6 +204,18 @@
return NULL;
}
return ll_pipe_result(filedes[0], filedes[1]);
+#else
+ HANDLE read, write;
+ int read_fd, write_fd;
+ BOOL ok = CreatePipe(&read, &write, NULL, 0);
+ if (!ok) {
+ RPYTHON_RAISE_OSERROR(errno);
+ return NULL;
+ }
+ read_fd = _open_osfhandle((long)read, 0);
+ write_fd = _open_osfhandle((long)write, 1);
+ return ll_pipe_result(read_fd, write_fd);
+#endif
}
#endif
More information about the Pypy-commit
mailing list