[pypy-svn] r45728 - in pypy/branch/pypy-more-rtti-inprogress: rpython rpython/module translator/c translator/c/src
arigo at codespeak.net
arigo at codespeak.net
Thu Aug 16 16:21:08 CEST 2007
Author: arigo
Date: Thu Aug 16 16:21:08 2007
New Revision: 45728
Modified:
pypy/branch/pypy-more-rtti-inprogress/rpython/extfunctable.py
pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py
pypy/branch/pypy-more-rtti-inprogress/translator/c/extfunc.py
pypy/branch/pypy-more-rtti-inprogress/translator/c/src/ll_os.h
Log:
os.umask()...
Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/extfunctable.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/extfunctable.py (original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/extfunctable.py Thu Aug 16 16:21:08 2007
@@ -150,7 +150,6 @@
# external function declarations
posix = __import__(os.name)
-declare(os.umask , int , 'll_os/umask')
declare(os._exit , noneannotation, 'll_os/_exit')
if hasattr(os, 'kill'):
declare(os.kill , noneannotation, 'll_os/kill')
Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py (original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py Thu Aug 16 16:21:08 2007
@@ -757,6 +757,21 @@
self.register(os.rename, [str, str], s_None, llimpl=rename_lltypeimpl,
export_name="ll_os.ll_os_rename")
+ @registering(os.umask)
+ def register_os_umask(self):
+ if os.name == 'nt':
+ mode_t = rffi.INT
+ else:
+ mode_t = rffi.MODE_T
+ os_umask = rffi.llexternal('umask', [mode_t], mode_t)
+
+ def umask_lltypeimpl(fd):
+ res = os_umask(rffi.cast(mode_t, fd))
+ return rffi.cast(lltype.Signed, res)
+
+ self.register(os.umask, [int], int, llimpl=umask_lltypeimpl,
+ export_name="ll_os.ll_os_umask")
+
# --------------------------- os.stat & variants ---------------------------
@registering(os.fstat)
@@ -846,10 +861,6 @@
# XXX deprecated style, this is all waiting to be converted to rffi
__metaclass__ = ClassMethods
- def ll_os_umask(cls, mask):
- return os.umask(mask)
- ll_os_umask.suggested_primitive = True
-
def ll_os_kill(cls, pid, sig):
os.kill(pid, sig)
ll_os_kill.suggested_primitive = True
Modified: pypy/branch/pypy-more-rtti-inprogress/translator/c/extfunc.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/translator/c/extfunc.py (original)
+++ pypy/branch/pypy-more-rtti-inprogress/translator/c/extfunc.py Thu Aug 16 16:21:08 2007
@@ -20,7 +20,6 @@
# references to functions, so we cannot insert classmethods here.
EXTERNALS = {
- impl.ll_os_umask.im_func: 'LL_os_umask',
impl.ll_os_kill.im_func: 'LL_os_kill',
impl.ll_os_link.im_func: 'LL_os_link',
impl.ll_os_symlink.im_func: 'LL_os_symlink',
Modified: pypy/branch/pypy-more-rtti-inprogress/translator/c/src/ll_os.h
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/translator/c/src/ll_os.h (original)
+++ pypy/branch/pypy-more-rtti-inprogress/translator/c/src/ll_os.h Thu Aug 16 16:21:08 2007
@@ -68,10 +68,6 @@
#include "ll_osdefs.h"
-int LL_os_umask(int mode) {
- return umask(mode);
-}
-
#ifdef HAVE_KILL
void LL_os_kill(int pid, int sig) {
int error = kill(pid, sig);
More information about the Pypy-commit
mailing list