summaryrefslogtreecommitdiff
path: root/src/unistd/ftruncate.c
blob: e0b2f4bb4c198c15ac2e52401c985d0c9152152b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <unistd.h>
#include "syscall.h"
#include "libc.h"

int ftruncate(int fd, off_t length)
{
	if (sizeof(long) == 8)
		return syscall2(__NR_ftruncate, fd, length);
	else {
		union { long long ll; long l[2]; } u = { length };
		return syscall3(__NR_ftruncate64, fd, u.l[0], u.l[1]);
	}
}

LFS64(ftruncate);