Commit graph

44 commits

Author SHA1 Message Date
David van Moolenbroek 44707c1900 inet: do not link against libc
This should make its printed errors show up again.

Change-Id: I6839a584dc2a544bae7973ded3ab1dacf04e4ec0
2015-06-07 14:38:12 +00:00
Jacob Adams 1cd28eb8e4 libc: Fix incomplete fprintf
Closes #23

Change-Id: Ibe6362de0d2d1d94442401b92bc126e63bf9f9b0
2015-03-31 15:45:48 +02:00
Emmanuel Blot 54841c0102 Fix incorrect sanity check
Remove invalid sanity check where an array is tested against NULL -
not a pointer

Change-Id: I3d5e33585e7f97a41124af4133e8a879ab21d972
2015-03-18 07:49:44 +01:00
Emmanuel Blot d91890d288 Fix format string for size_t types
Fix missing “%z[dux]” prefix printf formatter string for `size_t`
types.

Change-Id: If216a778b0b65e8ab2cdd1c7484cb8452d1f965d
2015-03-18 07:48:09 +01:00
Jacob Adams dc0077241b Use or instead of and to determine if urb is valid
close #24

Change-Id: I12e2b20d69aa7b186a8e5cd0dc16f653a18b2ee2
2015-03-11 17:56:09 +01:00
Lionel Sambuc 3d0f2c86c4 Fix arm build for GCC, noassert, -Os
Change-Id: I706fdfc8fc9a5e0c9076e3657ac1a6ef0745bd14
2015-03-05 15:42:21 +01:00
David van Moolenbroek f912036bae libsffs, libvtreefs: fix getdents bug
Bad logic introduced as part of the fsdriver changes could cause
getdents to terminate early in these libraries.

Issue reported by r0ller.

Change-Id: If450d5ea85e830584878d8a4ec0f00519355a353
2015-02-10 13:47:29 +00:00
Ben Gras 5ae1a533c7 ARM: can build with llvm, switch to EABI
. bitcode fixes
	. switch to compiler-rt instead of netbsd libc functions
	  or libgcc for support functions for both x86 and arm
	. minor build fixes
	. allow  build with llvm without crossbuilding llvm itself
	. can now build minix/arm using llvm and eabi - without C++
	  support for now (hence crossbuilding llvm itself is turned off
	  for minix/arm)

Change-Id: If5c44ef766f5b4fc4394d4586ecc289927a0d6eb
2014-12-12 13:04:56 +01:00
David van Moolenbroek dbcce9ddb0 libnetdriver: turn into network driver framework
The new implementation of this library provides abstractions for
network drivers, and should be used for all network drivers from now
on.  It provides the following functionality:

  - a function call table abstraction, hiding the details of the
    datalink protocol with simple parameters;
  - a state machine for sending and receiving packets, freeing the
    actual driver from keeping track of pending requests;
  - an abstraction for copying data from and to the network driver,
    freeing the actual driver from dealing with I/O vectors while at
    the same time providing a copy implementation which is more
    efficient than most current driver implementations;
  - a generalized implementation of zero-copy port-based I/O;
  - a clearer set of policies and defaults.

While the concept is very similar to lib{block,char,fs,input}driver,
one main difference is that libnetdriver now also takes care of SEF
initialization, mainly so that aspects such as recovery policies and
live-update aspects can be changed for all network drivers in a
single place.  As always, for the case that the provided message loop
is too restrictive, a set of more low-level message processing
functions is provided.

The netdriver API has been designed so as to allow alleviation of one
current protocol bottleneck: the fact that at most one send request
and one receive request may be pending at any time.  Changing this
aspect will however require a significant rewrite of libnetdriver,
and possibly debugging of drivers that are not able to cope with (in
particular) queuing multiple packets for transmission at once.

Beyond that, the design of the new API is based on the current
protocol, and may be changed/extended later to allow for non-ethernet
network drivers, exposure of link status, multicast address
configuration, suspend and resume, and any other features that are in
fact long overdue.

