Commit graph

6273 commits

Author SHA1 Message Date
David van Moolenbroek d8106f7f1d Rename VFS_BASE to FS_BASE
The recipients of these requests are file systems, not VFS.

Change-Id: I49211cfe4289df25b0c07171c7f8c321fc3731d6
2014-03-01 09:05:00 +01:00
David van Moolenbroek 87c599da2d PM/VFS protocol: prefix with VFS_PM_
These calls are sent to VFS, and thus should be prefixed with VFS_.
Clean up the protocol and PM's main function a bit.

Since the protocol is substantially big and different from normal VFS
requests, this protocol retains its own numbering range for now.

Change-Id: Ia62104b5c5c929ed787144816d2e4cc70bed3b0b
2014-03-01 09:05:00 +01:00
David van Moolenbroek 44d3230e40 For common calls, give servers unique call numbers
The getsysinfo(2), getrusage(2), and svrctl(2) calls used the same
call number to different services. Since we want to give each service
its own call number ranges, this is no longer tenable. This patch
introduces per-service call numbers for these calls.

Note that the remainder of the COMMON_ range is left intact, as these
the remaining requests in it are processed by SEF and thus server-
agnostic. The range should really be prefixed with SEF_ now.

Change-Id: I80d728bbeb98227359c525494c433965b40fefc3
2014-03-01 09:05:00 +01:00
David van Moolenbroek 80bd109cd3 libsys: various updates
- move system calls for use by services from libminlib into libsys;
- move srv_fork(2) and srv_kill(2) from RS and into libsys;
- replace getprocnr(2) with sef_self(3);
- rename previous getnprocnr(2) to getprocnr(2);
- clean up getepinfo(2);
- change all libsys calls that used _syscall to use _taskcall, so as
  to avoid going through errno to pass errors; this is already how
  most calls work anyway, and many of the calls previously using
  _syscall were already assumed to return the actual error;
- initialize request messages to zero, for future compatibility
  (note that this does not include PCI calls, which are in need of a
  much bigger overhaul, nor kernel calls);
- clean up more of dead DS code as a side effect.

Change-Id: I8788f54c68598fcf58e23486e270c2d749780ebb
2014-03-01 09:05:00 +01:00
David van Moolenbroek efd3487bc5 PM: send replies immediately
The original delayed reply functionality was there to support swapping
in processes as they are unblocked, but swap support is long gone.
These days, this code only incurs overhead and hides bugs.

Change-Id: I4aebcd80719daa1bec45ac91975ddc9a460d74d4
2014-03-01 09:05:00 +01:00
David van Moolenbroek f310aefcbd PM: resolve fork/kill race condition
When a process forks, VFS is informed on behalf of the child. This is
correct, because otherwise signals to the new child could get lost.
However, that means that the parent is not blocked from being killed
by a signal while the child is blocked on this VFS call. As a result,
by the time that the VFS reply comes in, the parent may already be
dead, and the child may thus have been assigned a new parent: INIT.

Previously, PM would blindly reply to the parent when the VFS reply
for the fork came in. Thus, it could end up sending a reply to INIT,
even though INIT did not issue the fork(2) call. This could end up
satisfying a different call from INIT (typically waitpid(2)) and then
cause an error when that other call was complete.

It would be possible to set VFS_CALL on both forking parent and child.
This patch instead adds a flag (NEW_PARENT) to note that a process's
parent has changed during a VFS call.

Change-Id: Iad930b2e441db54fe6f7d2fd011f0f6a26e2923d
2014-03-01 09:04:59 +01:00
David van Moolenbroek 595d73a896 PM: rework signal handling
- introduce PROC_STOPPED flag, which tracks whether the process is
  stopped on PROC_STOP in the kernel, rather than implicitly deriving
  this from PM_SIG_PENDING;
- make the process resumption test based on current state rather than
  state transitions;
- add and clarify several flag checks in the signal handling code;
- add test79 to test signal handling robustness.

Change-Id: Ic8c7527095035b300b56f2ab1b9dd190bd4bf001
2014-03-01 09:04:59 +01:00
David van Moolenbroek 4d4e70daaa PM: remove obsolete ALARM, PAUSE, TIMES calls
NetBSD libc implements these as wrappers around setitimer(2),
sigsuspend(2), and getrusage(2), respectively.

