[pypy-svn] r57912 - pypy/dist/pypy/module/posix

fijal at codespeak.net fijal at codespeak.net
Sat Sep 6 22:43:11 CEST 2008


Author: fijal
Date: Sat Sep  6 22:43:09 2008
New Revision: 57912

Modified:
   pypy/dist/pypy/module/posix/__init__.py
   pypy/dist/pypy/module/posix/interp_posix.py
Log:
* implement getegid and chroot.
* seems that this comment is completely outdated, remove


Modified: pypy/dist/pypy/module/posix/__init__.py
==============================================================================
--- pypy/dist/pypy/module/posix/__init__.py	(original)
+++ pypy/dist/pypy/module/posix/__init__.py	Sat Sep  6 22:43:09 2008
@@ -93,6 +93,8 @@
         interpleveldefs['geteuid'] = 'interp_posix.geteuid'
     if hasattr(os, 'getgid'):
         interpleveldefs['getgid'] = 'interp_posix.getgid'
+    if hasattr(os, 'getegid'):
+        interpleveldefs['getegid'] = 'interp_posix.getegid'
     if hasattr(os, 'setuid'):
         interpleveldefs['setuid'] = 'interp_posix.setuid'
     if hasattr(os, 'setgid'):
@@ -100,6 +102,8 @@
     # not visible via os, inconsistency in nt:
     if hasattr(posix, '_getfullpathname'):
         interpleveldefs['_getfullpathname'] = 'interp_posix._getfullpathname'
+    if hasattr(os, 'chroot'):
+        interpleveldefs['chroot'] = 'interp_posix.chroot'
     
     for name in RegisterOs.w_star:
         if hasattr(os, name):
@@ -109,10 +113,6 @@
         """NOT_RPYTHON"""
         space = self.space
         config = space.config
-        # XXX execve does not work under ootypesystem yet :-(
-        # YYY nor does it anywhere else
-        #if config.translating and config.translation.type_system != "lltype":
-        #    space.delattr(self, space.wrap("execve"))
         if config.translating and config.translation.backend == "llvm":
             space.delattr(self, space.wrap("execv"))
 

Modified: pypy/dist/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/dist/pypy/module/posix/interp_posix.py	(original)
+++ pypy/dist/pypy/module/posix/interp_posix.py	Sat Sep  6 22:43:09 2008
@@ -591,6 +591,18 @@
     return space.w_None
 setgid.unwrap_spec = [ObjSpace, int]
 
+def chroot(space, path):
+    """ chroot(path)
+
+    Change root directory to path.
+    """
+    try:
+        os.chroot(path)
+    except OSError, e:
+        raise wrap_oserror(space, e)
+    return space.w_None
+chroot.unwrap_spec = [ObjSpace, str]
+
 def getgid(space):
     """ getgid() -> gid
     
@@ -599,6 +611,14 @@
     return space.wrap(os.getgid())
 getgid.unwrap_spec = [ObjSpace]
 
+def getegid(space):
+    """ getegid() -> gid
+    
+    Return the current process's effective group id.
+    """
+    return space.wrap(os.getegid())
+getgid.unwrap_spec = [ObjSpace]
+
 def geteuid(space):
     """ geteuid() -> euid
 



More information about the Pypy-commit mailing list