bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GSoC] Implementing libcap


From: Esa-Matti Mourujärvi
Subject: [GSoC] Implementing libcap
Date: Mon, 28 Mar 2011 22:44:29 +0300

Hello,

I'm interested in applying for Hurd in GSoC. I am a second year CS student in
University of Oulu, Finland. I have knowledge of C to some extend, but I have
never developed anything big with it on my own. On another note, I have used
non-windows operating systems only for a year, but I am eager to learn more.

What I am particularly interested in GSoC is the idea for implementing libcap
for Hurd. I have managed to compile it on qemu Hurd by doing dummy patch. The
main purpose of the mentioned patch (can be found from the bottom of this mail)
is to prove it is easy and possible to port libcap to Hurd. The solution I made
is not most likely the elegant one possible. I do realise, that another
solution could be to change every variable type to the ones defined in
stdint.h and send a patch to libcap's owner. I would love to hear more
experienced people's opinions on what would be the best way to do this.

Unfortunately I have not been able to actually test libcap by using capget/
capset functions, because gcc fails to link against them. What I have gathered,
they are not implemented in hurd (which is also one of the reasons why this
gsoc idea exists in the first place.) capget/capset manpage mentions "These
system calls are Linux-specific."

My next plan is to study more about capabilities and about how user
authentication currently works in Hurd. I also should learn somehow where
exactly should one implement the missing capabilities. Any suggestions what
else should I study in order to be able to send a proper application?




From 1b5b54d1be2c3ac40a5804348861d1ac97ce4585 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Esa-Matti=20Mouruj=C3=A4rvi?= <esamatti.mourujarvi@gmail.com>
Date: Mon, 28 Mar 2011 17:45:33 +0000
Subject: [PATCH] Make libcap compile by using stdint.h wrapper for __u32 and __le32 types instead of linux/types.h

---
 libcap/include/linux/capability.h |    2 +-
 libcap/include/sys/capability.h   |    2 +-
 libcap/include/typeswrapper.h     |   21 +++++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 libcap/include/typeswrapper.h

diff --git a/libcap/include/linux/capability.h b/libcap/include/linux/capability.h
index 4924f2a..9c7f4ca 100644
--- a/libcap/include/linux/capability.h
+++ b/libcap/include/linux/capability.h
@@ -13,7 +13,7 @@
 #ifndef _LINUX_CAPABILITY_H
 #define _LINUX_CAPABILITY_H
 
-#include <linux/types.h>
+#include "typeswrapper.h"
 
 struct task_struct;
 
diff --git a/libcap/include/sys/capability.h b/libcap/include/sys/capability.h
index c749327..7c40bfe 100644
--- a/libcap/include/sys/capability.h
+++ b/libcap/include/sys/capability.h
@@ -21,7 +21,7 @@ extern "C" {
 
 #include <sys/types.h>
 #include <stdint.h>
-#include <linux/types.h>
+#include "typeswrapper.h"
 
 /*
  * Required to limit what gets defined in the kernel header file.
diff --git a/libcap/include/typeswrapper.h b/libcap/include/typeswrapper.h
new file mode 100644
index 0000000..9031ab2
--- /dev/null
+++ b/libcap/include/typeswrapper.h
@@ -0,0 +1,21 @@
+#ifndef _TYPESWRAPPER_H
+#define _TYPESWRAPPER_H
+
+#include <stdint.h>
+
+typedef uint32_t __u32;
+
+#ifdef __CHECKER__
+#define __bitwise__ __attribute__((bitwise))
+#else
+#define __bitwise__
+#endif
+#ifdef __CHECK_ENDIAN__
+#define __bitwise __bitwise__
+#else
+#define __bitwise
+#endif
+
+typedef __u32 __bitwise __le32;
+
+#endif
--
1.7.1




--
Esa-Matti Mourujärvi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]