6853 Commits

Author SHA1 Message Date
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
David van Moolenbroek
2e23f1755e 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
2015-10-28 01:13:04 +00:00
Jean-Baptiste Boric
2d6bbeb0b9 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
2015-10-12 11:25:54 +02:00
Lionel Sambuc
240e6259de 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
2015-10-10 23:58:31 +02:00
Jean-Baptiste Boric
69eead77ff 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
2015-10-10 19:09:35 +02:00
Lionel Sambuc
b5400f9ff4 pkg_install: Set default paths as expected on MINIX
Change-Id: I97568cb5c92d14b7175ba0ed0f3efb2009d0c455
2015-10-09 15:49:42 +02:00
Jean-Baptiste Boric
9dfdf6f7ba ramdisk: fix command output to stdout
Change-Id: I58a8cf2cd05b71dbbc1784c7d5770279392e3a8b
2015-10-08 12:11:03 +02:00
Jean-Baptiste Boric
9af3a794f6 Add installboot to host tools
Change-Id: I5594cfdb13362b51f86b9ef76e82c21402c47f8d
2015-10-08 12:10:51 +02:00
Jean-Baptiste Boric
43afffcd77 Add makefs to host tools
Change-Id: I217c0b6f1a78622636d541fa80b93b6d148e3681
2015-10-08 11:58:39 +02:00
Jean-Baptiste Boric
a824f5a100 Import pkg_install from NetBSD
Change-Id: I9a3071b94dd2e9bfe2e3b162994e06ae10077b5a
2015-10-07 23:48:43 +02:00
Lionel Sambuc
ebfedea0ce Importing crypto libraries
- crypto/external/bsd/heimdal
 - crypto/external/bsd/libsaslc
 - crypto/external/bsd/netpgp
 - crypto/external/bsd/openssl

Change-Id: I91dbf05f33e637edf5b9bb408d5baddd7ba8cf75
2015-10-07 23:37:12 +02:00
Jean-Baptiste Boric
b1d068470b 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
2015-10-07 12:40:24 +02:00
Jean-Baptiste Boric
3472022b8b 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
2015-10-07 12:40:05 +02:00
Jean-Baptiste Boric
9f988b7934 Import makefs from NetBSD
Change-Id: I0ebcc9d0168df9d26cfb0af0fce2bc894ce688af
2015-10-07 12:39:44 +02:00
Jean-Baptiste Boric
22ad44d6a9 libutil: add getmaxpartitions() implementation
Change-Id: I6f1d7838e10bcb079fb5b68ff513c3279fffb4f9
2015-10-07 12:36:36 +02:00
Lionel Sambuc
41a30155b9 Fix gcc -O1 builds for ARM
The builds are failing as GCC somehow thinks ino might be
uninitialized before use.

Change-Id: Id99fd5e46bcbaafd5001752e16c3f77c1d568556
2015-10-04 03:47:57 -07:00
David van Moolenbroek
b7f0178aeb Import NetBSD time(1)
Change-Id: I035d21a926aa82434c24a84b914bd58ac064e66a
2015-09-29 18:16:14 +00:00
David van Moolenbroek
d1e4d7ce7d Import NetBSD csh(1)
Jobctl warning commented out.  Largely untested.

Change-Id: I4dffe23a2855a374628c820703b51591633aed64
2015-09-29 18:15:52 +00:00
David van Moolenbroek
29346ab043 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
2015-09-29 18:15:28 +00:00
David van Moolenbroek
bc2d75fa05 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
2015-09-28 14:06:59 +00:00
David van Moolenbroek
0f8e20a12c 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
2015-09-28 14:06:58 +00:00
David van Moolenbroek
cd27b2627a 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
2015-09-28 14:06:58 +00:00
David van Moolenbroek
0f5c95a00b 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
2015-09-28 14:06:57 +00:00
David van Moolenbroek
b80da2a01d commands: move manpages into command directories
Change-Id: Icf8a2d26629a1822725022c9ee21c587d3c4c3b4
2015-09-28 14:06:06 +00:00
Lionel Sambuc
81b1f87117 Fix noassert builds
Change-Id: I5626950ffa29afe7a0fb9e9144839b311824da92
2015-09-25 15:47:43 -07:00
David van Moolenbroek
ba736c7968 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
2015-09-23 12:05:03 +00:00
David van Moolenbroek
7c48de6cc4 Resolve more warnings
Change-Id: Ibc1b7f7cd45ad7295285e59c6ce55888266fece8
2015-09-23 12:04:58 +00:00
David van Moolenbroek
9488aa4c04 Import NetBSD flock(1)
Also fix the MINIX3 libc flock(3) implementation.

Change-Id: Ia80280029968786d7f029940ec02e942057701bd
2015-09-23 12:03:13 +00:00
David van Moolenbroek
875abb8724 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
2015-09-23 12:03:12 +00:00
David van Moolenbroek
32b187558b 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
2015-09-23 12:03:12 +00:00