LWN.net Logo

add simple get_uid() helper

From:  Chris Wright <chrisw@osdl.org>
To:  linux-kernel@vger.kernel.org
Subject:  [PATCH 4/11] add simple get_uid() helper
Date:  Tue, 11 May 2004 01:50:15 -0700
Cc:  akpm@osdl.org, torvalds@osdl.org, marcelo.tosatti@cyclades.com

Add simple helper function to grab a reference to a user_struct.

===== include/linux/sched.h 1.210 vs edited =====
--- 1.210/include/linux/sched.h	Mon May 10 04:25:34 2004
+++ edited/include/linux/sched.h	Mon May 10 18:22:10 2004
@@ -714,6 +714,11 @@
 
 /* per-UID process charging. */
 extern struct user_struct * alloc_uid(uid_t);
+static inline struct user_struct *get_uid(struct user_struct *u)
+{
+	atomic_inc(&u->__count);
+	return u;
+}
 extern void free_uid(struct user_struct *);
 extern void switch_uid(struct user_struct *);
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds