6882 Commits

Author SHA1 Message Date
rlfnb
d8c1e15ae6 e1000: add i82583V 1000baseT Ethernet
added device id for the i82583V NIC. Tested successful on bare metal.

Change-Id: I486ea60a52a16075a1da8ffa0280884a407acc30
2016-01-16 14:04:16 +01:00
David van Moolenbroek
b58e161ccb trace(1): resolve all level-5 LLVM warnings
Change-Id: If5ffe97eb0b15387b1ab674657879e13f58fb27e
2016-01-16 14:04:15 +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
2f09e77b82 MIB: add support for System V IPC information node
The kernel.ipc.sysvipc_info node is the gateway from NetBSD ipcs(1)
and ipcrm(1) to the IPC server, and thus necessary for a clean
import of these two utilities.  The MIB service implementation uses
the preexisting (Linux-specific) information calls on the IPC server
to obtain the information.

Change-Id: I85d1e193162d6b689f114764254dd7f314d2cfa0
2016-01-16 14:04:12 +01:00
David van Moolenbroek
5b1db95619 IPC server: subscribe to process events on demand
As mentioned in previous patches, services may not subscribe to
process events from specific processes only, since this results in
race conditions.  However, the IPC server can safely turn on and off
its entire subscription based on whether any System V IPC semaphores
(and, in the future, message queues) are allocated at all.  Since
the System V IPC facilities are not so commonly used, this removes
the extra round trip from PM to the IPC server and back for caught
signals and process exits in the common case.

Change-Id: I937259034872be32f4e26ab99270f4d475ff6134
2016-01-16 14:04:11 +01:00
David van Moolenbroek
56dc79cea0 IPC server: major fixes, test set for semaphores
- rewrite the semop(2) implementation so that it now conforms to the
  specification, including atomicity, support for blocking more than
  once, range checks, but also basic fairness support;
- fix permissions checking;
- fix missing time adjustments;
- fix off-by-one errors and other bugs;
- do not allocate dynamic memory for GETALL/SETALL;
- add test88, which properly tests the semaphore functionality.

Change-Id: I85f0d3408c0d6bba41cfb4c91a34c8b46b2a5959
2016-01-16 14:04:11 +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
0baafa0ef4 IPC server: restyle
Closer to KNF, better coding practices, more similar to other
services, no more global variables, a few more comments, that
kind of stuff.  No major functional changes.

Change-Id: I6e8f53bfafd6f41e92031fba76c40a31d2107a8e
2016-01-16 14:03:55 +01:00
David van Moolenbroek
4d272e5a97 IPC server: NetBSD sync, general improvements
- switch to the NetBSD identifier system; it is not only better, but
  also required for porting NetBSD ipcs(1) and ipcrm(1); however, it
  requires that slots not be moved, and that results in some changes;
- synchronize some other things with NetBSD: where keys are kept, as
  well as various non-permission mode flags;
- fix semctl(2) vararg retrieval and message field type;
- use SUSPEND instead of weird reply exceptions in the call table;
- fix several memory leaks and at least one missing permission check;
- improve the atomicity of semop(2) by a small amount, even though
  its atomicity is still broken at a fundamental level;
- use the new cheaper way to retrieve the current time;
- resolve all level-5 LLVM warnings.

Change-Id: I0c47aacde478b23bb77d628384aeab855a22fdbf
2016-01-16 13:58:47 +01:00
David van Moolenbroek
58c1923c9f IPC server: expose semaphore information
Specifically, add support for the IPC_INFO, SEM_INFO, and SEM_STAT
semctl(2) operations, similar to how information about shared memory
is already exposed as well.  The MINIX3 ipcs(1) utility already had
support for these operations, and can now actually use them, too.

Change-Id: Ice5a02e729bf6df6aa8fab76e854808adc04dae3
2016-01-13 20:32:56 +01:00
David van Moolenbroek
9d796422b1 Import NetBSD pagesize(1)
Change-Id: I6a749cba5c6dabb3daea8c5bad3e94be342833d7
2016-01-13 20:32:55 +01:00
David van Moolenbroek
6ad322a932 MIB: slim process tables to reduce memory usage
- About 80% of PM's process table consisted of per-signal sigaction
  structures.  This is information not used by the MIB service, and
  can safely be stored outside the main process table.

