2020-03-28 19:52:59 +01:00
|
|
|
#include <kernel/fs/vfs.h>
|
|
|
|
#include <kernel/process.h>
|
2020-03-30 00:40:59 +02:00
|
|
|
#include <fcntl.h>
|
2020-03-28 19:52:59 +01:00
|
|
|
|
|
|
|
ssize_t sys_pwrite(int fd, const void *buf, size_t count, off_t offset)
|
|
|
|
{
|
|
|
|
extern struct process *process_current;
|
|
|
|
|
|
|
|
// Check fd
|
2020-05-01 11:23:56 +02:00
|
|
|
if (fd < 0 || fd >= PROCESS_NB_OPEN_FILE)
|
2020-03-28 19:52:59 +01:00
|
|
|
return (-1);
|
|
|
|
|
|
|
|
// call VFS read primitive
|
|
|
|
return (vfs_pwrite(&process_current->opfile[fd].file, buf, count, offset));
|
|
|
|
}
|