]> Zhao Yanbai Git Server - minix.git/log
minix.git
9 years agoinet: resolve some compile and runtime warnings 71/3071/1
David van Moolenbroek [Tue, 1 Sep 2015 16:20:18 +0000 (16:20 +0000)]
inet: resolve some compile and runtime warnings

- ping(1) triggers warnings about unimplemented exceptions for select;
  even if there could be a useful implementation (which is doubtful),
  the warnings are not helping anyone right now;
- the clock_t data type has changed.

Change-Id: Ie5b1383e7657e8501f63bb4b9d255c6502567a15

9 years agoVFS: workaround to allow TIOCSCTTY on PTYs 70/3070/1
David van Moolenbroek [Tue, 1 Sep 2015 11:42:03 +0000 (11:42 +0000)]
VFS: workaround to allow TIOCSCTTY on PTYs

Fix /dev/tty-related issues in tmux(1) by hardcoding the PTY major
in VFS in addition to the TTY major.  Even though this is exactly
what we did NOT want to have to do, the actual fix for this issue
is going to take a little longer.

Change-Id: I24c75eaf688b9ebd28e931f2e445b8442cfdac78

9 years agoVFS: make message pointer management more robust 69/3069/1
David van Moolenbroek [Mon, 10 Aug 2015 16:07:31 +0000 (18:07 +0200)]
VFS: make message pointer management more robust

The previous approach of storing pointers to messages structures for
thread-blocking sendrec operations relied on several assumptions,
which if violated could lead to odd cases of memory corruption.
With this patch, VFS resets pointers right after use, avoiding that
any dangling pointers are accidentally dereferenced later.  This
approach was already used in some cases, but not all of them.

Change-Id: I752d994ea847b46228bd2ccf4e537deceb78fbaf

9 years agoVFS: check X bit, not R bit, opening executables 68/3068/1
David van Moolenbroek [Mon, 31 Aug 2015 12:12:28 +0000 (12:12 +0000)]
VFS: check X bit, not R bit, opening executables

For dynamically linked executables, the interpreter is passed a
file descriptor of the binary being executed.  To this end, VFS
opens the target executable, but opening the file fails if it is
not readable, even when it is executable.  With this patch, when
opening the executable, it verifies the X bit rather than the R
bit on the file, thus allowing the execution of dynamically
linked binaries that are executable but not readable.

Add test86 to verify correctness.

Change-Id: If3514add6a33b33d52c05a0a627d757bff118d77

9 years agoVFS: tweak coredump wrapper code 67/3067/1
David van Moolenbroek [Mon, 31 Aug 2015 12:01:26 +0000 (12:01 +0000)]
VFS: tweak coredump wrapper code

Change-Id: I6c1f50910d906b25f6df2b48f2cbfb899850924e

9 years agoVFS: resolve noassert warning 66/3066/1
David van Moolenbroek [Mon, 31 Aug 2015 11:24:21 +0000 (11:24 +0000)]
VFS: resolve noassert warning

Change-Id: I647f5a7b3c2935be3df032873705be83de9aaffb

9 years agosched: simplify 65/3065/1
David van Moolenbroek [Mon, 24 Aug 2015 07:20:26 +0000 (09:20 +0200)]
sched: simplify

- do not use timers when there is only ever one timer;
- do not include kernel header files for no reason;
- do not reply to notifications ever.

Change-Id: I5817e22c1b46c4e30e5135069df318af0b4f87fd

9 years agoDS: fix regex memory leaks 64/3064/1
David van Moolenbroek [Mon, 24 Aug 2015 10:18:40 +0000 (12:18 +0200)]
DS: fix regex memory leaks

The regcomp(3) calls had no matching regfree(3) calls.

Change-Id: I5250d62e6ab22821aff18bcdc336cb485df6868e

9 years agolibminixfs: rework prefetch API 63/3063/2
David van Moolenbroek [Sat, 4 Apr 2015 15:55:48 +0000 (15:55 +0000)]
libminixfs: rework prefetch API

This patch changes the prefetch API so that file systems must now
provide a set of block numbers, rather than a set of buffers.  The
result is a leaner and more well-defined API; linear computation of
the range of blocks to prefetch; duplicates no longer interfering
with the prefetch process; guaranteed inclusion of the block needed
next into the prefetch range; and, limits and policy decisions better
established by libminixfs now actually being moved into libminixfs.

Change-Id: I7e44daf2d2d164bc5e2f1473ad717f3ff0f0a77f

9 years agolibminixfs: better support for read errors and EOF 62/3062/2
David van Moolenbroek [Sun, 29 Mar 2015 16:57:53 +0000 (16:57 +0000)]
libminixfs: better support for read errors and EOF

- The lmfs_get_block*(3) API calls may now return an error.  The idea
  is to encourage a next generation of file system services to do a
  better job at dealing with block read errors than the MFS-derived
  implementations do.  These existing file systems have been changed
  to panic immediately upon getting a block read error, in order to
  let unchecked errors cause corruption.  Note that libbdev already
  retries failing I/O operations a few times first.

- The libminixfs block device I/O module (bio.c) now deals properly
  with end-of-file conditions on block devices.  Since a device or
  partition size may not be a multiple of the root file system's block
  size, support for partial block retrival has been added, with a new
  internal lmfs_get_partial_block(3) call.  A new test program,
  test85, tests the new handling of EOF conditions when reading,
  writing, and memory-mapping a block device.

Change-Id: I05e35b6b8851488328a2679da635ebba0c6d08ce

9 years agolibminixfs: keep track of block usage 61/3061/2
David van Moolenbroek [Sun, 29 Mar 2015 15:26:23 +0000 (15:26 +0000)]
libminixfs: keep track of block usage

This patch changes the libminixfs API and implementation such that the
library is at all times aware of how many total and used blocks there
are in the file system.  This removes the last upcall of libminixfs
into file systems (fs_blockstats).  In the process, make this part of
the libminixfs API a little prettier and more robust.  Change file
systems accordingly.  Since this change only adds to MFS being unable
to deal with zones and blocks having different sizes, fail to mount
such file systems immediately rather than triggering an assert later.

