2020-01-06 20:25:06 +01:00
|
|
|
#include <kernel/fs/vfs.h>
|
|
|
|
#include <kernel/process.h>
|
|
|
|
|
|
|
|
off_t sys_lseek(int fd, off_t offset, int whence)
|
|
|
|
{
|
2020-01-12 15:58:35 +01:00
|
|
|
extern struct process *process_current;
|
2020-01-06 20:25:06 +01:00
|
|
|
|
|
|
|
// Check fd
|
2020-05-01 11:23:56 +02:00
|
|
|
if (fd < 0 || fd >= PROCESS_NB_OPEN_FILE)
|
2020-01-06 20:25:06 +01:00
|
|
|
return (-1);
|
|
|
|
|
2020-03-20 22:47:05 +01:00
|
|
|
// Call VFS lseek primitive
|
2020-05-01 11:23:56 +02:00
|
|
|
return (vfs_lseek(&process_current->opfile[fd].file, offset, whence));
|
2020-01-06 20:25:06 +01:00
|
|
|
}
|