8 __weak_alias(pwrite
, _pwrite
)
11 #include <minix/u64.h>
13 ssize_t
pwrite64(int fd
, const void *buffer
, size_t nbytes
, u64_t where
)
18 if (lseek64(fd
, make64(0,0), SEEK_CUR
, &here
) < 0) return(-1);
19 if (lseek64(fd
, where
, SEEK_SET
, NULL
) < 0) return(-1);
20 if ((w
= write(fd
, buffer
, nbytes
)) < 0) {
22 lseek64(fd
, here
, SEEK_SET
, NULL
);
27 if (lseek64(fd
, here
, SEEK_SET
, NULL
) < 0) return(-1);
32 ssize_t
pwrite(int fd
, const void *buffer
, size_t nbytes
, off_t where
)
37 if((here
= lseek(fd
, 0, SEEK_CUR
)) < 0)
40 if(lseek(fd
, where
, SEEK_SET
) < 0)
43 if((w
=write(fd
, buffer
, nbytes
)) < 0) {
45 lseek(fd
, here
, SEEK_SET
);
50 if(lseek(fd
, here
, SEEK_SET
) < 0)