Change-Id: I078e589c7e1be1fa691cf391bf5dfddd1baf2c86

9 years agolibminixfs: miscellaneous API cleanup 60/3060/2
David van Moolenbroek [Sat, 28 Mar 2015 00:45:28 +0000 (00:45 +0000)]
libminixfs: miscellaneous API cleanup

Mostly removal of unused parameters from calls.

Change-Id: I0eb7b568265d1669492d958e78b9e69d7cf6fc05

9 years agolibminixfs: do not flush blocks that are in use 59/3059/1
David van Moolenbroek [Sun, 29 Mar 2015 12:30:45 +0000 (12:30 +0000)]
libminixfs: do not flush blocks that are in use

This removes an implicit requirement for the way the libminixfs API is
to be used, namely that a block is to be marked as dirty only once its
contents have been fully updated, within a single get_block/put_block
window.  The requirement may not be appropriate for all file systems.

Change-Id: I6a129d51b1a5e9aec1572039dc7c1c82dd795db5

9 years agolibminixfs: add support for peeking blocks 58/3058/1
David van Moolenbroek [Fri, 27 Mar 2015 20:00:55 +0000 (20:00 +0000)]
libminixfs: add support for peeking blocks

With this change, the lmfs_get_block*(3) functions allow the caller to
specify that it only wants the block if it is in the cache or the
secondary VM cache.  If the block is not found there, the functions
return NULL.  Previously, the PREFETCH method would be used to this
end instead, which was both abuse in name and less efficient.

Change-Id: Ieb5a15b67fa25d2008a8eeef9d126ac908fc2395

9 years agolibminixfs: add support for memory-mapped holes 57/3057/1
David van Moolenbroek [Thu, 13 Aug 2015 12:23:06 +0000 (12:23 +0000)]
libminixfs: add support for memory-mapped holes

When VM asks a file system to provide a block to satisfy a page fault
on a file memory mapping, the file system previously had no way to
inform VM that the block is a hole, since there is no corresponding
block on the underlying device.  To work around this, MFS and ext2
would actually allocate a block for the hole when asked by VM, which
not only defeats the point of holes in the first place, but also does
not work on read-only file systems.  With this patch, a new libminixfs
call allows the file system to inform VM about holes.  This issue does
raise the question as to whether the VM cache is using the right data
structures, since there are now two places where we have to fake a
device offset.  This will have to be revisited in the future.

The patch changes file systems accordingly, and adds a test to test74.

Change-Id: Ib537d56b3f30a8eb05bc1f63c92b5c7428d18f4c

9 years agolibminixfs/VM: fix memory-mapped file corruption 56/3056/1
David van Moolenbroek [Thu, 13 Aug 2015 11:29:33 +0000 (11:29 +0000)]
libminixfs/VM: fix memory-mapped file corruption

This patch employs one solution to resolve two independent but related
issues.  Both issues are the result of one fundamental aspect of the
way VM's memory mapping works: VM uses its cache to map in blocks for
memory-mapped file regions, and for blocks already in the VM cache, VM
does not go to the file system before mapping them in.  To preserve
consistency between the FS and VM caches, VM relies on being informed
about all updates to file contents through the block cache.  The two
issues are both the result of VM not being properly informed about
such updates:

 1. Once a file system provides libminixfs with an inode association
    (inode number + inode offset) for a disk block, this association
    is not broken until a new inode association is provided for it.
    If a block is freed and reallocated as a metadata (non-inode)
    block, its old association is maintained, and may be supplied to
    VM's secondary cache.  Due to reuse of inodes, it is possible
    that the same inode association becomes valid for an actual file
    block again.  In that case, when that new file is memory-mapped,
    under certain circumstances, VM may end up using the metadata
    block to satisfy a page fault on the file, due to the stale inode
    association.  The result is a corrupted memory mapping, with the
    application seeing data other than the current file contents
    mapped in at the file block.

 2. When a hole is created in a file, the underlying block is freed
    from the device, but VM is not informed of this update, and thus,
    if VM's cache contains the block with its previous inode
    association, this block will remain there.  As a result, if an
    application subsequently memory-maps the file, VM will map in the
    old block at the position of the hole, rather than an all-zeroes
    block.  Thus, again, the result is a corrupted memory mapping.

This patch resolves both issues by making the file system inform the
minixfs library about blocks being freed, so that libminixfs can
break the inode association for that block, both in its own cache and
in the VM cache.  Since libminixfs does not know whether VM has the
block in its cache or not, it makes a call to VM for each block being
freed.  Thus, this change introduces more calls to VM, but it solves
the correctness issues at hand; optimizations may be introduced
later.  On the upside, all freed blocks are now marked as clean,
which should result in fewer blocks being written back to the device,
and the blocks are removed from the caches entirely, which should
result in slightly better cache usage.

This patch is necessary but not sufficient to resolve the situation
with respect to memory mapping of file holes in general.  Therefore,
this patch extends test 74 with a (rather particular but effective)
test for the first issue, but not yet with a test for the second one.

This fixes #90.

Change-Id: Iad8b134d2f88a884f15d3fc303e463280749c467

9 years agolibminixfs: add support for 64-bit block numbers 55/3055/1
David van Moolenbroek [Mon, 30 Mar 2015 10:44:09 +0000 (10:44 +0000)]
libminixfs: add support for 64-bit block numbers

There are currently no devices out there that require this change.
The change is merely needed to support subsequent changes.

Change-Id: I64214c5f46ff4a2260815d15c15e4a17709b9036

9 years agoVFS: merge scratchpad into fproc 54/3054/1
David van Moolenbroek [Mon, 10 Aug 2015 22:28:00 +0000 (22:28 +0000)]
VFS: merge scratchpad into fproc

There is no reason to keep these tightly coupled data structures
separate.  Moreover, there is no reason to have a union of file
descriptor and file pointer, since the second can be derived from
the first.  The result are somewhat cleaner VFS internals.

Change-Id: I854da7d8291177878eecfc3077ef0a9e0cc82aaa

