summaryrefslogtreecommitdiffstats
path: root/usr/klibc/pwrite.c
blob: 19b219f163fc8779bebe37e6803a229d8b53ec81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * pwrite.c
 *
 * Some architectures need to wrap the system call
 */

#include <sys/types.h>
#include <endian.h>
#include <sys/syscall.h>

#if defined(__hppa__)

#if _BITSIZE == 32
extern ssize_t __pwrite(int, const void *, size_t, unsigned int, unsigned int);
#else
extern ssize_t __pwrite(int, const void *, size_t, off_t);
#endif

size_t pwrite(int fd, void *buf, size_t count, off_t offset)
{
#if _BITSIZE == 32
	unsigned int hi = offset >> 32;
	unsigned int lo = (unsigned int) offset;
	return __pwrite(fd, buf, count, __LONG_LONG_PAIR(hi, lo));
#else
	return __pwrite(fd, buf, count, offset);
#endif
}

#endif