- The MIB service does not need most of the VFS process table, so VFS
  now generates a "light" version of its table upon request, with just
  the fields used by the MIB service.

The result is a size reduction of the MIB service of about 700KB.

Change-Id: I79fe7239361fbfb45286af8e86a10aed4c2d2be7
2016-01-13 20:32:55 +01:00
David van Moolenbroek
305e366fe4 ProcFS: get process information from MIB service
Instead of pulling in process tables itself, ProcFS now queries the
MIB service for process information.  This reduces ProcFS's memory
usage by about 1MB.  The change does have two negative consequences.

First, getting all the original /proc/<pid>/psinfo fields filled in
would take a lot of extra effort.  Since the only program that uses
those files at all is mtop(1), we reformat psinfo to expose only the
information used by mtop(1).  This means that with this patch, older
copies of MINIX3 ps and top will cease to work.

Second, since both MIB and ProcFS update their own view of the
process list only once per clock tick, ProcFS' view may now be
outdated by up to two clock ticks.  This is unlikely to pose a
problem in practice.

Change-Id: Iaa6b60450c8fb52d092962394d33d08bd638bc01
2016-01-13 20:32:54 +01:00
David van Moolenbroek
b89261ba01 Rename top(1) to mtop(1), import NetBSD top(1)
Due to differences in (mainly) measuring and accumulating CPU times,
the two top programs end up serving different purposes: the NetBSD
top is a system administration tool, while the MINIX3 top (now mtop)
is a performance debugging tool.  Therefore, we keep both.

The newly imported BSD top has a few MINIX3-specific changes.  CPU
statistics separate system time from kernel time, rather than kernel
time from time spent on handling interrupts.  Memory statistics show
numbers that are currently relevant for MINIX3.  Swap statistics are
disabled entirely.  All of these changes effectively bring it closer
to how mtop already worked as well.

Change-Id: I9611917cb03e164ddf012c5def6da0e7fede826d
2016-01-13 20:32:53 +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
180e74704d Import NetBSD dev_mkdb(8)
Adapt libc devname(3) to make use of it, so that such device name
queries are now several orders of magnitude faster.  The database
is created and updated at system bootup time.

Change-Id: I0cbcb24c7d47577d4d6af9c8290c21ee4df9a0ff
2016-01-13 20:32:51 +01:00
David van Moolenbroek
1f761e1bea w(1): switch to libkvm
Change-Id: I6d836d9aa2e1dfe8df1d866a5cc33868522f767e
2016-01-13 20:32:50 +01:00
David van Moolenbroek
9da227510d Import NetBSD libkvm
Imported with no changes, but not all parts are expected to be
functional.  The libc nlist functionality is enabled for the
purpose of successful linking, although the nlist functionaly has
not been tested on MINIX3 nor is it needed for how we use libkvm.

In terms of function calls: kvm_getproc2, kvm_getargv2,
kvm_getenvv2, and kvm_getlwps are expected to work, whereas
kvm_getproc, kvm_getargv, kvm_getenvv, and kvm_getfiles are not.

Change-Id: I7539209736f1771fc0b7db5e839d2df72f5ac615
2016-01-13 20:32:49 +01:00
David van Moolenbroek
b4f34f94be Import NetBSD sysctl(8)
Change-Id: Idc3a9138521de1329daaab3bd0907a0db0d37775
2016-01-13 20:32:48 +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
d2532d3d42 Start using sysctl(3) throughout userland
This patch mostly removes MINIX3-specific workarounds for missing
sysctl support.

