Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/procps/sysctl.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/procps/sysctl.c
r2725 r3232 12 12 */ 13 13 14 //usage:#define sysctl_trivial_usage 15 //usage: "[OPTIONS] [KEY[=VALUE]]..." 16 //usage:#define sysctl_full_usage "\n\n" 17 //usage: "Show/set kernel parameters\n" 18 //usage: "\n -e Don't warn about unknown keys" 19 //usage: "\n -n Don't show key names" 20 //usage: "\n -a Show all values" 21 /* Same as -a, no need to show it */ 22 /* //usage: "\n -A Show all values in table form" */ 23 //usage: "\n -w Set values" 24 //usage: "\n -p FILE Set values from FILE (default /etc/sysctl.conf)" 25 //usage: "\n -q Set values silently" 26 //usage: 27 //usage:#define sysctl_example_usage 28 //usage: "sysctl [-n] [-e] variable...\n" 29 //usage: "sysctl [-n] [-e] [-q] -w variable=value...\n" 30 //usage: "sysctl [-n] [-e] -a\n" 31 //usage: "sysctl [-n] [-e] [-q] -p file (default /etc/sysctl.conf)\n" 32 //usage: "sysctl [-n] [-e] -A\n" 33 14 34 #include "libbb.h" 15 35 … … 20 40 FLAG_SHOW_ALL = 1 << 3, 21 41 FLAG_PRELOAD_FILE = 1 << 4, 42 /* TODO: procps 3.2.8 seems to not require -w for KEY=VAL to work: */ 22 43 FLAG_WRITE = 1 << 5, 44 FLAG_QUIET = 1 << 6, 23 45 }; 24 #define OPTION_STR "neAapw "46 #define OPTION_STR "neAapwq" 25 47 26 48 static void sysctl_dots_to_slashes(char *name) … … 127 149 xwrite_str(fd, value); 128 150 close(fd); 129 if (option_mask32 & FLAG_SHOW_KEYS) 130 printf("%s = ", outname); 131 puts(value); 151 if (!(option_mask32 & FLAG_QUIET)) { 152 if (option_mask32 & FLAG_SHOW_KEYS) 153 printf("%s = ", outname); 154 puts(value); 155 } 132 156 } else { 133 157 char c; … … 182 206 /* if path was ".", drop "./" prefix: */ 183 207 retval |= sysctl_act_recursive((next[0] == '.' && next[1] == '/') ? 184 208 next + 2 : next); 185 209 free(next); 186 210 } … … 207 231 /* Must do it _after_ config_open(): */ 208 232 xchdir("/proc/sys"); 209 /* xchroot(" .") - if you are paranoid */233 /* xchroot("/proc/sys") - if you are paranoid */ 210 234 211 235 //TODO: ';' is comment char too … … 243 267 } 244 268 xchdir("/proc/sys"); 245 /* xchroot(" .") - if you are paranoid */269 /* xchroot("/proc/sys") - if you are paranoid */ 246 270 if (opt & (FLAG_TABLE_FORMAT | FLAG_SHOW_ALL)) { 247 271 return sysctl_act_recursive(".");
Note:
See TracChangeset
for help on using the changeset viewer.