1*6777b538SAndroid Build Coastguard Worker // Copyright 2012 The Chromium Authors 2*6777b538SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 3*6777b538SAndroid Build Coastguard Worker // found in the LICENSE file. 4*6777b538SAndroid Build Coastguard Worker 5*6777b538SAndroid Build Coastguard Worker #ifndef BASE_FILES_DIR_READER_POSIX_H_ 6*6777b538SAndroid Build Coastguard Worker #define BASE_FILES_DIR_READER_POSIX_H_ 7*6777b538SAndroid Build Coastguard Worker 8*6777b538SAndroid Build Coastguard Worker #include "build/build_config.h" 9*6777b538SAndroid Build Coastguard Worker 10*6777b538SAndroid Build Coastguard Worker // This header provides a class, DirReaderPosix, which allows one to open and 11*6777b538SAndroid Build Coastguard Worker // read from directories without allocating memory. For the interface, see 12*6777b538SAndroid Build Coastguard Worker // the generic fallback in dir_reader_fallback.h. 13*6777b538SAndroid Build Coastguard Worker 14*6777b538SAndroid Build Coastguard Worker // Mac note: OS X has getdirentries, but it only works if we restrict Chrome to 15*6777b538SAndroid Build Coastguard Worker // 32-bit inodes. There is a getdirentries64 syscall in 10.6, but it's not 16*6777b538SAndroid Build Coastguard Worker // wrapped and the direct syscall interface is unstable. Using an unstable API 17*6777b538SAndroid Build Coastguard Worker // seems worse than falling back to enumerating all file descriptors so we will 18*6777b538SAndroid Build Coastguard Worker // probably never implement this on the Mac. 19*6777b538SAndroid Build Coastguard Worker 20*6777b538SAndroid Build Coastguard Worker #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) 21*6777b538SAndroid Build Coastguard Worker #include "base/files/dir_reader_linux.h" 22*6777b538SAndroid Build Coastguard Worker #else 23*6777b538SAndroid Build Coastguard Worker #include "base/files/dir_reader_fallback.h" 24*6777b538SAndroid Build Coastguard Worker #endif 25*6777b538SAndroid Build Coastguard Worker 26*6777b538SAndroid Build Coastguard Worker namespace base { 27*6777b538SAndroid Build Coastguard Worker 28*6777b538SAndroid Build Coastguard Worker #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) 29*6777b538SAndroid Build Coastguard Worker typedef DirReaderLinux DirReaderPosix; 30*6777b538SAndroid Build Coastguard Worker #else 31*6777b538SAndroid Build Coastguard Worker typedef DirReaderFallback DirReaderPosix; 32*6777b538SAndroid Build Coastguard Worker #endif 33*6777b538SAndroid Build Coastguard Worker 34*6777b538SAndroid Build Coastguard Worker } // namespace base 35*6777b538SAndroid Build Coastguard Worker 36*6777b538SAndroid Build Coastguard Worker #endif // BASE_FILES_DIR_READER_POSIX_H_ 37