~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH hare] linux::keyctl: Add chown and setperm

Details
Message ID
<20231111031529.1473789-1-me@tomlebreux.com>
DKIM signature
missing
Download raw message
Patch: +44 -0
Signed-off-by: Tom Lebreux <me@tomlebreux.com>
---
 linux/keyctl/+linux/keyctl.ha | 10 ++++++++++
 linux/keyctl/+linux/types.ha  | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/linux/keyctl/+linux/keyctl.ha b/linux/keyctl/+linux/keyctl.ha
index 3ef65397db59..71a7aab56e36 100644
--- a/linux/keyctl/+linux/keyctl.ha
+++ b/linux/keyctl/+linux/keyctl.ha
@@ -95,3 +95,13 @@ export fn read(id: serial, buf: []u8) (size | error) = {
	return keyctl(command::READ, id: u64,
		buf: uintptr: u64, bufln: u64, 0)?: size;
};

// Changes the user and group ownership of the key.
export fn chown(id: serial, uid: uint, gid: uint) (void | error) = {
	keyctl(command::CHOWN, id: u64, uid: u64, gid: u64, 0)?;
};

// Changes the permissions mask of the key.
export fn setperm(id: serial, perm: perm) (void | error) = {
	keyctl(command::SETPERM, id: u64, perm, 0, 0)?;
};
diff --git a/linux/keyctl/+linux/types.ha b/linux/keyctl/+linux/types.ha
index 564740246294..7ecbad8298e0 100644
--- a/linux/keyctl/+linux/types.ha
+++ b/linux/keyctl/+linux/types.ha
@@ -143,6 +143,40 @@ export type caps = enum u8 {
	CAPS1_NOTIFICATIONS = 0x04,
};

export type perm = enum u32 {
	KEY_OTH_VIEW = 0x01,
	KEY_OTH_READ = 0x02,
	KEY_OTH_WRITE = 0x04,
	KEY_OTH_SEARCH = 0x08,
	KEY_OTH_LINK = 0x10,
	KEY_OTH_SETATTR = 0x20,
	KEY_OTH_ALL = 0x3f,

	KEY_GRP_VIEW = 0x0100,
	KEY_GRP_READ = 0x0200,
	KEY_GRP_WRITE = 0x0400,
	KEY_GRP_SEARCH = 0x0800,
	KEY_GRP_LINK = 0x1000,
	KEY_GRP_SETATTR = 0x2000,
	KEY_GRP_ALL = 0x3f00,

	KEY_USR_VIEW = 0x010000,
	KEY_USR_READ = 0x020000,
	KEY_USR_WRITE = 0x040000,
	KEY_USR_SEARCH = 0x080000,
	KEY_USR_LINK = 0x100000,
	KEY_USR_SETATTR = 0x200000,
	KEY_USR_ALL = 0x3f0000,

	KEY_POS_VIEW = 0x01000000,
	KEY_POS_READ = 0x02000000,
	KEY_POS_WRITE = 0x04000000,
	KEY_POS_SEARCH = 0x08000000,
	KEY_POS_LINK = 0x10000000,
	KEY_POS_SETATTR = 0x20000000,
	KEY_POS_ALL = 0x3f000000,
};

// Converts an [[error]] into a human-friendly string.
export fn strerror(err: error) const str = match (err) {
case nokey =>
-- 
2.41.0

[hare/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CWVNO97RROAC.BEWHLOIA6YHL@cirno2>
In-Reply-To
<20231111031529.1473789-1-me@tomlebreux.com> (view parent)
DKIM signature
missing
Download raw message
hare/patches: SUCCESS in 1m59s

[linux::keyctl: Add chown and setperm][0] from [Tom Lebreux][1]

[0]: https://lists.sr.ht/~sircmpwn/hare-dev/patches/46618
[1]: me@tomlebreux.com

✓ #1092051 SUCCESS hare/patches/freebsd.yml https://builds.sr.ht/~sircmpwn/job/1092051
✓ #1092050 SUCCESS hare/patches/alpine.yml  https://builds.sr.ht/~sircmpwn/job/1092050
Details
Message ID
<CWZ2CNR7PTRL.1RM4N21JEZ8P5@d2evs.net>
In-Reply-To
<20231111031529.1473789-1-me@tomlebreux.com> (view parent)
DKIM signature
missing
Download raw message
thanks!

to git@git.sr.ht:~sircmpwn/hare
  3d06f9d2..d56e1c8c  master -> master
Reply to thread Export thread (mbox)