Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2682 → Rev 2684

/trunk/uspace/lib/libc/include/unistd.h
41,8 → 41,14
#define NULL 0
#define getpagesize() (PAGE_SIZE)
 
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
 
extern ssize_t write(int fd, const void * buf, size_t count);
extern ssize_t read(int fd, void * buf, size_t count);
extern off_t lseek(int, off_t, int);
 
extern void _exit(int status);
extern void *sbrk(ssize_t incr);
extern int usleep(unsigned long usec);
/trunk/uspace/lib/libc/generic/vfs.c
1,5 → 1,5
/*
* Copyright (c) 2007 Jakub Jermar
* Copyright (c) 2008 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
184,5 → 184,35
futex_up(&vfs_phone_futex);
return (ssize_t) IPC_GET_ARG1(answer);
}
 
off_t lseek(int fildes, off_t offset, int whence)
{
int res;
ipcarg_t rc;
 
futex_down(&vfs_phone_futex);
async_serialize_start();
if (vfs_phone < 0) {
res = vfs_connect();
if (res < 0) {
async_serialize_end();
futex_up(&vfs_phone_futex);
return res;
}
}
off_t newoffs;
rc = async_req_3_1(vfs_phone, VFS_SEEK, fildes, offset, whence,
&newoffs);
 
async_serialize_end();
futex_up(&vfs_phone_futex);
 
if (rc != EOK)
return (off_t) -1;
return newoffs;
}
 
/** @}
*/