blob: 96b24384aa666b2e9d46f162036c9b5bc9ce49b0 [file] [log] [blame]
Bill Wendling353fbd32013-05-23 07:18:59 +00001/* ===-- 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 Northovera5a06ad2014-10-08 17:28:37 +000026# elif defined(__arm) || defined(__arm64)
Bill Wendling353fbd32013-05-23 07:18:59 +000027# define __OPEN_NAME "_open"
28# else
Alp Toker1ee7fc72014-05-15 02:22:34 +000029# error "unrecognized architecture for targeting OS X"
Bill Wendling353fbd32013-05-23 07:18:59 +000030# endif
31#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
32# if defined(__i386) || defined (__x86_64)
33# define __OPEN_NAME "_open"
Tim Northovera5a06ad2014-10-08 17:28:37 +000034# elif defined(__arm) || defined(__arm64)
Bill Wendling353fbd32013-05-23 07:18:59 +000035# define __OPEN_NAME "_open"
36# else
Alp Toker1ee7fc72014-05-15 02:22:34 +000037# error "unrecognized architecture for targeting iOS"
Bill Wendling353fbd32013-05-23 07:18:59 +000038# endif
39#else
Alp Toker1ee7fc72014-05-15 02:22:34 +000040# error "unrecognized architecture for targeting Darwin"
Bill Wendling353fbd32013-05-23 07:18:59 +000041#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 Toker1ee7fc72014-05-15 02:22:34 +000048#define O_CREAT 0x0200 /* create if nonexistent */
Bill Wendling353fbd32013-05-23 07:18:59 +000049
50int open(const char *, int, ...) __asm(__OPEN_NAME);
51
52#endif /* !_SYS_FCNTL_H_ */