• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef COMPAT_FCNTL_H
17 #define COMPAT_FCNTL_H
18 
19 #include <fcntl.h>
20 
21 #include <errno.h>
22 #include <sys/cdefs.h>
23 
24 /*
25  * zircon does not support this operation.
26  *
27  * This is super hacky: supply a function that takes a long * and explicitly
28  * cast to loff_t, which on Fuchsia is long long. This is safe on Fuchsia but
29  * obviously not portable, yet it allows us to leave libcore code alone.
30  */
splice(int fd_in,long * off_in,int fd_out,long * off_out,size_t len,unsigned int flags)31 ssize_t splice(int fd_in, long *off_in, int fd_out,
32                long *off_out, size_t len, unsigned int flags) {
33   return splice(fd_in, (loff_t *)off_in, fd_out, (loff_t *)off_out, len, flags);
34 }
35 
splice(int fd_in __UNUSED,loff_t * off_in __UNUSED,int fd_out __UNUSED,loff_t * off_out __UNUSED,size_t len __UNUSED,unsigned int flags __UNUSED)36 ssize_t splice(int fd_in __UNUSED, loff_t *off_in __UNUSED, int fd_out __UNUSED,
37                loff_t *off_out __UNUSED, size_t len __UNUSED, unsigned int flags __UNUSED) {
38   errno = EINVAL;
39   return -1;
40 }
41 
42 #endif  // COMPAT_FCNTL_H
43