Bill Wendling | 353fbd3 | 2013-05-23 07:18:59 +0000 | [diff] [blame] | 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" |
Tim Northover | a5a06ad | 2014-10-08 17:28:37 +0000 | [diff] [blame] | 26 | # elif defined(__arm) || defined(__arm64) |
Bill Wendling | 353fbd3 | 2013-05-23 07:18:59 +0000 | [diff] [blame] | 27 | # define __OPEN_NAME "_open" |
| 28 | # else |
Alp Toker | 1ee7fc7 | 2014-05-15 02:22:34 +0000 | [diff] [blame] | 29 | # error "unrecognized architecture for targeting OS X" |
Bill Wendling | 353fbd3 | 2013-05-23 07:18:59 +0000 | [diff] [blame] | 30 | # endif |
| 31 | #elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) |
| 32 | # if defined(__i386) || defined (__x86_64) |
| 33 | # define __OPEN_NAME "_open" |
Tim Northover | a5a06ad | 2014-10-08 17:28:37 +0000 | [diff] [blame] | 34 | # elif defined(__arm) || defined(__arm64) |
Bill Wendling | 353fbd3 | 2013-05-23 07:18:59 +0000 | [diff] [blame] | 35 | # define __OPEN_NAME "_open" |
| 36 | # else |
Alp Toker | 1ee7fc7 | 2014-05-15 02:22:34 +0000 | [diff] [blame] | 37 | # error "unrecognized architecture for targeting iOS" |
Bill Wendling | 353fbd3 | 2013-05-23 07:18:59 +0000 | [diff] [blame] | 38 | # endif |
| 39 | #else |
Alp Toker | 1ee7fc7 | 2014-05-15 02:22:34 +0000 | [diff] [blame] | 40 | # error "unrecognized architecture for targeting Darwin" |
Bill Wendling | 353fbd3 | 2013-05-23 07:18:59 +0000 | [diff] [blame] | 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 | |
Alp Toker | 1ee7fc7 | 2014-05-15 02:22:34 +0000 | [diff] [blame] | 48 | #define O_CREAT 0x0200 /* create if nonexistent */ |
Bill Wendling | 353fbd3 | 2013-05-23 07:18:59 +0000 | [diff] [blame] | 49 | |
| 50 | int open(const char *, int, ...) __asm(__OPEN_NAME); |
| 51 | |
| 52 | #endif /* !_SYS_FCNTL_H_ */ |