Added _kstatfs_() for binary compatibility with some BeOS apps (most notably, SoftwareValet).

We might want to remove it again once we have a replacement for it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19929 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-23 21:01:18 +00:00
parent 7b72625fe7
commit a9d09fc255
+27 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2005-2006, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2005-2007, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@@ -12,10 +12,13 @@
// ToDo: maybe they should indeed do something...
#include <SupportDefs.h>
#include <fs_info.h>
#include <sys/resource.h>
#include <syscalls.h>
#include <errno.h>
#include <sys/resource.h>
#include <sys/stat.h>
int _kset_mon_limit_(int num);
@@ -23,6 +26,7 @@ int _kset_fd_limit_(int num);
int _klock_node_(int fd);
int _kget_cpu_state_(int cpuNum);
int _kset_cpu_state_(int cpuNum, int state);
int _kstatfs_(dev_t device, void *whatever, int fd, const char *path, fs_info *info);
int
@@ -71,4 +75,25 @@ _kset_cpu_state_(int cpuNum, int state)
return _kern_set_cpu_enabled(cpuNum, state != 0);
}
int
_kstatfs_(dev_t device, void *whatever, int fd, const char *path, fs_info *info)
{
if (device < 0) {
if (fd >= 0) {
struct stat stat;
if (fstat(fd, &stat) < 0)
return -1;
device = stat.st_dev;
} else if (path != NULL)
device = dev_for_path(path);
}
if (device < 0)
return B_ERROR;
return fs_stat_dev(device, info);
}
#endif // __GNUC__ < 3