Lionel Sambuc [Mon, 17 Mar 2014 13:01:22 +0000 (14:01 +0100)]
Prefix libc (u)mount with minix_
The goal is to prevent a name collision with the expected mount/umount
function signatures, if we decide one day to allow any application
using those to work on MINIX.
At this moment the caller has to start the required services, but if we
implement that logic inside the mount/unmout function, this would allow
any application to call those function successfully.
By renaming those now, we prevent a possible ABI break in the future.
The setcontext method did not alway set the return value to 0 after
restoring the desired context. Specially When calling setcontext with
the _UC_IGNSIGM and the _UC_IGNFPU flags the return value would be non
zero.
Ben Gras [Tue, 18 Mar 2014 10:43:08 +0000 (11:43 +0100)]
patch(1) problems workaround
. NUL input in 2 source files cause patch(1)
to truncate the input (and fail the patches); a sed
command removes the NULs
. in binutils/ld, configdoc.texi is patched to be removed
but some patch(1)es leave an empty file, causing build problems;
this file is explicitly removed.
Ben Gras [Mon, 17 Mar 2014 14:53:28 +0000 (15:53 +0100)]
mmap: accept non-PROT_WRITE MAP_SHARED mappings
Currently we don't accept writable file mmap()s, as there is no
system in place to guarantee dirty buffers would make it back to
disk. But we can actually accept MAP_SHARED for PROT_READ mappings,
meaning the ranges aren't writable at all (and no private copy is
made as with MAP_PRIVATE), as it turns out a fairly large class of
usage.
. fail writable MAP_SHARED mappings at runtime
. reduces some minix-specific patches
. lets binutils gold build on minix without further patching
build:update 'git review' config to match gerrit.minix3.org
We have moved the gerrit service to a new server and at the same time allowed
direct access to gerrit. This change updates the '.gitreview' file to reflect
these changes. If you have an existing checkout you might need to update your
.ssh/config file to remove the git-minix alias and edit .git/config to update
the gerrit repository from 'git-minix' to the new url sheme:
ssh://username@gerrit.minix3.org:2222/minix
Ben Gras [Wed, 5 Mar 2014 14:12:54 +0000 (15:12 +0100)]
vfs: call pipe_check before reviving select()
. select callback on close() on a pipe
would falsely revive a read-select on
the pipe
. the extra pipe_check catches it
. fixes the new import of the netbsd
make in -j N mode (make jobs that communicate
with pipes)
Ben Gras [Wed, 5 Mar 2014 11:21:55 +0000 (12:21 +0100)]
_MINIX_SYSTEM - fixes for in-minix crossbuild
. define _MINIX_SYSTEM for all system code from minix.service.mk
. hide some system-level declarations and definitions
behind _MINIX_SYSTEM to cleanly fix host tool build problems on
Minix (such as: NONE being defined and paddr_t being used but not
declared)
. the similar definition _SYSTEM is unsuitable as it changes the
values of errno definitions
Ben Gras [Fri, 28 Feb 2014 15:26:13 +0000 (16:26 +0100)]
VFS: add F_FLUSH_FS_CACHE fcntl
This fcntl requests all cached blocks associated with the minor device
number associated with the regular file are invalidated. If the file
is a block special, invalidate the blocks associated with that minor
device instead.
This is to be used for a test that tests unmapped file-mapped memory
ranges whose blocks are not in the cache and therefore must be fetched
from a FS.
Ben Gras [Thu, 16 Jan 2014 13:22:13 +0000 (14:22 +0100)]
make vfs & filesystems use failable copying
Change the kernel to add features to vircopy and safecopies so that
transparent copy fixing won't happen to avoid deadlocks, and such copies
fail with EFAULT.
Transparently making copying work from filesystems (as normally done by
the kernel & VM when copying fails because of missing/readonly memory)
is problematic as it can happen that, for file-mapped ranges, that that
same filesystem that is blocked on the copy request is needed to satisfy
the memory range, leading to deadlock. Dito for VFS itself, if done with
a blocking call.
This change makes the copying done from a filesystem fail in such cases
with EFAULT by VFS adding the CPF_TRY flag to the grants. If a FS call
fails with EFAULT, VFS will then request the range to be made available
to VM after the FS is unblocked, allowing it to be used to satisfy the
range if need be in another VFS thread.
Similarly, for datacopies that VFS itself does, it uses the failable
vircopy variant and callers use a wrapper that talk to VM if necessary
to get the copy to work.
. kernel: add CPF_TRY flag to safecopies
. kernel: only request writable ranges to VM for the
target buffer when copying fails
. do copying in VFS TRY-first
. some fixes in VM to build SANITYCHECK mode
. add regression test for the cases where
- a FS system call needs memory mapped in a process that the
FS itself must map.
- such a range covers more than one file-mapped region.
. add 'try' mode to vircopy, physcopy
. add flags field to copy kernel call messages
. if CP_FLAG_TRY is set, do not transparently try
to fix memory ranges
. for use by VFS when accessing user buffers to avoid
deadlock
. remove some obsolete backwards compatability assignments
. VFS: let thread scheduling work for VM requests too
Allows VFS to make calls to VM while suspending and resuming
the currently running thread. Does currently not work for the
main thread.
. VM: add fix memory range call for use by VFS
Diagnostics messages are printed using locally generated requests,
using KERNEL as the calling endpoint. No reply should be sent for
such cases. This check was accidentally lost with the previous
removal of tty_reply().
The constants ANY, NONE, and SELF are now a function of the way the
endpoint number is split between a generation number and a process
slot number, rather than the other way around. This allows for the
use of bit masking and shifting instead of the previous (and more
expensive) multiplication and division.
Ben Gras [Sun, 4 May 2014 11:52:22 +0000 (13:52 +0200)]
fix for ld.so @ bitcode build
ld.so linked with gold didn't work - gold was not generating
the _DYNAMIC ptr in the first GOT entry, leaving it zero, causing
mayhem for ld.so.
. patch for gold: always generate _DYNAMIC ptr. submitted upstream,
more info here: https://sourceware.org/bugzilla/show_bug.cgi?id=16900
. revert "REMOVE ME: Static tests for now" - we can link tests dynamically
This reverts commit 3e0a3993deb831eb5abcd1c1a2cb1246b43f8d1d.
Ben Gras [Thu, 13 Mar 2014 12:21:32 +0000 (13:21 +0100)]
backport 2 binutils patches
These 2 patches are from upstream binutils and together properly
detect whether -ldl is necessary and available to build ld and gold
in plugins mode, instead of hard-coding its usage always. This lets
us build ld and gold on *bsd and minix systems, which do not have
or need -ldl for dl*() functions.
Thomas Cort [Sat, 22 Feb 2014 21:32:12 +0000 (16:32 -0500)]
x86_hdimage.sh: use nbstat from tooldir.
The syntax of the stat(1) command varies between Linux and FreeBSD.
This prevented `x86_hdimage.sh -i` from succeeding on FreeBSD 10.0.
The fix is to use the NetBSD stat from the tooldir for all systems.