Commit graph

616 commits

Author SHA1 Message Date
Evgeniy Ivanov ef0a265086 New stat structure.
* VFS and installed MFSes must be in sync before and after this change *

Use struct stat from NetBSD. It requires adding new STAT, FSTAT and LSTAT
syscalls. Libc modification is both backward and forward compatible.

Also new struct stat uses modern field sizes to avoid ABI
incompatibility, when we update uid_t, gid_t and company.
Exceptions are ino_t and off_t in old libc (though paddings added).
2011-07-12 16:39:55 +02:00
Evgeniy Ivanov 48331843ea Update minix-port.patch. 2011-07-12 16:39:55 +02:00
Evgeniy Ivanov 5da4a0bd56 Move minimal libc from libsys into separate lib.
Now users can choose between libsys, libsys + libminc and
libsys + libc. E.g. PUFFS/FUSE servers need libsys + libc while
old servers can use libsys + libminc.
2011-07-09 22:32:38 +02:00
Ben Gras 898d9f97f6 libm: remove debug statements 2011-07-09 16:12:14 +02:00
Ben Gras 9aa4fb0dc6 update nbsd port patch files 2011-07-08 16:51:20 +02:00
Ben Gras a4ac03c188 libm: add i387/ dir, fix test51 compilation
. if $MACHINE_ARCH is unknown, use $MACHINE like in libc
	. fixes test51 compilation for gcc/clang (with other compile
	  and link fixes)
2011-07-08 16:34:40 +02:00
Ben Gras cf7f7d0ef1 nbsd libc: global constructors run sanity check 2011-07-08 16:34:40 +02:00
Thomas Veerman b61266eb51 Fix compiler warnings and mutex deadlock 2011-07-08 13:59:07 +00:00
Thomas Cort f66e550c80 namespace.h: add entry for shutdown(2) 2011-07-07 18:47:06 +02:00
Ben Gras 545ac12f3d nbsd libc: no alias for getpw* minix compat symbols 2011-07-06 19:02:17 +02:00
Ben Gras 9fdd167da4 nbsd libc: disable i386 exec*() optimisation 2011-07-06 11:36:24 +02:00
Ben Gras afc8f3defa compat.S: succincter and without mktemp 2011-07-05 16:17:29 +02:00
Ben Gras 434119ab89 stopgap measure to define originals of __RENAMEd symbols 2011-07-05 15:07:59 +02:00
Ben Gras f3d5a9dc61 Reduce compiler/libraries/headers cases to only two
1. ack, a.out, minix headers (moved to /usr/include.ack),
	   minix libc
	2. gcc/clang, elf, netbsd headers (moved to /usr/include),
	   netbsd libc (moved to /usr/lib)

So this obsoletes the /usr/netbsd hierarchy.

No special invocation for netbsd libc necessary - it's always used
for gcc/clang.
2011-07-04 04:09:52 +02:00
Ben Gras 9c01ceb576 introduce sqrt_approx() in -lsys
. use this to avoid -lm dependency in mfs
2011-07-04 02:51:12 +02:00
Arun Thomas 49a93d54be Update minix-port.patch 2011-07-01 17:53:12 +02:00
Thomas Cort 66b369c62c opendir(3): on success, don't clobber errno
The opendir(3) function was setting errno to ENOTDIR even
when the directory existed and was opened successfully. This
caused git to falsely detect an error.

This change moves the errno assignment into the failure code
block. It also adds a test to test24 to check for errno
changing when opendir(3) returns success.
2011-06-29 19:58:41 +02:00
Arun Thomas 5971d0532c GCC build option for elf libs and usr.bin 2011-06-29 10:32:37 +02:00
Arun Thomas ecb1c96fc5 Build libelf and mkimage in world 2011-06-29 09:33:40 +02:00
Arun Thomas 9902a435cd Simplify ELF library build logic
-Remove obsolete clang-libraries and gnu-libraries targets
-Buildworld now builds elf-libraries as well
2011-06-28 17:27:50 +02:00
Thomas Cort 69bf8e4f71 add pkgsrc hooks for building pkgs w/nbsd_libc
Add two makefiles to manage compiling packages with NetBSD libc.

  *  minix.libc.mk contains the proper CFLAGS/LDFLAGS
  *  pkgsrchooks.mk contains the logic for setting the flags.
  *  update bmake

