
From: Chris Wright <chrisw@osdl.org>

Add mq_bytes field to user_struct, and make sure it's properly initialized.


---

 25-akpm/include/linux/sched.h |    2 ++
 25-akpm/kernel/user.c         |    3 +++
 2 files changed, 5 insertions(+)

diff -puN include/linux/sched.h~rlim-add-mq_bytes-to-user_struct include/linux/sched.h
--- 25/include/linux/sched.h~rlim-add-mq_bytes-to-user_struct	2004-05-18 18:31:55.432429712 -0700
+++ 25-akpm/include/linux/sched.h	2004-05-18 18:31:55.437428952 -0700
@@ -323,6 +323,8 @@ struct user_struct {
 	atomic_t processes;	/* How many processes does this user have? */
 	atomic_t files;		/* How many open files does this user have? */
 	atomic_t sigpending;	/* How many pending signals does this user have? */
+	/* protected by mq_lock	*/
+	unsigned long mq_bytes;	/* How many bytes can be allocated to mqueue? */
 
 	/* Hash table maintenance information */
 	struct list_head uidhash_list;
diff -puN kernel/user.c~rlim-add-mq_bytes-to-user_struct kernel/user.c
--- 25/kernel/user.c~rlim-add-mq_bytes-to-user_struct	2004-05-18 18:31:55.433429560 -0700
+++ 25-akpm/kernel/user.c	2004-05-18 18:31:55.438428800 -0700
@@ -32,6 +32,7 @@ struct user_struct root_user = {
 	.processes	= ATOMIC_INIT(1),
 	.files		= ATOMIC_INIT(0),
 	.sigpending	= ATOMIC_INIT(0),
+	.mq_bytes	= 0
 };
 
 /*
@@ -111,6 +112,8 @@ struct user_struct * alloc_uid(uid_t uid
 		atomic_set(&new->files, 0);
 		atomic_set(&new->sigpending, 0);
 
+		new->mq_bytes = 0;
+
 		/*
 		 * Before adding this, check whether we raced
 		 * on adding the same user already..

_
