143 Commits

Author SHA1 Message Date
Christopher Simons
f94fc08000 part.8: fix typo: other then -> other than
Change-Id: I966376d9d34b30a7bdd87272858d50248ca41221
2018-10-27 16:56:17 +02:00
Christopher Simons
d189cd4505 vol.1: fix typo: larger then -> larger than
Change-Id: I962f05774d9cf8ce4fb441ff7e2765a895649805
2018-10-27 16:56:17 +02:00
Jean-Baptiste Boric
c1d4abeb0c Fix pkgin_cd.sh
Change-Id: I513c16b0691897f3c665532d50ed398967f3e4d0
2017-05-07 00:54:46 +02:00
David van Moolenbroek
9a8b4f5601 netconf(8): rewrite
When possible, network drivers are now started automatically.  That
means that netconf(8)'s network driver selection has become obsolete.
This patch changes netconf(8) to allow the user to specify a network
configuration (currently one of DHCP IPv4+IPv6, DHCP IPv4-only,
manual IPv4-only) for any hardware network interfaces that are
currently present.

Selection of network drivers that require manual configuration first
(mainly old ISA cards) is still supported, but now as a special case.

Change-Id: I6208fc75192eb7f0b061862aaf7507f71a620da4
2017-04-30 13:16:19 +00:00
David van Moolenbroek
ef8d499e2d Add lwip: a new lwIP-based TCP/IP service
This commit adds a new TCP/IP service to MINIX 3.  As its core, the
service uses the lwIP TCP/IP stack for maintenance reasons.  The
service aims to be compatible with NetBSD userland, including its
low-level network management utilities.  It also aims to support
modern features such as IPv6.  In summary, the new LWIP service has
support for the following main features:

- TCP, UDP, RAW sockets with mostly standard BSD API semantics;
- IPv6 support: host mode (complete) and router mode (partial);
- most of the standard BSD API socket options (SO_);
- all of the standard BSD API message flags (MSG_);
- the most used protocol-specific socket and control options;
- a default loopback interface and the ability to create one more;
- configuration-free ethernet interfaces and driver tracking;
- queuing and multiple concurrent requests to each ethernet driver;
- standard ioctl(2)-based BSD interface management;
- radix tree backed, destination-based routing;
- routing sockets for standard BSD route reporting and management;
- multicast traffic and multicast group membership tracking;
- Berkeley Packet Filter (BPF) devices;
- standard and custom sysctl(7) nodes for many internals;
- a slab allocation based, hybrid static/dynamic memory pool model.

Many of its modules come with fairly elaborate comments that cover
many aspects of what is going on.  The service is primarily a socket
driver built on top of the libsockdriver library, but for BPF devices
it is at the same time also a character driver.

Change-Id: Ib0c02736234b21143915e5fcc0fda8fe408f046f
2017-04-30 13:16:03 +00:00
David van Moolenbroek
d7c7182ad4 Retire MINIX rlogin(1)
Change-Id: Ib85e74e5333e8fffa05631dbc760284761bf3ecb
2017-03-09 23:40:08 +00:00
David van Moolenbroek
47ebcd22bd Retire MINIX rget(1), rput(1)
Change-Id: I70e3ec9281275730c589fb7683801dc1ca584cab
2017-03-09 23:40:07 +00:00
David van Moolenbroek
a9ef5b90e6 Retire MINIX in.telnetd(8)
Change-Id: Ib54998e7a81f924d19b8013ef567703996d24a03
2017-03-09 23:40:06 +00:00
David van Moolenbroek
4d04ccc15b Retire MINIX telnet(1)
..which, for some strange reason, was installed as "ttn".

