[pypy-commit] pypy default: ctermid impl in rpython, no idea how to test it

fijal noreply at buildbot.pypy.org
Wed Sep 18 12:26:02 CEST 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r66998:c5f2ba2568ae
Date: 2013-09-18 12:21 +0200
http://bitbucket.org/pypy/pypy/changeset/c5f2ba2568ae/

Log:	ctermid impl in rpython, no idea how to test it

diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py
--- a/rpython/rtyper/module/ll_os.py
+++ b/rpython/rtyper/module/ll_os.py
@@ -1668,6 +1668,16 @@
         return extdef([int], int, llimpl=nice_llimpl,
                       export_name="ll_os.ll_os_nice")
 
+    @registering_if(os, 'ctermid')
+    def register_os_ctermid(self):
+        os_ctermid = self.llexternal('ctermid', [rffi.CCHARP], rffi.CCHARP)
+
+        def ctermid_llimpl():
+            return rffi.charp2str(os_ctermid(lltype.nullptr(rffi.CCHARP.TO)))
+
+        return extdef([], str, llimpl=ctermid_llimpl,
+                      export_name="ll_os.ll_os_ctermid")
+
 # --------------------------- os.stat & variants ---------------------------
 
     @registering(os.fstat)


More information about the pypy-commit mailing list