Home | History | Annotate | Download | only in Unix
      1 //===- FileSystem.inc -----------------------------------------------------===//
      2 //
      3 //                     The MCLinker Project
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 #include <string>
     10 #include <sys/types.h>
     11 #include <sys/stat.h>
     12 #include <unistd.h>
     13 #include <fcntl.h>
     14 
     15 namespace mcld{
     16 namespace sys{
     17 namespace fs{
     18 namespace detail{
     19 
     20 std::string static_library_extension = ".a";
     21 std::string shared_library_extension = ".so";
     22 std::string executable_extension = "";
     23 std::string relocatable_extension = ".o";
     24 std::string assembly_extension = ".s";
     25 std::string bitcode_extension = ".bc";
     26 
     27 int open(const Path& pPath, int pOFlag)
     28 {
     29   return ::open(pPath.native().c_str(), pOFlag);
     30 }
     31 
     32 int open(const Path& pPath, int pOFlag, int pPerm)
     33 {
     34   return ::open(pPath.native().c_str(), pOFlag, pPerm);
     35 }
     36 
     37 ssize_t pread(int pFD, void* pBuf, size_t pCount, size_t pOffset)
     38 {
     39   return ::pread(pFD, pBuf, pCount, pOffset);
     40 }
     41 
     42 ssize_t pwrite(int pFD, const void* pBuf, size_t pCount, size_t pOffset)
     43 {
     44   return ::pwrite(pFD, pBuf, pCount, pOffset);
     45 }
     46 
     47 int ftruncate(int pFD, size_t pLength)
     48 {
     49   return ::ftruncate(pFD, pLength);
     50 }
     51 
     52 } // namespace of detail
     53 } // namespace of fs
     54 } // namespace of sys
     55 } // namespace of mcld
     56 
     57