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
15namespace mcld{
16namespace sys{
17namespace fs{
18namespace detail{
19
20std::string static_library_extension = ".a";
21std::string shared_library_extension = ".so";
22std::string executable_extension = "";
23std::string relocatable_extension = ".o";
24std::string assembly_extension = ".s";
25std::string bitcode_extension = ".bc";
26
27int open(const Path& pPath, int pOFlag)
28{
29  return ::open(pPath.native().c_str(), pOFlag);
30}
31
32int open(const Path& pPath, int pOFlag, int pPerm)
33{
34  return ::open(pPath.native().c_str(), pOFlag, pPerm);
35}
36
37ssize_t pread(int pFD, void* pBuf, size_t pCount, size_t pOffset)
38{
39  return ::pread(pFD, pBuf, pCount, pOffset);
40}
41
42ssize_t pwrite(int pFD, const void* pBuf, size_t pCount, size_t pOffset)
43{
44  return ::pwrite(pFD, pBuf, pCount, pOffset);
45}
46
47int 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