Change-Id: I47ec47e05852c42f92af04549d41524f928efec2
2014-12-04 12:10:48 +00:00
David van Moolenbroek d1db724f47 libvirtio: expose result size on packet dequeue
Change-Id: I49304678895779849abc2528a9f78730f968e712
2014-12-04 12:10:47 +00:00
David van Moolenbroek e321f65582 libfsdriver: support mmap on FSes with no device
This patch adds (very limited) support for memory-mapping pages on
file systems that are mounted on the special "none" device and that
do not implement PEEK support by themselves.  This includes hgfs,
vbfs, and procfs.

The solution is implemented in libvtreefs, and consists of allocating
pages, filling them with content by calling the file system's READ
functionality, passing the pages to VM, and freeing them again.  A new
VM flag is used to indicate that these pages should be mapped in only
once, and thus not cached beyond their single use.  This prevents
stale data from getting mapped in without the involvement of the file
system, which would be problematic on file systems where file contents
may become outdated at any time.  No VM caching means no sharing and
poor performance, but mmap no longer fails on these file systems.

Compared to a libc-based approach, this patch retains the on-demand
nature of mmap.  Especially tail(1) is known to map in a large file
area only to use a small portion of it.

All file systems now need to be given permission for the SETCACHEPAGE
and CLEARCACHE calls to VM.

A very basic regression test is added to test74.

Change-Id: I17afc4cb97315b515cad1542521b98f293b6b559
2014-11-15 11:19:52 +00:00
David van Moolenbroek 289b04677a libfsdriver: prefill st_dev for stat requests
This obviates the need for several file system implementations to
remember the device on which they are mounted.

Change-Id: Ida8325cf4bcf072e61761cfee34e3f7ed2d750b9
2014-11-14 15:54:16 +00:00
David van Moolenbroek 52be5c0afb libvtreefs: API changes/extensions, part 2
- rename start_vtreefs to run_vtreefs, since the function returns upon
  termination these days;
- add get_inode_slots function to retrieve the number of indexed slots;
- add support for extra per-inode data for arbitrary storage.

Change-Id: If2d365d7b478a1cecc9e20fb2b3e70c1a1cf7243
2014-11-12 12:13:43 +00:00
David van Moolenbroek 5eefd0fec2 libvtreefs: API changes/extensions, part 1
- move primary I/O buffer into vtreefs; change read hook API;
- add hooks for write, truncate, symlink, mknod, unlink, chmod/chown;
- modernize message_hook;
- change procfs, devman, gpio accordingly;

Change-Id: I9f0669e41195efa3253032e95d93f0a78e9d68d6
2014-11-12 12:13:38 +00:00
David van Moolenbroek 693ad767e8 libvtreefs: convert to KNF
Change-Id: I81bdf05c9b630a0cbb0ac573d36d4f59f8137199
2014-11-12 12:13:33 +00:00
David van Moolenbroek 1f945e8080 Fix fcntl(F_[GS]ETNOSIGPIPE) semantics
The new semantics should match those of NetBSD and other systems.

Change-Id: Ic9ca9d6b8c3e42d2a2953d9feea5f6bacaceb43c
2014-11-01 12:57:31 +00:00
David van Moolenbroek 65f76edb8f minix libraries: resolve clang warnings
Change-Id: I0f3425fb8838708c9848a006f1eee5ab1bad71d2
2014-09-30 21:04:09 +00:00
David van Moolenbroek 5dd8da10c5 libc: resolve minix clang warnings
Change-Id: If6c42f7346cc1b00b387ae8d3b4f0df3ffb0244f
2014-09-30 20:35:56 +00:00
David van Moolenbroek 685aa79304 libsys: resolve clang warnings
Change-Id: Ic954ba8667b4d039172b8e0d2ec57674a479b8aa
2014-09-30 20:08:54 +00:00
David van Moolenbroek 94e65446c4 libsffs: make path names constant
And a few other related warning fixes.

Change-Id: I1a49b9ee04c2b1bf80bc943272f72ffd6de77ef6
2014-09-30 12:48:10 +00:00
David van Moolenbroek 1dcfbcd173 Remove support for call profiling
The entire infrastructure relied on an ACK feature, and as such, it
has been broken for years now, with no easy way to repair it.