Several pkg-config files were added to help pkgsrc learn about
the c, minlib, and compat_minix libraries.
2011-06-27 15:10:34 +02:00
Arun Thomas 93ae43f577 boot: Add multiboot support
Not yet fully spec-compliant; work in progress
2011-06-24 17:21:51 +02:00
Ben Gras e785381d4d introduce option to time assert()s
. remove a few asserts in the kernel and 64bi library
    that are not compatible with the timing code
  . change the TIME_BLOCKS code a little to work in-kernel
2011-06-24 16:00:42 +02:00
Gianluca Guida cc17b27a2b Build NetBSD libc library in world in ELF mode.
3 sets of libraries are built now:
  . ack: all libraries that ack can compile (/usr/lib/i386/)
  . clang+elf: all libraries with minix headers (/usr/lib/)
  . clang+elf: all libraries with netbsd headers (/usr/netbsd/)

Once everything can be compiled with netbsd libraries and headers, the
/usr/netbsd hierarchy will be obsolete and its libraries compiled with
netbsd headers will be installed in /usr/lib, and its headers
in /usr/include. (i.e. minix libc and current minix headers set
will be gone.)

To use the NetBSD libc system (libraries + headers) before
it is the default libc, see:
   http://wiki.minix3.org/en/DevelopersGuide/UsingNetBSDCode
This wiki page also documents the maintenance of the patch
files of minix-specific changes to imported NetBSD code.

Changes in this commit:
  . libsys: Add NBSD compilation and create a safe NBSD-based libc.
  . Port rest of libraries (except libddekit) to new header system.
  . Enable compilation of libddekit with new headers.
  . Enable kernel compilation with new headers.
  . Enable drivers compilation with new headers.
  . Port legacy commands to new headers and libc.
  . Port servers to new headers.
  . Add <sys/sigcontext.h> in compat library.
  . Remove dependency file in tree.
  . Enable compilation of common/lib/libc/atomic in libsys
  . Do not generate RCSID strings in libc.
  . Temporarily disable zoneinfo as they are incompatible with NetBSD format
  . obj-nbsd for .gitignore
  . Procfs: use only integer arithmetic. (Antoine Leca)
  . Increase ramdisk size to create NBSD-based images.
  . Remove INCSYMLINKS handling hack.
  . Add nbsd_include/sys/exec_elf.h
  . Enable ELF compilation with NBSD libc.
  . Add 'make nbsdsrc' in tools to download reference NetBSD sources.
  . Automate minix-port.patch creation.
  . Avoid using fstavfs() as it is *extremely* slow and unneeded.
  . Set err() as PRIVATE to avoid name clash with libc.
  . [NBSD] servers/vm: remove compilation warnings.
  . u32 is not a long in NBSD headers.
  . UPDATING info on netbsd hierarchy
  . commands fixes for netbsd libc
2011-06-24 11:46:30 +02:00
Ben Gras e3f68488ee fix many clang warnings in lib/ 2011-06-23 19:25:36 +02:00
Antoine Leca 6d8d7a88b2 libc!setmode.c: Avoid #if inside macro call
#if inside macro call is undefined behaviour under the C standard
(3.8.3 paragraph 10 for C90, 6.8.10 paragraph 11 for C99).
The same effect can be achieved with a slightly more verbose construct,
putting the whole macro call inside the #ifdef/#else/#endif.
2011-06-23 17:54:17 +02:00
Erik van der Kouwe 6e0f3b3bda Split off sys_umap_remote from sys_umap
sys_umap now supports only:
- looking up the physical address of a virtual address in the address space
  of the caller;
- looking up the physical address of a grant for which the caller is the
  grantee.