Change-Id: I21e35e887359619ba72c252aa43d9017301a46ac
2016-01-13 20:32:45 +01:00
David van Moolenbroek
25d39513e7 MIB: initial tree population
Change-Id: I28ef0a81a59faaf341bfc15178df89474779a136
2016-01-13 20:32:44 +01:00
David van Moolenbroek
1b75f6357e PM: restore own proper process group
PM uses its own process table entry as source for kernel signals,
and temporarily changes its own process group to make the signals
arrive at the right processes.  However, the value is never reset,
with as result that the temporary value shows up in ps(1) output.

Change-Id: Ib7f635b2cf1958055123736dfd58c26530632785
2016-01-13 20:32:43 +01:00
David van Moolenbroek
58be976d3b PM: remember when each process was started
Change-Id: I176f01681ebe758b03b635f2b5ecc8f083710bb4
2016-01-13 20:32:42 +01:00
David van Moolenbroek
89926a4cc3 VM: report resource usage with VM usage info
Change-Id: I93e898343e7fb72e75ae74c650b10f2ba570d381
2016-01-13 20:32:41 +01:00
David van Moolenbroek
8b30ac4cc1 VM: expose virtual process size
So far, VM reported only the number of bytes actually allocated to
each process.  This patch adds two additional fields: the sum of the
byte sizes of all the virtual address ranges in the process, and that
number minus the part of the process stack that is not actually
mapped in.  Unfortunately, we have to guess where the process stack
is, so the second field is not necessarily accurate.

Change-Id: If9e07c20e8588bc3e11601ec79bdcebc06eba6ee
2016-01-13 20:32:41 +01:00
David van Moolenbroek
6b0f33d0fc Kernel: per-process sleep time
Change-Id: I6e08e7db155ed6d51002f0993dbef29ca6d926d1
2016-01-13 20:32:40 +01:00
David van Moolenbroek
1f3ef2b206 Kernel: per-process CPU utilization statistics
See the comment at the top of the new cpuavg.c file for details.

Change-Id: Ic45617d00736931575949b702e98f9a4fd083768
2016-01-13 20:32:39 +01:00
David van Moolenbroek
366d18b2b8 Kernel: per-state CPU accounting
This functionality is required for BSD top(1), as exposed through
the CTL_KERN KERN_CP_TIME sysctl(2) call.  The idea is that the
overall time spent in the system is divided into five categories.
While NetBSD uses a separate category for the kernel ("system") and
interrupts, we redefine "system" to mean userspace system services
and "interrupts" to mean time spent in the kernel, thereby providing
the same categories as MINIX3's own top(1), while adding the "nice"
category which, like on NetBSD, is used for time spent by processes
with a priority lowered by the system administrator.

Change-Id: I2114148d1e07d9635055ceca7b163f337c53c43a
2016-01-13 20:32:38 +01:00
David van Moolenbroek
e4e21ee1b2 Add MIB service, sysctl(2) support
The new MIB service implements the sysctl(2) system call which, as
we adopt more NetBSD code, is an increasingly important part of the
operating system API.  The system call is implemented in the new
service rather than as part of an existing service, because it will
eventually call into many other services in order to gather data,
similar to ProcFS.  Since the sysctl(2) functionality is used even
by init(8), the MIB service is added to the boot image.

MIB stands for Management Information Base, and the MIB service
should be seen as a knowledge base of management information.

The MIB service implementation of the sysctl(2) interface is fairly
complete; it incorporates support for both static and dynamic nodes
and imitates many NetBSD-specific quirks expected by userland.  The
patch also adds trace(1) support for the new system call, and adds
a new test, test87, which tests the fundamental operation of the
MIB service rather thoroughly.

Change-Id: I4766b410b25e94e9cd4affb72244112c2910ff67
2016-01-13 20:32:37 +01:00
David van Moolenbroek
eba1476389 generate_gold_plugin: support for MAKE variable
The user of the script may now override the default name of the
host platform's GNU make utility by passing in a MAKE variable.
Along with the previous commits and upcoming documentation changes,
this fixes #93.

