1 /*
2  * truncate() for uClibc
3  *
4  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
5  *
6  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7  */
8 
9 #include <sys/syscall.h>
10 #include <unistd.h>
11 
12 #if defined(__NR_truncate64) && !defined(__NR_truncate)
13 # include <endian.h>
14 # include <stdint.h>
15 
truncate(const char * path,__off_t length)16 int truncate(const char *path, __off_t length)
17 {
18 # if __WORDSIZE == 32
19 #  if defined(__UCLIBC_SYSCALL_ALIGN_64BIT__)
20 	return INLINE_SYSCALL(truncate64, 4, path, 0, OFF_HI_LO(length));
21 #  else
22 	return INLINE_SYSCALL(truncate64, 3, path, OFF_HI_LO(length));
23 #  endif
24 # else
25 	return truncate64(path, length);
26 # endif
27 }
28 libc_hidden_def(truncate);
29 
30 #else
31 _syscall2(int, truncate, const char *, path, __off_t, length)
32 libc_hidden_def(truncate)
33 #endif
34