aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Love <rml@novell.com>2005-07-13 12:38:18 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-13 14:09:31 -0400
commit0399cb08c54708db231d616f106f64d920e0b723 (patch)
treef0424d43c578f7c5c1e7aa6ea6ca1c906c7ac289
parent153f805781d35c91ab2f54aa2b8930cc4cfc7e89 (diff)
[PATCH] inotify: move sysctl
This moves the inotify sysctl knobs to "/proc/sys/fs/inotify" from "/proc/sys/fs". Also some related cleanup. Signed-off-by: Robert Love <rml@novell.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/inotify.c49
-rw-r--r--include/linux/sysctl.h12
-rw-r--r--kernel/sysctl.c51
3 files changed, 62 insertions, 50 deletions
diff --git a/fs/inotify.c b/fs/inotify.c
index e423bfe0c86f..fb4803131423 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -45,8 +45,8 @@ static kmem_cache_t *event_cachep;
45 45
46static struct vfsmount *inotify_mnt; 46static struct vfsmount *inotify_mnt;
47 47
48/* These are configurable via /proc/sys/inotify */ 48/* these are configurable via /proc/sys/fs/inotify/ */
49int inotify_max_user_devices; 49int inotify_max_user_instances;
50int inotify_max_user_watches; 50int inotify_max_user_watches;
51int inotify_max_queued_events; 51int inotify_max_queued_events;
52 52
@@ -125,6 +125,47 @@ struct inotify_watch {
125 u32 mask; /* event mask for this watch */ 125 u32 mask; /* event mask for this watch */
126}; 126};
127 127
128#ifdef CONFIG_SYSCTL
129
130#include <linux/sysctl.h>
131
132static int zero;
133
134ctl_table inotify_table[] = {
135 {
136 .ctl_name = INOTIFY_MAX_USER_INSTANCES,
137 .procname = "max_user_instances",
138 .data = &inotify_max_user_instances,
139 .maxlen = sizeof(int),
140 .mode = 0644,
141 .proc_handler = &proc_dointvec_minmax,
142 .strategy = &sysctl_intvec,
143 .extra1 = &zero,
144 },
145 {
146 .ctl_name = INOTIFY_MAX_USER_WATCHES,
147 .procname = "max_user_watches",
148 .data = &inotify_max_user_watches,
149 .maxlen = sizeof(int),
150 .mode = 0644,
151 .proc_handler = &proc_dointvec_minmax,
152 .strategy = &sysctl_intvec,
153 .extra1 = &zero,
154 },
155 {
156 .ctl_name = INOTIFY_MAX_QUEUED_EVENTS,
157 .procname = "max_queued_events",
158 .data = &inotify_max_queued_events,
159 .maxlen = sizeof(int),
160 .mode = 0644,
161 .proc_handler = &proc_dointvec_minmax,
162 .strategy = &sysctl_intvec,
163 .extra1 = &zero
164 },
165 { .ctl_name = 0 }
166};
167#endif /* CONFIG_SYSCTL */
168
128static inline void get_inotify_dev(struct inotify_device *dev) 169static inline void get_inotify_dev(struct inotify_device *dev)
129{ 170{
130 atomic_inc(&dev->count); 171 atomic_inc(&dev->count);
@@ -842,7 +883,7 @@ asmlinkage long sys_inotify_init(void)
842 883
843 user = get_uid(current->user); 884 user = get_uid(current->user);
844 885
845 if (unlikely(atomic_read(&user->inotify_devs) >= inotify_max_user_devices)) { 886 if (unlikely(atomic_read(&user->inotify_devs) >= inotify_max_user_instances)) {
846 ret = -EMFILE; 887 ret = -EMFILE;
847 goto out_err; 888 goto out_err;
848 } 889 }
@@ -979,7 +1020,7 @@ static int __init inotify_init(void)
979 inotify_mnt = kern_mount(&inotify_fs_type); 1020 inotify_mnt = kern_mount(&inotify_fs_type);
980 1021
981 inotify_max_queued_events = 8192; 1022 inotify_max_queued_events = 8192;
982 inotify_max_user_devices = 128; 1023 inotify_max_user_instances = 8;
983 inotify_max_user_watches = 8192; 1024 inotify_max_user_watches = 8192;
984 1025
985 atomic_set(&inotify_cookie, 0); 1026 atomic_set(&inotify_cookie, 0);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index ce19a2aa0b21..bfbbe94b297d 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -61,8 +61,7 @@ enum
61 CTL_DEV=7, /* Devices */ 61 CTL_DEV=7, /* Devices */
62 CTL_BUS=8, /* Busses */ 62 CTL_BUS=8, /* Busses */
63 CTL_ABI=9, /* Binary emulation */ 63 CTL_ABI=9, /* Binary emulation */
64 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */ 64 CTL_CPU=10 /* CPU stuff (speed scaling, etc) */
65 CTL_INOTIFY=11 /* Inotify */
66}; 65};
67 66
68/* CTL_BUS names: */ 67/* CTL_BUS names: */
@@ -71,12 +70,12 @@ enum
71 CTL_BUS_ISA=1 /* ISA */ 70 CTL_BUS_ISA=1 /* ISA */
72}; 71};
73 72
74/* CTL_INOTIFY names: */ 73/* /proc/sys/fs/inotify/ */
75enum 74enum
76{ 75{
77 INOTIFY_MAX_USER_DEVICES=1, /* max number of inotify device instances per user */ 76 INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */
78 INOTIFY_MAX_USER_WATCHES=2, /* max number of inotify watches per user */ 77 INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */
79 INOTIFY_MAX_QUEUED_EVENTS=3 /* Max number of queued events per inotify device instance */ 78 INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */
80}; 79};
81 80
82/* CTL_KERN names: */ 81/* CTL_KERN names: */
@@ -685,6 +684,7 @@ enum
685 FS_XFS=17, /* struct: control xfs parameters */ 684 FS_XFS=17, /* struct: control xfs parameters */
686 FS_AIO_NR=18, /* current system-wide number of aio requests */ 685 FS_AIO_NR=18, /* current system-wide number of aio requests */
687 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ 686 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
687 FS_INOTIFY=20, /* inotify submenu */
688}; 688};
689 689
690/* /proc/sys/fs/quota/ */ 690/* /proc/sys/fs/quota/ */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index b240e2cb86fc..e60b9c36f1f0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -67,12 +67,6 @@ extern int printk_ratelimit_jiffies;
67extern int printk_ratelimit_burst; 67extern int printk_ratelimit_burst;
68extern int pid_max_min, pid_max_max; 68extern int pid_max_min, pid_max_max;
69 69
70#ifdef CONFIG_INOTIFY
71extern int inotify_max_user_devices;
72extern int inotify_max_user_watches;
73extern int inotify_max_queued_events;
74#endif
75
76#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) 70#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
77int unknown_nmi_panic; 71int unknown_nmi_panic;
78extern int proc_unknown_nmi_panic(ctl_table *, int, struct file *, 72extern int proc_unknown_nmi_panic(ctl_table *, int, struct file *,
@@ -152,6 +146,9 @@ extern ctl_table random_table[];
152#ifdef CONFIG_UNIX98_PTYS 146#ifdef CONFIG_UNIX98_PTYS
153extern ctl_table pty_table[]; 147extern ctl_table pty_table[];
154#endif 148#endif
149#ifdef CONFIG_INOTIFY
150extern ctl_table inotify_table[];
151#endif
155 152
156#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 153#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
157int sysctl_legacy_va_layout; 154int sysctl_legacy_va_layout;
@@ -957,6 +954,14 @@ static ctl_table fs_table[] = {
957 .mode = 0644, 954 .mode = 0644,
958 .proc_handler = &proc_dointvec, 955 .proc_handler = &proc_dointvec,
959 }, 956 },
957#ifdef CONFIG_INOTIFY
958 {
959 .ctl_name = FS_INOTIFY,
960 .procname = "inotify",
961 .mode = 0555,
962 .child = inotify_table,
963 },
964#endif
960#endif 965#endif
961 { 966 {
962 .ctl_name = KERN_SETUID_DUMPABLE, 967 .ctl_name = KERN_SETUID_DUMPABLE,
@@ -966,40 +971,6 @@ static ctl_table fs_table[] = {
966 .mode = 0644, 971 .mode = 0644,
967 .proc_handler = &proc_dointvec, 972 .proc_handler = &proc_dointvec,
968 }, 973 },
969#ifdef CONFIG_INOTIFY
970 {
971 .ctl_name = INOTIFY_MAX_USER_DEVICES,
972 .procname = "max_user_devices",
973 .data = &inotify_max_user_devices,
974 .maxlen = sizeof(int),
975 .mode = 0644,
976 .proc_handler = &proc_dointvec_minmax,
977 .strategy = &sysctl_intvec,
978 .extra1 = &zero,
979 },
980
981 {
982 .ctl_name = INOTIFY_MAX_USER_WATCHES,
983 .procname = "max_user_watches",
984 .data = &inotify_max_user_watches,
985 .maxlen = sizeof(int),
986 .mode = 0644,
987 .proc_handler = &proc_dointvec_minmax,
988 .strategy = &sysctl_intvec,
989 .extra1 = &zero,
990 },
991
992 {
993 .ctl_name = INOTIFY_MAX_QUEUED_EVENTS,
994 .procname = "max_queued_events",
995 .data = &inotify_max_queued_events,
996 .maxlen = sizeof(int),
997 .mode = 0644,
998 .proc_handler = &proc_dointvec_minmax,
999 .strategy = &sysctl_intvec,
1000 .extra1 = &zero
1001 },
1002#endif
1003 { .ctl_name = 0 } 974 { .ctl_name = 0 }
1004}; 975};
1005 976