aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c78
1 files changed, 33 insertions, 45 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 37abb8c3995b..a02697b7cb97 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -163,9 +163,9 @@ extern int max_lock_depth;
163#endif 163#endif
164 164
165#ifdef CONFIG_PROC_SYSCTL 165#ifdef CONFIG_PROC_SYSCTL
166static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp, 166static int proc_do_cad_pid(struct ctl_table *table, int write,
167 void __user *buffer, size_t *lenp, loff_t *ppos); 167 void __user *buffer, size_t *lenp, loff_t *ppos);
168static int proc_taint(struct ctl_table *table, int write, struct file *filp, 168static int proc_taint(struct ctl_table *table, int write,
169 void __user *buffer, size_t *lenp, loff_t *ppos); 169 void __user *buffer, size_t *lenp, loff_t *ppos);
170#endif 170#endif
171 171
@@ -2226,7 +2226,7 @@ void sysctl_head_put(struct ctl_table_header *head)
2226#ifdef CONFIG_PROC_SYSCTL 2226#ifdef CONFIG_PROC_SYSCTL
2227 2227
2228static int _proc_do_string(void* data, int maxlen, int write, 2228static int _proc_do_string(void* data, int maxlen, int write,
2229 struct file *filp, void __user *buffer, 2229 void __user *buffer,
2230 size_t *lenp, loff_t *ppos) 2230 size_t *lenp, loff_t *ppos)
2231{ 2231{
2232 size_t len; 2232 size_t len;
@@ -2287,7 +2287,6 @@ static int _proc_do_string(void* data, int maxlen, int write,
2287 * proc_dostring - read a string sysctl 2287 * proc_dostring - read a string sysctl
2288 * @table: the sysctl table 2288 * @table: the sysctl table
2289 * @write: %TRUE if this is a write to the sysctl file 2289 * @write: %TRUE if this is a write to the sysctl file
2290 * @filp: the file structure
2291 * @buffer: the user buffer 2290 * @buffer: the user buffer
2292 * @lenp: the size of the user buffer 2291 * @lenp: the size of the user buffer
2293 * @ppos: file position 2292 * @ppos: file position
@@ -2301,10 +2300,10 @@ static int _proc_do_string(void* data, int maxlen, int write,
2301 * 2300 *
2302 * Returns 0 on success. 2301 * Returns 0 on success.
2303 */ 2302 */
2304int proc_dostring(struct ctl_table *table, int write, struct file *filp, 2303int proc_dostring(struct ctl_table *table, int write,
2305 void __user *buffer, size_t *lenp, loff_t *ppos) 2304 void __user *buffer, size_t *lenp, loff_t *ppos)
2306{ 2305{
2307 return _proc_do_string(table->data, table->maxlen, write, filp, 2306 return _proc_do_string(table->data, table->maxlen, write,
2308 buffer, lenp, ppos); 2307 buffer, lenp, ppos);
2309} 2308}
2310 2309
@@ -2329,7 +2328,7 @@ static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
2329} 2328}
2330 2329
2331static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, 2330static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2332 int write, struct file *filp, void __user *buffer, 2331 int write, void __user *buffer,
2333 size_t *lenp, loff_t *ppos, 2332 size_t *lenp, loff_t *ppos,
2334 int (*conv)(int *negp, unsigned long *lvalp, int *valp, 2333 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2335 int write, void *data), 2334 int write, void *data),
@@ -2436,13 +2435,13 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2436#undef TMPBUFLEN 2435#undef TMPBUFLEN
2437} 2436}
2438 2437
2439static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp, 2438static int do_proc_dointvec(struct ctl_table *table, int write,
2440 void __user *buffer, size_t *lenp, loff_t *ppos, 2439 void __user *buffer, size_t *lenp, loff_t *ppos,
2441 int (*conv)(int *negp, unsigned long *lvalp, int *valp, 2440 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2442 int write, void *data), 2441 int write, void *data),
2443 void *data) 2442 void *data)
2444{ 2443{
2445 return __do_proc_dointvec(table->data, table, write, filp, 2444 return __do_proc_dointvec(table->data, table, write,
2446 buffer, lenp, ppos, conv, data); 2445 buffer, lenp, ppos, conv, data);
2447} 2446}
2448 2447
@@ -2450,7 +2449,6 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil
2450 * proc_dointvec - read a vector of integers 2449 * proc_dointvec - read a vector of integers
2451 * @table: the sysctl table 2450 * @table: the sysctl table
2452 * @write: %TRUE if this is a write to the sysctl file 2451 * @write: %TRUE if this is a write to the sysctl file
2453 * @filp: the file structure
2454 * @buffer: the user buffer 2452 * @buffer: the user buffer
2455 * @lenp: the size of the user buffer 2453 * @lenp: the size of the user buffer
2456 * @ppos: file position 2454 * @ppos: file position
@@ -2460,10 +2458,10 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil
2460 * 2458 *
2461 * Returns 0 on success. 2459 * Returns 0 on success.
2462 */ 2460 */
2463int proc_dointvec(struct ctl_table *table, int write, struct file *filp, 2461int proc_dointvec(struct ctl_table *table, int write,
2464 void __user *buffer, size_t *lenp, loff_t *ppos) 2462 void __user *buffer, size_t *lenp, loff_t *ppos)
2465{ 2463{
2466 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2464 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2467 NULL,NULL); 2465 NULL,NULL);
2468} 2466}
2469 2467
@@ -2471,7 +2469,7 @@ int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2471 * Taint values can only be increased 2469 * Taint values can only be increased
2472 * This means we can safely use a temporary. 2470 * This means we can safely use a temporary.
2473 */ 2471 */
2474static int proc_taint(struct ctl_table *table, int write, struct file *filp, 2472static int proc_taint(struct ctl_table *table, int write,
2475 void __user *buffer, size_t *lenp, loff_t *ppos) 2473 void __user *buffer, size_t *lenp, loff_t *ppos)
2476{ 2474{
2477 struct ctl_table t; 2475 struct ctl_table t;
@@ -2483,7 +2481,7 @@ static int proc_taint(struct ctl_table *table, int write, struct file *filp,
2483 2481
2484 t = *table; 2482 t = *table;
2485 t.data = &tmptaint; 2483 t.data = &tmptaint;
2486 err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos); 2484 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2487 if (err < 0) 2485 if (err < 0)
2488 return err; 2486 return err;
2489 2487
@@ -2535,7 +2533,6 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2535 * proc_dointvec_minmax - read a vector of integers with min/max values 2533 * proc_dointvec_minmax - read a vector of integers with min/max values
2536 * @table: the sysctl table 2534 * @table: the sysctl table
2537 * @write: %TRUE if this is a write to the sysctl file 2535 * @write: %TRUE if this is a write to the sysctl file
2538 * @filp: the file structure
2539 * @buffer: the user buffer 2536 * @buffer: the user buffer
2540 * @lenp: the size of the user buffer 2537 * @lenp: the size of the user buffer
2541 * @ppos: file position 2538 * @ppos: file position
@@ -2548,19 +2545,18 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2548 * 2545 *
2549 * Returns 0 on success. 2546 * Returns 0 on success.
2550 */ 2547 */
2551int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp, 2548int proc_dointvec_minmax(struct ctl_table *table, int write,
2552 void __user *buffer, size_t *lenp, loff_t *ppos) 2549 void __user *buffer, size_t *lenp, loff_t *ppos)
2553{ 2550{
2554 struct do_proc_dointvec_minmax_conv_param param = { 2551 struct do_proc_dointvec_minmax_conv_param param = {
2555 .min = (int *) table->extra1, 2552 .min = (int *) table->extra1,
2556 .max = (int *) table->extra2, 2553 .max = (int *) table->extra2,
2557 }; 2554 };
2558 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos, 2555 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2559 do_proc_dointvec_minmax_conv, &param); 2556 do_proc_dointvec_minmax_conv, &param);
2560} 2557}
2561 2558
2562static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, 2559static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2563 struct file *filp,
2564 void __user *buffer, 2560 void __user *buffer,
2565 size_t *lenp, loff_t *ppos, 2561 size_t *lenp, loff_t *ppos,
2566 unsigned long convmul, 2562 unsigned long convmul,
@@ -2665,21 +2661,19 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
2665} 2661}
2666 2662
2667static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, 2663static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2668 struct file *filp,
2669 void __user *buffer, 2664 void __user *buffer,
2670 size_t *lenp, loff_t *ppos, 2665 size_t *lenp, loff_t *ppos,
2671 unsigned long convmul, 2666 unsigned long convmul,
2672 unsigned long convdiv) 2667 unsigned long convdiv)
2673{ 2668{
2674 return __do_proc_doulongvec_minmax(table->data, table, write, 2669 return __do_proc_doulongvec_minmax(table->data, table, write,
2675 filp, buffer, lenp, ppos, convmul, convdiv); 2670 buffer, lenp, ppos, convmul, convdiv);
2676} 2671}
2677 2672
2678/** 2673/**
2679 * proc_doulongvec_minmax - read a vector of long integers with min/max values 2674 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2680 * @table: the sysctl table 2675 * @table: the sysctl table
2681 * @write: %TRUE if this is a write to the sysctl file 2676 * @write: %TRUE if this is a write to the sysctl file
2682 * @filp: the file structure
2683 * @buffer: the user buffer 2677 * @buffer: the user buffer
2684 * @lenp: the size of the user buffer 2678 * @lenp: the size of the user buffer
2685 * @ppos: file position 2679 * @ppos: file position
@@ -2692,17 +2686,16 @@ static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2692 * 2686 *
2693 * Returns 0 on success. 2687 * Returns 0 on success.
2694 */ 2688 */
2695int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp, 2689int proc_doulongvec_minmax(struct ctl_table *table, int write,
2696 void __user *buffer, size_t *lenp, loff_t *ppos) 2690 void __user *buffer, size_t *lenp, loff_t *ppos)
2697{ 2691{
2698 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l); 2692 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2699} 2693}
2700 2694
2701/** 2695/**
2702 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values 2696 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2703 * @table: the sysctl table 2697 * @table: the sysctl table
2704 * @write: %TRUE if this is a write to the sysctl file 2698 * @write: %TRUE if this is a write to the sysctl file
2705 * @filp: the file structure
2706 * @buffer: the user buffer 2699 * @buffer: the user buffer
2707 * @lenp: the size of the user buffer 2700 * @lenp: the size of the user buffer
2708 * @ppos: file position 2701 * @ppos: file position
@@ -2717,11 +2710,10 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp
2717 * Returns 0 on success. 2710 * Returns 0 on success.
2718 */ 2711 */
2719int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 2712int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2720 struct file *filp,
2721 void __user *buffer, 2713 void __user *buffer,
2722 size_t *lenp, loff_t *ppos) 2714 size_t *lenp, loff_t *ppos)
2723{ 2715{
2724 return do_proc_doulongvec_minmax(table, write, filp, buffer, 2716 return do_proc_doulongvec_minmax(table, write, buffer,
2725 lenp, ppos, HZ, 1000l); 2717 lenp, ppos, HZ, 1000l);
2726} 2718}
2727 2719
@@ -2797,7 +2789,6 @@ static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2797 * proc_dointvec_jiffies - read a vector of integers as seconds 2789 * proc_dointvec_jiffies - read a vector of integers as seconds
2798 * @table: the sysctl table 2790 * @table: the sysctl table
2799 * @write: %TRUE if this is a write to the sysctl file 2791 * @write: %TRUE if this is a write to the sysctl file
2800 * @filp: the file structure
2801 * @buffer: the user buffer 2792 * @buffer: the user buffer
2802 * @lenp: the size of the user buffer 2793 * @lenp: the size of the user buffer
2803 * @ppos: file position 2794 * @ppos: file position
@@ -2809,10 +2800,10 @@ static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2809 * 2800 *
2810 * Returns 0 on success. 2801 * Returns 0 on success.
2811 */ 2802 */
2812int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp, 2803int proc_dointvec_jiffies(struct ctl_table *table, int write,
2813 void __user *buffer, size_t *lenp, loff_t *ppos) 2804 void __user *buffer, size_t *lenp, loff_t *ppos)
2814{ 2805{
2815 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2806 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2816 do_proc_dointvec_jiffies_conv,NULL); 2807 do_proc_dointvec_jiffies_conv,NULL);
2817} 2808}
2818 2809
@@ -2820,7 +2811,6 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2820 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds 2811 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2821 * @table: the sysctl table 2812 * @table: the sysctl table
2822 * @write: %TRUE if this is a write to the sysctl file 2813 * @write: %TRUE if this is a write to the sysctl file
2823 * @filp: the file structure
2824 * @buffer: the user buffer 2814 * @buffer: the user buffer
2825 * @lenp: the size of the user buffer 2815 * @lenp: the size of the user buffer
2826 * @ppos: pointer to the file position 2816 * @ppos: pointer to the file position
@@ -2832,10 +2822,10 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2832 * 2822 *
2833 * Returns 0 on success. 2823 * Returns 0 on success.
2834 */ 2824 */
2835int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp, 2825int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2836 void __user *buffer, size_t *lenp, loff_t *ppos) 2826 void __user *buffer, size_t *lenp, loff_t *ppos)
2837{ 2827{
2838 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2828 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2839 do_proc_dointvec_userhz_jiffies_conv,NULL); 2829 do_proc_dointvec_userhz_jiffies_conv,NULL);
2840} 2830}
2841 2831
@@ -2843,7 +2833,6 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file
2843 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds 2833 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2844 * @table: the sysctl table 2834 * @table: the sysctl table
2845 * @write: %TRUE if this is a write to the sysctl file 2835 * @write: %TRUE if this is a write to the sysctl file
2846 * @filp: the file structure
2847 * @buffer: the user buffer 2836 * @buffer: the user buffer
2848 * @lenp: the size of the user buffer 2837 * @lenp: the size of the user buffer
2849 * @ppos: file position 2838 * @ppos: file position
@@ -2856,14 +2845,14 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file
2856 * 2845 *
2857 * Returns 0 on success. 2846 * Returns 0 on success.
2858 */ 2847 */
2859int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp, 2848int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2860 void __user *buffer, size_t *lenp, loff_t *ppos) 2849 void __user *buffer, size_t *lenp, loff_t *ppos)
2861{ 2850{
2862 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos, 2851 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2863 do_proc_dointvec_ms_jiffies_conv, NULL); 2852 do_proc_dointvec_ms_jiffies_conv, NULL);
2864} 2853}
2865 2854
2866static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp, 2855static int proc_do_cad_pid(struct ctl_table *table, int write,
2867 void __user *buffer, size_t *lenp, loff_t *ppos) 2856 void __user *buffer, size_t *lenp, loff_t *ppos)
2868{ 2857{
2869 struct pid *new_pid; 2858 struct pid *new_pid;
@@ -2872,7 +2861,7 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp
2872 2861
2873 tmp = pid_vnr(cad_pid); 2862 tmp = pid_vnr(cad_pid);
2874 2863
2875 r = __do_proc_dointvec(&tmp, table, write, filp, buffer, 2864 r = __do_proc_dointvec(&tmp, table, write, buffer,
2876 lenp, ppos, NULL, NULL); 2865 lenp, ppos, NULL, NULL);
2877 if (r || !write) 2866 if (r || !write)
2878 return r; 2867 return r;
@@ -2887,50 +2876,49 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp
2887 2876
2888#else /* CONFIG_PROC_FS */ 2877#else /* CONFIG_PROC_FS */
2889 2878
2890int proc_dostring(struct ctl_table *table, int write, struct file *filp, 2879int proc_dostring(struct ctl_table *table, int write,
2891 void __user *buffer, size_t *lenp, loff_t *ppos) 2880 void __user *buffer, size_t *lenp, loff_t *ppos)
2892{ 2881{
2893 return -ENOSYS; 2882 return -ENOSYS;
2894} 2883}
2895 2884
2896int proc_dointvec(struct ctl_table *table, int write, struct file *filp, 2885int proc_dointvec(struct ctl_table *table, int write,
2897 void __user *buffer, size_t *lenp, loff_t *ppos) 2886 void __user *buffer, size_t *lenp, loff_t *ppos)
2898{ 2887{
2899 return -ENOSYS; 2888 return -ENOSYS;
2900} 2889}
2901 2890
2902int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp, 2891int proc_dointvec_minmax(struct ctl_table *table, int write,
2903 void __user *buffer, size_t *lenp, loff_t *ppos) 2892 void __user *buffer, size_t *lenp, loff_t *ppos)
2904{ 2893{
2905 return -ENOSYS; 2894 return -ENOSYS;
2906} 2895}
2907 2896
2908int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp, 2897int proc_dointvec_jiffies(struct ctl_table *table, int write,
2909 void __user *buffer, size_t *lenp, loff_t *ppos) 2898 void __user *buffer, size_t *lenp, loff_t *ppos)
2910{ 2899{
2911 return -ENOSYS; 2900 return -ENOSYS;
2912} 2901}
2913 2902
2914int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp, 2903int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2915 void __user *buffer, size_t *lenp, loff_t *ppos) 2904 void __user *buffer, size_t *lenp, loff_t *ppos)
2916{ 2905{
2917 return -ENOSYS; 2906 return -ENOSYS;
2918} 2907}
2919 2908
2920int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp, 2909int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2921 void __user *buffer, size_t *lenp, loff_t *ppos) 2910 void __user *buffer, size_t *lenp, loff_t *ppos)
2922{ 2911{
2923 return -ENOSYS; 2912 return -ENOSYS;
2924} 2913}
2925 2914
2926int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp, 2915int proc_doulongvec_minmax(struct ctl_table *table, int write,
2927 void __user *buffer, size_t *lenp, loff_t *ppos) 2916 void __user *buffer, size_t *lenp, loff_t *ppos)
2928{ 2917{
2929 return -ENOSYS; 2918 return -ENOSYS;
2930} 2919}
2931 2920
2932int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 2921int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2933 struct file *filp,
2934 void __user *buffer, 2922 void __user *buffer,
2935 size_t *lenp, loff_t *ppos) 2923 size_t *lenp, loff_t *ppos)
2936{ 2924{