]> Zhao Yanbai Git Server - minix.git/log
minix.git
8 years agoFix umount order in setup.sh 79/3279/3
Lionel Sambuc [Thu, 31 Dec 2015 17:41:27 +0000 (18:41 +0100)]
Fix umount order in setup.sh

Change-Id: Ife0c36b0fdc70e4b7ae86278d0df8d6d00d19df4

8 years agotests: add most kyua kernel tests 78/3278/3
Lionel Sambuc [Thu, 31 Dec 2015 10:14:35 +0000 (11:14 +0100)]
tests: add most kyua kernel tests

Change-Id: I2da22559ee3b0208945e21312e7721a32e629d27

8 years agold.elf_so: sysctl support uncommented 77/3277/3
Lionel Sambuc [Wed, 30 Dec 2015 22:22:55 +0000 (23:22 +0100)]
ld.elf_so: sysctl support uncommented

Change-Id: I253f3b4a2ef8c5b3fb332eb98a08d328a9591c52

8 years agold.elf_so: Drop fallback routine 76/3276/3
Lionel Sambuc [Wed, 30 Dec 2015 08:16:54 +0000 (09:16 +0100)]
ld.elf_so: Drop fallback routine

Change-Id: Ia2236146c3302ba992aa6fea0fc9e9699fe9e3cd

8 years agomined: fix buffer overflow in input() 75/3275/3
Thomas Cort [Tue, 22 Dec 2015 03:07:01 +0000 (03:07 +0000)]
mined: fix buffer overflow in input()

input() is used to accept filenames when saving, regular
expressions when searching, and other input. It writes
the characters into buffers such as file and exp_buf and
others which are of length LINE_LEN.

To prevent writing beyond the end of the intended buffer,
truncate the input at LINE_LEN - 1 and ensure that the
string is NULL terminated.

Change-Id: I142baa8cfae38bdd7fa648d86559d6d9b8e7a7fd

8 years agoFix soft faults in FSes resulting in partial I/O 74/3274/3
David van Moolenbroek [Wed, 30 Dec 2015 13:17:42 +0000 (13:17 +0000)]
Fix soft faults in FSes resulting in partial I/O

In order to resolve page faults on file-mapped pages, VM may need to
communicate (through VFS) with a file system.  The file system must
therefore not be the one to cause, and thus end up being blocked on,
such page faults.  To resolve this potential deadlock, the safecopy
system was previously extended with the CPF_TRY flag, which causes the
kernel to return EFAULT to the caller of a safecopy function upon
getting a pagefault, bypassing VM and thus avoiding the loop.  VFS was
extended to repeat relevant file system calls that returned EFAULT,
after resolving the page fault, to keep these soft faults from being
exposed to applications.

However, general UNIX I/O semantics dictate that if an I/O transfer
partially succeeded before running into a failure, the partial result
is to be returned.  Proper file system implementations may therefore
end up returning partial success rather than the EFAULT code resulting
from a soft fault.  Since VFS does not get the EFAULT code in this
case, it does not know that a soft fault occurred, and thus does not
repeat the call either.  The end result is that an application may get
partial I/O results (e.g., a short read(2)) even on regular files.
Applications cannot reasonably be expected to deal with this.

Due to the fact that most of the current file system implementations
do not implement proper partial-failure semantics, this problem is not
yet widespread.  In fact, it has only occurred on direct block device
I/O so far.  However, the next generation of file system services will
be implementing proper I/O semantics, thus exacerbating the problem.

To remedy this situation, this patch changes the CPF_TRY semantics:
whenever the kernel experiences a soft fault during a safecopy call,
in addition to returning FAULT, the kernel also stores a mark in the
grant created with CPF_TRY.  Instead of testing on EFAULT, VFS checks
whether the grant was marked, as part of revoking the grant.  If the
grant was indeed marked by the kernel, VFS repeats the file system
operation, regardless of its initial return value.  Thus, the EFAULT
code now only serves to make the file system fail the call faster.

The approach is currently supported for both direct and magic grants,
but is used only with magic grants - arguably the only case where it
makes sense.  Indirect grants should not have CPF_TRY set; in a chain
of indirect grants, the original grant is marked, as it should be.
In order to avoid potential SMP issues, the mark stored in the grant
is its grant identifier, so as to discard outdated kernel writes.
Whether this is necessary or effective remains to be evaluated.

This patch also cleans up the grant structure a bit, removing reserved
space and thus making the structure slightly smaller.  The structure
is used internally between system services only, so there is no need
for binary compatibility.

Change-Id: I6bb3990dce67a80146d954546075ceda4d6567f8

