Commit graph

829 commits

Author SHA1 Message Date
Thomas Veerman 41e69065b9 Fix stat symbols 2011-11-30 11:17:13 +00:00
David van Moolenbroek c9ba1ad75d libpuffs: remove unused block device code 2011-11-29 16:56:52 +01:00
Raja Appuswamy 03a8d06668 adding rwlock and event support to mthread 2011-11-29 14:35:22 +01:00
David van Moolenbroek e2758c6759 libblockdriver: allow for not handling partitions
Each block driver now gets to specify whether it is a disk block
driver, which implies it wants the library to handle getting and
setting partitions for it.
2011-11-28 16:42:35 +01:00
Thomas Veerman fb50da9dad Fine grained compatibility with _RENAMEd symbols
The NetBSD libc provides a mechanism to have versions of system calls.
By 'renaming' symbols to a new version, freshly compiled programs will
automatically use the new symbol iff they use the proper header files. The
old, not renamed, version of the symbol will still exist (after being moved
to the compat directory), so old programs can still link.

Since MINIX doesn't support dynamic linking, the whole rename mechanism
doesn't really work for us. However, removing it would create a huge diff
with the current NetBSD libc.

A lot of the compat code relies on things we don't (seem to) have, and
therefore does not get built and linked. This causes trouble for tools like
autoconf, which will fail to find the renamed symbols. For example,
currently select gets renamed to __select50 in libc. Autoconf looks for
'select' and doesn't find it and reports we don't have it. This is where
the compat.S stub comes into play: it generates the old symbols and jumps to
the new symbols. However, as this is done in one object file, all renamed
symbols get linked together, causing binaries to be huge. This patch fixes
that by generating an object file for each renamed symbol.

This patch also makes the MISSING_SYSCALLS more complete and marginally
reduces the diff with NetBSD.
2011-11-28 10:12:44 +00:00
Thomas Veerman 92b61c816d Fix many more comiler warnings
Most warnings were harmless, some real bugs. Test set should now compile
cleanly with ack, gcc, and clang.
2011-11-28 10:07:55 +00:00
Thomas Veerman b4fb061802 Implement issetugid syscall
Implement issetugid syscall and provide a test. This gets rid of the
scary "Unsecure. Implement me" warning during compilation.
2011-11-28 10:03:43 +00:00
David van Moolenbroek fd4c2b74f3 Add block device tracing facility
The implementation is in libblockdriver, and works transparently for
all block drivers. The new btrace(8) tool can be used to control block
tracing; see ``man btrace'' for details.
2011-11-25 13:47:21 +01:00
David van Moolenbroek b4d909d415 Split block/character protocols and libdriver
This patch separates the character and block driver communication
protocols. The old character protocol remains the same, but a new
block protocol is introduced. The libdriver library is replaced by
two new libraries: libchardriver and libblockdriver. Their exposed
API, and drivers that use them, have been updated accordingly.
Together, libbdev and libblockdriver now completely abstract away
the message format used by the block protocol. As the memory driver
is both a character and a block device driver, it now implements its
own message loop.

The most important semantic change made to the block protocol is that
it is no longer possible to return both partial results and an error
for a single transfer. This simplifies the interaction between the
caller and the driver, as the I/O vector no longer needs to be copied
back. Also, drivers are now no longer supposed to decide based on the
layout of the I/O vector when a transfer should be cut short. Put
simply, transfers are now supposed to either succeed completely, or
result in an error.

After this patch, the state of the various pieces is as follows:
- block protocol: stable
- libbdev API: stable for synchronous communication
- libblockdriver API: needs slight revision (the drvlib/partition API
  in particular; the threading API will also change shortly)
- character protocol: needs cleanup
- libchardriver API: needs cleanup accordingly
- driver restarts: largely unsupported until endpoint changes are
  reintroduced

As a side effect, this patch eliminates several bugs, hacks, and gcc
-Wall and -W warnings all over the place. It probably introduces a
few new ones, too.

Update warning: this patch changes the protocol between MFS and disk
drivers, so in order to use old/new images, the MFS from the ramdisk
must be used to mount all file systems.
2011-11-23 14:06:37 +01:00
Ben Gras 8b69d04fff csu: add code to call constructors to be used by clang
. clang-linked binaries were not calling global constructors, as the
	  code to do so wasn't in csu/ and linked
	. it does work for gcc as it uses its self-supplied crt{begin,end} code
	. this commit copies netbsd's crt{begin,end}.S, which contains
	  constructor/destructor calling code, called from .init and .fini
	  sections already accumulated by the linker. the _init function was already
	  called by the C startup code before calling main.
	. based on work by Antoine Leca
