about summary refs log tree commit diff
path: root/src/unistd/truncate.c
blob: f75e824e614c9c6142fd3d5243b0a890a3d2dc0a (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 truncate(const char *path, off_t length)
{
	if (sizeof(long) == 8)
		return syscall2(__NR_truncate, (long)path, length);
	else {
		union { long long ll; long l[2]; } u = { length };
		return syscall3(__NR_truncate64, (long)path, u.l[0], u.l[1]);
	}
}

LFS64(truncate);