New stat structure.

* VFS and installed MFSes must be in sync before and after this change *

Use struct stat from NetBSD. It requires adding new STAT, FSTAT and LSTAT
syscalls. Libc modification is both backward and forward compatible.

Also new struct stat uses modern field sizes to avoid ABI
incompatibility, when we update uid_t, gid_t and company.
Exceptions are ino_t and off_t in old libc (though paddings added).
This commit is contained in:
Evgeniy Ivanov
2011-07-12 16:39:55 +02:00
committed by Ben Gras
parent 48331843ea
commit ef0a265086
34 changed files with 533 additions and 417 deletions
+22 -1
View File
@@ -1,14 +1,35 @@
#include <lib.h>
#define fstat _fstat
#include <sys/stat.h>
#include <string.h>
PUBLIC int fstat(fd, buffer)
int fd;
struct stat *buffer;
{
message m;
int r;
struct minix_prev_stat old_sb;
m.m1_i1 = fd;
m.m1_p1 = (char *) buffer;
return(_syscall(VFS_PROC_NR, FSTAT, &m));
if((r = _syscall(VFS_PROC_NR, FSTAT, &m)) >= 0 || errno != ENOSYS)
return r;
errno = 0;
/* ENOSYS: new binary and old VFS, fallback to PREV_STAT.
* User has struct stat (buffer), VFS still fills minix_prev_stat.
*/
m.m1_i1 = fd;
m.m1_p1 = (char *) &old_sb;
if((r = _syscall(VFS_PROC_NR, PREV_FSTAT, &m)) < 0)
return r;
memset(buffer, 0, sizeof(struct stat));
COPY_PREV_STAT_TO_NEW(buffer, &old_sb);
return r;
}