2011-11-20 20:20:51 +01:00
Thomas Cort 0c9b539a35 compat.S: add getpwnam() alias.
Needed for finding getpwnam() when a prototype is not given.
2011-11-20 18:36:42 +01:00
Arun Thomas 3f9ef4ac46 make: set MACHINE_ARCH variable
Also, modify sys.mk so we continue to build with -O
2011-11-18 16:22:25 +01:00
Ben Gras ee8602a486 minor bugfixes caught by clang warnings 2011-11-18 12:18:23 +01:00
Ben Gras 79285c3664 libarchive: not for ack
. fixes compile error due to missing bzlib.h for ack
	. one less ack library
2011-11-18 11:49:21 +01:00
Vivek Prakash 79bfef9aab import NetBSD bzip2 and libbz2 2011-11-18 11:11:04 +01:00
Ben Gras 2c57ee566b pwcache_userdb alias.
. mainly so configure can find it without the prototype.
2011-11-16 12:59:40 +01:00
Vivek Prakash c4bce95897 Define flags in sys/stat.h 2011-11-15 17:14:57 +01:00
Ben Gras 5c00743626 Switch to NetBSD passwd format
Based on work by Vivek Prakash and Gianluca Guida.

See UPDATING about caveats on currently existing accounts.

	. restores netbsd libc pwcache functions
2011-11-14 14:47:42 +00:00
Thomas Veerman 4311136125 Fix compiler warnings 2011-11-14 14:21:39 +00:00
Thomas Veerman 490e0de548 Import librefuse and libpuffs
Import libpuffs and our port of libpuffs. The port was done as part of
GSoC 2011 FUSE project, done by Evgeniy Ivanov. The librefuse import
did not require any porting efforts. Libpuffs has been modified to
understand our VFS-FS protocol and translate between that and PUFFS. As
an example that it works, fuse-ntfs-3g from pkgsrc can be compiled and
used to mount ntfs partitions:
mount -t ntfs-3g <device> <mountpoint>

FUSE only works with the asynchronous version of VFS. See <docs/UPDATING> on
how to run AVFS.

This patch further includes some changes to mount(1) and mount(2) so it's
possible to use file systems provided by pkgsrc (note: manual modifications
to /etc/system.conf are still needed. There has been made an exception for
fuse-ntfs-3g, so it already as an entry).
2011-11-14 11:53:05 +00:00
Thomas Veerman a209c3ae12 Fix a ton of compiler warnings
This patch fixes most of current reasons to generate compiler warnings.
The changes consist of:
 - adding missing casts
 - hiding or unhiding function declarations
 - including headers where missing
 - add __UNCONST when assigning a const char * to a char *
 - adding missing return statements
 - changing some types from unsigned to signed, as the code seems to want
   signed ints
 - converting old-style function definitions to current style (i.e.,
   void func(param1, param2) short param1, param2; {...} to
   void func (short param1, short param2) {...})
 - making the compiler silent about signed vs unsigned comparisons. We
   have too many of those in the new libc to fix.

A number of bugs in the test set were fixed. These bugs were never
triggered with our old libc. Consequently, these tests are now forced to
link with the new libc or they will generate errors (in particular tests 43
and 55).

Most changes in NetBSD libc are limited to moving aroudn "#ifndef __minix"
or stuff related to Minix-specific things (code in sys-minix or gen/minix).
2011-11-14 10:07:49 +00:00
David van Moolenbroek af01bda509 libbdev: initial version
The "bdev" library provides basic primitives for file systems to talk
to block device drivers, hiding the details of the underlying protocol
and interaction model.

This version of libbdev is rather basic. It is planned to support the
following features in the long run:

 - asynchronous requests and replies;
 - recovery support for underlying block drivers;
 - retrying of failed I/O requests.

The commit also changes our block-based file systems (mfs, ext2, isofs)
to make use of libbdev.
2011-11-09 14:43:25 +01:00
David van Moolenbroek 2602861f23 Move optset.c into libsys; remove redundant copies 2011-11-07 16:16:08 +01:00
David van Moolenbroek e1d867b686 ahci/libdriver: multithreading support
This patch adds support for executing multiple concurrent requests on
different devices on the same AHCI controller. The libdriver library
has been extended to include a generic multithreading interface, and
the AHCI driver has been extended to make use of this interface.

