minix/lib/libc/sys-minix/getdents.c
Lionel Sambuc 7031438f58 Message type and related cleanup
- Intorduce and use a message type for VFS_GETDENTS, VFS_READ,
   VFS_WRITE.

 - Some cleanup to related functions where vir_bytes are replaced (and
   casted to/from, in parameter definition and local variables as well.

   This allow to see more clearly which function receives unsafe
   (pointer) values, or at least values which are not supposed to be
   valid in the address space of VFS. The current patch does so only
   for the minimal amount of functions which are concerned with the
   introduction of the new message type.

Change-Id: I0cdca97409c4016d02fae067b48bf55d37572c5c
2014-07-28 17:05:34 +02:00

22 lines
463 B
C

#include <sys/cdefs.h>
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <dirent.h>
ssize_t getdents(int fd, char *buffer, size_t nbytes)
{
message m;
memset(&m, 0, sizeof(m));
m.m_lc_vfs_readwrite.fd = fd;
m.m_lc_vfs_readwrite.len = nbytes;
m.m_lc_vfs_readwrite.buf = (vir_bytes)buffer;
return _syscall(VFS_PROC_NR, VFS_GETDENTS, &m);
}
#if defined(__minix) && defined(__weak_alias)
__weak_alias(getdents, __getdents30)
#endif