2011-02-17 18:11:09 +01:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include "namespace.h"
|
|
|
|
#include <lib.h>
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2013-01-29 19:59:30 +01:00
|
|
|
#ifdef __weak_alias
|
2011-12-06 00:58:22 +01:00
|
|
|
__weak_alias(_stat, __stat50);
|
|
|
|
__weak_alias(_lstat, __lstat50);
|
|
|
|
__weak_alias(_fstat, __fstat50);
|
|
|
|
|
2013-01-29 19:59:30 +01:00
|
|
|
__weak_alias(stat, __stat50);
|
|
|
|
__weak_alias(lstat, __lstat50);
|
|
|
|
__weak_alias(fstat, __fstat50);
|
|
|
|
#endif
|
|
|
|
|
2011-11-29 12:39:22 +01:00
|
|
|
int stat(const char *name, struct stat *buffer)
|
2011-02-17 18:11:09 +01:00
|
|
|
{
|
|
|
|
message m;
|
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
memset(&m, 0, sizeof(m));
|
|
|
|
m.VFS_STAT_LEN = strlen(name) + 1;
|
|
|
|
m.VFS_STAT_NAME = (char *) __UNCONST(name);
|
|
|
|
m.VFS_STAT_BUF = (char *) buffer;
|
2011-07-01 21:35:54 +02:00
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
return _syscall(VFS_PROC_NR, VFS_STAT, &m);
|
2011-02-17 18:11:09 +01:00
|
|
|
}
|
|
|
|
|
2011-11-29 12:39:22 +01:00
|
|
|
int fstat(int fd, struct stat *buffer)
|
2011-02-17 18:11:09 +01:00
|
|
|
{
|
2011-07-01 21:35:54 +02:00
|
|
|
message m;
|
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
memset(&m, 0, sizeof(m));
|
|
|
|
m.VFS_FSTAT_FD = fd;
|
|
|
|
m.VFS_FSTAT_BUF = (char *) buffer;
|
2011-07-01 21:35:54 +02:00
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
return _syscall(VFS_PROC_NR, VFS_FSTAT, &m);
|
2011-02-17 18:11:09 +01:00
|
|
|
}
|
|
|
|
|
2011-11-29 12:39:22 +01:00
|
|
|
int lstat(const char *name, struct stat *buffer)
|
2011-02-17 18:11:09 +01:00
|
|
|
{
|
|
|
|
message m;
|
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
memset(&m, 0, sizeof(m));
|
|
|
|
m.VFS_STAT_LEN = strlen(name) + 1;
|
|
|
|
m.VFS_STAT_NAME = (char *) __UNCONST(name);
|
|
|
|
m.VFS_STAT_BUF = (char *) buffer;
|
2011-02-17 18:11:09 +01:00
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
return _syscall(VFS_PROC_NR, VFS_LSTAT, &m);
|
2011-02-17 18:11:09 +01:00
|
|
|
}
|