The original version of this code has been written by Arne Welzel.
2011-11-04 09:37:53 +00:00
Ben Gras 0c3983b25a update/fix manpage support
. add bsd-style MLINKS to minix man set, restoring aliases
	  (e.g. man add64 -> int64)
	. update daily cron script to run makewhatis and restore makewhatis
	  in man Makefile (makedb), restores functionality of man -k
	. netbsd imports of man, mdocml, makewhatis, libutil, apropos
	. update man.conf with manpage locations, restoring man [-s] <section>
	. throws out some obsolete manpages
2011-09-28 15:24:15 +00:00
Arun Thomas 05341dfeb0 sef: build sef_debug_header only when needed 2011-09-19 18:17:45 +02:00
Arun Thomas 92fa3189ab MKSYSDEBUG: conditionally compile more debug code 2011-09-16 15:25:26 +02:00
Ben Gras 4857d5d554 add -lminixfs with fs support routines
. move cache size heuristic from mfs there
	  so mfs and ext2 can share it
	. add vfs credentials retrieving function, with
	  backwards compatability from previous struct
	  format, to be used by both ext2 and mfs
	. fix for ext2 - STATICINIT was fed no.
	  of bytes instead of no. of elements, overallocating
	  memory by a megabyte or two for the superblock
2011-09-08 16:52:13 +00:00
Thomas Veerman d4b72e81b2 Cleanup servers to make GCC/Clang a little happier 2011-09-08 13:57:03 +00:00
Thomas Veerman 8a266a478e Increase gid_t and uid_t to 32 bits
Increase gid_t and uid_t to 32 bits and provide backwards compatibility
where needed.
2011-09-05 13:56:14 +00:00
Arun Thomas 4ca68d42a0 Add MKLIVEUPDATE and MKSTATECTL 2011-09-02 16:57:22 +02:00
Arun Thomas 5cddf6dce8 libsys: don't pull in strerror 2011-08-30 21:10:34 +02:00
Thomas Veerman 8a73de51f1 Tell VFS how many requests an FS can handle concurrently 2011-08-26 12:47:43 +00:00
Ben Gras 195190912f malloc build fixes 2011-08-18 22:30:51 +00:00
Ben Gras e81a0fd9c1 use minix malloc
. default jemalloc is not too easy to compile without threads
	  libraries/types
	. non-default malloc has odd virtual address space binge problem
	. switch to ack/minix malloc in old libc for now
2011-08-18 21:52:09 +00:00
Ben Gras 88e57eee69 make time functions pass PCTS test
. fixes a problem in building gawk wanting to provide
	  its own mktime otherwise
2011-08-18 14:02:57 +00:00
Arun Thomas 7b70f548e4 minlib: Add vm_query_exit 2011-08-12 17:15:42 +02:00
Ben Gras 10375d2629 don't keep minix-port.patch files in repo
. causes git noise, and unnecessary conflicts
	. are easily generated with 'make nbsd_diff' in tools/
2011-08-10 13:38:12 +00:00
Arun Thomas 86b061078b Build gcov code only if MKCOVERAGE is yes 2011-08-09 10:39:33 +02:00
Ben Gras 4a8ceeebff allow bind() with addr len >= sizeof(sockaddr_in)
. specifically, if it's struct sockaddr, which is
	  1 byte larger than sockaddr_in
	. unbreaks some applications
	. debugged and solved by Jan Wieck
2011-08-05 22:58:03 +02:00
Ben Gras d477a9ed82 vm/ipc: only report signals when it matters to ipc
. ipc wants to know about processes that get
	  signals, so that it can break blocking ipc operations
	. doing it for every single signal is wasteful
	  and causes the annoying 'no slot for signals' message
	. this fix tells vm on a per-process basis it (ipc)
	  wants to be notified, i.e. only when it does any ipc calls
	. move ipc config to separate config file while we're at it
2011-08-05 20:52:32 +00:00
Arun Thomas 862fb8354d minix.ack.mk: use CPPFLAGS for ACK asm files 2011-08-05 14:16:48 +02:00
Ben Gras 3977443581 terminfo fixes
. add TERM=minix to builtin terms
	. regenerate compiled-in compile_terms.c
	. fix terminfo db path
	. update termcap command
	. By Antoine Leca