Change-Id: I5ad2f969ad7978a27fb7345f8434470ca427d429
2017-03-09 23:40:06 +00:00
David van Moolenbroek
34a8cf369f Retire MINIX rarpd(8)
Change-Id: I2d7b7edbb8fa6000ba368d156cf947e7691cf454
2017-03-09 23:40:05 +00:00
David van Moolenbroek
9cf227216d Retire MINIX irdpd(8)
Change-Id: Id11c6db9db5da18346d993cb9c3faa4313ed3ed4
2017-03-09 23:40:04 +00:00
David van Moolenbroek
f130137a5e Retire MINIX arp(8)
Change-Id: I8351fbb99d73811282e46dae7fae1b6abb130bf2
2017-03-09 23:40:04 +00:00
David van Moolenbroek
b8046fb69b Retire MINIX tcpd(8)
Change-Id: If419d441c5df0b9f2e29db1ef0d904d102739f9b
2017-03-09 23:40:03 +00:00
David van Moolenbroek
fd8826c892 Retire MINIX host(1)
Change-Id: I19d2e866d6d397d3bff9ba698cb8ec26267ee82c
2017-03-09 23:40:03 +00:00
David van Moolenbroek
9490732a59 Retire MINIX dhcpd(8)
Change-Id: I4b8c738b6176ce390a7a7817b0dcaf9caffe636c
2017-03-09 23:40:02 +00:00
David van Moolenbroek
035c234ade Retire MINIX hostaddr(1)
Change-Id: I30c7b5fe4c96ea040c3eea46f1dc4d9bd135745d
2017-03-09 23:40:01 +00:00
David van Moolenbroek
407c396431 Retire MINIX nonamed(8)
Also retire support for the MINIX versions of /etc/hosts and
/etc/resolv.conf.  These files will be brought back with NetBSD
imports, although like NetBSD, MINIX 3 will be using external
resolvers directly from then on.  Since resolv.conf is hand-created
rather than installed, we do not mark it as obsolete.

Change-Id: Ie6154d5a4d8d977c19b9754bf920ae868680e9d1
2017-03-09 23:40:01 +00:00
David van Moolenbroek
50c98e1f41 Retire MINIX pr_routes(8)
Change-Id: Ic7494d097f9d19185b7173edb7590044baee5abc
2017-03-09 23:40:00 +00:00
David van Moolenbroek
73ee574be3 Retire MINIX add_route(8)
Change-Id: I900a3c6ac8e8fac15f5f84960bb89f92aeb90863
2017-03-09 23:40:00 +00:00
David van Moolenbroek
96339c07fd Retire MINIX ifconfig(8)
Change-Id: I26f3ceff01bbd31e4c009752c7454a58e8a72abf
2017-03-09 23:39:59 +00:00
David van Moolenbroek
c5da0dffe2 Retire inet: the previous MINIX TCP/IP service
This commit (temporarily) leaves MINIX 3 without a TCP/IP service.

Thanks go out to Philip Homburg for providing this TCP/IP stack in the
first place.  It has served MINIX well for a long time.

Change-Id: I0e3eb6fe64204081e4e3c2b9d6e6bd642f121973
2017-03-09 23:39:58 +00:00
David van Moolenbroek
49bf8d5c6a Retire MINIX tcpstat(1), udpstat(1)
This needs to be done before retiring inet itself, since these
utilities include headers from inet directly.

Also retire the now-obsolete paramvalue(3).

Change-Id: I9b27771190a6a32ee533b0c0d9d37f61a16ee36c
2017-03-09 23:39:57 +00:00
David van Moolenbroek
27852ebe53 UDS: full rewrite
This new implementation of the UDS service is built on top of the
libsockevent library.  It thereby inherits all the advantages that
libsockevent brings.  However, the fundamental restructuring
required for that change also paved the way for resolution of a
number of other important open issues with the old UDS code.  Most
importantly, the rewrite brings the behavior of the service much
closer to POSIX compliance and NetBSD compatibility.  These are the
most important changes:

- due to the use of libsockevent, UDS now supports multiple suspending
  calls per socket and a large number of standard socket flags and
  options;
- socket address matching is now based on <device,inode> lookups
  instead of canonized path names, and socket addresses are no longer
  altered either due to canonization or at connect time;
- the socket state machine is now well defined, most importantly
  resolving the erroneous reset-on-EOF semantics of the old UDS, but
  also allowing socket reuse;
