minix/lib/libc/sys-minix/lseek.c
Lionel Sambuc 268d670a85 Message type for VFS_LSEEK
Change-Id: I592284078572e4abf2b181d3b4e8281c9baf8a7b
2014-07-28 17:05:32 +02:00

24 lines
480 B
C

#include <sys/cdefs.h>
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <minix/u64.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(lseek, _lseek)
#endif
off_t
lseek(int fd, off_t offset, int whence)
{
message m;
memset(&m, 0, sizeof(m));
m.m_lc_vfs_lseek.fd = fd;
m.m_lc_vfs_lseek.offset = offset;
m.m_lc_vfs_lseek.whence = whence;
if (_syscall(VFS_PROC_NR, VFS_LSEEK, &m) < 0) return( (off_t) -1);
return(m.m_vfs_lc_lseek.offset);
}