2011-08-04 16:50:57 +00:00
Ben Gras a99a4b2a05 added missing m_closefrom.c 2011-08-03 12:51:28 +02:00
Ben Gras c4ea2a195c getsid() implementation 2011-08-02 22:16:59 +02:00
Ben Gras c0bb1ba1b1 closefrom() as library call 2011-08-02 22:16:58 +02:00
Ben Gras 989934b37c rename -lutil to -lminixutil
. in preparation for netbsd -lutil
2011-08-01 14:32:14 +02:00
Ben Gras 914d02825f libvassert: vmware VAssert support.
- BSD-licensed Code gratefully taken from the project at
	  http://en.sourceforge.jp/projects/sfnet_vassertlinuxsdk/

	- For more information on vmware VAssert, a powerful debugging
	  facility usable under vmware, see:
	  www.vmware.com/pdf/ws65_vassert_programming.pdf
2011-07-28 03:23:10 +00:00
Thomas Veerman 7588db2691 Add support for VFS-FS transaction IDs 2011-07-27 15:49:42 +00:00
Thomas Veerman 9b43de2cb3 Clean up mthread 2011-07-27 09:30:26 +00:00
Ben Gras 51ffecc181 import elf-only -lcurses
. abandons mixer, gomoku, talk, talkd, top from base system
	. compile top with clang so no ack-compiled program
	  needs -lcurses any more
2011-07-25 11:08:17 +02:00
Arun Thomas b7b7b3e63f add vfork to namespace.h 2011-07-22 14:07:04 +02:00
Arun Thomas f9ccc501f8 Add vfork() system call
-Same semantics as fork() as it's really just a stub
-Eases porting of BSD utilities
2011-07-22 10:55:30 +02:00
Ben Gras 000a9d36be cleanup of libterminfo introduction
. don't install minix <termcap.h> as libterminfo
	  has its own (but still install it in /usr/include.ack)
	. forget minix termcap functions in -lcompat_minix
	. make commands use -lterminfo in netbsd libc compile mode
2011-07-20 18:39:02 +02:00
Arun Thomas 5df8be8e7a buildsystem: use dependall target
Improves cache locality by grouping together dependency generation
with building for each program instead of doing a whole-tree dep
generation phase followed by a whole-tree build phase
2011-07-19 15:28:20 +02:00
Vivek Prakash 51e66a47d8 import libterminfo, terminfo.db and stat command 2011-07-18 16:17:14 +02:00
Ben Gras cb7a3b0299 mmap rename fix for netbsd libc 2011-07-16 16:52:21 +02:00
Ben Gras 02081e4b62 rename mmap() and munmap()
. it's a good extra interface to have but doesn't
	  meet standardised functionality
	. applications (in pkgsrc) find it and expect
	  full functionality the minix mmap doesn't offter
	. on the whole probably better to hide these functions
	  (mmap and friends) until they are grown up; the base system
	  can use the new minix_* names
2011-07-16 13:01:19 +02:00
Thomas Cort 76356eed97 compat.S: add shmctl(2) 2011-07-16 11:23:05 +02:00
Thomas Cort bb9fb905a1 Move uid/gid<=>name functions into libcompat_minix 2011-07-14 03:07:22 +02:00
Ben Gras 4691eeae9f generate sys_errlist without holes
. strerror() assumes this
	. remove generated libminc/errlist.c
	. errno's in <sys/errno.h> have to be in sorted order
	. filtering out some errno.h in Makefile lets us use near-stock
	  errlist.awk
2011-07-13 23:42:07 +02:00
Thomas Cort 42c2ae9786 compat.S: add setlocale(3) 2011-07-13 21:38:05 +02:00
Ben Gras ebffaa4250 import libcrypt
. move crypt() from minix-specific to netbsd -lcrypt
2011-07-13 18:19:27 +02:00
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
Dirk Vogt 97980446a4 Cleaning up Makefiles (thx antoine) 2011-03-07 13:54:17 +00:00
Dirk Vogt aca0749d71 Small fix, implemented getvid/did 2011-03-07 13:31:48 +00:00
Gianluca Guida 693842c855 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).
2011-03-04 22:37:43 +00:00
Gianluca Guida b87af1c325 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.
2011-03-04 22:31:31 +00:00
Gianluca Guida 98af1ee195 NBSD libc: fix forgot weak_alias
This patch add a few weak_alias forgotten, so that non-internal
symbols are defined to be used from application.