8 years agolibsys: use linked list for free grants 73/3273/3
David van Moolenbroek [Tue, 29 Dec 2015 15:37:11 +0000 (15:37 +0000)]
libsys: use linked list for free grants

With this change, obtaining an existing free grant is no longer an
operation of O(n) complexity.  As a result, the now-deprecated
getgrant/setgrant part of the grants API also no longer has a
performance advantage.

Change-Id: Ic19308a76924c6242f9784244a6b3600e561e0fe

8 years agoAdd sequence numbers to grant IDs 72/3272/3
David van Moolenbroek [Mon, 28 Dec 2015 23:48:39 +0000 (23:48 +0000)]
Add sequence numbers to grant IDs

The memory grant identifier for safecopies now includes a sequence
number in its upper bits, to prevent accidental reuse of a grant ID
after revocation and subsequent reallocation.  This should increase
overall system robustness by a tiny amount, and possibly help catch
bugs in system services early on.  For now, the lower 20 bits of the
grant ID are used as grant table slot index (thus allowing for up to
a million grants per process), and the next 11 bits of the (signed
32-bit) grant ID are used to store the per-slot sequence number.  As
grant IDs are never exposed to userland, the split can be changed
later on without breaking the userland ABI.

Change-Id: Ic34be27ff2a45db0ea5db037a24eef9efcd9ca40

8 years agoKernel: apply x86 copy overflow check to ARM 71/3271/3
David van Moolenbroek [Tue, 29 Dec 2015 15:58:24 +0000 (15:58 +0000)]
Kernel: apply x86 copy overflow check to ARM

Apply the x86 overflow check from git-d09f72c to ARM code as well.
Not just stack traces, but also system services can trigger this
case, possibly as a result of being handed bad pointers by userland,
ending in a kernel panic.

Change-Id: Ib817e8b682fafec8edb486a094319ad11eda7081

8 years agoKernel: synchronize i386 and ARM clock code 70/3270/3
Lionel Sambuc [Sun, 20 Dec 2015 11:15:50 +0000 (12:15 +0100)]
Kernel: synchronize i386 and ARM clock code

Change-Id: Ie5c4653299e47aaefc9d35a8af491ad0b2eab1ab

8 years agoKernel: convert K&R functions to ANSI 69/3269/3
Dr. Florian Grätz [Thu, 5 Nov 2015 14:39:38 +0000 (15:39 +0100)]
Kernel: convert K&R functions to ANSI

Changed all K&R style functions to ANSI-style declarations within the
kernel directory. The code compiles and aparently works for i386. For
arm my toolchain does not work, but I have changed the code with great
care. Also, the make command fails for the test suite. Therefore, I
strongly recommand to review the code with care.

Edited by David van Moolenbroek to convert really all K&R functions.

Change-Id: I58cde797d36f4caa9c72db4e4dc27d8545ab8866

8 years agoe1000: add i82583V 1000baseT Ethernet 68/3268/3
rlfnb [Tue, 10 Nov 2015 15:04:00 +0000 (16:04 +0100)]
e1000: add i82583V 1000baseT Ethernet

added device id for the i82583V NIC. Tested successful on bare metal.

Change-Id: I486ea60a52a16075a1da8ffa0280884a407acc30

8 years agotrace(1): resolve all level-5 LLVM warnings 67/3267/3
David van Moolenbroek [Thu, 17 Dec 2015 13:50:28 +0000 (13:50 +0000)]
trace(1): resolve all level-5 LLVM warnings

Change-Id: If5ffe97eb0b15387b1ab674657879e13f58fb27e

8 years agoImport NetBSD ipcrm(1) 66/3266/3
David van Moolenbroek [Thu, 17 Dec 2015 13:14:08 +0000 (13:14 +0000)]
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

8 years agoImport NetBSD ipcs(1) 65/3265/3
David van Moolenbroek [Thu, 17 Dec 2015 13:07:17 +0000 (13:07 +0000)]
Import NetBSD ipcs(1)

The old ipcs(1) utility had a dubious license at best.

Change-Id: Ic4c0a24f04c94cc77a43658f6c939d138461bd6a

8 years agoMIB: add support for System V IPC information node 64/3264/3
David van Moolenbroek [Thu, 17 Dec 2015 12:57:54 +0000 (12:57 +0000)]
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

8 years agoIPC server: subscribe to process events on demand 63/3263/3
David van Moolenbroek [Thu, 17 Dec 2015 12:33:40 +0000 (12:33 +0000)]
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

8 years agoIPC server: major fixes, test set for semaphores 62/3262/3
David van Moolenbroek [Thu, 17 Dec 2015 11:34:07 +0000 (11:34 +0000)]
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

