[pypy-svn] r45272 - pypy/dist/pypy/module/posix
fijal at codespeak.net
fijal at codespeak.net
Mon Jul 23 14:27:10 CEST 2007
Author: fijal
Date: Mon Jul 23 14:27:10 2007
New Revision: 45272
Modified:
pypy/dist/pypy/module/posix/__init__.py
pypy/dist/pypy/module/posix/interp_posix.py
Log:
getuid/geteuid implementation
Modified: pypy/dist/pypy/module/posix/__init__.py
==============================================================================
--- pypy/dist/pypy/module/posix/__init__.py (original)
+++ pypy/dist/pypy/module/posix/__init__.py Mon Jul 23 14:27:10 2007
@@ -85,6 +85,9 @@
interpleveldefs['ttyname'] = 'interp_posix.ttyname'
if hasattr(os, 'setsid'):
interpleveldefs['setsid'] = 'interp_posix.setsid'
+ if hasattr(os, 'getuid'):
+ interpleveldefs['getuid'] = 'interp_posix.getuid'
+ interpleveldefs['geteuid'] = 'interp_posix.geteuid'
for name in w_star:
if hasattr(os, name):
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 Mon Jul 23 14:27:10 2007
@@ -524,6 +524,30 @@
return space.newtuple(l_w)
uname.unwrap_spec = [ObjSpace]
+def getuid(space):
+ """ getuid() -> uid
+
+ Return the current process's user id.
+ """
+ try:
+ result = os.getuid()
+ except OSError, e:
+ raise wrap_oserror(space, e)
+ return space.wrap(result)
+getuid.unwrap_spec = [ObjSpace]
+
+def getuid(space):
+ """ geteuid() -> euid
+
+ Return the current process's effective user id.
+ """
+ try:
+ result = os.geteuid()
+ except OSError, e:
+ raise wrap_oserror(space, e)
+ return space.wrap(result)
+getuid.unwrap_spec = [ObjSpace]
+
def declare_new_w_star(name):
if name in w_star_returning_int:
def WSTAR(space, status):
More information about the Pypy-commit
mailing list