- sockets are now connected before being accepted instead of being
  held in connecting state, unless the LOCAL_CONNWAIT option is set
  on either the connecting or the listening socket;
- connect(2) on datagram sockets is now supported (needed by syslog),
  and proper datagram socket disconnect notification is provided;
- the receive queue now supports segmentation, associating ancillary
  data (in-flight file descriptors and credentials) with each segment
  instead of being kept fully separately; this is a POSIX requirement
  (and needed by tmux);
- as part of the segmentation support, the receive queue can now hold
  as many packets as can fit, instead of one;
- in addition to the flags supported by libsockevent, the MSG_PEEK,
  MSG_WAITALL, MSG_CMSG_CLOEXEC, MSG_TRUNC, and MSG_CTRUNC send and
  receive flags are now supported;
- the SO_PASSCRED and SO_PEERCRED socket options are replaced by
  LOCAL_CREDS and LOCAL_PEEREID respectively, now following NetBSD
  semantics and allowing use of NetBSD libc's getpeereid(3);
- memory usage is reduced by about 250 KB due to centralized in-flight
  file descriptor tracking, with a limit of OPEN_MAX total rather than
  of OPEN_MAX per socket;
- memory usage is reduced by another ~50 KB due to removal of state
  redundancy, despite the fact that socket path names may now be up to
  253 bytes rather than the previous 104 bytes;
- compared to the old UDS, there is now very little direct indexing on
  the static array of sockets, thus allowing dynamic allocation of
  sockets more easily in the future;
- the UDS service now has RMIB support for the net.local sysctl tree,
  implementing preliminary support for NetBSD netstat(1).

Change-Id: I4a9b6fe4aaeef0edf2547eee894e6c14403fcb32
2017-03-09 23:39:56 +00:00
David van Moolenbroek
181fb1b2b5 RS: add infrastructure for mapping socket drivers
This patch introduces the first piece of support for the concept of
"socket drivers": services that implement one or more socket protocol
families.  The latter are also known as "domains", as per the first
parameter of the socket(2) API.  More specifically, this patch adds
the basic infrastructure for specifying that a particular service is
the socket driver for a set of domains.

Unlike major number mappings for block and character drivers, socket
domain mappings are static.  For that reason, they are specified in
system.conf files, using the "domain" keyword.  Such a keyword is to
be followed by one or more protocol families, without their "PF_"
prefix.  For example, a service with the line "domain INET INET6;"
will be mapped as the socket driver responsible for the AF_INET and
AF_INET6 protocol families.

This patch implements only the infrastructure for creating such
mappings; the actual mapping will be implemented in VFS in a later
patch.  The infrastructure is implemented in service(8), RS, and VFS.

For now there is a hardcoded limit of eight domains per socket driver.
This may sound like a lot, but the upcoming new LWIP service will
already use four of those.  Also, it is allowed for a service to be
both a block/character driver and a socket driver at the same time,
which is a requirement for the new LWIP service.

Change-Id: I93352d488fc6c481e7079248082895d388c39f2d
2017-03-09 23:39:49 +00:00
David van Moolenbroek
c58da9fbc3 Rename MINIX service(8) to minix-service(8)
IMPORTANT: this change has a docs/UPDATING entry!

This rename is unfortunately necessary because NetBSD has decided to
create its own service(8) utility, and we will want to import theirs
as well.  The two can obviously not coexist.

Also move ours from /bin to /sbin, as it is a superuser-only utility.

Change-Id: Ic6e46ffb3a84b4747d2fdcb0d74e62dbea065039
2017-02-22 17:16:21 +00:00
David van Moolenbroek
77e79d3374 etc: synchronize master.password, group to NetBSD
IMPORTANT: this change has a docs/UPDATING entry!

This change is a long overdue switch-over from the old MINIX set of
user and group accounts to the NetBSD set.  This switch-over is
increasingly important now that we are importing more and more
utilities from NetBSD, several of which expect various user accounts
to exist.  By switching over in one go, we save ourselves various
headaches in the long run, even if the switch-over itself is a bit
painful for existing MINIX users.