9 years agoservice(8): no need to include kernel headers 53/3053/1
David van Moolenbroek [Thu, 13 Aug 2015 13:31:21 +0000 (13:31 +0000)]
service(8): no need to include kernel headers

Change-Id: I8fb7a1a58457909b7759a74925a12cf9b11261f0

9 years agoRestore and expand NONE_MAJOR comment 52/3052/1
David van Moolenbroek [Thu, 13 Aug 2015 13:40:38 +0000 (13:40 +0000)]
Restore and expand NONE_MAJOR comment

This fixes #50.

Change-Id: I318d08e8c57c12cfd409700b14c88a90c81a1715

9 years agoetc: create system log files 51/3051/2
David van Moolenbroek [Mon, 10 Aug 2015 10:22:40 +0000 (12:22 +0200)]
etc: create system log files

The new syslogd(8) does not create log files that do not already
exist, and thus, we adopt the NetBSD way of creating them.

Change-Id: Icd7fdba362726696df6a52dd55c049fd2bfcc2d3

9 years agolwip: no need to retrieve own endpoint 50/3050/1
David van Moolenbroek [Sat, 18 Jul 2015 08:07:19 +0000 (10:07 +0200)]
lwip: no need to retrieve own endpoint

Change-Id: I86bd20be9b1aec4116edbe112eb562737860568f

9 years agoKernel: correctly set USE_ defines from Makefile 49/3049/1
David van Moolenbroek [Fri, 17 Jul 2015 21:30:17 +0000 (23:30 +0200)]
Kernel: correctly set USE_ defines from Makefile

Without defining these to 1, #if statements on them will fail.

Change-Id: Ifc4824a6ffacc4bebcfd6f1110c864d7eb16401a

9 years agolibsys: add Tomas Hruby's asynsend barrier 48/3048/1
David van Moolenbroek [Wed, 15 Jul 2015 01:10:35 +0000 (03:10 +0200)]
libsys: add Tomas Hruby's asynsend barrier

This barrier ensures that all fields of an asynchronously sent
message are properly initialized before the message is marked as
valid.

Change-Id: I7b9590c11c4e040c8f992f1dd2581e54201bf214

9 years agoKernel: fix async message failure handling crash 47/3047/1
David van Moolenbroek [Mon, 13 Jul 2015 06:14:33 +0000 (08:14 +0200)]
Kernel: fix async message failure handling crash

If an asynchronous message is delivered during an ipc_receive(2) call,
but a failure occurred while copying out the status to the sending
process, then the receiving process would be left in an inconsistent
state, leading to a kernel crash shortly after.

For now, we fix this by altogether ignoring errors while copying out
the status field to the sending process.  While this resolves the
kernel crash, it is hardly ideal, since it will likely cause the same
message to be delivered repeatedly.  It would be better to disable
asynchronous communication from the sender process altogether, but this
solution requires more changes and thus more testing.

Change-Id: Ib00bf01ad29cdd10a5dee731d4788254d9037a76

9 years agolibsys: make tickdelay(3) more reliable 46/3046/1
David van Moolenbroek [Sat, 18 Jul 2015 07:52:27 +0000 (09:52 +0200)]
libsys: make tickdelay(3) more reliable

Previously, there was a tiny chance that tickdelay(3) would return
early or that it would fail to reinstate a previous alarm.

- sys_setalarm(2) now returns TMR_NEVER instead of 0 for the time
  left if no previous alarm was set;
- sys_setalarm(2) now also returns the current time, to allow the
  caller to determine whether it got an alarm notification for the
  alarm it set or for a previous alarm that has just gone off;
- tickdelay(3) now makes use of these facilities.

Change-Id: Id4f8fe19a61ca8574f43131964e6f0317f613f49

9 years agoaudio: use standard Makefile structure 45/3045/1
David van Moolenbroek [Mon, 6 Jul 2015 11:57:19 +0000 (13:57 +0200)]
audio: use standard Makefile structure

The previous approach of including libraries through the parent
directory's Makefile.inc created linking issues, with libchardriver
not finding snprintf in certain cases.  The new approach of including
libraries through the driver's only Makefile is the one used by all
other drivers.

Change-Id: I96e6308e12e54f0fce8ecf58bd061269860d4355

9 years agoImporting bin/domainname utility 44/3044/1
Kaustubh Kelkar [Sat, 11 Jul 2015 22:53:22 +0000 (17:53 -0500)]
Importing bin/domainname utility

Change-Id: Iaf2067296195d2d55b93d00ac593b431572ca4cd

9 years agotests: resolve new compiler warnings 43/3043/1
David van Moolenbroek [Tue, 28 Jul 2015 13:24:44 +0000 (13:24 +0000)]
tests: resolve new compiler warnings

Change-Id: I57f6602a9fe9e8524f7da4320b0d1a46889b90d6

9 years agolibc: add posix_spawn family of functions 42/3042/2
Jean-Baptiste Boric [Sun, 14 Jun 2015 10:29:01 +0000 (12:29 +0200)]
libc: add posix_spawn family of functions

The implementation is taken from newlib (BSD licensed) and test84 is based
on NetBSD's t_spawn.c

Change-Id: Ia4e9dd5204a0b4ef241a451978057e11fb29e3d6

9 years agoupdate_bootcfg(8): Add actually useful information 41/3041/1
Jacob Adams [Tue, 14 Jul 2015 21:08:59 +0000 (17:08 -0400)]
update_bootcfg(8): Add actually useful information

Change-Id: I3f1aa2141827b3dc4072f2e8cedeecb40006e626

9 years agoClose #83 with fix suggested 40/3040/1
Jacob Adams [Tue, 14 Jul 2015 20:24:50 +0000 (16:24 -0400)]
Close #83 with fix suggested

Change-Id: I83975a0963d09eab73df62adf81ce8027ca41bb0

9 years agopatch(1): fix arbitrary code execution bug 39/3039/1
David van Moolenbroek [Sun, 26 Jul 2015 15:47:05 +0000 (15:47 +0000)]
patch(1): fix arbitrary code execution bug

