blob: cd52b453a4410d17750793d90f6e9779b678d7b3 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
Elliott Hughese9893992013-10-17 11:45:22 -070028
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029#ifndef _FCNTL_H
30#define _FCNTL_H
31
32#include <sys/cdefs.h>
33#include <sys/types.h>
Elliott Hughes01e505a2014-01-07 17:47:20 -080034#include <linux/fadvise.h>
Nick Desaulniers09d900d2016-07-19 15:20:24 -070035#include <linux/falloc.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080036#include <linux/fcntl.h>
Elliott Hughes64d83822014-12-29 11:14:38 -080037#include <linux/stat.h>
Elliott Hughes3f525d42014-06-24 16:32:01 -070038#include <linux/uio.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080039
Josh Gaoee8d1692016-04-07 14:16:30 -070040#include <bits/fcntl.h>
Elliott Hughesfd936ae2016-08-12 10:16:34 -070041#include <bits/seek_constants.h>
Josh Gaoee8d1692016-04-07 14:16:30 -070042
Elliott Hughes5704c422016-01-25 18:06:24 -080043#if defined(__USE_GNU) || defined(__USE_BSD)
44#include <bits/lockf.h>
45#endif
46
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080047__BEGIN_DECLS
48
Serban Constantinescu48501af2014-03-14 13:16:25 +000049#ifdef __LP64__
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070050/* LP64 kernels don't have F_*64 defines because their flock is 64-bit. */
Serban Constantinescu48501af2014-03-14 13:16:25 +000051#define F_GETLK64 F_GETLK
52#define F_SETLK64 F_SETLK
53#define F_SETLKW64 F_SETLKW
54#endif
55
Elliott Hughes3f525d42014-06-24 16:32:01 -070056#define O_ASYNC FASYNC
Elliott Hughes31165ed2014-09-23 17:34:29 -070057#define O_RSYNC O_SYNC
Elliott Hughes3f525d42014-06-24 16:32:01 -070058
Elliott Hughes9d250722017-07-05 15:59:58 -070059#if __ANDROID_API__ >= __ANDROID_API_L__
Elliott Hughes3f525d42014-06-24 16:32:01 -070060#define SPLICE_F_MOVE 1
61#define SPLICE_F_NONBLOCK 2
62#define SPLICE_F_MORE 4
63#define SPLICE_F_GIFT 8
Elliott Hughes9d250722017-07-05 15:59:58 -070064#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080065
Elliott Hughes9d250722017-07-05 15:59:58 -070066#if __ANDROID_API__ >= __ANDROID_API_O__
Elliott Hughes34347272014-02-26 11:10:32 -080067#define SYNC_FILE_RANGE_WAIT_BEFORE 1
68#define SYNC_FILE_RANGE_WRITE 2
69#define SYNC_FILE_RANGE_WAIT_AFTER 4
Elliott Hughes9d250722017-07-05 15:59:58 -070070#endif
Elliott Hughes34347272014-02-26 11:10:32 -080071
Colin Cross9af91202017-08-17 18:29:54 +000072int creat(const char*, mode_t);
73int creat64(const char*, mode_t) __INTRODUCED_IN(21);
74int openat(int, const char*, int, ...) __overloadable __RENAME_CLANG(openat);
75int openat64(int, const char*, int, ...) __INTRODUCED_IN(21);
76int open(const char*, int, ...) __overloadable __RENAME_CLANG(open);
77int open64(const char*, int, ...) __INTRODUCED_IN(21);
78ssize_t splice(int, off64_t*, int, off64_t*, size_t, unsigned int) __INTRODUCED_IN(21);
79ssize_t tee(int, int, size_t, unsigned int) __INTRODUCED_IN(21);
80ssize_t vmsplice(int, const struct iovec*, size_t, unsigned int) __INTRODUCED_IN(21);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080081
Colin Cross9af91202017-08-17 18:29:54 +000082int fallocate(int, int, off_t, off_t) __RENAME_IF_FILE_OFFSET64(fallocate64) __INTRODUCED_IN(21);
83int fallocate64(int, int, off64_t, off64_t) __INTRODUCED_IN(21);
84int posix_fadvise(int, off_t, off_t, int) __RENAME_IF_FILE_OFFSET64(posix_fadvise64) __INTRODUCED_IN(21);
85int posix_fadvise64(int, off64_t, off64_t, int) __INTRODUCED_IN(21);
86int posix_fallocate(int, off_t, off_t) __RENAME_IF_FILE_OFFSET64(posix_fallocate64) __INTRODUCED_IN(21);
87int posix_fallocate64(int, off64_t, off64_t) __INTRODUCED_IN(21);
Elliott Hughes68dc20d2015-02-06 22:28:49 -080088
Elliott Hughes55147ad2016-04-05 11:06:02 -070089#if defined(__USE_GNU)
Colin Cross9af91202017-08-17 18:29:54 +000090ssize_t readahead(int, off64_t, size_t) __INTRODUCED_IN(16);
91int sync_file_range(int, off64_t, off64_t, unsigned int) __INTRODUCED_IN(26);
Elliott Hughes55147ad2016-04-05 11:06:02 -070092#endif
93
George Burgess IVb97049c2017-07-24 15:05:05 -070094#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
95#include <bits/fortify/fcntl.h>
96#endif
Nick Kralevich8118f622012-06-26 15:08:06 -070097
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080098__END_DECLS
99
Colin Cross9af91202017-08-17 18:29:54 +0000100#endif /* _FCNTL_H */