8 years agoPM: generic process event publish/subscribe system 61/3261/3
David van Moolenbroek [Sat, 12 Dec 2015 17:22:00 +0000 (17:22 +0000)]
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

8 years agoIPC server: restyle 60/3260/3
David van Moolenbroek [Wed, 25 Nov 2015 22:37:19 +0000 (22:37 +0000)]
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

8 years agoIPC server: NetBSD sync, general improvements 59/3259/3
David van Moolenbroek [Tue, 24 Nov 2015 23:01:22 +0000 (23:01 +0000)]
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

8 years agoIPC server: expose semaphore information 58/3258/2
David van Moolenbroek [Mon, 23 Nov 2015 23:25:27 +0000 (23:25 +0000)]
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

8 years agoImport NetBSD pagesize(1) 57/3257/2
David van Moolenbroek [Thu, 19 Nov 2015 14:59:41 +0000 (14:59 +0000)]
Import NetBSD pagesize(1)

Change-Id: I6a749cba5c6dabb3daea8c5bad3e94be342833d7

8 years agoMIB: slim process tables to reduce memory usage 56/3256/2
David van Moolenbroek [Sun, 8 Nov 2015 12:39:45 +0000 (12:39 +0000)]
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

8 years agoProcFS: get process information from MIB service 55/3255/2
David van Moolenbroek [Sun, 8 Nov 2015 11:56:52 +0000 (11:56 +0000)]
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

8 years agoRename top(1) to mtop(1), import NetBSD top(1) 54/3254/2
David van Moolenbroek [Sun, 8 Nov 2015 11:29:53 +0000 (11:29 +0000)]
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

8 years agoImport NetBSD ps(1) 53/3253/2
David van Moolenbroek [Wed, 28 Oct 2015 22:51:59 +0000 (22:51 +0000)]
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

8 years agoImport NetBSD dev_mkdb(8) 52/3252/2
David van Moolenbroek [Tue, 6 Oct 2015 16:42:46 +0000 (16:42 +0000)]
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

8 years agow(1): switch to libkvm 51/3251/2
David van Moolenbroek [Fri, 9 Oct 2015 20:56:06 +0000 (20:56 +0000)]
w(1): switch to libkvm

Change-Id: I6d836d9aa2e1dfe8df1d866a5cc33868522f767e

8 years agoImport NetBSD libkvm 50/3250/2
David van Moolenbroek [Wed, 28 Oct 2015 17:52:48 +0000 (17:52 +0000)]
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

8 years agoImport NetBSD sysctl(8) 49/3249/2
David van Moolenbroek [Wed, 28 Oct 2015 13:02:34 +0000 (13:02 +0000)]
Import NetBSD sysctl(8)

Change-Id: Idc3a9138521de1329daaab3bd0907a0db0d37775

8 years agoRetire sysuname(2), synchronize sys/utsname.h 48/3248/2
David van Moolenbroek [Fri, 9 Oct 2015 18:34:38 +0000 (18:34 +0000)]
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

8 years agoStart using sysctl(3) throughout userland 47/3247/2
David van Moolenbroek [Wed, 28 Oct 2015 15:06:03 +0000 (15:06 +0000)]
Start using sysctl(3) throughout userland

This patch mostly removes MINIX3-specific workarounds for missing
sysctl support.

Change-Id: I21e35e887359619ba72c252aa43d9017301a46ac

8 years agoMIB: initial tree population 46/3246/2
David van Moolenbroek [Tue, 27 Oct 2015 21:32:33 +0000 (21:32 +0000)]
MIB: initial tree population

Change-Id: I28ef0a81a59faaf341bfc15178df89474779a136

8 years agoPM: restore own proper process group 45/3245/2
David van Moolenbroek [Mon, 2 Nov 2015 19:20:00 +0000 (19:20 +0000)]
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

8 years agoPM: remember when each process was started 44/3244/2
David van Moolenbroek [Mon, 2 Nov 2015 17:45:28 +0000 (17:45 +0000)]
PM: remember when each process was started

Change-Id: I176f01681ebe758b03b635f2b5ecc8f083710bb4

8 years agoVM: report resource usage with VM usage info 43/3243/2
David van Moolenbroek [Wed, 4 Nov 2015 11:10:57 +0000 (11:10 +0000)]
VM: report resource usage with VM usage info

Change-Id: I93e898343e7fb72e75ae74c650b10f2ba570d381

8 years agoVM: expose virtual process size 42/3242/2
David van Moolenbroek [Fri, 9 Oct 2015 18:48:05 +0000 (18:48 +0000)]
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

