dir_reader_posix.h 1.2 KB

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