mailing list of musl libc
 help / color / mirror / code / Atom feed
* capset() capget() syscalls
@ 2012-08-27 11:51 igmar
  2012-09-05  6:19 ` Rich Felker
  0 siblings, 1 reply; 43+ messages in thread
From: igmar @ 2012-08-27 11:51 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: TEXT/PLAIN, Size: 150 bytes --]

Hi,

Attached patch adds types to the existing syscalls, and defines the types 
in the header. All CAP_* defines are also added.


Regards,



 	Igmar

[-- Attachment #2: Type: TEXT/PLAIN, Size: 3006 bytes --]

From 0237fb69ec7c3bf77c6280a005238fc8d0ba7607 Mon Sep 17 00:00:00 2001
From: Igmar Palsenberg <igmar@palsenberg.com>
Date: Mon, 27 Aug 2012 13:47:51 +0200
Subject: [PATCH]] Properly implement capset and capget syscalls
 Define CAP_* defines
 Define kernel ABI structs


Signed-off-by: Igmar Palsenberg <igmar@palsenberg.com>
---
 include/sys/capability.h |   74 ++++++++++++++++++++++++++++++++++++++++++++++
 src/linux/cap.c          |    5 ++-
 2 files changed, 77 insertions(+), 2 deletions(-)
 create mode 100644 include/sys/capability.h

diff --git a/include/sys/capability.h b/include/sys/capability.h
new file mode 100644
index 0000000..68bb4fc
--- /dev/null
+++ b/include/sys/capability.h
@@ -0,0 +1,74 @@
+#ifndef _SYS_CAPABILITY_H
+#define _SYS_CAPABILITY_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _LINUX_CAPABILITY_VERSION_1  0x19980330
+#define _LINUX_CAPABILITY_VERSION_2  0x20071026
+#define _LINUX_CAPABILITY_VERSION_3  0x20080522
+
+/* POSIX defined capabilities */
+#define CAP_CHOWN				0
+#define CAP_DAC_OVERRIDE		1
+#define CAP_DAC_READ_SEARCH		2
+#define CAP_FOWNER				3
+#define CAP_FSETID				4
+#define CAP_KILL				5
+#define CAP_SETGID				6
+#define CAP_SETUID				7
+
+/* Linux specific */
+#define CAP_SETPCAP				8
+#define CAP_LINUX_IMMUTABLE		9
+#define CAP_NET_BIND_SERVICE	10
+#define CAP_NET_BROADCAST		11
+#define CAP_NET_ADMIN			12
+#define CAP_NET_RAW				13
+#define CAP_IPC_LOCK			14
+#define	CAP_IPC_OWNER			15
+#define CAP_SYS_MODULE			16
+#define	CAP_SYS_RAWIO			17
+#define	CAP_SYS_CHROOT			18
+#define	CAP_SYS_PTRACE			19
+#define	CAP_SYS_PACCT			20
+#define	CAP_SYS_ADMIN			21
+#define	CAP_SYS_BOOT			22
+#define	CAP_SYS_NICE			23
+#define	CAP_SYS_RESOURCE		24
+#define	CAP_SYS_TIME			25
+#define	CAP_SYS_TTY_CONFIG		26
+#define	CAP_MKNOD				27
+#define	CAP_LEASE				28
+#define	CAP_AUDIT_WRITE			29
+#define	CAP_AUDIT_CONTROL		30
+#define	CAP_SETFCAP				31
+#define	CAP_MAC_OVERRIDE		32
+#define	CAP_MAC_ADMIN			33
+
+typedef struct _user_cap_header_struct * cap_user_header_t;
+typedef struct _user_cap_data_struct * cap_user_data_t;
+
+struct _user_cap_header_struct {
+	uint32_t version;
+	int pid;
+};
+
+struct _user_cap_data_struct {
+	uint32_t effective;
+	uint32_t permitted;
+	uint32_t inheritable;
+};
+
+
+int capget(cap_user_header_t, cap_user_data_t);
+int capset(cap_user_header_t, cap_user_data_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/linux/cap.c b/src/linux/cap.c
index 8d035e0..b88e530 100644
--- a/src/linux/cap.c
+++ b/src/linux/cap.c
@@ -1,11 +1,12 @@
 #include "syscall.h"
+#include <sys/capability.h>
 
-int capset(void *a, void *b)
+int capset(cap_user_header_t a, cap_user_data_t b)
 {
 	return syscall(SYS_capset, a, b);
 }
 
-int capget(void *a, void *b)
+int capget(cap_user_header_t a, cap_user_data_t b)
 {
 	return syscall(SYS_capget, a, b);
 }
-- 
1.7.1


^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2012-09-17  2:27 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-27 11:51 capset() capget() syscalls igmar
2012-09-05  6:19 ` Rich Felker
2012-09-05  9:28   ` Igmar Palsenberg
2012-09-05 14:24     ` Rich Felker
2012-09-05 17:01       ` Justin Cormack
2012-09-06  3:04         ` Rich Felker
2012-09-06  3:10           ` John Spencer
2012-09-06  3:20             ` Rich Felker
2012-09-06  3:28               ` Kurt H Maier
2012-09-06  3:41                 ` Rich Felker
2012-09-06  4:41                   ` Kurt H Maier
2012-09-06  8:22           ` Justin Cormack
2012-09-06  9:28             ` Szabolcs Nagy
2012-09-06 14:23               ` Rich Felker
2012-09-07  4:56             ` Rich Felker
2012-09-08 16:02               ` Justin Cormack
2012-09-08 22:14                 ` Rich Felker
2012-09-09 20:04                   ` Justin Cormack
2012-09-09 20:14                     ` Rich Felker
2012-09-09 21:13                   ` James Cloos
2012-09-09 21:55                     ` Rich Felker
2012-09-09 22:12                       ` Justin Cormack
2012-09-09 22:29                         ` Rich Felker
2012-09-09 22:37                           ` Justin Cormack
2012-09-10 15:07                             ` James Cloos
2012-09-08 21:25               ` Justin Cormack
2012-09-08 22:15                 ` Rich Felker
2012-09-08 23:56                   ` Rich Felker
2012-09-09  0:21                 ` Rich Felker
2012-09-09  8:21                   ` Justin Cormack
2012-09-09 19:40                     ` Justin Cormack
2012-09-09 21:02                       ` Rich Felker
2012-09-09 21:07                         ` Justin Cormack
2012-09-09 21:23                         ` Justin Cormack
2012-09-09 21:31                           ` Justin Cormack
2012-09-09 21:58                             ` Rich Felker
2012-09-09 22:14                               ` Justin Cormack
2012-09-15  1:54                                 ` Rich Felker
2012-09-16 14:13                                   ` Justin Cormack
2012-09-17  2:27                                     ` Rich Felker
2012-09-06 11:47           ` Igmar Palsenberg
2012-09-06 11:36       ` Igmar Palsenberg
2012-09-06 14:11         ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).