[pypy-svn] r46286 - pypy/branch/pypy-more-rtti-inprogress/rpython/module

arigo at codespeak.net arigo at codespeak.net
Mon Sep 3 17:55:31 CEST 2007


Author: arigo
Date: Mon Sep  3 17:55:29 2007
New Revision: 46286

Modified:
   pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py
Log:
Fix os.listdir() on Linux


Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py	Mon Sep  3 17:55:29 2007
@@ -620,16 +620,20 @@
 
         else:
             class CConfig:
-                DIRENT = platform.Struct('dirent',
+                _includes_ = ['sys/types.h', 'dirent.h']
+                DIRENT = platform.Struct('struct dirent',
                     [('d_name', lltype.FixedSizeArray(rffi.CHAR, 1))])
 
             config = platform.configure(CConfig)
             DIRENT = config['DIRENT']
             DIRENTP = lltype.Ptr(DIRENT)
             DIRP = rffi.COpaquePtr('DIR')
-            os_opendir = self.llexternal('opendir', [rffi.CCHARP], DIRP)
-            os_readdir = self.llexternal('readdir', [DIRP], DIRENTP)
-            os_closedir = self.llexternal('closedir', [DIRP], rffi.INT)
+            os_opendir = self.llexternal('opendir', [rffi.CCHARP], DIRP,
+                                         includes=CConfig._includes_)
+            os_readdir = self.llexternal('readdir', [DIRP], DIRENTP,
+                                         includes=CConfig._includes_)
+            os_closedir = self.llexternal('closedir', [DIRP], rffi.INT,
+                                          includes=CConfig._includes_)
 
             def os_listdir_llimpl(path):
                 dirp = os_opendir(path)



More information about the Pypy-commit mailing list