[PATCH 8/11] add mq_bytes to user_struct

From: Chris Wright
Date: Tue May 11 2004 - 04:04:07 EST


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

--- 2.6-rlimit/include/linux/sched.h~mqueue_rlimit 2004-05-10 22:29:32.558320808 -0700
+++ 2.6-rlimit/include/linux/sched.h 2004-05-10 22:30:44.527379848 -0700
@@ -315,6 +315,8 @@
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;
--- 2.6-rlimit/kernel/user.c~mqueue_rlimit 2004-05-10 22:29:03.741701600 -0700
+++ 2.6-rlimit/kernel/user.c 2004-05-10 22:30:44.531379240 -0700
@@ -32,6 +32,7 @@
.processes = ATOMIC_INIT(1),
.files = ATOMIC_INIT(0),
.sigpending = ATOMIC_INIT(0),
+ .mq_bytes = 0
};

/*
@@ -111,6 +112,8 @@
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..
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/