* Threw away the broken stat() vs. _stat() mechanism to allow for more fields

in struct stat.
* Instead, I followed Marcus' great idea and added a compatibility check in
  the runtime loader: now, R5 binaries (also shared libraries) are detected,
  and they get special versions for stat(), fstat(), and lstat() that return
  the smaller stat struct.
* However, I've disabled (in src/system/libroot/posix/sys/stat.c) using the
  larger stat field for now, as this breaks some of our optional packages.
  So until we rebuild them all, this shouldn't be enabled.
* This should now also be used for BeOS compatibility in libnetwork.so.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27961 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-10 22:13:05 +00:00
parent 1b3b00c2a1
commit 2716cfd3d7
4 changed files with 90 additions and 57 deletions
+3 -20
View File
@@ -23,11 +23,6 @@ struct stat {
time_t st_mtime; /* last modification time */
time_t st_ctime; /* last change time, not creation time */
time_t st_crtime; /* creation time */
/* Haiku extensions:
* TODO: we might also define special types for files and TTYs
* TODO: we should find another solution for this, as BStatable::GetStat()
* can only retrieve the R5 stat structure */
unsigned int st_type; /* attribute/index type */
blkcnt_t st_blocks; /* number of blocks allocated for object */
};
@@ -104,24 +99,12 @@ extern "C" {
extern int chmod(const char *path, mode_t mode);
extern int fchmod(int fd, mode_t mode);
extern int _stat(const char *path, struct stat *st, size_t statSize);
extern int _fstat(int fd, struct stat *st, size_t statSize);
extern int _lstat(const char *path, struct stat *st, size_t statSize);
extern int mkdir(const char *path, mode_t mode);
extern int mkfifo(const char *path, mode_t mode);
extern mode_t umask(mode_t cmask);
/* This achieves backwards compatibility with R5 */
#if 0 /* def HAIKU_TARGET_PLATFORM_HAIKU */
#define stat(fd, st) _stat(fd, st, sizeof(struct stat))
#define fstat(fd, st) _fstat(fd, st, sizeof(struct stat))
#define lstat(fd, st) _lstat(fd, st, sizeof(struct stat))
#else
/* ... and this fixes the build for R5 for now */
extern int stat(const char *path, struct stat *st);
extern int fstat(int fd, struct stat *st);
extern int lstat(const char *path, struct stat *st);
#endif
extern int mkdir(const char *path, mode_t mode);
extern int mkfifo(const char *path, mode_t mode);
extern mode_t umask(mode_t cmask);
#ifdef __cplusplus
}