The newly imported master.passwd and group files have three exceptions
compared to their NetBSD originals:

1. There is a custom "service" account for MINIX 3 services.  This
   account is used to limit run-time privileges of various system
   services, and is not used for any files on disk.  Its user ID may
   be changed later, but should always correspond to whatever the
   SERVICE_UID definition is set to.
2. The user "bin" has its shell set to /bin/sh, instead of NetBSD's
   /sbin/nologin.  The reason for this is that the test set in
   /usr/tests/minix-posix will not be able to run otherwise.
3. The group "operator" has been set to group ID 0, to match its old
   value.  This tweak is purely for transitioning purposes: as of
   writing, pkgsrc packages are still using root:operator as owner and
   group for most installed files.  Sometime later, we can change back
   "operator" to group ID 5 without breaking anything, because it does
   not appear that this group name is used for anything important.

Change-Id: I689bcfff4cf7ba85c27d1ae579057fa3f8019c68
2017-02-18 21:37:24 +00:00
David van Moolenbroek
0c6b4c6127 printconfig(8): print PCI sub-VID/DID when set
In order to allow for proper matching of available drivers to system
hardware, the output of this utility should reflect the full details
of the input from configuration files.  In particular, that includes
sub-IDs of PCI devices when those have been specified.

Change-Id: Iea24d72795cd714268dbdb95df998eb74de8f2bd
2017-02-16 10:22:28 +00:00
David van Moolenbroek
3ac58492b3 Add LLVM GCOV coverage support
With this patch, it is now possible to generate coverage information
for MINIX3 system services with LLVM.  In particular, the system can
be built with MKCOVERAGE=yes, either with a native "make build" or
with crosscompilation.  Either way, MKCOVERAGE=yes will build the
MINIX3 system services with coverage profiling support, generating a
.gcno file for each source module.  After a reboot it is possible to
obtain runtime coverage data (.gcda files) for individual system
services using gcov-pull(8).  The combination of the .gcno and .gcda
files can then be inspected with llvm-cov(1).

For reasons documented in minix.gcov.mk, only system service program
modules are supported for now; system service libraries (libsys etc.)
are not included.  Userland programs are not affected by MKCOVERAGE.

The heart of this patch is the libsys code that writes data generated
by the LLVM coverage hooks into a serialized format using the routines
we already had for GCC GCOV.  Unfortunately, the new llvm_gcov.c code
is LLVM ABI dependent, and may therefore have to be updated later when
we upgrade LLVM.  The current implementation should support all LLVM
versions 3.x with x >= 4.

The rest of this patch is mostly a light cleanup of our existing GCOV
infrastructure, with as most visible change that gcov-pull(8) now
takes a service label string rather than a PID number.

Change-Id: I6de055359d3d2b3f53e426f3fffb17af7877261f
2016-09-24 22:18:31 +00:00
Antoine Leca
6ddb33542a Allow repartition(8) subpartitions above 4G
Change-Id: I058ab3b58b2e7822b59365b1ce222c5588f442cd
2016-08-06 10:52:38 +02:00
David van Moolenbroek
3083d603ba Resolve a number of GCC-generated warnings
The warnings in test47 seem to be a symptom of a larger problem,
i.e., not an issue with the test set code but rather with the GCC
configuration.  Hopefully the switch to LLVM will resolve those.

Change-Id: Ic9fa3b8bc9b728947c993f2e1ed49d9a3b731344
2016-08-05 16:24:04 +02:00
David van Moolenbroek
ab712d1923 commands: fix various small issues
Reported by dcb314.  Recommendations adopted as is.

This closes #137, closes #138, closes #139, and hopefully I got that
right this time.

Change-Id: I79774f4c398495dba19dec43fbc3f79afd186843
2016-08-05 11:17:19 +00:00
Antoine Leca
55a5a21b97 Clean up traces from long-gone sys_int86 interface
Change-Id: I773ab67342be852cc74f76b4fcbb338c9cb11f7e
2016-07-20 19:00:44 +02:00
Antoine Leca
a2bd2caf02 Drop obsolete postinstall script
Conflicts with NetBSD /usr/sbin/postinstall(8)