This is the combination of two NetBSD patches committed by Christos
Zoulas, based on the findings and Bitrig patch by Martin Natano.
The NetBSD log messages read:

  From Martin Natano @bitrig: Use execve(2) instead of system to
  apply patches that require rcs command execution instead system(3)
  to avoid malicious filenames in patches causing bad things to
  happen. In the process, lose SCCS support. It is not like we are
  shipping sccs commands for that to work.

And:

  Use absolute paths for RCS commands (Martin Natano)

Change-Id: Id44bd59a5a6bc6cd95d1e1fae468bd718cfff2db

9 years agoeMMC: add support to 8-bit mode. 38/3038/1
Leonardo Fogel [Thu, 2 Jul 2015 21:45:04 +0000 (18:45 -0300)]
eMMC: add support to 8-bit mode.

Change-Id: I0470130eb5f8de319cd55c448a9aa1b9131e8e07

9 years agoImport NetBSD syslogd(8) 37/3037/2
David van Moolenbroek [Fri, 24 Jul 2015 22:09:13 +0000 (22:09 +0000)]
Import NetBSD syslogd(8)

The primary reason for the import is a likely GPL taint of the
original MINIX3 syslogd.  As a result, this import may still
have some rough edges.

Change-Id: I5c8d26eca10fc2dd50ecc9eab44a1d483cf068a9

9 years agoLOG: fix bugs in userland write handler 36/3036/2
David van Moolenbroek [Fri, 24 Jul 2015 20:54:27 +0000 (20:54 +0000)]
LOG: fix bugs in userland write handler

- report correct number of bytes written;
- correctly return partial writes on failure;
- do not overwrite result if there is a pending read.

Change-Id: I92aeeaee1eccb47c2aa2b6666a2f560c3cb17f42

9 years agolibc: fix sysctl(3) error code 35/3035/1
David van Moolenbroek [Fri, 24 Jul 2015 17:16:29 +0000 (17:16 +0000)]
libc: fix sysctl(3) error code

All unimplemented sysctl calls would return 2 instead of -1.

Change-Id: Ib486a03dc93969e646e4e11d890dc46855d790c4

9 years agotest83: add test to send strange/wrong UDP and TCP packets 34/3034/1
Erik van der Kouwe [Wed, 22 Jul 2015 19:39:39 +0000 (21:39 +0200)]
test83: add test to send strange/wrong UDP and TCP packets

Change-Id: I73444d2753adab140a4f8e6bee2db32282044888

9 years agotest82: share support functions in common.[ch] for test83 33/3033/1
Erik van der Kouwe [Wed, 22 Jul 2015 19:33:28 +0000 (21:33 +0200)]
test82: share support functions in common.[ch] for test83

Change-Id: I3dfeacc3c2c143d3b696efa39a6f257d38281742

9 years agoorinoco: retire 32/3032/1
David van Moolenbroek [Mon, 20 Jul 2015 16:55:15 +0000 (16:55 +0000)]
orinoco: retire

This code is MPL-licensed and thus does not belong in the MINIX3
source tree.

Change-Id: I10388b05e90e83b95414cf9b469e50f49bc1db31

9 years agoVFS: add support for F_DUPFD_CLOEXEC 31/3031/1
David van Moolenbroek [Mon, 20 Jul 2015 13:55:10 +0000 (13:55 +0000)]
VFS: add support for F_DUPFD_CLOEXEC

Change-Id: Ibe422c6c99fe5fd1385884843ff9e15111810309

9 years agobenchmarks: remove unixbench 30/3030/1
David van Moolenbroek [Mon, 20 Jul 2015 11:02:57 +0000 (11:02 +0000)]
benchmarks: remove unixbench

This code appears to be GPL-licensed and thus does not belong in
the MINIX3 source tree.

Change-Id: I9e88c3ffd8eae8697b629899dba9728863a4413a

9 years agomkfs.mfs: remove Linux mount check 29/3029/1
David van Moolenbroek [Mon, 20 Jul 2015 10:59:49 +0000 (10:59 +0000)]
mkfs.mfs: remove Linux mount check

This code is GPL-licensed and thus does not belong in the MINIX3
source tree.

Change-Id: Ie154f8a4b536df53b840e535283996b545f2bafc

9 years agotests: remove IPC test set 28/3028/1
David van Moolenbroek [Sun, 19 Jul 2015 17:58:10 +0000 (17:58 +0000)]
tests: remove IPC test set

This code appears to be GPL-licensed and thus does not belong in
the MINIX3 source tree.

Change-Id: I1d1060cd159322398284c6bb9716541819706e95

9 years agoinet: fix state transitions in driver receipt code 27/3027/1
David van Moolenbroek [Fri, 17 Jul 2015 18:44:39 +0000 (18:44 +0000)]
inet: fix state transitions in driver receipt code

This resolves a problem with ioctl(NIOCGETHSTAT) hanging forever
as identified by Erik van der Kouwe, and possibly many other corner
cases.

Change-Id: I2350c882dc6a0862e16454ec6b6c320d78780bcd

9 years agoAdd test82 (HTTP) 26/3026/1
Erik van der Kouwe [Wed, 8 Jul 2015 07:54:56 +0000 (09:54 +0200)]
Add test82 (HTTP)

This test connects to a remote HTTP server to retrieve files, using various
chunk sizes and concurrency settings to exercise the network stack. The test
is only performed is USENETWORK=yes. This test requires the following URLs to
remain available: http://test82.minix3.org/test1.txt and
 http://test82.minix3.org/test2.bin. The former contains a 'Hello world'
message followed by a newline, the latter all 16-bit values in increasing
order, using big-endian notation.

Change-Id: I696106482fb1658f9657be2b6845a1b37a3d6172

9 years agoAdd new tests 80 (TCP) and 81 (UDP) 25/3025/1
Erik van der Kouwe [Wed, 8 Jul 2015 07:46:56 +0000 (09:46 +0200)]
Add new tests 80 (TCP) and 81 (UDP)

