[PATCH 33/46] ustat: Return ENOSYS if ustat syscall is not defined

Markos Chandras markos.chandras at gmail.com
Tue Nov 13 11:31:42 UTC 2012


From: Markos Chandras <markos.chandras at imgtec.com>

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>
---
 libc/sysdeps/linux/common/ustat.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/libc/sysdeps/linux/common/ustat.c b/libc/sysdeps/linux/common/ustat.c
index e97fa76..b89b4c9 100644
--- a/libc/sysdeps/linux/common/ustat.c
+++ b/libc/sysdeps/linux/common/ustat.c
@@ -9,8 +9,22 @@
 
 #include <sys/syscall.h>
 #include <sys/ustat.h>
+#include <sys/vfs.h>
 #include <sys/sysmacros.h>
+#include <string.h>
 
+#if ! defined(__NR_ustat)
+/*
+ * ustat syscall is deprecated and statfs or fstatfs should
+ * be used instead. There is no way to provide a wrapper for the
+ * newer syscalls, so just mark this syscall as unimplemented
+ */
+int ustat(dev_t dev, struct ustat* ubuf)
+{
+	__set_errno (ENOSYS);
+	return -1;
+}
+#else
 #define __NR___syscall_ustat __NR_ustat
 /* Kernel's fs/super.c defines this:
  * long sys_ustat(unsigned dev, struct ustat __user * ubuf),
@@ -24,3 +38,4 @@ int ustat(dev_t dev, struct ustat *ubuf)
 {
 	return __syscall_ustat(dev, ubuf);
 }
+#endif
-- 
1.7.1




More information about the uClibc mailing list