michael@0: // Copyright (c) 2010 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef BASE_DIR_READER_POSIX_H_ michael@0: #define BASE_DIR_READER_POSIX_H_ michael@0: #pragma once michael@0: michael@0: #include "build/build_config.h" michael@0: michael@0: // This header provides a class, DirReaderPosix, which allows one to open and michael@0: // read from directories without allocating memory. For the interface, see michael@0: // the generic fallback in dir_reader_fallback.h. michael@0: michael@0: // Mac note: OS X has getdirentries, but it only works if we restrict Chrome to michael@0: // 32-bit inodes. There is a getdirentries64 syscall in 10.6, but it's not michael@0: // wrapped and the direct syscall interface is unstable. Using an unstable API michael@0: // seems worse than falling back to enumerating all file descriptors so we will michael@0: // probably never implement this on the Mac. michael@0: michael@0: #if defined(OS_LINUX) michael@0: #include "base/dir_reader_linux.h" michael@0: #elif defined(OS_BSD) && !defined(__GLIBC__) michael@0: #include "base/dir_reader_bsd.h" michael@0: #else michael@0: #include "base/dir_reader_fallback.h" michael@0: #endif michael@0: michael@0: namespace base { michael@0: michael@0: #if defined(OS_LINUX) michael@0: typedef DirReaderLinux DirReaderPosix; michael@0: #elif defined(OS_BSD) && !defined(__GLIBC__) michael@0: typedef DirReaderBSD DirReaderPosix; michael@0: #else michael@0: typedef DirReaderFallback DirReaderPosix; michael@0: #endif michael@0: michael@0: } // namespace base michael@0: michael@0: #endif // BASE_DIR_READER_POSIX_H_