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>
|
|
|
|
|
2012-11-15 12:06:41 +01:00
|
|
|
int _stat(const char *name, struct stat *buffer);
|
|
|
|
int _lstat(const char *name, struct stat *buffer);
|
|
|
|
int _fstat(int fd, struct stat *buffer);
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
m.m1_i1 = strlen(name) + 1;
|
2011-11-28 11:07:55 +01:00
|
|
|
m.m1_p1 = (char *) __UNCONST(name);
|
2011-02-17 18:11:09 +01:00
|
|
|
m.m1_p2 = (char *) buffer;
|
2011-07-01 21:35:54 +02:00
|
|
|
|
2013-02-28 15:44:23 +01:00
|
|
|
return _syscall(VFS_PROC_NR, STAT, &m);
|
2011-02-17 18:11:09 +01:00
|
|
|
}
|
|
|
|
|
2011-12-06 00:58:22 +01:00
|
|
|
int _fstat(int fd, struct stat *buffer) { return fstat(fd, buffer); }
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
m.m1_i1 = fd;
|
|
|
|
m.m1_p1 = (char *) buffer;
|
|
|
|
|
2013-02-28 15:44:23 +01:00
|
|
|
return _syscall(VFS_PROC_NR, FSTAT, &m);
|
2011-02-17 18:11:09 +01:00
|
|
|
}
|
|
|
|
|
2011-12-06 00:58:22 +01:00
|
|
|
int _lstat(const char *name, struct stat *buffer) { return lstat(name, buffer); }
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
m.m1_i1 = strlen(name) + 1;
|
2011-11-28 11:07:55 +01:00
|
|
|
m.m1_p1 = (char *) __UNCONST(name);
|
2011-02-17 18:11:09 +01:00
|
|
|
m.m1_p2 = (char *) buffer;
|
|
|
|
|
2013-02-28 15:44:23 +01:00
|
|
|
return _syscall(VFS_PROC_NR, LSTAT, &m);
|
2011-02-17 18:11:09 +01:00
|
|
|
}
|