sysctl.c 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575
  1. /*
  2. * sysctl.c: General linux system control interface
  3. *
  4. * Begun 24 March 1995, Stephen Tweedie
  5. * Added /proc support, Dec 1995
  6. * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
  7. * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
  8. * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
  9. * Dynamic registration fixes, Stephen Tweedie.
  10. * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
  11. * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
  12. * Horn.
  13. * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
  14. * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
  15. * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
  16. * Wendling.
  17. * The list_for_each() macro wasn't appropriate for the sysctl loop.
  18. * Removed it and replaced it with older style, 03/23/00, Bill Wendling
  19. */
  20. #include <linux/module.h>
  21. #include <linux/mm.h>
  22. #include <linux/swap.h>
  23. #include <linux/slab.h>
  24. #include <linux/sysctl.h>
  25. #include <linux/proc_fs.h>
  26. #include <linux/capability.h>
  27. #include <linux/ctype.h>
  28. #include <linux/utsname.h>
  29. #include <linux/smp_lock.h>
  30. #include <linux/fs.h>
  31. #include <linux/init.h>
  32. #include <linux/kernel.h>
  33. #include <linux/kobject.h>
  34. #include <linux/net.h>
  35. #include <linux/sysrq.h>
  36. #include <linux/highuid.h>
  37. #include <linux/writeback.h>
  38. #include <linux/hugetlb.h>
  39. #include <linux/security.h>
  40. #include <linux/initrd.h>
  41. #include <linux/times.h>
  42. #include <linux/limits.h>
  43. #include <linux/dcache.h>
  44. #include <linux/syscalls.h>
  45. #include <linux/nfs_fs.h>
  46. #include <linux/acpi.h>
  47. #include <linux/reboot.h>
  48. #include <asm/uaccess.h>
  49. #include <asm/processor.h>
  50. #ifdef CONFIG_X86
  51. #include <asm/nmi.h>
  52. #include <asm/stacktrace.h>
  53. #endif
  54. #if defined(CONFIG_SYSCTL)
  55. /* External variables not in a header file. */
  56. extern int C_A_D;
  57. extern int print_fatal_signals;
  58. extern int sysctl_overcommit_memory;
  59. extern int sysctl_overcommit_ratio;
  60. extern int sysctl_panic_on_oom;
  61. extern int max_threads;
  62. extern int core_uses_pid;
  63. extern int suid_dumpable;
  64. extern char core_pattern[];
  65. extern int pid_max;
  66. extern int min_free_kbytes;
  67. extern int printk_ratelimit_jiffies;
  68. extern int printk_ratelimit_burst;
  69. extern int pid_max_min, pid_max_max;
  70. extern int sysctl_drop_caches;
  71. extern int percpu_pagelist_fraction;
  72. extern int compat_log;
  73. extern int maps_protect;
  74. extern int sysctl_stat_interval;
  75. extern int audit_argv_kb;
  76. /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
  77. static int maxolduid = 65535;
  78. static int minolduid;
  79. static int min_percpu_pagelist_fract = 8;
  80. static int ngroups_max = NGROUPS_MAX;
  81. #ifdef CONFIG_KMOD
  82. extern char modprobe_path[];
  83. #endif
  84. #ifdef CONFIG_CHR_DEV_SG
  85. extern int sg_big_buff;
  86. #endif
  87. #ifdef __sparc__
  88. extern char reboot_command [];
  89. extern int stop_a_enabled;
  90. extern int scons_pwroff;
  91. #endif
  92. #ifdef __hppa__
  93. extern int pwrsw_enabled;
  94. extern int unaligned_enabled;
  95. #endif
  96. #ifdef CONFIG_S390
  97. #ifdef CONFIG_MATHEMU
  98. extern int sysctl_ieee_emulation_warnings;
  99. #endif
  100. extern int sysctl_userprocess_debug;
  101. extern int spin_retry;
  102. #endif
  103. extern int sysctl_hz_timer;
  104. #ifdef CONFIG_BSD_PROCESS_ACCT
  105. extern int acct_parm[];
  106. #endif
  107. #ifdef CONFIG_IA64
  108. extern int no_unaligned_warning;
  109. #endif
  110. #ifdef CONFIG_RT_MUTEXES
  111. extern int max_lock_depth;
  112. #endif
  113. #ifdef CONFIG_SYSCTL_SYSCALL
  114. static int parse_table(int __user *, int, void __user *, size_t __user *,
  115. void __user *, size_t, ctl_table *);
  116. #endif
  117. #ifdef CONFIG_PROC_SYSCTL
  118. static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
  119. void __user *buffer, size_t *lenp, loff_t *ppos);
  120. static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
  121. void __user *buffer, size_t *lenp, loff_t *ppos);
  122. #endif
  123. static ctl_table root_table[];
  124. static struct ctl_table_header root_table_header =
  125. { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
  126. static ctl_table kern_table[];
  127. static ctl_table vm_table[];
  128. static ctl_table fs_table[];
  129. static ctl_table debug_table[];
  130. static ctl_table dev_table[];
  131. extern ctl_table random_table[];
  132. #ifdef CONFIG_UNIX98_PTYS
  133. extern ctl_table pty_table[];
  134. #endif
  135. #ifdef CONFIG_INOTIFY_USER
  136. extern ctl_table inotify_table[];
  137. #endif
  138. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  139. int sysctl_legacy_va_layout;
  140. #endif
  141. extern int prove_locking;
  142. extern int lock_stat;
  143. /* The default sysctl tables: */
  144. static ctl_table root_table[] = {
  145. {
  146. .ctl_name = CTL_KERN,
  147. .procname = "kernel",
  148. .mode = 0555,
  149. .child = kern_table,
  150. },
  151. {
  152. .ctl_name = CTL_VM,
  153. .procname = "vm",
  154. .mode = 0555,
  155. .child = vm_table,
  156. },
  157. #ifdef CONFIG_NET
  158. {
  159. .ctl_name = CTL_NET,
  160. .procname = "net",
  161. .mode = 0555,
  162. .child = net_table,
  163. },
  164. #endif
  165. {
  166. .ctl_name = CTL_FS,
  167. .procname = "fs",
  168. .mode = 0555,
  169. .child = fs_table,
  170. },
  171. {
  172. .ctl_name = CTL_DEBUG,
  173. .procname = "debug",
  174. .mode = 0555,
  175. .child = debug_table,
  176. },
  177. {
  178. .ctl_name = CTL_DEV,
  179. .procname = "dev",
  180. .mode = 0555,
  181. .child = dev_table,
  182. },
  183. /*
  184. * NOTE: do not add new entries to this table unless you have read
  185. * Documentation/sysctl/ctl_unnumbered.txt
  186. */
  187. { .ctl_name = 0 }
  188. };
  189. #ifdef CONFIG_SCHED_DEBUG
  190. static unsigned long min_sched_granularity_ns = 100000; /* 100 usecs */
  191. static unsigned long max_sched_granularity_ns = 1000000000; /* 1 second */
  192. static unsigned long min_wakeup_granularity_ns; /* 0 usecs */
  193. static unsigned long max_wakeup_granularity_ns = 1000000000; /* 1 second */
  194. #endif
  195. static ctl_table kern_table[] = {
  196. #ifdef CONFIG_SCHED_DEBUG
  197. {
  198. .ctl_name = CTL_UNNUMBERED,
  199. .procname = "sched_nr_latency",
  200. .data = &sysctl_sched_nr_latency,
  201. .maxlen = sizeof(unsigned int),
  202. .mode = 0644,
  203. .proc_handler = &proc_dointvec,
  204. },
  205. {
  206. .ctl_name = CTL_UNNUMBERED,
  207. .procname = "sched_latency_ns",
  208. .data = &sysctl_sched_latency,
  209. .maxlen = sizeof(unsigned int),
  210. .mode = 0644,
  211. .proc_handler = &proc_dointvec_minmax,
  212. .strategy = &sysctl_intvec,
  213. .extra1 = &min_sched_granularity_ns,
  214. .extra2 = &max_sched_granularity_ns,
  215. },
  216. {
  217. .ctl_name = CTL_UNNUMBERED,
  218. .procname = "sched_wakeup_granularity_ns",
  219. .data = &sysctl_sched_wakeup_granularity,
  220. .maxlen = sizeof(unsigned int),
  221. .mode = 0644,
  222. .proc_handler = &proc_dointvec_minmax,
  223. .strategy = &sysctl_intvec,
  224. .extra1 = &min_wakeup_granularity_ns,
  225. .extra2 = &max_wakeup_granularity_ns,
  226. },
  227. {
  228. .ctl_name = CTL_UNNUMBERED,
  229. .procname = "sched_batch_wakeup_granularity_ns",
  230. .data = &sysctl_sched_batch_wakeup_granularity,
  231. .maxlen = sizeof(unsigned int),
  232. .mode = 0644,
  233. .proc_handler = &proc_dointvec_minmax,
  234. .strategy = &sysctl_intvec,
  235. .extra1 = &min_wakeup_granularity_ns,
  236. .extra2 = &max_wakeup_granularity_ns,
  237. },
  238. {
  239. .ctl_name = CTL_UNNUMBERED,
  240. .procname = "sched_child_runs_first",
  241. .data = &sysctl_sched_child_runs_first,
  242. .maxlen = sizeof(unsigned int),
  243. .mode = 0644,
  244. .proc_handler = &proc_dointvec,
  245. },
  246. {
  247. .ctl_name = CTL_UNNUMBERED,
  248. .procname = "sched_features",
  249. .data = &sysctl_sched_features,
  250. .maxlen = sizeof(unsigned int),
  251. .mode = 0644,
  252. .proc_handler = &proc_dointvec,
  253. },
  254. #endif
  255. {
  256. .ctl_name = CTL_UNNUMBERED,
  257. .procname = "sched_compat_yield",
  258. .data = &sysctl_sched_compat_yield,
  259. .maxlen = sizeof(unsigned int),
  260. .mode = 0644,
  261. .proc_handler = &proc_dointvec,
  262. },
  263. #ifdef CONFIG_PROVE_LOCKING
  264. {
  265. .ctl_name = CTL_UNNUMBERED,
  266. .procname = "prove_locking",
  267. .data = &prove_locking,
  268. .maxlen = sizeof(int),
  269. .mode = 0644,
  270. .proc_handler = &proc_dointvec,
  271. },
  272. #endif
  273. #ifdef CONFIG_LOCK_STAT
  274. {
  275. .ctl_name = CTL_UNNUMBERED,
  276. .procname = "lock_stat",
  277. .data = &lock_stat,
  278. .maxlen = sizeof(int),
  279. .mode = 0644,
  280. .proc_handler = &proc_dointvec,
  281. },
  282. #endif
  283. {
  284. .ctl_name = KERN_PANIC,
  285. .procname = "panic",
  286. .data = &panic_timeout,
  287. .maxlen = sizeof(int),
  288. .mode = 0644,
  289. .proc_handler = &proc_dointvec,
  290. },
  291. {
  292. .ctl_name = KERN_CORE_USES_PID,
  293. .procname = "core_uses_pid",
  294. .data = &core_uses_pid,
  295. .maxlen = sizeof(int),
  296. .mode = 0644,
  297. .proc_handler = &proc_dointvec,
  298. },
  299. #ifdef CONFIG_AUDITSYSCALL
  300. {
  301. .ctl_name = CTL_UNNUMBERED,
  302. .procname = "audit_argv_kb",
  303. .data = &audit_argv_kb,
  304. .maxlen = sizeof(int),
  305. .mode = 0644,
  306. .proc_handler = &proc_dointvec,
  307. },
  308. #endif
  309. {
  310. .ctl_name = KERN_CORE_PATTERN,
  311. .procname = "core_pattern",
  312. .data = core_pattern,
  313. .maxlen = CORENAME_MAX_SIZE,
  314. .mode = 0644,
  315. .proc_handler = &proc_dostring,
  316. .strategy = &sysctl_string,
  317. },
  318. #ifdef CONFIG_PROC_SYSCTL
  319. {
  320. .ctl_name = KERN_TAINTED,
  321. .procname = "tainted",
  322. .data = &tainted,
  323. .maxlen = sizeof(int),
  324. .mode = 0644,
  325. .proc_handler = &proc_dointvec_taint,
  326. },
  327. #endif
  328. {
  329. .ctl_name = KERN_CAP_BSET,
  330. .procname = "cap-bound",
  331. .data = &cap_bset,
  332. .maxlen = sizeof(kernel_cap_t),
  333. .mode = 0600,
  334. .proc_handler = &proc_dointvec_bset,
  335. },
  336. #ifdef CONFIG_BLK_DEV_INITRD
  337. {
  338. .ctl_name = KERN_REALROOTDEV,
  339. .procname = "real-root-dev",
  340. .data = &real_root_dev,
  341. .maxlen = sizeof(int),
  342. .mode = 0644,
  343. .proc_handler = &proc_dointvec,
  344. },
  345. #endif
  346. {
  347. .ctl_name = CTL_UNNUMBERED,
  348. .procname = "print-fatal-signals",
  349. .data = &print_fatal_signals,
  350. .maxlen = sizeof(int),
  351. .mode = 0644,
  352. .proc_handler = &proc_dointvec,
  353. },
  354. #ifdef __sparc__
  355. {
  356. .ctl_name = KERN_SPARC_REBOOT,
  357. .procname = "reboot-cmd",
  358. .data = reboot_command,
  359. .maxlen = 256,
  360. .mode = 0644,
  361. .proc_handler = &proc_dostring,
  362. .strategy = &sysctl_string,
  363. },
  364. {
  365. .ctl_name = KERN_SPARC_STOP_A,
  366. .procname = "stop-a",
  367. .data = &stop_a_enabled,
  368. .maxlen = sizeof (int),
  369. .mode = 0644,
  370. .proc_handler = &proc_dointvec,
  371. },
  372. {
  373. .ctl_name = KERN_SPARC_SCONS_PWROFF,
  374. .procname = "scons-poweroff",
  375. .data = &scons_pwroff,
  376. .maxlen = sizeof (int),
  377. .mode = 0644,
  378. .proc_handler = &proc_dointvec,
  379. },
  380. #endif
  381. #ifdef __hppa__
  382. {
  383. .ctl_name = KERN_HPPA_PWRSW,
  384. .procname = "soft-power",
  385. .data = &pwrsw_enabled,
  386. .maxlen = sizeof (int),
  387. .mode = 0644,
  388. .proc_handler = &proc_dointvec,
  389. },
  390. {
  391. .ctl_name = KERN_HPPA_UNALIGNED,
  392. .procname = "unaligned-trap",
  393. .data = &unaligned_enabled,
  394. .maxlen = sizeof (int),
  395. .mode = 0644,
  396. .proc_handler = &proc_dointvec,
  397. },
  398. #endif
  399. {
  400. .ctl_name = KERN_CTLALTDEL,
  401. .procname = "ctrl-alt-del",
  402. .data = &C_A_D,
  403. .maxlen = sizeof(int),
  404. .mode = 0644,
  405. .proc_handler = &proc_dointvec,
  406. },
  407. {
  408. .ctl_name = KERN_PRINTK,
  409. .procname = "printk",
  410. .data = &console_loglevel,
  411. .maxlen = 4*sizeof(int),
  412. .mode = 0644,
  413. .proc_handler = &proc_dointvec,
  414. },
  415. #ifdef CONFIG_KMOD
  416. {
  417. .ctl_name = KERN_MODPROBE,
  418. .procname = "modprobe",
  419. .data = &modprobe_path,
  420. .maxlen = KMOD_PATH_LEN,
  421. .mode = 0644,
  422. .proc_handler = &proc_dostring,
  423. .strategy = &sysctl_string,
  424. },
  425. #endif
  426. #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
  427. {
  428. .ctl_name = KERN_HOTPLUG,
  429. .procname = "hotplug",
  430. .data = &uevent_helper,
  431. .maxlen = UEVENT_HELPER_PATH_LEN,
  432. .mode = 0644,
  433. .proc_handler = &proc_dostring,
  434. .strategy = &sysctl_string,
  435. },
  436. #endif
  437. #ifdef CONFIG_CHR_DEV_SG
  438. {
  439. .ctl_name = KERN_SG_BIG_BUFF,
  440. .procname = "sg-big-buff",
  441. .data = &sg_big_buff,
  442. .maxlen = sizeof (int),
  443. .mode = 0444,
  444. .proc_handler = &proc_dointvec,
  445. },
  446. #endif
  447. #ifdef CONFIG_BSD_PROCESS_ACCT
  448. {
  449. .ctl_name = KERN_ACCT,
  450. .procname = "acct",
  451. .data = &acct_parm,
  452. .maxlen = 3*sizeof(int),
  453. .mode = 0644,
  454. .proc_handler = &proc_dointvec,
  455. },
  456. #endif
  457. #ifdef CONFIG_MAGIC_SYSRQ
  458. {
  459. .ctl_name = KERN_SYSRQ,
  460. .procname = "sysrq",
  461. .data = &__sysrq_enabled,
  462. .maxlen = sizeof (int),
  463. .mode = 0644,
  464. .proc_handler = &proc_dointvec,
  465. },
  466. #endif
  467. #ifdef CONFIG_PROC_SYSCTL
  468. {
  469. .ctl_name = KERN_CADPID,
  470. .procname = "cad_pid",
  471. .data = NULL,
  472. .maxlen = sizeof (int),
  473. .mode = 0600,
  474. .proc_handler = &proc_do_cad_pid,
  475. },
  476. #endif
  477. {
  478. .ctl_name = KERN_MAX_THREADS,
  479. .procname = "threads-max",
  480. .data = &max_threads,
  481. .maxlen = sizeof(int),
  482. .mode = 0644,
  483. .proc_handler = &proc_dointvec,
  484. },
  485. {
  486. .ctl_name = KERN_RANDOM,
  487. .procname = "random",
  488. .mode = 0555,
  489. .child = random_table,
  490. },
  491. #ifdef CONFIG_UNIX98_PTYS
  492. {
  493. .ctl_name = KERN_PTY,
  494. .procname = "pty",
  495. .mode = 0555,
  496. .child = pty_table,
  497. },
  498. #endif
  499. {
  500. .ctl_name = KERN_OVERFLOWUID,
  501. .procname = "overflowuid",
  502. .data = &overflowuid,
  503. .maxlen = sizeof(int),
  504. .mode = 0644,
  505. .proc_handler = &proc_dointvec_minmax,
  506. .strategy = &sysctl_intvec,
  507. .extra1 = &minolduid,
  508. .extra2 = &maxolduid,
  509. },
  510. {
  511. .ctl_name = KERN_OVERFLOWGID,
  512. .procname = "overflowgid",
  513. .data = &overflowgid,
  514. .maxlen = sizeof(int),
  515. .mode = 0644,
  516. .proc_handler = &proc_dointvec_minmax,
  517. .strategy = &sysctl_intvec,
  518. .extra1 = &minolduid,
  519. .extra2 = &maxolduid,
  520. },
  521. #ifdef CONFIG_S390
  522. #ifdef CONFIG_MATHEMU
  523. {
  524. .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
  525. .procname = "ieee_emulation_warnings",
  526. .data = &sysctl_ieee_emulation_warnings,
  527. .maxlen = sizeof(int),
  528. .mode = 0644,
  529. .proc_handler = &proc_dointvec,
  530. },
  531. #endif
  532. #ifdef CONFIG_NO_IDLE_HZ
  533. {
  534. .ctl_name = KERN_HZ_TIMER,
  535. .procname = "hz_timer",
  536. .data = &sysctl_hz_timer,
  537. .maxlen = sizeof(int),
  538. .mode = 0644,
  539. .proc_handler = &proc_dointvec,
  540. },
  541. #endif
  542. {
  543. .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
  544. .procname = "userprocess_debug",
  545. .data = &sysctl_userprocess_debug,
  546. .maxlen = sizeof(int),
  547. .mode = 0644,
  548. .proc_handler = &proc_dointvec,
  549. },
  550. #endif
  551. {
  552. .ctl_name = KERN_PIDMAX,
  553. .procname = "pid_max",
  554. .data = &pid_max,
  555. .maxlen = sizeof (int),
  556. .mode = 0644,
  557. .proc_handler = &proc_dointvec_minmax,
  558. .strategy = sysctl_intvec,
  559. .extra1 = &pid_max_min,
  560. .extra2 = &pid_max_max,
  561. },
  562. {
  563. .ctl_name = KERN_PANIC_ON_OOPS,
  564. .procname = "panic_on_oops",
  565. .data = &panic_on_oops,
  566. .maxlen = sizeof(int),
  567. .mode = 0644,
  568. .proc_handler = &proc_dointvec,
  569. },
  570. {
  571. .ctl_name = KERN_PRINTK_RATELIMIT,
  572. .procname = "printk_ratelimit",
  573. .data = &printk_ratelimit_jiffies,
  574. .maxlen = sizeof(int),
  575. .mode = 0644,
  576. .proc_handler = &proc_dointvec_jiffies,
  577. .strategy = &sysctl_jiffies,
  578. },
  579. {
  580. .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
  581. .procname = "printk_ratelimit_burst",
  582. .data = &printk_ratelimit_burst,
  583. .maxlen = sizeof(int),
  584. .mode = 0644,
  585. .proc_handler = &proc_dointvec,
  586. },
  587. {
  588. .ctl_name = KERN_NGROUPS_MAX,
  589. .procname = "ngroups_max",
  590. .data = &ngroups_max,
  591. .maxlen = sizeof (int),
  592. .mode = 0444,
  593. .proc_handler = &proc_dointvec,
  594. },
  595. #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
  596. {
  597. .ctl_name = KERN_UNKNOWN_NMI_PANIC,
  598. .procname = "unknown_nmi_panic",
  599. .data = &unknown_nmi_panic,
  600. .maxlen = sizeof (int),
  601. .mode = 0644,
  602. .proc_handler = &proc_dointvec,
  603. },
  604. {
  605. .ctl_name = KERN_NMI_WATCHDOG,
  606. .procname = "nmi_watchdog",
  607. .data = &nmi_watchdog_enabled,
  608. .maxlen = sizeof (int),
  609. .mode = 0644,
  610. .proc_handler = &proc_nmi_enabled,
  611. },
  612. #endif
  613. #if defined(CONFIG_X86)
  614. {
  615. .ctl_name = KERN_PANIC_ON_NMI,
  616. .procname = "panic_on_unrecovered_nmi",
  617. .data = &panic_on_unrecovered_nmi,
  618. .maxlen = sizeof(int),
  619. .mode = 0644,
  620. .proc_handler = &proc_dointvec,
  621. },
  622. {
  623. .ctl_name = KERN_BOOTLOADER_TYPE,
  624. .procname = "bootloader_type",
  625. .data = &bootloader_type,
  626. .maxlen = sizeof (int),
  627. .mode = 0444,
  628. .proc_handler = &proc_dointvec,
  629. },
  630. {
  631. .ctl_name = CTL_UNNUMBERED,
  632. .procname = "kstack_depth_to_print",
  633. .data = &kstack_depth_to_print,
  634. .maxlen = sizeof(int),
  635. .mode = 0644,
  636. .proc_handler = &proc_dointvec,
  637. },
  638. #endif
  639. #if defined(CONFIG_MMU)
  640. {
  641. .ctl_name = KERN_RANDOMIZE,
  642. .procname = "randomize_va_space",
  643. .data = &randomize_va_space,
  644. .maxlen = sizeof(int),
  645. .mode = 0644,
  646. .proc_handler = &proc_dointvec,
  647. },
  648. #endif
  649. #if defined(CONFIG_S390) && defined(CONFIG_SMP)
  650. {
  651. .ctl_name = KERN_SPIN_RETRY,
  652. .procname = "spin_retry",
  653. .data = &spin_retry,
  654. .maxlen = sizeof (int),
  655. .mode = 0644,
  656. .proc_handler = &proc_dointvec,
  657. },
  658. #endif
  659. #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
  660. {
  661. .ctl_name = KERN_ACPI_VIDEO_FLAGS,
  662. .procname = "acpi_video_flags",
  663. .data = &acpi_realmode_flags,
  664. .maxlen = sizeof (unsigned long),
  665. .mode = 0644,
  666. .proc_handler = &proc_doulongvec_minmax,
  667. },
  668. #endif
  669. #ifdef CONFIG_IA64
  670. {
  671. .ctl_name = KERN_IA64_UNALIGNED,
  672. .procname = "ignore-unaligned-usertrap",
  673. .data = &no_unaligned_warning,
  674. .maxlen = sizeof (int),
  675. .mode = 0644,
  676. .proc_handler = &proc_dointvec,
  677. },
  678. #endif
  679. #ifdef CONFIG_COMPAT
  680. {
  681. .ctl_name = KERN_COMPAT_LOG,
  682. .procname = "compat-log",
  683. .data = &compat_log,
  684. .maxlen = sizeof (int),
  685. .mode = 0644,
  686. .proc_handler = &proc_dointvec,
  687. },
  688. #endif
  689. #ifdef CONFIG_RT_MUTEXES
  690. {
  691. .ctl_name = KERN_MAX_LOCK_DEPTH,
  692. .procname = "max_lock_depth",
  693. .data = &max_lock_depth,
  694. .maxlen = sizeof(int),
  695. .mode = 0644,
  696. .proc_handler = &proc_dointvec,
  697. },
  698. #endif
  699. #ifdef CONFIG_PROC_FS
  700. {
  701. .ctl_name = CTL_UNNUMBERED,
  702. .procname = "maps_protect",
  703. .data = &maps_protect,
  704. .maxlen = sizeof(int),
  705. .mode = 0644,
  706. .proc_handler = &proc_dointvec,
  707. },
  708. #endif
  709. {
  710. .ctl_name = CTL_UNNUMBERED,
  711. .procname = "poweroff_cmd",
  712. .data = &poweroff_cmd,
  713. .maxlen = POWEROFF_CMD_PATH_LEN,
  714. .mode = 0644,
  715. .proc_handler = &proc_dostring,
  716. .strategy = &sysctl_string,
  717. },
  718. /*
  719. * NOTE: do not add new entries to this table unless you have read
  720. * Documentation/sysctl/ctl_unnumbered.txt
  721. */
  722. { .ctl_name = 0 }
  723. };
  724. /* Constants for minimum and maximum testing in vm_table.
  725. We use these as one-element integer vectors. */
  726. static int zero;
  727. static int two = 2;
  728. static int one_hundred = 100;
  729. static ctl_table vm_table[] = {
  730. {
  731. .ctl_name = VM_OVERCOMMIT_MEMORY,
  732. .procname = "overcommit_memory",
  733. .data = &sysctl_overcommit_memory,
  734. .maxlen = sizeof(sysctl_overcommit_memory),
  735. .mode = 0644,
  736. .proc_handler = &proc_dointvec,
  737. },
  738. {
  739. .ctl_name = VM_PANIC_ON_OOM,
  740. .procname = "panic_on_oom",
  741. .data = &sysctl_panic_on_oom,
  742. .maxlen = sizeof(sysctl_panic_on_oom),
  743. .mode = 0644,
  744. .proc_handler = &proc_dointvec,
  745. },
  746. {
  747. .ctl_name = VM_OVERCOMMIT_RATIO,
  748. .procname = "overcommit_ratio",
  749. .data = &sysctl_overcommit_ratio,
  750. .maxlen = sizeof(sysctl_overcommit_ratio),
  751. .mode = 0644,
  752. .proc_handler = &proc_dointvec,
  753. },
  754. {
  755. .ctl_name = VM_PAGE_CLUSTER,
  756. .procname = "page-cluster",
  757. .data = &page_cluster,
  758. .maxlen = sizeof(int),
  759. .mode = 0644,
  760. .proc_handler = &proc_dointvec,
  761. },
  762. {
  763. .ctl_name = VM_DIRTY_BACKGROUND,
  764. .procname = "dirty_background_ratio",
  765. .data = &dirty_background_ratio,
  766. .maxlen = sizeof(dirty_background_ratio),
  767. .mode = 0644,
  768. .proc_handler = &proc_dointvec_minmax,
  769. .strategy = &sysctl_intvec,
  770. .extra1 = &zero,
  771. .extra2 = &one_hundred,
  772. },
  773. {
  774. .ctl_name = VM_DIRTY_RATIO,
  775. .procname = "dirty_ratio",
  776. .data = &vm_dirty_ratio,
  777. .maxlen = sizeof(vm_dirty_ratio),
  778. .mode = 0644,
  779. .proc_handler = &proc_dointvec_minmax,
  780. .strategy = &sysctl_intvec,
  781. .extra1 = &zero,
  782. .extra2 = &one_hundred,
  783. },
  784. {
  785. .ctl_name = VM_DIRTY_WB_CS,
  786. .procname = "dirty_writeback_centisecs",
  787. .data = &dirty_writeback_interval,
  788. .maxlen = sizeof(dirty_writeback_interval),
  789. .mode = 0644,
  790. .proc_handler = &dirty_writeback_centisecs_handler,
  791. },
  792. {
  793. .ctl_name = VM_DIRTY_EXPIRE_CS,
  794. .procname = "dirty_expire_centisecs",
  795. .data = &dirty_expire_interval,
  796. .maxlen = sizeof(dirty_expire_interval),
  797. .mode = 0644,
  798. .proc_handler = &proc_dointvec_userhz_jiffies,
  799. },
  800. {
  801. .ctl_name = VM_NR_PDFLUSH_THREADS,
  802. .procname = "nr_pdflush_threads",
  803. .data = &nr_pdflush_threads,
  804. .maxlen = sizeof nr_pdflush_threads,
  805. .mode = 0444 /* read-only*/,
  806. .proc_handler = &proc_dointvec,
  807. },
  808. {
  809. .ctl_name = VM_SWAPPINESS,
  810. .procname = "swappiness",
  811. .data = &vm_swappiness,
  812. .maxlen = sizeof(vm_swappiness),
  813. .mode = 0644,
  814. .proc_handler = &proc_dointvec_minmax,
  815. .strategy = &sysctl_intvec,
  816. .extra1 = &zero,
  817. .extra2 = &one_hundred,
  818. },
  819. #ifdef CONFIG_HUGETLB_PAGE
  820. {
  821. .ctl_name = VM_HUGETLB_PAGES,
  822. .procname = "nr_hugepages",
  823. .data = &max_huge_pages,
  824. .maxlen = sizeof(unsigned long),
  825. .mode = 0644,
  826. .proc_handler = &hugetlb_sysctl_handler,
  827. .extra1 = (void *)&hugetlb_zero,
  828. .extra2 = (void *)&hugetlb_infinity,
  829. },
  830. {
  831. .ctl_name = VM_HUGETLB_GROUP,
  832. .procname = "hugetlb_shm_group",
  833. .data = &sysctl_hugetlb_shm_group,
  834. .maxlen = sizeof(gid_t),
  835. .mode = 0644,
  836. .proc_handler = &proc_dointvec,
  837. },
  838. {
  839. .ctl_name = CTL_UNNUMBERED,
  840. .procname = "hugepages_treat_as_movable",
  841. .data = &hugepages_treat_as_movable,
  842. .maxlen = sizeof(int),
  843. .mode = 0644,
  844. .proc_handler = &hugetlb_treat_movable_handler,
  845. },
  846. #endif
  847. {
  848. .ctl_name = VM_LOWMEM_RESERVE_RATIO,
  849. .procname = "lowmem_reserve_ratio",
  850. .data = &sysctl_lowmem_reserve_ratio,
  851. .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
  852. .mode = 0644,
  853. .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
  854. .strategy = &sysctl_intvec,
  855. },
  856. {
  857. .ctl_name = VM_DROP_PAGECACHE,
  858. .procname = "drop_caches",
  859. .data = &sysctl_drop_caches,
  860. .maxlen = sizeof(int),
  861. .mode = 0644,
  862. .proc_handler = drop_caches_sysctl_handler,
  863. .strategy = &sysctl_intvec,
  864. },
  865. {
  866. .ctl_name = VM_MIN_FREE_KBYTES,
  867. .procname = "min_free_kbytes",
  868. .data = &min_free_kbytes,
  869. .maxlen = sizeof(min_free_kbytes),
  870. .mode = 0644,
  871. .proc_handler = &min_free_kbytes_sysctl_handler,
  872. .strategy = &sysctl_intvec,
  873. .extra1 = &zero,
  874. },
  875. {
  876. .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
  877. .procname = "percpu_pagelist_fraction",
  878. .data = &percpu_pagelist_fraction,
  879. .maxlen = sizeof(percpu_pagelist_fraction),
  880. .mode = 0644,
  881. .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
  882. .strategy = &sysctl_intvec,
  883. .extra1 = &min_percpu_pagelist_fract,
  884. },
  885. #ifdef CONFIG_MMU
  886. {
  887. .ctl_name = VM_MAX_MAP_COUNT,
  888. .procname = "max_map_count",
  889. .data = &sysctl_max_map_count,
  890. .maxlen = sizeof(sysctl_max_map_count),
  891. .mode = 0644,
  892. .proc_handler = &proc_dointvec
  893. },
  894. #endif
  895. {
  896. .ctl_name = VM_LAPTOP_MODE,
  897. .procname = "laptop_mode",
  898. .data = &laptop_mode,
  899. .maxlen = sizeof(laptop_mode),
  900. .mode = 0644,
  901. .proc_handler = &proc_dointvec_jiffies,
  902. .strategy = &sysctl_jiffies,
  903. },
  904. {
  905. .ctl_name = VM_BLOCK_DUMP,
  906. .procname = "block_dump",
  907. .data = &block_dump,
  908. .maxlen = sizeof(block_dump),
  909. .mode = 0644,
  910. .proc_handler = &proc_dointvec,
  911. .strategy = &sysctl_intvec,
  912. .extra1 = &zero,
  913. },
  914. {
  915. .ctl_name = VM_VFS_CACHE_PRESSURE,
  916. .procname = "vfs_cache_pressure",
  917. .data = &sysctl_vfs_cache_pressure,
  918. .maxlen = sizeof(sysctl_vfs_cache_pressure),
  919. .mode = 0644,
  920. .proc_handler = &proc_dointvec,
  921. .strategy = &sysctl_intvec,
  922. .extra1 = &zero,
  923. },
  924. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  925. {
  926. .ctl_name = VM_LEGACY_VA_LAYOUT,
  927. .procname = "legacy_va_layout",
  928. .data = &sysctl_legacy_va_layout,
  929. .maxlen = sizeof(sysctl_legacy_va_layout),
  930. .mode = 0644,
  931. .proc_handler = &proc_dointvec,
  932. .strategy = &sysctl_intvec,
  933. .extra1 = &zero,
  934. },
  935. #endif
  936. #ifdef CONFIG_NUMA
  937. {
  938. .ctl_name = VM_ZONE_RECLAIM_MODE,
  939. .procname = "zone_reclaim_mode",
  940. .data = &zone_reclaim_mode,
  941. .maxlen = sizeof(zone_reclaim_mode),
  942. .mode = 0644,
  943. .proc_handler = &proc_dointvec,
  944. .strategy = &sysctl_intvec,
  945. .extra1 = &zero,
  946. },
  947. {
  948. .ctl_name = VM_MIN_UNMAPPED,
  949. .procname = "min_unmapped_ratio",
  950. .data = &sysctl_min_unmapped_ratio,
  951. .maxlen = sizeof(sysctl_min_unmapped_ratio),
  952. .mode = 0644,
  953. .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
  954. .strategy = &sysctl_intvec,
  955. .extra1 = &zero,
  956. .extra2 = &one_hundred,
  957. },
  958. {
  959. .ctl_name = VM_MIN_SLAB,
  960. .procname = "min_slab_ratio",
  961. .data = &sysctl_min_slab_ratio,
  962. .maxlen = sizeof(sysctl_min_slab_ratio),
  963. .mode = 0644,
  964. .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
  965. .strategy = &sysctl_intvec,
  966. .extra1 = &zero,
  967. .extra2 = &one_hundred,
  968. },
  969. #endif
  970. #ifdef CONFIG_SMP
  971. {
  972. .ctl_name = CTL_UNNUMBERED,
  973. .procname = "stat_interval",
  974. .data = &sysctl_stat_interval,
  975. .maxlen = sizeof(sysctl_stat_interval),
  976. .mode = 0644,
  977. .proc_handler = &proc_dointvec_jiffies,
  978. .strategy = &sysctl_jiffies,
  979. },
  980. #endif
  981. #ifdef CONFIG_SECURITY
  982. {
  983. .ctl_name = CTL_UNNUMBERED,
  984. .procname = "mmap_min_addr",
  985. .data = &mmap_min_addr,
  986. .maxlen = sizeof(unsigned long),
  987. .mode = 0644,
  988. .proc_handler = &proc_doulongvec_minmax,
  989. },
  990. #endif
  991. #ifdef CONFIG_NUMA
  992. {
  993. .ctl_name = CTL_UNNUMBERED,
  994. .procname = "numa_zonelist_order",
  995. .data = &numa_zonelist_order,
  996. .maxlen = NUMA_ZONELIST_ORDER_LEN,
  997. .mode = 0644,
  998. .proc_handler = &numa_zonelist_order_handler,
  999. .strategy = &sysctl_string,
  1000. },
  1001. #endif
  1002. #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
  1003. (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
  1004. {
  1005. .ctl_name = VM_VDSO_ENABLED,
  1006. .procname = "vdso_enabled",
  1007. .data = &vdso_enabled,
  1008. .maxlen = sizeof(vdso_enabled),
  1009. .mode = 0644,
  1010. .proc_handler = &proc_dointvec,
  1011. .strategy = &sysctl_intvec,
  1012. .extra1 = &zero,
  1013. },
  1014. #endif
  1015. /*
  1016. * NOTE: do not add new entries to this table unless you have read
  1017. * Documentation/sysctl/ctl_unnumbered.txt
  1018. */
  1019. { .ctl_name = 0 }
  1020. };
  1021. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1022. static ctl_table binfmt_misc_table[] = {
  1023. { .ctl_name = 0 }
  1024. };
  1025. #endif
  1026. static ctl_table fs_table[] = {
  1027. {
  1028. .ctl_name = FS_NRINODE,
  1029. .procname = "inode-nr",
  1030. .data = &inodes_stat,
  1031. .maxlen = 2*sizeof(int),
  1032. .mode = 0444,
  1033. .proc_handler = &proc_dointvec,
  1034. },
  1035. {
  1036. .ctl_name = FS_STATINODE,
  1037. .procname = "inode-state",
  1038. .data = &inodes_stat,
  1039. .maxlen = 7*sizeof(int),
  1040. .mode = 0444,
  1041. .proc_handler = &proc_dointvec,
  1042. },
  1043. {
  1044. .ctl_name = FS_NRFILE,
  1045. .procname = "file-nr",
  1046. .data = &files_stat,
  1047. .maxlen = 3*sizeof(int),
  1048. .mode = 0444,
  1049. .proc_handler = &proc_nr_files,
  1050. },
  1051. {
  1052. .ctl_name = FS_MAXFILE,
  1053. .procname = "file-max",
  1054. .data = &files_stat.max_files,
  1055. .maxlen = sizeof(int),
  1056. .mode = 0644,
  1057. .proc_handler = &proc_dointvec,
  1058. },
  1059. {
  1060. .ctl_name = FS_DENTRY,
  1061. .procname = "dentry-state",
  1062. .data = &dentry_stat,
  1063. .maxlen = 6*sizeof(int),
  1064. .mode = 0444,
  1065. .proc_handler = &proc_dointvec,
  1066. },
  1067. {
  1068. .ctl_name = FS_OVERFLOWUID,
  1069. .procname = "overflowuid",
  1070. .data = &fs_overflowuid,
  1071. .maxlen = sizeof(int),
  1072. .mode = 0644,
  1073. .proc_handler = &proc_dointvec_minmax,
  1074. .strategy = &sysctl_intvec,
  1075. .extra1 = &minolduid,
  1076. .extra2 = &maxolduid,
  1077. },
  1078. {
  1079. .ctl_name = FS_OVERFLOWGID,
  1080. .procname = "overflowgid",
  1081. .data = &fs_overflowgid,
  1082. .maxlen = sizeof(int),
  1083. .mode = 0644,
  1084. .proc_handler = &proc_dointvec_minmax,
  1085. .strategy = &sysctl_intvec,
  1086. .extra1 = &minolduid,
  1087. .extra2 = &maxolduid,
  1088. },
  1089. {
  1090. .ctl_name = FS_LEASES,
  1091. .procname = "leases-enable",
  1092. .data = &leases_enable,
  1093. .maxlen = sizeof(int),
  1094. .mode = 0644,
  1095. .proc_handler = &proc_dointvec,
  1096. },
  1097. #ifdef CONFIG_DNOTIFY
  1098. {
  1099. .ctl_name = FS_DIR_NOTIFY,
  1100. .procname = "dir-notify-enable",
  1101. .data = &dir_notify_enable,
  1102. .maxlen = sizeof(int),
  1103. .mode = 0644,
  1104. .proc_handler = &proc_dointvec,
  1105. },
  1106. #endif
  1107. #ifdef CONFIG_MMU
  1108. {
  1109. .ctl_name = FS_LEASE_TIME,
  1110. .procname = "lease-break-time",
  1111. .data = &lease_break_time,
  1112. .maxlen = sizeof(int),
  1113. .mode = 0644,
  1114. .proc_handler = &proc_dointvec_minmax,
  1115. .strategy = &sysctl_intvec,
  1116. .extra1 = &zero,
  1117. .extra2 = &two,
  1118. },
  1119. {
  1120. .ctl_name = FS_AIO_NR,
  1121. .procname = "aio-nr",
  1122. .data = &aio_nr,
  1123. .maxlen = sizeof(aio_nr),
  1124. .mode = 0444,
  1125. .proc_handler = &proc_doulongvec_minmax,
  1126. },
  1127. {
  1128. .ctl_name = FS_AIO_MAX_NR,
  1129. .procname = "aio-max-nr",
  1130. .data = &aio_max_nr,
  1131. .maxlen = sizeof(aio_max_nr),
  1132. .mode = 0644,
  1133. .proc_handler = &proc_doulongvec_minmax,
  1134. },
  1135. #ifdef CONFIG_INOTIFY_USER
  1136. {
  1137. .ctl_name = FS_INOTIFY,
  1138. .procname = "inotify",
  1139. .mode = 0555,
  1140. .child = inotify_table,
  1141. },
  1142. #endif
  1143. #endif
  1144. {
  1145. .ctl_name = KERN_SETUID_DUMPABLE,
  1146. .procname = "suid_dumpable",
  1147. .data = &suid_dumpable,
  1148. .maxlen = sizeof(int),
  1149. .mode = 0644,
  1150. .proc_handler = &proc_dointvec,
  1151. },
  1152. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1153. {
  1154. .ctl_name = CTL_UNNUMBERED,
  1155. .procname = "binfmt_misc",
  1156. .mode = 0555,
  1157. .child = binfmt_misc_table,
  1158. },
  1159. #endif
  1160. /*
  1161. * NOTE: do not add new entries to this table unless you have read
  1162. * Documentation/sysctl/ctl_unnumbered.txt
  1163. */
  1164. { .ctl_name = 0 }
  1165. };
  1166. static ctl_table debug_table[] = {
  1167. #if defined(CONFIG_X86) || defined(CONFIG_PPC)
  1168. {
  1169. .ctl_name = CTL_UNNUMBERED,
  1170. .procname = "exception-trace",
  1171. .data = &show_unhandled_signals,
  1172. .maxlen = sizeof(int),
  1173. .mode = 0644,
  1174. .proc_handler = proc_dointvec
  1175. },
  1176. #endif
  1177. { .ctl_name = 0 }
  1178. };
  1179. static ctl_table dev_table[] = {
  1180. { .ctl_name = 0 }
  1181. };
  1182. static DEFINE_SPINLOCK(sysctl_lock);
  1183. /* called under sysctl_lock */
  1184. static int use_table(struct ctl_table_header *p)
  1185. {
  1186. if (unlikely(p->unregistering))
  1187. return 0;
  1188. p->used++;
  1189. return 1;
  1190. }
  1191. /* called under sysctl_lock */
  1192. static void unuse_table(struct ctl_table_header *p)
  1193. {
  1194. if (!--p->used)
  1195. if (unlikely(p->unregistering))
  1196. complete(p->unregistering);
  1197. }
  1198. /* called under sysctl_lock, will reacquire if has to wait */
  1199. static void start_unregistering(struct ctl_table_header *p)
  1200. {
  1201. /*
  1202. * if p->used is 0, nobody will ever touch that entry again;
  1203. * we'll eliminate all paths to it before dropping sysctl_lock
  1204. */
  1205. if (unlikely(p->used)) {
  1206. struct completion wait;
  1207. init_completion(&wait);
  1208. p->unregistering = &wait;
  1209. spin_unlock(&sysctl_lock);
  1210. wait_for_completion(&wait);
  1211. spin_lock(&sysctl_lock);
  1212. }
  1213. /*
  1214. * do not remove from the list until nobody holds it; walking the
  1215. * list in do_sysctl() relies on that.
  1216. */
  1217. list_del_init(&p->ctl_entry);
  1218. }
  1219. void sysctl_head_finish(struct ctl_table_header *head)
  1220. {
  1221. if (!head)
  1222. return;
  1223. spin_lock(&sysctl_lock);
  1224. unuse_table(head);
  1225. spin_unlock(&sysctl_lock);
  1226. }
  1227. struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
  1228. {
  1229. struct ctl_table_header *head;
  1230. struct list_head *tmp;
  1231. spin_lock(&sysctl_lock);
  1232. if (prev) {
  1233. tmp = &prev->ctl_entry;
  1234. unuse_table(prev);
  1235. goto next;
  1236. }
  1237. tmp = &root_table_header.ctl_entry;
  1238. for (;;) {
  1239. head = list_entry(tmp, struct ctl_table_header, ctl_entry);
  1240. if (!use_table(head))
  1241. goto next;
  1242. spin_unlock(&sysctl_lock);
  1243. return head;
  1244. next:
  1245. tmp = tmp->next;
  1246. if (tmp == &root_table_header.ctl_entry)
  1247. break;
  1248. }
  1249. spin_unlock(&sysctl_lock);
  1250. return NULL;
  1251. }
  1252. #ifdef CONFIG_SYSCTL_SYSCALL
  1253. int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
  1254. void __user *newval, size_t newlen)
  1255. {
  1256. struct ctl_table_header *head;
  1257. int error = -ENOTDIR;
  1258. if (nlen <= 0 || nlen >= CTL_MAXNAME)
  1259. return -ENOTDIR;
  1260. if (oldval) {
  1261. int old_len;
  1262. if (!oldlenp || get_user(old_len, oldlenp))
  1263. return -EFAULT;
  1264. }
  1265. for (head = sysctl_head_next(NULL); head;
  1266. head = sysctl_head_next(head)) {
  1267. error = parse_table(name, nlen, oldval, oldlenp,
  1268. newval, newlen, head->ctl_table);
  1269. if (error != -ENOTDIR) {
  1270. sysctl_head_finish(head);
  1271. break;
  1272. }
  1273. }
  1274. return error;
  1275. }
  1276. asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
  1277. {
  1278. struct __sysctl_args tmp;
  1279. int error;
  1280. if (copy_from_user(&tmp, args, sizeof(tmp)))
  1281. return -EFAULT;
  1282. lock_kernel();
  1283. error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
  1284. tmp.newval, tmp.newlen);
  1285. unlock_kernel();
  1286. return error;
  1287. }
  1288. #endif /* CONFIG_SYSCTL_SYSCALL */
  1289. /*
  1290. * sysctl_perm does NOT grant the superuser all rights automatically, because
  1291. * some sysctl variables are readonly even to root.
  1292. */
  1293. static int test_perm(int mode, int op)
  1294. {
  1295. if (!current->euid)
  1296. mode >>= 6;
  1297. else if (in_egroup_p(0))
  1298. mode >>= 3;
  1299. if ((mode & op & 0007) == op)
  1300. return 0;
  1301. return -EACCES;
  1302. }
  1303. int sysctl_perm(ctl_table *table, int op)
  1304. {
  1305. int error;
  1306. error = security_sysctl(table, op);
  1307. if (error)
  1308. return error;
  1309. return test_perm(table->mode, op);
  1310. }
  1311. #ifdef CONFIG_SYSCTL_SYSCALL
  1312. static int parse_table(int __user *name, int nlen,
  1313. void __user *oldval, size_t __user *oldlenp,
  1314. void __user *newval, size_t newlen,
  1315. ctl_table *table)
  1316. {
  1317. int n;
  1318. repeat:
  1319. if (!nlen)
  1320. return -ENOTDIR;
  1321. if (get_user(n, name))
  1322. return -EFAULT;
  1323. for ( ; table->ctl_name || table->procname; table++) {
  1324. if (!table->ctl_name)
  1325. continue;
  1326. if (n == table->ctl_name) {
  1327. int error;
  1328. if (table->child) {
  1329. if (sysctl_perm(table, 001))
  1330. return -EPERM;
  1331. name++;
  1332. nlen--;
  1333. table = table->child;
  1334. goto repeat;
  1335. }
  1336. error = do_sysctl_strategy(table, name, nlen,
  1337. oldval, oldlenp,
  1338. newval, newlen);
  1339. return error;
  1340. }
  1341. }
  1342. return -ENOTDIR;
  1343. }
  1344. /* Perform the actual read/write of a sysctl table entry. */
  1345. int do_sysctl_strategy (ctl_table *table,
  1346. int __user *name, int nlen,
  1347. void __user *oldval, size_t __user *oldlenp,
  1348. void __user *newval, size_t newlen)
  1349. {
  1350. int op = 0, rc;
  1351. size_t len;
  1352. if (oldval)
  1353. op |= 004;
  1354. if (newval)
  1355. op |= 002;
  1356. if (sysctl_perm(table, op))
  1357. return -EPERM;
  1358. if (table->strategy) {
  1359. rc = table->strategy(table, name, nlen, oldval, oldlenp,
  1360. newval, newlen);
  1361. if (rc < 0)
  1362. return rc;
  1363. if (rc > 0)
  1364. return 0;
  1365. }
  1366. /* If there is no strategy routine, or if the strategy returns
  1367. * zero, proceed with automatic r/w */
  1368. if (table->data && table->maxlen) {
  1369. if (oldval && oldlenp) {
  1370. if (get_user(len, oldlenp))
  1371. return -EFAULT;
  1372. if (len) {
  1373. if (len > table->maxlen)
  1374. len = table->maxlen;
  1375. if(copy_to_user(oldval, table->data, len))
  1376. return -EFAULT;
  1377. if(put_user(len, oldlenp))
  1378. return -EFAULT;
  1379. }
  1380. }
  1381. if (newval && newlen) {
  1382. len = newlen;
  1383. if (len > table->maxlen)
  1384. len = table->maxlen;
  1385. if(copy_from_user(table->data, newval, len))
  1386. return -EFAULT;
  1387. }
  1388. }
  1389. return 0;
  1390. }
  1391. #endif /* CONFIG_SYSCTL_SYSCALL */
  1392. static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
  1393. {
  1394. for (; table->ctl_name || table->procname; table++) {
  1395. table->parent = parent;
  1396. if (table->child)
  1397. sysctl_set_parent(table, table->child);
  1398. }
  1399. }
  1400. static __init int sysctl_init(void)
  1401. {
  1402. sysctl_set_parent(NULL, root_table);
  1403. return 0;
  1404. }
  1405. core_initcall(sysctl_init);
  1406. /**
  1407. * register_sysctl_table - register a sysctl hierarchy
  1408. * @table: the top-level table structure
  1409. *
  1410. * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  1411. * array. An entry with a ctl_name of 0 terminates the table.
  1412. *
  1413. * The members of the &ctl_table structure are used as follows:
  1414. *
  1415. * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
  1416. * must be unique within that level of sysctl
  1417. *
  1418. * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
  1419. * enter a sysctl file
  1420. *
  1421. * data - a pointer to data for use by proc_handler
  1422. *
  1423. * maxlen - the maximum size in bytes of the data
  1424. *
  1425. * mode - the file permissions for the /proc/sys file, and for sysctl(2)
  1426. *
  1427. * child - a pointer to the child sysctl table if this entry is a directory, or
  1428. * %NULL.
  1429. *
  1430. * proc_handler - the text handler routine (described below)
  1431. *
  1432. * strategy - the strategy routine (described below)
  1433. *
  1434. * de - for internal use by the sysctl routines
  1435. *
  1436. * extra1, extra2 - extra pointers usable by the proc handler routines
  1437. *
  1438. * Leaf nodes in the sysctl tree will be represented by a single file
  1439. * under /proc; non-leaf nodes will be represented by directories.
  1440. *
  1441. * sysctl(2) can automatically manage read and write requests through
  1442. * the sysctl table. The data and maxlen fields of the ctl_table
  1443. * struct enable minimal validation of the values being written to be
  1444. * performed, and the mode field allows minimal authentication.
  1445. *
  1446. * More sophisticated management can be enabled by the provision of a
  1447. * strategy routine with the table entry. This will be called before
  1448. * any automatic read or write of the data is performed.
  1449. *
  1450. * The strategy routine may return
  1451. *
  1452. * < 0 - Error occurred (error is passed to user process)
  1453. *
  1454. * 0 - OK - proceed with automatic read or write.
  1455. *
  1456. * > 0 - OK - read or write has been done by the strategy routine, so
  1457. * return immediately.
  1458. *
  1459. * There must be a proc_handler routine for any terminal nodes
  1460. * mirrored under /proc/sys (non-terminals are handled by a built-in
  1461. * directory handler). Several default handlers are available to
  1462. * cover common cases -
  1463. *
  1464. * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
  1465. * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
  1466. * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
  1467. *
  1468. * It is the handler's job to read the input buffer from user memory
  1469. * and process it. The handler should return 0 on success.
  1470. *
  1471. * This routine returns %NULL on a failure to register, and a pointer
  1472. * to the table header on success.
  1473. */
  1474. struct ctl_table_header *register_sysctl_table(ctl_table * table)
  1475. {
  1476. struct ctl_table_header *tmp;
  1477. tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
  1478. if (!tmp)
  1479. return NULL;
  1480. tmp->ctl_table = table;
  1481. INIT_LIST_HEAD(&tmp->ctl_entry);
  1482. tmp->used = 0;
  1483. tmp->unregistering = NULL;
  1484. sysctl_set_parent(NULL, table);
  1485. spin_lock(&sysctl_lock);
  1486. list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
  1487. spin_unlock(&sysctl_lock);
  1488. return tmp;
  1489. }
  1490. /**
  1491. * unregister_sysctl_table - unregister a sysctl table hierarchy
  1492. * @header: the header returned from register_sysctl_table
  1493. *
  1494. * Unregisters the sysctl table and all children. proc entries may not
  1495. * actually be removed until they are no longer used by anyone.
  1496. */
  1497. void unregister_sysctl_table(struct ctl_table_header * header)
  1498. {
  1499. might_sleep();
  1500. spin_lock(&sysctl_lock);
  1501. start_unregistering(header);
  1502. spin_unlock(&sysctl_lock);
  1503. kfree(header);
  1504. }
  1505. #else /* !CONFIG_SYSCTL */
  1506. struct ctl_table_header *register_sysctl_table(ctl_table * table)
  1507. {
  1508. return NULL;
  1509. }
  1510. void unregister_sysctl_table(struct ctl_table_header * table)
  1511. {
  1512. }
  1513. #endif /* CONFIG_SYSCTL */
  1514. /*
  1515. * /proc/sys support
  1516. */
  1517. #ifdef CONFIG_PROC_SYSCTL
  1518. static int _proc_do_string(void* data, int maxlen, int write,
  1519. struct file *filp, void __user *buffer,
  1520. size_t *lenp, loff_t *ppos)
  1521. {
  1522. size_t len;
  1523. char __user *p;
  1524. char c;
  1525. if (!data || !maxlen || !*lenp) {
  1526. *lenp = 0;
  1527. return 0;
  1528. }
  1529. if (write) {
  1530. len = 0;
  1531. p = buffer;
  1532. while (len < *lenp) {
  1533. if (get_user(c, p++))
  1534. return -EFAULT;
  1535. if (c == 0 || c == '\n')
  1536. break;
  1537. len++;
  1538. }
  1539. if (len >= maxlen)
  1540. len = maxlen-1;
  1541. if(copy_from_user(data, buffer, len))
  1542. return -EFAULT;
  1543. ((char *) data)[len] = 0;
  1544. *ppos += *lenp;
  1545. } else {
  1546. len = strlen(data);
  1547. if (len > maxlen)
  1548. len = maxlen;
  1549. if (*ppos > len) {
  1550. *lenp = 0;
  1551. return 0;
  1552. }
  1553. data += *ppos;
  1554. len -= *ppos;
  1555. if (len > *lenp)
  1556. len = *lenp;
  1557. if (len)
  1558. if(copy_to_user(buffer, data, len))
  1559. return -EFAULT;
  1560. if (len < *lenp) {
  1561. if(put_user('\n', ((char __user *) buffer) + len))
  1562. return -EFAULT;
  1563. len++;
  1564. }
  1565. *lenp = len;
  1566. *ppos += len;
  1567. }
  1568. return 0;
  1569. }
  1570. /**
  1571. * proc_dostring - read a string sysctl
  1572. * @table: the sysctl table
  1573. * @write: %TRUE if this is a write to the sysctl file
  1574. * @filp: the file structure
  1575. * @buffer: the user buffer
  1576. * @lenp: the size of the user buffer
  1577. * @ppos: file position
  1578. *
  1579. * Reads/writes a string from/to the user buffer. If the kernel
  1580. * buffer provided is not large enough to hold the string, the
  1581. * string is truncated. The copied string is %NULL-terminated.
  1582. * If the string is being read by the user process, it is copied
  1583. * and a newline '\n' is added. It is truncated if the buffer is
  1584. * not large enough.
  1585. *
  1586. * Returns 0 on success.
  1587. */
  1588. int proc_dostring(ctl_table *table, int write, struct file *filp,
  1589. void __user *buffer, size_t *lenp, loff_t *ppos)
  1590. {
  1591. return _proc_do_string(table->data, table->maxlen, write, filp,
  1592. buffer, lenp, ppos);
  1593. }
  1594. static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
  1595. int *valp,
  1596. int write, void *data)
  1597. {
  1598. if (write) {
  1599. *valp = *negp ? -*lvalp : *lvalp;
  1600. } else {
  1601. int val = *valp;
  1602. if (val < 0) {
  1603. *negp = -1;
  1604. *lvalp = (unsigned long)-val;
  1605. } else {
  1606. *negp = 0;
  1607. *lvalp = (unsigned long)val;
  1608. }
  1609. }
  1610. return 0;
  1611. }
  1612. static int __do_proc_dointvec(void *tbl_data, ctl_table *table,
  1613. int write, struct file *filp, void __user *buffer,
  1614. size_t *lenp, loff_t *ppos,
  1615. int (*conv)(int *negp, unsigned long *lvalp, int *valp,
  1616. int write, void *data),
  1617. void *data)
  1618. {
  1619. #define TMPBUFLEN 21
  1620. int *i, vleft, first=1, neg, val;
  1621. unsigned long lval;
  1622. size_t left, len;
  1623. char buf[TMPBUFLEN], *p;
  1624. char __user *s = buffer;
  1625. if (!tbl_data || !table->maxlen || !*lenp ||
  1626. (*ppos && !write)) {
  1627. *lenp = 0;
  1628. return 0;
  1629. }
  1630. i = (int *) tbl_data;
  1631. vleft = table->maxlen / sizeof(*i);
  1632. left = *lenp;
  1633. if (!conv)
  1634. conv = do_proc_dointvec_conv;
  1635. for (; left && vleft--; i++, first=0) {
  1636. if (write) {
  1637. while (left) {
  1638. char c;
  1639. if (get_user(c, s))
  1640. return -EFAULT;
  1641. if (!isspace(c))
  1642. break;
  1643. left--;
  1644. s++;
  1645. }
  1646. if (!left)
  1647. break;
  1648. neg = 0;
  1649. len = left;
  1650. if (len > sizeof(buf) - 1)
  1651. len = sizeof(buf) - 1;
  1652. if (copy_from_user(buf, s, len))
  1653. return -EFAULT;
  1654. buf[len] = 0;
  1655. p = buf;
  1656. if (*p == '-' && left > 1) {
  1657. neg = 1;
  1658. p++;
  1659. }
  1660. if (*p < '0' || *p > '9')
  1661. break;
  1662. lval = simple_strtoul(p, &p, 0);
  1663. len = p-buf;
  1664. if ((len < left) && *p && !isspace(*p))
  1665. break;
  1666. if (neg)
  1667. val = -val;
  1668. s += len;
  1669. left -= len;
  1670. if (conv(&neg, &lval, i, 1, data))
  1671. break;
  1672. } else {
  1673. p = buf;
  1674. if (!first)
  1675. *p++ = '\t';
  1676. if (conv(&neg, &lval, i, 0, data))
  1677. break;
  1678. sprintf(p, "%s%lu", neg ? "-" : "", lval);
  1679. len = strlen(buf);
  1680. if (len > left)
  1681. len = left;
  1682. if(copy_to_user(s, buf, len))
  1683. return -EFAULT;
  1684. left -= len;
  1685. s += len;
  1686. }
  1687. }
  1688. if (!write && !first && left) {
  1689. if(put_user('\n', s))
  1690. return -EFAULT;
  1691. left--, s++;
  1692. }
  1693. if (write) {
  1694. while (left) {
  1695. char c;
  1696. if (get_user(c, s++))
  1697. return -EFAULT;
  1698. if (!isspace(c))
  1699. break;
  1700. left--;
  1701. }
  1702. }
  1703. if (write && first)
  1704. return -EINVAL;
  1705. *lenp -= left;
  1706. *ppos += *lenp;
  1707. return 0;
  1708. #undef TMPBUFLEN
  1709. }
  1710. static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
  1711. void __user *buffer, size_t *lenp, loff_t *ppos,
  1712. int (*conv)(int *negp, unsigned long *lvalp, int *valp,
  1713. int write, void *data),
  1714. void *data)
  1715. {
  1716. return __do_proc_dointvec(table->data, table, write, filp,
  1717. buffer, lenp, ppos, conv, data);
  1718. }
  1719. /**
  1720. * proc_dointvec - read a vector of integers
  1721. * @table: the sysctl table
  1722. * @write: %TRUE if this is a write to the sysctl file
  1723. * @filp: the file structure
  1724. * @buffer: the user buffer
  1725. * @lenp: the size of the user buffer
  1726. * @ppos: file position
  1727. *
  1728. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  1729. * values from/to the user buffer, treated as an ASCII string.
  1730. *
  1731. * Returns 0 on success.
  1732. */
  1733. int proc_dointvec(ctl_table *table, int write, struct file *filp,
  1734. void __user *buffer, size_t *lenp, loff_t *ppos)
  1735. {
  1736. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1737. NULL,NULL);
  1738. }
  1739. #define OP_SET 0
  1740. #define OP_AND 1
  1741. #define OP_OR 2
  1742. static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
  1743. int *valp,
  1744. int write, void *data)
  1745. {
  1746. int op = *(int *)data;
  1747. if (write) {
  1748. int val = *negp ? -*lvalp : *lvalp;
  1749. switch(op) {
  1750. case OP_SET: *valp = val; break;
  1751. case OP_AND: *valp &= val; break;
  1752. case OP_OR: *valp |= val; break;
  1753. }
  1754. } else {
  1755. int val = *valp;
  1756. if (val < 0) {
  1757. *negp = -1;
  1758. *lvalp = (unsigned long)-val;
  1759. } else {
  1760. *negp = 0;
  1761. *lvalp = (unsigned long)val;
  1762. }
  1763. }
  1764. return 0;
  1765. }
  1766. /*
  1767. * init may raise the set.
  1768. */
  1769. int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
  1770. void __user *buffer, size_t *lenp, loff_t *ppos)
  1771. {
  1772. int op;
  1773. if (write && !capable(CAP_SYS_MODULE)) {
  1774. return -EPERM;
  1775. }
  1776. op = is_init(current) ? OP_SET : OP_AND;
  1777. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1778. do_proc_dointvec_bset_conv,&op);
  1779. }
  1780. /*
  1781. * Taint values can only be increased
  1782. */
  1783. static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
  1784. void __user *buffer, size_t *lenp, loff_t *ppos)
  1785. {
  1786. int op;
  1787. if (write && !capable(CAP_SYS_ADMIN))
  1788. return -EPERM;
  1789. op = OP_OR;
  1790. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1791. do_proc_dointvec_bset_conv,&op);
  1792. }
  1793. struct do_proc_dointvec_minmax_conv_param {
  1794. int *min;
  1795. int *max;
  1796. };
  1797. static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
  1798. int *valp,
  1799. int write, void *data)
  1800. {
  1801. struct do_proc_dointvec_minmax_conv_param *param = data;
  1802. if (write) {
  1803. int val = *negp ? -*lvalp : *lvalp;
  1804. if ((param->min && *param->min > val) ||
  1805. (param->max && *param->max < val))
  1806. return -EINVAL;
  1807. *valp = val;
  1808. } else {
  1809. int val = *valp;
  1810. if (val < 0) {
  1811. *negp = -1;
  1812. *lvalp = (unsigned long)-val;
  1813. } else {
  1814. *negp = 0;
  1815. *lvalp = (unsigned long)val;
  1816. }
  1817. }
  1818. return 0;
  1819. }
  1820. /**
  1821. * proc_dointvec_minmax - read a vector of integers with min/max values
  1822. * @table: the sysctl table
  1823. * @write: %TRUE if this is a write to the sysctl file
  1824. * @filp: the file structure
  1825. * @buffer: the user buffer
  1826. * @lenp: the size of the user buffer
  1827. * @ppos: file position
  1828. *
  1829. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  1830. * values from/to the user buffer, treated as an ASCII string.
  1831. *
  1832. * This routine will ensure the values are within the range specified by
  1833. * table->extra1 (min) and table->extra2 (max).
  1834. *
  1835. * Returns 0 on success.
  1836. */
  1837. int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
  1838. void __user *buffer, size_t *lenp, loff_t *ppos)
  1839. {
  1840. struct do_proc_dointvec_minmax_conv_param param = {
  1841. .min = (int *) table->extra1,
  1842. .max = (int *) table->extra2,
  1843. };
  1844. return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
  1845. do_proc_dointvec_minmax_conv, &param);
  1846. }
  1847. static int __do_proc_doulongvec_minmax(void *data, ctl_table *table, int write,
  1848. struct file *filp,
  1849. void __user *buffer,
  1850. size_t *lenp, loff_t *ppos,
  1851. unsigned long convmul,
  1852. unsigned long convdiv)
  1853. {
  1854. #define TMPBUFLEN 21
  1855. unsigned long *i, *min, *max, val;
  1856. int vleft, first=1, neg;
  1857. size_t len, left;
  1858. char buf[TMPBUFLEN], *p;
  1859. char __user *s = buffer;
  1860. if (!data || !table->maxlen || !*lenp ||
  1861. (*ppos && !write)) {
  1862. *lenp = 0;
  1863. return 0;
  1864. }
  1865. i = (unsigned long *) data;
  1866. min = (unsigned long *) table->extra1;
  1867. max = (unsigned long *) table->extra2;
  1868. vleft = table->maxlen / sizeof(unsigned long);
  1869. left = *lenp;
  1870. for (; left && vleft--; i++, min++, max++, first=0) {
  1871. if (write) {
  1872. while (left) {
  1873. char c;
  1874. if (get_user(c, s))
  1875. return -EFAULT;
  1876. if (!isspace(c))
  1877. break;
  1878. left--;
  1879. s++;
  1880. }
  1881. if (!left)
  1882. break;
  1883. neg = 0;
  1884. len = left;
  1885. if (len > TMPBUFLEN-1)
  1886. len = TMPBUFLEN-1;
  1887. if (copy_from_user(buf, s, len))
  1888. return -EFAULT;
  1889. buf[len] = 0;
  1890. p = buf;
  1891. if (*p == '-' && left > 1) {
  1892. neg = 1;
  1893. p++;
  1894. }
  1895. if (*p < '0' || *p > '9')
  1896. break;
  1897. val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
  1898. len = p-buf;
  1899. if ((len < left) && *p && !isspace(*p))
  1900. break;
  1901. if (neg)
  1902. val = -val;
  1903. s += len;
  1904. left -= len;
  1905. if(neg)
  1906. continue;
  1907. if ((min && val < *min) || (max && val > *max))
  1908. continue;
  1909. *i = val;
  1910. } else {
  1911. p = buf;
  1912. if (!first)
  1913. *p++ = '\t';
  1914. sprintf(p, "%lu", convdiv * (*i) / convmul);
  1915. len = strlen(buf);
  1916. if (len > left)
  1917. len = left;
  1918. if(copy_to_user(s, buf, len))
  1919. return -EFAULT;
  1920. left -= len;
  1921. s += len;
  1922. }
  1923. }
  1924. if (!write && !first && left) {
  1925. if(put_user('\n', s))
  1926. return -EFAULT;
  1927. left--, s++;
  1928. }
  1929. if (write) {
  1930. while (left) {
  1931. char c;
  1932. if (get_user(c, s++))
  1933. return -EFAULT;
  1934. if (!isspace(c))
  1935. break;
  1936. left--;
  1937. }
  1938. }
  1939. if (write && first)
  1940. return -EINVAL;
  1941. *lenp -= left;
  1942. *ppos += *lenp;
  1943. return 0;
  1944. #undef TMPBUFLEN
  1945. }
  1946. static int do_proc_doulongvec_minmax(ctl_table *table, int write,
  1947. struct file *filp,
  1948. void __user *buffer,
  1949. size_t *lenp, loff_t *ppos,
  1950. unsigned long convmul,
  1951. unsigned long convdiv)
  1952. {
  1953. return __do_proc_doulongvec_minmax(table->data, table, write,
  1954. filp, buffer, lenp, ppos, convmul, convdiv);
  1955. }
  1956. /**
  1957. * proc_doulongvec_minmax - read a vector of long integers with min/max values
  1958. * @table: the sysctl table
  1959. * @write: %TRUE if this is a write to the sysctl file
  1960. * @filp: the file structure
  1961. * @buffer: the user buffer
  1962. * @lenp: the size of the user buffer
  1963. * @ppos: file position
  1964. *
  1965. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  1966. * values from/to the user buffer, treated as an ASCII string.
  1967. *
  1968. * This routine will ensure the values are within the range specified by
  1969. * table->extra1 (min) and table->extra2 (max).
  1970. *
  1971. * Returns 0 on success.
  1972. */
  1973. int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
  1974. void __user *buffer, size_t *lenp, loff_t *ppos)
  1975. {
  1976. return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
  1977. }
  1978. /**
  1979. * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
  1980. * @table: the sysctl table
  1981. * @write: %TRUE if this is a write to the sysctl file
  1982. * @filp: the file structure
  1983. * @buffer: the user buffer
  1984. * @lenp: the size of the user buffer
  1985. * @ppos: file position
  1986. *
  1987. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  1988. * values from/to the user buffer, treated as an ASCII string. The values
  1989. * are treated as milliseconds, and converted to jiffies when they are stored.
  1990. *
  1991. * This routine will ensure the values are within the range specified by
  1992. * table->extra1 (min) and table->extra2 (max).
  1993. *
  1994. * Returns 0 on success.
  1995. */
  1996. int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
  1997. struct file *filp,
  1998. void __user *buffer,
  1999. size_t *lenp, loff_t *ppos)
  2000. {
  2001. return do_proc_doulongvec_minmax(table, write, filp, buffer,
  2002. lenp, ppos, HZ, 1000l);
  2003. }
  2004. static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
  2005. int *valp,
  2006. int write, void *data)
  2007. {
  2008. if (write) {
  2009. if (*lvalp > LONG_MAX / HZ)
  2010. return 1;
  2011. *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
  2012. } else {
  2013. int val = *valp;
  2014. unsigned long lval;
  2015. if (val < 0) {
  2016. *negp = -1;
  2017. lval = (unsigned long)-val;
  2018. } else {
  2019. *negp = 0;
  2020. lval = (unsigned long)val;
  2021. }
  2022. *lvalp = lval / HZ;
  2023. }
  2024. return 0;
  2025. }
  2026. static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
  2027. int *valp,
  2028. int write, void *data)
  2029. {
  2030. if (write) {
  2031. if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
  2032. return 1;
  2033. *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
  2034. } else {
  2035. int val = *valp;
  2036. unsigned long lval;
  2037. if (val < 0) {
  2038. *negp = -1;
  2039. lval = (unsigned long)-val;
  2040. } else {
  2041. *negp = 0;
  2042. lval = (unsigned long)val;
  2043. }
  2044. *lvalp = jiffies_to_clock_t(lval);
  2045. }
  2046. return 0;
  2047. }
  2048. static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
  2049. int *valp,
  2050. int write, void *data)
  2051. {
  2052. if (write) {
  2053. *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
  2054. } else {
  2055. int val = *valp;
  2056. unsigned long lval;
  2057. if (val < 0) {
  2058. *negp = -1;
  2059. lval = (unsigned long)-val;
  2060. } else {
  2061. *negp = 0;
  2062. lval = (unsigned long)val;
  2063. }
  2064. *lvalp = jiffies_to_msecs(lval);
  2065. }
  2066. return 0;
  2067. }
  2068. /**
  2069. * proc_dointvec_jiffies - read a vector of integers as seconds
  2070. * @table: the sysctl table
  2071. * @write: %TRUE if this is a write to the sysctl file
  2072. * @filp: the file structure
  2073. * @buffer: the user buffer
  2074. * @lenp: the size of the user buffer
  2075. * @ppos: file position
  2076. *
  2077. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2078. * values from/to the user buffer, treated as an ASCII string.
  2079. * The values read are assumed to be in seconds, and are converted into
  2080. * jiffies.
  2081. *
  2082. * Returns 0 on success.
  2083. */
  2084. int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
  2085. void __user *buffer, size_t *lenp, loff_t *ppos)
  2086. {
  2087. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2088. do_proc_dointvec_jiffies_conv,NULL);
  2089. }
  2090. /**
  2091. * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
  2092. * @table: the sysctl table
  2093. * @write: %TRUE if this is a write to the sysctl file
  2094. * @filp: the file structure
  2095. * @buffer: the user buffer
  2096. * @lenp: the size of the user buffer
  2097. * @ppos: pointer to the file position
  2098. *
  2099. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2100. * values from/to the user buffer, treated as an ASCII string.
  2101. * The values read are assumed to be in 1/USER_HZ seconds, and
  2102. * are converted into jiffies.
  2103. *
  2104. * Returns 0 on success.
  2105. */
  2106. int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
  2107. void __user *buffer, size_t *lenp, loff_t *ppos)
  2108. {
  2109. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2110. do_proc_dointvec_userhz_jiffies_conv,NULL);
  2111. }
  2112. /**
  2113. * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
  2114. * @table: the sysctl table
  2115. * @write: %TRUE if this is a write to the sysctl file
  2116. * @filp: the file structure
  2117. * @buffer: the user buffer
  2118. * @lenp: the size of the user buffer
  2119. * @ppos: file position
  2120. * @ppos: the current position in the file
  2121. *
  2122. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2123. * values from/to the user buffer, treated as an ASCII string.
  2124. * The values read are assumed to be in 1/1000 seconds, and
  2125. * are converted into jiffies.
  2126. *
  2127. * Returns 0 on success.
  2128. */
  2129. int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
  2130. void __user *buffer, size_t *lenp, loff_t *ppos)
  2131. {
  2132. return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
  2133. do_proc_dointvec_ms_jiffies_conv, NULL);
  2134. }
  2135. static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
  2136. void __user *buffer, size_t *lenp, loff_t *ppos)
  2137. {
  2138. struct pid *new_pid;
  2139. pid_t tmp;
  2140. int r;
  2141. tmp = pid_nr(cad_pid);
  2142. r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
  2143. lenp, ppos, NULL, NULL);
  2144. if (r || !write)
  2145. return r;
  2146. new_pid = find_get_pid(tmp);
  2147. if (!new_pid)
  2148. return -ESRCH;
  2149. put_pid(xchg(&cad_pid, new_pid));
  2150. return 0;
  2151. }
  2152. #else /* CONFIG_PROC_FS */
  2153. int proc_dostring(ctl_table *table, int write, struct file *filp,
  2154. void __user *buffer, size_t *lenp, loff_t *ppos)
  2155. {
  2156. return -ENOSYS;
  2157. }
  2158. int proc_dointvec(ctl_table *table, int write, struct file *filp,
  2159. void __user *buffer, size_t *lenp, loff_t *ppos)
  2160. {
  2161. return -ENOSYS;
  2162. }
  2163. int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
  2164. void __user *buffer, size_t *lenp, loff_t *ppos)
  2165. {
  2166. return -ENOSYS;
  2167. }
  2168. int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
  2169. void __user *buffer, size_t *lenp, loff_t *ppos)
  2170. {
  2171. return -ENOSYS;
  2172. }
  2173. int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
  2174. void __user *buffer, size_t *lenp, loff_t *ppos)
  2175. {
  2176. return -ENOSYS;
  2177. }
  2178. int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
  2179. void __user *buffer, size_t *lenp, loff_t *ppos)
  2180. {
  2181. return -ENOSYS;
  2182. }
  2183. int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
  2184. void __user *buffer, size_t *lenp, loff_t *ppos)
  2185. {
  2186. return -ENOSYS;
  2187. }
  2188. int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
  2189. void __user *buffer, size_t *lenp, loff_t *ppos)
  2190. {
  2191. return -ENOSYS;
  2192. }
  2193. int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
  2194. struct file *filp,
  2195. void __user *buffer,
  2196. size_t *lenp, loff_t *ppos)
  2197. {
  2198. return -ENOSYS;
  2199. }
  2200. #endif /* CONFIG_PROC_FS */
  2201. #ifdef CONFIG_SYSCTL_SYSCALL
  2202. /*
  2203. * General sysctl support routines
  2204. */
  2205. /* The generic string strategy routine: */
  2206. int sysctl_string(ctl_table *table, int __user *name, int nlen,
  2207. void __user *oldval, size_t __user *oldlenp,
  2208. void __user *newval, size_t newlen)
  2209. {
  2210. if (!table->data || !table->maxlen)
  2211. return -ENOTDIR;
  2212. if (oldval && oldlenp) {
  2213. size_t bufsize;
  2214. if (get_user(bufsize, oldlenp))
  2215. return -EFAULT;
  2216. if (bufsize) {
  2217. size_t len = strlen(table->data), copied;
  2218. /* This shouldn't trigger for a well-formed sysctl */
  2219. if (len > table->maxlen)
  2220. len = table->maxlen;
  2221. /* Copy up to a max of bufsize-1 bytes of the string */
  2222. copied = (len >= bufsize) ? bufsize - 1 : len;
  2223. if (copy_to_user(oldval, table->data, copied) ||
  2224. put_user(0, (char __user *)(oldval + copied)))
  2225. return -EFAULT;
  2226. if (put_user(len, oldlenp))
  2227. return -EFAULT;
  2228. }
  2229. }
  2230. if (newval && newlen) {
  2231. size_t len = newlen;
  2232. if (len > table->maxlen)
  2233. len = table->maxlen;
  2234. if(copy_from_user(table->data, newval, len))
  2235. return -EFAULT;
  2236. if (len == table->maxlen)
  2237. len--;
  2238. ((char *) table->data)[len] = 0;
  2239. }
  2240. return 1;
  2241. }
  2242. /*
  2243. * This function makes sure that all of the integers in the vector
  2244. * are between the minimum and maximum values given in the arrays
  2245. * table->extra1 and table->extra2, respectively.
  2246. */
  2247. int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
  2248. void __user *oldval, size_t __user *oldlenp,
  2249. void __user *newval, size_t newlen)
  2250. {
  2251. if (newval && newlen) {
  2252. int __user *vec = (int __user *) newval;
  2253. int *min = (int *) table->extra1;
  2254. int *max = (int *) table->extra2;
  2255. size_t length;
  2256. int i;
  2257. if (newlen % sizeof(int) != 0)
  2258. return -EINVAL;
  2259. if (!table->extra1 && !table->extra2)
  2260. return 0;
  2261. if (newlen > table->maxlen)
  2262. newlen = table->maxlen;
  2263. length = newlen / sizeof(int);
  2264. for (i = 0; i < length; i++) {
  2265. int value;
  2266. if (get_user(value, vec + i))
  2267. return -EFAULT;
  2268. if (min && value < min[i])
  2269. return -EINVAL;
  2270. if (max && value > max[i])
  2271. return -EINVAL;
  2272. }
  2273. }
  2274. return 0;
  2275. }
  2276. /* Strategy function to convert jiffies to seconds */
  2277. int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
  2278. void __user *oldval, size_t __user *oldlenp,
  2279. void __user *newval, size_t newlen)
  2280. {
  2281. if (oldval && oldlenp) {
  2282. size_t olen;
  2283. if (get_user(olen, oldlenp))
  2284. return -EFAULT;
  2285. if (olen) {
  2286. int val;
  2287. if (olen < sizeof(int))
  2288. return -EINVAL;
  2289. val = *(int *)(table->data) / HZ;
  2290. if (put_user(val, (int __user *)oldval))
  2291. return -EFAULT;
  2292. if (put_user(sizeof(int), oldlenp))
  2293. return -EFAULT;
  2294. }
  2295. }
  2296. if (newval && newlen) {
  2297. int new;
  2298. if (newlen != sizeof(int))
  2299. return -EINVAL;
  2300. if (get_user(new, (int __user *)newval))
  2301. return -EFAULT;
  2302. *(int *)(table->data) = new*HZ;
  2303. }
  2304. return 1;
  2305. }
  2306. /* Strategy function to convert jiffies to seconds */
  2307. int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
  2308. void __user *oldval, size_t __user *oldlenp,
  2309. void __user *newval, size_t newlen)
  2310. {
  2311. if (oldval && oldlenp) {
  2312. size_t olen;
  2313. if (get_user(olen, oldlenp))
  2314. return -EFAULT;
  2315. if (olen) {
  2316. int val;
  2317. if (olen < sizeof(int))
  2318. return -EINVAL;
  2319. val = jiffies_to_msecs(*(int *)(table->data));
  2320. if (put_user(val, (int __user *)oldval))
  2321. return -EFAULT;
  2322. if (put_user(sizeof(int), oldlenp))
  2323. return -EFAULT;
  2324. }
  2325. }
  2326. if (newval && newlen) {
  2327. int new;
  2328. if (newlen != sizeof(int))
  2329. return -EINVAL;
  2330. if (get_user(new, (int __user *)newval))
  2331. return -EFAULT;
  2332. *(int *)(table->data) = msecs_to_jiffies(new);
  2333. }
  2334. return 1;
  2335. }
  2336. #else /* CONFIG_SYSCTL_SYSCALL */
  2337. asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
  2338. {
  2339. static int msg_count;
  2340. struct __sysctl_args tmp;
  2341. int name[CTL_MAXNAME];
  2342. int i;
  2343. /* Read in the sysctl name for better debug message logging */
  2344. if (copy_from_user(&tmp, args, sizeof(tmp)))
  2345. return -EFAULT;
  2346. if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME)
  2347. return -ENOTDIR;
  2348. for (i = 0; i < tmp.nlen; i++)
  2349. if (get_user(name[i], tmp.name + i))
  2350. return -EFAULT;
  2351. /* Ignore accesses to kernel.version */
  2352. if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
  2353. goto out;
  2354. if (msg_count < 5) {
  2355. msg_count++;
  2356. printk(KERN_INFO
  2357. "warning: process `%s' used the removed sysctl "
  2358. "system call with ", current->comm);
  2359. for (i = 0; i < tmp.nlen; i++)
  2360. printk("%d.", name[i]);
  2361. printk("\n");
  2362. }
  2363. out:
  2364. return -ENOSYS;
  2365. }
  2366. int sysctl_string(ctl_table *table, int __user *name, int nlen,
  2367. void __user *oldval, size_t __user *oldlenp,
  2368. void __user *newval, size_t newlen)
  2369. {
  2370. return -ENOSYS;
  2371. }
  2372. int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
  2373. void __user *oldval, size_t __user *oldlenp,
  2374. void __user *newval, size_t newlen)
  2375. {
  2376. return -ENOSYS;
  2377. }
  2378. int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
  2379. void __user *oldval, size_t __user *oldlenp,
  2380. void __user *newval, size_t newlen)
  2381. {
  2382. return -ENOSYS;
  2383. }
  2384. int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
  2385. void __user *oldval, size_t __user *oldlenp,
  2386. void __user *newval, size_t newlen)
  2387. {
  2388. return -ENOSYS;
  2389. }
  2390. #endif /* CONFIG_SYSCTL_SYSCALL */
  2391. /*
  2392. * No sense putting this after each symbol definition, twice,
  2393. * exception granted :-)
  2394. */
  2395. EXPORT_SYMBOL(proc_dointvec);
  2396. EXPORT_SYMBOL(proc_dointvec_jiffies);
  2397. EXPORT_SYMBOL(proc_dointvec_minmax);
  2398. EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
  2399. EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
  2400. EXPORT_SYMBOL(proc_dostring);
  2401. EXPORT_SYMBOL(proc_doulongvec_minmax);
  2402. EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
  2403. EXPORT_SYMBOL(register_sysctl_table);
  2404. EXPORT_SYMBOL(sysctl_intvec);
  2405. EXPORT_SYMBOL(sysctl_jiffies);
  2406. EXPORT_SYMBOL(sysctl_ms_jiffies);
  2407. EXPORT_SYMBOL(sysctl_string);
  2408. EXPORT_SYMBOL(unregister_sysctl_table);