From db63c22446443dd3954404ce154738c81b621792 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Tue, 5 Nov 2013 15:04:34 +0100 Subject: [PATCH] work-3.2.1 squash commit Squashed commit of the following: commit 8fcdd34f87fe9daaac235315d3b6e1d4986ea0ed Author: David van Moolenbroek Date: Tue Nov 5 14:26:57 2013 +0100 Fix for ramdisk generation (?) Change-Id: If7fd55d9a146d7d7b621da274ac0472a5b246c36 commit 5ffd24ad49bff556adceb050c7cbfddd774ed200 Author: David van Moolenbroek Date: Tue Nov 5 13:16:56 2013 +0100 Rebase fixes Too lazy to merge this into the appropriate patch. Change-Id: I66505d6a0d65330656e78ec9615a026f892b8609 commit 0240220770e6cc18fe16bd0c82e6e5e2c88a4301 Author: David van Moolenbroek Date: Sun Oct 6 15:58:54 2013 +0200 VFS: further cleanup of device code - all TTY-related exceptions have now been merged into the regular code paths, allowing non-TTY drivers to expose TTY-like devices; - as part of this, CTTY_MAJOR is now fully managed by VFS instead of being an ugly stepchild of the TTY driver; - device styles have become completely obsolete, support for them has been removed throughout the system; same for device flags, which had already become useless a while ago; - device map open/close and I/O function pointers have lost their use, thus finally making the VFS device code actually readable; - the device-unrelated pm_setsid has been moved to misc.c; - some other small cleanup-related changes. Change-Id: If90b10d1818e98a12139da3e94a15d250c9933da commit 07d10dc91955475340005fa86adf71aa981712c8 Author: David van Moolenbroek Date: Sat Oct 5 14:59:59 2013 +0200 IS: dump number of in-use FDs for VFS Change-Id: If0e2092d5a8c384c31b1f44cc0591bb119c6d8de commit ced39723e3e7c39a4a2ef516834702a36a6a26c8 Author: David van Moolenbroek Date: Sat Oct 5 01:40:58 2013 +0200 TTY: fix earlier PTY select "improvement" It was just plain wrong. Change-Id: Ieab4b4f01d9461e05e0d0ba6427a99d863d6b98d commit a4a63c15cc5f9daf2e149b84ec930834fe24a983 Author: David van Moolenbroek Date: Sat Oct 5 16:31:35 2013 +0200 Extend dupfrom(2) into copyfd(2) This single function allows copying file descriptors from and to processes, and closing a previously copied remote file descriptor. This function replaces the five FD-related UDS backcalls. While it limits the total number of in-flight file descriptors to OPEN_MAX, this change greatly improves crash recovery support of UDS, since all in-flight file descriptors will be closed instead of keeping them open indefinitely (causing VFS to crash on system shutdown). With the new copyfd call, UDS becomes simpler, and the concept of filps is no longer exposed outside of VFS. This patch also moves the checkperms(2) stub into libminlib, thus fully abstracting away message details of VFS communication from UDS. Change-Id: Idd32ad390a566143c8ef66955e5ae2c221cff966 commit 663e0abb01990da768f1701df6366a4d3bbd67c1 Author: David van Moolenbroek Date: Sat Oct 5 12:50:44 2013 +0200 VFS: better dupfrom(2) deadlock detection Change-Id: I29f00075698888c7c8ca60b47ab82fba8c606f4e commit 54c509663718cc109b0f11ab0adc196bfa82015b Author: David van Moolenbroek Date: Fri Oct 4 21:10:01 2013 +0200 UDS: sendmsg/recvmsg fixes - sendmsg: the accumulation of multiple in-flight file descriptors was already described in the comments; now the code actually does what the comments say :) -- also, added robustness in case of a failure; - recvmsg: only create a socket rights message if there are file descriptors pending at all; - recvmsg: copy back the control message length; - recvmsg: use CMSG_SPACE instead of CMSG_LEN to compute sizes. Not sure if all of this is now working according to specification, but at least tmux seems to be happy with it. Change-Id: I8d076c14c3ff3220b7fea730e0f08f4b4254ede5 commit b0a891c329d721eb84e06ecac803789fe8197306 Author: David van Moolenbroek Date: Fri Oct 4 18:41:21 2013 +0200 UDS: add support for FIONREAD Change-Id: I50030012b408242a86f8c55017429acdadff49d1 commit e81d59c874d57d0d0010d3b1ace2351d01f66766 Author: David van Moolenbroek Date: Fri Oct 4 18:00:42 2013 +0200 UDS: align struct sockaddr_un with NetBSD Well, make a start, anyway. Our copy was missing a legacy field from the structure, that could very well cause applications to fail trying to set, clear, or check it. As a consequence, SUN_LEN now yields the same result as on NetBSD. Change-Id: I80f6aff7769be402b3bd3959f64d314509ed138c commit 66f8ad9ac7f0e008cdf416877eeab63ed599477d Author: David van Moolenbroek Date: Fri Oct 4 17:57:42 2013 +0200 UDS: support for nonblocking sockets This patch includes several other fixes, which are now tested in the test56 test set. Change-Id: I9535d5a6c072abf966252838522c5f65b353c6c2 commit 9b4a7ba7ced0b40bf650451ec7baf2935b2ccfe7 Author: David van Moolenbroek Date: Fri Oct 4 16:46:18 2013 +0200 UDS: clean up source code - move VFS calls to a separate source file; - solve a few subtle bugs, mostly in error handling; - simplify debug reporting code; - make a few definitions more independent; - restyle to something closer to KNF. Change-Id: I7b0537adfccac8b92b5cc3e78dac9f5ce3c79f03 commit 881641da1fa711d2d4bf8687cb5beb843801daf8 Author: David van Moolenbroek Date: Fri Oct 4 16:29:40 2013 +0200 UDS: split off from PFS Change-Id: I769cbd64aa6e5e85a797caf0f8bbb4c20e145263 commit 2baef79e569c4cebda1a3f831b8e329295e449e6 Author: David van Moolenbroek Date: Wed Oct 2 19:37:00 2013 +0200 at_wini: PCI-only now; one controller per instance - remove non-PCI support, since all supported platforms with at_wini devices also have PCI support by now; - correspondingly, stop using information from the BIOS altogether; - limit each driver instance to one controller, to be in line with the general MINIX3 one-instance-per-controller driver model; this limits the number of disks per at_wini instance to four; - go through the controllers by the order of their occurrence in the PCI table, thus removing the exception for compatibility devices; - let the second at_wini instance shut down silently if there is only one IDE controller; - clean up some extra code we don't need anymore, and resolve some WARNS=5 level warnings. Overall, these changes should simplify automatic loading of the right disk drivers at boot time in the future. Change-Id: Ia64d08cfbeb9916abd68c9c2941baeb87d02a806 commit f7aaabe7e0ae93b439b02d3c21c38f11bae7bbcf Author: David van Moolenbroek Date: Tue Oct 1 00:42:41 2013 +0200 system.conf: subsystem VID/DID matching support - change "vid/did" to "vid:did", old form still supported for now; - allow "vid:did/subvid:subdid" specification in system.conf, in which case a device will be visible to a driver if the subsystem VID/DID also match. Change-Id: I7aef54da1b0bc81e24b5d98f1a28416f38f8b266 commit 178d896a32140285e7e9f00dba7bb4a871752f60 Author: Lionel Sambuc Date: Tue Oct 8 19:00:16 2013 +0200 usr.bin/man: Update Change-Id: I0c5d2115ba384687032f7b2af50d99dedc323b7a commit 33e8e00217bbf38300f266dda5a494ad4e51bebd Author: Lionel Sambuc Date: Tue Oct 8 18:05:29 2013 +0200 external/bsd/mdocml: Update Change-Id: I17b54e52e8322676d83ed4386f586f8ef3029f72 commit e28c0794f18eae77faf3055dadbe76a963242c4e Author: Lionel Sambuc Date: Thu Oct 3 18:26:21 2013 +0200 Adapting build system to call MAKEDEV for /dev * Remove static proto.dev * Update releasetools/*image.sh not to use proto.dev, as well as minor comments cleanup * Add TOOL_TOPROTO Change-Id: If7dc16d4ebb3b0c4e859786fad25d4af000c999f commit d26b8149f47461aac67078b8a63ddae21ecdf4f8 Author: Lionel Sambuc Date: Thu Oct 3 13:54:24 2013 +0200 MAKEDEV: Add mtree output, and ramdisk set. Change-Id: I36cb7e9451960189a33a04a5c2e3ddb19c7be75e commit 8dc3249c2ec209689922abb306b0e3d15e6a0347 Author: David van Moolenbroek Date: Sat Oct 5 20:24:25 2013 +0200 3.3.0 sync fixes Keeping this version at 3.2.1 though, mainly for pkgsrc. Change-Id: Ic91e326623f6dbad58754152c4a632e4406f1117 commit f61a525630a33734481bfd8f0994ae33fef6c3fb Author: David van Moolenbroek Date: Wed Oct 2 13:37:49 2013 +0200 keymaps: improve keypad slash support Now that the keymaps can distinguish between the regular slash key and the slash key on the numeric keypad, we can avoid localization of the latter. Change-Id: I20ead7d26a9baa82f5a522562524fd75d44efb42 commit 81e1e0e8e10c08459af9b7d24f51eff41225b62d Author: Mikal Villa Date: Wed Oct 2 12:30:03 2013 +0200 Norwegian keymap Change-Id: I181234afc8f1a058e92af6c1fe88979463aaff45 commit c9fc72ef1769f677ad6c932e84959f8756b32264 Author: Thomas Cort Date: Fri Sep 6 21:40:42 2013 -0400 Importing usr.bin/uname Change-Id: I4c316221e288edd839e26a2af4cb59f28bf722c1 commit 320e18fd3269219d4b68ba0df3ff8f8434a24a09 Author: Thomas Cort Date: Fri Sep 6 21:40:31 2013 -0400 uname: normalize release and version Most systems provide the full version number in the 'release' field and the kernel version in 'version'. Minix used to split the full version number between release and version which caused problems for pkgsrc and other applications. This patch brings Minix's uname in line with other systems such as NetBSD. It also brings the getty banner in line with NetBSD. Old Minix uname: sysname->Minix nodename->10.0.2.15 release->3 version->2.1 machine->i686 New Minix uname: sysname->Minix nodename->10.0.2.15 release->3.2.1 version->Minix 3.2.1 (GENERIC) machine->i686 Change-Id: I966633dfdcf2f9485966bb0d0d042afc45bbeb7d commit 3840323699856b0ab67b3c6c3b79695acc25ffcb Author: Lionel Sambuc Date: Thu Sep 19 10:57:10 2013 +0200 Replacing timer_t by netbsd's timer_t * Renamed struct timer to struct minix_timer * Renamed timer_t to minix_timer_t * Ensured all the code uses the minix_timer_t typedef * Removed ifdef around _BSD_TIMER_T * Removed include/timers.h and merged it into include/minix/timers.h * Resolved prototype conflict by renaming kernel's (re)set_timer to (re)set_kernel_timer. Change-Id: I56f0f30dfed96e1a0575d92492294cf9a06468a5 commit 23906ce75094c89071c04c6a2a2da780d5d1d9d1 Author: Lionel Sambuc Date: Wed Oct 2 10:56:24 2013 +0200 ARM serial driver: Comment termios_baud_rate. The B0-B115200 defines are flags, and not the actual speed they represent. This fixes an incoherency for B0 handling, and documents why it is required to call the function again after changing the speed flag. DFL_BAUD is set to one of the flag, so to translate it to an actual speed, the function calls itself again, which will always be able to finish without inducing another recursive call. Change-Id: I04ebfaefee31a88d05f0b726352d1581a966147b commit 92db382b054926bc494cf369731e67af91033cc8 Author: David van Moolenbroek Date: Tue Oct 1 23:25:01 2013 +0200 TTY: skip /dev/log checks if console is serial It is unclear why /dev/log has its own open/close rules, but those rules conflict with serial console redirection. This does not solve the root of the problem, but it puts back in place more or less the same workaround that was already in place before the TTY overhaul. Change-Id: Ib53abbc28a76c1f2b0befc8448aeed0173bc96a5 commit f1b6f94f744e82b0a4f0fbe8967a4986e079c7cd Author: David van Moolenbroek Date: Sat Oct 5 19:45:42 2013 +0200 Corrections to keep VFS ABI-compatible Change-Id: Id8a53a687577c1b6f83c11c2e5fb0b8ed1cd2a08 commit 1d9f12eec8edb0ed8b9bc3cb05eb342d6e4ffb03 Author: David van Moolenbroek Date: Sat Oct 5 19:35:11 2013 +0200 Remove support for obsolete 3.2.1 ABI Change-Id: I76b4960bda41f55d9c42f8c99c5beae3424ca851 commit 93267010fcf5a6de5bc4ea511e1edab09c2362aa Author: David van Moolenbroek Date: Sat Aug 31 22:59:44 2013 +0200 Fix various file system warnings Change-Id: Ied10498c3ae14f9f2fd06914f23239df330fa296 commit 42a4fca69efd41f11d28e5b4a4df45c3a14ea91f Author: David van Moolenbroek Date: Sat Oct 5 19:22:13 2013 +0200 VFS/FS: replace protocol version with flag field The main motivation for this change is that only Loris supports multithreading, and Loris supports dynamic thread allocation, so the number of supported threads can be implemented as a bit flag (i.e., either 1 or "at least as many as VFS has"). The ABI break obviates the need to support file system versioning at this time, and several other aspects are better implemented as flags as well. Other changes: - replace peek/bpeek test upon mount with FS flag as well; - mark libsffs as 64-bit file size capable; - remove old (3.2.1) getdents support. Change-Id: I313eace9c50ed816656c31cd47d969033d952a03 commit 6237d4580b2e7f4ca37222581c44f3898a9f2985 Author: Lionel Sambuc Date: Fri Apr 19 13:16:51 2013 +0200 usr.bin/stat Update Change-Id: I029160c73baab1b3465bc5397a36c55886db225b commit 9e7f974e9fa61e0e1d9cb519a69155eb71826f9d Author: Lionel Sambuc Date: Fri Apr 19 09:54:51 2013 +0200 almost aligned ioctl prototype Change-Id: I7f3eaa99d2a9767f71e8387cea5c7f56dcb28f99 commit b1a9440566584280bd07c6e646bb18d5b8133786 Author: Lionel Sambuc Date: Thu Apr 18 14:42:15 2013 +0200 32 to 64 bits fsblkcnt_t and fsfilcnt_t. Change-Id: I432229143c85cd178262b802a76ac606801ac59a commit 8dea53df7843cf4a96601e019f941e7d13a878c0 Author: Lionel Sambuc Date: Thu Apr 18 11:08:16 2013 +0200 moving prototypes to lib.h Change-Id: If53d3f5ee761b10e0f3d4346a0c5b39ba7901c65 commit 0d00df150181bcc7ee20726801bbc34ebe978a29 Author: Lionel Sambuc Date: Thu Apr 18 11:07:44 2013 +0200 struct uucred Change-Id: Ia97cb6c38bb566be30d568a252ae7b76142a21dd commit 1e355e9d217877943e01c5b8859d66258e54b3e5 Author: Lionel Sambuc Date: Tue Apr 16 11:48:54 2013 +0200 Alignement on netbsd types, part 1 The following types are modified (old -> new): * _BSD_USECONDS_T_ int -> unsigned int * __socklen_t __int32_t -> __uint32_t * blksize_t uint32_t -> int32_t * rlim_t uint32_t -> uint64_t On ARM: * _BSD_CLOCK_T_ int -> unsigned int On Intel: * _BSD_CLOCK_T_ int -> unsigned long bin/cat is also updated in order to fix warnings. _BSD_TIMER_T_ has still to be aligned. Change-Id: I2b4fda024125a19901120546c4e22e443ba5e9d7 commit e7b39757eac1ab7aac5a59d7aa124fc316a6e01f Author: Lionel Sambuc Date: Fri Aug 23 20:27:27 2013 +0200 Adapt the type used for adjtime_delta clock_t is currently a signed type, but in NetBSD this is not the case. As we plan on aligning our types we have to change this as this prevents negative delta from being correctly used. Change-Id: I9bccdee2b41626b0262471dc1900de505a1991a7 commit 5a551dbe663b22760632c5232326e4101360b330 Author: David van Moolenbroek Date: Sat Oct 5 19:01:19 2013 +0200 Butchered version of "Bumping version.." Change-Id: Ieb5f31fe037bcf45cc86a906f983a0ab3f636468 commit 6d601ae1d7072a8fb6cd908ff1d24ea4ca9bf1b0 Author: David van Moolenbroek Date: Sat Oct 5 18:57:04 2013 +0200 Trimmed version of "VFS: use 64-bit file..." Change-Id: I1b53ef05e939f6afed97f507d443a1d60ed81a21 commit 7adaa6556051b3800670399ee26d246fa9f32486 Author: David van Moolenbroek Date: Sat Oct 5 18:37:39 2013 +0200 Trimmed version of "stat.h: remove some big_ types" Change-Id: I6c17d6e5e9d2ab4c1bbf33e461cec4c37b870266 commit 3da9bd17116b66416e8e10ce148599b8ea723680 Author: Thomas Veerman Date: Thu Mar 7 14:46:21 2013 +0000 Define protocol version of {mode,ino,uid,gid}_t Change-Id: Ia2027749f2ce55a561d19eb895a5618505e9a2ac commit 6ca17cd644c3b3e4f318faf7d1242855af473b6f Author: Thomas Veerman Date: Mon Mar 25 21:09:10 2013 +0000 VFS-FS protocol: add versioning Change-Id: Ice6fbfd4b535b7435653fa08b27a3378d1cfdbf8 commit a7ff601df7d61c0925241ce10aee3a7e99343b3a Author: David van Moolenbroek Date: Sat Sep 28 14:46:21 2013 +0200 Input infrastructure, INPUT server, PCKBD driver This commit separates the low-level keyboard driver from TTY, putting it in a separate driver (PCKBD). The commit also separates management of raw input devices from TTY, and puts it in a separate server (INPUT). All keyboard and mouse input from hardware is sent by drivers to the INPUT server, which either sends it to a process that has opened a raw input device, or otherwise forwards it to TTY for standard processing. Design by Dirk Vogt. Prototype by Uli Kastlunger. Additional changes made to the prototype: - the event communication is now based on USB HID codes; all input drivers have to use USB codes to describe events; - all TTY keymaps have been converted to USB format, with the effect that a single keymap covers all keys; there is no (static) escaped keymap anymore; - further keymap tweaks now allow remapping of literally all keys; - input device renumbering and protocol rewrite; - INPUT server rewrite, with added support for cancel and select; - PCKBD reimplementation, including PC/AT-to-USB translation; - support for manipulating keyboard LEDs has been added; - keyboard and mouse multiplexer devices have been added to INPUT, primarily so that an X server need only open two devices; - a new "libinputdriver" library abstracts away protocol details from input drivers, and should be used by all future input drivers; - both INPUT and PCKBD can be restarted; - TTY is now scheduled by KERNEL, so that it won't be punished for running a lot; without this, simply running "yes" on the console kills the system; - the KIOCBELL IOCTL has been moved to /dev/console; - support for the SCANCODES termios setting has been removed; - obsolete keymap compression has been removed; - the obsolete Olivetti M24 keymap has been removed. Change-Id: I3a672fb8c4fd566734e4b46d3994b4b7fc96d578 commit 0a3e629c0d4101a33c8b2e79c2e52d312978d34b Author: David van Moolenbroek Date: Fri Sep 27 11:56:29 2013 +0000 TTY: allow selecting on translated minors Due to the existence of /dev/console and /dev/log, and the new "console=" setting, it is now possible that a single non-PTY object (e.g. serial) is accessible through two different minor numbers. This poses a problem when sending late select replies (CDEV_SEL2_REPLY), because the object's minor number can not be used to identify the device. Since selecting on such objects through translated minor numbers is actually required, we now save the minor number used to initiate the select query in order to send a late reply. The solution is suboptimal, as it is not possible to use two different minors to select on the same object at once. In the future, there should be at least one select record for each minor that can be used with each object. Change-Id: I4d39681d2ffd68b4047daf933d45b7bafe3c885e commit fe2167a148dd17e15502d98e64057239fa122dd5 Author: David van Moolenbroek Date: Sat Sep 21 17:35:15 2013 +0200 Take LOG out of the boot image Change-Id: Id2629776b53aae46629b04a42c15cbbacac9b949 commit 81e138bb5ba168322eb780978ed4a90fc1ab7945 Author: David van Moolenbroek Date: Sat Sep 21 15:03:20 2013 +0200 Kernel: make SIGKMESS target process list dynamic The set of processes to which a SIGKMESS signal is sent whenever new diagnostics messages are added to the kernel's message buffer, is now no longer hardcoded. Instead, processes can (un)register themselves to receive such notifications, by means of sys_diagctl(). Change-Id: I9d6ac006a5d9bbfad2757587a068fc1ec3cc083e commit 9afa18ec208646a9244048a1d444c474ceb47c73 Author: David van Moolenbroek Date: Sat Sep 21 00:58:46 2013 +0200 Rename SYSCTL kernel call to DIAGCTL Change-Id: I1b17373f01808d887dcbeab493838946fbef4ef6 commit f82f1ec4b06240e96ed8e64e4bfdf5b06d688f89 Author: David van Moolenbroek Date: Wed Sep 18 20:13:59 2013 +0200 Prevent Jenkins from breaking on old df(1) Change-Id: Ie8e1758bd9de4d5c95c597302f80d568058fbb68 commit 8a430b673dc97767306ddc9cb1a5367f333b7602 Author: David van Moolenbroek Date: Wed Sep 18 14:09:47 2013 +0200 Add testvnd.sh test script As part of this, change the "run" script to allow certain scripts to be run as root only. Change-Id: I846e41037f9d4f6c7fc0b5ea8250303a7bd72f5d commit fd57902664f398edd9274c2ab1d87daa0b4f4584 Author: David van Moolenbroek Date: Wed Sep 18 14:06:46 2013 +0200 Import NetBSD vndconfig(8) The tool has been changed heavily to match our VND driver model. NetBSD is in the process of renaming it from vnconfig(8) to vndconfig(8). To keep things in sync, we have to play along. Change-Id: Ie86df184f03ab00573ea76b43c9caa0412e8321d commit 6809baec22122124a04d8bf8f4f8b5fc7778cb3d Author: David van Moolenbroek Date: Wed Sep 18 14:02:17 2013 +0200 Add VND driver, providing loopback devices Change-Id: I40fa695e28c67477a75383e6f1550e451afcab41 commit 4cb7efbfd17b934f914f633c8bebf5bec7934e5d Author: David van Moolenbroek Date: Wed Sep 18 13:55:15 2013 +0200 VFS: add dupfrom(2) call This call copies a file descriptor from a remote process into the calling process. The call is for the VND driver only, and in the future, ACLs will prevent any other process from using this call. Change-Id: Ib16fdd1f1a12cb38a70d7e441dad91bc86898f6d commit 378f893b1e710563e2ef2eee457255a6f3037885 Author: David van Moolenbroek Date: Wed Sep 18 11:46:08 2013 +0200 tests: do not skip installed shell tests When installed, the test scripts lose their ".sh" suffix, causing them to be skipped by the "run" script. With this patch, the tests are no longer specified with ".sh" suffix in the run script, and the suffix is added automatically as necessary. Change-Id: I0b72312e79992b9818559c6546a0e52cd95184c2 commit ecdd53c03077c3cceb29485aa56021d99485d6a5 Author: David van Moolenbroek Date: Wed Sep 18 13:41:56 2013 +0200 blocktest: prepare to be run as part of tests - fail SEF initialization if any of the subtests failed, so that the party invoking the "service up" can tell whether the test succeeded; - add "nocontig" option, because VM isn't particularly good at allocating contiguous memory; - add "silent" option, because it floods the console otherwise; - allow the device size to be smaller than the maximum transfer size; - install files to installed test directory. Change-Id: I45c818f817c11d90c5f94ae26a2fc49e36e6761e commit 848ef711847b7adcf20dce333435802c4e1018ea Author: David van Moolenbroek Date: Wed Sep 18 13:38:36 2013 +0200 Enable devname(3) There is no support for a device name database yet, so this call is expected to be fairly slow. Change-Id: I73aa5f267e2b6921b7d3bbdcc4beac463931132c commit b84199849ad72030993bcf3f943da1509be15ded Author: David van Moolenbroek Date: Sun Sep 15 13:09:00 2013 +0200 libbdev: be less noisy about clean driver restarts Change-Id: Ie02a459c9b544d361ab00bac431ef99de53b0c5f commit 4f01352a2a6c82fc11465bc555c25e0344c5b970 Author: David van Moolenbroek Date: Sat Sep 14 14:43:53 2013 +0200 Straighten ioctl.h - include all ioctl subheaders, properly listing all letters; - change FBD's ioctl calls to use 'B' instead of 'F', in preparation of the VND driver. Change-Id: Ia718979568cc057f47cf505a89238d5b3b6695d4 commit 0ee3f3aeb3d634133a9cd8c3b81589772235c617 Author: David van Moolenbroek Date: Sun Sep 15 18:55:42 2013 +0200 VM: readd support for forgetting cached FS blocks Not all services involved in block I/O go through VM to access the blocks they need. As a result, the blocks in VM may become stale, possibly causing corruption when the stale copy is restored by a service that does go through VM later on. This patch restores support for forgetting cached blocks that belong to a particular device, and makes the relevant file systems use this functionality 1) when requested by VFS through REQ_FLUSH, and 2) upon unmount. Change-Id: I0758c5ed8fe4b5ba81d432595d2113175776aff8 commit c1652705b625a978ea2af169a21349352bd6575f Author: David van Moolenbroek Date: Wed Sep 11 14:50:18 2013 +0200 filter: use libblockdriver Change-Id: Ifbca2482e996ddca58036d45f557165e636fb3fa commit ad99ccdb45b897afa7573f75b1a29c4a19767870 Author: David van Moolenbroek Date: Tue Sep 10 20:25:01 2013 +0200 Rewrite character driver protocol As a side effect, remove the clone style, as the normal device style supports device cloning now. Change-Id: Ie82d1ef0385514a04a8faa139129a617895780b5 commit 4f91091ea26022877fd8c29094008d8072cf5e2b Author: David van Moolenbroek Date: Tue Sep 10 16:06:37 2013 +0200 Remove support for reopening character devices Previously, VFS would reopen a character device after a driver crash if the associated file descriptor was opened with the O_REOPEN flag. This patch removes support for this feature. The code was complex, full of uncovered corner cases, and hard to test. Moreover, it did not actually hide the crash from user applications: they would get an error code to indicate that something went wrong, and have to decide based on the nature of the underlying device how to continue. - remove support for O_REOPEN, and make playwave(1) reopen its device; - remove support for the DEV_REOPEN protocol message; - remove all code in VFS related to reopening character devices; - no longer change VFS filp reference count and FD bitmap upon filp invalidation; instead, make get_filp* fail all calls on invalidated FDs except when obtained with the locktype VNODE_OPCL which is used by close_fd only; - remove the VFS fproc file descriptor bitmap entirely, returning to the situation that a FD is in use if its slot points to a filp; use FILP_CLOSED as single means of marking a filp as invalidated. Change-Id: I34f6bc69a036b3a8fc667c1f80435ff3af56558f commit 8dfbb8fbe4f37642ac9700cc46ad0588687aa3a4 Author: David van Moolenbroek Date: Tue Sep 10 12:19:08 2013 +0200 VFS: rework device code - block the calling thread on character device close; - fully separate block and character open/close routines; - reuse generic open/close code for the cloning case; - zero all messages to drivers before filling them; - use appropriate types for major/minor device numbers. Change-Id: Ia90e6fe5688f212f835c5ee1bfca831cb249cf51 commit 9fabdb8b4edf637b47f1530bea145d68a028c319 Author: David van Moolenbroek Date: Mon Sep 9 00:04:12 2013 +0200 Make PFS backcalls regular VFS calls - prefix them with VFS_ as they are going to VFS; - give these calls normal call numbers; - give them their own set of message field aliases; - also make do_mapdriver a regular call. Change-Id: I2140439f288b06d699a1f65438bd8306509b259e commit 8fbd5d36fa175e2c31ed4a239be3f785e2995aef Author: David van Moolenbroek Date: Wed Sep 11 12:48:10 2013 +0200 TTY: use libchardriver; clean up - writing to a PTY master side blocks if there is not already a blocked reader on the slave side, and select now reflects this; - internally, TTY now uses a test based on "caller != NONE" rather than "grant != GRANT_INVALID" to identify whether a call is currently ongoing; - "offset" fields have been removed as they equal the corresponding "cum" fields; - improved variable typing and function naming here and there; - various other small fixes. Change-Id: I6b51452888942e864b4e034e8c8490576184a23e commit 53df30e2b876c03b26f8f52abeafcf8f601e6fd2 Author: David van Moolenbroek Date: Wed Sep 11 01:13:59 2013 +0200 VFS: select(2) fixes - check each file descriptor's open access mode (filp_mode); - treat an error returned by a character driver as a select error; - check all filps in each set before finishing select; - do not copy back file descriptor sets if an error occurred; - remove the hardcoded list of supported character major devices, since all drivers should now be capable of responding properly; - add tests to test40 and fix its error count aggregation. Change-Id: I57ef58d3afb82640fc50b59c859ee4b25f02db17 commit f08c75810f26adf75a757b5b65fdfa2589cf701d Author: David van Moolenbroek Date: Wed Sep 11 01:07:28 2013 +0200 Retire EBADIOCTL in favor of ENOTTY Change-Id: I6bd0e301d21ab7f2336e350e7e6e15d238c2c93d commit 91b7de8257c92283648c796d882a9095a1f64707 Author: David van Moolenbroek Date: Wed Sep 4 15:42:36 2013 +0000 libnetsock: use libchardriver Change-Id: Ia5b780cad0b0c636db9bd866c7223da0d38ef6ea commit 6a3a64d9669c5b1d6ca9acc12f02cd2f21f22d0f Author: David van Moolenbroek Date: Wed Sep 11 00:50:36 2013 +0200 LWIP: move chardev message parsing into libnetsock Change-Id: Ie23fd003c9fa35811548f388c8e9b55e8d9de8d7 commit 39aa2794e04ad34aecc6dcf607c0987dad13c1ef Author: David van Moolenbroek Date: Mon Sep 9 14:53:28 2013 +0000 INET: use libchardriver Change-Id: Icf8a1a5769ce0aede1cc28da99b9daf7d328182c commit 7c0d3f508d8e840a2d30da4d3e3af696b9ad2abc Author: David van Moolenbroek Date: Tue Sep 3 02:00:20 2013 +0200 PFS: use libchardriver; clean up - simplify and repair UDS request handling state machine; - simplify interface used between internal modules; - implement missing support for nonblocking I/O; - fix select implementation; - clean up global variables. Change-Id: Ia82c5c6f05cc3f0a498efc9a26de14b1cde6eace commit 5598aedb79b34fd02b3b81427d683014a3303e0c Author: David van Moolenbroek Date: Tue Sep 3 01:59:20 2013 +0200 libaudiodriver: use libchardriver Change-Id: I299d58d110ad14b69076276ba46c4325875c34ca commit 2aadc0aa253427d18c1e3db597c33dd06d9c380e Author: David van Moolenbroek Date: Tue Sep 3 01:57:41 2013 +0200 printer: use libchardriver Change-Id: Ifa3cabeada74c32df2613b8279c00f86e831c775 commit aeaa28b7c68aced329d9cf5b4a01af07b2f3638e Author: David van Moolenbroek Date: Tue Sep 3 01:49:38 2013 +0200 libchardriver: full API rewrite The new API now covers the entire character driver protocol, while hiding all the message details. It should therefore be used by all new character drivers. All existing drivers that already made use of libchardriver have been changed to use the new API. As one of the most important API changes, support for scatter and gather transfers has been removed, as several key drivers already did not support this, and it could be supported at the safecopy level instead (for a future readv/writev). Additional changes include: - respond to block device open requests to avoid hanging VFS threads; - add support for sef_cancel. Change-Id: I1bab6c1cb66916c71b87aeb1db54a9bdf171fe6b commit 6fbd39f8a65178d8fafa260dc42fde5341eb9097 Author: David van Moolenbroek Date: Thu Aug 1 18:20:33 2013 +0200 blocktest: add support for no alignment Some block drivers do not impose any alignment requirements, and this patch allows such block drivers to pass the test set. As a side effect, minimal support for min_write is added, but this part of blocktest is in need of further improvement. commit d70dc11950991506fa08d144067de3fe86b17136 Author: David van Moolenbroek Date: Wed Apr 18 00:04:28 2012 +0200 libutil: let opendisk(3) try /dev If a device node is given without path, and opening the node fails initially, prepend "/dev/" to the node name and try opening again. This is more in line with NetBSD behavior. commit 4b6bf57bc77973874b041239c5a7809448e4d857 Author: David van Moolenbroek Date: Tue Sep 10 23:57:32 2013 +0200 Block drivers: make IOCTL request unsigned long The block driver protocol and libblockdriver's bdr_ioctl hook are changed, as well as the users of this hook. Other parts of the system are expected to change accordingly eventually, since the ioctl(2) prototype has been aligned with NetBSD's. Change-Id: Ide46245b22cfa89ed267a38088fb0ab7696eba92 commit d74ea98bdfd90605dd5b0c57e12390dc4dba56e6 Author: David van Moolenbroek Date: Sat Jul 27 00:49:49 2013 +0200 Block protocol: add user endpoint to IOCTL request I/O control requests now come with the endpoint of the user process that initiated the ioctl(2) call. It is stored in a new BDEV_USER field, which is an alias for BDEV_FLAGS. The contents of this field are to be used only in highly specific situations. It should be preserved (not replaced!) by services that forward IOCTL requests, and may be set to NONE for service-initiated IOCTL requests. Change-Id: I68a01b9ce43eca00e61b985a9cf87f55ba683de4 commit 15afe7ddf85235f00e5a5d0e825d2894ac58549d Author: David van Moolenbroek Date: Sat Jul 27 00:49:49 2013 +0200 Block protocol: use own [RW]_BIT definitions The original R_BIT and W_BIT definitions have nothing to do with the way these bits are used. Their distinct usage is more apparent when they have different names. Change-Id: Ia984457f900078b2e3502ceed565fead4e5bb965 commit c4c9435b0df31b36c11f27370475694043c5b8e0 Author: David van Moolenbroek Date: Tue Sep 10 23:35:15 2013 +0200 libblockdriver: expose BLOCKDRIVER_MAX_DEVICES This constant determines the range of valid device_id_t values that a block driver can return from the bdr_device hook: a value between 0 and (BLOCKDRIVER_MAX_DEVICES - 1) inclusive. Change-Id: I80fac469e88ac13d4b869007e6f2c2f7569da433 commit 2c5bd1565b5d9b487899dee7a023a641343e65a9 Author: David van Moolenbroek Date: Wed Sep 11 13:33:00 2013 +0200 libblockdriver: various updates - internal structure rearrangement; - respond to char device open requests to avoid hanging VFS threads; - make drivers use designated initializers; - use devminor_t for all minor device numbers; - change bdr_other hook to take ipc_status and return nothing; - fix default geometry computation; - add support for sef_cancel. Change-Id: Ia063a136a3ddb2b78de36180feda870605753d70 commit b1cfc3123b03d5a8c9452ae251892593dc328357 Author: David van Moolenbroek Date: Sun Sep 1 14:34:17 2013 +0200 Block drivers: reply ENOTTY to unknown IOCTLs Change-Id: Ie2e82d2491d546f4dd73b009100646e249a147b5 commit b5eab0554511ace3d7fae40883be0da139b0e2ab Author: David van Moolenbroek Date: Sun Jul 28 14:03:07 2013 +0200 Move SUB_PER_DRIVE definition into minix/drvlib.h commit 20c8aedc6737fc935ccea0b394616851ff4fdece Author: David van Moolenbroek Date: Mon Sep 2 17:34:44 2013 +0200 VFS: update filp_pos on chardev I/O (workaround) Previously, reading from or writing to a character device would not update the file position on the corresponding filp object. Performing this update correctly is not trivial: during and after the I/O operation, the filp object must not be locked. Ideally, read/write requests on a filp that is already involved in a read/write operation, should be queued. For now, we optimistically update the file position at the start of the I/O; this works under the assumptions listed in the corresponding comment. Change-Id: I172a61781850423709924390ae3df1f2d1f94707 commit dbef7bae2308a2e4449b8f274898ed3b60b2add2 Author: David van Moolenbroek Date: Mon Sep 2 13:45:02 2013 +0200 I2C: change BUSC_I2C_xxx to use own protocol Previously it would use bits of the character driver protocol, which will change heavily. In the new situation, the BUSC_I2C_xxx requests use a protocol more in line with the PCI protocol, with the reply code in m_type. Change-Id: I51597b3f191078c8178ce17372de123031f7a4c4 commit 7cdb9683ec718247b03cbae3c827d9834c484e91 Author: David van Moolenbroek Date: Sat Aug 31 16:13:37 2013 +0200 tests: add test77 for opening/closing PTYs Change-Id: I30e3418f75137aa08037fa6581ff3d4cce32a114 commit ed9ee8b9cd5a647130a81bd70af48cee4f6dca15 Author: David van Moolenbroek Date: Sat Aug 31 16:08:25 2013 +0200 TTY: fix for PTY open/close logic Opening and closing the master side of a pseudo terminal without opening the slave side would result in the pseudo terminal becoming permanently unavailable. In addition, reopening the slave side would be possible but not allow for I/O. Finally, attempting to open an in-use master would wipe its I/O state. These issues have been resolved. Change-Id: I9235e3d9aba321803f9280b86b6b5e3646ad5ef3 commit cd14d52a99df7fb6dd7c6c48a034e4bf7c170789 Author: David van Moolenbroek Date: Fri Aug 30 18:48:56 2013 +0200 tests: remove select subdirectory This test set has been obsoleted by test40. Change-Id: I55439152824906778ad07d409dfb327ac10bea70 commit 5ab6f6e7c2f4618648f163af6bd705e5ef2fafb8 Author: David van Moolenbroek Date: Fri Aug 30 18:43:23 2013 +0200 tests: add test76 for interrupting VFS operations Change-Id: Ic436cac61de8c42e0c7ee2d442c647528654cde9 commit ad548d2c9f78e2f2dc2108c50b6c7ed6755a53f1 Author: David van Moolenbroek Date: Wed Aug 28 13:08:16 2013 +0200 VFS: fix interruption of blocking pipe operations POSIX states that when interrupted, partially successful pipe operations should return the partial result rather than EINTR. VFS previously wouldn't look at the partial result, and not clear it either, which would result in a panic upon the next pipe operation. Change-Id: Ia1eb72b4b77394051444e63a1390d49bb315eb04 commit 813198ce7b0ce171f79529e8f6c5a94ab26ce1cb Author: David van Moolenbroek Date: Fri Aug 30 00:57:16 2013 +0200 libmthread: do not dump stack for free threads Change-Id: Ic438a252f5bddaf1513f554c71173e6fffb0c674 commit 53b6001312428a1ac7379718616cb640614f53e6 Author: David van Moolenbroek Date: Fri Aug 30 14:00:50 2013 +0200 VFS: worker thread model overhaul The main purpose of this patch is to fix handling of unpause calls from PM while another call is ongoing. The solution to this problem sparked a full revision of the threading model, consisting of a large number of related changes: - all active worker threads are now always associated with a process, and every process has at most one active thread working for it; - the process lock is always held by a process's worker thread; - a process can now have both normal work and postponed PM work associated to it; - timer expiry and non-postponed PM work is done from the main thread; - filp garbage collection is done from a thread associated with VFS; - reboot calls from PM are now done from a thread associated with PM; - the DS events handler is protected from starting multiple threads; - support for a system worker thread has been removed; - the deadlock recovery thread has been replaced by a parameter to the worker_start() function; the number of worker threads has consequently been increased by one; - saving and restoring of global but per-thread variables is now centralized in worker_suspend() and worker_resume(); err_code is now saved and restored in all cases; - the concept of jobs has been removed, and job_m_in now points to a message stored in the worker thread structure instead; - the PM lock has been removed; - the separate exec lock has been replaced by a lock on the VM process, which was already being locked for exec calls anyway; - PM_UNPAUSE is now processed as a postponed PM request, from a thread associated with the target process; - the FP_DROP_WORK flag has been removed, since it is no longer more than just an optimization and only applied to processes operating on a pipe when getting killed; - assignment to "fp" now takes place only when obtaining new work in the main thread or a worker thread, when resuming execution of a thread, and in the special case of exiting processes during reboot; - there are no longer special cases where the yield() call is used to force a thread to run. Change-Id: I7a97b9b95c2450454a9b5318dfa0e6150d4e6858 commit 6fbb7f4167510fb1a71fdad2b965dc2f7417aef4 Author: David van Moolenbroek Date: Wed Aug 28 15:58:30 2013 +0200 Retire ptrace(T_DUMPCORE), dumpcore(1), gcore(1) The T_DUMPCORE implementation was not only broken - it would currently produce a coredump of the tracer process rather than the traced process - but also deeply flawed, and fixing it would require serious alteration of PM's internal state machine. It should be possible to implement the same functionality in userland, and that is now the suggested way forward. For now, also remove the (identical) utilities using T_DUMPCORE: dumpcore(1) and gcore(1). Change-Id: I1d51be19c739362b8a5833de949b76382a1edbcc commit fde44a0523a26b5bad5a0e3fc2921b1b5821d5d4 Author: David van Moolenbroek Date: Fri Aug 30 13:42:51 2013 +0200 VFS: process char driver replies from main thread Previously, processing of some replies coming from character drivers could block on locks, and therefore, such processing was done from threads that were associated to the character driver process. The hidden consequence of this was that if all threads were in use, VFS could drop replies coming from the driver. This patch returns VFS to a situation where the replies from character drivers are processed instantly from the main thread, by removing the situations that may cause VFS to block while handling those replies. - change the locking model for select, so that it will never block on any processing that happens after the select call has been set up, in particular processing of character driver select replies; - clearly mark all select routines that may never block; - protect against race conditions in do_select as result of the locking that still does happen there (as is required for pipes); - also handle select timers from the main thread; - move processing of character driver replies into device.c. Change-Id: I4dc8e69f265cbd178de0fbf321d35f58f067cc57 commit d5d67d293d4a7a2669eb179621a1c6d3e2796d97 Author: David van Moolenbroek Date: Sun Aug 25 00:26:38 2013 +0200 VFS: properly cancel select queries on unpause Change-Id: I16e71db3f5c1bcc7ba6045bc9f02b13d71dc31eb commit d0371a4fbdaddbf7bc543a8046bb91454e09283d Author: David van Moolenbroek Date: Fri Aug 30 13:33:56 2013 +0200 VFS: remove support for sync char driver protocol Change-Id: I57cc870a053b813b3a3fc45da46606ea84fe4cb1 commit 2b12ad511fabd5a1019f736221f2940bfe7e2781 Author: David van Moolenbroek Date: Fri Aug 30 13:00:44 2013 +0200 VFS: remove FP_BLOCKED_ON_DOPEN These days, DEV_OPEN calls to character drivers block the calling thread until completion or failure, and thus never return SUSPEND to the caller. The same already applied to BDEV_OPEN calls to block drivers. It has thus become impossible for a process to enter a state of being blocked on a device open call. There is currently no support for restarting device open calls to restarted character drivers. This support was present in the _DOPEN logic, but was already no longer triggering. In the future, this case should be handled by the thread performing the open request. Change-Id: I6cc1e7b4c9ed116c6ce160b315e6e060124dce00 commit 0eee377a337f5800760d2f5611d203c158ac6099 Author: David van Moolenbroek Date: Fri Aug 30 12:18:27 2013 +0200 PFS: remember request information for IOCTLs Not doing so caused PFS to commit protocol violations by relying on stale information when sending replies. This stale information always happened to be correct, which is why the problem went unnoticed. Change-Id: Ia42ca670718d6e731193cd2c34a3ff455f8a94d3 commit 3272c645aca015b6778a8fe945e014a0a5acc023 Author: David van Moolenbroek Date: Fri Aug 30 11:14:03 2013 +0200 Retire the synchronous character driver protocol - change all sync char drivers into async drivers; - retire support for the sync protocol in libchardev; - remove async dev style, as this is now the default; - remove dev_status from VFS; - clean up now-unused protocol messages. Change-Id: I6aacff712292f6b29f2ccd51bc1e7d7003723e87 commit 831d825d5a6891b79e97002e1a2d396dcb47bea6 Author: David van Moolenbroek Date: Fri Aug 30 10:48:34 2013 +0200 Sync char protocol: add nonblocking transfer flag The async char protocol already has this, so this patch closes the gap between the two protocols a bit. Support for this flag has been added to all sync char drivers that support CANCEL at all. The LOG driver was already using the asynchronous protocol, but it did not support the nonblocking transfer flag. This has been fixed as well. Change-Id: Ia55432c9f102765b59ad3feb45a8bd47a782c93f commit 4f5aec7328128b9d035ff1158f0e6a0f7bd393e4 Author: David van Moolenbroek Date: Sat Aug 24 12:29:39 2013 +0200 VFS: set w_drv_sendrec only when needed As with w_task, this ensures that the field remains cleared if it is not used. Without this, worker_stop could mistakenly identify a thread as talking to a device driver rather than a (crashed) file server. Change-Id: I7d3ebed3efc3cd4f5c891f61c67a6463109b6376 commit 9bbf923154733f1b9ba52a063872ccdbaa7ff0f0 Author: Thomas Veerman Date: Sat Aug 24 12:23:41 2013 +0200 VFS: set w_task only when needed It was always set, but not always cleared, when talking to asynchronous drivers. This could cause erratic behavior upon a driver crash. Normally, a worker thread's w_task field is set when it's about to communicate with a driver or FS. Then upon receiving a reply we can do sanity checks (that the thread we want to wake up was actually waiting for a reply). Also, when a driver/FS crashes, we can identify which worker threads were talking to the crashed endpoint and handle the error gracefully. Asynchronous drivers are a bit special, though. In most cases, the sender of the request is not interested in the reply (the sender was suspended and only wants to know whether the request was successfully caried out or not). However, the open request is special, as the reply carries information needed by the sender. This is the only request where a worker thread actually yields and waits for the result. This is also the only case where we're interested in setting w_task for asynchronous drivers. Change-Id: Ia1ce2747937df376122b5e13b6a069de27fcc379 commit 2a293ca6703354cd7be8eb18147f7c4d18894132 Author: David van Moolenbroek Date: Mon Aug 19 20:34:15 2013 +0200 Import NetBSD df(1) Change-Id: Ia60f8b23b961e4132efece1e7e38f0d63597c13b commit c35fc992ccc052e1f3741be0db9b676682f68bf8 Author: David van Moolenbroek Date: Tue Aug 20 01:33:43 2013 +0200 Enable getmntinfo(3) Change-Id: Id9d11a67cdcad331a52030127f7c7ead3c847919 commit 907b40860983a73fe22f45aa8b175b27cb7dc1d7 Author: David van Moolenbroek Date: Tue Aug 20 00:49:07 2013 +0200 test55: add tests for getvfsstat(2) Change-Id: Iad4567068a82bb0e780891a478ba5a06b63f1d48 commit 3297eb8d103545690e9f2cb6c63fdd1ce3452c6d Author: David van Moolenbroek Date: Tue Aug 20 01:28:23 2013 +0200 Implement support for [f]statvfs1(2) The [f]statvfs(3) calls now use [f]statvfs1(2). Change-Id: I56c92fe1c70670f476631c4a50e47351562712c6 commit 4f576aff9f046276974c4a769427a1cb8c2470a0 Author: David van Moolenbroek Date: Tue Aug 20 01:39:47 2013 +0200 Implement support for getvfsstat(2) Change-Id: I4680c071b94fa855edfb6220b03cff6b20f3c1c9 commit 53485a9b35ec2e27ec0df232d8c80db1a829246b Author: David van Moolenbroek Date: Tue Aug 20 01:37:18 2013 +0200 Redo mount(2)/umount(2) ABI - pass in file system type through mount(2), and return this type in statvfs structures as generated by [f]statvfs(2); - align mount flags field with NetBSD's, splitting out service flags which are not to be passed to VFS; - remove limitation of mount ABI to 16-byte labels, so that labels can be made larger in the future; - introduce new m11 message union type for mount(2) as side effect. Change-Id: Ia9ed4566d88af5239749c57274312be26bb61448 commit 6ebff29307cd1bacba965d1e8dfb465b6684ccb7 Author: David van Moolenbroek Date: Tue Aug 20 01:35:35 2013 +0200 Align "struct statvfs" with NetBSD This is a requirement for implementing calls such as getmntinfo(3). VFS is now responsible for filling in some of the structure's fields. Change-Id: I457b463c70ea2f326b9c50de954a91cfefba0065 commit 9b5871fd21d37b0533b6546c408ff4ad4ae02952 Author: David van Moolenbroek Date: Tue Aug 20 00:55:49 2013 +0200 VFS/FS: remove fstatfs(2) and REQ_FSTATFS The fstatfs(3) call now uses fstatvfs(2). Change-Id: Ic6bbb040e1a8f01aaffe1a6a809dd4c7a2eae2f6 Change-Id: I44109a83fd9155f15a8b580e9471ed1aff952673 --- bin/Makefile | 2 +- bin/cat/cat.1 | 11 +- bin/cat/cat.c | 8 +- bin/df/Makefile | 11 + bin/df/df.1 | 206 ++ bin/df/df.c | 520 +++++ commands/DESCRIBE/DESCRIBE.sh | 38 +- commands/MAKEDEV/MAKEDEV.8 | 57 + commands/MAKEDEV/MAKEDEV.sh | 735 ++++--- commands/MAKEDEV/Makefile | 2 +- commands/Makefile | 8 +- commands/df/Makefile | 4 - commands/df/df.c | 237 --- commands/dumpcore/Makefile | 5 - commands/dumpcore/dumpcore.c | 71 - commands/fdisk/fdisk.c | 32 +- commands/fsck.mfs/fsck.c | 2 +- commands/gcore/Makefile | 4 - commands/gcore/gcore.c | 58 - commands/getty/getty.c | 2 +- commands/loadkeys/loadkeys.c | 67 +- commands/mount/mount.c | 15 +- commands/playwave/playwave.c | 77 +- commands/ps/ps.c | 1 - commands/service/parse.c | 28 +- commands/service/print.c | 2 +- commands/service/service.8 | 10 +- commands/service/service.c | 31 +- commands/setup/setup.sh | 6 +- commands/umount/umount.c | 2 +- commands/uname/Makefile | 6 - commands/uname/uname.c | 124 -- distrib/sets/lists/minix/md.evbarm | 22 +- distrib/sets/lists/minix/md.i386 | 23 +- distrib/sets/lists/minix/mi | 921 +++++---- drivers/Makefile | 12 +- drivers/ahci/ahci.c | 69 +- drivers/ahci/ahci.h | 1 - drivers/at_wini/at_wini.c | 764 +++---- drivers/at_wini/at_wini.h | 34 +- drivers/atl2/atl2.conf | 2 +- drivers/audio/es1370/es1370.c | 2 +- drivers/audio/es1371/es1371.c | 2 +- drivers/audio/sb16/mixer.c | 2 +- drivers/audio/sb16/mixer.h | 2 +- drivers/audio/sb16/sb16.c | 15 +- drivers/bmp085/bmp085.c | 82 +- drivers/cat24c256/cat24c256.c | 63 +- drivers/dec21140A/dec21140A.conf | 2 +- drivers/e1000/e1000.c | 2 +- drivers/e1000/e1000.conf | 14 +- drivers/fb/arch/earm/fb_arch.c | 8 +- drivers/fb/fb.c | 183 +- drivers/fb/fb.h | 2 +- drivers/fb/fb_edid.c | 2 +- drivers/fbd/fbd.c | 44 +- drivers/filter/driver.c | 5 +- drivers/filter/main.c | 215 +- drivers/filter/util.c | 2 +- drivers/floppy/floppy.c | 60 +- drivers/fxp/fxp.c | 8 +- drivers/fxp/fxp.conf | 14 +- drivers/hello/hello.c | 91 +- drivers/i2c/i2c.c | 103 +- drivers/lance/lance.conf | 2 +- drivers/log/log.c | 376 ++-- drivers/log/log.h | 14 +- drivers/memory/memory.c | 466 ++--- drivers/mmc/mmcblk.c | 54 +- drivers/orinoco/orinoco.c | 6 +- drivers/pci/pci.c | 37 +- drivers/pckbd/Makefile | 12 + drivers/pckbd/pckbd.c | 476 +++++ drivers/pckbd/pckbd.h | 49 + drivers/pckbd/table.c | 169 ++ drivers/printer/liveupdate.c | 7 +- drivers/printer/printer.c | 265 +-- drivers/ramdisk/Makefile | 38 +- drivers/ramdisk/proto | 2 + drivers/ramdisk/proto.dev | 455 ---- drivers/ramdisk/rc | 5 +- drivers/random/main.c | 163 +- drivers/readclock/readclock.c | 1 + drivers/rtl8139/rtl8139.c | 4 +- drivers/rtl8139/rtl8139.conf | 34 +- drivers/rtl8139/rtl8139.h | 2 +- drivers/rtl8169/rtl8169.c | 6 +- drivers/rtl8169/rtl8169.conf | 20 +- drivers/sht21/sht21.c | 80 +- drivers/tda19988/tda19988.c | 60 +- drivers/tps65217/tps65217.c | 23 +- drivers/tsl2550/tsl2550.c | 80 +- drivers/tty/Makefile | 4 +- drivers/tty/arch/earm/console.c | 10 +- drivers/tty/arch/earm/keyboard.c | 25 +- drivers/tty/arch/earm/rs232.c | 40 +- drivers/tty/arch/i386/console.c | 187 +- drivers/tty/arch/i386/keyboard.c | 972 ++------- drivers/tty/arch/i386/rs232.c | 31 +- drivers/tty/keymaps/Makefile | 4 +- drivers/tty/keymaps/abnt2.src | 233 +-- drivers/tty/keymaps/dvorak.src | 232 +-- drivers/tty/keymaps/french.src | 232 +-- drivers/tty/keymaps/genmap.c | 80 +- drivers/tty/keymaps/german.src | 232 +-- drivers/tty/keymaps/italian.src | 232 +-- drivers/tty/keymaps/japanese.src | 236 +-- drivers/tty/keymaps/latin-america.src | 236 +-- drivers/tty/keymaps/norwegian.src | 111 + drivers/tty/keymaps/olivetti.src | 132 -- drivers/tty/keymaps/polish.src | 232 +-- drivers/tty/keymaps/portuguese.src | 236 +-- drivers/tty/keymaps/russian-cp1251.src | 232 +-- drivers/tty/keymaps/russian-cp866.src | 232 +-- drivers/tty/keymaps/russian.src | 232 +-- drivers/tty/keymaps/scandinavian.src | 232 +-- drivers/tty/keymaps/spanish.src | 236 +-- drivers/tty/keymaps/uk.src | 232 +-- drivers/tty/keymaps/ukraine-koi8-u.src | 232 +-- drivers/tty/keymaps/us-std-esc.src | 132 -- drivers/tty/keymaps/us-std.src | 232 +-- drivers/tty/keymaps/us-swap.src | 232 +-- drivers/tty/pty.c | 715 +++---- drivers/tty/tty.c | 858 +++----- drivers/tty/tty.h | 72 +- drivers/uds/Makefile | 12 + drivers/uds/ioc_uds.c | 1077 ++++++++++ drivers/uds/uds.c | 751 +++++++ {servers/pfs => drivers/uds}/uds.h | 155 +- drivers/virtio_blk/virtio_blk.c | 76 +- drivers/virtio_net/virtio_net.conf | 2 +- drivers/vnd/Makefile | 12 + drivers/vnd/NOTES | 90 + drivers/vnd/vnd.c | 602 ++++++ etc/Makefile | 8 +- etc/man.conf | 85 +- etc/mtree/NetBSD.dist.base | 1 + etc/rc | 3 +- etc/rs.inet | 4 +- etc/system.conf | 102 +- etc/usr/rc | 10 +- external/bsd/mdocml/Makefile.inc | 7 +- external/bsd/mdocml/bin/mandoc/Makefile | 22 +- external/bsd/mdocml/dist/Makefile | 823 +++++--- external/bsd/mdocml/dist/apropos.1 | 312 +++ external/bsd/mdocml/dist/apropos.c | 157 ++ external/bsd/mdocml/dist/apropos_db.c | 899 ++++++++ external/bsd/mdocml/dist/apropos_db.h | 59 + external/bsd/mdocml/dist/arch.c | 3 +- external/bsd/mdocml/dist/arch.in | 57 +- external/bsd/mdocml/dist/att.c | 3 +- external/bsd/mdocml/dist/att.in | 31 +- external/bsd/mdocml/dist/catman.8 | 111 + external/bsd/mdocml/dist/catman.c | 511 +++++ external/bsd/mdocml/dist/cgi.c | 1210 +++++++++++ external/bsd/mdocml/dist/chars.c | 176 +- external/bsd/mdocml/dist/chars.h | 36 - external/bsd/mdocml/dist/chars.in | 70 +- external/bsd/mdocml/dist/compat_fgetln.c | 93 + external/bsd/mdocml/dist/compat_getsubopt.c | 104 + .../dist/{compat.c => compat_strlcat.c} | 50 +- external/bsd/mdocml/dist/compat_strlcpy.c | 63 + external/bsd/mdocml/dist/config.h.post | 17 + external/bsd/mdocml/dist/config.h.pre | 2 + external/bsd/mdocml/dist/demandoc.1 | 109 + external/bsd/mdocml/dist/demandoc.c | 257 +++ external/bsd/mdocml/dist/eqn.7 | 280 +++ external/bsd/mdocml/dist/eqn.c | 949 +++++++++ external/bsd/mdocml/dist/eqn_html.c | 81 + external/bsd/mdocml/dist/eqn_term.c | 76 + external/bsd/mdocml/dist/example.style.css | 244 +-- external/bsd/mdocml/dist/external.png.uu | 2 +- external/bsd/mdocml/dist/html.c | 427 ++-- external/bsd/mdocml/dist/html.h | 37 +- external/bsd/mdocml/dist/lib.c | 3 +- external/bsd/mdocml/dist/lib.in | 12 +- external/bsd/mdocml/dist/libman.h | 27 +- external/bsd/mdocml/dist/libmandoc.h | 82 +- external/bsd/mdocml/dist/libmdoc.h | 66 +- external/bsd/mdocml/dist/libroff.h | 40 +- external/bsd/mdocml/dist/main.c | 851 +------- external/bsd/mdocml/dist/main.h | 9 +- external/bsd/mdocml/dist/man-cgi.css | 13 + external/bsd/mdocml/dist/man.3 | 272 --- external/bsd/mdocml/dist/man.7 | 690 +++---- external/bsd/mdocml/dist/man.c | 240 ++- external/bsd/mdocml/dist/man.cgi.7 | 123 ++ external/bsd/mdocml/dist/man.h | 41 +- external/bsd/mdocml/dist/man_hash.c | 13 +- external/bsd/mdocml/dist/man_html.c | 368 ++-- external/bsd/mdocml/dist/man_macro.c | 127 +- external/bsd/mdocml/dist/man_term.c | 390 ++-- external/bsd/mdocml/dist/man_validate.c | 309 ++- external/bsd/mdocml/dist/mandoc | Bin 725594 -> 0 bytes external/bsd/mdocml/dist/mandoc.1 | 158 +- external/bsd/mdocml/dist/mandoc.3 | 600 ++++++ external/bsd/mdocml/dist/mandoc.c | 676 ++++-- external/bsd/mdocml/dist/mandoc.h | 207 +- external/bsd/mdocml/dist/mandoc_char.7 | 357 +++- external/bsd/mdocml/dist/mandocdb.8 | 293 +++ external/bsd/mdocml/dist/mandocdb.c | 1834 +++++++++++++++++ external/bsd/mdocml/dist/mandocdb.h | 62 + external/bsd/mdocml/dist/manpath.c | 225 ++ .../bsd/mdocml/dist/{man_argv.c => manpath.h} | 42 +- external/bsd/mdocml/dist/mdoc.3 | 348 ---- external/bsd/mdocml/dist/mdoc.7 | 1797 +++++++++------- external/bsd/mdocml/dist/mdoc.c | 281 ++- external/bsd/mdocml/dist/mdoc.h | 210 +- external/bsd/mdocml/dist/mdoc_argv.c | 720 +++---- external/bsd/mdocml/dist/mdoc_hash.c | 17 +- external/bsd/mdocml/dist/mdoc_html.c | 533 +++-- external/bsd/mdocml/dist/mdoc_macro.c | 180 +- external/bsd/mdocml/dist/mdoc_man.c | 637 ++++++ external/bsd/mdocml/dist/mdoc_strings.c | 219 -- external/bsd/mdocml/dist/mdoc_term.c | 319 +-- external/bsd/mdocml/dist/mdoc_validate.c | 435 ++-- external/bsd/mdocml/dist/msec.c | 6 +- external/bsd/mdocml/dist/msec.in | 18 +- external/bsd/mdocml/dist/out.c | 311 +-- external/bsd/mdocml/dist/out.h | 69 +- external/bsd/mdocml/dist/preconv.1 | 158 ++ external/bsd/mdocml/dist/preconv.c | 528 +++++ external/bsd/mdocml/dist/predefs.in | 65 + external/bsd/mdocml/dist/read.c | 846 ++++++++ external/bsd/mdocml/dist/roff.3 | 177 -- external/bsd/mdocml/dist/roff.7 | 488 ++++- external/bsd/mdocml/dist/roff.c | 998 ++++++--- external/bsd/mdocml/dist/roff.h | 45 - external/bsd/mdocml/dist/st.c | 3 +- external/bsd/mdocml/dist/st.in | 52 +- external/bsd/mdocml/dist/tbl.7 | 74 +- external/bsd/mdocml/dist/tbl.c | 42 +- external/bsd/mdocml/dist/tbl_data.c | 122 +- external/bsd/mdocml/dist/tbl_html.c | 105 +- external/bsd/mdocml/dist/tbl_layout.c | 100 +- external/bsd/mdocml/dist/tbl_opts.c | 34 +- external/bsd/mdocml/dist/tbl_term.c | 257 +-- external/bsd/mdocml/dist/term.c | 426 ++-- external/bsd/mdocml/dist/term.h | 58 +- external/bsd/mdocml/dist/term_ascii.c | 154 +- external/bsd/mdocml/dist/term_ps.c | 398 ++-- external/bsd/mdocml/dist/test-fgetln.c | 11 + external/bsd/mdocml/dist/test-getsubopt.c | 12 + external/bsd/mdocml/dist/test-mmap.c | 10 + external/bsd/mdocml/dist/test-strptime.c | 13 + external/bsd/mdocml/dist/tree.c | 104 +- external/bsd/mdocml/dist/vol.c | 3 +- external/bsd/mdocml/dist/whatis.1 | 172 ++ external/bsd/mdocml/lib/Makefile | 4 +- external/bsd/mdocml/lib/libman/Makefile | 10 - external/bsd/mdocml/lib/libmandoc/Makefile | 13 + external/bsd/mdocml/lib/libmdoc/Makefile | 13 - external/bsd/mdocml/lib/libroff/Makefile | 11 - external/bsd/mdocml/man/Makefile | 13 +- include/Makefile | 2 +- include/dirent.h | 2 +- include/lib.h | 13 + include/minix/Makefile | 5 +- include/minix/audio_fw.h | 11 +- include/minix/bdev.h | 5 +- include/minix/blockdriver.h | 26 +- include/minix/blockdriver_mt.h | 2 + include/minix/callnr.h | 21 +- include/minix/chardriver.h | 46 +- include/minix/com.h | 284 ++- include/minix/config.h | 17 +- include/minix/const.h | 17 - include/minix/dmap.h | 13 +- include/minix/drivers.h | 25 +- include/minix/drvlib.h | 1 + include/minix/input.h | 331 ++- include/minix/inputdriver.h | 24 + include/minix/ioctl.h | 3 +- include/minix/ipc.h | 16 +- include/minix/keymap.h | 43 +- include/minix/libminixfs.h | 4 +- include/minix/mount.h | 16 +- include/minix/netsock.h | 62 +- include/minix/paths.h | 2 + include/minix/procfs.h | 1 - include/minix/rs.h | 28 +- include/minix/sysinfo.h | 1 - include/minix/syslib.h | 13 +- include/minix/termios.h | 1 - include/minix/timers.h | 112 +- include/minix/tty.h | 28 - include/minix/vfsif.h | 42 +- include/minix/virtio.h | 24 +- include/minix/vm.h | 2 + include/stdlib.h | 3 +- include/sys/ioc_fbd.h | 6 +- include/sys/ioc_net.h | 2 +- include/sys/ioc_tty.h | 1 - include/sys/statfs.h | 2 +- include/sys/vm.h | 2 +- include/time.h | 2 - include/timers.h | 110 - include/unistd.h | 12 - kernel/arch/earm/pre_init.c | 8 +- kernel/arch/earm/protect.c | 2 +- kernel/arch/i386/pre_init.c | 4 +- kernel/arch/i386/protect.c | 2 +- kernel/clock.c | 45 +- kernel/kernel.h | 2 +- kernel/main.c | 10 +- kernel/priv.h | 4 +- kernel/proto.h | 14 +- kernel/system.c | 22 +- kernel/system/Makefile.inc | 2 +- kernel/system/do_clear.c | 2 +- kernel/system/do_diagctl.c | 65 + kernel/system/do_privctl.c | 3 +- kernel/system/do_setalarm.c | 10 +- kernel/system/do_settime.c | 3 +- kernel/system/do_sysctl.c | 50 - kernel/system/do_update.c | 1 + kernel/system/do_vtimer.c | 6 +- kernel/table.c | 1 - kernel/utility.c | 15 +- lib/Makefile | 2 +- lib/libaudiodriver/audio_fw.c | 358 +--- lib/libaudiodriver/liveupdate.c | 14 +- lib/libbdev/bdev.c | 16 +- lib/libbdev/ipc.c | 15 +- lib/libbdev/minor.c | 16 + lib/libbdev/proto.h | 1 + lib/libblockdriver/const.h | 2 +- lib/libblockdriver/driver.c | 192 +- lib/libblockdriver/driver.h | 5 +- lib/libblockdriver/driver_mt.c | 22 +- lib/libblockdriver/driver_st.c | 21 +- lib/libblockdriver/trace.c | 6 +- lib/libblockdriver/trace.h | 2 +- lib/libc/gen/Makefile.inc | 8 +- lib/libc/gen/devname.c | 4 + lib/libc/include/namespace.h | 4 +- lib/libc/net/minix/getpeereid.c | 8 +- lib/libc/sys-minix/MISSING_SYSCALLS | 1 - lib/libc/sys-minix/Makefile.inc | 1 + lib/libc/sys-minix/accept.c | 9 +- lib/libc/sys-minix/bind.c | 6 +- lib/libc/sys-minix/connect.c | 8 +- lib/libc/sys-minix/fstatfs.c | 13 +- lib/libc/sys-minix/fstatvfs.c | 15 +- lib/libc/sys-minix/getpeername.c | 6 +- lib/libc/sys-minix/getsockname.c | 6 +- lib/libc/sys-minix/getsockopt.c | 10 +- lib/libc/sys-minix/getvfsstat.c | 19 + lib/libc/sys-minix/ioctl.c | 8 +- lib/libc/sys-minix/listen.c | 4 +- lib/libc/sys-minix/mount.c | 58 +- lib/libc/sys-minix/recvfrom.c | 6 +- lib/libc/sys-minix/recvmsg.c | 2 +- lib/libc/sys-minix/sendmsg.c | 2 +- lib/libc/sys-minix/sendto.c | 6 +- lib/libc/sys-minix/setsockopt.c | 6 +- lib/libc/sys-minix/shutdown.c | 4 +- lib/libc/sys-minix/statvfs.c | 17 +- lib/libc/sys/Makefile.inc | 8 +- lib/libchardriver/chardriver.c | 729 ++++--- lib/libddekit/src/msg_queue.c | 17 +- lib/libexec/exec_general.c | 12 +- lib/libexec/libexec.h | 21 +- lib/libi2cdriver/i2cdriver.c | 8 +- lib/libinputdriver/Makefile | 8 + lib/libinputdriver/inputdriver.c | 206 ++ lib/libminc/Makefile | 13 +- lib/libminixfs/cache.c | 9 +- lib/libminlib/Makefile | 7 +- lib/libminlib/checkperms.c | 27 + lib/libminlib/copyfd.c | 15 + lib/libminlib/getnucred.c | 40 +- lib/libminlib/mapdriver.c | 6 +- lib/libmthread/misc.c | 8 +- lib/libnetsock/socket.c | 486 +++-- lib/libpuffs/fs.h | 1 + lib/libpuffs/inode.c | 2 +- lib/libpuffs/link.c | 6 +- lib/libpuffs/mount.c | 4 +- lib/libpuffs/null.c | 6 +- lib/libpuffs/open.c | 8 +- lib/libpuffs/path.c | 24 +- lib/libpuffs/proto.h | 1 - lib/libpuffs/puffs.c | 5 +- lib/libpuffs/read.c | 8 +- lib/libpuffs/stadir.c | 29 +- lib/libpuffs/table.c | 7 +- lib/libsffs/const.h | 4 +- lib/libsffs/inode.c | 3 +- lib/libsffs/lookup.c | 6 +- lib/libsffs/misc.c | 25 +- lib/libsffs/mount.c | 2 +- lib/libsffs/proto.h | 5 +- lib/libsffs/stat.c | 4 +- lib/libsffs/table.c | 5 +- lib/libsys/Makefile | 4 +- lib/libsys/input.c | 17 - lib/libsys/kputc.c | 2 +- lib/libsys/sched_start.c | 2 +- lib/libsys/send_taskreply.c | 20 - lib/libsys/sys_diagctl.c | 13 + lib/libsys/sys_sysctl.c | 20 - lib/libsys/tickdelay.c | 2 +- lib/libsys/timers.c | 10 +- lib/libsys/vm_cache.c | 14 + lib/libtimers/timers.h | 4 +- lib/libtimers/tmrs_clr.c | 6 +- lib/libtimers/tmrs_exp.c | 4 +- lib/libtimers/tmrs_set.c | 6 +- lib/libutil/Makefile | 4 +- lib/libutil/opendisk.c | 10 + lib/libvirtio/virtio.c | 8 +- lib/libvtreefs/inc.h | 1 - lib/libvtreefs/inode.c | 4 +- lib/libvtreefs/mount.c | 3 +- lib/libvtreefs/path.c | 4 +- lib/libvtreefs/proto.h | 5 +- lib/libvtreefs/read.c | 4 +- lib/libvtreefs/stadir.c | 22 +- lib/libvtreefs/table.c | 7 +- man/man1/Makefile | 6 +- man/man1/df.1 | 75 - man/man1/dumpcore.1 | 29 - man/man1/uname.1 | 59 - man/man2/Makefile | 3 +- man/man2/getnucred.2 | 4 +- man/man2/intro.2 | 1 - man/man2/mount.2 | 19 +- man/man2/statvfs.2 | 133 -- man/man4/ip.4 | 2 +- man/man4/tty.4 | 24 - man/man5/keymap.5 | 53 +- man/man5/system.conf.5 | 9 +- man/man8/MAKEDEV.8 | 53 - man/man8/Makefile | 2 +- releasetools/Makefile | 1 - releasetools/arm_sdimage.sh | 27 +- releasetools/gen_uEnv.txt.sh | 17 +- releasetools/nbsd_ports | 12 +- releasetools/release.functions | 11 +- releasetools/release.sh | 2 +- releasetools/x86_hdimage.sh | 42 +- sbin/newfs_ext2fs/mke2fs.c | 1 + sbin/newfs_ext2fs/newfs_ext2fs.c | 15 +- servers/Makefile | 4 +- servers/devman/buf.c | 2 +- servers/devman/devman.h | 2 +- servers/devman/main.c | 2 +- servers/ds/inc.h | 1 - servers/ext2/const.h | 2 +- servers/ext2/fs.h | 1 + servers/ext2/ialloc.c | 4 +- servers/ext2/inode.c | 8 +- servers/ext2/inode.h | 2 +- servers/ext2/link.c | 25 +- servers/ext2/mount.c | 11 +- servers/ext2/open.c | 28 +- servers/ext2/path.c | 26 +- servers/ext2/protect.c | 12 +- servers/ext2/proto.h | 11 +- servers/ext2/read.c | 14 +- servers/ext2/stadir.c | 36 +- servers/ext2/table.c | 7 +- servers/ext2/time.c | 2 +- servers/inet/clock.c | 24 +- servers/inet/generic/arp.c | 6 +- servers/inet/generic/clock.h | 16 +- servers/inet/generic/eth.c | 2 +- servers/inet/generic/ip_ioctl.c | 6 +- servers/inet/generic/tcp.c | 2 +- servers/inet/generic/tcp_int.h | 2 +- servers/inet/generic/tcp_send.c | 27 +- servers/inet/generic/udp.c | 2 +- servers/inet/inet.c | 72 +- servers/inet/inet.h | 2 +- servers/inet/mq.h | 21 +- servers/inet/proto.h | 6 +- servers/inet/sr.c | 541 ++--- servers/inet/sr_int.h | 3 - servers/input/Makefile | 14 + servers/input/input.c | 696 +++++++ servers/input/input.h | 45 + servers/ipc/inc.h | 1 + servers/is/dmp_fs.c | 46 +- servers/is/dmp_kernel.c | 6 +- servers/is/dmp_pm.c | 4 +- servers/is/dmp_rs.c | 6 +- servers/is/dmp_vm.c | 2 +- servers/iso9660fs/const.h | 2 +- servers/iso9660fs/inc.h | 2 +- servers/iso9660fs/inode.c | 6 +- servers/iso9660fs/inode.h | 4 +- servers/iso9660fs/mount.c | 5 +- servers/iso9660fs/path.c | 40 +- servers/iso9660fs/proto.h | 6 +- servers/iso9660fs/read.c | 4 +- servers/iso9660fs/stadir.c | 30 +- servers/iso9660fs/table.c | 11 +- servers/lwip/driver.c | 231 +-- servers/lwip/eth.c | 1 + servers/lwip/inet_config.c | 3 +- servers/lwip/lwip.c | 39 +- servers/lwip/proto.h | 4 +- servers/lwip/raw_ip.c | 146 +- servers/lwip/tcp.c | 326 ++- servers/lwip/udp.c | 134 +- servers/mfs/const.h | 2 +- servers/mfs/fs.h | 2 + servers/mfs/inode.c | 18 +- servers/mfs/inode.h | 3 +- servers/mfs/link.c | 20 +- servers/mfs/mfsdir.h | 2 +- servers/mfs/mount.c | 15 +- servers/mfs/open.c | 28 +- servers/mfs/path.c | 36 +- servers/mfs/protect.c | 12 +- servers/mfs/proto.h | 11 +- servers/mfs/read.c | 14 +- servers/mfs/stadir.c | 42 +- servers/mfs/stats.c | 2 +- servers/mfs/super.c | 2 +- servers/mfs/super.h | 4 +- servers/mfs/table.c | 7 +- servers/mfs/time.c | 2 +- servers/pfs/Makefile | 7 +- servers/pfs/buf.h | 2 +- servers/pfs/buffer.c | 8 +- servers/pfs/const.h | 24 +- servers/pfs/dev_uds.c | 1192 ----------- servers/pfs/fs.h | 1 + servers/pfs/glo.h | 5 - servers/pfs/inc.h | 35 - servers/pfs/inode.c | 21 +- servers/pfs/inode.h | 2 +- servers/pfs/link.c | 4 +- servers/pfs/main.c | 55 +- servers/pfs/open.c | 12 +- servers/pfs/proto.h | 47 +- servers/pfs/read.c | 10 +- servers/pfs/stadir.c | 2 +- servers/pfs/table.c | 35 +- servers/pfs/uds.c | 1509 -------------- servers/pfs/utility.c | 2 +- servers/pm/alarm.c | 15 +- servers/pm/forkexit.c | 5 +- servers/pm/main.c | 11 +- servers/pm/misc.c | 12 +- servers/pm/mproc.h | 4 +- servers/pm/proto.h | 2 +- servers/pm/schedule.c | 2 +- servers/pm/signal.c | 4 +- servers/pm/table.c | 5 +- servers/pm/trace.c | 21 - servers/pm/utility.c | 2 +- servers/procfs/Makefile | 2 +- servers/procfs/inc.h | 3 +- servers/procfs/mounts.c | 34 - servers/procfs/mounts.h | 6 - servers/procfs/pid.c | 1 - servers/procfs/root.c | 20 +- servers/procfs/type.h | 2 +- servers/rs/const.h | 4 - servers/rs/exec.c | 6 +- servers/rs/inc.h | 3 +- servers/rs/main.c | 5 +- servers/rs/manager.c | 21 +- servers/rs/table.c | 15 +- servers/rs/type.h | 3 - servers/rs/utility.c | 4 +- servers/sched/proto.h | 2 +- servers/sched/schedule.c | 6 +- servers/vfs/README | 212 +- servers/vfs/comm.c | 17 +- servers/vfs/comm.h | 12 - servers/vfs/const.h | 28 +- servers/vfs/coredump.c | 1 - servers/vfs/device.c | 1449 +++++-------- servers/vfs/dmap.c | 216 +- servers/vfs/dmap.h | 9 +- servers/vfs/exec.c | 93 +- servers/vfs/file.h | 11 +- servers/vfs/filedes.c | 405 +--- servers/vfs/fproc.h | 22 +- servers/vfs/fs.h | 3 +- servers/vfs/gcov.c | 1 - servers/vfs/glo.h | 13 +- servers/vfs/job.h | 12 - servers/vfs/link.c | 2 +- servers/vfs/lock.c | 5 +- servers/vfs/main.c | 721 ++----- servers/vfs/misc.c | 180 +- servers/vfs/mount.c | 127 +- servers/vfs/open.c | 38 +- servers/vfs/param.h | 6 - servers/vfs/path.c | 24 +- servers/vfs/pipe.c | 128 +- servers/vfs/protect.c | 1 - servers/vfs/proto.h | 133 +- servers/vfs/read.c | 68 +- servers/vfs/request.c | 337 +-- servers/vfs/select.c | 407 ++-- servers/vfs/stadir.c | 198 +- servers/vfs/table.c | 51 +- servers/vfs/threads.h | 6 +- servers/vfs/time.c | 1 - servers/vfs/type.h | 41 + servers/vfs/utility.c | 3 +- servers/vfs/vmnt.c | 2 - servers/vfs/vmnt.h | 9 +- servers/vfs/vnode.c | 2 - servers/vfs/vnode.h | 4 +- servers/vfs/worker.c | 474 +++-- servers/vm/arch/i386/pagetable.c | 1 - servers/vm/break.c | 1 - servers/vm/cache.c | 19 + servers/vm/exit.c | 1 - servers/vm/fdref.h | 1 - servers/vm/fork.c | 1 - servers/vm/main.c | 8 +- servers/vm/mem_cache.c | 14 + servers/vm/mem_file.c | 2 +- servers/vm/mmap.c | 5 +- servers/vm/pagefaults.c | 3 +- servers/vm/proto.h | 4 +- servers/vm/queryexit.c | 1 - servers/vm/region.h | 1 - servers/vm/rs.c | 1 - servers/vm/slaballoc.c | 1 - share/mk/bsd.own.mk | 2 + sys/arch/arm/include/ansi.h | 8 +- sys/arch/i386/include/ansi.h | 9 +- sys/arch/i386/include/asm.h | 4 +- sys/conf/osrelease.sh | 6 +- sys/dev/Makefile | 2 + sys/dev/vndvar.h | 218 ++ sys/stdlib.h | 3 +- sys/sys/ansi.h | 6 +- sys/sys/disklabel_gpt.h | 9 +- sys/sys/errno.h | 1 - sys/sys/fd_set.h | 50 +- sys/sys/file.h | 30 +- sys/sys/ioctl.h | 5 +- sys/sys/ptrace.h | 1 - sys/sys/select.h | 9 - sys/sys/statvfs.h | 74 +- sys/sys/syslimits.h | 1 + sys/sys/time.h | 7 +- sys/sys/types.h | 24 +- sys/sys/ucred.h | 12 +- sys/sys/un.h | 1 + test/Makefile | 16 +- test/blocktest/Makefile | 4 +- test/blocktest/blocktest.c | 305 +-- test/blocktest/test.sh | 18 +- test/run | 42 +- test/scancodes/Makefile | 10 - test/scancodes/test-scancodes.c | 410 ---- test/select/Makefile | 39 - test/select/speed.c | 61 - test/select/test00.c | 58 - test/select/test01.c | 74 - test/select/test02.c | 114 - test/select/test03.c | 137 -- test/select/test04_cli.c | 148 -- test/select/test04_srv.c | 134 -- test/select/test05_cli.c | 165 -- test/select/test05_srv.c | 196 -- test/select/test06_cli.c | 162 -- test/select/test06_srv.c | 127 -- test/select/test07_cli.c | 182 -- test/select/test07_srv.c | 137 -- test/select/test08_cli.c | 183 -- test/select/test08_srv.c | 145 -- test/select/test09.c | 62 - test/select/test10.c | 71 - test/select/test11.c | 164 -- test/select/test12.c | 39 - test/select/test13a.c | 56 - test/select/test13b.c | 67 - test/select/test14.c | 144 -- test/t40c.c | 51 +- test/t40g.c | 52 + test/test2.c | 6 +- test/test40.c | 6 +- test/test55.c | 197 +- test/test56.c | 661 +++++- test/test72.c | 17 +- test/test76.c | 446 ++++ test/test77.c | 486 +++++ test/testvm.c | 2 + test/testvm.conf | 2 +- test/testvnd.sh | 155 ++ test/tvnd.c | 53 + usr.bin/Makefile | 2 +- usr.bin/man/man.1 | 12 +- usr.bin/man/man.c | 69 +- usr.bin/man/man.conf.5 | 23 +- usr.bin/stat/stat.1 | 71 +- usr.bin/stat/stat.c | 96 +- usr.bin/top/top.c | 2 +- usr.bin/uname/Makefile | 10 + usr.bin/uname/uname.1 | 86 + usr.bin/uname/uname.c | 175 ++ usr.sbin/Makefile | 1 + usr.sbin/vnconfig/Makefile | 10 + usr.sbin/vnconfig/vnconfig.8 | 195 ++ usr.sbin/vnconfig/vnconfig.c | 605 ++++++ 707 files changed, 39741 insertions(+), 30169 deletions(-) create mode 100644 bin/df/Makefile create mode 100644 bin/df/df.1 create mode 100644 bin/df/df.c create mode 100644 commands/MAKEDEV/MAKEDEV.8 mode change 100644 => 100755 commands/MAKEDEV/MAKEDEV.sh delete mode 100644 commands/df/Makefile delete mode 100644 commands/df/df.c delete mode 100644 commands/dumpcore/Makefile delete mode 100644 commands/dumpcore/dumpcore.c delete mode 100644 commands/gcore/Makefile delete mode 100644 commands/gcore/gcore.c delete mode 100644 commands/uname/Makefile delete mode 100644 commands/uname/uname.c create mode 100644 drivers/pckbd/Makefile create mode 100644 drivers/pckbd/pckbd.c create mode 100644 drivers/pckbd/pckbd.h create mode 100644 drivers/pckbd/table.c delete mode 100644 drivers/ramdisk/proto.dev create mode 100644 drivers/tty/keymaps/norwegian.src delete mode 100644 drivers/tty/keymaps/olivetti.src delete mode 100644 drivers/tty/keymaps/us-std-esc.src create mode 100644 drivers/uds/Makefile create mode 100644 drivers/uds/ioc_uds.c create mode 100644 drivers/uds/uds.c rename {servers/pfs => drivers/uds}/uds.h (55%) create mode 100644 drivers/vnd/Makefile create mode 100644 drivers/vnd/NOTES create mode 100644 drivers/vnd/vnd.c create mode 100644 external/bsd/mdocml/dist/apropos.1 create mode 100644 external/bsd/mdocml/dist/apropos.c create mode 100644 external/bsd/mdocml/dist/apropos_db.c create mode 100644 external/bsd/mdocml/dist/apropos_db.h create mode 100644 external/bsd/mdocml/dist/catman.8 create mode 100644 external/bsd/mdocml/dist/catman.c create mode 100644 external/bsd/mdocml/dist/cgi.c delete mode 100644 external/bsd/mdocml/dist/chars.h create mode 100644 external/bsd/mdocml/dist/compat_fgetln.c create mode 100644 external/bsd/mdocml/dist/compat_getsubopt.c rename external/bsd/mdocml/dist/{compat.c => compat_strlcat.c} (70%) create mode 100644 external/bsd/mdocml/dist/compat_strlcpy.c create mode 100644 external/bsd/mdocml/dist/demandoc.1 create mode 100644 external/bsd/mdocml/dist/demandoc.c create mode 100644 external/bsd/mdocml/dist/eqn.7 create mode 100644 external/bsd/mdocml/dist/eqn.c create mode 100644 external/bsd/mdocml/dist/eqn_html.c create mode 100644 external/bsd/mdocml/dist/eqn_term.c create mode 100644 external/bsd/mdocml/dist/man-cgi.css delete mode 100644 external/bsd/mdocml/dist/man.3 create mode 100644 external/bsd/mdocml/dist/man.cgi.7 delete mode 100755 external/bsd/mdocml/dist/mandoc create mode 100644 external/bsd/mdocml/dist/mandoc.3 create mode 100644 external/bsd/mdocml/dist/mandocdb.8 create mode 100644 external/bsd/mdocml/dist/mandocdb.c create mode 100644 external/bsd/mdocml/dist/mandocdb.h create mode 100644 external/bsd/mdocml/dist/manpath.c rename external/bsd/mdocml/dist/{man_argv.c => manpath.h} (60%) delete mode 100644 external/bsd/mdocml/dist/mdoc.3 create mode 100644 external/bsd/mdocml/dist/mdoc_man.c delete mode 100644 external/bsd/mdocml/dist/mdoc_strings.c create mode 100644 external/bsd/mdocml/dist/preconv.1 create mode 100644 external/bsd/mdocml/dist/preconv.c create mode 100644 external/bsd/mdocml/dist/predefs.in create mode 100644 external/bsd/mdocml/dist/read.c delete mode 100644 external/bsd/mdocml/dist/roff.3 delete mode 100644 external/bsd/mdocml/dist/roff.h create mode 100644 external/bsd/mdocml/dist/test-fgetln.c create mode 100644 external/bsd/mdocml/dist/test-getsubopt.c create mode 100644 external/bsd/mdocml/dist/test-mmap.c create mode 100644 external/bsd/mdocml/dist/test-strptime.c create mode 100644 external/bsd/mdocml/dist/whatis.1 delete mode 100644 external/bsd/mdocml/lib/libman/Makefile create mode 100644 external/bsd/mdocml/lib/libmandoc/Makefile delete mode 100644 external/bsd/mdocml/lib/libmdoc/Makefile delete mode 100644 external/bsd/mdocml/lib/libroff/Makefile create mode 100644 include/minix/inputdriver.h delete mode 100644 include/minix/tty.h delete mode 100644 include/timers.h create mode 100644 kernel/system/do_diagctl.c delete mode 100644 kernel/system/do_sysctl.c create mode 100644 lib/libc/sys-minix/getvfsstat.c create mode 100644 lib/libinputdriver/Makefile create mode 100644 lib/libinputdriver/inputdriver.c create mode 100644 lib/libminlib/checkperms.c create mode 100644 lib/libminlib/copyfd.c delete mode 100644 lib/libsys/input.c delete mode 100644 lib/libsys/send_taskreply.c create mode 100644 lib/libsys/sys_diagctl.c delete mode 100644 lib/libsys/sys_sysctl.c delete mode 100644 man/man1/df.1 delete mode 100644 man/man1/dumpcore.1 delete mode 100644 man/man1/uname.1 delete mode 100644 man/man2/statvfs.2 delete mode 100644 man/man8/MAKEDEV.8 create mode 100644 servers/input/Makefile create mode 100644 servers/input/input.c create mode 100644 servers/input/input.h delete mode 100644 servers/pfs/dev_uds.c delete mode 100644 servers/pfs/inc.h delete mode 100644 servers/pfs/uds.c delete mode 100644 servers/procfs/mounts.c delete mode 100644 servers/procfs/mounts.h delete mode 100644 servers/vfs/comm.h delete mode 100644 servers/vfs/job.h create mode 100644 servers/vfs/type.h create mode 100644 sys/dev/vndvar.h delete mode 100644 test/scancodes/Makefile delete mode 100644 test/scancodes/test-scancodes.c delete mode 100644 test/select/Makefile delete mode 100644 test/select/speed.c delete mode 100644 test/select/test00.c delete mode 100644 test/select/test01.c delete mode 100644 test/select/test02.c delete mode 100644 test/select/test03.c delete mode 100644 test/select/test04_cli.c delete mode 100644 test/select/test04_srv.c delete mode 100644 test/select/test05_cli.c delete mode 100644 test/select/test05_srv.c delete mode 100644 test/select/test06_cli.c delete mode 100644 test/select/test06_srv.c delete mode 100644 test/select/test07_cli.c delete mode 100644 test/select/test07_srv.c delete mode 100644 test/select/test08_cli.c delete mode 100644 test/select/test08_srv.c delete mode 100644 test/select/test09.c delete mode 100644 test/select/test10.c delete mode 100644 test/select/test11.c delete mode 100644 test/select/test12.c delete mode 100644 test/select/test13a.c delete mode 100644 test/select/test13b.c delete mode 100644 test/select/test14.c create mode 100644 test/t40g.c create mode 100644 test/test76.c create mode 100644 test/test77.c create mode 100755 test/testvnd.sh create mode 100644 test/tvnd.c create mode 100644 usr.bin/uname/Makefile create mode 100644 usr.bin/uname/uname.1 create mode 100644 usr.bin/uname/uname.c create mode 100644 usr.sbin/vnconfig/Makefile create mode 100644 usr.sbin/vnconfig/vnconfig.8 create mode 100644 usr.sbin/vnconfig/vnconfig.c diff --git a/bin/Makefile b/bin/Makefile index cfbbfbb1f..1d2a3c8a2 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.22 2007/12/31 15:31:24 ad Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 -SUBDIR= cat date echo ed expr kill ksh ln ls \ +SUBDIR= cat date df echo ed expr kill ksh ln ls \ mkdir pax pwd rm rmdir sync test .include diff --git a/bin/cat/cat.1 b/bin/cat/cat.1 index c60063330..d2e07539d 100644 --- a/bin/cat/cat.1 +++ b/bin/cat/cat.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: cat.1,v 1.32 2006/09/23 11:24:44 wiz Exp $ +.\" $NetBSD: cat.1,v 1.34 2012/08/09 07:26:28 dholland Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)cat.1 8.3 (Berkeley) 5/2/95 .\" -.Dd September 23, 2006 +.Dd April 6, 2012 .Dt CAT 1 .Os .Sh NAME @@ -54,6 +54,9 @@ A single dash represents the standard input, and may appear multiple times in the .Ar file list. +If no +.Ar file +operands are given, standard input is read. .Pp The word .Dq concatenate @@ -65,7 +68,7 @@ The options are as follows: .It Fl b Implies the .Fl n -option but doesn't number blank lines. +option, but doesn't number blank lines. .It Fl e Implies the .Fl v @@ -139,7 +142,7 @@ to the file truncating .Ar file3 if it already exists. -See the manual page for your shell (i.e., +See the manual page for your shell (e.g., .Xr sh 1 ) for more information on redirection. .Pp diff --git a/bin/cat/cat.c b/bin/cat/cat.c index 5d955e56a..176aeb986 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -1,4 +1,4 @@ -/* $NetBSD: cat.c,v 1.47 2008/07/20 00:52:39 lukem Exp $ */ +/* $NetBSD: cat.c,v 1.48 2012/03/17 23:35:28 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -44,7 +44,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95"; #else -__RCSID("$NetBSD: cat.c,v 1.47 2008/07/20 00:52:39 lukem Exp $"); +__RCSID("$NetBSD: cat.c,v 1.48 2012/03/17 23:35:28 christos Exp $"); #endif #endif /* not lint */ @@ -295,8 +295,8 @@ raw_cat(int rfd) if (buf == NULL) { struct stat sbuf; - if (fstat(wfd, &sbuf) == 0 && - sbuf.st_blksize > sizeof(fb_buf)) { + if (fstat(wfd, &sbuf) == 0 && sbuf.st_blksize > 0 && + (size_t)sbuf.st_blksize > sizeof(fb_buf)) { bsize = sbuf.st_blksize; buf = malloc(bsize); } diff --git a/bin/df/Makefile b/bin/df/Makefile new file mode 100644 index 000000000..e3c5edb60 --- /dev/null +++ b/bin/df/Makefile @@ -0,0 +1,11 @@ +# $NetBSD: Makefile,v 1.19 2011/08/28 08:20:58 christos Exp $ +# @(#)Makefile 8.3 (Berkeley) 5/8/95 + +.include + +PROG= df + +LDADD+=-lutil +DPADD+=${LIBUTIL} + +.include diff --git a/bin/df/df.1 b/bin/df/df.1 new file mode 100644 index 000000000..7ab3d0c67 --- /dev/null +++ b/bin/df/df.1 @@ -0,0 +1,206 @@ +.\" $NetBSD: df.1,v 1.44 2010/04/05 21:17:28 joerg Exp $ +.\" +.\" Copyright (c) 1989, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)df.1 8.2 (Berkeley) 1/13/92 +.\" +.Dd March 4, 2008 +.Dt DF 1 +.Os +.Sh NAME +.Nm df +.Nd display free disk space +.Sh SYNOPSIS +.Nm +.Op Fl agklmn +.Op Fl G | Fl i | Fl P +.Op Fl t Ar type +.Op Ar file | Ar file_system ... +.Sh DESCRIPTION +.Nm +displays statistics about the amount of free disk space on the specified +.Ar file_system +or on the file system of which +.Ar file +is a part. +By default, all sizes are reported in 512-byte block counts. +If neither a file or a +.Ar file_system +operand is specified, +statistics for all mounted file systems are displayed +(subject to the +.Fl l +and +.Fl t +options below). +.Pp +Note that the printed count of available blocks takes +.Va minfree +into account, and thus will be negative when the number of free blocks +on the filesystem is less than +.Va minfree . +.Pp +The following options are available: +.Bl -tag -width Ds +.It Fl a +Show all mount points, +including those that were mounted with the +.Dv MNT_IGNORE +flag. +.It Fl G +Display all the fields of the structure(s) returned by +.Xr statvfs 2 . +This option cannot be used with the +.Fl i +or +.Fl P +options, and it is modelled after the Solaris +.Fl g +option. +This option will override the +.Fl g , +.Fl h , +.Fl k , +and +.Fl m +options, as well as any setting of +.Ev BLOCKSIZE . +.It Fl g +The +.Fl g +option causes the numbers to be reported in gigabytes (1024*1024*1024 +bytes). +.It Fl h +"Human-readable" output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte, Petabyte, Exabyte in order to reduce the number of +digits to four or less. +.It Fl i +Include statistics on the number of free inodes. +.It Fl k +By default, all sizes are reported in 512-byte block counts. +The +.Fl k +option causes the numbers to be reported in kilobytes (1024 bytes). +.It Fl l +Display statistics only about mounted file systems with the +.Dv MNT_LOCAL +flag set. +If a non-local file system is given as an argument, a +warning is issued and no information is given on that file system. +.It Fl m +The +.Fl m +option causes the numbers to be reported in megabytes (1024*1024 bytes). +.It Fl n +Print out the previously obtained statistics from the file systems. +This option should be used if it is possible that one or more +file systems are in a state such that they will not be able to provide +statistics without a long delay. +When this option is specified, +.Nm +will not request new statistics from the file systems, but will respond +with the possibly stale statistics that were previously obtained. +.It Fl P +Produce output in the following portable format: +.Pp +If both the +.Fl P +and +.Fl k +option are specified, the output will be preceded by the following header +line, formatted to match the data following it: +.Bd -literal +"Filesystem 1024-blocks Used Available Capacity Mounted on\en" +.Ed +.Pp +If the +.Fl P +option is specified without the +.Fl k +options, the output will be preceded by the following header line, +formatted to match the data following it: +.Bd -literal +"Filesystem \*[Lt]blksize\*[Gt]-blocks Used Available Capacity Mounted on\en" +.Ed +.Pp +The header line is followed by data formatted as follows: +.Bd -literal +"%s %d %d %d %d%% %s\en", \*[Lt]file system name\*[Gt], \*[Lt]total space\*[Gt], + \*[Lt]space used\*[Gt], \*[Lt]space free\*[Gt], \*[Lt]percentage used\*[Gt], + \*[Lt]file system root\*[Gt] +.Ed +.Pp +Note that the +.Fl i +option may not be specified with +.Fl P . +.It Fl t Ar type +Is used to indicate the actions should only be taken on +filesystems of the specified type. +More than one type may be specified in a comma-separated list. +The list of filesystem types can be prefixed with +.Dq no +to specify the filesystem types for which action should +.Em not +be taken. +If a file system is given on the command line that is not of +the specified type, a warning is issued and no information is given on +that file system. +.El +.Sh ENVIRONMENT +.Bl -tag -width BLOCKSIZE +.It Ev BLOCKSIZE +If the environment variable +.Ev BLOCKSIZE +is set, and the +.Fl g , +.Fl h , +.Fl k +and +.Fl m +options are not specified, the block counts will be displayed in units of that +size block. +.El +.Sh SEE ALSO +.Xr quota 1 , +.Xr fstatvfs 2 , +.Xr getvfsstat 2 , +.Xr statvfs 2 , +.Xr getbsize 3 , +.Xr getmntinfo 3 , +.Xr fs 5 , +.Xr fstab 5 , +.Xr mount 8 , +.Xr quot 8 , +.Xr tunefs 8 +.Sh HISTORY +A +.Nm +utility appeared in +.At v6 . diff --git a/bin/df/df.c b/bin/df/df.c new file mode 100644 index 000000000..d36157411 --- /dev/null +++ b/bin/df/df.c @@ -0,0 +1,520 @@ +/* $NetBSD: df.c,v 1.90 2012/01/07 18:45:13 christos Exp $ */ + +/* + * Copyright (c) 1980, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +__COPYRIGHT( +"@(#) Copyright (c) 1980, 1990, 1993, 1994\ + The Regents of the University of California. All rights reserved."); +#endif /* not lint */ + +#ifndef lint +#if 0 +static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; +#else +__RCSID("$NetBSD: df.c,v 1.90 2012/01/07 18:45:13 christos Exp $"); +#endif +#endif /* not lint */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static char *getmntpt(const char *); +static void prtstat(struct statvfs *, int); +static int selected(const char *, size_t); +static void maketypelist(char *); +static size_t regetmntinfo(struct statvfs **, size_t); +__dead static void usage(void); +static void prthumanval(int64_t, const char *); +static void prthuman(struct statvfs *, int64_t, int64_t); + +static int aflag, gflag, hflag, iflag, lflag, nflag, Pflag; +static long usize; +static char **typelist; + +int +main(int argc, char *argv[]) +{ + struct stat stbuf; + struct statvfs *mntbuf; + long mntsize; + int ch, i, maxwidth, width; + char *mntpt; + + setprogname(argv[0]); + (void)setlocale(LC_ALL, ""); + + while ((ch = getopt(argc, argv, "aGghiklmnPt:")) != -1) + switch (ch) { + case 'a': + aflag = 1; + break; + case 'g': + hflag = 0; + usize = 1024 * 1024 * 1024; + break; + case 'G': + gflag = 1; + break; + case 'h': + hflag = 1; + usize = 0; + break; + case 'i': + iflag = 1; + break; + case 'k': + hflag = 0; + usize = 1024; + break; + case 'l': + lflag = 1; + break; + case 'm': + hflag = 0; + usize = 1024 * 1024; + break; + case 'n': + nflag = 1; + break; + case 'P': + Pflag = 1; + break; + case 't': + if (typelist != NULL) + errx(EXIT_FAILURE, + "only one -t option may be specified."); + maketypelist(optarg); + break; + case '?': + default: + usage(); + } + + if (gflag && (Pflag || iflag)) + errx(EXIT_FAILURE, + "only one of -G and -P or -i may be specified"); + if (Pflag && iflag) + errx(EXIT_FAILURE, + "only one of -P and -i may be specified"); +#if 0 + /* + * The block size cannot be checked until after getbsize() is called. + */ + if (Pflag && (hflag || (usize != 1024 && usize != 512))) + errx(EXIT_FAILURE, + "non-standard block size incompatible with -P"); +#endif + argc -= optind; + argv += optind; + + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + if (mntsize == 0) + err(EXIT_FAILURE, + "retrieving information on mounted file systems"); + + if (*argv == NULL) { + mntsize = regetmntinfo(&mntbuf, mntsize); + } else { + if ((mntbuf = malloc(argc * sizeof(*mntbuf))) == NULL) + err(EXIT_FAILURE, "can't allocate statvfs array"); + mntsize = 0; + for (/*EMPTY*/; *argv != NULL; argv++) { + if (stat(*argv, &stbuf) < 0) { + if ((mntpt = getmntpt(*argv)) == 0) { + warn("%s", *argv); + continue; + } + } else if (S_ISBLK(stbuf.st_mode)) { + if ((mntpt = getmntpt(*argv)) == 0) + mntpt = *argv; + } else + mntpt = *argv; + /* + * Statfs does not take a `wait' flag, so we cannot + * implement nflag here. + */ + if (!statvfs(mntpt, &mntbuf[mntsize])) + if (lflag && + (mntbuf[mntsize].f_flag & MNT_LOCAL) == 0) + warnx("Warning: %s is not a local %s", + *argv, "file system"); + else if + (!selected(mntbuf[mntsize].f_fstypename, + sizeof(mntbuf[mntsize].f_fstypename))) + warnx("Warning: %s mounted as a %s %s", + *argv, + mntbuf[mntsize].f_fstypename, + "file system"); + else + ++mntsize; + else + warn("%s", *argv); + } + } + + maxwidth = 0; + for (i = 0; i < mntsize; i++) { + width = (int)strlen(mntbuf[i].f_mntfromname); + if (width > maxwidth) + maxwidth = width; + } + for (i = 0; i < mntsize; i++) + prtstat(&mntbuf[i], maxwidth); + return 0; +} + +static char * +getmntpt(const char *name) +{ + size_t mntsize, i; + struct statvfs *mntbuf; + + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + if (mntsize == 0) + err(EXIT_FAILURE, "Can't get mount information"); + for (i = 0; i < mntsize; i++) { + if (!strcmp(mntbuf[i].f_mntfromname, name)) + return mntbuf[i].f_mntonname; + } + return 0; +} + +static enum { IN_LIST, NOT_IN_LIST } which; + +static int +selected(const char *type, size_t len) +{ + char **av; + + /* If no type specified, it's always selected. */ + if (typelist == NULL) + return 1; + for (av = typelist; *av != NULL; ++av) + if (!strncmp(type, *av, len)) + return which == IN_LIST ? 1 : 0; + return which == IN_LIST ? 0 : 1; +} + +static void +maketypelist(char *fslist) +{ + size_t i; + char *nextcp, **av; + + if ((fslist == NULL) || (fslist[0] == '\0')) + errx(EXIT_FAILURE, "empty type list"); + + /* + * XXX + * Note: the syntax is "noxxx,yyy" for no xxx's and + * no yyy's, not the more intuitive "noyyy,noyyy". + */ + if (fslist[0] == 'n' && fslist[1] == 'o') { + fslist += 2; + which = NOT_IN_LIST; + } else + which = IN_LIST; + + /* Count the number of types. */ + for (i = 1, nextcp = fslist; + (nextcp = strchr(nextcp, ',')) != NULL; i++) + ++nextcp; + + /* Build an array of that many types. */ + if ((av = typelist = malloc((i + 1) * sizeof(*av))) == NULL) + err(EXIT_FAILURE, "can't allocate type array"); + av[0] = fslist; + for (i = 1, nextcp = fslist; + (nextcp = strchr(nextcp, ',')) != NULL; i++) { + *nextcp = '\0'; + av[i] = ++nextcp; + } + /* Terminate the array. */ + av[i] = NULL; +} + +/* + * Make a pass over the filesystem info in ``mntbuf'' filtering out + * filesystem types not in ``fsmask'' and possibly re-stating to get + * current (not cached) info. Returns the new count of valid statvfs bufs. + */ +static size_t +regetmntinfo(struct statvfs **mntbufp, size_t mntsize) +{ + size_t i, j; + struct statvfs *mntbuf; + + if (!lflag && typelist == NULL && aflag) + return nflag ? mntsize : (size_t)getmntinfo(mntbufp, MNT_WAIT); + + mntbuf = *mntbufp; + j = 0; + for (i = 0; i < mntsize; i++) { + if (!aflag && (mntbuf[i].f_flag & MNT_IGNORE) != 0) + continue; + if (lflag && (mntbuf[i].f_flag & MNT_LOCAL) == 0) + continue; + if (!selected(mntbuf[i].f_fstypename, + sizeof(mntbuf[i].f_fstypename))) + continue; + if (nflag) + mntbuf[j] = mntbuf[i]; + else { + struct statvfs layerbuf = mntbuf[i]; + (void)statvfs(mntbuf[i].f_mntonname, &mntbuf[j]); + /* + * If the FS name changed, then new data is for + * a different layer and we don't want it. + */ + if (memcmp(layerbuf.f_mntfromname, + mntbuf[j].f_mntfromname, MNAMELEN)) + mntbuf[j] = layerbuf; + } + j++; + } + return j; +} + +static void +prthumanval(int64_t bytes, const char *pad) +{ + char buf[6]; + + (void)humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1), + bytes, "", HN_AUTOSCALE, + HN_B | HN_NOSPACE | HN_DECIMAL); + + (void)printf("%s %6s", pad, buf); +} + +static void +prthuman(struct statvfs *sfsp, int64_t used, int64_t bavail) +{ + + prthumanval((int64_t)(sfsp->f_blocks * sfsp->f_frsize), " "); + prthumanval((int64_t)(used * sfsp->f_frsize), " "); + prthumanval((int64_t)(bavail * sfsp->f_frsize), " "); +} + +/* + * Convert statvfs returned filesystem size into BLOCKSIZE units. + * Attempts to avoid overflow for large filesystems. + */ +#define fsbtoblk(num, fsbs, bs) \ + (((fsbs) != 0 && (uint64_t)(fsbs) < (uint64_t)(bs)) ? \ + (int64_t)(num) / (int64_t)((bs) / (fsbs)) : \ + (int64_t)(num) * (int64_t)((fsbs) / (bs))) + +/* + * Print out status about a filesystem. + */ +static void +prtstat(struct statvfs *sfsp, int maxwidth) +{ + static long blocksize; + static int headerlen, timesthrough; + static const char *header; + static const char full[] = "100"; + static const char empty[] = " 0"; + int64_t used, availblks, inodes; + int64_t bavail; + char pb[64]; + + if (gflag) { + /* + * From SunOS-5.6: + * + * /var (/dev/dsk/c0t0d0s3 ): 8192 block size 1024 frag size + * 984242 total blocks 860692 free blocks 859708 available 249984 total files + * 248691 free files 8388611 filesys id + * ufs fstype 0x00000004 flag 255 filename length + * + */ + (void)printf("%10s (%-12s): %7ld block size %12ld frag size\n", + sfsp->f_mntonname, sfsp->f_mntfromname, + sfsp->f_iosize, /* On UFS/FFS systems this is + * also called the "optimal + * transfer block size" but it + * is of course the file + * system's block size too. + */ + sfsp->f_bsize); /* not so surprisingly the + * "fundamental file system + * block size" is the frag + * size. + */ + (void)printf("%10" PRId64 " total blocks %10" PRId64 + " free blocks %10" PRId64 " available\n", + (uint64_t)sfsp->f_blocks, (uint64_t)sfsp->f_bfree, + (uint64_t)sfsp->f_bavail); + (void)printf("%10" PRId64 " total files %10" PRId64 + " free files %12lx filesys id\n", + (uint64_t)sfsp->f_ffree, (uint64_t)sfsp->f_files, + sfsp->f_fsid); + (void)printf("%10s fstype %#15lx flag %17ld filename " + "length\n", sfsp->f_fstypename, sfsp->f_flag, + sfsp->f_namemax); + (void)printf("%10lu owner %17" PRId64 " syncwrites %12" PRId64 + " asyncwrites\n\n", (unsigned long)sfsp->f_owner, + sfsp->f_syncwrites, sfsp->f_asyncwrites); + + /* + * a concession by the structured programming police to the + * indentation police.... + */ + return; + } + if (maxwidth < 12) + maxwidth = 12; + if (++timesthrough == 1) { + switch (blocksize = usize) { + case 1024: + header = Pflag ? "1024-blocks" : "1K-blocks"; + headerlen = (int)strlen(header); + break; + case 1024 * 1024: + header = "1M-blocks"; + headerlen = (int)strlen(header); + break; + case 1024 * 1024 * 1024: + header = "1G-blocks"; + headerlen = (int)strlen(header); + break; + default: + if (hflag) { + header = "Size"; + headerlen = (int)strlen(header); + } else + header = getbsize(&headerlen, &blocksize); + break; + } + if (Pflag) { + /* + * either: + * "Filesystem 1024-blocks Used Available Capacity Mounted on\n" + * or: + * "Filesystem 512-blocks Used Available Capacity Mounted on\n" + */ + if (blocksize != 1024 && blocksize != 512) + errx(EXIT_FAILURE, + "non-standard block size incompatible with -P"); + (void)printf("Filesystem %s Used Available Capacity " + "Mounted on\n", header); + } else { + (void)printf("%-*.*s %s Used Avail %%Cap", + maxwidth - (headerlen - 10), + maxwidth - (headerlen - 10), + "Filesystem", header); + if (iflag) + (void)printf(" iUsed iAvail %%iCap"); + (void)printf(" Mounted on\n"); + } + } + used = sfsp->f_blocks - sfsp->f_bfree; + bavail = sfsp->f_bfree - sfsp->f_bresvd; + availblks = bavail + used; + if (Pflag) { + assert(hflag == 0); + assert(blocksize > 0); + /* + * "%s %d %d %d %s %s\n", , , + * , , , + * + */ + (void)printf("%s %" PRId64 " %" PRId64 " %" PRId64 " %s%% %s\n", + sfsp->f_mntfromname, + fsbtoblk(sfsp->f_blocks, sfsp->f_frsize, blocksize), + fsbtoblk(used, sfsp->f_frsize, blocksize), + fsbtoblk(bavail, sfsp->f_frsize, blocksize), + availblks == 0 ? full : strspct(pb, sizeof(pb), used, + availblks, 0), sfsp->f_mntonname); + /* + * another concession by the structured programming police to + * the indentation police.... + * + * Note iflag cannot be set when Pflag is set. + */ + return; + } + + (void)printf("%-*.*s ", maxwidth, maxwidth, sfsp->f_mntfromname); + + if (hflag) + prthuman(sfsp, used, bavail); + else + (void)printf("%10" PRId64 " %10" PRId64 " %10" PRId64, + fsbtoblk(sfsp->f_blocks, sfsp->f_frsize, blocksize), + fsbtoblk(used, sfsp->f_frsize, blocksize), + fsbtoblk(bavail, sfsp->f_frsize, blocksize)); + (void)printf(" %3s%%", + availblks == 0 ? full : + strspct(pb, sizeof(pb), used, availblks, 0)); + if (iflag) { + inodes = sfsp->f_files; + used = inodes - sfsp->f_ffree; + (void)printf(" %8jd %8jd %3s%%", + (intmax_t)used, (intmax_t)sfsp->f_ffree, + inodes == 0 ? (used == 0 ? empty : full) : + strspct(pb, sizeof(pb), used, inodes, 0)); + } + (void)printf(" %s\n", sfsp->f_mntonname); +} + +static void +usage(void) +{ + + (void)fprintf(stderr, + "Usage: %s [-aGgln] [-hkm|-ihkm|-Pk] [-t type] [file | " + "file_system ...]\n", + getprogname()); + exit(1); + /* NOTREACHED */ +} diff --git a/commands/DESCRIBE/DESCRIBE.sh b/commands/DESCRIBE/DESCRIBE.sh index 63560ae36..5ad21eb0c 100644 --- a/commands/DESCRIBE/DESCRIBE.sh +++ b/commands/DESCRIBE/DESCRIBE.sh @@ -126,10 +126,6 @@ do ;; 4,125) des="video output" dev=video ;; - 4,126) des="auxiliary input" dev=kbdaux - ;; - 4,127) des="keyboard input" dev=kbd - ;; 4,12[89]|4,1[3-8]?|4,19[01]) p=`expr \\( $minor - 128 \\) / 16 | tr '0123' 'pqrs'` n=`expr $minor % 16` @@ -196,6 +192,40 @@ do 18,0) des="UNIX domain socket" dev=uds ;; + 5[6-9],0|6[0-3],0) + drive=`expr $major - 56` + des="vnode disk $drive" dev=vnd$drive + ;; + 5[6-9],[1-4]|6[0-3],[1-4]) + drive=`expr $major - 56` + par=`expr $minor - 1` + des="vnode disk $drive partition $par" dev=vnd${drive}p${par} + ;; + 5[6-9],12[89]|5[6-9],13[0-9]|5[6-9],14[0-3]|6[0-3],12[89]|5[6-9],13[0-9]|5[6-9],14[0-3]) + drive=`expr $major - 56` + par=`expr \\( \\( $minor - 128 \\) / 4 \\) % 4` + sub=`expr \\( $minor - 128 \\) % 4` + des="vnode disk $drive partition $par slice $sub" + dev=vnd${drive}p${par}s${sub} + ;; + 64,0) + des="keyboard input multiplexer" + dev=kbdmux + ;; + 64,[1-4]) + n=`expr $minor - 1` + des="keyboard input $n" + dev=kbd$n + ;; + 64,64) + des="mouse input multiplexer" + dev=mousemux + ;; + 64,6[5-8]) + n=`expr $minor - 65` + des="mouse input $n" + dev=mouse$n + ;; BAD,BAD) des= dev= ;; diff --git a/commands/MAKEDEV/MAKEDEV.8 b/commands/MAKEDEV/MAKEDEV.8 new file mode 100644 index 000000000..51e0063d8 --- /dev/null +++ b/commands/MAKEDEV/MAKEDEV.8 @@ -0,0 +1,57 @@ +.Dd October 4, 2013 +.Dt MAKEDEV 8 +.Os +.Sh NAME +.Nm MAKEDEV, DESCRIBE +.Nd make/describe device files +.Sh SYNOPSIS +.Nm MAKEDEV +.Op Fl n | Fl m +.Op Fl r | Fl s +.Op key ... +.Nm DESCRIBE +.Op device ... +.Sh DESCRIPTION +.Nm MAKEDEV +may be used to create the device files normally found in the /dev directory. +.Nm MAKEDEV +knows about all supported devices and will create them in the current +directory with the proper owner and mode. For many devices +.Nm MAKEDEV +will not only create the device you want, but also the devices related +to it that you will probably want too. Naming one floppy device will +create all floppy devices for the same drive for instance. +.Pp +The options are as follows: +.Bl -tag -width Xxxexcludexfilexx +.It Fl n +echo the commands it would execute when you call it without that flag. +.It Fl m +echo +.Nm mtree(8) +formatted lines instead of creating the device nodes. +.It Fl r +Restricted set of devices. This set is used when generating the ramdisk. +.It Fl s +Standard set of devices. This set is used when popluating /dev. +.El +.Pp +.Ar key +arguments are simply the names of the devices you want to create. Call +.Nm MAKEDEV +without arguments to see a list of keys that it understands. +.Pp +The command +.Nm DESCRIBE +will give you a one-line description of a given device. By default It +will list all devices in /dev. +.Sh "SEE ALSO" +.Xr dev 4 , +.Xr mknod 8 +.Sh BUGS +The eagerness of +.Nm MAKEDEV +to create devices may cause many "File exists" errors from +.Nm mknod . +.Sh AUTHORS +Written by Kees J. Bot (kjb@cs.vu.nl) and Lionel A. Sambuc (lionel@minix3.org) diff --git a/commands/MAKEDEV/MAKEDEV.sh b/commands/MAKEDEV/MAKEDEV.sh old mode 100644 new mode 100755 index 9a4c1a9cd..30b8ae76a --- a/commands/MAKEDEV/MAKEDEV.sh +++ b/commands/MAKEDEV/MAKEDEV.sh @@ -1,43 +1,115 @@ #!/bin/sh # # MAKEDEV 3.3 - Make special devices. Author: Kees J. Bot +# 3.4 - Rewritten to allow mtree line to be printed, Lionel A. Sambuc +# also use getopt for argument parsing +umask 077 -case $1 in --n) e=echo; shift ;; # Just echo when -n is given. -*) e= -esac +MTREE=false +STD=false +RAMDISK=false +ECHO= +EXIT=0 -case $#:$1 in -1:std) # Standard devices. - set -$- mem fd0 fd1 fd0p0 fd1p0 \ - c0d0 c0d0p0 c0d0p0s0 c0d1 c0d1p0 c0d1p0s0 \ - c0d2 c0d2p0 c0d2p0s0 c0d3 c0d3p0 c0d3p0s0 \ - c0d4 c0d4p0 c0d4p0s0 c0d5 c0d5p0 c0d5p0s0 \ - c0d6 c0d6p0 c0d6p0s0 c0d7 c0d7p0 c0d7p0s0 \ - c1d0 c1d0p0 c1d0p0s0 c1d1 c1d1p0 c1d1p0s0 \ - c1d2 c1d2p0 c1d2p0s0 c1d3 c1d3p0 c1d3p0s0 \ - c1d4 c1d4p0 c1d4p0s0 c1d5 c1d5p0 c1d5p0s0 \ - c1d6 c1d6p0 c1d6p0s0 c1d7 c1d7p0 c1d7p0s0 \ - tty ttyc1 ttyc2 ttyc3 tty00 tty01 tty02 tty03 \ - ttyp0 ttyp1 ttyp2 ttyp3 ttyp4 ttyp5 ttyp6 ttyp7 ttyp8 ttyp9 \ - ttypa ttypb ttypc ttypd ttype ttypf \ - ttyq0 ttyq1 ttyq2 ttyq3 ttyq4 ttyq5 ttyq6 ttyq7 ttyq8 ttyq9 \ - ttyqa ttyqb ttyqc ttyqd ttyqe ttyqf \ - eth klog random uds filter fbd hello fb0 \ - i2c-1 i2c-2 i2c-3 \ - eepromb1s50 eepromb1s51 eepromb1s52 eepromb1s53 \ - eepromb1s54 eepromb1s55 eepromb1s56 eepromb1s57 \ - eepromb2s50 eepromb2s51 eepromb2s52 eepromb2s53 \ - eepromb2s54 eepromb2s55 eepromb2s56 eepromb2s57 \ - eepromb3s50 eepromb3s51 eepromb3s52 eepromb3s53 \ - eepromb3s54 eepromb3s55 eepromb3s56 eepromb3s57 \ - tsl2550b1s39 tsl2550b2s39 tsl2550b3s39 \ - sht21b1s40 sht21b2s40 sht21b3s40 \ +# console => lp tty log +# boot => kmem mem null ram zero +RAMDISK_DEVICES=" + boot + console + input + c0d0 c0d0p0 c0d0p0s0 c0d1 c0d1p0 c0d1p0s0 + c0d2 c0d2p0 c0d2p0s0 c0d3 c0d3p0 c0d3p0s0 + c0d4 c0d4p0 c0d4p0s0 c0d5 c0d5p0 c0d5p0s0 + c0d6 c0d6p0 c0d6p0s0 c0d7 c0d7p0 c0d7p0s0 + c1d0 c1d0p0 c1d0p0s0 c1d1 c1d1p0 c1d1p0s0 + c1d2 c1d2p0 c1d2p0s0 c1d3 c1d3p0 c1d3p0s0 + c1d4 c1d4p0 c1d4p0s0 c1d5 c1d5p0 c1d5p0s0 + c1d6 c1d6p0 c1d6p0s0 c1d7 c1d7p0 c1d7p0s0 + fd0 fd1 fd0p0 fd1p0 + ttyc1 ttyc2 ttyc3 tty00 tty01 tty02 tty03 + ttyp0 ttyp1 ttyp2 ttyp3 ttyp4 ttyp5 ttyp6 ttyp7 ttyp8 ttyp9 + ttypa ttypb ttypc ttypd ttype ttypf + ttyq0 ttyq1 ttyq2 ttyq3 ttyq4 ttyq5 ttyq6 ttyq7 ttyq8 ttyq9 + ttyqa ttyqb ttyqc ttyqd ttyqe ttyqf +" + +#eth => ip tcp udp +STD_DEVICES=" + ${RAMDISK_DEVICES} bmp085b1s77 bmp085b2s77 bmp085b3s77 - ;; -0:|1:-\?) - cat >&2 <&2 <&2 - ex=1 - esac done -exit $ex +if [ ${STD} = "yes" ] +then + DEVICES=${STD_DEVICES} +elif [ ${RAMDISK} = "yes" ] +then + DEVICES=${RAMDISK_DEVICES} +else + while [ $OPTIND -gt 1 ] + do + shift + OPTIND=$((${OPTIND} - 1)) + done + while [ ! -z "$1" ] + do + DEVICES="${DEVICES} $1" + shift + done +fi + +for dev in ${DEVICES} +do + # Reset the defaults + uname=root + gname=operator + permissions=600 + + case ${dev} in + c0*) major=3 ;; + c1*) major=8 ;; + c2*) major=10 ;; + c3*) major=12 ;; + vnd*) # Whole vnode disk devices. + disk=`expr ${dev} : '...\\(.\\)'` + major=`expr ${disk} + 56` + ;; + esac + + # The following is lexicographicaly ordered + case ${dev} in + audio|mixer) + # Audio devices. + makedev audio c 13 0 ${uname} ${gname} 666 + makedev mixer c 13 1 ${uname} ${gname} 666 + ;; + bmp085b[1-3]s77) + # Weather Cape: temperature & pressure sensor + bus=`expr ${dev} : 'bmp085b\\(.*\\)s77'` #bus number + major=`expr ${bus} + 52` + + makedev bmp085b${bus}s77 c ${major} 0 ${uname} ${gname} 444 + ;; + c[0-3]d[0-7]) + # Whole disk devices. + disk=`expr ${dev} : '...\\(.\\)'` + minor=`expr ${disk} '*' 5` + + makedev ${dev} b ${major} ${minor} ${uname} ${gname} ${permissions} + ;; + c[0-3]d[0-7]p[0-3]) + # Disk primary partitions. + prefix=`expr ${dev} : '\\(.*\\).'` + disk=`expr ${dev} : '...\\(.\\)'` + + for p in 0 1 2 3 + do + minor=`expr ${disk} '*' 5 + 1 + ${p}` + makedev ${prefix}${p} b ${major} ${minor} \ + ${uname} ${gname} ${permissions} + done + ;; + c[0-3]d[0-7]p[0-3]s[0-3]) + # Disk subpartition. + prefix=`expr ${dev} : '\\(.*\\)...'` + disk=`expr ${dev} : '...\\(.\\)'` + + for p in 0 1 2 3 + do + for s in 0 1 2 3 + do + minor=`expr 128 + ${disk} '*' 16 + ${p} '*' 4 + ${s}` + makedev ${prefix}${p}s${s} b ${major} ${minor} \ + ${uname} ${gname} ${permissions} + done + done + ;; + c[0-3]t[0-7]|c[0-3]t[0-7]n) + # Tape devices. + prefix=`expr ${dev} : '\\(....\\)'` + tape=`expr ${dev} : '...\\(.\\)'` + minor=`expr 64 + ${tape} '*' 2` + + makedev ${prefix}n c ${major} ${minor} ${uname} ${gname} 660 + makedev ${prefix} c ${major} `expr ${minor} + 1` ${uname} ${gname} 660 + ;; + console|lp|tty|log|video) + # Console, line printer, anonymous tty, diagnostics device, video. + makedev console c 4 0 ${uname} tty ${permissions} + makedev tty c 5 0 ${uname} ${gname} 666 + makedev lp c 6 0 daemon daemon 200 + makedev log c 4 15 ${uname} ${gname} 222 + makedev video c 4 125 ${uname} ${gname} ${permissions} + ;; + eepromb[1-3]s5[0-7]) + # cat24c256 driver + bus=`expr ${dev} : 'eepromb\\(.*\\)s'` + # configurable part of slave addr + slave_low=`expr ${dev} : 'eepromb.s5\\(.*\\)'` + major=`expr ${bus} '*' 8 + ${slave_low} + 17` + + makedev eepromb${bus}s5${slave_low} b ${major} 0 ${uname} ${gname} ${permissions} + ;; + eth|ip|tcp|udp|eth0|ip0|tcp0|udp0) + # TCP/IP devices. + makedev ipstat c 7 0 ${uname} ${gname} 666 + makedev eth0 c 7 1 ${uname} ${gname} ${permissions} + makedev ip0 c 7 2 ${uname} ${gname} ${permissions} + makedev tcp0 c 7 3 ${uname} ${gname} 666 + makedev udp0 c 7 4 ${uname} ${gname} 666 + + # Default interface + makedev eth c 7 1 ${uname} ${gname} ${permissions} + makedev ip c 7 2 ${uname} ${gname} ${permissions} + makedev tcp c 7 3 ${uname} ${gname} 666 + makedev udp c 7 4 ${uname} ${gname} 666 + ;; + fb0) + # Framebuffer driver + makedev ${dev} c 19 0 ${uname} ${gname} 644 + ;; + fbd) + # Faulty block device driver + makedev ${dev} b 14 0 ${uname} ${gname} ${permissions} + ;; + fd[0-3]) + # Floppy disk drive N has minor N. + minor=`expr ${dev} : '..\\(.\\)'` + + makedev ${dev} b 2 ${minor} ${uname} ${gname} 666 + ;; + fd[0-3]p[0-3]) + # Floppy disk partitions. + prefix=`expr ${dev} : '\\(.*\\).'` + drive=`expr ${dev} : '..\\(.\\)'` + + for p in 0 1 2 3 + do + minor=`expr 112 + ${drive} + ${p} '*' 4` + makedev ${prefix}${p} b 2 ${minor} \ + ${uname} ${gname} 666 + done + ;; + filter) + # Filter driver + makedev ${dev} b 11 0 ${uname} ${gname} ${permissions} + ;; + hello) + # Hello driver + makedev ${dev} c 17 0 ${uname} ${gname} 644 + ;; + i2c-[1-3]) + # i2c driver + bus=`expr ${dev} : '....\\(.*\\)'` # bus number + # least significant digit of major + major_low=`expr ${dev} : '....\\(.*\\)'` + major_low=`expr ${major_low} - 1` + + makedev "i2c-${bus}" c 2${major_low} 0 ${uname} ${gname} ${permissions} + ;; + input) + # Input server + makedev kbdmux c 64 0 ${uname} ${gname} ${permissions} + makedev mousemux c 64 64 ${uname} ${gname} ${permissions} + + for n in 0 1 2 3 + do + minor_keyboard=`expr ${n} + 1` + minor_mouse=`expr ${n} + 65` + + makedev kbd${n} c 64 ${minor_keyboard} ${uname} ${gname} ${permissions} + makedev mouse${n} c 64 ${minor_mouse} ${uname} ${gname} ${permissions} + done + ;; + klog) + # Logging device. + makedev ${dev} c 15 0 ${uname} ${gname} ${permissions} + ;; + pc[0-3]|at[0-3]|qd[0-3]|ps[0-3]|pat[0-3]|qh[0-3]|PS[0-3]) + # Obsolete density locked floppy disk drive n. + drive=`expr ${dev} : '.*\\(.\\)'` + minor=${drive} + + for prefix in pc at qd ps pat qh PS + do + makedev ${prefix}${drive} b 2 ${minor} \ + ${uname} ${gname} 666 + minor=`expr ${minor} + 4` + done + ;; + ram|mem|kmem|null|boot|zero|imgrd) + # Memory devices. + makedev ram b 1 0 ${uname} kmem ${permissions} + makedev mem c 1 1 ${uname} kmem 640 + makedev kmem c 1 2 ${uname} kmem 640 + makedev null c 1 3 ${uname} kmem 666 + makedev boot b 1 4 ${uname} kmem ${permissions} + makedev zero c 1 5 ${uname} kmem 644 + makedev imgrd b 1 6 ${uname} kmem ${permissions} + + for n in 0 1 2 3 4 5 + do + minor=`expr ${n} + 7` + + makedev ram${n} b 1 ${minor} ${uname} kmem ${permissions} + done + ;; + random|urandom) + # Random data generator. + makedev random c 16 0 ${uname} ${gname} 644 + makedev urandom c 16 0 ${uname} ${gname} 644 + ;; + sht21b[1-3]s40) + # Weather Cape: relative humidity & temperature sensor + bus=`expr ${dev} : 'sht21b\\(.*\\)s40'` + major=`expr ${bus} + 49` + + makedev sht21b${bus}s40 c ${major} 0 ${uname} ${gname} 444 + ;; + tsl2550b[1-3]s39) + # Weather Cape: ambient light sensor + bus=`expr ${dev} : 'tsl2550b\\(.*\\)s39'` + major=`expr ${bus} + 46` + + makedev tsl2550b${bus}s39 c ${major} 0 ${uname} ${gname} 444 + ;; + tty0[0-3]) + # Serial lines. + line=`expr ${dev} : '.*\\(.\\)'` + minor=`expr ${line} + 16` + + makedev ${dev} c 4 ${minor} ${uname} tty 666 + ;; + tty[p-s][0-9a-f]|pty[p-s][0-9a-f]) + # Pseudo ttys. + dev=`expr ${dev} : '...\\(..\\)'` + group=`expr ${dev} : '\\(.\\)'` + group=`echo ${group} | tr 'pqrs' '0123'` + pty=`expr ${dev} : '.\\(.\\)'` + case ${pty} in + [a-f]) pty=1`/bin/echo ${pty} | tr 'abcdef' '012345'` + esac + minor_tty=`expr ${group} '*' 16 + ${pty} + 128` + minor_pty=`expr ${group} '*' 16 + ${pty} + 192` + + makedev tty${dev} c 4 ${minor_tty} ${uname} tty 666 + makedev pty${dev} c 4 ${minor_pty} ${uname} tty 666 + ;; + ttyc[1-7]) + # Virtual consoles. + minor=`expr ${dev} : '....\\(.*\\)'` + + makedev ${dev} c 4 ${minor} ${uname} tty ${permissions} + ;; + uds) + # Unix domain sockets device + makedev ${dev} c 18 0 ${uname} ${gname} 666 + ;; + vnd[0-7]) + # Whole vnode disk devices. + makedev ${dev} b ${major} 0 ${uname} ${gname} ${permissions} + ;; + vnd[0-7]p[0-3]) + # Vnode disk primary partitions. + prefix=`expr ${dev} : '\\(.*\\).'` + disk=`expr ${dev} : '...\\(.\\)'` + + for p in 0 1 2 3 + do + minor=`expr 1 + ${p}` + + makedev ${prefix}${p} b ${major} ${minor} \ + ${uname} ${gname} ${permissions} + done + ;; + vnd[0-7]p[0-3]s[0-3]) + # Vnode disk subpartition. + prefix=`expr ${dev} : '\\(.*\\)...'` + disk=`expr ${dev} : '...\\(.\\)'` + + for p in 0 1 2 3 + do + for s in 0 1 2 3 + do + minor=`expr 128 + ${p} '*' 4 + ${s}` + + makedev ${prefix}${p}s${s} b ${major} ${minor} \ + ${uname} ${gname} ${permissions} + done + done + ;; + *) + echo "$0: don't know about ${dev}" >&2 + EXIT=1 + esac +done + +exit $EXIT diff --git a/commands/MAKEDEV/Makefile b/commands/MAKEDEV/Makefile index 93040ea76..9a9ac5d1d 100644 --- a/commands/MAKEDEV/Makefile +++ b/commands/MAKEDEV/Makefile @@ -1,4 +1,4 @@ SCRIPTS= MAKEDEV.sh -MAN= +MAN= MAKEDEV.8 .include diff --git a/commands/Makefile b/commands/Makefile index 4754ecbf4..2d682bbfe 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -6,11 +6,11 @@ SUBDIR= add_route arp ash at backup btrace \ cawf cd cdprobe cpp \ chmod chown ci cleantmp cmp co \ compress cp crc cron crontab \ - dd decomp16 DESCRIBE devmand devsize df dhcpd \ - dhrystone diff diskctl dumpcore \ + dd decomp16 DESCRIBE devmand devsize dhcpd \ + dhrystone diff diskctl \ eject factor fbdctl \ find fix format fortune fsck.mfs \ - gcore gcov-pull getty grep host \ + gcov-pull getty grep host \ hostaddr id ifconfig ifdef \ intr ipcrm ipcs irdpd isoread last \ less loadkeys loadramdisk logger look lp \ @@ -27,7 +27,7 @@ SUBDIR= add_route arp ash at backup btrace \ stty svclog svrctl swifi synctree sysenv \ syslogd tail tcpd tcpdp tcpstat telnet \ telnetd term termcap tget time touch \ - truncate udpstat umount uname \ + truncate udpstat umount \ unstack update uud uue version vol \ whereis which writeisofs fetch \ zdump zmodem pkgin_cd pkgin_all \ diff --git a/commands/df/Makefile b/commands/df/Makefile deleted file mode 100644 index a77a7bffa..000000000 --- a/commands/df/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PROG= df -MAN= - -.include diff --git a/commands/df/df.c b/commands/df/df.c deleted file mode 100644 index be07620b8..000000000 --- a/commands/df/df.c +++ /dev/null @@ -1,237 +0,0 @@ -/* df - disk free block printout Author: Andy Tanenbaum - * - * 91/04/30 Kees J. Bot (kjb@cs.vu.nl) - * Map filename arguments to the devices they live on. - * Changed output to show percentages. - * - * 92/12/12 Kees J. Bot - * Posixized. (Almost, the normal output is in kilobytes, it should - * be 512-byte units. 'df -P' and 'df -kP' are as it should be.) - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct mtab { /* List of mounted devices from /etc/mtab. */ - struct mtab *next; - dev_t device; - char *devname; - char *mountpoint; -} *mtab= NULL; - -struct mtab *searchtab(char *name); -static void readmtab(const char *type); -int df(const struct mtab *mt); - -int iflag= 0; /* Focus on inodes instead of blocks. */ -int Pflag= 0; /* Posix standard output. */ -int kflag= 0; /* Output in kilobytes instead of 512 byte units for -P. */ -int istty; /* isatty(1) */ - -void usage(void) -{ - fprintf(stderr, "Usage: df [-ikP] [-t type] [device]...\n"); - exit(1); -} - -int unitsize; - -int main(int argc, char *argv[]) -{ - int i; - struct mtab *mt; - char *type= "dev"; - int ex= 0; - - while (argc > 1 && argv[1][0] == '-') { - char *opt= argv[1]+1; - - while (*opt != 0) { - switch (*opt++) { - case 'i': iflag= 1; break; - case 'k': kflag= 1; break; - case 'P': Pflag= 1; break; - case 't': - if (argc < 3) usage(); - type= argv[2]; - argv++; - argc--; - break; - default: - usage(); - } - } - argc--; - argv++; - } - - istty= isatty(1); - - readmtab(type); - - if(!Pflag || (Pflag && kflag)) unitsize = 1024; - else unitsize = 512; - - if (Pflag) { - if (!iflag) - printf("\ -Filesystem %4d-blocks Used Available Capacity Mounted on\n", - unitsize); - else - printf("\ -Filesystem Inodes IUsed IFree %%IUsed Mounted on\n" - ); - } else { - printf("%s\n", !iflag ? "\ -Filesystem Size (kB) Free Used % Files% Mounted on" : "\ -Filesystem Files Free Used % BUsed% Mounted on" - ); - } - - if (argc == 1) { - for (mt= mtab; mt != NULL; mt= mt->next) ex |= df(mt); - } else { - for (i = 1; i < argc; i++) ex |= df(searchtab(argv[i])); - } - exit(ex); -} - -static void readmtab(const char *type) -/* Turn the mounted file table into a list. */ -{ - struct mtab **amt= &mtab, *new; - struct stat st; - char devname[PATH_MAX], mountpoint[PATH_MAX], version[MNTNAMELEN], - rw_flag[MNTFLAGLEN]; - - if (load_mtab("df") < 0) exit(1); - - while (get_mtab_entry(devname, mountpoint, version, rw_flag), - devname[0] != 0) { - if (strcmp(type, "dev") != 0 && strcmp(type, version) != 0) continue; - - /* Make new list cell. */ - if ((new= (struct mtab *) malloc(sizeof(*new))) == NULL - || (new->devname= (char *) malloc(strlen(devname) + 1)) == NULL - || (new->mountpoint= (char *) malloc(strlen(mountpoint) + 1)) == NULL - ) break; - - if (strcmp(devname, "none") != 0 && stat(devname, &st) == 0 && - S_ISBLK(st.st_mode)) { - new->device= st.st_rdev; - } else if (stat(mountpoint, &st) == 0) { - new->device= st.st_dev; - } - strcpy(new->devname, devname); - strcpy(new->mountpoint, mountpoint); - - *amt= new; /* Add the cell to the end. */ - amt= &new->next; - *amt= NULL; - } -} - -struct mtab *searchtab(char *name) -/* See what we can do with a user supplied name, there are three possibilities: - * 1. It's a device and it is in the mtab: Return mtab entry. - * 2. It's a file and lives on a device in the mtab: Return mtab entry. - * 3. It's anything else: Return something df() will choke on. - */ -{ - static struct mtab unknown; - struct mtab *mt; - struct stat st; - - unknown.devname= name; - unknown.mountpoint= ""; - - if (stat(name, &st) < 0) return &unknown; /* Case 3. */ - - unknown.device= S_ISBLK(st.st_mode) ? st.st_rdev : st.st_dev; - - for (mt= mtab; mt != NULL; mt= mt->next) { - if (unknown.device == mt->device) - return mt; /* Case 1 & 2. */ - } - - return &unknown; /* Case 3. */ -} - -/* (num / tot) in percentages rounded up. */ -#define percent(num, tot) \ - ((tot > 0) ? ((int) ((100ULL * (num) + ((tot) - 1)) / (tot))) : 0) - -int df(const struct mtab *mt) -{ - long totblocks, busyblocks, totinodes, busyinodes; - struct statvfs sv; - int n; - - if (statvfs(mt->mountpoint, &sv) < 0) { - fprintf(stderr, "df: %s: %s\n", mt->devname, strerror(errno)); - return(1); - } - - /* Print results. */ - printf("%s", mt->devname); - n= strlen(mt->devname); - if (n > 15 && istty) { putchar('\n'); n= 0; } - while (n < 15) { putchar(' '); n++; } - - totblocks = sv.f_blocks; - busyblocks = sv.f_blocks - sv.f_bfree; - - busyblocks = busyblocks * (sv.f_bsize/512) / (unitsize/512); - totblocks = totblocks * (sv.f_bsize/512) / (unitsize/512); - - totinodes = sv.f_files; - busyinodes = sv.f_files - sv.f_ffree; - - if (!Pflag && !iflag) { - printf(" %9ld %9ld %9ld %3d%% %3d%% %s\n", - totblocks, /* Blocks */ - totblocks - busyblocks, /* free */ - busyblocks, /* used */ - percent(busyblocks, totblocks), /* % */ - percent(busyinodes, totinodes), /* FUsed% */ - mt->mountpoint /* Mounted on */ - ); - } - if (!Pflag && iflag) { - printf(" %9ld %9ld %9ld %3d%% %3d%% %s\n", - totinodes, /* Files */ - totinodes - busyinodes, /* free */ - busyinodes, /* used */ - percent(busyinodes, totinodes), /* % */ - percent(busyblocks, totblocks), /* BUsed% */ - mt->mountpoint /* Mounted on */ - ); - } - if (Pflag && !iflag) { - printf(" %9ld %9ld %9ld %4d%% %s\n", - totblocks, /* Blocks */ - busyblocks, /* Used */ - totblocks - busyblocks, /* Available */ - percent(busyblocks, totblocks), /* Capacity */ - mt->mountpoint /* Mounted on */ - ); - } - if (Pflag && iflag) { - printf(" %9ld %9ld %9ld %4d%% %s\n", - totinodes, /* Inodes */ - busyinodes, /* IUsed */ - totinodes - busyinodes, /* IAvail */ - percent(busyinodes, totinodes), /* Capacity */ - mt->mountpoint /* Mounted on */ - ); - } - return(0); -} diff --git a/commands/dumpcore/Makefile b/commands/dumpcore/Makefile deleted file mode 100644 index 3b469fb13..000000000 --- a/commands/dumpcore/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= dumpcore -CPPFLAGS+= -I${NETBSDSRCDIR} -MAN= - -.include diff --git a/commands/dumpcore/dumpcore.c b/commands/dumpcore/dumpcore.c deleted file mode 100644 index ca6b70bc6..000000000 --- a/commands/dumpcore/dumpcore.c +++ /dev/null @@ -1,71 +0,0 @@ -/* dumpcore - create core file of running process */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "kernel/proc.h" - -#define CLICK_WORDS (CLICK_SIZE / sizeof(unsigned long)) - -int main(int argc, char *argv[]) -{ - pid_t pid; - int r, status; - - if(argc != 2) { - printf("usage: %s \n", argv[0]); - return 1; - } - - pid = atoi(argv[1]); - - if (ptrace(T_ATTACH, pid, 0, 0) != 0) { - perror("ptrace(T_ATTACH)"); - return 1; - } - - if (waitpid(pid, &status, 0) != pid) { - perror("waitpid"); - return 1; - } - - while (WIFSTOPPED(status) && WSTOPSIG(status) != SIGSTOP) { - /* whatever happens here is fine */ - ptrace(T_RESUME, pid, 0, WSTOPSIG(status)); - - if (waitpid(pid, &status, 0) != pid) { - perror("waitpid"); - return 1; - } - } - - if (!WIFSTOPPED(status)) { - fprintf(stderr, "process died while attaching\n"); - return 1; - } - - if (ptrace(T_DUMPCORE, pid, 0, 0) != 0) { - fprintf(stderr, "warning, dumpcore failed (%s)\n", - strerror(errno)); - } - - if (ptrace(T_DETACH, pid, 0, 0)) { - fprintf(stderr, "warning, detaching failed (%s)\n", - strerror(errno)); - } - - return r; -} diff --git a/commands/fdisk/fdisk.c b/commands/fdisk/fdisk.c index 4c237f27a..5b41d8308 100644 --- a/commands/fdisk/fdisk.c +++ b/commands/fdisk/fdisk.c @@ -75,7 +75,7 @@ char *secbuf; int badbases; int badsizes; int badorders; -char *devname; +char *dev_name; int nhead; int nsec; int ncyl = 1024; @@ -161,9 +161,9 @@ int main(int argc, char *argv[]) } if (argn == argc) - devname = DEFAULT_DEV; + dev_name = DEFAULT_DEV; else if (argn == argc - 1) - devname = argv[argn]; + dev_name = argv[argn]; else usage(); @@ -232,7 +232,7 @@ void getgeom(void) if (override) return; - if ((fd= open(devname, O_RDONLY)) < 0) return; + if ((fd= open(dev_name, O_RDONLY)) < 0) return; r = ioctl(fd, DIOCGETP, &geom); close(fd); @@ -242,21 +242,21 @@ void getgeom(void) nsec = geom.sectors; ncyl = geom.cylinders; - printf("Geometry of %s: %dx%dx%d\n", devname, ncyl, nhead, nsec); + printf("Geometry of %s: %dx%dx%d\n", dev_name, ncyl, nhead, nsec); } static int devfd; void getboot(char *buffer) { - devfd = open(devname, 2); + devfd = open(dev_name, 2); if (devfd < 0) { - printf("No write permission on %s\n", devname); + printf("No write permission on %s\n", dev_name); readonly = 1; - devfd = open(devname, 0); + devfd = open(dev_name, 0); } if (devfd < 0) { - printf("Cannot open device %s\n", devname); + printf("Cannot open device %s\n", dev_name); exit(1); } if (read(devfd, buffer, SECSIZE) != SECSIZE) { @@ -264,7 +264,7 @@ void getboot(char *buffer) exit(1); } if (* (unsigned short *) &buffer[510] != 0xAA55) { - printf("Invalid boot sector on %s.\n", devname); + printf("Invalid boot sector on %s.\n", dev_name); printf("Partition table reset and boot code installed.\n"); memset(buffer, 0, 512); memcpy(buffer, bootstrap, sizeof(bootstrap)); @@ -514,8 +514,8 @@ int chk_table(void) printf( "Disk appears to have mis-specified number of heads or sectors.\n"); printf("Try fdisk -h%d -s%d %s instead of\n", - maxhead + 1, maxsec, devname); - printf(" fdisk -h%d -s%d %s\n", nhead, nsec, devname); + maxhead + 1, maxsec, dev_name); + printf(" fdisk -h%d -s%d %s\n", nhead, nsec, dev_name); seenpart = 0; } } else { @@ -695,12 +695,12 @@ void getboot(char *buffer) segread(&sregs); /* get ds */ - if (devname[1] != ':') { - printf("Invalid drive %s\n", devname); + if (dev_name[1] != ':') { + printf("Invalid drive %s\n", dev_name); exit(1); } - if (*devname >= 'a') *devname += 'A' - 'a'; - drivenum = (*devname - 'C') & 0xff; + if (*dev_name >= 'a') *dev_name += 'A' - 'a'; + drivenum = (*dev_name - 'C') & 0xff; if (drivenum < 0 || drivenum > 7) { printf("Funny drive number %d\n", drivenum); exit(1); diff --git a/commands/fsck.mfs/fsck.c b/commands/fsck.mfs/fsck.c index b9cdda513..f1f4aedf0 100644 --- a/commands/fsck.mfs/fsck.c +++ b/commands/fsck.mfs/fsck.c @@ -686,7 +686,7 @@ char **clist; if (input(buf, 80)) ip->i_mode = atoo(buf); printf(" nlinks = %6u", ip->i_nlinks); if (input(buf, 80)) ip->i_nlinks = atol(buf); - printf(" size = %6ld", ip->i_size); + printf(" size = %6d", ip->i_size); if (input(buf, 80)) ip->i_size = atol(buf); if (yes("Write this back")) { devwrite(inoblock(ino), inooff(ino), (char *) ip, diff --git a/commands/gcore/Makefile b/commands/gcore/Makefile deleted file mode 100644 index 4ad31cc0e..000000000 --- a/commands/gcore/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PROG= gcore -MAN= - -.include diff --git a/commands/gcore/gcore.c b/commands/gcore/gcore.c deleted file mode 100644 index d07d9c0b2..000000000 --- a/commands/gcore/gcore.c +++ /dev/null @@ -1,58 +0,0 @@ -/* gcore - create core file of running process */ - -#include -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - pid_t pid; - int status; - - if(argc != 2) { - printf("usage: %s \n", argv[0]); - return 1; - } - - pid = atoi(argv[1]); - - if (ptrace(T_ATTACH, pid, 0, 0) != 0) { - perror("ptrace(T_ATTACH)"); - return 1; - } - - if (waitpid(pid, &status, 0) != pid) { - perror("waitpid"); - return 1; - } - - while (WIFSTOPPED(status) && WSTOPSIG(status) != SIGSTOP) { - /* whatever happens here is fine */ - ptrace(T_RESUME, pid, 0, WSTOPSIG(status)); - - if (waitpid(pid, &status, 0) != pid) { - perror("waitpid"); - return 1; - } - } - - if (!WIFSTOPPED(status)) { - fprintf(stderr, "process died while attaching\n"); - return 1; - } - - if (ptrace(T_DUMPCORE, pid, 0, 0)) { - fprintf(stderr, "warning, dumpcore failed (%s)\n", strerror(errno)); - } - - if (ptrace(T_DETACH, pid, 0, 0)) { - fprintf(stderr, "warning, detaching failed (%s)\n", strerror(errno)); - } - - return 0; -} diff --git a/commands/getty/getty.c b/commands/getty/getty.c index 14356c6b3..9e35fb2b6 100644 --- a/commands/getty/getty.c +++ b/commands/getty/getty.c @@ -88,7 +88,7 @@ void do_getty(char *name, size_t len, char **args, const char *ttyname) int ch; struct utsname utsname; char **banner, *t; - static char *def_banner[] = { "%s Release %r Version %v (%t)\n\n%n login: ", 0 }; + static char *def_banner[] = { "%s/%p (%t)\n\n%n login: ", 0 }; /* Clean up tty name. */ if((t = strrchr(ttyname, '/'))) ttyname = t + 1; diff --git a/commands/loadkeys/loadkeys.c b/commands/loadkeys/loadkeys.c index f1f0646b1..38468ba06 100644 --- a/commands/loadkeys/loadkeys.c +++ b/commands/loadkeys/loadkeys.c @@ -6,86 +6,51 @@ #include #include #include +#include #include #include -#if __minix_vmd -#define KBD_DEVICE "/dev/kbd" -#else #define KBD_DEVICE "/dev/console" -#endif - -u16_t keymap[NR_SCAN_CODES * MAP_COLS]; -u8_t comprmap[4 + NR_SCAN_CODES * MAP_COLS * 9/8 * 2 + 1]; - - -void tell(char *s) -{ - write(2, s, strlen(s)); -} - void fatal(char *say) { - int err = errno; - tell("loadkeys: "); - if (say != NULL) { - tell(say); - tell(": "); - } - tell(strerror(err)); - tell("\n"); - exit(1); + fprintf(stderr, "loadkeys: %s: %s\n", say, strerror(errno)); + exit(EXIT_FAILURE); } void usage(void) { - tell("Usage: loadkeys mapfile\n"); - exit(1); + fprintf(stderr, "usage: loadkeys \n"); + exit(EXIT_FAILURE); } int main(int argc, char *argv[]) { - u8_t *cm; - u16_t *km; - int fd, n, fb; + char sig[4]; + keymap_t keymap; + int fd; if (argc != 2) usage(); if ((fd = open(argv[1], O_RDONLY)) < 0) fatal(argv[1]); - if (read(fd, comprmap, sizeof(comprmap)) < 0) fatal(argv[1]); + if (read(fd, sig, sizeof(sig)) < sizeof(sig)) fatal(argv[1]); - if (memcmp(comprmap, KEY_MAGIC, 4) != 0) { - tell("loadkeys: "); - tell(argv[1]); - tell(": not a keymap file\n"); - exit(1); + if (memcmp(sig, KEY_MAGIC, sizeof(sig)) != 0) { + fprintf(stderr, "loadkeys: %s: not a keymap file\n", argv[1]); + return EXIT_FAILURE; } + + if (read(fd, keymap, sizeof(keymap)) < sizeof(keymap)) fatal(argv[1]); + close(fd); - /* Decompress the keymap data. */ - cm = comprmap + 4; - n = 8; - for (km = keymap; km < keymap + NR_SCAN_CODES * MAP_COLS; km++) { - if (n == 8) { - /* Need a new flag byte. */ - fb = *cm++; - n = 0; - } - *km = *cm++; /* Low byte. */ - if (fb & (1 << n)) { - *km |= (*cm++ << 8); /* One of the few special keys. */ - } - n++; - } - if ((fd = open(KBD_DEVICE, O_WRONLY)) < 0) fatal(KBD_DEVICE); if (ioctl(fd, KIOCSMAP, keymap) < 0) fatal(KBD_DEVICE); - return 0; + return EXIT_SUCCESS; } diff --git a/commands/mount/mount.c b/commands/mount/mount.c index f4e463cad..fa34bcccd 100644 --- a/commands/mount/mount.c +++ b/commands/mount/mount.c @@ -24,11 +24,12 @@ int main(argc, argv) int argc; char *argv[]; { - int all = 0, i, v = 0, mountflags; + int all = 0, i, v = 0, mountflags, srvflags; char **ap, *opt, *err, *type, *args, *device; if (argc == 1) list(); /* just list /etc/mtab */ mountflags = 0; + srvflags = 0; type = NULL; args = NULL; ap = argv+1; @@ -36,12 +37,12 @@ char *argv[]; if (argv[i][0] == '-') { opt = argv[i]+1; while (*opt != 0) switch (*opt++) { - case 'r': mountflags |= MS_RDONLY; break; + case 'r': mountflags |= MNT_RDONLY; break; case 't': if (++i == argc) usage(); type = argv[i]; break; - case 'i': mountflags |= MS_REUSE; break; - case 'e': mountflags |= MS_EXISTING; break; + case 'i': srvflags |= MS_REUSE; break; + case 'e': srvflags |= MS_EXISTING; break; case 'n': write_mtab = 0; break; case 'o': if (++i == argc) usage(); args = argv[i]; @@ -75,7 +76,7 @@ char *argv[]; } } - if (mount(device, argv[2], mountflags, type, args) < 0) { + if (mount(device, argv[2], mountflags, srvflags, type, args) < 0) { err = strerror(errno); fprintf(stderr, "mount: Can't mount %s on %s: %s\n", argv[1], argv[2], err); @@ -141,7 +142,7 @@ mount_all() if (has_opt(fs->fs_mntops, "ro")) ro = 1; if (ro) { - mountflags |= MS_RDONLY; + mountflags |= MNT_RDONLY; } device = fs->fs_spec; @@ -152,7 +153,7 @@ mount_all() if (!strcmp(device, "none")) device = NULL; - if (mount(device, mountpoint, mountflags, fs->fs_vfstype, + if (mount(device, mountpoint, mountflags, 0, fs->fs_vfstype, fs->fs_mntops) != 0) { err = strerror(errno); fprintf(stderr, "mount: Can't mount %s on %s: %s\n", diff --git a/commands/playwave/playwave.c b/commands/playwave/playwave.c index 53b92d8dc..28bdbf588 100644 --- a/commands/playwave/playwave.c +++ b/commands/playwave/playwave.c @@ -66,15 +66,36 @@ void usage() exit(-1); } +int open_audio(unsigned int *fragment_size, unsigned int channels, + unsigned int samples_per_sec, unsigned int bits) +{ + unsigned int sign; + int audio; + + /* Open DSP */ + if ((audio = open("/dev/audio", O_RDWR | O_REOPEN)) < 0) + { + printf("Cannot open /dev/audio: %s\n", strerror(errno)); + exit(-1); + } + + ioctl(audio, DSPIOMAX, fragment_size); /* Get maximum fragment size. */ + + /* Set DSP parameters (should check return values..) */ + ioctl(audio, DSPIOSIZE, fragment_size); /* Use max. fragment size. */ + ioctl(audio, DSPIOSTEREO, &channels); + ioctl(audio, DSPIORATE, &samples_per_sec); + ioctl(audio, DSPIOBITS, &bits); + sign = (bits == 16 ? 1 : 0); + ioctl(audio, DSPIOSIGN, &sign); + return audio; +} int main ( int argc, char *argv[] ) { int i, r, audio, file; char *buffer, *file_name = NULL; - unsigned int sign; - unsigned int fragment_size; - unsigned int channels; - unsigned int bits; + unsigned int fragment_size, fragment_size2; long data_pos; int showinfo = 0; @@ -91,22 +112,6 @@ int main ( int argc, char *argv[] ) } else file_name = argv[1]; - /* Open DSP */ - if ((audio = open("/dev/audio", O_RDWR | O_REOPEN)) < 0) - { - printf("Cannot open /dev/audio: %s\n", strerror(errno)); - exit(-1); - } - - /* Get maximum fragment size and try to allocate a buffer */ - ioctl(audio, DSPIOMAX, &fragment_size); - if ((buffer = malloc(fragment_size)) == (char *)0) - { - fprintf(stderr, "Cannot allocate buffer\n"); - exit(-1); - } - ioctl(audio, DSPIOSIZE, &fragment_size); - /* Open wav file */ if((file = open(file_name, O_RDONLY)) < 0) { @@ -141,15 +146,15 @@ int main ( int argc, char *argv[] ) exit(1); } - /* Set DSP parameters */ - channels = c_fields.Channels; - channels--; - bits = s_fields.BitsPerSample; - ioctl(audio, DSPIOSTEREO, &channels); - ioctl(audio, DSPIORATE, &c_fields.SamplesPerSec); - ioctl(audio, DSPIOBITS, &bits); - sign = (bits == 16 ? 1 : 0); - ioctl(audio, DSPIOSIGN, &sign); + /* Open audio device and set DSP parameters */ + audio = open_audio(&fragment_size, c_fields.Channels - 1, + c_fields.SamplesPerSec, s_fields.BitsPerSample); + + if ((buffer = malloc(fragment_size)) == (char *)0) + { + fprintf(stderr, "Cannot allocate buffer\n"); + exit(-1); + } /* Goto data chunk */ lseek(file, data_pos, SEEK_SET); @@ -203,6 +208,20 @@ int main ( int argc, char *argv[] ) { fprintf(stderr, "playwave: write to audio device failed: %s\n", strerror(errno)); + + /* If we get EIO, the driver might have restarted. Reopen the + * audio device. + */ + if (errno == EIO) { + close(audio); + audio = open_audio(&fragment_size2, + c_fields.Channels - 1, c_fields.SamplesPerSec, + s_fields.BitsPerSample); + if (fragment_size2 != fragment_size) { + fprintf(stderr, "Fragment size has changed\n"); + exit(1); + } + } } else { diff --git a/commands/ps/ps.c b/commands/ps/ps.c index c421c7ab9..0b69eb21a 100644 --- a/commands/ps/ps.c +++ b/commands/ps/ps.c @@ -203,7 +203,6 @@ static char *prrecv(struct pstat *ps) case FSTATE_LOCK: blkstr = "flock"; break; case FSTATE_POPEN: blkstr = "popen"; break; case FSTATE_SELECT: blkstr = "select"; break; - case FSTATE_DOPEN: blkstr = "dopen"; break; case FSTATE_TASK: blkstr = taskname(ps->ps_ftask); break; default: blkstr = "??"; break; } diff --git a/commands/service/parse.c b/commands/service/parse.c index a84db8012..e00911afc 100644 --- a/commands/service/parse.c +++ b/commands/service/parse.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include "kernel/proc.h" #include "config.h" @@ -519,7 +519,7 @@ static void do_io(config_t *cpe, struct rs_start *rs_start) static void do_pci_device(config_t *cpe, struct rs_start *rs_start) { - u16_t vid, did; + u16_t vid, did, sub_vid, sub_did; char *check, *check2; /* Process a list of PCI device IDs */ @@ -536,13 +536,26 @@ static void do_pci_device(config_t *cpe, struct rs_start *rs_start) cpe->file, cpe->line); } vid= strtoul(cpe->word, &check, 0x10); - if (check[0] == '/') - did= strtoul(check+1, &check2, 0x10); - if (check[0] != '/' || check2[0] != '\0') - { + if (check[0] != ':' && /* LEGACY: */ check[0] != '/') { fatal("do_pci_device: bad ID '%s' at %s:%d", cpe->word, cpe->file, cpe->line); } + did= strtoul(check+1, &check, 0x10); + if (check[0] == '/') { + sub_vid= strtoul(check+1, &check, 0x10); + if (check[0] == ':') + sub_did= strtoul(check+1, &check2, 0x10); + if (check[0] != ':' || check2[0] != '\0') { + fatal("do_pci_device: bad ID '%s' at %s:%d", + cpe->word, cpe->file, cpe->line); + } + } else if (check[0] != '\0') { + fatal("do_pci_device: bad ID '%s' at %s:%d", + cpe->word, cpe->file, cpe->line); + } else { + sub_vid = NO_SUB_VID; + sub_did = NO_SUB_DID; + } if (rs_start->rss_nr_pci_id >= RS_NR_PCI_DEVICE) { fatal("do_pci_device: too many device IDs (max %d)", @@ -550,6 +563,8 @@ static void do_pci_device(config_t *cpe, struct rs_start *rs_start) } rs_start->rss_pci_id[rs_start->rss_nr_pci_id].vid= vid; rs_start->rss_pci_id[rs_start->rss_nr_pci_id].did= did; + rs_start->rss_pci_id[rs_start->rss_nr_pci_id].sub_vid= sub_vid; + rs_start->rss_pci_id[rs_start->rss_nr_pci_id].sub_did= sub_did; rs_start->rss_nr_pci_id++; } } @@ -734,6 +749,7 @@ struct { "PROCCTL", VM_PROCCTL }, { "MAPCACHEPAGE", VM_MAPCACHEPAGE }, { "SETCACHEPAGE", VM_SETCACHEPAGE }, + { "CLEARCACHE", VM_CLEARCACHE }, { "VFS_MMAP", VM_VFS_MMAP }, { "VFS_REPLY", VM_VFS_REPLY }, { NULL, 0 }, diff --git a/commands/service/print.c b/commands/service/print.c index 52ea796d5..7f42396ba 100644 --- a/commands/service/print.c +++ b/commands/service/print.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include "config.h" diff --git a/commands/service/service.8 b/commands/service/service.8 index d46d29bbb..711c02248 100644 --- a/commands/service/service.8 +++ b/commands/service/service.8 @@ -5,7 +5,7 @@ service \- Manage an operating system service. .PP \fBservice [-b -c -n -p -r] (up|run|edit|update)\fR \fI\fR [\fB-args\fR \fI\fR] [\fB-dev\fR \fI\fR] -[\fB-devstyle\fR \fI