8 years agoKernel: per-process sleep time 41/3241/2
David van Moolenbroek [Mon, 2 Nov 2015 17:46:16 +0000 (17:46 +0000)]
Kernel: per-process sleep time

Change-Id: I6e08e7db155ed6d51002f0993dbef29ca6d926d1

8 years agoKernel: per-process CPU utilization statistics 40/3240/2
David van Moolenbroek [Mon, 2 Nov 2015 17:43:38 +0000 (17:43 +0000)]
Kernel: per-process CPU utilization statistics

See the comment at the top of the new cpuavg.c file for details.

Change-Id: Ic45617d00736931575949b702e98f9a4fd083768

8 years agoKernel: per-state CPU accounting 39/3239/2
David van Moolenbroek [Sat, 7 Nov 2015 14:42:40 +0000 (14:42 +0000)]
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

8 years agoAdd MIB service, sysctl(2) support 38/3238/2
David van Moolenbroek [Tue, 13 Oct 2015 22:43:53 +0000 (22:43 +0000)]
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

8 years agogenerate_gold_plugin: support for MAKE variable 37/3237/2
David van Moolenbroek [Sat, 14 Nov 2015 03:53:50 +0000 (04:53 +0100)]
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

8 years agoRemove llvm-apps scripts 36/3236/2
David van Moolenbroek [Fri, 13 Nov 2015 11:12:33 +0000 (12:12 +0100)]
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

8 years agoIntegrate ASR instrumentation into build system 35/3235/2
David van Moolenbroek [Fri, 13 Nov 2015 11:08:40 +0000 (12:08 +0100)]
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

8 years agoIntegrate magic instrumentation into build system 34/3234/2
David van Moolenbroek [Fri, 13 Nov 2015 00:29:26 +0000 (01:29 +0100)]
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

8 years agolibmagicrt: integrate into build system 33/3233/2
David van Moolenbroek [Wed, 11 Nov 2015 12:43:01 +0000 (13:43 +0100)]
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

8 years agoRS: allow service program name to be overridden 32/3232/2
David van Moolenbroek [Fri, 13 Nov 2015 10:26:56 +0000 (11:26 +0100)]
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

8 years agommc/emmc: compile for ARM target only 31/3231/2
David van Moolenbroek [Thu, 12 Nov 2015 12:53:32 +0000 (13:53 +0100)]
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

8 years agox86_hdimage: fix -b feature 30/3230/2
David van Moolenbroek [Sat, 14 Nov 2015 04:03:01 +0000 (05:03 +0100)]
x86_hdimage: fix -b feature

Change-Id: I0f8ccef5cc8de2e2db52e0967b6bf108bc1e56a7

8 years agomagic pass: disable extra isArrayAsStructTy check 29/3229/2
David van Moolenbroek [Wed, 11 Nov 2015 04:40:52 +0000 (05:40 +0100)]
magic pass: disable extra isArrayAsStructTy check

The check caused the pass to crash on the new MIB service.

Change-Id: Iad475d4e7368d17ebf6fee32f280b00bd874b780

8 years agoupdate_asr(8): fix argument handling 28/3228/2
David van Moolenbroek [Wed, 11 Nov 2015 04:46:19 +0000 (05:46 +0100)]
update_asr(8): fix argument handling

Passing in labels of specific services did not actually work at all.

Change-Id: I9501bc0206f0ce5cf064f1453fdf171c4c930aae

8 years agopasses: updates for LLVM 3.6.1 27/3227/2
David van Moolenbroek [Wed, 11 Nov 2015 04:38:27 +0000 (05:38 +0100)]
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

8 years agoflist: add bitcode entries for crypto libraries 26/3226/2
David van Moolenbroek [Wed, 11 Nov 2015 04:16:22 +0000 (05:16 +0100)]
flist: add bitcode entries for crypto libraries

Change-Id: Id8238597f5f1b5c9fb0949f26dded30efddd0d4c

8 years agoVFS: fix prototype related warning 25/3225/2
Lionel Sambuc [Sun, 20 Dec 2015 10:00:58 +0000 (11:00 +0100)]
VFS: fix prototype related warning

Change-Id: Ie01454cdcc0c900916f4b6efd3a965079187509f

8 years agoInstall xorg.conf which loads all extensions. 24/3224/2
Lionel Sambuc [Thu, 29 Oct 2015 00:50:57 +0000 (01:50 +0100)]
Install xorg.conf which loads all extensions.

Change-Id: I4592dec88703a80e8852690bb004e07e818b1753

8 years agoFix weird flock uses 23/3223/2
Lionel Sambuc [Thu, 29 Oct 2015 00:49:45 +0000 (01:49 +0100)]
Fix weird flock uses

