lib: os: fdtable: add support for fsync

Add support for fsync in existing posix ioctl call

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
This commit is contained in:
Karthikeyan Krishnasamy 2024-04-13 13:12:12 +05:30 committed by Chris Friedt
commit 65ad32b3ca
3 changed files with 6 additions and 0 deletions

View file

@ -237,6 +237,7 @@ int close(int file);
ssize_t write(int file, const void *buffer, size_t count);
ssize_t read(int file, void *buffer, size_t count);
off_t lseek(int file, off_t offset, int whence);
int fsync(int fd);
/* File System related operations */
int rename(const char *old, const char *newp);

View file

@ -362,6 +362,7 @@ int fsync(int fd)
return z_fdtable_call_ioctl(fdtable[fd].vtable, fdtable[fd].obj, ZFD_IOCTL_FSYNC);
}
FUNC_ALIAS(fsync, _fsync, int);
off_t lseek(int fd, off_t offset, int whence)
{

View file

@ -144,6 +144,10 @@ static int fs_ioctl_vmeth(void *obj, unsigned int request, va_list args)
struct posix_fs_desc *ptr = obj;
switch (request) {
case ZFD_IOCTL_FSYNC: {
rc = fs_sync(&ptr->file);
break;
}
case ZFD_IOCTL_LSEEK: {
off_t offset;
int whence;