Server/driver protocols: no longer allow third-party copies.
Before safecopies, the IO_ENDPT and DL_ENDPT message fields were needed
to know which actual process to copy data from/to, as that process may
not always be the caller. Now that we have full safecopy support, these
fields have become useless for that purpose: the owner of the grant is
*always* the caller. Allowing the caller to supply another endpoint is
in fact dangerous, because the callee may then end up using a grant
from a third party. One could call this a variant of the confused
deputy problem.
From now on, safecopy calls should always use the caller's endpoint as
grant owner. This fully obsoletes the DL_ENDPT field in the
inet/ethernet protocol. IO_ENDPT has other uses besides identifying the
grant owner though. This patch renames IO_ENDPT to USER_ENDPT, not only
because that is a more fitting name (it should never be used for I/O
after all), but also in order to intentionally break any old system
source code outside the base system. If this patch breaks your code,
fixing it is fairly simple:
- DL_ENDPT should be replaced with m_source;
- IO_ENDPT should be replaced with m_source when used for safecopies;
- IO_ENDPT should be replaced with USER_ENDPT for any other use, e.g.
when setting REP_ENDPT, matching requests in CANCEL calls, getting
DEV_SELECT flags, and retrieving of the real user process's endpoint
in DEV_OPEN.
The changes in this patch are binary backward compatible.
Thomas Veerman [Fri, 8 Apr 2011 15:23:12 +0000 (15:23 +0000)]
Enable a process to find out what the error code was when delivery of an
asynchronous message resulted in an error.
The model here is that:
- Iff a sender wishes to be notified, the sender MUST check for errors
BEFORE sending another asynchronous message.
The reason is that in order to remember the error code, we can't clean up
the message table and hence we risk running out of table space. This is
less of a problem when the sender enables notifications only for errors.
Thomas Veerman [Fri, 8 Apr 2011 15:14:48 +0000 (15:14 +0000)]
Enable sending a notification when sending of an asynchronous message was
completed (successfully or not). AMF_NOTIFY_ERR can be used if the sender
only wishes to be notified in case of an error (e.g., EDEADSRCDST). A new
endpoint ASYNCM will be the sender of the notification.
Tomas Hruby [Thu, 7 Apr 2011 07:44:27 +0000 (07:44 +0000)]
LWIP - Fix for dhcpd broadcast to work after boot
Dhcp only works if devices are configured with a broadcast source
address at the begining as it currently uses raw ip sockets and the
sockets sets the source address. It is a quick hack and proper hdcpd
fix is preferable
Tomas Hruby [Thu, 7 Apr 2011 07:44:17 +0000 (07:44 +0000)]
LWIP - dhcpd --lwip
A sort of quick hack for dhcpd to work as a client with lwip server.
- The functionality is not changed unless --lwip switch is supplied.
dhcpd does not use broadcast udp sockets but some sort of raw
sockets and changes their behavior during their life by ioctls.
- I thought there is no need to polute lwip just to make dhcp client
work. Instead I decided to twist the client a little bit.
- It is so far the only big collision I found between inet and lwip.
Tomas Hruby [Thu, 7 Apr 2011 07:43:03 +0000 (07:43 +0000)]
LWIP - udp_io_hdr.h
lwip server needs to include struct udp_io_hdr but must not include
struct udp-hdr as it conflicts with its internal type. So it is split
into to files now.
VFS: bugfixes for handling block-special files:
- on driver restarts, reopen devices on a per-file basis, not per-mount
- do not assume that there is just one vnode per block-special device
- update block-special files in the uncommon mounting success paths, too
- upon mount, sync but also invalidate affected buffers on the root FS
- upon unmount, check whether a vnode is in use before updating it
Gianluca Guida [Tue, 22 Mar 2011 13:47:35 +0000 (13:47 +0000)]
Add libminlib for NBSD libc compilation.
This library includes various random and minix-specific functions
included in the Minix libc. Most of them should be part of libsys,
and in general it would be nice to extinguish this library over
time.
Thomas Veerman [Fri, 18 Mar 2011 10:29:54 +0000 (10:29 +0000)]
- Refactor mthread structure fields to prevent name clashes
- Remove sanity checks for initialized mutexes and condition variables. This
significantly boosts performance. The checks can be turned back on by
compiling libmthread with MTHREAD_STRICT. According to POSIX operations on
uninitialized variables are a MAY fail if, therefore allowing this
optimization.
- Test59 has to be accommodated to the lack of sanity checks on uninitialized
variables in the library. It specifically tests for them and will run into
segfaults when the checks are absent in the library.
- Fix a few bugs related to the scheduler
- Do some general code cleanups
Ben Gras [Thu, 10 Mar 2011 12:54:58 +0000 (12:54 +0000)]
release.sh: explicitly use the pkgin pkg_install pkg_add
. when switching from the base pkg_install to the pkgin pkg_install,
the version number changed, causing a compatability problem if the
old base system binary was inadvertently left behind.
. this change checks for that situation by specifically invoking
the pkgin instance of pkg_install and telling the user to install
it if it doesn't exist.
Gianluca Guida [Fri, 4 Mar 2011 23:15:48 +0000 (23:15 +0000)]
Various fixes for NBSD include.
This patch include various fixes to NBSD includes.
- unistd.h: Avoid different linkages on non-_NETBSD_SOURCE
compilation;
- stdlib.h: remove devname declaration.
- sys/select.h: Add _MINIX specific flags.
- limits.h: Add SYMLOOP_MAX and SYMLINK_MAX
- time.h: Fix CLOCKS_PER_SEC and remove BSD's timer_t, as it
confuses minix own specific timers.
- utmp.h: Set Minix-specific paths and use Minix utmp format.
- param.h: Do not set BSD4_4, as this mostly means sa_len in
struct sock_addr.
- arch/i386/include/param.h: include <machine/vmparam.h> to
add PAGE_SIZE and related macros, defined round_page() and
trunc_page() for minix compatibility.
- dirent.h: remove DIRBLKSIZ and fix d_ino/d_fileno.
- sys/dir.h: ADD from existing includes and edit include
conditions.
- sys/dirent.h: include <minix/dirent.h>, fix d_ino/d_fileno.
- sys/fd_set.h: set default FD_SETSIZE at __MINIX_OPENMAX, as
the default NetBSD value is too big and cause vfs to return
an error.
- sys/cdefs.h: Always include <minix/ansi.h>
- minix/paths.h: Add Minix-specific paths.
- minix/dirent.h: ADD, keep only "direct" and "flex"definitions.
- minix/types.h: include <minix/ansi.h>
Gianluca Guida [Fri, 4 Mar 2011 22:37:43 +0000 (22:37 +0000)]
Sync NBSD libc errno.h with minix errno.h
This patch fixes some wrong error code number in nbsd libc's sys/errno.h
and adds new ones.
As in NetBSD the errno.h is used to automatically generate errlist.c array,
EBADCPU set to 1000 to be a bit too large, so we instruct the awk script
to stop at EDEADEPT (ELAST).
Gianluca Guida [Fri, 4 Mar 2011 22:31:31 +0000 (22:31 +0000)]
Fix stat, add fstat and other NBSD libc fixes.
This patch changes the NBSD libc stat implemenation and adds
fstat (and headers), taken from current libc.
It also adds weaks alias to functions in the resolver that
were removed from public use in NetBSD but that are still
used by Minix, and fixes a NetBSD non-REENTRANT bug in
in gen/initdir.c.
Gianluca Guida [Thu, 3 Mar 2011 16:41:19 +0000 (16:41 +0000)]
mk scripts: add flag for compiling with nbsd libc.
This patch changes the system mk scripts to enable compilation
of programs using the BSD make system to compile with the new
libc.
In details, it does the following:
- it always defines the __MINIX make variable. This can be used,
in porting applications, to specialize Makefiles for Minix.
- If the environment variable NBSD is set to something different
than 'no' and if the compiler is not ack, set NBSD_LIBC to 'yes'.
This will set the destination lib directory to '/usr/netbsd/lib'
and set up CPPFLAGS and LDFLAGS to use new libc's includes and
library directory.
Gianluca Guida [Thu, 3 Mar 2011 16:39:02 +0000 (16:39 +0000)]
Move even more includes to common/include.
This patch moves more includes (most of them, to tell the truth) to
common/include directory. This completes the list of includes needed
to compile current trunk with the new libc (but to do that you need
more patches in queue).
This patch also contains some modification (for compilation with new
headers) to the common includes under __NBSD_LIBC, the define used
in mk script to specialize compilation with new includes.
Ben Gras [Mon, 21 Feb 2011 15:05:32 +0000 (15:05 +0000)]
mark forked process as such in the kernel p_name
. helps debugging output; you can see the difference
between parent and child easily (it's sometimes
confusing to see an expected endpoint number with
an unexpected name, i.e. before exec())
. when processes crash after fork and before exec, it's
an instant hint that that's what's going on, instead of
it being the parent (endpoint numbers don't usually convey
this)
. name returns to 'normal' after exec(), so *F isn't visible
normally at all. (Except for for RS which forks apparently.)
Gianluca Guida [Tue, 15 Feb 2011 20:12:04 +0000 (20:12 +0000)]
Fix NetBSD a.out bug in common/libc and port Makefile
This patch includes the required modifications (summarized
in common/lib/libc/minix-port.patch) to make the common
part of the NetBSD libc to compile and work under Minix.
Gianluca Guida [Tue, 15 Feb 2011 12:19:40 +0000 (12:19 +0000)]
Port NetBSD libc functions to Minix.
This patch contains changes to NetBSD libc code base to make it
compile and work on Minix. Some of them are due to actual NetBSD
libc bugs, as we're compiling it in non-reentrant mode and with
a.out support, something not exactly frequent in NetBSD.
Others are proper fixes to port it to Minix (mostly sa_len
parameter missing in socket and a few mmap from files).
Gianluca Guida [Tue, 15 Feb 2011 12:03:42 +0000 (12:03 +0000)]
This patch modifies the NetBSD basic includes to be Minix
compatible. There are also changes in the make file, mostly to
let them install in /usr/netbsd/include.
Gianluca Guida [Mon, 14 Feb 2011 19:36:03 +0000 (19:36 +0000)]
Import unmodified NetBSD libc in trunk
This patch imports the unmodified current version of NetBSD libc.
The NetBSD includes are in /nbsd_include, while the libc code itself is
split between lib/nbsd_libc and common/lib/libc.
Gianluca Guida [Mon, 14 Feb 2011 12:49:18 +0000 (12:49 +0000)]
Move network includes and lib.h into common/include subdir.
This patch moves further includes (the network part and lib.h) in common/.
It is the last part to get the netbsd libc to compile under minix. Further moves will be needed as we get the netbsd libc to compile minix itself.
Also, this patch add #ifndef's to termios.h, as it create problems with netbsd's namespace.h.
Ben Gras [Thu, 10 Feb 2011 15:05:18 +0000 (15:05 +0000)]
take pkgsrc.conf out of the base system.
. use bmake for pkgsrc instead, reads mk.conf from /usr/pkg/etc/mk.conf
. tracking bmake from pkgsrc eases tracking pkgsrc
. further disentangles pkgsrc from base system, reducing maintenance
burden of pkgsrc