Commit graph

6060 commits

Author SHA1 Message Date
Ben Gras 0b79eac642 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

Change-Id: If2896c0a555328ac5b324afa706063fc6d86519e
2014-07-28 17:05:20 +02:00
Ryan Sheridan 29dca95386 writeisofs build fix (missing NAME_MAX define).
Building writeisofs on OS X led to a failure due to the NAME_MAX define
being missing.
2014-07-28 17:05:20 +02:00
Thomas Cort 8df22d598f Importing games/arithmetic
No Minix specific changes needed.

Change-Id: I67d7a01edea0cee5be403dbbea20c2ca0f1771f0
2014-07-28 17:05:19 +02:00
Thomas Cort b098ee9ca6 Importing games/random
No Minix specific changes needed.

Change-Id: I0fd074325f334f03426accbece4e731b746ebe14
2014-07-28 17:05:19 +02:00
Thomas Cort 6e7922ee31 Importing games/wargames
No Minix specific changes needed.

Change-Id: Ie752ee476dd6be712b1dc9cae6ea260f12aaf906
2014-07-28 17:05:19 +02:00
Thomas Cort 0c3cfeffb3 Importing games/monop
No Minix specific changes needed.

Change-Id: I362b974a95911d26fcd8a4401129ca946179d93c
2014-07-28 17:05:19 +02:00
Thomas Cort 5f9253d438 Importing games/number
No Minix specific changes needed.

Change-Id: Iaf87f29a954f241d41c101dd74fe338b9d7c4d95
2014-07-28 17:05:18 +02:00
Thomas Cort 0868456318 Importing games/bcd
No Minix specific changes needed.

Change-Id: Ib98d41526baf73445f3a9465dd75fbc517b1edbe
2014-07-28 17:05:17 +02:00
Thomas Cort 193687130e Importing games/ppt
No Minix specific changes needed.

Change-Id: I81eecad5c0f4c1d7a7dba356bcc2e928e3f2c175
2014-07-28 17:05:17 +02:00
Thomas Cort 90dc219012 Importing games/morse
No Minix specific changes needed.

Change-Id: Ie0d427d39a5392c0c0f2c3856ba36286957d21a4
2014-07-28 17:05:17 +02:00
Thomas Cort 402f338ee6 Importing games/pig
No Minix specific changes needed.

Change-Id: If6c638f44e9cabc5b667f0b30a0654f1e8e61c13
2014-07-28 17:05:16 +02:00
Thomas Cort bd0f8badfa Importing games/fortune
Replaces commands/fortune. No Minix specific changes needed.

Change-Id: Iac79ea82dedd12e80377c85954da5e2d8eee74af
2014-07-28 17:05:16 +02:00
Thomas Cort c1f592a24c Importing games/factor
Replaces commands/factor. No Minix specific changes needed.

Change-Id: Ie2a58534c59a1ebbf922d483fb27abd8dffd1f5f
2014-07-28 17:05:16 +02:00
Thomas Cort d1878c29f6 Importing games/primes
No Minix specific changes needed.

Change-Id: Id4133ad419cb1e31e49b625ad80bb003561afaad
2014-07-28 17:05:16 +02:00
Thomas Cort 0819c9f89b Importing games/adventure
No Minix specific changes needed.

Change-Id: I6826d660c60a9e01676e21ef9b95d27e64a67aa5
2014-07-28 17:05:16 +02:00
Zachary Storer 71d1d39e61 Import NetBSD touch command
Replaces the 'touch' functionality provided by commands/touch.
2014-07-28 17:05:15 +02:00
Zachary Storer 5552d86152 Import NetBSD echo command
Replaces the 'echo' functionality provided by commands/echo.
2014-07-28 17:05:15 +02:00
Lionel Sambuc b6ca6448bc fix declaration of minix_kerninfo_user 2014-07-28 17:05:15 +02:00
Lionel Sambuc 0472cd6e9d Move Assert to check MAGIC before actual use of the MBI record 2014-07-28 17:05:15 +02:00
Kees Jongenburger 023eea4762 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

Change-Id: I621848d56c81c8c22a90b8092adf4ab0f29e2fb8
2014-07-28 17:05:15 +02:00
Lionel Sambuc 7d98eee859 usr.bin/make: -j fix
The job option enable the usage of pipes to communicate with sub-makes.

On MINIX, it seems that there is possibility of receiving an EAGAIN on
such reads, even when it had previously been tested for POLLIN using
poll().

This patch is a workaround, by wrapping the read operation within a
do {} while(errno == EAGAIN && ...) loop.

Change-Id: Ia184c4d600efe7218d197820df87761604120862
2014-07-28 17:05:15 +02:00
Lionel Sambuc ac9fa699bd Fix perl build hanging on pipe
Change-Id: Ic1ff95f45c6082b9310b27783190ce8f92c2afad
2014-07-28 17:05:14 +02:00
Ben Gras 013226c417 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)
2014-07-28 17:05:14 +02:00
Ben Gras 3f38115c7b _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

Change-Id: I407de79e2575115243a074b16e79546a279cfa3e
2014-07-28 17:05:14 +02:00
Ben Gras aa6ee31737 test74: add mmap-related regression tests
tests many complex system/process memory interaction cases.

has to run as root so it can flush the FS cache; needed to
force FS cache misses for unmapped pages.

See the comment in test74.c for a full description of what the tested
cases are.

also re-enable filemap on arm
2014-07-28 17:05:14 +02:00
Ben Gras 58b8ff5ffa 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.