These new tests are largely based on the code from test 56 (UDS). Common code
is moved into a separate file common-socket.c. In some instances the tests
are too strict for TCP/UDP sockets, which may not always react instantly to
whatever happens on the other side (even locally). For these cases, the
ignore_* fields in struct socket_test_info indicate that there needs to be
an exception. There are also tests where it seems the functionality of inet
is either incorrect or incomplete with regard to the POSIX standard. In these
cases, the bug_* fields are used to document the issues while avoiding
failure of the test.

Change-Id: Ia860deb4559d42608790451936b1aade866faebc

9 years agotest48: skip some redundant combinations of parameters 24/3024/1
Erik van der Kouwe [Wed, 8 Jul 2015 07:32:17 +0000 (09:32 +0200)]
test48: skip some redundant combinations of parameters

Change-Id: I8ebecf4f61a99c653fd6dc0ae9510d5fd154dd4e

9 years agotest48: move can_use_network function to common code for reuse 23/3023/1
Erik van der Kouwe [Wed, 8 Jul 2015 07:30:15 +0000 (09:30 +0200)]
test48: move can_use_network function to common code for reuse

Change-Id: I66a5f36f05fa4c4413b3b62c555fa58fbe5d73ea

9 years agotests: change u32_t to uint32_t for portability 22/3022/1
Erik van der Kouwe [Wed, 8 Jul 2015 07:27:30 +0000 (09:27 +0200)]
tests: change u32_t to uint32_t for portability

Change-Id: I8ea57fff72c3b3ed02cc9d82ee295069ca299ed9

9 years agotest48: Introduce USENETWORK variable. 21/3021/2
Erik van der Kouwe [Thu, 2 Jul 2015 17:01:58 +0000 (19:01 +0200)]
test48: Introduce USENETWORK variable.

This patch introduces USENETWORK environment variable to determine whether to
use the network or not, instead of the unreliable ping test; set to 'yes' to
enable network usage.

Change-Id: I9e26fa95b5b990fd94f5978db8de0dd73496d314

9 years agotest48: update lookup name from static.minix3.org to test48.minix3.org 20/3020/1
Erik van der Kouwe [Thu, 2 Jul 2015 17:01:21 +0000 (19:01 +0200)]
test48: update lookup name from static.minix3.org to test48.minix3.org

Change-Id: Ie8553bee529aeba66a438eab90177551ec44bc07

9 years agoclang: apply LLVM patch r201729 19/3019/1
Erik van der Kouwe [Wed, 29 Apr 2015 20:59:26 +0000 (22:59 +0200)]
clang: apply LLVM patch r201729

This fixes an issue when compiling with GCC 4.9.
For details, see: http://reviews.llvm.org/rL201729

Change-Id: Iaa522715798016f6edb433b01b02aa664fcb5d1c

9 years agolibc: FTS support for dynamic inode numbering 18/3018/1
Ben Gras [Thu, 2 Apr 2015 11:04:27 +0000 (13:04 +0200)]
libc: FTS support for dynamic inode numbering

Edited by Lionel Sambuc and David van Moolenbroek.

Change-Id: I29d6383499d8c0524f86f9dcec701aff35ce8a43

9 years agomemory: announce presence during startup 17/3017/1
Lionel Sambuc [Sun, 28 Jun 2015 17:31:18 +0000 (17:31 +0000)]
memory: announce presence during startup

Change-Id: Id4724c444bdca9f72fca05edb55d7614eb5c8286

9 years agouds: announce presence during startup 16/3016/1
Lionel Sambuc [Thu, 15 Jan 2015 14:25:21 +0000 (15:25 +0100)]
uds: announce presence during startup

Change-Id: Ibaf2e08e80e2b0c4cf4108fff3866a2bd430ec47

9 years agolog: announce presence during startup 15/3015/1
Lionel Sambuc [Thu, 15 Jan 2015 14:19:55 +0000 (15:19 +0100)]
log: announce presence during startup

Set its restart policy to "reset".

Change-Id: I54f350d9d0d9bc571abd9630f27f4c961c7c0778

9 years agolibvtreefs: allow highly dynamic directories 14/3014/1
Cristiano Giuffrida [Thu, 1 Jan 2015 15:34:13 +0000 (16:34 +0100)]
libvtreefs: allow highly dynamic directories

Change-Id: Ibf76262f943ef1a5f529384ebd4a06a2cc5897c1

9 years agolibvtreefs: dynamically allocate long inode names 13/3013/1
Cristiano Giuffrida [Wed, 31 Dec 2014 01:15:44 +0000 (02:15 +0100)]
libvtreefs: dynamically allocate long inode names

Extended by David van Moolenbroek to continue using static buffers
for short inode names, so as to prevent important file system
services such as procfs from running out of memory at runtime.

Change-Id: I6f841741ee9944fc87dbdb78b5cdaa2abee9da76

9 years agolibvtreefs: fix naming bug 12/3012/1
Cristiano Giuffrida [Sat, 27 Dec 2014 15:07:45 +0000 (16:07 +0100)]
libvtreefs: fix naming bug

Change-Id: Ib8767cfef4206ed491855bace6dd8bd58b45b8ce

9 years agoprocfs: add service pid information 11/3011/1
Cristiano Giuffrida [Sat, 20 Dec 2014 00:29:37 +0000 (01:29 +0100)]
procfs: add service pid information

Change-Id: I163ca4c6c6db45cca41515644ac6c2acd0807ee8

9 years agoprocfs: do not list inactive services 10/3010/1
David van Moolenbroek [Fri, 19 Dec 2014 15:35:31 +0000 (15:35 +0000)]
procfs: do not list inactive services

Each /proc/service entry must have a unique label.  With cloning,
multiple RS services may have the same label.  Since we are not
actually interested in inactive services (for now), eliminate those
entries, leaving only the active service which will then indeed have
a unique label in the list.  This resolves a procfs crash.

Change-Id: I0de7ef8fd186ab13f3e22e46416504fd981c09aa

9 years agoprocfs: retrieve both RS tables from RS at once 09/3009/1
David van Moolenbroek [Fri, 19 Dec 2014 13:40:10 +0000 (13:40 +0000)]
procfs: retrieve both RS tables from RS at once

