Lionel Sambuc [Sun, 13 Jan 2013 16:20:11 +0000 (17:20 +0100)]
ARM updates
Due to the ABI we are using we have to use the earm architecture
moniker for the build system to behave correctly. This involves
then some headers to move around.
There is also a few related Makefile updates as well as minor
source code corrections.
Lionel Sambuc [Sun, 13 Jan 2013 19:06:31 +0000 (20:06 +0100)]
Reverting back to default value of MKARZERO
The value was changed to no for cross-building as the old binutils
could not handle the required flag. As this is now possible, the
default is restored.
This flags make sure that AR zeroes out some timestamps and uid/gid
fields in libraries, which would change for every build of the
library otherwise, preventing comparison between to builds.
Lionel Sambuc [Tue, 11 Dec 2012 17:42:21 +0000 (18:42 +0100)]
Fix warnings trivial warnings.
Fix warnings about:
. Unused variables
. format mismatch in printf/scanf format string and arguments
. Missing parenthesis around assignment as truth values
. Clang warnings anout unknown GCC pragma
Lionel Sambuc [Tue, 11 Dec 2012 17:03:26 +0000 (18:03 +0100)]
Changing field utmp.ut_time from int to time_t
This makes sure the types are coherent, and right now, time_t is
defined as an long, through _BSD_TIME_T_. It previously was
hardcoded as an int, so the structure's size does not change.
Lionel Sambuc [Thu, 15 Nov 2012 11:06:41 +0000 (12:06 +0100)]
Libraries updates and cleanup
* Updating common/lib
* Updating lib/csu
* Updating lib/libc
* Updating libexec/ld.elf_so
* Corrected test on __minix in featuretest to actually follow the
meaning of the comment.
* Cleaned up _REENTRANT-related defintions.
* Disabled -D_REENTRANT for libfetch
* Removing some unneeded __NBSD_LIBC defines and tests
Thomas Veerman [Tue, 8 Jan 2013 12:02:38 +0000 (13:02 +0100)]
ARM: fix clock
The GPTIMER1 clock is configured to run at 32 kHz and generate
(overflow) interrupts every 1 ms. However, the Timer Overflow Wrappping
Register (TOWR) was configured to filter every other interrupt. This
caused to the internal 'realtime' value to be off.
Thomas Veerman [Fri, 21 Dec 2012 15:30:37 +0000 (15:30 +0000)]
VFS: change locking to ease concurrent FSes
This patch uses stricter locking for REQ_LINK, REQ_MKDIR, REQ_MKNOD,
REQ_RENAME, REQ_RMDIR, REQ_SLINK and REQ_UNLINK. For all requests, VFS
locks the directory in which we add or remove an inode with VNODE_WRITE.
I.e., the operations have exclusive access to that directory.
Furthermore, REQ_CHOWN, REQ_CHMOD, and REQ_FTRUNC now lock the vmnt
VMNT_READ; VMNT_WRITE was unnecessary.
Thomas Veerman [Tue, 11 Dec 2012 19:46:09 +0000 (19:46 +0000)]
VFS/PFS: remove notion of position in pipes
Because pipes have no file position. VFS maintained (file) offsets into a
buffer internal to PFS and stored them in vnodes for simplicity, mixing
the responsibilities of filp and vnode objects.
With this patch PFS ignores the position field in REQ_READ and REQ_WRITE
requests making VFS' job a lot simpler.
Thomas Veerman [Fri, 30 Nov 2012 12:49:53 +0000 (12:49 +0000)]
VFS: fix locking bugs
.sync and fsync used unnecessarily restrictive locking type
.fsync violated locking order by obtaining a vmnt lock after a filp lock
.fsync contained a TOCTOU bug
.new_node violated locking rules (didn't upgrade lock upon file creation)
.do_pipe used unnecessarily restrictive locking type
.always lock pipes exclusively; even a read operation might require to do
a write on a vnode object (update pipe size)
.when opening a file with O_TRUNC, upgrade vnode lock when truncating
.utime used unnecessarily restrictive locking type
.path parsing:
.always acquire VMNT_WRITE or VMNT_EXCL on vmnt and downgrade to
VMNT_READ if that was what was actually requested. This prevents the
following deadlock scenario:
thread A:
lock_vmnt(vmp, TLL_READSER);
lock_vnode(vp, TLL_READSER);
upgrade_vmnt_lock(vmp, TLL_WRITE);
thread A will be stuck in upgrade_vmnt_lock and thread B is stuck in
lock_vnode. This happens when, for example, thread A tries create a
new node (open.c:new_node) and thread B tries to do eat_path to
change dir (stadir.c:do_chdir). When the path is being resolved, a
vnode is always locked with VNODE_OPCL (TLL_READSER) and then
downgraded to VNODE_READ if read-only is actually requested. Thread
A locks the vmnt with VMNT_WRITE (TLL_READSER) which still allows
VMNT_READ locks. Thread B can't acquire a lock on the vnode because
thread A has it; Thread A can't upgrade its vmnt lock to VMNT_WRITE
(TLL_WRITE) because thread B has a VMNT_READ lock on it.
By serializing vmnt locks during path parsing, thread B can only
acquire a lock on vmp when thread A has completely finished its
operation.
Antoine Leca [Mon, 7 Jan 2013 11:07:29 +0000 (11:07 +0000)]
gzip: fix warning messages with off_t
NetBSD assumes off_t is 64-bit, but on MINIX it is still 32-bit.
So cast the calls to use big_off_t, as stat(2) uses.
Only used in warning messages, was not a real production bug.
Ben Gras [Sun, 6 Jan 2013 18:18:41 +0000 (18:18 +0000)]
kernel: trap-dependent state restore, trace fixes
. restore state depends on how saving of state was done;
also remember trap style in sig context
. actually set and restore TRACEBIT with new trap styles;
have to remove it once process enters kernel though, done
in debug trap exception handler
. introduce MF_STEP that makes arch-specific code
turn on trace bit instead of setting TRACEBIT directly,
a bit more arch-friendly and avoids keeping precious
state in per-process PSW arch-dependently
Ben Gras [Fri, 4 Jan 2013 17:14:31 +0000 (17:14 +0000)]
kernel: separate state for trace-deferred syscalls
state is usually not in p_reg any more with sysenter/syscall trap entries,
so when saving/restarting do_ipc invocations the state has to be remembered
explicitly.
Ben Gras [Fri, 4 Jan 2013 14:58:12 +0000 (14:58 +0000)]
kernel: restore setting KTS_NONE
The 'trap style' variable records how a process has trapped into the
kernel (hardware/software interrupt, or one of the other trap
instructions). KTS_NONE indicates the process isn't trapped into the
kernel at all and is useful for sanity checking. The KTS_NONE reset was
inadvertently removed while removing some debugging code and this commit
restores it.
Ben Gras [Fri, 4 Jan 2013 18:26:10 +0000 (18:26 +0000)]
kernel: restore stacktraces
When processes have entered the kernel with one of the new
trap modes, %ebp is not valid, used for stacktraces, so we
need an alternative way to retrieve it to make the stacktraces
valid again.
Ben Gras [Mon, 17 Dec 2012 18:26:52 +0000 (18:26 +0000)]
vm: replace phys avl by array
. make vm be able to use malloc() by overriding brk()
and minix_mmap() functions
. phys regions can then be malloc()ed and free()d instead
of being in an avl tree, which is slightly faster
. 'offset' field in phys_region can go too (offset is implied
by position in array) but leads to bigger code changes
Lionel Sambuc [Mon, 10 Dec 2012 14:49:24 +0000 (15:49 +0100)]
Shell tests now complain more loudly.
Adding the bomb function which takes as a parameter a string
to be printed, print it, cleans up and exits with an error
code. It also means they will exit after the first error, unlike
previous behaviour.
test3 performs tests for null pointers but after that still continues
and uses them. This results in segfault's. Fixing this issue by failing
on the first error.