Change-Id: If8593b8f8d6ef2f91a9ad9c3a0b9f0a02d52444d

8 years agofix fts.c on minix 22/3222/2
Lionel Sambuc [Sat, 24 Oct 2015 23:35:08 +0000 (23:35 +0000)]
fix fts.c on minix

Change-Id: I3888842734756cead342634a0c089001da59f1f7

8 years agoNetBSD re-synchronization of the source tree 20/3220/2
Lionel Sambuc [Thu, 15 Oct 2015 15:01:16 +0000 (17:01 +0200)]
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

8 years agoFix default partition in clientctl. 19/3219/1
Lionel Sambuc [Mon, 12 Oct 2015 18:49:00 +0000 (20:49 +0200)]
Fix default partition in clientctl.

The partition numbering has changed with the new image creation
framework.

Change-Id: I0644e5879913bee067bc31376f81bc5407f4c81f

8 years agoAdd boot menu entry to boot an ALIX SBC. 18/3218/1
rlfnb [Tue, 13 Oct 2015 10:00:09 +0000 (12:00 +0200)]
Add boot menu entry to boot an ALIX SBC.

closes #95

Change-Id: Ifb49cb8e4730d50d2d6a33fcb5e9f08ac790b512

8 years agolibc: fix needless malloc failures 17/3217/2
David van Moolenbroek [Wed, 28 Oct 2015 01:05:39 +0000 (01:05 +0000)]
libc: fix needless malloc failures

The NetBSD libc malloc implementation performs its own out-of-memory
check, presumably for performance reasons.  The check makes a strong
assumption about the address space layout, which is that memory-
mapped pages are always located above the heap.  However, this
assumption does not necessarily hold on MINIX3, thus resulting in
malloc reporting an out-of-memory condition without the system
actually being out of memory at all.  Evidence suggests that in
particular dynamically linked (i.e., pkgsrc) binaries were affected
by this issue - most notably git.

Change-Id: If542fbace0a1cce12aa9e075d51992cbbbf26e94

8 years agoSplit minix distribution set 16/3216/6
Jean-Baptiste Boric [Wed, 16 Sep 2015 14:00:24 +0000 (16:00 +0200)]
Split minix distribution set

The minix set is now divided into minix-base, minix-comp, minix-games,
minix-kernel, minix-man and minix-tests.

This allows massive space savings on the installlation CD because only
the base system used for installation is stored uncompressed. Also, it
makes the system more modular.

Change-Id: Ic8d168b4c3112204013170f07245aef98aaa51e7

8 years agoUpgrade releasetools/sort_set 15/3215/4
Lionel Sambuc [Fri, 9 Oct 2015 12:36:26 +0000 (14:36 +0200)]
Upgrade releasetools/sort_set

 - retire the old shell script
 - import perl script

The perl scripts has the following advantages:
 - The sorting should be more stable, even accross different OSes.
 - The sorted output is automatically formatted into columns
 - It is much faster, even on large inputs.

Change-Id: I1068b21fda981b4cf9eeea4af83165ec2968280b

8 years agoNew image framework generation 14/3214/2
Jean-Baptiste Boric [Mon, 14 Sep 2015 19:46:48 +0000 (21:46 +0200)]
New image framework generation

The CD now boots directly from the ISO 9660 filesystem instead of using
MBR partitioning with Minix file systems. This saves some space on the
CD and reduces memory requirements by some unknown amount as the root
ramdisk is completely eliminated.

The x86 hard drive image creation is also rewritten in the same
fashion.

The setup is modified to be more NetBSD-like (unpacking sets
tarballs instead of blindly copying the CD contents). Splitting MINIX
into sets is done in another commit due to it being a nightmare to
rebase.

Since MINIX lacks union mounts for now, a bunch of ramdisks are
generated at run-time to make parts of the filesystem writeable for the
CD. This solution isn't ideal, but it's enough for an installation CD.

Change-Id: Icbd9cca4dafebf7b42c345b107a17679a622d5cd

8 years agopkg_install: Set default paths as expected on MINIX 13/3213/1
Lionel Sambuc [Fri, 9 Oct 2015 13:46:08 +0000 (15:46 +0200)]
pkg_install: Set default paths as expected on MINIX

Change-Id: I97568cb5c92d14b7175ba0ed0f3efb2009d0c455

8 years agoramdisk: fix command output to stdout 12/3212/1
Jean-Baptiste Boric [Tue, 15 Sep 2015 10:59:13 +0000 (12:59 +0200)]
ramdisk: fix command output to stdout

