diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-09-19 19:43:57 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-09-19 19:43:57 +0000 |
commit | 71c10cea5a832d2412a551c849bd5655e65e1c22 (patch) | |
tree | 3cca62ed38f7c85d5d34c73db75228b6738dc49d /libc/sysdeps/linux/i386 | |
parent | dfd1f080f49437b390809bbfaac3cd7127f97a3d (diff) |
- add posix_fadvise. Not yet tested most likely broken in advise64
Diffstat (limited to 'libc/sysdeps/linux/i386')
-rw-r--r-- | libc/sysdeps/linux/i386/Makefile.arch | 5 | ||||
-rw-r--r-- | libc/sysdeps/linux/i386/posix_fadvise.c | 34 |
2 files changed, 39 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/i386/Makefile.arch b/libc/sysdeps/linux/i386/Makefile.arch index ea2fce0d3..bff33a8f2 100644 --- a/libc/sysdeps/linux/i386/Makefile.arch +++ b/libc/sysdeps/linux/i386/Makefile.arch @@ -11,4 +11,9 @@ SSRC := \ __longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \ sync_file_range.S syscall.S mmap.S mmap64.S +ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y) +SSRC += posix_fadvise64.S +CSRC += posix_fadvise.c +endif + include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/i386/posix_fadvise.c b/libc/sysdeps/linux/i386/posix_fadvise.c new file mode 100644 index 000000000..5406213b8 --- /dev/null +++ b/libc/sysdeps/linux/i386/posix_fadvise.c @@ -0,0 +1,34 @@ +/* vi: set sw=4 ts=4: */ +/* + * posix_fadvise() for uClibc + * + * Copyright (C) 2008 Bernhard Reutner-Fischer <uclibc@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <sys/syscall.h> +#if defined __USE_GNU +#include <fcntl.h> + + +#if defined __NR_fadvise64_64 || defined __NR_fadvise64 +libc_hidden_proto(posix_fadvise64) +libc_hidden_proto(posix_fadvise) +int posix_fadvise(int fd, off_t offset, off_t len, int advice) +{ + if (posix_fadvise64(fd, offset, len, advice) != 0) + return errno; + return 0; +} +libc_hidden_def(posix_fadvise) +#elif defined __UCLIBC_HAS_STUBS__ +libc_hidden_proto(posix_fadvise) +int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, + off_t len attribute_unused, int advice attribute_unused) +{ + return ENOSYS; +} +libc_hidden_def(posix_fadvise) +#endif +#endif |