Change-Id: I0c5e725b3e1316bddd3a3ff7ef65d57d30afd10d
2014-03-01 09:04:59 +01:00
David van Moolenbroek f30a16b159 Remove support for MKTRACE, MKMCONTEXT, MKSTATECTL
Change-Id: Ib5fa53913ecb7b46d30d391dbdd3e8ef21eb2254
2014-03-01 09:04:59 +01:00
David van Moolenbroek 56be4fa616 test56: fix race condition
Change-Id: Ib8f435f2272fed96e99698ab5030531e733577ca
2014-03-01 09:04:59 +01:00
Lionel Sambuc c1d0e723a3 Fix missing nm.1 file
Change-Id: Ic0f2a364df5251b4d349c15ea671c6705dada3a9
2014-03-01 09:04:59 +01:00
Ben Gras 6c8f7fc3ba netbsd dirent.h, import sys/sys *.h, mfs cleanup
. add all sys/sys headers not already present to help compiling
	. take netbsd dirent.h and struct dirent; main result is
	  introducing d_type and d_namlen that have to be set by getdents()
	  in all FS code implementing it
	. d_off is gone
	. alignment of the struct has become 8 bytes instead of 4
	. remove _MAX_BLOCK_SIZE, _MIN_BLOCK_SIZE, _STATIC_BLOCK_SIZE
	. libminlib: cleanup unused yet duplicate code
	. mfs: throw out the long-broken v1, v2 support
	. new test for dirent contents filled by getdents()

Change-Id: I1459755c7ba5e5d1c9396d3a587ce6e63ddc283e
2014-03-01 09:04:59 +01:00
David van Moolenbroek 664b726cd3 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
2014-03-01 09:04:58 +01:00
David van Moolenbroek cf12dbac0d IS: dump number of in-use FDs for VFS
Change-Id: If0e2092d5a8c384c31b1f44cc0591bb119c6d8de
2014-03-01 09:04:58 +01:00
David van Moolenbroek b058039a35 TTY: fix earlier PTY select "improvement"
It was just plain wrong.

Change-Id: Ieab4b4f01d9461e05e0d0ba6427a99d863d6b98d
2014-03-01 09:04:58 +01:00
David van Moolenbroek e5cc85fdc4 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
2014-03-01 09:04:58 +01:00
David van Moolenbroek 50685cbec3 VFS: better dupfrom(2) deadlock detection
Change-Id: I29f00075698888c7c8ca60b47ab82fba8c606f4e
2014-03-01 09:04:58 +01:00
David van Moolenbroek 9e3e032c26 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
2014-03-01 09:04:58 +01:00
David van Moolenbroek f3d8aa65ac UDS: add support for FIONREAD
Change-Id: I50030012b408242a86f8c55017429acdadff49d1
2014-03-01 09:04:58 +01:00
David van Moolenbroek 10a344c3fd 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
2014-03-01 09:04:57 +01:00
David van Moolenbroek 3e8346a8e8 UDS: support for nonblocking sockets
This patch includes several other fixes, which are now tested in the
test56 test set.

Change-Id: I9535d5a6c072abf966252838522c5f65b353c6c2
2014-03-01 09:04:57 +01:00
David van Moolenbroek 1e07186caf 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
2014-03-01 09:04:57 +01:00
David van Moolenbroek b003ed0929 UDS: split off from PFS
Change-Id: I769cbd64aa6e5e85a797caf0f8bbb4c20e145263
2014-03-01 09:04:57 +01:00
David van Moolenbroek 6d466f941b 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
2014-03-01 09:04:57 +01:00
David van Moolenbroek 89332ecdf1 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
2014-03-01 09:04:57 +01:00
Lionel Sambuc acc46143ab Updating saved configure line in gcc
GCC embeddeds in a string the configuration used when building itself,
this patches just updates that string to match the configuration
actually used.

