1*433d6423SLionel Sambuc #include <sys/cdefs.h>
2*433d6423SLionel Sambuc #include "namespace.h"
3*433d6423SLionel Sambuc #include <lib.h>
4*433d6423SLionel Sambuc
5*433d6423SLionel Sambuc #include <sys/stat.h>
6*433d6423SLionel Sambuc #include <string.h>
7*433d6423SLionel Sambuc
8*433d6423SLionel Sambuc #ifdef __weak_alias
9*433d6423SLionel Sambuc __weak_alias(_stat, __stat50);
10*433d6423SLionel Sambuc __weak_alias(_lstat, __lstat50);
11*433d6423SLionel Sambuc __weak_alias(_fstat, __fstat50);
12*433d6423SLionel Sambuc
13*433d6423SLionel Sambuc __weak_alias(stat, __stat50);
14*433d6423SLionel Sambuc __weak_alias(lstat, __lstat50);
15*433d6423SLionel Sambuc __weak_alias(fstat, __fstat50);
16*433d6423SLionel Sambuc #endif
17*433d6423SLionel Sambuc
stat(const char * name,struct stat * buffer)18*433d6423SLionel Sambuc int stat(const char *name, struct stat *buffer)
19*433d6423SLionel Sambuc {
20*433d6423SLionel Sambuc message m;
21*433d6423SLionel Sambuc
22*433d6423SLionel Sambuc memset(&m, 0, sizeof(m));
23*433d6423SLionel Sambuc m.m_lc_vfs_stat.len = strlen(name) + 1;
24*433d6423SLionel Sambuc m.m_lc_vfs_stat.name = (vir_bytes)name;
25*433d6423SLionel Sambuc m.m_lc_vfs_stat.buf = (vir_bytes)buffer;
26*433d6423SLionel Sambuc
27*433d6423SLionel Sambuc return _syscall(VFS_PROC_NR, VFS_STAT, &m);
28*433d6423SLionel Sambuc }
29*433d6423SLionel Sambuc
fstat(int fd,struct stat * buffer)30*433d6423SLionel Sambuc int fstat(int fd, struct stat *buffer)
31*433d6423SLionel Sambuc {
32*433d6423SLionel Sambuc message m;
33*433d6423SLionel Sambuc
34*433d6423SLionel Sambuc memset(&m, 0, sizeof(m));
35*433d6423SLionel Sambuc m.m_lc_vfs_fstat.fd = fd;
36*433d6423SLionel Sambuc m.m_lc_vfs_fstat.buf = (vir_bytes)buffer;
37*433d6423SLionel Sambuc
38*433d6423SLionel Sambuc return _syscall(VFS_PROC_NR, VFS_FSTAT, &m);
39*433d6423SLionel Sambuc }
40*433d6423SLionel Sambuc
lstat(const char * name,struct stat * buffer)41*433d6423SLionel Sambuc int lstat(const char *name, struct stat *buffer)
42*433d6423SLionel Sambuc {
43*433d6423SLionel Sambuc message m;
44*433d6423SLionel Sambuc
45*433d6423SLionel Sambuc memset(&m, 0, sizeof(m));
46*433d6423SLionel Sambuc m.m_lc_vfs_stat.len = strlen(name) + 1;
47*433d6423SLionel Sambuc m.m_lc_vfs_stat.name = (vir_bytes)name;
48*433d6423SLionel Sambuc m.m_lc_vfs_stat.buf = (vir_bytes)buffer;
49*433d6423SLionel Sambuc
50*433d6423SLionel Sambuc return _syscall(VFS_PROC_NR, VFS_LSTAT, &m);
51*433d6423SLionel Sambuc }
52