Change-Id: I58a8cf2cd05b71dbbc1784c7d5770279392e3a8b

8 years agoAdd installboot to host tools 11/3211/1
Jean-Baptiste Boric [Thu, 10 Sep 2015 22:02:37 +0000 (00:02 +0200)]
Add installboot to host tools

Change-Id: I5594cfdb13362b51f86b9ef76e82c21402c47f8d

8 years agoAdd makefs to host tools 10/3210/1
Jean-Baptiste Boric [Fri, 11 Sep 2015 09:48:57 +0000 (11:48 +0200)]
Add makefs to host tools

Change-Id: I217c0b6f1a78622636d541fa80b93b6d148e3681

8 years agoImport pkg_install from NetBSD 09/3209/1
Jean-Baptiste Boric [Fri, 11 Sep 2015 09:07:35 +0000 (11:07 +0200)]
Import pkg_install from NetBSD

Change-Id: I9a3071b94dd2e9bfe2e3b162994e06ae10077b5a

8 years agoImporting crypto libraries 08/3208/1
Lionel Sambuc [Wed, 7 Oct 2015 00:45:38 +0000 (00:45 +0000)]
Importing crypto libraries

 - crypto/external/bsd/heimdal
 - crypto/external/bsd/libsaslc
 - crypto/external/bsd/netpgp
 - crypto/external/bsd/openssl

Change-Id: I91dbf05f33e637edf5b9bb408d5baddd7ba8cf75

8 years agoisofs: reworked for better performance 89/2989/2
Jean-Baptiste Boric [Wed, 16 Sep 2015 12:36:11 +0000 (14:36 +0200)]
isofs: reworked for better performance

isofs now uses an in-memory directory listing built on-the-fly instead
of parsing the ISO 9660 data structures over and over for almost every
request. This yields huge performance improvements.

The directory listing is allocated dynamically, but Minix servers aren't
normally supposed to do that because critical servers would crash if the
system runs out of memory. isofs is quite frugal, won't allocate memory
after having the whole directory tree cached and is not that critical
(its most important job is to serve as a root file system during
installation).

The benefits and elegance of this scheme far outweights this small
problem in practice.

Change-Id: I13d070388c07d274cbee0645cbc50295c447c5b6

8 years agomakefs: apply NetBSD PR kern/48852 patch 88/2988/2
Jean-Baptiste Boric [Thu, 23 Apr 2015 15:30:57 +0000 (17:30 +0200)]
makefs: apply NetBSD PR kern/48852 patch

It's a fix for correcting cd9660 device node creation in makefs. This
fix was commited in NetBSD on May 30, 2014, after the current NetBSD
source code import, hence the cherrypicking.

Change-Id: Id3e05618688bbd6d07780f46f6ada90525556b5a

8 years agoImport makefs from NetBSD 87/2987/2
Jean-Baptiste Boric [Thu, 10 Sep 2015 21:45:24 +0000 (23:45 +0200)]
Import makefs from NetBSD

Change-Id: I0ebcc9d0168df9d26cfb0af0fce2bc894ce688af

8 years agolibutil: add getmaxpartitions() implementation 07/3207/1
Jean-Baptiste Boric [Fri, 11 Sep 2015 08:52:26 +0000 (10:52 +0200)]
libutil: add getmaxpartitions() implementation

Change-Id: I6f1d7838e10bcb079fb5b68ff513c3279fffb4f9

8 years agoFix gcc -O1 builds for ARM 06/3206/1
Lionel Sambuc [Sun, 4 Oct 2015 10:47:57 +0000 (03:47 -0700)]
Fix gcc -O1 builds for ARM

The builds are failing as GCC somehow thinks ino might be
uninitialized before use.

Change-Id: Id99fd5e46bcbaafd5001752e16c3f77c1d568556

8 years agoImport NetBSD time(1) 05/3205/2
David van Moolenbroek [Mon, 28 Sep 2015 11:41:16 +0000 (11:41 +0000)]
Import NetBSD time(1)

Change-Id: I035d21a926aa82434c24a84b914bd58ac064e66a

8 years agoImport NetBSD csh(1) 04/3204/2
David van Moolenbroek [Mon, 28 Sep 2015 11:36:43 +0000 (11:36 +0000)]
Import NetBSD csh(1)

Jobctl warning commented out.  Largely untested.

Change-Id: I4dffe23a2855a374628c820703b51591633aed64

8 years agoPM: add support for wait4(2) 03/3203/2
David van Moolenbroek [Mon, 28 Sep 2015 11:11:55 +0000 (11:11 +0000)]
PM: add support for wait4(2)

