summaryrefslogtreecommitdiff
path: root/tools/versioner/tests/fortify_inline/headers/fcntl.h
blob: dc81ef8c9880dd5b71e2df30f9155ca9d15dc3fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#if defined(__cplusplus)
extern "C" {
#endif

extern int open_real(const char* name, int flags, ...) __asm__("open");

#define O_CREAT 00000100

typedef unsigned int mode_t;

static inline __attribute__((always_inline))
int open(const char* name, int flags)
    __attribute__((annotate("versioner_fortify_inline")))
    __attribute__((overloadable))
    __attribute__((enable_if(!(flags & O_CREAT), ""))) {
  return open_real(name, flags);
}

static inline __attribute__((always_inline))
int open(const char* name, int flags, mode_t mode)
    __attribute__((annotate("versioner_fortify_inline")))
    __attribute__((overloadable))
    __attribute__((enable_if(flags & O_CREAT, ""))) {
  return open_real(name, flags, mode);
}

#if defined(__cplusplus)
}
#endif