Previously, procfs would retrieve the rproc and rprocpub tables from
RS in two separate calls.  This allowed for a race condition where the
tables could change in between the calls, resulting in a panic in
procfs under certain circumstances.  RS now implements a new method
for getsysinfo that allows the retrieval of both tables at once.

Change-Id: I5ec22d25898361270c90e805a43fc6d76ad9e29d

9 years agoAdd PTYFS, Unix98 pseudo terminal support 08/3008/2
David van Moolenbroek [Mon, 22 Jun 2015 17:14:34 +0000 (17:14 +0000)]
Add PTYFS, Unix98 pseudo terminal support

This patch adds support for Unix98 pseudo terminals, that is,
posix_openpt(3), grantpt(3), unlockpt(3), /dev/ptmx, and /dev/pts/.
The latter is implemented with a new pseudo file system, PTYFS.

In effect, this patch adds secure support for unprivileged pseudo
terminal allocation, allowing programs such as tmux(1) to be used by
non-root users as well.  Test77 has been extended with new tests, and
no longer needs to run as root.

The new functionality is optional.  To revert to the old behavior,
remove the "ptyfs" entry from /etc/fstab.

Technical nodes:

o The reason for not implementing the NetBSD /dev/ptm approach is that
  implementing the corresponding ioctl (TIOCPTMGET) would require
  adding a number of extremely hairy exceptions to VFS, including the
  PTY driver having to create new file descriptors for its own device
  nodes.

o PTYFS is required for Unix98 PTYs in order to avoid that the PTY
  driver has to be aware of old-style PTY naming schemes and even has
  to call chmod(2) on a disk-backed file system.  PTY cannot be its
  own PTYFS since a character driver may currently not also be a file
  system.  However, PTYFS may be subsumed into a DEVFS in the future.

o The Unix98 PTY behavior differs somewhat from NetBSD's, in that
  slave nodes are created on ptyfs only upon the first call to
  grantpt(3).  This approach obviates the need to revoke access as
  part of the grantpt(3) call.

o Shutting down PTY may leave slave nodes on PTYFS, but once PTY is
  restarted, these leftover slave nodes will be removed before they
  create a security risk.  Unmounting PTYFS will make existing PTY
  slaves permanently unavailable, and absence of PTYFS will block
  allocation of new Unix98 PTYs until PTYFS is (re)mounted.

Change-Id: I822b43ba32707c8815fd0f7d5bb7a438f51421c1

9 years agolibfsdriver: clear VM cache only if used 07/3007/1
David van Moolenbroek [Mon, 22 Jun 2015 11:50:04 +0000 (11:50 +0000)]
libfsdriver: clear VM cache only if used

As part of its built-in mmap emulation support for "none" file system
services, libfsdriver clears the VM cache upon exit.  However, for
trivial file systems which do not even support reading from files, the
the VM cache need to be cleared either.  With this patch, the VM cache
is cleared only when modified, so that such trivial file systems need
not be given CLEARCACHE permission.

Change-Id: I518c092443455302b9b9728f10a3f894d2c8036b

9 years agolibfsdriver: default to noop for putnode 06/3006/1
David van Moolenbroek [Sun, 21 Jun 2015 17:53:53 +0000 (17:53 +0000)]
libfsdriver: default to noop for putnode

While putnode requests should always succeed, very simple file system
services may not care about reference counts and thus about putnode
requests at all.  For this reason, we now default to an OK response if
no fdr_putnode implementation is given.

Change-Id: I01f6421abf4546a1f69d8c21900a92d6acc45745

9 years agolibfsdriver: preinitialize stat.st_ino 05/3005/1
David van Moolenbroek [Sun, 21 Jun 2015 17:50:22 +0000 (17:50 +0000)]
libfsdriver: preinitialize stat.st_ino

The stat.st_ino field must always be filled with the inode number
given as part of the fdr_stat request anyway, so libfsdriver can
simply fill in the number and allow the file system not to bother.

Change-Id: Ia7a849d0b23dfc83010df0d48fa26e4225427694

9 years agoAdd a driver for the eMMC on the BeagleBone Black 04/3004/1
Leonardo Fogel [Sat, 20 Jun 2015 21:13:50 +0000 (18:13 -0300)]
Add a driver for the eMMC on the BeagleBone Black

Change-Id: I30ab36ac048c65538718e372db9502fb8f51d41f

9 years agoVFS: fix pipe resumption delay bug 03/3003/1
David van Moolenbroek [Fri, 19 Jun 2015 22:06:19 +0000 (22:06 +0000)]
VFS: fix pipe resumption delay bug

Commit 723e513 erroneously removed a yield() call from VFS which was
necessary to get resumed pipe read/write threads to run before VFS
blocks on receive().  The removal caused those threads to run only
once VFS received another message, effectively slowing down activity
on pipes to a crawl in some cases.

Instead of readding the yield() call, this patch restructures the
get_work() code to go back through the main message loop even when no
new work is received, thus ensuring that newly started threads are
always activated without requiring a special case.

This fixes #65.

Change-Id: I59b7fb9e403d87dba1a5deecb04539cc37517742

9 years agohandle lack of pckbd more gracefully 02/3002/1
rlfnb [Wed, 3 Jun 2015 05:56:35 +0000 (07:56 +0200)]
handle lack of pckbd more gracefully

kb_init() panics, if no keyboard controller is found during self-test.
Instead of panic, the driver should quit the init process and tell it the SEF .

Change-Id: Icdfb7125f5d4062f46cfbbdbbb9e54ac4b273642

9 years agoisofs: do not link against libc 01/3001/2
David van Moolenbroek [Sat, 6 Jun 2015 12:58:46 +0000 (12:58 +0000)]
isofs: do not link against libc

This change requires a small patch to libc, in order to avoid that
libminc has to pull in a large chunk of libc just for mktime(3).

Change-Id: I48e598b3716eff626cac461f78a41e32334e6b28

9 years agoinet: do not link against libc 00/3000/4
David van Moolenbroek [Sat, 6 Jun 2015 11:51:39 +0000 (11:51 +0000)]
inet: do not link against libc