Change-Id: Ide914b2e88413aa90bd731ae587ca06fa5f13ebc
2014-07-28 17:05:14 +02:00
Ben Gras 565f13088f 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

Change-Id: I295794269cea51a3163519a9cfe5901301d90b32
2014-07-28 17:05:14 +02:00
Ben Gras 8c277f99f4 PFS: when copy fails, don't change state
. makes it safe to transparently repeate i/o operation on
	  EFAULT
	. needed for future re-issued i/o operation change in VFS

Change-Id: Iea6b29f3bff19002dcd69b30569671768ac17e21
2014-07-28 17:05:13 +02:00
David van Moolenbroek fa901649a3 devmand: don't die so easily
Change-Id: I048a975fb35dadf07ebb5d067d76fb1d1892bda8
2014-07-28 17:05:13 +02:00
David van Moolenbroek b539f91aba RS: also wait for VM's RS_INIT message
Bug reported by JD Begin.

Change-Id: Idd8c4299f20253fe2d982af319002bfb67af27c6
2014-07-28 17:05:13 +02:00
David van Moolenbroek f199fc0bfe VM: fix corruption from recursive PDE allocation
Change-Id: I6176b849fefca4bed3e92648b0d72ff47658915c
2014-07-28 17:05:13 +02:00
David van Moolenbroek 415782f70f TTY: do not reply to KERNEL
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().

Change-Id: I4b76215a4d90e927b0071675d89d861aa399abb3
2014-07-28 17:05:13 +02:00
David van Moolenbroek e7974541d0 Rearrange endpoint number layout
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.

Change-Id: Id890eea74435444128c75eb0c89816b948f43c0b
2014-07-28 17:05:12 +02:00
David van Moolenbroek 760f3d62d7 PTY: split off from TTY
Requires recreation of /dev/tty[pq]*, /dev/pty[pq]* device nodes.

Change-Id: I0e5a28d82faa934497fd3b97d619e506bcb5f439
2014-07-28 17:05:12 +02:00
Ben Gras fad76abe45 Install sources with MKSRC=yes
Change-Id: Iee433cfe6796af0ea292c7eadff365a32059a609
2014-07-28 17:05:12 +02:00
Ben Gras 4193f2292e 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.

Change-Id: I4f2910ec2592c31bbd14a85d8a6045497fcaf4e3
2014-07-28 17:05:12 +02:00
Ben Gras c81f587520 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.

Change-Id: Ie21d027f5d7c225edc9e6e0c6fa2e4b34f421415
2014-07-28 17:05:12 +02:00
Lionel Sambuc c9ea9e7af8 Binutils: Synchronization & Gold activation
Change-Id: I5235984746178ee30b5db18e7def0016d9a0e36f
2014-07-28 17:05:11 +02:00
Ben Gras e4ab5378cb libsffs: return 64-bit value in st_size
Change-Id: Ife7e590279e582a233f7cd95bf16ae2ac394d9c2
2014-07-28 17:05:11 +02:00
Ben Gras 273c51a7d1 64-bit CDEV_POS
Change-Id: Iecdadf3dd92cc14525961976f51a9eb16a996d62
2014-07-28 17:05:11 +02:00
Ben Gras 3f3e78ef59 64-bit REQ_TRC_START, REQ_TRC_END
Change-Id: I567804209695b5ec0d83a453d93e36cbf8900f1a
2014-07-28 17:05:11 +02:00
Ben Gras e6daf20a69 64-bit VFS_LSEEK_OFF
Change-Id: Ic0b6d65cbde1033462b909436efa92464094f1ec
2014-07-28 17:05:11 +02:00
Ben Gras ed9076ccb4 64-bit VFS_VMCALL_OFFSET
Change-Id: I29725365a199f850420cd0e4e3902cf70dffe9ad
2014-07-28 17:05:10 +02:00
Ben Gras 188a5fde1f 64-bit VFS_TRUNCATE_OFF
Change-Id: I4bd5cc57ddda2525b0bec6f044f35196a2c21f2e
2014-07-28 17:05:10 +02:00
Ben Gras 4694fcc1d5 64-bit RES_FILE_SIZE
Change-Id: Ia17b4b4722f87fb35142948b62d4a8392ded5f73
2014-07-28 17:05:10 +02:00
Ben Gras fdd85c4d08 64-bit RES_SEEK_POS
Change-Id: Id13f06417f2f600db167bec7b33bc825742cae79
2014-07-28 17:05:10 +02:00
Ben Gras 978082bb0d 64-bit REQ_SEEK_POS
Change-Id: I2e51a188b171af0f0a02349e4eccbe78e7cc2e0c
2014-07-28 17:05:10 +02:00
Ben Gras 3c7f4e462e 64-bit bdev position
Change-Id: I149693624610e04af0c5e4437b5efa484a33467d
2014-07-28 17:05:10 +02:00
Zachary Storer d1cfa0acd0 Import NetBSD sleep command
Replaces the 'sleep' functionality provided by commands/sleep.

Change-Id: I8758bf027b26aaef7954848803d6da982c753bfa
2014-07-28 17:05:09 +02:00
Kees Jongenburger e54d075f6f arm-refactor:remove dependency from memory.c to omap_timer.h.
Remove the dependency from memory.c to omap_timer.h.

Change-Id: I1f1a0e5436ac725e4b0db9d7d404194384794802
2014-07-28 17:05:09 +02:00