2
* Copyright (C) 2010 The Android Open Source Project
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
#ifndef __LIB_UTILS_COMPAT_H
18
#define __LIB_UTILS_COMPAT_H
22
/* Compatibility definitions for non-Linux (i.e., BSD-based) hosts. */
24
#if _FILE_OFFSET_BITS < 64
25
#error "_FILE_OFFSET_BITS < 64; large files are not supported on this platform"
26
#endif /* _FILE_OFFSET_BITS < 64 */
28
typedef off_t off64_t;
30
static inline off64_t lseek64(int fd, off64_t offset, int whence) {
31
return lseek(fd, offset, whence);
35
static inline ssize_t pread64(int fd, void* buf, size_t nbytes, off64_t offset) {
36
return pread(fd, buf, nbytes, offset);
40
#endif /* !HAVE_OFF64_T */
42
#endif /* __LIB_UTILS_COMPAT_H */