aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2016-11-29 11:26:45 +0000
committerRon Yorston <rmy@pobox.com>2016-11-29 11:26:45 +0000
commitbb8d79eadbba1942dbdb9f9cee5c47833afe269f (patch)
treeb8c517e9ca895d60d7227aef7177b6291df5e2cd /util-linux
parent9fa1e4990e655a85025c9d270a1606983e375e47 (diff)
parent7d877fc9312a742b06125927bb1d34bd35398c6c (diff)
downloadbusybox-w32-bb8d79eadbba1942dbdb9f9cee5c47833afe269f.tar.gz
busybox-w32-bb8d79eadbba1942dbdb9f9cee5c47833afe269f.tar.bz2
busybox-w32-bb8d79eadbba1942dbdb9f9cee5c47833afe269f.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/Config.src547
-rw-r--r--util-linux/Kbuild.src36
-rw-r--r--util-linux/acpid.c26
-rw-r--r--util-linux/blkdiscard.c1
-rw-r--r--util-linux/blkid.c20
-rw-r--r--util-linux/blockdev.c9
-rw-r--r--util-linux/dmesg.c37
-rw-r--r--util-linux/fatattr.c1
-rw-r--r--util-linux/fbset.c32
-rw-r--r--util-linux/fdformat.c10
-rw-r--r--util-linux/fdisk.c81
-rw-r--r--util-linux/fdisk_gpt.c56
-rw-r--r--util-linux/findfs.c14
-rw-r--r--util-linux/flock.c9
-rw-r--r--util-linux/freeramdisk.c30
-rw-r--r--util-linux/fsck_minix.c14
-rw-r--r--util-linux/getopt.c26
-rw-r--r--util-linux/hexdump.c32
-rw-r--r--util-linux/hwclock.c36
-rw-r--r--util-linux/ipcrm.c11
-rw-r--r--util-linux/ipcs.c11
-rw-r--r--util-linux/losetup.c12
-rw-r--r--util-linux/lspci.c13
-rw-r--r--util-linux/lsusb.c13
-rw-r--r--util-linux/mkfs_ext2.c20
-rw-r--r--util-linux/mkfs_minix.c21
-rw-r--r--util-linux/mkfs_reiser.c11
-rw-r--r--util-linux/mkfs_vfat.c19
-rw-r--r--util-linux/mkswap.c23
-rw-r--r--util-linux/more.c13
-rw-r--r--util-linux/mount.c8
-rw-r--r--util-linux/pivot_root.c16
-rw-r--r--util-linux/rdate.c14
-rw-r--r--util-linux/rdev.c9
-rw-r--r--util-linux/readprofile.c17
-rw-r--r--util-linux/rev.c9
-rw-r--r--util-linux/rtcwake.c10
-rw-r--r--util-linux/script.c9
-rw-r--r--util-linux/scriptreplay.c10
-rw-r--r--util-linux/setarch.c29
-rw-r--r--util-linux/swaponoff.c50
-rw-r--r--util-linux/switch_root.c23
-rw-r--r--util-linux/uevent.c1
-rw-r--r--util-linux/umount.c20
-rw-r--r--util-linux/unshare.c1
45 files changed, 784 insertions, 626 deletions
diff --git a/util-linux/Config.src b/util-linux/Config.src
index 922cabdb8..3c522f948 100644
--- a/util-linux/Config.src
+++ b/util-linux/Config.src
@@ -7,553 +7,6 @@ menu "Linux System Utilities"
7 7
8INSERT 8INSERT
9 9
10config ACPID
11 bool "acpid"
12 default y
13 select PLATFORM_LINUX
14 help
15 acpid listens to ACPI events coming either in textual form from
16 /proc/acpi/event (though it is marked deprecated it is still widely
17 used and _is_ a standard) or in binary form from specified evdevs
18 (just use /dev/input/event*).
19
20 It parses the event to retrieve ACTION and a possible PARAMETER.
21 It then spawns /etc/acpi/<ACTION>[/<PARAMETER>] either via run-parts
22 (if the resulting path is a directory) or directly as an executable.
23
24 N.B. acpid relies on run-parts so have the latter installed.
25
26config FEATURE_ACPID_COMPAT
27 bool "Accept and ignore redundant options"
28 default y
29 depends on ACPID
30 help
31 Accept and ignore compatibility options -g -m -s -S -v.
32
33config BLKID
34 bool "blkid"
35 default y
36 select PLATFORM_LINUX
37 select VOLUMEID
38 help
39 Lists labels and UUIDs of all filesystems.
40 WARNING:
41 With all submodules selected, it will add ~8k to busybox.
42
43config FEATURE_BLKID_TYPE
44 bool "Print filesystem type"
45 default n
46 depends on BLKID
47 help
48 Show TYPE="filesystem type"
49
50config DMESG
51 bool "dmesg"
52 default y
53 select PLATFORM_LINUX
54 help
55 dmesg is used to examine or control the kernel ring buffer. When the
56 Linux kernel prints messages to the system log, they are stored in
57 the kernel ring buffer. You can use dmesg to print the kernel's ring
58 buffer, clear the kernel ring buffer, change the size of the kernel
59 ring buffer, and change the priority level at which kernel messages
60 are also logged to the system console. Enable this option if you
61 wish to enable the 'dmesg' utility.
62
63config FEATURE_DMESG_PRETTY
64 bool "Pretty dmesg output"
65 default y
66 depends on DMESG
67 help
68 If you wish to scrub the syslog level from the output, say 'Y' here.
69 The syslog level is a string prefixed to every line with the form
70 "<#>".
71
72 With this option you will see:
73 # dmesg
74 Linux version 2.6.17.4 .....
75 BIOS-provided physical RAM map:
76 BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
77
78 Without this option you will see:
79 # dmesg
80 <5>Linux version 2.6.17.4 .....
81 <6>BIOS-provided physical RAM map:
82 <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
83
84config FBSET
85 bool "fbset"
86 default y
87 select PLATFORM_LINUX
88 help
89 fbset is used to show or change the settings of a Linux frame buffer
90 device. The frame buffer device provides a simple and unique
91 interface to access a graphics display. Enable this option
92 if you wish to enable the 'fbset' utility.
93
94config FEATURE_FBSET_FANCY
95 bool "Turn on extra fbset options"
96 default y
97 depends on FBSET
98 help
99 This option enables extended fbset options, allowing one to set the
100 framebuffer size, color depth, etc. interface to access a graphics
101 display. Enable this option if you wish to enable extended fbset
102 options.
103
104config FEATURE_FBSET_READMODE
105 bool "Turn on fbset readmode support"
106 default y
107 depends on FBSET
108 help
109 This option allows fbset to read the video mode database stored by
110 default as /etc/fb.modes, which can be used to set frame buffer
111 device to pre-defined video modes.
112
113config FDFLUSH
114 bool "fdflush"
115 default y
116 select PLATFORM_LINUX
117 help
118 fdflush is only needed when changing media on slightly-broken
119 removable media drives. It is used to make Linux believe that a
120 hardware disk-change switch has been actuated, which causes Linux to
121 forget anything it has cached from the previous media. If you have
122 such a slightly-broken drive, you will need to run fdflush every time
123 you change a disk. Most people have working hardware and can safely
124 leave this disabled.
125
126config FDFORMAT
127 bool "fdformat"
128 default y
129 select PLATFORM_LINUX
130 help
131 fdformat is used to low-level format a floppy disk.
132
133config FDISK
134 bool "fdisk"
135 default y
136 select PLATFORM_LINUX
137 help
138 The fdisk utility is used to divide hard disks into one or more
139 logical disks, which are generally called partitions. This utility
140 can be used to list and edit the set of partitions or BSD style
141 'disk slices' that are defined on a hard drive.
142
143config FDISK_SUPPORT_LARGE_DISKS
144 bool "Support over 4GB disks"
145 default y
146 depends on FDISK
147 depends on !LFS # with LFS no special code is needed
148 help
149 Enable this option to support large disks > 4GB.
150
151config FEATURE_FDISK_WRITABLE
152 bool "Write support"
153 default y
154 depends on FDISK
155 help
156 Enabling this option allows you to create or change a partition table
157 and write those changes out to disk. If you leave this option
158 disabled, you will only be able to view the partition table.
159
160config FEATURE_AIX_LABEL
161 bool "Support AIX disklabels"
162 default n
163 depends on FDISK && FEATURE_FDISK_WRITABLE
164 help
165 Enabling this option allows you to create or change AIX disklabels.
166 Most people can safely leave this option disabled.
167
168config FEATURE_SGI_LABEL
169 bool "Support SGI disklabels"
170 default n
171 depends on FDISK && FEATURE_FDISK_WRITABLE
172 help
173 Enabling this option allows you to create or change SGI disklabels.
174 Most people can safely leave this option disabled.
175
176config FEATURE_SUN_LABEL
177 bool "Support SUN disklabels"
178 default n
179 depends on FDISK && FEATURE_FDISK_WRITABLE
180 help
181 Enabling this option allows you to create or change SUN disklabels.
182 Most people can safely leave this option disabled.
183
184config FEATURE_OSF_LABEL
185 bool "Support BSD disklabels"
186 default n
187 depends on FDISK && FEATURE_FDISK_WRITABLE
188 help
189 Enabling this option allows you to create or change BSD disklabels
190 and define and edit BSD disk slices.
191
192config FEATURE_GPT_LABEL
193 bool "Support GPT disklabels"
194 default n
195 depends on FDISK && FEATURE_FDISK_WRITABLE
196 help
197 Enabling this option allows you to view GUID Partition Table
198 disklabels.
199
200config FEATURE_FDISK_ADVANCED
201 bool "Support expert mode"
202 default y
203 depends on FDISK && FEATURE_FDISK_WRITABLE
204 help
205 Enabling this option allows you to do terribly unsafe things like
206 define arbitrary drive geometry, move the beginning of data in a
207 partition, and similarly evil things. Unless you have a very good
208 reason you would be wise to leave this disabled.
209
210config FINDFS
211 bool "findfs"
212 default y
213 select PLATFORM_LINUX
214 select VOLUMEID
215 help
216 Prints the name of a filesystem with given label or UUID.
217 WARNING:
218 With all submodules selected, it will add ~8k to busybox.
219
220config FLOCK
221 bool "flock"
222 default y
223 help
224 Manage locks from shell scripts
225
226config FREERAMDISK
227 bool "freeramdisk"
228 default y
229 select PLATFORM_LINUX
230 help
231 Linux allows you to create ramdisks. This utility allows you to
232 delete them and completely free all memory that was used for the
233 ramdisk. For example, if you boot Linux into a ramdisk and later
234 pivot_root, you may want to free the memory that is allocated to the
235 ramdisk. If you have no use for freeing memory from a ramdisk, leave
236 this disabled.
237
238config FSCK_MINIX
239 bool "fsck_minix"
240 default y
241 help
242 The minix filesystem is a nice, small, compact, read-write filesystem
243 with little overhead. It is not a journaling filesystem however and
244 can experience corruption if it is not properly unmounted or if the
245 power goes off in the middle of a write. This utility allows you to
246 check for and attempt to repair any corruption that occurs to a minix
247 filesystem.
248
249config MKFS_EXT2
250 bool "mkfs_ext2"
251 default y
252 select PLATFORM_LINUX
253 help
254 Utility to create EXT2 filesystems.
255
256config MKFS_MINIX
257 bool "mkfs_minix"
258 default y
259 select PLATFORM_LINUX
260 help
261 The minix filesystem is a nice, small, compact, read-write filesystem
262 with little overhead. If you wish to be able to create minix
263 filesystems this utility will do the job for you.
264
265config FEATURE_MINIX2
266 bool "Support Minix fs v2 (fsck_minix/mkfs_minix)"
267 default y
268 depends on FSCK_MINIX || MKFS_MINIX
269 help
270 If you wish to be able to create version 2 minix filesystems, enable
271 this. If you enabled 'mkfs_minix' then you almost certainly want to
272 be using the version 2 filesystem support.
273
274config MKFS_REISER
275 bool "mkfs_reiser"
276 default n
277 select PLATFORM_LINUX
278 help
279 Utility to create ReiserFS filesystems.
280 Note: this applet needs a lot of testing and polishing.
281
282config MKFS_VFAT
283 bool "mkfs_vfat"
284 default y
285 select PLATFORM_LINUX
286 help
287 Utility to create FAT32 filesystems.
288
289config GETOPT
290 bool "getopt"
291 default y
292 help
293 The getopt utility is used to break up (parse) options in command
294 lines to make it easy to write complex shell scripts that also check
295 for legal (and illegal) options. If you want to write horribly
296 complex shell scripts, or use some horribly complex shell script
297 written by others, this utility may be for you. Most people will
298 wisely leave this disabled.
299
300config FEATURE_GETOPT_LONG
301 bool "Support option -l"
302 default y if LONG_OPTS
303 depends on GETOPT
304 help
305 Enable support for long options (option -l).
306
307config HEXDUMP
308 bool "hexdump"
309 default y
310 help
311 The hexdump utility is used to display binary data in a readable
312 way that is comparable to the output from most hex editors.
313
314config FEATURE_HEXDUMP_REVERSE
315 bool "Support -R, reverse of 'hexdump -Cv'"
316 default y
317 depends on HEXDUMP
318 help
319 The hexdump utility is used to display binary data in an ascii
320 readable way. This option creates binary data from an ascii input.
321 NB: this option is non-standard. It's unwise to use it in scripts
322 aimed to be portable.
323
324config HD
325 bool "hd"
326 default y
327 depends on HEXDUMP
328 help
329 hd is an alias to hexdump -C.
330
331config HWCLOCK
332 bool "hwclock"
333 default y
334 select PLATFORM_LINUX
335 help
336 The hwclock utility is used to read and set the hardware clock
337 on a system. This is primarily used to set the current time on
338 shutdown in the hardware clock, so the hardware will keep the
339 correct time when Linux is _not_ running.
340
341config FEATURE_HWCLOCK_LONG_OPTIONS
342 bool "Support long options (--hctosys,...)"
343 default y
344 depends on HWCLOCK && LONG_OPTS
345 help
346 By default, the hwclock utility only uses short options. If you
347 are overly fond of its long options, such as --hctosys, --utc, etc)
348 then enable this option.
349
350config FEATURE_HWCLOCK_ADJTIME_FHS
351 bool "Use FHS /var/lib/hwclock/adjtime"
352 default n # util-linux-ng in Fedora 13 still uses /etc/adjtime
353 depends on HWCLOCK
354 help
355 Starting with FHS 2.3, the adjtime state file is supposed to exist
356 at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish
357 to use the FHS behavior, answer Y here, otherwise answer N for the
358 classic /etc/adjtime path.
359
360 pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO
361
362config IPCRM
363 bool "ipcrm"
364 default y
365 help
366 The ipcrm utility allows the removal of System V interprocess
367 communication (IPC) objects and the associated data structures
368 from the system.
369
370config IPCS
371 bool "ipcs"
372 default y
373 select PLATFORM_LINUX
374 help
375 The ipcs utility is used to provide information on the currently
376 allocated System V interprocess (IPC) objects in the system.
377
378config LOSETUP
379 bool "losetup"
380 default y
381 select PLATFORM_LINUX
382 help
383 losetup is used to associate or detach a loop device with a regular
384 file or block device, and to query the status of a loop device. This
385 version does not currently support enabling data encryption.
386
387config LSPCI
388 bool "lspci"
389 default y
390 #select PLATFORM_LINUX
391 help
392 lspci is a utility for displaying information about PCI buses in the
393 system and devices connected to them.
394
395 This version uses sysfs (/sys/bus/pci/devices) only.
396
397config LSUSB
398 bool "lsusb"
399 default y
400 #select PLATFORM_LINUX
401 help
402 lsusb is a utility for displaying information about USB buses in the
403 system and devices connected to them.
404
405 This version uses sysfs (/sys/bus/usb/devices) only.
406
407config MKSWAP
408 bool "mkswap"
409 default y
410 help
411 The mkswap utility is used to configure a file or disk partition as
412 Linux swap space. This allows Linux to use the entire file or
413 partition as if it were additional RAM, which can greatly increase
414 the capability of low-memory machines. This additional memory is
415 much slower than real RAM, but can be very helpful at preventing your
416 applications being killed by the Linux out of memory (OOM) killer.
417 Once you have created swap space using 'mkswap' you need to enable
418 the swap space using the 'swapon' utility.
419
420config FEATURE_MKSWAP_UUID
421 bool "UUID support"
422 default y
423 depends on MKSWAP
424 help
425 Generate swap spaces with universally unique identifiers.
426
427config MORE
428 bool "more"
429 default y
430 help
431 more is a simple utility which allows you to read text one screen
432 sized page at a time. If you want to read text that is larger than
433 the screen, and you are using anything faster than a 300 baud modem,
434 you will probably find this utility very helpful. If you don't have
435 any need to reading text files, you can leave this disabled.
436
437config PIVOT_ROOT
438 bool "pivot_root"
439 default y
440 select PLATFORM_LINUX
441 help
442 The pivot_root utility swaps the mount points for the root filesystem
443 with some other mounted filesystem. This allows you to do all sorts
444 of wild and crazy things with your Linux system and is far more
445 powerful than 'chroot'.
446
447 Note: This is for initrd in linux 2.4. Under initramfs (introduced
448 in linux 2.6) use switch_root instead.
449
450config RDATE
451 bool "rdate"
452 default y
453 help
454 The rdate utility allows you to synchronize the date and time of your
455 system clock with the date and time of a remote networked system using
456 the RFC868 protocol, which is built into the inetd daemon on most
457 systems.
458
459config RDEV
460 bool "rdev"
461 default y
462 help
463 Print the device node associated with the filesystem mounted at '/'.
464
465config READPROFILE
466 bool "readprofile"
467 default y
468 #select PLATFORM_LINUX
469 help
470 This allows you to parse /proc/profile for basic profiling.
471
472config RTCWAKE
473 bool "rtcwake"
474 default y
475 select PLATFORM_LINUX
476 help
477 Enter a system sleep state until specified wakeup time.
478
479config SCRIPT
480 bool "script"
481 default y
482 help
483 The script makes typescript of terminal session.
484
485config SCRIPTREPLAY
486 bool "scriptreplay"
487 default y
488 help
489 This program replays a typescript, using timing information
490 given by script -t.
491
492config SWAPONOFF
493 bool "swaponoff"
494 default y
495 select PLATFORM_LINUX
496 help
497 This option enables both the 'swapon' and the 'swapoff' utilities.
498 Once you have created some swap space using 'mkswap', you also need
499 to enable your swap space with the 'swapon' utility. The 'swapoff'
500 utility is used, typically at system shutdown, to disable any swap
501 space. If you are not using any swap space, you can leave this
502 option disabled.
503
504config FEATURE_SWAPON_DISCARD
505 bool "Support discard option -d"
506 default y
507 depends on SWAPONOFF
508 help
509 Enable support for discarding swap area blocks at swapon and/or as
510 the kernel frees them. This option enables both the -d option on
511 'swapon' and the 'discard' option for swap entries in /etc/fstab.
512
513config FEATURE_SWAPON_PRI
514 bool "Support priority option -p"
515 default y
516 depends on SWAPONOFF
517 help
518 Enable support for setting swap device priority in swapon.
519
520config SWITCH_ROOT
521 bool "switch_root"
522 default y
523 select PLATFORM_LINUX
524 help
525 The switch_root utility is used from initramfs to select a new
526 root device. Under initramfs, you have to use this instead of
527 pivot_root. (Stop reading here if you don't care why.)
528
529 Booting with initramfs extracts a gzipped cpio archive into rootfs
530 (which is a variant of ramfs/tmpfs). Because rootfs can't be moved
531 or unmounted*, pivot_root will not work from initramfs. Instead,
532 switch_root deletes everything out of rootfs (including itself),
533 does a mount --move that overmounts rootfs with the new root, and
534 then execs the specified init program.
535
536 * Because the Linux kernel uses rootfs internally as the starting
537 and ending point for searching through the kernel's doubly linked
538 list of active mount points. That's why.
539
540config UMOUNT
541 bool "umount"
542 default y
543 select PLATFORM_LINUX
544 help
545 When you want to remove a mounted filesystem from its current mount
546 point, for example when you are shutting down the system, the
547 'umount' utility is the tool to use. If you enabled the 'mount'
548 utility, you almost certainly also want to enable 'umount'.
549
550config FEATURE_UMOUNT_ALL
551 bool "Support option -a"
552 default y
553 depends on UMOUNT
554 help
555 Support -a option to unmount all currently mounted filesystems.
556
557comment "Common options for mount/umount" 10comment "Common options for mount/umount"
558 depends on MOUNT || UMOUNT 11 depends on MOUNT || UMOUNT
559 12
diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src
index 0b87c52ac..6b4fb7470 100644
--- a/util-linux/Kbuild.src
+++ b/util-linux/Kbuild.src
@@ -7,39 +7,3 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10lib-$(CONFIG_ACPID) += acpid.o
11lib-$(CONFIG_BLKID) += blkid.o
12lib-$(CONFIG_DMESG) += dmesg.o
13lib-$(CONFIG_FBSET) += fbset.o
14lib-$(CONFIG_FDFLUSH) += freeramdisk.o
15lib-$(CONFIG_FDFORMAT) += fdformat.o
16lib-$(CONFIG_FDISK) += fdisk.o
17lib-$(CONFIG_FINDFS) += findfs.o
18lib-$(CONFIG_FLOCK) += flock.o
19lib-$(CONFIG_FREERAMDISK) += freeramdisk.o
20lib-$(CONFIG_FSCK_MINIX) += fsck_minix.o
21lib-$(CONFIG_GETOPT) += getopt.o
22lib-$(CONFIG_HEXDUMP) += hexdump.o
23lib-$(CONFIG_HWCLOCK) += hwclock.o
24lib-$(CONFIG_IPCRM) += ipcrm.o
25lib-$(CONFIG_IPCS) += ipcs.o
26lib-$(CONFIG_LOSETUP) += losetup.o
27lib-$(CONFIG_LSPCI) += lspci.o
28lib-$(CONFIG_LSUSB) += lsusb.o
29lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o
30lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o
31lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o
32lib-$(CONFIG_MKFS_VFAT) += mkfs_vfat.o
33lib-$(CONFIG_MKSWAP) += mkswap.o
34lib-$(CONFIG_MORE) += more.o
35lib-$(CONFIG_MOUNT) += mount.o
36lib-$(CONFIG_PIVOT_ROOT) += pivot_root.o
37lib-$(CONFIG_RDATE) += rdate.o
38lib-$(CONFIG_RDEV) += rdev.o
39lib-$(CONFIG_READPROFILE) += readprofile.o
40lib-$(CONFIG_RTCWAKE) += rtcwake.o
41lib-$(CONFIG_SCRIPT) += script.o
42lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o
43lib-$(CONFIG_SWAPONOFF) += swaponoff.o
44lib-$(CONFIG_SWITCH_ROOT) += switch_root.o
45lib-$(CONFIG_UMOUNT) += umount.o
diff --git a/util-linux/acpid.c b/util-linux/acpid.c
index 0f2cb6bdc..3e68b61ab 100644
--- a/util-linux/acpid.c
+++ b/util-linux/acpid.c
@@ -6,6 +6,32 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config ACPID
10//config: bool "acpid"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: acpid listens to ACPI events coming either in textual form from
15//config: /proc/acpi/event (though it is marked deprecated it is still widely
16//config: used and _is_ a standard) or in binary form from specified evdevs
17//config: (just use /dev/input/event*).
18//config:
19//config: It parses the event to retrieve ACTION and a possible PARAMETER.
20//config: It then spawns /etc/acpi/<ACTION>[/<PARAMETER>] either via run-parts
21//config: (if the resulting path is a directory) or directly as an executable.
22//config:
23//config: N.B. acpid relies on run-parts so have the latter installed.
24//config:
25//config:config FEATURE_ACPID_COMPAT
26//config: bool "Accept and ignore redundant options"
27//config: default y
28//config: depends on ACPID
29//config: help
30//config: Accept and ignore compatibility options -g -m -s -S -v.
31
32//applet:IF_ACPID(APPLET(acpid, BB_DIR_SBIN, BB_SUID_DROP))
33
34//kbuild:lib-$(CONFIG_ACPID) += acpid.o
9 35
10//usage:#define acpid_trivial_usage 36//usage:#define acpid_trivial_usage
11//usage: "[-df] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]" 37//usage: "[-df] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]"
diff --git a/util-linux/blkdiscard.c b/util-linux/blkdiscard.c
index ace88a1f0..af0bc946d 100644
--- a/util-linux/blkdiscard.c
+++ b/util-linux/blkdiscard.c
@@ -5,7 +5,6 @@
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8
9//config:config BLKDISCARD 8//config:config BLKDISCARD
10//config: bool "blkdiscard" 9//config: bool "blkdiscard"
11//config: default y 10//config: default y
diff --git a/util-linux/blkid.c b/util-linux/blkid.c
index 1bbc80311..b6f33b513 100644
--- a/util-linux/blkid.c
+++ b/util-linux/blkid.c
@@ -6,6 +6,26 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config BLKID
10//config: bool "blkid"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: select VOLUMEID
14//config: help
15//config: Lists labels and UUIDs of all filesystems.
16//config: WARNING:
17//config: With all submodules selected, it will add ~8k to busybox.
18//config:
19//config:config FEATURE_BLKID_TYPE
20//config: bool "Print filesystem type"
21//config: default n
22//config: depends on BLKID
23//config: help
24//config: Show TYPE="filesystem type"
25
26//applet:IF_BLKID(APPLET(blkid, BB_DIR_SBIN, BB_SUID_DROP))
27
28//kbuild:lib-$(CONFIG_BLKID) += blkid.o
9 29
10//usage:#define blkid_trivial_usage 30//usage:#define blkid_trivial_usage
11//usage: "[BLOCKDEV]..." 31//usage: "[BLOCKDEV]..."
diff --git a/util-linux/blockdev.c b/util-linux/blockdev.c
index e25e529db..bf4d49792 100644
--- a/util-linux/blockdev.c
+++ b/util-linux/blockdev.c
@@ -5,17 +5,16 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8
9//applet:IF_BLOCKDEV(APPLET(blockdev, BB_DIR_SBIN, BB_SUID_DROP))
10
11//kbuild:lib-$(CONFIG_BLOCKDEV) += blockdev.o
12
13//config:config BLOCKDEV 8//config:config BLOCKDEV
14//config: bool "blockdev" 9//config: bool "blockdev"
15//config: default y 10//config: default y
16//config: help 11//config: help
17//config: Performs some ioctls with block devices. 12//config: Performs some ioctls with block devices.
18 13
14//applet:IF_BLOCKDEV(APPLET(blockdev, BB_DIR_SBIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_BLOCKDEV) += blockdev.o
17
19//usage:#define blockdev_trivial_usage 18//usage:#define blockdev_trivial_usage
20//usage: "OPTION BLOCKDEV" 19//usage: "OPTION BLOCKDEV"
21//usage:#define blockdev_full_usage "\n\n" 20//usage:#define blockdev_full_usage "\n\n"
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 50e8a0fce..b7b2c6924 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -8,6 +8,43 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11//config:config DMESG
12//config: bool "dmesg"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: dmesg is used to examine or control the kernel ring buffer. When the
17//config: Linux kernel prints messages to the system log, they are stored in
18//config: the kernel ring buffer. You can use dmesg to print the kernel's ring
19//config: buffer, clear the kernel ring buffer, change the size of the kernel
20//config: ring buffer, and change the priority level at which kernel messages
21//config: are also logged to the system console. Enable this option if you
22//config: wish to enable the 'dmesg' utility.
23//config:
24//config:config FEATURE_DMESG_PRETTY
25//config: bool "Pretty dmesg output"
26//config: default y
27//config: depends on DMESG
28//config: help
29//config: If you wish to scrub the syslog level from the output, say 'Y' here.
30//config: The syslog level is a string prefixed to every line with the form
31//config: "<#>".
32//config:
33//config: With this option you will see:
34//config: # dmesg
35//config: Linux version 2.6.17.4 .....
36//config: BIOS-provided physical RAM map:
37//config: BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
38//config:
39//config: Without this option you will see:
40//config: # dmesg
41//config: <5>Linux version 2.6.17.4 .....
42//config: <6>BIOS-provided physical RAM map:
43//config: <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
44
45//applet:IF_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP))
46
47//kbuild:lib-$(CONFIG_DMESG) += dmesg.o
11 48
12//usage:#define dmesg_trivial_usage 49//usage:#define dmesg_trivial_usage
13//usage: "[-c] [-n LEVEL] [-s SIZE]" 50//usage: "[-c] [-n LEVEL] [-s SIZE]"
diff --git a/util-linux/fatattr.c b/util-linux/fatattr.c
index 6dca24a73..030978f64 100644
--- a/util-linux/fatattr.c
+++ b/util-linux/fatattr.c
@@ -16,6 +16,7 @@
16//config: fatattr lists or changes the file attributes on a fat file system. 16//config: fatattr lists or changes the file attributes on a fat file system.
17 17
18//applet:IF_FATATTR(APPLET(fatattr, BB_DIR_BIN, BB_SUID_DROP)) 18//applet:IF_FATATTR(APPLET(fatattr, BB_DIR_BIN, BB_SUID_DROP))
19
19//kbuild:lib-$(CONFIG_FATATTR) += fatattr.o 20//kbuild:lib-$(CONFIG_FATATTR) += fatattr.o
20 21
21//usage:#define fatattr_trivial_usage 22//usage:#define fatattr_trivial_usage
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index b75ec1921..8a78c1ef9 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -11,6 +11,38 @@
11 * the GPL, and is (c) 1995-1999 by: 11 * the GPL, and is (c) 1995-1999 by:
12 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) 12 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
13 */ 13 */
14//config:config FBSET
15//config: bool "fbset"
16//config: default y
17//config: select PLATFORM_LINUX
18//config: help
19//config: fbset is used to show or change the settings of a Linux frame buffer
20//config: device. The frame buffer device provides a simple and unique
21//config: interface to access a graphics display. Enable this option
22//config: if you wish to enable the 'fbset' utility.
23//config:
24//config:config FEATURE_FBSET_FANCY
25//config: bool "Turn on extra fbset options"
26//config: default y
27//config: depends on FBSET
28//config: help
29//config: This option enables extended fbset options, allowing one to set the
30//config: framebuffer size, color depth, etc. interface to access a graphics
31//config: display. Enable this option if you wish to enable extended fbset
32//config: options.
33//config:
34//config:config FEATURE_FBSET_READMODE
35//config: bool "Turn on fbset readmode support"
36//config: default y
37//config: depends on FBSET
38//config: help
39//config: This option allows fbset to read the video mode database stored by
40//config: default as /etc/fb.modes, which can be used to set frame buffer
41//config: device to pre-defined video modes.
42
43//applet:IF_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP))
44
45//kbuild:lib-$(CONFIG_FBSET) += fbset.o
14 46
15//usage:#define fbset_trivial_usage 47//usage:#define fbset_trivial_usage
16//usage: "[OPTIONS] [MODE]" 48//usage: "[OPTIONS] [MODE]"
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index 6ef6445e6..67c6e1504 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -4,6 +4,16 @@
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this source tree. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7//config:config FDFORMAT
8//config: bool "fdformat"
9//config: default y
10//config: select PLATFORM_LINUX
11//config: help
12//config: fdformat is used to low-level format a floppy disk.
13
14//applet:IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_SBIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_FDFORMAT) += fdformat.o
7 17
8//usage:#define fdformat_trivial_usage 18//usage:#define fdformat_trivial_usage
9//usage: "[-n] DEVICE" 19//usage: "[-n] DEVICE"
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 32a66d03d..b988e65a9 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -6,6 +6,86 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FDISK
10//config: bool "fdisk"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: The fdisk utility is used to divide hard disks into one or more
15//config: logical disks, which are generally called partitions. This utility
16//config: can be used to list and edit the set of partitions or BSD style
17//config: 'disk slices' that are defined on a hard drive.
18//config:
19//config:config FDISK_SUPPORT_LARGE_DISKS
20//config: bool "Support over 4GB disks"
21//config: default y
22//config: depends on FDISK
23//config: depends on !LFS # with LFS no special code is needed
24//config: help
25//config: Enable this option to support large disks > 4GB.
26//config:
27//config:config FEATURE_FDISK_WRITABLE
28//config: bool "Write support"
29//config: default y
30//config: depends on FDISK
31//config: help
32//config: Enabling this option allows you to create or change a partition table
33//config: and write those changes out to disk. If you leave this option
34//config: disabled, you will only be able to view the partition table.
35//config:
36//config:config FEATURE_AIX_LABEL
37//config: bool "Support AIX disklabels"
38//config: default n
39//config: depends on FDISK && FEATURE_FDISK_WRITABLE
40//config: help
41//config: Enabling this option allows you to create or change AIX disklabels.
42//config: Most people can safely leave this option disabled.
43//config:
44//config:config FEATURE_SGI_LABEL
45//config: bool "Support SGI disklabels"
46//config: default n
47//config: depends on FDISK && FEATURE_FDISK_WRITABLE
48//config: help
49//config: Enabling this option allows you to create or change SGI disklabels.
50//config: Most people can safely leave this option disabled.
51//config:
52//config:config FEATURE_SUN_LABEL
53//config: bool "Support SUN disklabels"
54//config: default n
55//config: depends on FDISK && FEATURE_FDISK_WRITABLE
56//config: help
57//config: Enabling this option allows you to create or change SUN disklabels.
58//config: Most people can safely leave this option disabled.
59//config:
60//config:config FEATURE_OSF_LABEL
61//config: bool "Support BSD disklabels"
62//config: default n
63//config: depends on FDISK && FEATURE_FDISK_WRITABLE
64//config: help
65//config: Enabling this option allows you to create or change BSD disklabels
66//config: and define and edit BSD disk slices.
67//config:
68//config:config FEATURE_GPT_LABEL
69//config: bool "Support GPT disklabels"
70//config: default n
71//config: depends on FDISK && FEATURE_FDISK_WRITABLE
72//config: help
73//config: Enabling this option allows you to view GUID Partition Table
74//config: disklabels.
75//config:
76//config:config FEATURE_FDISK_ADVANCED
77//config: bool "Support expert mode"
78//config: default y
79//config: depends on FDISK && FEATURE_FDISK_WRITABLE
80//config: help
81//config: Enabling this option allows you to do terribly unsafe things like
82//config: define arbitrary drive geometry, move the beginning of data in a
83//config: partition, and similarly evil things. Unless you have a very good
84//config: reason you would be wise to leave this disabled.
85
86//applet:IF_FDISK(APPLET(fdisk, BB_DIR_SBIN, BB_SUID_DROP))
87
88//kbuild:lib-$(CONFIG_FDISK) += fdisk.o
9 89
10/* Looks like someone forgot to add this to config system */ 90/* Looks like someone forgot to add this to config system */
11//usage:#ifndef ENABLE_FEATURE_FDISK_BLKSIZE 91//usage:#ifndef ENABLE_FEATURE_FDISK_BLKSIZE
@@ -41,6 +121,7 @@
41# define BLKGETSIZE64 _IOR(0x12,114,size_t) 121# define BLKGETSIZE64 _IOR(0x12,114,size_t)
42#endif 122#endif
43#include "libbb.h" 123#include "libbb.h"
124#include "unicode.h"
44 125
45#if BB_LITTLE_ENDIAN 126#if BB_LITTLE_ENDIAN
46# define inline_if_little_endian ALWAYS_INLINE 127# define inline_if_little_endian ALWAYS_INLINE
diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c
index 715e227ca..45d2aa6e7 100644
--- a/util-linux/fdisk_gpt.c
+++ b/util-linux/fdisk_gpt.c
@@ -36,14 +36,13 @@ typedef struct {
36 uint64_t lba_start; 36 uint64_t lba_start;
37 uint64_t lba_end; 37 uint64_t lba_end;
38 uint64_t flags; 38 uint64_t flags;
39 uint16_t name[36]; 39 uint16_t name36[36];
40} gpt_partition; 40} gpt_partition;
41 41
42static gpt_header *gpt_hdr; 42static gpt_header *gpt_hdr;
43 43
44static char *part_array; 44static char *part_array;
45static unsigned int n_parts; 45static unsigned int n_parts;
46static unsigned int part_array_len;
47static unsigned int part_entry_len; 46static unsigned int part_entry_len;
48 47
49static inline gpt_partition * 48static inline gpt_partition *
@@ -73,18 +72,34 @@ gpt_print_guid(uint8_t *buf)
73 buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); 72 buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]);
74} 73}
75 74
76/* TODO: real unicode support */
77static void 75static void
78gpt_print_wide(uint16_t *s, int max_len) 76gpt_print_wide36(uint16_t *s)
79{ 77{
78#if ENABLE_UNICODE_SUPPORT
79 char buf[37 * 4];
80 wchar_t wc[37];
80 int i = 0; 81 int i = 0;
81 82 while (i < ARRAY_SIZE(wc)-1) {
82 while (i < max_len) { 83 if (s[i] == 0)
83 if (*s == 0) 84 break;
84 return; 85 wc[i] = s[i];
85 fputc(*s, stdout); 86 i++;
86 s++; 87 }
88 wc[i] = 0;
89 if (wcstombs(buf, wc, sizeof(buf)) <= sizeof(buf)-1)
90 fputs(printable_string(NULL, buf), stdout);
91#else
92 char buf[37];
93 int i = 0;
94 while (i < ARRAY_SIZE(buf)-1) {
95 if (s[i] == 0)
96 break;
97 buf[i] = (0x20 <= s[i] && s[i] < 0x7f) ? s[i] : '?';
98 i++;
87 } 99 }
100 buf[i] = '\0';
101 fputs(buf, stdout);
102#endif
88} 103}
89 104
90static void 105static void
@@ -106,19 +121,28 @@ gpt_list_table(int xtra UNUSED_PARAM)
106 (unsigned long long)SWAP_LE64(gpt_hdr->first_usable_lba), 121 (unsigned long long)SWAP_LE64(gpt_hdr->first_usable_lba),
107 (unsigned long long)SWAP_LE64(gpt_hdr->last_usable_lba)); 122 (unsigned long long)SWAP_LE64(gpt_hdr->last_usable_lba));
108 123
109 puts("Number Start (sector) End (sector) Size Code Name"); 124/* "GPT fdisk" has a concept of 16-bit extension of the original MBR 8-bit type codes,
125 * which it displays here: its output columns are ... Size Code Name
126 * They are their own invention and are not stored on disk.
127 * Looks like they use them to support "hybrid" GPT: for example, they have
128 * AddType(0x8307, "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", "Linux ARM32 root (/)");
129 * and then (code>>8) matches what you need to put into MBR's type field for such a partition.
130 * To print those codes, we'd need a GUID lookup table. Lets just drop the "Code" column instead:
131 */
132 puts("Number Start (sector) End (sector) Size Name");
133 // 123456 123456789012345 123456789012345 12345 abc
110 for (i = 0; i < n_parts; i++) { 134 for (i = 0; i < n_parts; i++) {
111 gpt_partition *p = gpt_part(i); 135 gpt_partition *p = gpt_part(i);
112 if (p->lba_start) { 136 if (p->lba_start) {
113 smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size, 137 smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size,
114 numstr6, " KMGTPEZY")[0] = '\0'; 138 numstr6, " KMGTPEZY")[0] = '\0';
115 printf("%4u %15llu %15llu %11s %04x ", 139 printf("%6u %15llu %15llu %s ",
116 i + 1, 140 i + 1,
117 (unsigned long long)SWAP_LE64(p->lba_start), 141 (unsigned long long)SWAP_LE64(p->lba_start),
118 (unsigned long long)SWAP_LE64(p->lba_end), 142 (unsigned long long)SWAP_LE64(p->lba_end),
119 numstr6, 143 numstr6
120 0x0700 /* FIXME */); 144 );
121 gpt_print_wide(p->name, 18); 145 gpt_print_wide36(p->name36);
122 bb_putchar('\n'); 146 bb_putchar('\n');
123 } 147 }
124 } 148 }
@@ -127,6 +151,7 @@ gpt_list_table(int xtra UNUSED_PARAM)
127static int 151static int
128check_gpt_label(void) 152check_gpt_label(void)
129{ 153{
154 unsigned part_array_len;
130 struct partition *first = pt_offset(MBRbuffer, 0); 155 struct partition *first = pt_offset(MBRbuffer, 0);
131 struct pte pe; 156 struct pte pe;
132 uint32_t crc; 157 uint32_t crc;
@@ -150,6 +175,7 @@ check_gpt_label(void)
150 return 0; 175 return 0;
151 } 176 }
152 177
178 init_unicode();
153 if (!global_crc32_table) { 179 if (!global_crc32_table) {
154 global_crc32_table = crc32_filltable(NULL, 0); 180 global_crc32_table = crc32_filltable(NULL, 0);
155 } 181 }
diff --git a/util-linux/findfs.c b/util-linux/findfs.c
index 07734f359..daa46b039 100644
--- a/util-linux/findfs.c
+++ b/util-linux/findfs.c
@@ -7,6 +7,20 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config FINDFS
11//config: bool "findfs"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: select VOLUMEID
15//config: help
16//config: Prints the name of a filesystem with given label or UUID.
17//config: WARNING:
18//config: With all submodules selected, it will add ~8k to busybox.
19
20/* Benefits from suid root: better access to /dev/BLOCKDEVs: */
21//applet:IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE))
22
23//kbuild:lib-$(CONFIG_FINDFS) += findfs.o
10 24
11//usage:#define findfs_trivial_usage 25//usage:#define findfs_trivial_usage
12//usage: "LABEL=label or UUID=uuid" 26//usage: "LABEL=label or UUID=uuid"
diff --git a/util-linux/flock.c b/util-linux/flock.c
index 1f7ade7c4..f34c0ad8f 100644
--- a/util-linux/flock.c
+++ b/util-linux/flock.c
@@ -3,6 +3,15 @@
3 * 3 *
4 * This is free software, licensed under the GNU General Public License v2. 4 * This is free software, licensed under the GNU General Public License v2.
5 */ 5 */
6//config:config FLOCK
7//config: bool "flock"
8//config: default y
9//config: help
10//config: Manage locks from shell scripts
11
12//applet:IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP))
13
14//kbuild:lib-$(CONFIG_FLOCK) += flock.o
6 15
7//usage:#define flock_trivial_usage 16//usage:#define flock_trivial_usage
8//usage: "[-sxun] FD|{FILE [-c] PROG ARGS}" 17//usage: "[-sxun] FD|{FILE [-c] PROG ARGS}"
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c
index a89ae1a39..8bc2c443b 100644
--- a/util-linux/freeramdisk.c
+++ b/util-linux/freeramdisk.c
@@ -8,6 +8,36 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11//config:config FDFLUSH
12//config: bool "fdflush"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: fdflush is only needed when changing media on slightly-broken
17//config: removable media drives. It is used to make Linux believe that a
18//config: hardware disk-change switch has been actuated, which causes Linux to
19//config: forget anything it has cached from the previous media. If you have
20//config: such a slightly-broken drive, you will need to run fdflush every time
21//config: you change a disk. Most people have working hardware and can safely
22//config: leave this disabled.
23//config:
24//config:config FREERAMDISK
25//config: bool "freeramdisk"
26//config: default y
27//config: select PLATFORM_LINUX
28//config: help
29//config: Linux allows you to create ramdisks. This utility allows you to
30//config: delete them and completely free all memory that was used for the
31//config: ramdisk. For example, if you boot Linux into a ramdisk and later
32//config: pivot_root, you may want to free the memory that is allocated to the
33//config: ramdisk. If you have no use for freeing memory from a ramdisk, leave
34//config: this disabled.
35
36//applet:IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush))
37//applet:IF_FREERAMDISK(APPLET(freeramdisk, BB_DIR_SBIN, BB_SUID_DROP))
38
39//kbuild:lib-$(CONFIG_FDFLUSH) += freeramdisk.o
40//kbuild:lib-$(CONFIG_FREERAMDISK) += freeramdisk.o
11 41
12//usage:#define freeramdisk_trivial_usage 42//usage:#define freeramdisk_trivial_usage
13//usage: "DEVICE" 43//usage: "DEVICE"
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index d2f3524b4..0eaac17c0 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -85,6 +85,20 @@
85 * The device may be a block device or a image of one, but this isn't 85 * The device may be a block device or a image of one, but this isn't
86 * enforced (but it's not much fun on a character device :-). 86 * enforced (but it's not much fun on a character device :-).
87 */ 87 */
88//config:config FSCK_MINIX
89//config: bool "fsck_minix"
90//config: default y
91//config: help
92//config: The minix filesystem is a nice, small, compact, read-write filesystem
93//config: with little overhead. It is not a journaling filesystem however and
94//config: can experience corruption if it is not properly unmounted or if the
95//config: power goes off in the middle of a write. This utility allows you to
96//config: check for and attempt to repair any corruption that occurs to a minix
97//config: filesystem.
98
99//applet:IF_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, BB_DIR_SBIN, BB_SUID_DROP, fsck_minix))
100
101//kbuild:lib-$(CONFIG_FSCK_MINIX) += fsck_minix.o
88 102
89//usage:#define fsck_minix_trivial_usage 103//usage:#define fsck_minix_trivial_usage
90//usage: "[-larvsmf] BLOCKDEV" 104//usage: "[-larvsmf] BLOCKDEV"
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 18d490987..f6ecc3dde 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -28,8 +28,28 @@
28 * Removed --version/-V and --help/-h 28 * Removed --version/-V and --help/-h
29 * Removed parse_error(), using bb_error_msg() from Busybox instead 29 * Removed parse_error(), using bb_error_msg() from Busybox instead
30 * Replaced our_malloc with xmalloc and our_realloc with xrealloc 30 * Replaced our_malloc with xmalloc and our_realloc with xrealloc
31 *
32 */ 31 */
32//config:config GETOPT
33//config: bool "getopt"
34//config: default y
35//config: help
36//config: The getopt utility is used to break up (parse) options in command
37//config: lines to make it easy to write complex shell scripts that also check
38//config: for legal (and illegal) options. If you want to write horribly
39//config: complex shell scripts, or use some horribly complex shell script
40//config: written by others, this utility may be for you. Most people will
41//config: wisely leave this disabled.
42//config:
43//config:config FEATURE_GETOPT_LONG
44//config: bool "Support option -l"
45//config: default y if LONG_OPTS
46//config: depends on GETOPT
47//config: help
48//config: Enable support for long options (option -l).
49
50//applet:IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP))
51
52//kbuild:lib-$(CONFIG_GETOPT) += getopt.o
33 53
34//usage:#define getopt_trivial_usage 54//usage:#define getopt_trivial_usage
35//usage: "[OPTIONS] [--] OPTSTRING PARAMS" 55//usage: "[OPTIONS] [--] OPTSTRING PARAMS"
@@ -327,9 +347,9 @@ static struct option *add_long_options(struct option *long_options, char *option
327 347
328static void set_shell(const char *new_shell) 348static void set_shell(const char *new_shell)
329{ 349{
330 if (!strcmp(new_shell, "bash") || !strcmp(new_shell, "sh")) 350 if (strcmp(new_shell, "bash") == 0 || strcmp(new_shell, "sh") == 0)
331 return; 351 return;
332 if (!strcmp(new_shell, "tcsh") || !strcmp(new_shell, "csh")) 352 if (strcmp(new_shell, "tcsh") == 0 || strcmp(new_shell, "csh") == 0)
333 option_mask32 |= SHELL_IS_TCSH; 353 option_mask32 |= SHELL_IS_TCSH;
334 else 354 else
335 bb_error_msg("unknown shell '%s', assuming bash", new_shell); 355 bb_error_msg("unknown shell '%s', assuming bash", new_shell);
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index ac7e24ff8..4a7f641db 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -8,6 +8,34 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11//config:config HEXDUMP
12//config: bool "hexdump"
13//config: default y
14//config: help
15//config: The hexdump utility is used to display binary data in a readable
16//config: way that is comparable to the output from most hex editors.
17//config:
18//config:config FEATURE_HEXDUMP_REVERSE
19//config: bool "Support -R, reverse of 'hexdump -Cv'"
20//config: default y
21//config: depends on HEXDUMP
22//config: help
23//config: The hexdump utility is used to display binary data in an ascii
24//config: readable way. This option creates binary data from an ascii input.
25//config: NB: this option is non-standard. It's unwise to use it in scripts
26//config: aimed to be portable.
27//config:
28//config:config HD
29//config: bool "hd"
30//config: default y
31//config: help
32//config: hd is an alias to hexdump -C.
33
34//applet:IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump))
35//applet:IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd))
36
37//kbuild:lib-$(CONFIG_HEXDUMP) += hexdump.o
38//kbuild:lib-$(CONFIG_HD) += hexdump.o
11 39
12//usage:#define hexdump_trivial_usage 40//usage:#define hexdump_trivial_usage
13//usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." 41//usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..."
@@ -77,7 +105,9 @@ int hexdump_main(int argc, char **argv)
77 smallint rdump = 0; 105 smallint rdump = 0;
78#endif 106#endif
79 107
80 if (ENABLE_HD && !applet_name[2]) { /* we are "hd" */ 108 if (ENABLE_HD
109 && (!ENABLE_HEXDUMP || !applet_name[2])
110 ) { /* we are "hd" */
81 ch = 'C'; 111 ch = 'C';
82 goto hd_applet; 112 goto hd_applet;
83 } 113 }
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 6c99977cf..084a7f1e9 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -5,7 +5,41 @@
5 * Copyright (C) 2002 Robert Griebl <griebl@gmx.de> 5 * Copyright (C) 2002 Robert Griebl <griebl@gmx.de>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8*/ 8 */
9//config:config HWCLOCK
10//config: bool "hwclock"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: The hwclock utility is used to read and set the hardware clock
15//config: on a system. This is primarily used to set the current time on
16//config: shutdown in the hardware clock, so the hardware will keep the
17//config: correct time when Linux is _not_ running.
18//config:
19//config:config FEATURE_HWCLOCK_LONG_OPTIONS
20//config: bool "Support long options (--hctosys,...)"
21//config: default y
22//config: depends on HWCLOCK && LONG_OPTS
23//config: help
24//config: By default, the hwclock utility only uses short options. If you
25//config: are overly fond of its long options, such as --hctosys, --utc, etc)
26//config: then enable this option.
27//config:
28//config:config FEATURE_HWCLOCK_ADJTIME_FHS
29//config: bool "Use FHS /var/lib/hwclock/adjtime"
30//config: default n # util-linux-ng in Fedora 13 still uses /etc/adjtime
31//config: depends on HWCLOCK
32//config: help
33//config: Starting with FHS 2.3, the adjtime state file is supposed to exist
34//config: at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish
35//config: to use the FHS behavior, answer Y here, otherwise answer N for the
36//config: classic /etc/adjtime path.
37//config:
38//config: pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO
39
40//applet:IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))
41
42//kbuild:lib-$(CONFIG_HWCLOCK) += hwclock.o
9 43
10#include "libbb.h" 44#include "libbb.h"
11/* After libbb.h, since it needs sys/types.h on some systems */ 45/* After libbb.h, since it needs sys/types.h on some systems */
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c
index 38d81af50..76ea3ca4f 100644
--- a/util-linux/ipcrm.c
+++ b/util-linux/ipcrm.c
@@ -7,6 +7,17 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config IPCRM
11//config: bool "ipcrm"
12//config: default y
13//config: help
14//config: The ipcrm utility allows the removal of System V interprocess
15//config: communication (IPC) objects and the associated data structures
16//config: from the system.
17
18//applet:IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_IPCRM) += ipcrm.o
10 21
11//usage:#define ipcrm_trivial_usage 22//usage:#define ipcrm_trivial_usage
12//usage: "[-MQS key] [-mqs id]" 23//usage: "[-MQS key] [-mqs id]"
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index 67a25a8ef..88ae9225d 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -7,6 +7,17 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config IPCS
11//config: bool "ipcs"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: The ipcs utility is used to provide information on the currently
16//config: allocated System V interprocess (IPC) objects in the system.
17
18//applet:IF_IPCS(APPLET(ipcs, BB_DIR_USR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_IPCS) += ipcs.o
10 21
11//usage:#define ipcs_trivial_usage 22//usage:#define ipcs_trivial_usage
12//usage: "[[-smq] -i shmid] | [[-asmq] [-tcplu]]" 23//usage: "[[-smq] -i shmid] | [[-asmq] [-tcplu]]"
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index d450b5a78..4424d9cbb 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -6,6 +6,18 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LOSETUP
10//config: bool "losetup"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: losetup is used to associate or detach a loop device with a regular
15//config: file or block device, and to query the status of a loop device. This
16//config: version does not currently support enabling data encryption.
17
18//kbuild:lib-$(CONFIG_LOSETUP) += losetup.o
19
20//applet:IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP))
9 21
10//usage:#define losetup_trivial_usage 22//usage:#define losetup_trivial_usage
11//usage: "[-r] [-o OFS] {-f|LOOPDEV} FILE - associate loop devices\n" 23//usage: "[-r] [-o OFS] {-f|LOOPDEV} FILE - associate loop devices\n"
diff --git a/util-linux/lspci.c b/util-linux/lspci.c
index 514678afd..8b38a2366 100644
--- a/util-linux/lspci.c
+++ b/util-linux/lspci.c
@@ -6,6 +6,19 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LSPCI
10//config: bool "lspci"
11//config: default y
12//config: #select PLATFORM_LINUX
13//config: help
14//config: lspci is a utility for displaying information about PCI buses in the
15//config: system and devices connected to them.
16//config:
17//config: This version uses sysfs (/sys/bus/pci/devices) only.
18
19//applet:IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_LSPCI) += lspci.o
9 22
10//usage:#define lspci_trivial_usage 23//usage:#define lspci_trivial_usage
11//usage: "[-mk]" 24//usage: "[-mk]"
diff --git a/util-linux/lsusb.c b/util-linux/lsusb.c
index 540f21ec6..7d36d6f5a 100644
--- a/util-linux/lsusb.c
+++ b/util-linux/lsusb.c
@@ -6,6 +6,19 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LSUSB
10//config: bool "lsusb"
11//config: default y
12//config: #select PLATFORM_LINUX
13//config: help
14//config: lsusb is a utility for displaying information about USB buses in the
15//config: system and devices connected to them.
16//config:
17//config: This version uses sysfs (/sys/bus/usb/devices) only.
18
19//applet:IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_LSUSB) += lsusb.o
9 22
10//usage:#define lsusb_trivial_usage NOUSAGE_STR 23//usage:#define lsusb_trivial_usage NOUSAGE_STR
11//usage:#define lsusb_full_usage "" 24//usage:#define lsusb_full_usage ""
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index 413e7aa15..5816a208e 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -7,6 +7,26 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config MKE2FS
11//config: bool "mke2fs"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: Utility to create EXT2 filesystems.
16//config:
17//config:config MKFS_EXT2
18//config: bool "mkfs.ext2"
19//config: default y
20//config: select PLATFORM_LINUX
21//config: help
22//config: Alias to "mke2fs".
23
24//applet:IF_MKE2FS(APPLET_ODDNAME(mke2fs, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2))
25//applet:IF_MKFS_EXT2(APPLET_ODDNAME(mkfs.ext2, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2))
26////////:IF_MKFS_EXT3(APPLET_ODDNAME(mkfs.ext3, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2))
27
28//kbuild:lib-$(CONFIG_MKE2FS) += mkfs_ext2.o
29//kbuild:lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o
10 30
11//usage:#define mkfs_ext2_trivial_usage 31//usage:#define mkfs_ext2_trivial_usage
12//usage: "[-Fn] " 32//usage: "[-Fn] "
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index aaabf8453..912246b93 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -62,6 +62,27 @@
62 * Modified for BusyBox by Erik Andersen <andersen@debian.org> -- 62 * Modified for BusyBox by Erik Andersen <andersen@debian.org> --
63 * removed getopt based parser and added a hand rolled one. 63 * removed getopt based parser and added a hand rolled one.
64 */ 64 */
65//config:config MKFS_MINIX
66//config: bool "mkfs_minix"
67//config: default y
68//config: select PLATFORM_LINUX
69//config: help
70//config: The minix filesystem is a nice, small, compact, read-write filesystem
71//config: with little overhead. If you wish to be able to create minix
72//config: filesystems this utility will do the job for you.
73//config:
74//config:config FEATURE_MINIX2
75//config: bool "Support Minix fs v2 (fsck_minix/mkfs_minix)"
76//config: default y
77//config: depends on FSCK_MINIX || MKFS_MINIX
78//config: help
79//config: If you wish to be able to create version 2 minix filesystems, enable
80//config: this. If you enabled 'mkfs_minix' then you almost certainly want to
81//config: be using the version 2 filesystem support.
82
83//applet:IF_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, BB_DIR_SBIN, BB_SUID_DROP, mkfs_minix))
84
85//kbuild:lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o
65 86
66//usage:#define mkfs_minix_trivial_usage 87//usage:#define mkfs_minix_trivial_usage
67//usage: "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]" 88//usage: "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]"
diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c
index 0a31ee44f..d01119f7f 100644
--- a/util-linux/mkfs_reiser.c
+++ b/util-linux/mkfs_reiser.c
@@ -6,6 +6,17 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config MKFS_REISER
10//config: bool "mkfs_reiser"
11//config: default n
12//config: select PLATFORM_LINUX
13//config: help
14//config: Utility to create ReiserFS filesystems.
15//config: Note: this applet needs a lot of testing and polishing.
16
17//applet:IF_MKFS_REISER(APPLET_ODDNAME(mkfs.reiser, mkfs_reiser, BB_DIR_SBIN, BB_SUID_DROP, mkfs_reiser))
18
19//kbuild:lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o
9 20
10//usage:#define mkfs_reiser_trivial_usage 21//usage:#define mkfs_reiser_trivial_usage
11//usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]" 22//usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]"
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index d53c751eb..ab70853a1 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -7,6 +7,25 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config MKDOSFS
11//config: bool "mkdosfs"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: Utility to create FAT32 filesystems.
16//config:
17//config:config MKFS_VFAT
18//config: bool "mkfs.vfat"
19//config: default y
20//config: select PLATFORM_LINUX
21//config: help
22//config: Alias to "mkdosfs".
23
24//applet:IF_MKDOSFS(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
25//applet:IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
26
27//kbuild:lib-$(CONFIG_MKDOSFS) += mkfs_vfat.o
28//kbuild:lib-$(CONFIG_MKFS_VFAT) += mkfs_vfat.o
10 29
11//usage:#define mkfs_vfat_trivial_usage 30//usage:#define mkfs_vfat_trivial_usage
12//usage: "[-v] [-n LABEL] BLOCKDEV [KBYTES]" 31//usage: "[-v] [-n LABEL] BLOCKDEV [KBYTES]"
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index dcb53f008..954a1948d 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -5,6 +5,29 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8//config:config MKSWAP
9//config: bool "mkswap"
10//config: default y
11//config: help
12//config: The mkswap utility is used to configure a file or disk partition as
13//config: Linux swap space. This allows Linux to use the entire file or
14//config: partition as if it were additional RAM, which can greatly increase
15//config: the capability of low-memory machines. This additional memory is
16//config: much slower than real RAM, but can be very helpful at preventing your
17//config: applications being killed by the Linux out of memory (OOM) killer.
18//config: Once you have created swap space using 'mkswap' you need to enable
19//config: the swap space using the 'swapon' utility.
20//config:
21//config:config FEATURE_MKSWAP_UUID
22//config: bool "UUID support"
23//config: default y
24//config: depends on MKSWAP
25//config: help
26//config: Generate swap spaces with universally unique identifiers.
27
28//applet:IF_MKSWAP(APPLET(mkswap, BB_DIR_SBIN, BB_SUID_DROP))
29
30//kbuild:lib-$(CONFIG_MKSWAP) += mkswap.o
8 31
9//usage:#define mkswap_trivial_usage 32//usage:#define mkswap_trivial_usage
10//usage: "[-L LBL] BLOCKDEV [KBYTES]" 33//usage: "[-L LBL] BLOCKDEV [KBYTES]"
diff --git a/util-linux/more.c b/util-linux/more.c
index f6923efda..d04c17f90 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -13,6 +13,19 @@
13 * 13 *
14 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 */ 15 */
16//config:config MORE
17//config: bool "more"
18//config: default y
19//config: help
20//config: more is a simple utility which allows you to read text one screen
21//config: sized page at a time. If you want to read text that is larger than
22//config: the screen, and you are using anything faster than a 300 baud modem,
23//config: you will probably find this utility very helpful. If you don't have
24//config: any need to reading text files, you can leave this disabled.
25
26//applet:IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP))
27
28//kbuild:lib-$(CONFIG_MORE) += more.o
16 29
17//usage:#define more_trivial_usage 30//usage:#define more_trivial_usage
18//usage: "[FILE]..." 31//usage: "[FILE]..."
diff --git a/util-linux/mount.c b/util-linux/mount.c
index eb8b7ba7b..42962b859 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -112,6 +112,14 @@
112//config: help 112//config: help
113//config: Support mount -T (specifying an alternate fstab) 113//config: Support mount -T (specifying an alternate fstab)
114 114
115/* On full-blown systems, requires suid for user mounts.
116 * But it's not unthinkable to have it available in non-suid flavor on some systems,
117 * for viewing mount table.
118 * Therefore we use BB_SUID_MAYBE instead of BB_SUID_REQUIRE: */
119//applet:IF_MOUNT(APPLET(mount, BB_DIR_BIN, IF_DESKTOP(BB_SUID_MAYBE) IF_NOT_DESKTOP(BB_SUID_DROP)))
120
121//kbuild:lib-$(CONFIG_MOUNT) += mount.o
122
115//usage:#define mount_trivial_usage 123//usage:#define mount_trivial_usage
116//usage: "[OPTIONS] [-o OPT] DEVICE NODE" 124//usage: "[OPTIONS] [-o OPT] DEVICE NODE"
117//usage:#define mount_full_usage "\n\n" 125//usage:#define mount_full_usage "\n\n"
diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c
index 83f01fabd..9bdae506c 100644
--- a/util-linux/pivot_root.c
+++ b/util-linux/pivot_root.c
@@ -8,6 +8,22 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11//config:config PIVOT_ROOT
12//config: bool "pivot_root"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: The pivot_root utility swaps the mount points for the root filesystem
17//config: with some other mounted filesystem. This allows you to do all sorts
18//config: of wild and crazy things with your Linux system and is far more
19//config: powerful than 'chroot'.
20//config:
21//config: Note: This is for initrd in linux 2.4. Under initramfs (introduced
22//config: in linux 2.6) use switch_root instead.
23
24//applet:IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP))
25
26//kbuild:lib-$(CONFIG_PIVOT_ROOT) += pivot_root.o
11 27
12//usage:#define pivot_root_trivial_usage 28//usage:#define pivot_root_trivial_usage
13//usage: "NEW_ROOT PUT_OLD" 29//usage: "NEW_ROOT PUT_OLD"
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 8075ef6af..8dd784d3d 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -6,7 +6,19 @@
6 * by Sterling Huxley <sterling@europa.com> 6 * by Sterling Huxley <sterling@europa.com>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9*/ 9 */
10//config:config RDATE
11//config: bool "rdate"
12//config: default y
13//config: help
14//config: The rdate utility allows you to synchronize the date and time of your
15//config: system clock with the date and time of a remote networked system using
16//config: the RFC868 protocol, which is built into the inetd daemon on most
17//config: systems.
18
19//applet:IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_RDATE) += rdate.o
10 22
11//usage:#define rdate_trivial_usage 23//usage:#define rdate_trivial_usage
12//usage: "[-sp] HOST" 24//usage: "[-sp] HOST"
diff --git a/util-linux/rdev.c b/util-linux/rdev.c
index 465281756..0e1578e33 100644
--- a/util-linux/rdev.c
+++ b/util-linux/rdev.c
@@ -8,6 +8,15 @@
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 * 9 *
10 */ 10 */
11//config:config RDEV
12//config: bool "rdev"
13//config: default y
14//config: help
15//config: Print the device node associated with the filesystem mounted at '/'.
16
17//applet:IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_RDEV) += rdev.o
11 20
12//usage:#define rdev_trivial_usage 21//usage:#define rdev_trivial_usage
13//usage: "" 22//usage: ""
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index 345b676ba..31abb6bb2 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -31,6 +31,16 @@
31 * Taken from util-linux and adapted for busybox by 31 * Taken from util-linux and adapted for busybox by
32 * Paul Mundt <lethal@linux-sh.org>. 32 * Paul Mundt <lethal@linux-sh.org>.
33 */ 33 */
34//config:config READPROFILE
35//config: bool "readprofile"
36//config: default y
37//config: #select PLATFORM_LINUX
38//config: help
39//config: This allows you to parse /proc/profile for basic profiling.
40
41//applet:IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP))
42
43//kbuild:lib-$(CONFIG_READPROFILE) += readprofile.o
34 44
35//usage:#define readprofile_trivial_usage 45//usage:#define readprofile_trivial_usage
36//usage: "[OPTIONS]" 46//usage: "[OPTIONS]"
@@ -164,7 +174,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
164 bb_error_msg_and_die("%s(%i): wrong map line", 174 bb_error_msg_and_die("%s(%i): wrong map line",
165 mapFile, maplineno); 175 mapFile, maplineno);
166 176
167 if (!strcmp(fn_name, "_stext")) /* only elf works like this */ { 177 if (strcmp(fn_name, "_stext") == 0) /* only elf works like this */ {
168 add0 = fn_add; 178 add0 = fn_add;
169 break; 179 break;
170 } 180 }
@@ -214,8 +224,9 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
214 if (optBins) { 224 if (optBins) {
215 if (optVerbose || this > 0) 225 if (optVerbose || this > 0)
216 printf(" total\t\t\t\t%u\n", this); 226 printf(" total\t\t\t\t%u\n", this);
217 } else if ((this || optAll) 227 } else
218 && (fn_len = next_add-fn_add) != 0 228 if ((this || optAll)
229 && (fn_len = next_add-fn_add) != 0
219 ) { 230 ) {
220 if (optVerbose) 231 if (optVerbose)
221 printf("%016llx %-40s %6u %8.4f\n", fn_add, 232 printf("%016llx %-40s %6u %8.4f\n", fn_add,
diff --git a/util-linux/rev.c b/util-linux/rev.c
index f952447e4..d34838a35 100644
--- a/util-linux/rev.c
+++ b/util-linux/rev.c
@@ -5,17 +5,16 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8
9//applet:IF_REV(APPLET(rev, BB_DIR_BIN, BB_SUID_DROP))
10
11//kbuild:lib-$(CONFIG_REV) += rev.o
12
13//config:config REV 8//config:config REV
14//config: bool "rev" 9//config: bool "rev"
15//config: default y 10//config: default y
16//config: help 11//config: help
17//config: Reverse lines of a file or files. 12//config: Reverse lines of a file or files.
18 13
14//applet:IF_REV(APPLET(rev, BB_DIR_BIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_REV) += rev.o
17
19//usage:#define rev_trivial_usage 18//usage:#define rev_trivial_usage
20//usage: "[FILE]..." 19//usage: "[FILE]..."
21//usage:#define rev_full_usage "\n\n" 20//usage:#define rev_full_usage "\n\n"
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index 8aee0cfcb..54fc70583 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -22,6 +22,16 @@
22 * RTC uses a local timezone instead (maybe you dual-boot MS-Windows). 22 * RTC uses a local timezone instead (maybe you dual-boot MS-Windows).
23 * That flag should not be needed on systems with adjtime support. 23 * That flag should not be needed on systems with adjtime support.
24 */ 24 */
25//config:config RTCWAKE
26//config: bool "rtcwake"
27//config: default y
28//config: select PLATFORM_LINUX
29//config: help
30//config: Enter a system sleep state until specified wakeup time.
31
32//applet:IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP))
33
34//kbuild:lib-$(CONFIG_RTCWAKE) += rtcwake.o
25 35
26//usage:#define rtcwake_trivial_usage 36//usage:#define rtcwake_trivial_usage
27//usage: "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]" 37//usage: "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]"
diff --git a/util-linux/script.c b/util-linux/script.c
index 86475c1f1..c5063e8a1 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -10,6 +10,15 @@
10 * 10 *
11 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 */ 12 */
13//config:config SCRIPT
14//config: bool "script"
15//config: default y
16//config: help
17//config: The script makes typescript of terminal session.
18
19//applet:IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_SCRIPT) += script.o
13 22
14//usage:#define script_trivial_usage 23//usage:#define script_trivial_usage
15//usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]" 24//usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]"
diff --git a/util-linux/scriptreplay.c b/util-linux/scriptreplay.c
index 382f56d9a..8a0c7489d 100644
--- a/util-linux/scriptreplay.c
+++ b/util-linux/scriptreplay.c
@@ -7,6 +7,16 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10//config:config SCRIPTREPLAY
11//config: bool "scriptreplay"
12//config: default y
13//config: help
14//config: This program replays a typescript, using timing information
15//config: given by script -t.
16
17//applet:IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o
10 20
11//usage:#define scriptreplay_trivial_usage 21//usage:#define scriptreplay_trivial_usage
12//usage: "timingfile [typescript [divisor]]" 22//usage: "timingfile [typescript [divisor]]"
diff --git a/util-linux/setarch.c b/util-linux/setarch.c
index 2e989ec2a..ec473e9cb 100644
--- a/util-linux/setarch.c
+++ b/util-linux/setarch.c
@@ -15,12 +15,28 @@
15//config: specified program (usually a shell). It only makes sense to have 15//config: specified program (usually a shell). It only makes sense to have
16//config: this util on a system that supports both 64bit and 32bit userland 16//config: this util on a system that supports both 64bit and 32bit userland
17//config: (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). 17//config: (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...).
18//config:
19//config:config LINUX32
20//config: bool "linux32"
21//config: default y
22//config: select PLATFORM_LINUX
23//config: help
24//config: Alias to "setarch linux32".
25//config:
26//config:config LINUX64
27//config: bool "linux64"
28//config: default y
29//config: select PLATFORM_LINUX
30//config: help
31//config: Alias to "setarch linux64".
18 32
19//applet:IF_SETARCH(APPLET(setarch, BB_DIR_BIN, BB_SUID_DROP)) 33//applet:IF_SETARCH(APPLET(setarch, BB_DIR_BIN, BB_SUID_DROP))
20//applet:IF_SETARCH(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32)) 34//applet:IF_LINUX32(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32))
21//applet:IF_SETARCH(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64)) 35//applet:IF_LINUX64(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64))
22 36
23//kbuild:lib-$(CONFIG_SETARCH) += setarch.o 37//kbuild:lib-$(CONFIG_SETARCH) += setarch.o
38//kbuild:lib-$(CONFIG_LINUX32) += setarch.o
39//kbuild:lib-$(CONFIG_LINUX64) += setarch.o
24 40
25//usage:#define setarch_trivial_usage 41//usage:#define setarch_trivial_usage
26//usage: "PERSONALITY [-R] PROG ARGS" 42//usage: "PERSONALITY [-R] PROG ARGS"
@@ -58,12 +74,15 @@ int setarch_main(int argc UNUSED_PARAM, char **argv)
58 if (ENABLE_SETARCH && applet_name[0] == 's' 74 if (ENABLE_SETARCH && applet_name[0] == 's'
59 && argv[1] && is_prefixed_with(argv[1], "linux") 75 && argv[1] && is_prefixed_with(argv[1], "linux")
60 ) { 76 ) {
61 applet_name = argv[1];
62 argv++; 77 argv++;
78 applet_name = argv[0];
63 } 79 }
64 if (applet_name[5] == '6') /* linux64 */ 80 if ((!ENABLE_SETARCH && !ENABLE_LINUX32) || applet_name[5] == '6')
81 /* linux64 */
65 pers = PER_LINUX; 82 pers = PER_LINUX;
66 else if (applet_name[5] == '3') /* linux32 */ 83 else
84 if ((!ENABLE_SETARCH && !ENABLE_LINUX64) || applet_name[5] == '3')
85 /* linux32 */
67 pers = PER_LINUX32; 86 pers = PER_LINUX32;
68 else 87 else
69 bb_show_usage(); 88 bb_show_usage();
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 6713852e5..b8f4e9447 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -6,6 +6,46 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SWAPON
10//config: bool "swapon"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: This option enables the 'swapon' utility.
15//config: Once you have created some swap space using 'mkswap', you also need
16//config: to enable your swap space with the 'swapon' utility. The 'swapoff'
17//config: utility is used, typically at system shutdown, to disable any swap
18//config: space. If you are not using any swap space, you can leave this
19//config: option disabled.
20//config:
21//config:config FEATURE_SWAPON_DISCARD
22//config: bool "Support discard option -d"
23//config: default y
24//config: depends on SWAPON
25//config: help
26//config: Enable support for discarding swap area blocks at swapon and/or as
27//config: the kernel frees them. This option enables both the -d option on
28//config: 'swapon' and the 'discard' option for swap entries in /etc/fstab.
29//config:
30//config:config FEATURE_SWAPON_PRI
31//config: bool "Support priority option -p"
32//config: default y
33//config: depends on SWAPON
34//config: help
35//config: Enable support for setting swap device priority in swapon.
36//config:
37//config:config SWAPOFF
38//config: bool "swapoff"
39//config: default y
40//config: select PLATFORM_LINUX
41//config: help
42//config: This option enables the 'swapoff' utility.
43
44//applet:IF_SWAPON(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon))
45//applet:IF_SWAPOFF(APPLET_ODDNAME(swapoff, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapoff))
46
47//kbuild:lib-$(CONFIG_SWAPON) += swaponoff.o
48//kbuild:lib-$(CONFIG_SWAPOFF) += swaponoff.o
9 49
10//usage:#define swapon_trivial_usage 50//usage:#define swapon_trivial_usage
11//usage: "[-a] [-e]" IF_FEATURE_SWAPON_DISCARD(" [-d[POL]]") IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]" 51//usage: "[-a] [-e]" IF_FEATURE_SWAPON_DISCARD(" [-d[POL]]") IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]"
@@ -74,7 +114,15 @@ struct globals {
74#endif 114#endif
75#define INIT_G() do { setup_common_bufsiz(); } while (0) 115#define INIT_G() do { setup_common_bufsiz(); } while (0)
76 116
77#define do_swapoff (applet_name[5] == 'f') 117#if ENABLE_SWAPOFF
118# if ENABLE_SWAPON
119# define do_swapoff (applet_name[5] == 'f')
120# else
121# define do_swapoff 1
122# endif
123#else
124# define do_swapoff 0
125#endif
78 126
79/* Command line options */ 127/* Command line options */
80enum { 128enum {
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index 7960b672c..6034485d7 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -5,6 +5,29 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8//config:config SWITCH_ROOT
9//config: bool "switch_root"
10//config: default y
11//config: select PLATFORM_LINUX
12//config: help
13//config: The switch_root utility is used from initramfs to select a new
14//config: root device. Under initramfs, you have to use this instead of
15//config: pivot_root. (Stop reading here if you don't care why.)
16//config:
17//config: Booting with initramfs extracts a gzipped cpio archive into rootfs
18//config: (which is a variant of ramfs/tmpfs). Because rootfs can't be moved
19//config: or unmounted*, pivot_root will not work from initramfs. Instead,
20//config: switch_root deletes everything out of rootfs (including itself),
21//config: does a mount --move that overmounts rootfs with the new root, and
22//config: then execs the specified init program.
23//config:
24//config: * Because the Linux kernel uses rootfs internally as the starting
25//config: and ending point for searching through the kernel's doubly linked
26//config: list of active mount points. That's why.
27
28//applet:IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP))
29
30//kbuild:lib-$(CONFIG_SWITCH_ROOT) += switch_root.o
8 31
9//usage:#define switch_root_trivial_usage 32//usage:#define switch_root_trivial_usage
10//usage: "[-c /dev/console] NEW_ROOT NEW_INIT [ARGS]" 33//usage: "[-c /dev/console] NEW_ROOT NEW_INIT [ARGS]"
diff --git a/util-linux/uevent.c b/util-linux/uevent.c
index b98fe6160..c22216a8a 100644
--- a/util-linux/uevent.c
+++ b/util-linux/uevent.c
@@ -3,7 +3,6 @@
3 * 3 *
4 * Licensed under GPLv2, see file LICENSE in this source tree. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */ 5 */
6
7//config:config UEVENT 6//config:config UEVENT
8//config: bool "uevent" 7//config: bool "uevent"
9//config: default y 8//config: default y
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 91da69674..78eef57a5 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -7,6 +7,26 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config UMOUNT
11//config: bool "umount"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: When you want to remove a mounted filesystem from its current mount
16//config: point, for example when you are shutting down the system, the
17//config: 'umount' utility is the tool to use. If you enabled the 'mount'
18//config: utility, you almost certainly also want to enable 'umount'.
19//config:
20//config:config FEATURE_UMOUNT_ALL
21//config: bool "Support option -a"
22//config: default y
23//config: depends on UMOUNT
24//config: help
25//config: Support -a option to unmount all currently mounted filesystems.
26
27//applet:IF_UMOUNT(APPLET(umount, BB_DIR_BIN, BB_SUID_DROP))
28
29//kbuild:lib-$(CONFIG_UMOUNT) += umount.o
10 30
11//usage:#define umount_trivial_usage 31//usage:#define umount_trivial_usage
12//usage: "[OPTIONS] FILESYSTEM|DIRECTORY" 32//usage: "[OPTIONS] FILESYSTEM|DIRECTORY"
diff --git a/util-linux/unshare.c b/util-linux/unshare.c
index dcc59559a..bbabeef55 100644
--- a/util-linux/unshare.c
+++ b/util-linux/unshare.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10//config:config UNSHARE 9//config:config UNSHARE
11//config: bool "unshare" 10//config: bool "unshare"
12//config: default y 11//config: default y