Modifying only the minix-specific part, this patch needs no update
to minix-port.patch.
2011-03-03 16:44:18 +00:00
Ben Gras 493ea15714 rename aligned() macro to _minix_aligned 2011-03-02 16:05:59 +00:00
Ben Gras 81b63473c0 minor fix for clang - do_unbind() becomes void 2011-02-27 00:10:33 +00:00
Arun Thomas 25a790a631 VM and kernel support for ELF 2011-02-26 23:00:55 +00:00
Dirk Vogt e94953a396 added libddekit 2011-02-25 12:40:31 +00:00
Dirk Vogt 8c8e44d0ae libdevman: IPC wrapper for devman 2011-02-25 12:28:07 +00:00
Dirk Vogt 0908191386 _mount.c: don't check for excutable if MS_EXISTING is set 2011-02-22 17:59:08 +00:00
Dirk Vogt 083d30afbb added libusb, a IPC abstraction lib for USB stuff 2011-02-22 10:23:38 +00:00
Gianluca Guida dc75514afc Set MACHINE_ARCH and MACHINE_CPU to in NBSD libc Makefile 2011-02-22 09:22:26 +00:00
Gianluca Guida 7193ee9890 Add Minix-specific siglist.c 2011-02-22 09:19:14 +00:00
Gianluca Guida 8aa9382e58 Simplify (and fix) NBSD libc's weak references of getcwd. 2011-02-22 09:08:24 +00:00
Ben Gras 0b920bb1cd clang - let buildsystem figure out how to invoke AR, etc., for clang too. 2011-02-22 01:08:29 +00:00
Gianluca Guida 7b9d99251f Fix signal handling in NBSD libc.
lib/nbsd_libc/minix-port.patch updated.
2011-02-21 18:06:54 +00:00
Ben Gras cba6e667da clang: support for building elf using temporary elf-targeted binutils. 2011-02-21 16:06:58 +00:00
Gianluca Guida 4f294c247f Add NBSDLibc Minix specific files.
This patch mainly copies and modifies files existing in
the current libc implementing minix specific functions.

To keep consisten with the NetBSD libc, we remove 
namespace stubs and we use "namespace.h" and weak
links.
2011-02-17 17:11:09 +00:00
Gianluca Guida 3c9575aadc Clean up NetBSD libc Minix port.
This patch add the proper .if/.else/.endif to the Makefiles, add places I forgot #ifdef __minix and remove newlines.
2011-02-15 16:31:16 +00:00
Gianluca Guida ad4dda469f 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).
2011-02-15 12:19:40 +00:00
Gianluca Guida b6cbf7203b 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.
2011-02-14 19:36:03 +00:00
Erik van der Kouwe b096b323d1 Fix comment mutilated by find/replace 2011-02-02 14:53:49 +00:00
Ben Gras dee29bbd3c some extra math functions from netbsd for netpbm. 2011-01-30 23:40:51 +00:00
Ben Gras dc1cc91df1 <ansi.h> -> <minix/ansi.h> 2011-01-28 11:35:02 +00:00
Erik van der Kouwe 04229f0581 Servers request TSC freq from kernel rather than each one measuring it individually 2011-01-11 11:03:37 +00:00
Arun Thomas 4fe0dfa9aa libc and csu updates for ELF 2010-12-10 23:04:04 +00:00
Arun Thomas d824b54d82 csu/build support for ELF 2010-12-10 22:20:12 +00:00
Arun Thomas 372b873413 VFS/RS support for ELF 2010-12-10 09:27:56 +00:00
Dirk Vogt 9ed280d1ec decouple file system server start/termination from mount/umount 2010-11-23 19:34:56 +00:00
Arun Thomas 7a4149a3f5 For GCC/clang, don't build in ACK int64 routines 2010-11-19 12:36:44 +00:00
Tomas Hruby 504abf4b34 Inlining 64bit integer handling functions
- if gcc/clang is used the C functions that use long long can be
  inlined to get better performance (yes, it makes difference)
