[pypy-svn] r79985 - in pypy/branch/more-posix/pypy/module/posix: . test
arigo at codespeak.net
arigo at codespeak.net
Sat Dec 11 16:57:18 CET 2010
Author: arigo
Date: Sat Dec 11 16:57:16 2010
New Revision: 79985
Modified:
pypy/branch/more-posix/pypy/module/posix/__init__.py
pypy/branch/more-posix/pypy/module/posix/interp_posix.py
pypy/branch/more-posix/pypy/module/posix/test/test_posix2.py
Log:
Docstrings. mkfifo().
Modified: pypy/branch/more-posix/pypy/module/posix/__init__.py
==============================================================================
--- pypy/branch/more-posix/pypy/module/posix/__init__.py (original)
+++ pypy/branch/more-posix/pypy/module/posix/__init__.py Sat Dec 11 16:57:16 2010
@@ -115,6 +115,8 @@
interpleveldefs['ttyname'] = 'interp_posix.ttyname'
if hasattr(os, 'getloadavg'):
interpleveldefs['getloadavg'] = 'interp_posix.getloadavg'
+ if hasattr(os, 'mkfifo'):
+ interpleveldefs['mkfifo'] = 'interp_posix.mkfifo'
for name in ['setsid', 'getuid', 'geteuid', 'getgid', 'getegid', 'setuid',
'seteuid', 'setgid', 'setegid', 'getpgrp', 'setpgrp',
Modified: pypy/branch/more-posix/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/branch/more-posix/pypy/module/posix/interp_posix.py (original)
+++ pypy/branch/more-posix/pypy/module/posix/interp_posix.py Sat Dec 11 16:57:16 2010
@@ -153,6 +153,7 @@
ftruncate.unwrap_spec = [ObjSpace, "c_int", r_longlong]
def fsync(space, w_fd):
+ """Force write of file with filedescriptor to disk."""
fd = space.c_filedescriptor_w(w_fd)
try:
os.fsync(fd)
@@ -161,6 +162,8 @@
fsync.unwrap_spec = [ObjSpace, W_Root]
def fdatasync(space, w_fd):
+ """Force write of file with filedescriptor to disk.
+Does not force update of metadata."""
fd = space.c_filedescriptor_w(w_fd)
try:
os.fdatasync(fd)
@@ -169,6 +172,8 @@
fdatasync.unwrap_spec = [ObjSpace, W_Root]
def fchdir(space, w_fd):
+ """Change to the directory of the given file descriptor. fildes must be
+opened on a directory, not a file."""
fd = space.c_filedescriptor_w(w_fd)
try:
os.fchdir(fd)
@@ -549,6 +554,14 @@
raise wrap_oserror(space, e)
rename.unwrap_spec = [ObjSpace, W_Root, W_Root]
+def mkfifo(space, w_filename, mode=0666):
+ """Create a FIFO (a POSIX named pipe)."""
+ try:
+ dispatch_filename(rposix.mkfifo)(space, w_filename, mode)
+ except OSError, e:
+ raise wrap_oserror2(space, e, w_filename)
+mkfifo.unwrap_spec = [ObjSpace, W_Root, "c_int"]
+
def umask(space, mask):
"Set the current numeric umask and return the previous umask."
prevmask = os.umask(mask)
Modified: pypy/branch/more-posix/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/branch/more-posix/pypy/module/posix/test/test_posix2.py (original)
+++ pypy/branch/more-posix/pypy/module/posix/test/test_posix2.py Sat Dec 11 16:57:16 2010
@@ -659,6 +659,15 @@
f.close()
os.chown(self.path, os.getuid(), os.getgid())
+ if hasattr(os, 'mkfifo'):
+ def test_mkfifo(self):
+ os = self.posix
+ os.mkfifo(self.path2 + 'test_mkfifo', 0666)
+ st = os.lstat(self.path2 + 'test_mkfifo')
+ import stat
+ assert stat.S_ISFIFO(st.st_mode)
+
+
class AppTestEnvironment(object):
def setup_class(cls):
cls.space = space
More information about the Pypy-commit
mailing list