This patch adds support for the wait4 system call, and with that the
wait3 call as well.  The implementation is absolutely minimal: only
user and system times of the exited child are returned (with all other
rusage fields left zero), and there is no support for tracers.  Still,
this should cover the main use cases of wait4.

Change-Id: I7a04589a8423a23990ab39aa38e85d535556743a

8 years agoRework getrusage(2) infrastructure 02/3202/1
David van Moolenbroek [Sun, 27 Sep 2015 17:32:10 +0000 (17:32 +0000)]
Rework getrusage(2) infrastructure

- the userland call is now made to PM only, and PM relays the call to
  other servers as appropriate; this is an ABI change that will
  ultimately allow us to add proper support for wait3() and the like;
  for the moment there is backward compatibility;
- the getrusage-specific kernel subcall has been removed, as it
  provided only redundant functionality, and did not provide the means
  to be extended correctly in the future - namely, allowing the kernel
  to return different values depending on whether resource usage of
  the caller (self) or its children was requested;
- VM is now told whether resource usage of the caller (self) or its
  children is requested, and it refrains from filling in wrong values
  for information it does not have;
- VM now uses the correct unit for the ru_maxrss values;
- VFS is cut out of the loop entirely, since it does not provide any
  values at the moment; a comment explains how it should be readded.

Change-Id: I27b0f488437dec3d8e784721c67b03f2f853120f

8 years agogetrusage(2): zero out ru_nsignals field 01/3201/1
David van Moolenbroek [Sun, 27 Sep 2015 15:00:19 +0000 (15:00 +0000)]
getrusage(2): zero out ru_nsignals field

The current value was both wrong (counting spawned kernel signals
rather than delivered user signals) and returned for the calling
process even if the request was for the process's children.
For now we are better off not populating this field at all.

Change-Id: I6c660be266b5746b7c3db57ae88fa7f872961ee2

8 years agogetrusage(2): zero out ru_i[xds]rss fields 00/3200/1
David van Moolenbroek [Sun, 27 Sep 2015 11:28:56 +0000 (11:28 +0000)]
getrusage(2): zero out ru_i[xds]rss fields

The current values were both inaccurate (especially for dynamically
linked executables) and using the wrong unit (bytes, instead of
kilobytes times ticks-of-execution).  For now we are better off not
populating these fields at all.

Change-Id: I195a8fa8db909e64a833eec25f59c9ee0b89bdc5

8 years agoPM: make child time accumulation POSIX compliant 99/3199/1
David van Moolenbroek [Sun, 27 Sep 2015 12:32:23 +0000 (12:32 +0000)]
PM: make child time accumulation POSIX compliant

POSIX states that times() and getrusage() should only return child
user and system times of terminated children for which wait*() has
returned their PIDs.

Change-Id: I38e19ad71543a3b91e944bef8e4e1bd903de51bf

8 years agocommands: move manpages into command directories 97/3197/4
David van Moolenbroek [Fri, 25 Sep 2015 12:15:49 +0000 (12:15 +0000)]
commands: move manpages into command directories

Change-Id: Icf8a2d26629a1822725022c9ee21c587d3c4c3b4

8 years agoFix noassert builds 98/3198/2
Lionel Sambuc [Fri, 25 Sep 2015 19:22:27 +0000 (12:22 -0700)]
Fix noassert builds

Change-Id: I5626950ffa29afe7a0fb9e9144839b311824da92

8 years agolibpuffs: clean up, unbreak 96/3196/1
David van Moolenbroek [Tue, 22 Sep 2015 12:41:58 +0000 (12:41 +0000)]
libpuffs: clean up, unbreak

- move MINIX3-specific files into minix/lib/libpuffs;
- resynchronize the remaining files with NetBSD code;
- remove a few unnecessary changes;
- put remaining MINIX3-specific changes in __minix blocks;
- sort out the source files being linked at all.

The result is that libpuffs now successfully links against FUSE
file system programs again.  It can successfully mount, perform
some of the most basic operations, and unmount the file system.

Change-Id: Ieac220f7ad8c4d1fa293abda81967e8045be0bb4

8 years agoResolve more warnings 95/3195/1
David van Moolenbroek [Mon, 21 Sep 2015 17:14:39 +0000 (17:14 +0000)]
Resolve more warnings

Change-Id: Ibc1b7f7cd45ad7295285e59c6ce55888266fece8

8 years agoImport NetBSD flock(1) 94/3194/1
David van Moolenbroek [Tue, 15 Sep 2015 20:42:11 +0000 (20:42 +0000)]
Import NetBSD flock(1)

Also fix the MINIX3 libc flock(3) implementation.