2010-11-18 16:37:40 +00:00
Dirk Vogt 6208131459 libdriver without mandatory driver main loop 2010-11-17 15:10:20 +00:00
Dirk Vogt c22564335f Added possibility to inject input events to tty
M    include/Makefile
A    include/minix/input.h
M    include/minix/com.h
M    drivers/tty/keyboard.c
M    drivers/tty/tty.c
M    drivers/tty/tty.h
M    include/minix/syslib.h
M    lib/libsys/Makefile
A    lib/libsys/input.c
2010-11-17 14:53:07 +00:00
Arun Thomas f0ab18377d GCC/clang: int64 routines in C 2010-11-12 18:38:10 +00:00
Arun Thomas aaaad89244 Use int64 functions consistently
Instead of manipulating the u64_t type directly, use the
ex64hi()/ex64lo()/make64() functions.
2010-11-07 23:35:29 +00:00
Arun Thomas 998af6f111 Move minix/paths.h to paths.h
Also, merge in relevant macros from NetBSD
2010-11-06 20:40:15 +00:00
Arun Thomas 40fb96b838 Remove revision IDs from files 2010-11-04 01:13:59 +00:00
Ben Gras efcfaf4b96 stdio: split vsprintf and vsnprintf
- workaround for linking problems
2010-11-02 22:05:40 +00:00
Ben Gras 51d9144e9f stdio/freopen.c: fill __iotab table with stream pointer
- lets fclose()d and then freopen()ed streams be fclose()d again
    without error
2010-11-02 22:02:50 +00:00
Ben Gras 09569d399f stdio/fclose.c: reset _buf
- if the stream gets freopen()ed, avoid buffer being seen as valid
2010-11-02 22:01:47 +00:00
Erik van der Kouwe 470a185909 Add libdriver support for async ioctl replies 2010-10-08 09:33:18 +00:00
Erik van der Kouwe ada0b4ca04 Fix warnings due to missing __dead attribute on exit 2010-10-05 07:25:47 +00:00
Erik van der Kouwe 591201c1a0 Fix warnings in libmthread 2010-10-04 20:19:40 +00:00
Erik van der Kouwe b0eaf0bc27 make system server vprintf check for NULL 2010-10-04 17:53:18 +00:00
Ben Gras 68de328ac1 make the asynsend table size NPROCS-dependent.
this is a fix for e.g. the situation where lots of processes die
instantly, and PM has to send an asyn msg for each one to VFS, and
panics if there are too many. there are likely more situations in
which this table should be dependent on the no. of processes.

reported by pikpik on #minix3.
2010-10-01 14:39:04 +00:00
Thomas Veerman a7072a5e1c Revamp the mthread library and update test59
Before, the 'main thread' of a process was never taken into account anywhere in
the library, causing mutexes not to work properly (and consequently, neither
did the condition variables). For example, if the 'main thread' (that is, the
thread which is started at the beginning of a process; not a spawned thread by
the library) would lock a mutex, it wasn't actually locked.
2010-09-30 13:44:13 +00:00
Tomas Hruby 74c5cd7668 The profile utility can set the sprofiling mode
- profile --nmi | --rtc sets the profiling mode

- --rtc is default, uses BIOS RTC, cannot profile kernel the presetted
  frequency values apply

- --nmi is only available in APIC mode as it uses the NMI watchdog, -f
  allows any frequency in Hz

- both modes use compatible data structures
2010-09-23 10:49:42 +00:00
David van Moolenbroek adbc4e4ea7 libsys: tsc_to_micros support for large TSC delta values 2010-09-23 09:26:42 +00:00
Thomas Veerman 12e167f672 Add libmthread and test59 to test the implementation 2010-09-21 12:22:38 +00:00
Ben Gras 250fb23dc0 lib/libsys/gcov.c - fix gcc warning 2010-09-20 11:36:41 +00:00
Tomas Hruby 06b6e5624a SMP - Changed prototype of sys_schedule()
- sys_schedule can change only selected values, -1 means that the
  current value should be kept unchanged. For instance we mostly want
  to change the scheduling quantum and priority but we want to keep
  the process at the current cpu

- RS can hand off its processes to scheduler

- service can read the destination cpu from system.conf

