From a9d09fc2554ea2f1149611e7048b616dc10ad9ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 23 Jan 2007 21:01:18 +0000 Subject: [PATCH] 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 --- .../libroot/os/arch/x86/compatibility.c | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/system/libroot/os/arch/x86/compatibility.c b/src/system/libroot/os/arch/x86/compatibility.c index 0546faec49..6192917243 100644 --- a/src/system/libroot/os/arch/x86/compatibility.c +++ b/src/system/libroot/os/arch/x86/compatibility.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -12,10 +12,13 @@ // ToDo: maybe they should indeed do something... #include +#include -#include #include + #include +#include +#include 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