Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309756
b: refs/heads/master
c: 93e6f11
h: refs/heads/master
v: v3
  • Loading branch information
Doug Ledford authored and Linus Torvalds committed Jun 1, 2012
1 parent fbda22b commit b004417
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29a5c67e7a78815fda0567a867adce467f6e6e5a
refs/heads/master: 93e6f119c0ce8a1bba6e81dc8dd97d67be360844
5 changes: 5 additions & 0 deletions trunk/include/linux/ipc_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ static inline void shm_destroy_orphaned(struct ipc_namespace *ns) {}
#ifdef CONFIG_POSIX_MQUEUE
extern int mq_init_ns(struct ipc_namespace *ns);
/* default values */
#define MIN_QUEUESMAX 1
#define DFLT_QUEUESMAX 256 /* max number of message queues */
#define HARD_QUEUESMAX 1024
#define MIN_MSGMAX 1
#define DFLT_MSGMAX 10 /* max number of messages in each queue */
#define HARD_MSGMAX (32768*sizeof(void *)/4)
#define MIN_MSGSIZEMAX 128
#define DFLT_MSGSIZEMAX 8192 /* max message size */
#define HARD_MSGSIZEMAX (8192*128)
#else
static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
#endif
Expand Down
31 changes: 8 additions & 23 deletions trunk/ipc/mq_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
#include <linux/ipc_namespace.h>
#include <linux/sysctl.h>

/*
* Define the ranges various user-specified maximum values can
* be set to.
*/
#define MIN_MSGMAX 1 /* min value for msg_max */
#define MAX_MSGMAX HARD_MSGMAX /* max value for msg_max */
#define MIN_MSGSIZEMAX 128 /* min value for msgsize_max */
#define MAX_MSGSIZEMAX (8192*128) /* max value for msgsize_max */

#ifdef CONFIG_PROC_SYSCTL
static void *get_mq(ctl_table *table)
{
Expand All @@ -31,16 +22,6 @@ static void *get_mq(ctl_table *table)
return which;
}

static int proc_mq_dointvec(ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct ctl_table mq_table;
memcpy(&mq_table, table, sizeof(mq_table));
mq_table.data = get_mq(table);

return proc_dointvec(&mq_table, write, buffer, lenp, ppos);
}

static int proc_mq_dointvec_minmax(ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
Expand All @@ -52,23 +33,27 @@ static int proc_mq_dointvec_minmax(ctl_table *table, int write,
lenp, ppos);
}
#else
#define proc_mq_dointvec NULL
#define proc_mq_dointvec_minmax NULL
#endif

static int msg_queues_limit_min = MIN_QUEUESMAX;
static int msg_queues_limit_max = HARD_QUEUESMAX;

static int msg_max_limit_min = MIN_MSGMAX;
static int msg_max_limit_max = MAX_MSGMAX;
static int msg_max_limit_max = HARD_MSGMAX;

static int msg_maxsize_limit_min = MIN_MSGSIZEMAX;
static int msg_maxsize_limit_max = MAX_MSGSIZEMAX;
static int msg_maxsize_limit_max = HARD_MSGSIZEMAX;

static ctl_table mq_sysctls[] = {
{
.procname = "queues_max",
.data = &init_ipc_ns.mq_queues_max,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_mq_dointvec,
.proc_handler = proc_mq_dointvec_minmax,
.extra1 = &msg_queues_limit_min,
.extra2 = &msg_queues_limit_max,
},
{
.procname = "msg_max",
Expand Down

0 comments on commit b004417

Please sign in to comment.