This should make its printed errors show up again.

Change-Id: I6839a584dc2a544bae7973ded3ab1dacf04e4ec0

9 years agoPFS, inet: use static UID to drop privileges 99/2999/1
David van Moolenbroek [Sat, 6 Jun 2015 11:21:23 +0000 (11:21 +0000)]
PFS, inet: use static UID to drop privileges

Previously, services would obtain the user ID of "service" through
getpwnam(3).  While this approach is conceptually better, it also
imposes linking against libc which in turn causes problems with
printf(3), which already led to PFS no longer dropping privileges at
all.  For now, we hardcode SERVICE_UID and use that instead.

In the future, two changes should allow removal of SERVICE_UID again:
- "service edit" should cause RS to request that a service (such as
  PFS) drop privileges through SEF, using the user ID resolved by
  service(8), or something similar;
- a future devfs should make it possible for inet to start without
  root privileges altogether.

Change-Id: Ie02a1e888cde325806fc0ae76909943ac42c9b96

9 years agoVFS: during initial mount, receive but block work 98/2998/1
David van Moolenbroek [Sat, 6 Jun 2015 18:00:34 +0000 (18:00 +0000)]
VFS: during initial mount, receive but block work

For VFS, initialization is a special case for processing work: PFS
and the ramdisk MFS must be fully mounted before VFS can process any
other requests, in particular from init(8). This case was handled by
receiving reply messages only from the FS service being mounted, but
this effectively disallowed PFS from calling setuid(2) at startup.

This patch lets VFS receive all messages during the mounting process,
but defer processing any new requests. As a result, the FS services
have a bit more freedom in what they can do during startup.

Change-Id: I18275f458952a8d790736a9c9559b27bbef97b7b

9 years agoVFS: fix error behavior for partial pipe writes 97/2997/1
David van Moolenbroek [Fri, 5 Jun 2015 18:28:20 +0000 (18:28 +0000)]
VFS: fix error behavior for partial pipe writes

This patch fixes two related issues:

- If a large (>PIPE_BUF) pipe write is processed partially, only to be
  followed by a write error condition, then the process is left in an
  incorrect state, possibly causing VFS to crash on a subsequent call.

- If such a partially processed large pipe write ends up resulting in
  an EPIPE error, no corresponding SIGPIPE signal is generated.

The corrected behavior is tested in test68.

Change-Id: I5540e61ab6bcc60a31201485eda04bc49ece2ca8

9 years agocawf: Update K&R function declarations 96/2996/1
Jacob Adams [Sun, 17 May 2015 03:14:24 +0000 (23:14 -0400)]
cawf: Update K&R function declarations

Change-Id: Ib18171089c7b389f7f2643d7298f9659e882f65c

9 years agocawf: Fix buffer scope 95/2995/1
Jacob Adams [Sun, 17 May 2015 01:08:33 +0000 (21:08 -0400)]
cawf: Fix buffer scope

Change-Id: I03f9066c20da142034626b07d0b07c446075b8af

9 years agosprofalyze: Fix minor typo 94/2994/1
Jacob Adams [Fri, 15 May 2015 19:36:03 +0000 (15:36 -0400)]
sprofalyze: Fix minor typo

Change-Id: I0a419833fb2f438808613737680ace7246713ee9

9 years agoAdd manpage for sprofdiff 93/2993/1
Jacob Adams [Sun, 10 May 2015 02:28:13 +0000 (22:28 -0400)]
Add manpage for sprofdiff

Change-Id: Ifa98ab133ef818d21921f05db650069448ea52ff

9 years agoAdd manpage for sprofalyze 92/2992/1
Jacob Adams [Sun, 10 May 2015 02:13:56 +0000 (22:13 -0400)]
Add manpage for sprofalyze

Change-Id: I206a5878e8f788ea4ff742453148462959263a6a

9 years agoImporting bin/dd 86/2986/1
Jacob Adams [Sun, 5 Apr 2015 01:00:10 +0000 (21:00 -0400)]
Importing bin/dd

Change-Id: Ibdfed821aa834419c9713dc80f698c8ed74ff269

9 years agoImport games/caesar and games/rot13 85/2985/1
Jacob Adams [Sun, 5 Apr 2015 02:26:08 +0000 (22:26 -0400)]
Import games/caesar and games/rot13

Change-Id: Ib6b074c6c525ee817b9182b17a06ae18851f5afe

9 years agoAdd games/banner 84/2984/1
Jacob Adams [Sun, 5 Apr 2015 02:05:03 +0000 (22:05 -0400)]
Add games/banner

Change-Id: Ib4a002422d668d8aa5cf0e7171ea430ef630eeff

9 years agoImport games/rain 83/2983/1
Jacob Adams [Sun, 5 Apr 2015 02:53:00 +0000 (22:53 -0400)]
Import games/rain

Change-Id: Ifc9a9d69795e3281f62c3c3438622ce74994b8b0

9 years agodevmand: properly prevent overflow 82/2982/1
Jacob Adams [Sat, 4 Apr 2015 22:14:44 +0000 (18:14 -0400)]
devmand: properly prevent overflow

closes #22

Change-Id: Ia10f352a7ff5b05b1095dbb65d36316f9165a6f0

9 years agolibc: Fix incomplete fprintf 81/2981/1
Jacob Adams [Mon, 30 Mar 2015 19:53:59 +0000 (15:53 -0400)]
libc: Fix incomplete fprintf

Closes #23

Change-Id: Ibe6362de0d2d1d94442401b92bc126e63bf9f9b0

9 years agomined: increase the size of the tgetent() buffer. 80/2980/1
Thomas Cort [Wed, 25 Mar 2015 19:46:00 +0000 (15:46 -0400)]
mined: increase the size of the tgetent() buffer.

From the termcap section of the GNU termutils manual:

"There is no way you can tell how much space is needed, so the convention
is to allocate a buffer 2048 characters long and assume that is enough.
(Formerly the convention was to allocate 1024 characters and assume that
was enough. But one day, for one kind of terminal, that was not
enough.)"