- RS can pass the information farther
2010-09-15 14:10:42 +00:00
David van Moolenbroek 354da24f5b make getsysinfo() a system-land call 2010-09-14 21:50:05 +00:00
David van Moolenbroek d7b10963c2 make library calls use ProcFS 2010-09-14 21:28:34 +00:00
Ben Gras a5a8c57fe7 add EHOSTDOWN errno. 2010-09-14 11:51:41 +00:00
Ben Gras 23311d9819 lib: fixes to make clang not error 2010-09-13 15:50:54 +00:00
Arun Thomas 7c3cfbde1a Update PATHs for llvm and X11 2010-09-12 17:56:53 +00:00
David van Moolenbroek d29833c5aa remove hardcoding of system.conf path in various service calls 2010-09-10 09:22:22 +00:00
Erik van der Kouwe 5cc29a6c7e Make realpath deal with double slashes 2010-09-06 07:45:32 +00:00
Thomas Veerman e8ddc0f46e - Add support for file descriptor passing to PFS.
- For security reasons move some libc code to PFS.
- Fix a few bugs in PFS.
Contributed by Thomas Cort.
2010-08-30 13:46:44 +00:00
Thomas Veerman 2297e26660 Prepare headers to support file descriptor passing over UNIX Domain Sockets.
Contributed by Thomas Cort.
2010-08-30 13:41:22 +00:00
Ben Gras c81f201c8c added missing sef_gcov.c 2010-08-25 13:23:32 +00:00
Ben Gras 5d6c2aae0a gcov support, based on work contributed by Anton Kuijsten. 2010-08-25 13:06:43 +00:00
Ben Gras d8466ce31f libaudiodriver <minix/audio_fw.h> fixes 2010-08-25 11:18:38 +00:00
Ben Gras 1c359afad4 connect libaudiodriver. 2010-08-25 11:07:36 +00:00
Ben Gras 0f4eda33eb new base libaudiodriver out of -lcommon in drivers/audio.
- this lets the drivers that used that library be compiled easily with
   different compilers.
2010-08-25 11:03:53 +00:00
Erik van der Kouwe a2647a4181 Fix buffer overflow in libarchive if a UTF-8 encoded string has codepoints that require two UTF-16 words 2010-08-23 16:32:05 +00:00
Erik van der Kouwe d743c5c6f3 Solve buffer overflow on tab completion in ash 2010-08-23 16:30:58 +00:00
Arun Thomas de231a713e Move MIN() and MAX() macros to sys/params.h 2010-08-21 13:10:41 +00:00
Arun Thomas 60a71efca8 easprintf() and evasprintf() 2010-08-21 13:07:25 +00:00
Erik van der Kouwe 292f98dc29 Minor malloc-debug fixes 2010-08-20 19:50:36 +00:00
Erik van der Kouwe 2a736d0c2e Add MALLOC_DEBUG env var to debug applications using malloc 2010-08-20 19:16:31 +00:00
Erik van der Kouwe b337d3f8e5 move rrrrrrread_tsc from libsys to libc so anyone can use it 2010-08-20 18:43:56 +00:00
Arun Thomas 9a21d1a2fd Macros for symbols used in both ASM and C
-The macros take care of prepending the leading underscore when
 necessary.
2010-08-17 16:44:07 +00:00
Erik van der Kouwe 551374c228 Add ftello function 2010-08-16 17:07:40 +00:00
Erik van der Kouwe a3e4dcafe0 Add fseeko function 2010-08-16 17:06:08 +00:00
David van Moolenbroek bee1f38e01 VTreeFS library 2010-08-10 20:05:51 +00:00
Ben Gras 42bbd56673 lib: when building clang/gcc libraries: add /usr/pkg/bin to $PATH 2010-08-03 11:21:25 +00:00
Erik van der Kouwe a719ab7780 Auto-detect ext2 partitions in mount 2010-08-03 06:28:58 +00:00
David van Moolenbroek 20eced94e7 libdriver: allow driver to break out of message loop 2010-08-01 22:07:46 +00:00
Ben Gras 05bbf81f93 new EPFNOSUPPORT errno 2010-07-28 16:32:21 +00:00
Arun Thomas ee1cabf06c Import poll() from NetBSD's libnbcompat 2010-07-26 20:46:04 +00:00
Ben Gras 541b5c5c38 inet_pton(), patched by Thomas Cort. 2010-07-26 14:47:10 +00:00
Ben Gras c297701987 libarchive: sanitize out-of-range uids/gids 2010-07-26 12:44:48 +00:00
Ben Gras 9f0364df60 lib - sanity check for group_from_gid etc. 2010-07-24 10:40:55 +00:00
Ben Gras 34a58c8d82 inet_ntop, contributed by Thomas Cort. 2010-07-23 09:54:47 +00:00
Erik van der Kouwe f389ad2655 Move sensitive instructions from libc into kernel 2010-07-23 07:12:47 +00:00