Change-Id: Iaefe4494b95b46d1134f4a477798765bbcc66c70
2016-07-20 17:35:49 +02:00
Antoine Leca
4aaaf2c612 Remove long-obsolete pwdauth(8) command (in usr/lib)
Change-Id: I454d506199ce1d5d48295bca86b590ce0701dcc2
2016-07-20 17:35:37 +02:00
Antoine Leca
7eb1c60ab5 Allow part(8) to make subpartitions above 4G
Change-Id: I3fd2c5de7cbb190b857eb34f16463f67a30118a3
2016-07-14 12:34:41 +02:00
David van Moolenbroek
4d3708913c cawf(1): remove various redundant comparisons
Reported by dcb314.

This fixes #135, #136.

Change-Id: I0f83a92e18adf68e5ad493b9057d093a6b37b328
2016-06-17 20:09:08 +00:00
David van Moolenbroek
a617090dc0 setup.sh: fix various issues
- fix the reinstallation (preserve-/home) option;
- remove support for just reinstalling the bootloader, as the main
  purpose of this option (allowing an upgrade from the old MINIX
  boot monitor to the NetBSD bootloader) is no longer needed and was
  already broken;
- do not try to copy over /etc/motd.install: it no longer exists.

This resolves issue 106.

Change-Id: Iad3805d86c4806d725f9b285c2d4378670790f78
2016-02-26 19:45:55 +00:00
Thomas Cort
b88949904f mail: close fp after use
Add missing `fclose(fp)`

Issue #109

Change-Id: I0908ede77cba18336c399c5e16771cb6650e6404
2016-02-07 09:50:08 -05:00
David van Moolenbroek
373b793920 Basic statistical profiling fixes
At least it works again now.  Sprofalyze should be made aware of the
kernel information page, though (i.e., /proc/ipcvecs).

Change-Id: Id4e5f6417ad152607c4e53b323b6f65ea4b10c6e
2016-01-28 13:09:35 +01:00
Lionel Sambuc
39508cdda5 setup.sh: clean up
- Fix unmounting order of slices.
 - Update pkgin pre-installation commands, make them as generic as
   possible.

Change-Id: Ifaa4021fed048facca8d2a170aa65491feb37702
2016-01-22 12:24:22 +01:00
Lionel Sambuc
6e48120e2b Fix umount order in setup.sh
Change-Id: Ife0c36b0fdc70e4b7ae86278d0df8d6d00d19df4
2016-01-16 14:04:26 +01:00
David van Moolenbroek
0502421f1b Import NetBSD ipcrm(1)
A few MINIX3-specific changes are necessary due to the fact that we
are missing the System V IPC message queue system calls.

Change-Id: Idd252984be9df69618cef79bcf6c676cbf915d85
2016-01-16 14:04:14 +01:00
David van Moolenbroek
7b09d0426a Import NetBSD ipcs(1)
The old ipcs(1) utility had a dubious license at best.

Change-Id: Ic4c0a24f04c94cc77a43658f6c939d138461bd6a
2016-01-16 14:04:13 +01:00
David van Moolenbroek
910831cb5c PM: generic process event publish/subscribe system
Now that there are services other than PM and VFS that implement
userland system calls directly, these services may need to know about
events related to user processes.  In particular, signal delivery may
have to interrupt blocking system calls, and certain cleanup tasks may
have to be performed after a user process exits.

This patch aims to implement a generic, lasting solution for this
problem, by allowing services to subscribe to "signal delivered"
and/or "process exit" events from PM.  PM publishes such events by
sending messages to its subscribed services, which must then reply an
acknowledgment message.

For now, only the two aforementioned events are implemented, and only
the IPC service makes use of the process event facility.

