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