This is enough for nearly all umap users. The new sys_umap_remote supports
lookups in arbitrary address spaces and grants for arbitrary grantees.
2011-06-10 14:28:20 +00:00
Thomas Cort 25d26d76fd A few aesthetic changes to make the minix port more acceptable
to upstream.

  - revert to upstream version of function prototypes for
    setting the uid and gid fields of the archive_entry.
  - move uid/gid overflow checks into header_common().
  - use archive_set_error() instead of fprintf() for getting
    error message text back to the main program.
2011-06-10 00:40:22 +02:00
Ben Gras b19820774e fixed clang warnings in drivers/
. changed debug statements system for audio/ to do so
2011-06-09 16:57:51 +02:00
Ben Gras 230b7775fe changes for detecting and building for clang/binutils elf
and minor fixes:
 . add ack/clean target to lib, 'unify' clean target
 . add includes as library dependency
 . mk: exclude warning options clang doesn't have in non-gcc
 . set -e in lib/*.sh build files
 . clang compile error circumvention (disable NOASSERTS for release builds)
2011-06-07 16:49:52 +02:00
Thomas Cort 4a5ca363b5 libarchive: fix bad timestamp bug caused by bit shift.
The file timestamps in archives created by libarchive all had
dates in the year 2038. It was caused by a bit shift in
archive_write_set_format_ustar which shifted 1 instead of 1ull.
2011-06-06 20:52:22 +02:00
Ben Gras c02833ced6 <timers.h> - add feature to time a code block
. also minor compile fixes for it
2011-06-06 09:04:11 +02:00
Gianluca Guida aff45df1af libcompat: Add net/gen stub headers.
This helps reducing patching when compiling legacy minix net utils.
2011-05-24 16:54:11 +02:00
Arun Thomas 2a839c735e Import libelf from elftoolchain r1525 2011-05-21 19:15:26 +02:00
Erik van der Kouwe e969b5e11b Remote unused segctl kernel call 2011-04-26 23:28:23 +02:00
David van Moolenbroek 020277a38f libmthread: support for thread-local storage (keys/specifics) 2011-04-14 11:54:43 +00:00
Thomas Veerman b1a60476c0 Return errors directly instead of using errno 2011-04-13 14:01:13 +00:00
David van Moolenbroek c51cd5fe91 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.
2011-04-11 17:35:05 +00:00
David van Moolenbroek c4928b2df9 libsys: fix micro_delay() 2011-04-08 16:57:44 +00:00
Thomas Veerman 2cde22ee10 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.
2011-04-08 15:23:12 +00:00
Arun Thomas cd9b4b46f4 libexec: return physaddr info from ELF headers 2011-04-07 12:22:36 +00:00
Tomas Hruby abab24b785 LWIP - liblwip
lwip-1.4.0-rc1 imported as liblwip
2011-04-07 07:43:36 +00:00
Gianluca Guida 3bbd454578 [NBSD libc] Various fixes. 2011-04-06 15:59:10 +00:00
David van Moolenbroek 53ad9d83b9 libvtreefs: return OK from REQ_INHIBREAD (this unbreaks grep on /proc) 2011-03-31 16:23:00 +00:00
Gianluca Guida 9caa53e8d9 Add libasyn, asynchio support for netbsd libc. 2011-03-23 15:28:22 +00:00
Gianluca Guida 878ba523ac 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.
2011-03-22 13:47:35 +00:00
Gianluca Guida 6bcf58bab8 Add libcompat_minix for NBSD libc
libcompat_minix is a compatibility layer meant to let existing commands to work
with the new libc.
2011-03-18 16:08:26 +00:00
Gianluca Guida 0dc9e0996a Import unmodified NetBSD's libm for compiling with new libc.
As the current libc includes a libm implementation, with the new libc
this is needed. Unneeded (for the moment) archs have been removed.
2011-03-18 15:52:16 +00:00
Gianluca Guida 6f4e3dd910 Move elf headers in common/include and libexec.h in lib/libexec.
It also fixes elf headers for NBSD compilation.
2011-03-18 15:13:05 +00:00
Thomas Veerman c8d0edc06a - 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
2011-03-18 10:29:54 +00:00