The new process event publish/subscribe system replaces the previous
VM notify-sig/watch-exit/query-exit system, which was unsound: 1) it
allowed subscription to events from individual processes, and suffered
from fundamental race conditions as a result; 2) it relied on "not too
many" processes making use of the IPC server functionality in order to
avoid loss of notifications.  In addition, it had the "ipc" process
name hardcoded, did not distinguish between signal delivery and exits,
and added a roundtrip to VM for all events from all processes.

Change-Id: I75ebad4bc54e646c6433f473294cb4003b2c3430
2016-01-16 14:04:10 +01:00
David van Moolenbroek
97189037b1 Import NetBSD ps(1)
No changes except for one cosmetic adjustment:  NetBSD has chosen to
rename the standard TT column to TTY and not shorten tty names;  we
undo those changes, making ps(1) behave more in accordance with the
specification and its manual page, and, most importantly for us, not
use an incredibly wide TTY column to print "console".

Change-Id: I3b3c198762f3eacf1b8e500557a803c1fedf2a61
2016-01-13 20:32:52 +01:00
David van Moolenbroek
d991a2bea3 Retire sysuname(2), synchronize sys/utsname.h
Now that uname(3) uses sysctl(2), we no longer need sysuname(2).
Backward compatibility is retained for old statically linked
binaries for a short while.

Also remove the now-obsolete MINIX3-specific "arch" field from the
utsname structure.  While this is an ABI break at the libc level,
it should pose no problems in practice, because:

- statically linked programs (i.e., all of the base system) are not
  affected, as they will use headers synchronized with libc;
- the structure is getting smaller, thus, older dynamically linked
  programs (typically in pkgsrc) using the new libc will end up with
  garbage in the "arch" field, but it is unlikely they will use this
  field anyway, since it was specific to MINIX3;
- new dynamically linked programs using an old libc could end up with
  memory corruption, but this is not a scenario that is expected to
  occur in the first place - certainly not with programs from pkgsrc.

Change-Id: I29c76576f509feacc8f996f0bd353ca8961d4917
2016-01-13 20:32:46 +01:00
David van Moolenbroek
72965c8885 Integrate ASR instrumentation into build system
ASR instrumentation is now performed on all applicable system services
if the system is built with MKASR=yes.  This setting automatically
enables MKMAGIC=yes, which in turn enables MKBITCODE=yes.

The number of extra rerandomized service binaries to be generated can
be set by passing ASRCOUNT=n to the build system, where n is a number
between 1 and 65536.  The default ASRCOUNT is 3, meaning that each
service will have one randomized base binary and three additional
rerandomized binaries.  As before, update_asr(8) can be used for
runtime rerandomization.

Change-Id: Icb498bcc6d1cd8d3f6bcc24eb0b32e29b7e750c2
2016-01-13 20:32:34 +01:00
David van Moolenbroek
23199f6205 RS: allow service program name to be overridden
Until now, the program name of a service was always the file name
(without directory) of the service binary.  The program name is used
to, among other things, find the corresponding system.conf entry.
With ASR moving to a situation where all rerandomized service binaries
are stored in a single directory, this can no longer be maintained.
Instead, the service(8) command can now be instructed to override the
service program name, using its new -progname option.

Change-Id: I981e9b35232c88048d8804ec5eca58d1e4a5db82
2016-01-13 20:32:31 +01:00
David van Moolenbroek
fe7ecbbff1 update_asr(8): fix argument handling
Passing in labels of specific services did not actually work at all.

Change-Id: I9501bc0206f0ce5cf064f1453fdf171c4c930aae
2016-01-13 20:32:28 +01:00
Lionel Sambuc
0a6a1f1d05 NetBSD re-synchronization of the source tree
This brings our tree to NetBSD 7.0, as found on -current on the
10-10-2015.

This updates:
 - LLVM to 3.6.1
 - GCC to GCC 5.1
 - Replace minix/commands/zdump with usr.bin/zdump
 - external/bsd/libelf has moved to /external/bsd/elftoolchain/
 - Import ctwm
 - Drop sprintf from libminc

Change-Id: I149836ac18e9326be9353958bab9b266efb056f0
2016-01-13 20:32:14 +01:00