1/* ===-- fcntl.h - stub SDK header for compiler-rt --------------------------===
2 *
3 *                     The LLVM Compiler Infrastructure
4 *
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
7 *
8 * ===-----------------------------------------------------------------------===
9 *
10 * This is a stub SDK header file. This file is not part of the interface of
11 * this library nor an official version of the appropriate SDK header. It is
12 * intended only to stub the features of this header required by compiler-rt.
13 *
14 * ===-----------------------------------------------------------------------===
15 */
16
17#ifndef _SYS_FCNTL_H_
18#define _SYS_FCNTL_H_
19
20/* Determine the appropriate open function. */
21#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
22#  if defined(__i386)
23#    define __OPEN_NAME  "_open$UNIX2003"
24#  elif defined(__x86_64__)
25#    define __OPEN_NAME  "_open"
26#  elif defined(__arm)
27#    define __OPEN_NAME  "_open"
28#  else
29#    error "unrecognized architecture for targeting OS X"
30#  endif
31#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
32#  if defined(__i386) || defined (__x86_64)
33#    define __OPEN_NAME  "_open"
34#  elif defined(__arm)
35#    define __OPEN_NAME  "_open"
36#  else
37#    error "unrecognized architecture for targeting iOS"
38#  endif
39#else
40#  error "unrecognized architecture for targeting Darwin"
41#endif
42
43#define O_RDONLY   0x0000    /* open for reading only */
44#define O_WRONLY   0x0001    /* open for writing only */
45#define O_RDWR     0x0002    /* open for reading and writing */
46#define O_ACCMODE  0x0003    /* mask for above modes */
47
48#define O_CREAT    0x0200    /* create if nonexistent */
49
50int open(const char *, int, ...) __asm(__OPEN_NAME);
51
52#endif /* !_SYS_FCNTL_H_ */
53