Home | History | Annotate | Download | only in include
      1 /*
      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  */
     28 
     29 #ifndef _FCNTL_H
     30 #define _FCNTL_H
     31 
     32 #include <sys/cdefs.h>
     33 #include <sys/types.h>
     34 #include <linux/fadvise.h>
     35 #include <linux/falloc.h>
     36 #include <linux/fcntl.h>
     37 #include <linux/stat.h>
     38 #include <linux/uio.h>
     39 
     40 #include <bits/fcntl.h>
     41 #include <bits/seek_constants.h>
     42 
     43 #if defined(__USE_GNU) || defined(__USE_BSD)
     44 #include <bits/lockf.h>
     45 #endif
     46 
     47 __BEGIN_DECLS
     48 
     49 #ifdef __LP64__
     50 /* LP64 kernels don't have F_*64 defines because their flock is 64-bit. */
     51 #define F_GETLK64  F_GETLK
     52 #define F_SETLK64  F_SETLK
     53 #define F_SETLKW64 F_SETLKW
     54 #endif
     55 
     56 #define O_ASYNC FASYNC
     57 #define O_RSYNC O_SYNC
     58 
     59 #if __ANDROID_API__ >= __ANDROID_API_L__
     60 #define SPLICE_F_MOVE 1
     61 #define SPLICE_F_NONBLOCK 2
     62 #define SPLICE_F_MORE 4
     63 #define SPLICE_F_GIFT 8
     64 #endif
     65 
     66 #if __ANDROID_API__ >= __ANDROID_API_O__
     67 #define SYNC_FILE_RANGE_WAIT_BEFORE 1
     68 #define SYNC_FILE_RANGE_WRITE 2
     69 #define SYNC_FILE_RANGE_WAIT_AFTER 4
     70 #endif
     71 
     72 int creat(const char* __path, mode_t __mode);
     73 int creat64(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
     74 int openat(int __dir_fd, const char* __path, int __flags, ...);
     75 int openat64(int __dir_fd, const char* __path, int __flags, ...) __INTRODUCED_IN(21);
     76 int open(const char* __path, int __flags, ...);
     77 int open64(const char* __path, int __flags, ...) __INTRODUCED_IN(21);
     78 ssize_t splice(int __in_fd, off64_t* __in_offset, int __out_fd, off64_t* __out_offset, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
     79 ssize_t tee(int __in_fd, int __out_fd, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
     80 ssize_t vmsplice(int __fd, const struct iovec* __iov, size_t __count, unsigned int __flags) __INTRODUCED_IN(21);
     81 
     82 int fallocate(int __fd, int __mode, off_t __offset, off_t __length) __RENAME_IF_FILE_OFFSET64(fallocate64) __INTRODUCED_IN(21);
     83 int fallocate64(int __fd, int __mode, off64_t __offset, off64_t __length) __INTRODUCED_IN(21);
     84 int posix_fadvise(int __fd, off_t __offset, off_t __length, int __advice) __RENAME_IF_FILE_OFFSET64(posix_fadvise64) __INTRODUCED_IN(21);
     85 int posix_fadvise64(int __fd, off64_t __offset, off64_t __length, int __advice) __INTRODUCED_IN(21);
     86 int posix_fallocate(int __fd, off_t __offset, off_t __length) __RENAME_IF_FILE_OFFSET64(posix_fallocate64) __INTRODUCED_IN(21);
     87 int posix_fallocate64(int __fd, off64_t __offset, off64_t __length) __INTRODUCED_IN(21);
     88 
     89 #if defined(__USE_GNU)
     90 ssize_t readahead(int __fd, off64_t __offset, size_t __length) __INTRODUCED_IN(16);
     91 int sync_file_range(int __fd, off64_t __offset, off64_t __length, unsigned int __flags) __INTRODUCED_IN(26);
     92 #endif
     93 
     94 #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
     95 #include <bits/fortify/fcntl.h>
     96 #endif
     97 
     98 __END_DECLS
     99 
    100 #endif
    101