Change-Id: Ia80280029968786d7f029940ec02e942057701bd

8 years agoswifi: various improvements 93/3193/1
David van Moolenbroek [Tue, 2 Oct 2012 15:49:23 +0000 (15:49 +0000)]
swifi: various improvements

- no longer inject fewer faults than instructed;
- no longer apply a limit on the number of injected faults;
- refactory to allow for random faults (type 99);
- also allow for stop faults (type 50);
- massive dead code cleanup;
- move outdated test cruft into tests/ subdirectory; it is kept only
  as an example of how to use swifi.

Change-Id: I8a3cb71902dfaadb7bf785723b917307db83d0d5

8 years agoDeprivilege some network commands 92/3192/1
David van Moolenbroek [Sun, 20 Sep 2015 16:46:38 +0000 (16:46 +0000)]
Deprivilege some network commands

At the very least, these can be used to test for the existence of
files not normally accessible by unprivileged users.

Change-Id: I054cf6d033a1604bbbc871db37103a67067abe84

8 years agocommands: resolve compiler warnings 91/3191/3
David van Moolenbroek [Sun, 20 Sep 2015 12:13:58 +0000 (12:13 +0000)]
commands: resolve compiler warnings

Change-Id: I95f0d0c48f998d4d950a0800eedd5fbbf2e50423

8 years agoRetire decomp16(1) 90/3190/2
David van Moolenbroek [Sun, 20 Sep 2015 15:35:48 +0000 (15:35 +0000)]
Retire decomp16(1)

Change-Id: I455aac47b3efa4ffa5cc8305c6760f92e1e8642a

8 years agoRetire ci(1), co(1), svclog(1) 89/3189/2
David van Moolenbroek [Sun, 20 Sep 2015 15:33:41 +0000 (15:33 +0000)]
Retire ci(1), co(1), svclog(1)

Change-Id: I1bd1d92b9aacd4dfc4843c423862ae540fe2b557

8 years agofbdctl(8): move to proper location 88/3188/2
David van Moolenbroek [Sat, 19 Sep 2015 23:06:10 +0000 (23:06 +0000)]
fbdctl(8): move to proper location

- move from minix/commands to minix/usr.sbin;
- install into /usr/sbin instead of /usr/bin;
- move manual page into source directory;
- resolve compilation warning;
- convert to KNF.

Change-Id: I1206b52e8804a68a3a80f6d7f63916e7fcdc9e3f

8 years agodiskctl(8): move to proper location 87/3187/2
David van Moolenbroek [Sat, 19 Sep 2015 22:39:59 +0000 (22:39 +0000)]
diskctl(8): move to proper location

- move from minix/commands to minix/usr.sbin;
- install into /usr/sbin instead of /usr/bin;
- move manual page into source directory;
- resolve compilation warning;
- convert to KNF.

Change-Id: Iccb4a8b27ae220254bae19e9198478b40706f542

8 years agobtrace(8): move to proper location 86/3186/2
David van Moolenbroek [Sat, 19 Sep 2015 22:31:13 +0000 (22:31 +0000)]
btrace(8): move to proper location

- move from minix/commands to minix/usr.sbin;
- install into /usr/sbin instead of /usr/bin;
- move manual page into source directory;
- resolve compilation warning;
- convert to KNF.

Change-Id: I08c16998bd499a468799a6587f6fe45f42590461

8 years agoMove OpenBSD diff(1) into minix/usr.bin 85/3185/2
David van Moolenbroek [Sat, 19 Sep 2015 23:21:24 +0000 (23:21 +0000)]
Move OpenBSD diff(1) into minix/usr.bin

Editor's note: NetBSD uses GNU diff.

Change-Id: I15d4441c73e0c626d0e5fda8c8683d131fbcbc38

8 years agolibfetch: switch to external/bsd version 84/3184/2
David van Moolenbroek [Sat, 19 Sep 2015 23:46:56 +0000 (23:46 +0000)]
libfetch: switch to external/bsd version

Change-Id: I7eb6fbf0ae6c008e399fe9bffdfc2b98dfed3432

8 years agoUpdate, move NetBSD find(1) 83/3183/2
David van Moolenbroek [Sat, 19 Sep 2015 23:17:55 +0000 (23:17 +0000)]
Update, move NetBSD find(1)

Change-Id: Iccda44465d49dba407d1ac1b1ced8aa8b4e6d8aa

8 years agoImport NetBSD cmp 82/3182/2
David van Moolenbroek [Sun, 20 Sep 2015 11:18:45 +0000 (11:18 +0000)]
Import NetBSD cmp

Change-Id: I0e7f6c69742db475ddba6a9159f167a53d151169