git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15305 27425a3e-05d8-49a3-a47f-9c15f0e5edd8

This commit is contained in:
Giovanni Di Sirio 2022-01-02 07:37:55 +00:00
parent d844cf3b25
commit e8b69f703d
2 changed files with 24 additions and 0 deletions

View File

@ -42,6 +42,16 @@
#define _DIRENT_HAVE_D_TYPE
/** @} */
/**
* @name File types
* @{
*/
#define DT_REG IFTODT(S_IFREG)
#define DT_DIR IFTODT(S_IFDIR)
#define DT_CHR IFTODT(S_IFCHR)
#define DT_FIFO IFTODT(S_IFIFO)
/** @} */
/*===========================================================================*/
/* Module pre-compile time settings. */
/*===========================================================================*/

View File

@ -34,6 +34,7 @@
#include <sys/stat.h>
#include "errcodes.h"
#include "dirent.h"
#include "sbsysc.h"
/*===========================================================================*/
@ -287,6 +288,19 @@ static inline off_t sbSeek(int fd, off_t offset, int whence) {
return (off_t)r0;
}
/**
* @brief Posix-style directory read.
* @param[in] fd file descriptor
* @param[in] buf buffer pointer
* @param[in] count number of bytes
* @return The number of bytes really transferred or an error.
*/
static inline ssize_t sbPosixGetdents(int fd, void *buf, size_t count) {
__syscall4r(0, SB_POSIX_GETDENTS, fd, buf, count);
return (ssize_t)r0;
}
/**
* @brief Terminates the sandbox.
*