Change-Id: Ife8f61570b94eb17ce5808b5b58cc5e75e9dc64f
2014-03-01 09:04:57 +01:00
Lionel Sambuc b9a6a72b65 usr.bin/man: Update
Change-Id: I0c5d2115ba384687032f7b2af50d99dedc323b7a
2014-03-01 09:04:56 +01:00
Lionel Sambuc 92395e9c3f external/bsd/mdocml: Update
Change-Id: I17b54e52e8322676d83ed4386f586f8ef3029f72
2014-03-01 09:04:56 +01:00
Lionel Sambuc ff68abe6b3 Remove obsolete compatibility links
* /usr/bin/strip would be replaced by a link, even when compiling
    binutils.
 * Updated minix-spec.h to use the correct dynamic linker, and removed
    the previously used symlinks.
 * Removed the patch to the builtin PATH of ld.elf_so.

Change-Id: I4dc8a7fb77a11638f5105a4e15b6c9be5add750e
2014-03-01 09:04:56 +01:00
Lionel Sambuc 11bab4dff7 Splitting commands/cd/cd.sh
As the situation is right now, importing one of the commands the
script replaces, requires a doc/UPDATING step.

By moving the script to a shared folder, and symlinking it once per
command, this allows for separatly installed files on the system,
instead of one file being symlinked multiple times.

Change-Id: I0dae96982bca5168b852ed70fff61442441b929f
2014-03-01 09:04:56 +01:00
Lionel Sambuc bbb8908c16 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
2014-03-01 09:04:56 +01:00
Lionel Sambuc f8d0f5b0ae MAKEDEV: Add mtree output, and ramdisk set.
Change-Id: I36cb7e9451960189a33a04a5c2e3ddb19c7be75e
2014-03-01 09:04:56 +01:00
David van Moolenbroek cc59831179 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
2014-03-01 09:04:56 +01:00
Mikal Villa 0214ccc9e2 Norwegian keymap
Change-Id: I181234afc8f1a058e92af6c1fe88979463aaff45
2014-03-01 09:04:55 +01:00
David van Moolenbroek 6b3f4dc157 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
2014-03-01 09:04:55 +01:00
David van Moolenbroek ec2359d566 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
2014-03-01 09:04:55 +01:00
Lionel Sambuc 913340b559 Enable sys-root support in the native binutils
sysroot support was enabled only for cross versions of the binutils
tools.

This patch also activate it for the native tools which are installed
on the target system.

Change-Id: Ica5de7e20719a63f3b695477b767c30d0a93490c
2014-03-01 09:04:55 +01:00
Thomas Cort c0c5113989 Importing usr.bin/uname
Change-Id: I4c316221e288edd839e26a2af4cb59f28bf722c1
2014-03-01 09:04:55 +01:00
Thomas Cort f5dbfe789e 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
2014-03-01 09:04:55 +01:00
David van Moolenbroek 36ac0dbcf8 Take LOG out of the boot image
Change-Id: Id2629776b53aae46629b04a42c15cbbacac9b949
2014-03-01 09:04:55 +01:00
David van Moolenbroek 8fea5ab8bd 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
2014-03-01 09:04:54 +01:00
David van Moolenbroek de975579a4 Rename SYSCTL kernel call to DIAGCTL
Change-Id: I1b17373f01808d887dcbeab493838946fbef4ef6
2014-03-01 09:04:54 +01:00
Lionel Sambuc 9fab85c2de 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
2014-03-01 09:04:54 +01:00
David van Moolenbroek 214c4e152b 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
2014-03-01 09:04:54 +01:00
David van Moolenbroek 0cea0924a6 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
2014-03-01 09:04:54 +01:00
David van Moolenbroek 6989311826 Add VND driver, providing loopback devices
Change-Id: I40fa695e28c67477a75383e6f1550e451afcab41
2014-03-01 09:04:54 +01:00
David van Moolenbroek dba2d1f8b4 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
2014-03-01 09:04:54 +01:00
David van Moolenbroek 1f8286c377 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.

LSC: Minor adaptation to keep track of history. As this patch has been
     forward ported into mainline, a simple rebase would loose this
     commit (cf commit 1f317d315c).

Change-Id: I0b72312e79992b9818559c6546a0e52cd95184c2
2014-03-01 09:04:53 +01:00
David van Moolenbroek 38f7b96048 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
2014-03-01 09:04:53 +01:00
David van Moolenbroek d266a94fea 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
2014-03-01 09:04:53 +01:00