Changed the "stat" related syscalls to have an additional parameter that specified

the size of the stat structure to allow extensions of that structure.
Renamed those syscalls to the new naming scheme.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7496 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-05-10 14:36:05 +00:00
parent 94e11a83bb
commit d93e356b51
7 changed files with 71 additions and 31 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ fs_stat_attr(int fd, const char *attribute, struct attr_info *attrInfo)
if (attr < 0)
RETURN_AND_SET_ERRNO(attr);
status = sys_read_stat(attr, &stat);
status = _kern_read_stat(attr, &stat, sizeof(struct stat));
if (status == B_OK) {
attrInfo->type = stat.st_type;
attrInfo->size = stat.st_size;
+4 -4
View File
@@ -56,10 +56,10 @@ SYSCALL6(sys_create_entry_ref, 84)
SYSCALL1(sys_unlink, 12)
SYSCALL2(sys_rename, 13)
SYSCALL2(sys_access, 73);
SYSCALL2(sys_read_stat, 74)
SYSCALL3(sys_write_stat, 100)
SYSCALL3(sys_read_path_stat, 14)
SYSCALL4(sys_write_path_stat, 15)
SYSCALL3(_kern_read_stat, 74)
SYSCALL4(_kern_write_stat, 100)
SYSCALL4(_kern_read_path_stat, 14)
SYSCALL5(_kern_write_path_stat, 15)
SYSCALL2(sys_getcwd, 41)
SYSCALL2(sys_setcwd, 42)
SYSCALL1(sys_dup, 61)
+3 -3
View File
@@ -1,5 +1,5 @@
/*
** Copyright 2002, Axel Dörfler, [email protected]. All rights reserved.
** Copyright 2002-2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
@@ -24,7 +24,7 @@ chmod(const char *path, mode_t mode)
status_t status;
stat.st_mode = mode;
status = sys_write_path_stat(path, true, &stat, FS_WRITE_STAT_MODE);
status = _kern_write_path_stat(path, true, &stat, sizeof(struct stat), FS_WRITE_STAT_MODE);
RETURN_AND_SET_ERRNO(status);
}
@@ -37,7 +37,7 @@ fchmod(int fd, mode_t mode)
status_t status;
stat.st_mode = mode;
status = sys_write_stat(fd, &stat, FS_WRITE_STAT_MODE);
status = _kern_write_stat(fd, &stat, sizeof(struct stat), FS_WRITE_STAT_MODE);
RETURN_AND_SET_ERRNO(status);
}
+50 -14
View File
@@ -1,5 +1,5 @@
/*
** Copyright 2002, Axel Dörfler, [email protected]. All rights reserved.
** Copyright 2002-2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
@@ -17,28 +17,64 @@
return err;
// R5 compatibility
#define R5_STAT_SIZE 60
#undef stat
#undef fstat
#undef lstat
extern int stat(const char *path, struct stat *stat);
extern int fstat(int fd, struct stat *stat);
extern int lstat(const char *path, struct stat *stat);
int
stat(const char *path, struct stat *stat)
{
int status = sys_read_path_stat(path, true, stat);
RETURN_AND_SET_ERRNO(status);
}
int
lstat(const char *path, struct stat *stat)
{
int status = sys_read_path_stat(path, false, stat);
RETURN_AND_SET_ERRNO(status);
return _stat(path, stat, R5_STAT_SIZE);
}
int
fstat(int fd, struct stat *stat)
{
int status = sys_read_stat(fd, stat);
return _fstat(fd, stat, R5_STAT_SIZE);
}
int
lstat(const char *path, struct stat *stat)
{
return _lstat(path, stat, R5_STAT_SIZE);
}
// #pragma mark -
int
_stat(const char *path, struct stat *stat, size_t statSize)
{
int status = _kern_read_path_stat(path, true, stat, statSize);
RETURN_AND_SET_ERRNO(status);
}
int
_lstat(const char *path, struct stat *stat, size_t statSize)
{
int status = _kern_read_path_stat(path, false, stat, statSize);
RETURN_AND_SET_ERRNO(status);
}
int
_fstat(int fd, struct stat *stat, size_t statSize)
{
int status = _kern_read_stat(fd, stat, statSize);
RETURN_AND_SET_ERRNO(status);
}
+7 -4
View File
@@ -1,5 +1,5 @@
/*
** Copyright 2002, Axel Dörfler, [email protected]. All rights reserved.
** Copyright 2002-2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
@@ -25,7 +25,8 @@ chown(const char *path, uid_t owner, gid_t group)
stat.st_uid = owner;
stat.st_gid = group;
status = sys_write_path_stat(path, true, &stat, FS_WRITE_STAT_UID | FS_WRITE_STAT_GID);
status = _kern_write_path_stat(path, true, &stat, sizeof(struct stat),
FS_WRITE_STAT_UID | FS_WRITE_STAT_GID);
RETURN_AND_SET_ERRNO(status);
}
@@ -39,7 +40,8 @@ lchown(const char *path, uid_t owner, gid_t group)
stat.st_uid = owner;
stat.st_gid = group;
status = sys_write_path_stat(path, false, &stat, FS_WRITE_STAT_UID | FS_WRITE_STAT_GID);
status = _kern_write_path_stat(path, false, &stat, sizeof(struct stat),
FS_WRITE_STAT_UID | FS_WRITE_STAT_GID);
RETURN_AND_SET_ERRNO(status);
}
@@ -53,7 +55,8 @@ fchown(int fd, uid_t owner, gid_t group)
stat.st_uid = owner;
stat.st_gid = group;
status = sys_write_stat(fd, &stat, FS_WRITE_STAT_UID | FS_WRITE_STAT_GID);
status = _kern_write_stat(fd, &stat, sizeof(struct stat),
FS_WRITE_STAT_UID | FS_WRITE_STAT_GID);
RETURN_AND_SET_ERRNO(status);
}
+3 -3
View File
@@ -1,5 +1,5 @@
/*
** Copyright 2002, Axel Dörfler, [email protected]. All rights reserved.
** Copyright 2002-2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
@@ -24,7 +24,7 @@ truncate(const char *path, off_t newSize)
status_t status;
stat.st_size = newSize;
status = sys_write_path_stat(path, true, &stat, FS_WRITE_STAT_SIZE);
status = _kern_write_path_stat(path, true, &stat, sizeof(struct stat), FS_WRITE_STAT_SIZE);
RETURN_AND_SET_ERRNO(status);
}
@@ -37,7 +37,7 @@ ftruncate(int fd, off_t newSize)
status_t status;
stat.st_size = newSize;
status = sys_write_stat(fd, &stat, FS_WRITE_STAT_SIZE);
status = _kern_write_stat(fd, &stat, sizeof(struct stat), FS_WRITE_STAT_SIZE);
RETURN_AND_SET_ERRNO(status);
}
+3 -2
View File
@@ -1,5 +1,5 @@
/*
** Copyright 2002, Axel Dörfler, [email protected]. All rights reserved.
** Copyright 2002-2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
@@ -30,7 +30,8 @@ utime(const char *path, const struct utimbuf *times)
} else
stat.st_atime = stat.st_mtime = time(NULL);
status = sys_write_path_stat(path, true, &stat, FS_WRITE_STAT_MTIME | FS_WRITE_STAT_ATIME);
status = _kern_write_path_stat(path, true, &stat, sizeof(struct stat),
FS_WRITE_STAT_MTIME | FS_WRITE_STAT_ATIME);
RETURN_AND_SET_ERRNO(status);
}