0.9.18.46:
[sbcl.git] / src / runtime / largefile.c
1 /*
2  * Wrapper functions for SUSv2 large file support. Linux defaults to a
3  * 32-bit off_t and hides the largefile-capable versions of the
4  * syscalls behind preprocessor magic, rather than making them
5  * reliably available using dlsym.
6  */
7
8 /*
9  * This software is part of the SBCL system. See the README file for
10  * more information.
11  *
12  * This software is derived from the CMU CL system, which was
13  * written at Carnegie Mellon University and released into the
14  * public domain. The software is in the public domain and is
15  * provided with absolutely no warranty. See the COPYING and CREDITS
16  * files for more information.
17  */
18
19 #include <genesis/config.h>
20
21 #ifdef LISP_FEATURE_LARGEFILE
22
23 #include <sys/mman.h>
24 #include <sys/types.h>
25 #include <unistd.h>
26 #include <sys/stat.h>
27
28 off_t
29 lseek_largefile(int fildes, off_t offset, int whence) {
30     return lseek(fildes, offset, whence);
31 }
32
33 int
34 truncate_largefile(const char *path, off_t length) {
35     return truncate(path, length);
36 }
37
38 int
39 ftruncate_largefile(int fd, off_t length) {
40     return ftruncate(fd, length);
41 }
42
43 void*
44 mmap_largefile(void *start, size_t length, int prot, int flags, int fd, off_t offset) {
45     mmap(start, length, prot, flags, fd, offset);
46 }
47
48 int
49 stat_largefile(const char *file_name, struct stat *buf) {
50     return stat(file_name, buf);
51 }
52
53 int
54 fstat_largefile(int filedes, struct stat *buf) {
55     return fstat(filedes, buf);
56 }
57
58 int
59 lstat_largefile(const char *file_name, struct stat *buf) {
60     return lstat(file_name, buf);
61 }
62
63 #endif