[pypy-svn] r45469 - in pypy/dist/pypy: rpython rpython/module translator/c translator/c/src

arigo at codespeak.net arigo at codespeak.net
Thu Aug 2 20:36:39 CEST 2007


Author: arigo
Date: Thu Aug  2 20:36:38 2007
New Revision: 45469

Modified:
   pypy/dist/pypy/rpython/extfunctable.py
   pypy/dist/pypy/rpython/module/ll_os.py
   pypy/dist/pypy/translator/c/extfunc.py
   pypy/dist/pypy/translator/c/src/ll_os.h
Log:
os.getpid()...


Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py	(original)
+++ pypy/dist/pypy/rpython/extfunctable.py	Thu Aug  2 20:36:38 2007
@@ -202,8 +202,6 @@
 declare(os._exit    , noneannotation, 'll_os/_exit')
 if hasattr(os, 'kill'):
     declare(os.kill     , noneannotation, 'll_os/kill')
-if hasattr(os, 'getpid'):
-    declare(os.getpid   , int,            'll_os/getpid')
 if hasattr(os, 'link'):
     declare(os.link     , noneannotation, 'll_os/link')
 if hasattr(os, 'symlink'):

Modified: pypy/dist/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_os.py	(original)
+++ pypy/dist/pypy/rpython/module/ll_os.py	Thu Aug  2 20:36:38 2007
@@ -20,8 +20,10 @@
 from pypy.rpython.lltypesystem import lltype
 
 class RegisterOs(BaseLazyRegistering):
+    UNISTD_INCL = ['unistd.h', 'sys/types.h']
+
     def __init__(self):
-        self.getuid_incl = ['unistd.h', 'sys/types.h']
+        pass   # XXX <arigo> fijal: why do I need this?
     
     # a simple, yet usefull factory
     def register_os_function_returning_int(self, fun, name, **kwds):
@@ -177,12 +179,18 @@
     @registering(os.getuid)
     def register_os_getuid(self):
         self.register_os_function_returning_int(os.getuid, 'getuid',
-                                                includes=self.getuid_incl)
+                                                includes=self.UNISTD_INCL)
 
     @registering(os.geteuid)
     def register_os_geteuid(self):
         self.register_os_function_returning_int(os.geteuid, 'geteuid',
-                                                includes=self.getuid_incl)
+                                                includes=self.UNISTD_INCL)
+
+    if hasattr(os, 'getpid'):
+        @registering(os.getpid)
+        def register_os_getpid(self):
+            self.register_os_function_returning_int(os.getpid, 'getpid',
+                                                    includes=self.UNISTD_INCL)
 
     @registering(os.open)
     def register_os_open(self):
@@ -462,10 +470,6 @@
         return os.umask(mask)
     ll_os_umask.suggested_primitive = True
 
-    def ll_os_getpid(cls):
-        return os.getpid()
-    ll_os_getpid.suggested_primitive = True
-
     def ll_os_kill(cls, pid, sig):
         os.kill(pid, sig)
     ll_os_kill.suggested_primitive = True

Modified: pypy/dist/pypy/translator/c/extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/extfunc.py	(original)
+++ pypy/dist/pypy/translator/c/extfunc.py	Thu Aug  2 20:36:38 2007
@@ -46,7 +46,6 @@
     impl.ll_os_chmod.im_func:   'LL_os_chmod',
     impl.ll_os_rename.im_func:  'LL_os_rename',
     impl.ll_os_umask.im_func:   'LL_os_umask',
-    impl.ll_os_getpid.im_func:  'LL_os_getpid',
     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/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	Thu Aug  2 20:36:38 2007
@@ -68,7 +68,6 @@
 void LL_os_chmod(RPyString * path, int mode);
 void LL_os_rename(RPyString * path1, RPyString * path2);
 int LL_os_umask(int mode);
-long LL_os_getpid(void);
 void LL_os_kill(int pid, int sig);
 void LL_os_link(RPyString * path1, RPyString * path2);
 void LL_os_symlink(RPyString * path1, RPyString * path2);
@@ -293,10 +292,6 @@
 	return umask(mode);
 }
 
-long LL_os_getpid(void) {
-	return getpid();
-}
-
 #ifdef HAVE_KILL
 void LL_os_kill(int pid, int sig) {
     int error = kill(pid, sig);


More information about the pypy-svn mailing list