Change-Id: I783c2a21276967af115a642199f31fef0f14a572
2014-09-30 12:39:03 +00:00
David van Moolenbroek f737eea636 svrctl(2) update
- synchronize request type with ioctl by making it unsigned long;
- unbreak VFS requests, as they were being sent to PM;
- use proper ioctl direction flags (and new numbers) for requests;
- remove some needless header inclusions;
- svrctl is in libc, make its message name reflect this;
- keep backward compatibility: svrctl is part of the userland ABI.

Change-Id: I44902e8d0d11b8ebc1ef3bda94d2202481743c9b
2014-09-29 16:15:21 +00:00
David van Moolenbroek 63ce03db66 IOCTL requests are unsigned longs now
Issue reported by JD Begin.

Change-Id: I0306d9dc43c36107897c8b73ed340d86a8dcef27
2014-09-29 15:11:01 +00:00
David van Moolenbroek ef9dc93f44 Clean up obsolete FS support routines
Change-Id: I56d0ab51f32064bb964051732de7e2465dc22b75
2014-09-18 13:01:02 +00:00
David van Moolenbroek 2e89653e65 libc: make socketpair(3) use the right device
UDS expects the device number of the actual socket, not the device on
which the socket happens to reside.  The code worked only because PFS
returned the same value in the st_dev stat field, which it will have
to continue doing for a while now.

Change-Id: I426d38a86a96307ff6e6ed8099d37dae02d6bf2b
2014-09-18 12:46:28 +00:00
David van Moolenbroek ccaeedb267 MFS: use libfsdriver
Change-Id: Ib658c7dea47b81a417755b0554a75288117b431a
2014-09-18 12:46:27 +00:00
David van Moolenbroek ad80a203db Move clock_time into libsys
Change-Id: Ibc5034617e6f6581de7c4a166ca075b3c357fa82
2014-09-18 12:46:26 +00:00
David van Moolenbroek 0dc5c83ec2 libvtreefs: use libfsdriver
Change-Id: I0e6446bd0ccc3b89edc237be441ebfd92585f352
2014-09-18 12:46:26 +00:00
David van Moolenbroek a99c939dee libsffs: use libfsdriver
Change-Id: Id8377873455771c614371e115643cd906d05f12c
2014-09-18 12:46:25 +00:00
David van Moolenbroek ebd3c0673d libminixfs: add block I/O routines
The new functionality aims to save each file system server from having
to implement its own block I/O routines just so that it can serve as a
root file system.  The new source file (bio.c) lists the requirements
that file system servers have to fulfill in order to use the routines.

Change-Id: Ia0190fd5c30e8c2097ed8f4b0e3ccde1827e0b92
2014-09-18 12:46:25 +00:00
David van Moolenbroek c5beebb68d libminixfs: do not make fs_sync upcalls
The file system may not be expecting these upcalls at arbitrary
moments, while they serve only as a performance optimization anyway.

Change-Id: I0748fd1f6c2645ddbb64466093ee36025aac45e0
2014-09-18 12:46:24 +00:00
David van Moolenbroek 89c9de7d09 Add libfsdriver: a library to drive file systems
This library provides new abstractions for the upper (VFS) side of
file system services, and should be used for all file system service
implementations from now on.  It provides the following functionality:

  - a function call table abstraction, hiding the details of the
    VFS-FS protocol with simple parameters;
  - a (currently limited) number of per-function steps required for
    all file system implementations, such as copying in and out path
    names and result buffers;
  - a default implementation for multicomponent path lookups, such
    that the file system merely has to implement resolution of single
    components at a time;
  - an abstraction for copying data from and to the file system, which
    allows transparent intraprocess copying as required for the lookup
    implementation;
  - a set of functions to simplify getdents implementations.

The message loop provided by the library is currently for use by
single-threaded file system implementations only.  Multithreaded file
system services may use the more low-level message processing
functionality.

Protocol-level optimizations such as including names in protocol
messages may be hidden entirely in this library.  In addition, in the
future, the lookup implementation may be replaced by a single-
component lookup VFS/FS protocol request as part of a VFS name cache
implementation; this, too, can be hidden entirely in this library.