Change-Id: Ia5937366ae89e886dbaef7d180bee40669d0c488

9 years agomined: move to minix/usr.bin/mined 79/2979/1
Thomas Cort [Wed, 25 Mar 2015 18:51:18 +0000 (14:51 -0400)]
mined: move to minix/usr.bin/mined

As suggested in issue #43.

Historic Locations:

Prior to this commit

  minix/commands/mined

Prior to commit 433d6423c39e34ec4b79c950597bb2d236f886be

  commands

Change-Id: I374ab3ff0e3b9e47779fc21e80b47fda87698242

9 years agomined: remove !__STDC__ code blocks. 78/2978/1
Thomas Cort [Wed, 25 Mar 2015 18:48:08 +0000 (14:48 -0400)]
mined: remove !__STDC__ code blocks.

__STDC__ is used to mitigate the differences between K&R C and the
ANSI C standard. Nearly every compiler now supports ANSI C, so
there is no need to support non-standard compilers.

Change-Id: Ifc3381ecf1c43dfde9004bee48552d8b3ac4dcdc

9 years agomined.h: use '\a' instead of ascii code for bell. 77/2977/1
Thomas Cort [Wed, 25 Mar 2015 18:34:14 +0000 (14:34 -0400)]
mined.h: use '\a' instead of ascii code for bell.

Makes the code slightly more portable and readable.

Change-Id: I45bbecb6dc1c320c9412eeeaf598116c2ce1aac5

9 years agomined: built without UNIX defined. 76/2976/1
Thomas Cort [Wed, 25 Mar 2015 18:32:43 +0000 (14:32 -0400)]
mined: built without UNIX defined.

* Remove undef NULL, EOF, getchar, putchar
* Rename putchar, getchar, _putchar, _getchar to putch, getch, _putch,
  _getch to avoid conflict with libc functions.
* Rename UP() to UP1() (for UP 1 line) to avoid conflict with UP
  definition in termcap.h. Rename DN1 LF1 RT1 for consistency.
* Add termcap.h for prototypes for tputs and friends.
* Add libterminfo references to Makefile
* Add return value to _putch() to make it work as tputs expects.
* Make putch() call _putch()
* Remove UNIX ifdefs and all code in the !UNIX branches.

closes #43

Change-Id: I0a6f7298aa8b12a74225badc88d3c236a02669ea

9 years agoman: clean-out man1x category. 75/2975/1
Thomas Cort [Tue, 24 Mar 2015 20:24:39 +0000 (16:24 -0400)]
man: clean-out man1x category.

Removes the following man pages:

* awk.1x -- for a version of awk we no longer have
* kermit.1x -- seems gone altogether
* macros.1x -- not useful for anyone anymore

Moves the following man pages:

* mined.1x -- Moved to minix/commands/mined/mined.1
and reformatted to use the mdoc macros instead of the
Minix macros so that it displays properly.

Removes /usr/man/man1x from the directory tree.

closes #44

Change-Id: I59b8bd54cf5cba6d188e51e99a92b36e90c275c1

9 years agomined: clean-up trailing whitespace. 74/2974/3
Thomas Cort [Sun, 22 Mar 2015 20:29:04 +0000 (16:29 -0400)]
mined: clean-up trailing whitespace.

Change-Id: Ic27293d7e1d0f830d635b78e7e620dcf0ef3e03f

9 years agomined1.c: remove i386 guard around escape sequences. 73/2973/3
Thomas Cort [Sun, 22 Mar 2015 20:14:51 +0000 (16:14 -0400)]
mined1.c: remove i386 guard around escape sequences.

The escape sequences for the function keys used to be separated
out in older versions of Minix when they were different for m68k
and intel. Support for m68k was dropped and that code was
removed, leaving the ifdef i386. Since the sequences are the
same for i386 and arm, there is no need to keep the ifdef i386.

Change-Id: Id96a80bcb24da120efa63acc9b248d87fc347eac

9 years agomined.h: remove irrlevant comment. 72/2972/3
Thomas Cort [Sun, 22 Mar 2015 20:10:17 +0000 (16:10 -0400)]
mined.h: remove irrlevant comment.

It used to refer to several NIL_* definitions. Those were removed
in commit 6e25ad8b0a5606fc9351824adf9034d2ef7f7293 leaving the
comment with nothing to comment on.

Change-Id: I52221ae5d2c5216e82391b480cf2038ad723b8f0

9 years agomined.h: remove unused definition, MEMORY_SIZE. 71/2971/3
Thomas Cort [Sun, 22 Mar 2015 20:09:25 +0000 (16:09 -0400)]
mined.h: remove unused definition, MEMORY_SIZE.

Change-Id: I1ae83c427cafb15f1382b7d8ab3871a36b0eec28

9 years agomined.h: remove minix/config.h include. 70/2970/3
Thomas Cort [Sun, 22 Mar 2015 20:07:45 +0000 (16:07 -0400)]
mined.h: remove minix/config.h include.

Nothing defined there is used by mined.

Change-Id: I38b692be1313aaed316eebd7caf8e879178d90dc

9 years agocommands/fix: create manpage for fix(8) 69/2969/2
Jacob Adams [Sun, 22 Mar 2015 02:41:10 +0000 (22:41 -0400)]
commands/fix: create manpage for fix(8)

Change-Id: I868f1338994d6cc2cba6789b9b4e8934610d0142

9 years agoFix boot if no pckd device is there 68/2968/1
rlfnb [Wed, 18 Mar 2015 14:36:10 +0000 (15:36 +0100)]
Fix boot if no pckd device is there

Trying to boot Minix3 master on an appliance/sbc like ALIX fails, as
the service command throws an error. Making the rc script more robust
solves it.

Change-Id: I659043cbbaa2d67b70d6d6e5ab14fff8e1bba769

9 years agoswifi: Fix incorrect memset 67/2967/1
Jacob Adams [Wed, 18 Mar 2015 13:04:01 +0000 (09:04 -0400)]
swifi: Fix incorrect memset

Change-Id: I6764aff558f51cdb90b91a3e71c982e8b3f47058