mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
vfs: Add ioctl() to filesystem set
This commit is contained in:
parent
3a271a4ae7
commit
a320fed3b5
@ -145,6 +145,10 @@ typedef struct
|
||||
int (*fcntl_p)(void* ctx, int fd, int cmd, va_list args);
|
||||
int (*fcntl)(int fd, int cmd, va_list args);
|
||||
};
|
||||
union {
|
||||
int (*ioctl_p)(void* ctx, int fd, int cmd, va_list args);
|
||||
int (*ioctl)(int fd, int cmd, va_list args);
|
||||
};
|
||||
} esp_vfs_t;
|
||||
|
||||
|
||||
|
@ -489,3 +489,20 @@ int fcntl(int fd, int cmd, ...)
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ioctl(int fd, int cmd, ...)
|
||||
{
|
||||
const vfs_entry_t* vfs = get_vfs_for_fd(fd);
|
||||
struct _reent* r = __getreent();
|
||||
if (vfs == NULL) {
|
||||
__errno_r(r) = EBADF;
|
||||
return -1;
|
||||
}
|
||||
int local_fd = translate_fd(vfs, fd);
|
||||
int ret;
|
||||
va_list args;
|
||||
va_start(args, cmd);
|
||||
CHECK_AND_CALL(ret, r, vfs, ioctl, local_fd, cmd, args);
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user