Change-Id: Ib34f0d0e021dfa3426ce8826efcf3eaa94d3ef3e
2014-09-18 12:46:23 +00:00
Lionel Sambuc 31b808b8fa Drop minix-malloc & friends
Known limitations:
 - comment for now testisofs, as iso9660fs is known to be broken.

Benefits:
 - near 3x speed improvement on C++ code compilation, bringing down
   make build to from 44min down to 21min.

 - Allows for X applications to work properly, which should be available
   in near-term future through pkgsrc for 3.3.0.

Change-Id: I8f4179a7ea925ed381642add32cfd8c5822217e4
2014-09-08 17:30:18 +02:00
Lionel Sambuc 6f7ac603f2 Allow elf_unpack to withstand invalid ELF headers
Change-Id: I10a0f3111176b9614b8531d6736e2e860eb95ce4
2014-09-08 11:48:57 +02:00
Lionel Sambuc 9d3fcac4cd Some more NDEBUG fixes
- replace a stray assert(0) with abort()
 - remove unrequired copy-pasted #undef NDEBUG
 - replace some #if NDEBUG by #if DEBUG as they protect debug printf()s.

Change-Id: Iff4c0331b06e860d32d91ce6b1d6c765ed065c8b
2014-09-02 16:57:50 +02:00
Lionel Sambuc 20a91f7755 Fix -DNEDUG builds
- assert() is macro which is defined as empty, while panic is always
   present. I added an explicit abort() after the macro to make sure the
   function never returns in case of wrong flags.

 - Fixed gcc build with -NDEBUG, -Os for ARM.
   * A few 'may be used uninitialized' messages
   * A few new missing support library functions where added in libminc.

Change-Id: I69fcda2cd3888390b7ddeff4c0cd849105ce86ff
2014-09-02 15:22:15 +02:00
Wojciech Zajac 2d64210c1d Much USB code for ARM USB support
Written by JP Embedded.

Host controller (HCD), mass storage, and hub drivers.

Change-Id: I4237cf7aeb4a1c0205a1876593a9cc67ef3d577e
2014-08-29 18:52:49 +02:00
Ben Gras bad58c9c51 merge libminlib with libc
Change-Id: I79cc4ea90c378a1da3dac16487b53034953827a7
2014-08-28 18:49:19 +02:00
Ben Gras c2808d8b07 remove libcompat_minix as library
. get rid of includes in libcompat_minix:
	  . move configfile.h to minix/include/
	  . all others are unneeded as they point to other files
	. merge the .c files with libc

Change-Id: I5e840c66fb9bc484f377926aa9d66473bbd16259
2014-08-28 18:49:13 +02:00
Ben Gras 7f5f010bbd netbsd ping & traceroute
. remove minix ping
	. add support for socket(AF_INET, SOCK_RAW, {IPPROTO_ICMP,IPPROTO_UDP})
	. gives test48 a better chance of detecting network connectivity

Change-Id: Ia678546d27ac378642f1160a141e1fc33458cce2
2014-08-21 08:07:39 -04:00
Wojciech Zajac 187bd3cde6 DDEKit interrupt fix
- With this patch, DDEKit no longer uses IRQ number as interrupt ID
      and more IRQ numbers can be used with it

    - DDEKit IRQ code, will now check return values and panic on error

Change-Id: I9ef5ab1ee2262242204bdd8c0a60459a19ddcc1b
2014-08-19 18:24:29 +02:00
Lionel Sambuc 37f29f557a servers/rs: Add sanity check on executable size
RS used to do a stat, and check that the stat was successful, but it
didn't check that the executable was not actually empty.

This patch adds a check to detect file which are smaller than the minimum
ELF size possible.

Change-Id: I22b004084f17e7d395e2c1377add7bc8b51c3d5e
2014-07-31 16:00:32 +02:00
Lionel Sambuc 50a1aef12b Move all services to /service
This concerns all services, a.k.a drivers, filesystem drivers, network
(inet, lwip, uds) servers, and the system servers.

Change-Id: I626fd15c795e15af42df2d10d47fb4a703665d63
2014-07-31 16:00:31 +02:00
Lionel Sambuc 433d6423c3 New sources layout
Change-Id: Ic716f336b7071063997cf5b4dae6d50e0b4631e9
2014-07-31 16:00:30 +02:00