build:refactor arm_sdimage.sh as to no longer require root.
There where two reasons for needing root access while making ARM builds. The
first reason was that we needed root permissions to create device nodes and
assign permissions to files. The second reason we needed root was that we used
loop mounted files to copy the build output to the file backed storage.
The first problem is solved by building in unprivileged mode (adding -U) during
compilation. The second problem is solved by using mcopy to put files on the
fat partition and use the mkfs.mfs proto files to create MFS file system.
Future work might be to replace this script by the netbsd makefs tool.
Ben Gras [Fri, 12 Apr 2013 20:54:42 +0000 (20:54 +0000)]
many new tests
. test70: regression test for m_out vfs race condition
The following tests use testcache.c to generate test i/o
patterns, generate random write data and verify the reads.
. test71: blackbox full-stack test of FS operation, testing
using the regular VFS interface crazy i/o patterns
with various working set sizes, triggering only
primary cache, also secondary cache, and finally
disk i/o and verifying contents all the time
. test72: unit test of libminixfs, implementing
functions it needs from -lsys and -lblockdriver
and the client in order to simulate a working
cache client and backend environment.
. test73: blackbox test of secondary vm cache in isolation
Ben Gras [Mon, 15 Apr 2013 17:44:19 +0000 (17:44 +0000)]
vfs: fix null deref, pfs: add fchmod()
. vfs read_only() assumes vnode->v_vmnt is non-NULL, but it can
be NULL sometimes
. e.g. fchmod() on UDS triggered NULL deref; add a check and
add REQ_CHMOD to pfs so unix domain sockets can be fchmod()ded
. add to test56
Ben Gras [Thu, 18 Apr 2013 13:41:01 +0000 (13:41 +0000)]
test run: feature for nicer jenkins interaction
. add -l option to list available tests
. add -t option to specify tests to run
. also improve the root check a bit by
not relying on an environment var
. do not print the human-friendly banner & summary
if a test list is given to make the test
results easy to parse
Ben Gras [Tue, 16 Apr 2013 16:04:46 +0000 (16:04 +0000)]
tests cleanup
. make common.o link with the tests instead of being
#included as common.c
. fix warnings about missing prototypes by declaring functions
static
. reduces some duplicated code
Ben Gras [Fri, 12 Apr 2013 16:41:23 +0000 (16:41 +0000)]
vfs: make m_out non-global
m_out is shared between threads as the reply message, and it can happen
results get overwritten by another thread before the reply is sent. This
change
. makes m_out local to the message handling function,
declared on the stack of the caller
. forces callers of reply() to give it a message, or
declare the reply message has no significant fields except
for the return code by calling replycode()
Antoine Leca [Sat, 24 Dec 2011 14:02:54 +0000 (15:02 +0100)]
utimens(2) system call
Variant of utime(2) with struct timespec (with ns precision)
instead of time_t values; also allows for tv_nsec members
the values UTIME_NOW (force update to current time) or
UTIME_OMIT (allow to set either atim or mtim independently.)
Provides a superset of utimes(2), futimes(2), lutimes(2),
and futimens(2).
Provides the same subset of utimensat(2) as does NetBSD 6.
Also import utimens() and lutimeNS() from NetBSD-current.
The kernel API for requesting interrupts and the associated callback
have a somewhat strange behaviour. Requesting an interrupts is done
by calling sys_irqsetpolicy using an interrupt and a given id. This
id can be modified by the sys_irqsetpolicy and must be used for
subsequent calls to sys_irqenable/sys_irqdisable. However upon an
incoming call from the kernel NOTIFY_ARG contains the original value
encoded in a set e.g. if 1 << id == true the interrupt was raised.
We used to load the memory driver above the other modules to allow
the memory driver (ramdisk) to grow. We no longer want or need this
this as we have a working mmc driver.
This files defines two constants which are only used through
sys/syslimits. So they where moved there instead of including the file
and it was removed.
* Also cleanup a bit the makefile.
* Also removing small inconsistency for arm builds where log would be
skipped if doing a make hdboot, but not when cross-compiling.
Thomas Cort [Sat, 6 Apr 2013 22:46:56 +0000 (22:46 +0000)]
tests/run: add test69 to setuids.
test69 requires superuser powers to adjust the time. This caused
the test to fail when run as a normal user. The patch adds test69
to the setuid list which will allow regular users to execute it.
Thomas Cort [Sat, 6 Apr 2013 12:47:10 +0000 (12:47 +0000)]
Importing usr.sbin/rdate
Import the NetBSD rdate command and remove the Minix rdate command.
The default behaviour for both is the same. The NetBSD version adds
options to just display the time, adjust the time using adjtime(),
and set the time without printing the time.
Porting Notes:
- Compiles cleanly out of the box without any warnings
- Path changes from /usr/bin/rdate to /usr/sbin/rdate
- checked pkgsrc for any usages of rdate (none found)
- checked src for any usages of rdate (none found)
Testing:
- all command line options work (tested with time.nist.gov server)
- Native and cross build OK
Ben Gras [Fri, 5 Apr 2013 15:24:47 +0000 (15:24 +0000)]
top: a few fixes
. fixed overflow in ticks compare function, causing
occasionally esp. the kernel to be mis-ordered by cpu
time
. fixed some const string related warnings
. fixed some variable name shadowing warnings
Thomas Cort [Sat, 30 Mar 2013 16:59:21 +0000 (16:59 +0000)]
libc: add clock_settime() system call.
This also adds the sys_settime() kernel call which allows for the adjusting
of the clock named realtime in the kernel. The existing sys_stime()
function is still needed for a separate job (setting the boottime). The
boottime is set in the readclock driver. The sys_settime() interface is
meant to be flexible and will support both clock_settime() and adjtime()
when adjtime() is implemented later.
settimeofday() was adjusted to use the clock_settime() interface.
One side note discovered during testing: uptime(1) (part of the last(1)),
uses wtmp to determine boottime (not Minix's times(2)). This leads `uptime`
to report odd results when you set the time to a time prior to boottime.
This isn't a new bug introduced by my changes. It's been there for a while.
Thomas Cort [Fri, 29 Mar 2013 21:48:22 +0000 (21:48 +0000)]
libc: add clock_getres()/clock_gettime() system calls.
In order to make it more clear that ticks should be used for timers
and realtime should be used for timestamps / displaying the date/time,
getuptime() was renamed to getticks() and getuptime2() was renamed to
getuptime().
Servers, drivers, libraries, tests, etc that use getuptime()/getuptime2()
have been updated. In instances where a realtime was calculated, the
calculation was changed to use realtime.
System calls clock_getres() and clock_gettime() were added to PM/libc.
Thomas Cort [Fri, 29 Mar 2013 19:34:29 +0000 (19:34 +0000)]
kernel: rename realtime to monotonic, add realtime
Old realtime was used for both timers (where an accurate count of
all ticks is needed) and the system time. In order to implement
adjtime(2), these duties must be separated as changing the time
of day by a small amount shouldn't affect timers in any way nor
should it change the boot time.
Following the naming of the clocks used by clock_gettime(2). The
clock named 'realtime' will represent the best guess at the
current wall clock time, and the clock named 'monotonic' will
represent the absolute time the system has been running.
Use monotonic for timers in kernel and in drivers. Use realtime
for determining time of day, dates, etc.
This commit simply renames realtime to monotonic and adds a new
tick counter named realtime. There are no functional changes in
this commit. It just lays the foundation for future work.
Ben Gras [Tue, 2 Apr 2013 22:42:17 +0000 (22:42 +0000)]
some etc fixes
. split user-editable and system-owned files in etc/Makefile
. mtab is a symlink, not a file now; remove it
. force-install of certain system-controlled /etc files from
top Makefile
. rename /etc/make.conf to /etc/mk.conf; and don't set $ARCH;
reduce difference in bsd.own.mk
Thomas Cort [Sun, 17 Mar 2013 23:54:20 +0000 (19:54 -0400)]
release.sh: pkg_install should be installed 1st
pkgin now depends on pkg_install. If pkg_install appears after pkgin
in PREINSTALLED_PACKAGES, there will be an error because pkg_install
was installed as a dependency for pkgin.
Ben Gras [Sat, 29 Dec 2012 00:16:33 +0000 (00:16 +0000)]
VM: pagequeue data structure
. data structure that automatically keeps a set
of pages in reserve, to replace sparepages and
possibly re-used in the future for similar situations,
e.g. if in-filesystem-cache block eviction is
implemented and FS asks for a new block
Lionel Sambuc [Fri, 8 Mar 2013 18:18:09 +0000 (19:18 +0100)]
Install default users directly
Install /home/ast and /home/bin as part of the system build procedure,
as the setup script is not ran on the arm image.
/home/bin is needed for successful completion of our test suite.
This patch does not change the setup script, as it is not bothered by
those files/directiories being already there, and may be useful during
reinstallation on intel systems.
Thomas Veerman [Fri, 8 Mar 2013 14:17:13 +0000 (14:17 +0000)]
UDS: terminate canonical path string
When you provided a string with junk after the terminating nul to a
UNIX domain socket and used bind(2), the canonical path function would
not properly terminate the new string. This caused VFS to return
ENAMETOOLONG on an otherwise valid path name.
* Use the same output directory as was previously the standard.
* Add copying of uEnv and cmdline to the obj directory to allow booting from tftp.
* No longer start qemu at the end of the process.
* Use sudo if the script was called as non root user.
Lionel Sambuc [Wed, 27 Feb 2013 16:53:12 +0000 (17:53 +0100)]
Let the build system manage compilation flags
Do not hardcode warning and optimisation flags, otherwise the
main options (i.e. DBG, CPPFLAGS) will not work as expected.
You can still provide specific default by using DBG?=<value>.
Doing so leaves the opportunity to override the setting from the
commandline, while the default value from the build system is
then ignored for that particular package.
When crosscompiling, and using build.sh, adding -V DBG=<value> has
this same effect as make DBG=<value>.
Ben Gras [Wed, 6 Mar 2013 18:27:47 +0000 (19:27 +0100)]
kernel, ramdisk: some boot unification
To use the new SD building script, Linux has to be configured with
loop.max_part=15 on the command line (or set at module load time)
to make the loopback device see the partitions.
This commit removes a lot of differences between the ARM and x86
boot ramdisk and rc scripts. It changes the ARM build from running
from ramdisk to requiring a full filesystem on the SD image and
booting into it.
. ramdisk: remove some arm-only utilities only used for running
from the shell
. remove ARM-only rc.arm, proto.arm.small, ttys and mylogin.sh
boot-time ramdisk files
. change kernel to add "arch" variable so userland knows what
we're running on from sysenv
. make ARM use the regular ramdisk rc file, changed to distinguish
i386-only and ARM-only drivers; requires rootdevname to be set
. change /etc/rc and /usr/etc/rc to start i386-only drivers only on
i386 systems
. change the kernel/arm to have a special case for the memory
driver to load it higher so it can be bigger
. add uEnv.txt, cmdline.txt and a for now highly linux-dependent
SD preparation script arm_sdimage.sh to the git repository in
releasetools/
Thomas Veerman [Tue, 5 Mar 2013 10:10:41 +0000 (10:10 +0000)]
UDS: check connection state better
Select(2)ing on UNIX domain sockets was not working properly because
connection state wasn't properly checked/propagated. So selecting for
a read descriptor and closing the write descriptor on the other end
didn't cause select to return. Similarly, read(2) kept blocking while
it should return an error when the other end closed the socket.
Ben Gras [Tue, 5 Mar 2013 16:17:21 +0000 (17:17 +0100)]
VM: shared memory pagefault fix
. if there is no memory there, it's not writable; this
check bug by the shared memory's writable() method causes
pagefaults not to be handled at all in certain situations,
triggering an assert() in pt_writemap()
. added some assert()s to catch this and similar situations
in the future
Thomas Veerman [Thu, 28 Feb 2013 14:44:23 +0000 (14:44 +0000)]
Spring cleanup
Remove old versions of system calls and system calls that don't have
a libc api interface anymore (dup, dup2, creat).
VFS still contains support for old system call numbers for the new stat
system calls (i.e., 65, 66, 67) to keep supporting old binaries built for
MINIX 3.2.1 (prior to the release).