Change-Id: I97fc501413ade50c48ebb5471584f9281ae45a11
2016-01-13 20:32:36 +01:00
David van Moolenbroek
8deb69fca1 Remove llvm-apps scripts
These utilities were already largely broken and are now also obsolete.
In addition, they have too many issues (for example, dependencies on
Linux specifics) to keep around.  The few usable features left in the
clientctl script are not LLVM specific and, if anything, should be
recreated somewhere else.

Change-Id: Id5645cf21837bcee069f560ae72570fb38f75adc
2016-01-13 20:32:35 +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
bcc17a8117 Integrate magic instrumentation into build system
Magic instrumentation is now performed on all system services if the
system is built with MKMAGIC=yes, which implies MKBITCODE=yes.

Change-Id: I9d1233650188b7532a9356b720fb68d5f8248939
2016-01-13 20:32:33 +01:00
David van Moolenbroek
b2ed49a5d8 libmagicrt: integrate into build system
The magic runtime library is now built as part of the regular build, if
the MKMAGIC=yes flag is passed to the build system.  The library has
been renamed from "magic" to "magicrt" to resolve a name clash with BSD
file(1)'s libmagic.  All its level-5 LLVM warnings have been resolved.
 The final library, "libmagicrt.bcc", is now stored in the destination
library directory rather than in the source tree.

Change-Id: Iebd4b93a2cafbb59f95d938ad1edb8b4f6e729f6
2016-01-13 20:32:32 +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
6068a2ee9f mmc/emmc: compile for ARM target only
It was not used or tested on x86 in practice, and the automated arm
tests should obviate the need for a dummy-only x86 implementation.
It should be noted that this change is merely the simplest way to
deal with conflicts with live update (for the second time now).

Change-Id: I6e066c4659c6213cd556144271784588356b140f
2016-01-13 20:32:30 +01:00
David van Moolenbroek
ee0944b45c x86_hdimage: fix -b feature
Change-Id: I0f8ccef5cc8de2e2db52e0967b6bf108bc1e56a7
2016-01-13 20:32:29 +01:00
David van Moolenbroek
1be839e808 magic pass: disable extra isArrayAsStructTy check
The check caused the pass to crash on the new MIB service.

Change-Id: Iad475d4e7368d17ebf6fee32f280b00bd874b780
2016-01-13 20:32:29 +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
David van Moolenbroek
bdb565187c passes: updates for LLVM 3.6.1
This patch also takes the first step to remove backward compatibility
code from the passes.  We only support the in-tree LLVM version.

Change-Id: I7836e524404afba151d1a8bfa539b505e1dbdb8e
2016-01-13 20:32:27 +01:00
David van Moolenbroek
0ce7112c0b flist: add bitcode entries for crypto libraries
Change-Id: Id8238597f5f1b5c9fb0949f26dded30efddd0d4c
2016-01-13 20:32:26 +01:00
Lionel Sambuc
3332c3a555 VFS: fix prototype related warning
Change-Id: Ie01454cdcc0c900916f4b6efd3a965079187509f
2016-01-13 20:32:25 +01:00
Lionel Sambuc
0a390218fa Install xorg.conf which loads all extensions.
Change-Id: I4592dec88703a80e8852690bb004e07e818b1753
2016-01-13 20:32:24 +01:00
Lionel Sambuc
0a4059ee41 Fix weird flock uses
Change-Id: If8593b8f8d6ef2f91a9ad9c3a0b9f0a02d52444d
2016-01-13 20:32:23 +01:00
Lionel Sambuc
6dc59ac7dc fix fts.c on minix
Change-Id: I3888842734756cead342634a0c089001da59f1f7
2016-01-13 20:32:22 +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
Lionel Sambuc
8933525b85 Fix default partition in clientctl.
The partition numbering has changed with the new image creation
framework.

Change-Id: I0644e5879913bee067bc31376f81bc5407f4c81f
2015-10-28 16:06:52 +01:00
rlfnb
2d51bc645f Add boot menu entry to boot an ALIX SBC.
closes #95

Change-Id: Ifb49cb8e4730d50d2d6a33fcb5e9f08ac790b512
2015-10-28 14:01:13 +01:00