Commit graph

1019 commits

Author SHA1 Message Date
Ben Gras a9d15dd3e4 pm, vfs: don't print something for bogus calls 2011-07-05 13:21:48 +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
Ben Gras 86a226680b vfs: don't SUSPEND for unknown calls
. returning ENOSYS helps for implementing
	  new calls with forwards compatability
2011-07-02 17:19:13 +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
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
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
Ben Gras a77c2973b3 fix clang warnings -R in kernel/ and servers/ 2011-06-09 16:09:13 +02:00
Erik van der Kouwe c2da8cb535 Globally enable -Wall warnings for GCC 2011-06-08 19:21:03 +00:00
Erik van der Kouwe 0cb22acbda Fix VM -Wall warnings and enable -Werror 2011-06-01 11:30:58 +02:00
Tomas Hruby 5582aae6d6 LWIP - removed __unused where inappropriate 2011-05-25 09:41:19 +02:00
Ben Gras 314d09adf7 fix clang warnings in servers/ 2011-05-12 22:23:02 +02:00
Ben Gras 674cd6fd48 larger i/o buffer for exec()
. makes exec() for large executables (e.g. clang, gcc)
    significantly faster

Thanks to Antoine Leca.
2011-05-12 19:12:28 +02:00
Arun Thomas 350b60661a ELF multiboot support 2011-05-04 18:51:43 +02:00
Thomas Veerman aba392e630 Clean up and fix multiple bugs in select:
- Remove redundant code.
 - Always wait for the initial reply from an asynchronous select request,
   even if the select has been satisfied on another file descriptor or
   was canceled due to a serious error.
 - Restart asynchronous selects if upon reply from the driver turns out
   that there are deferred operations (and do not forget we're still
   interested in the results of the deferred operations).
 - Do not hang a non-blocking select when another blocking select on
   the same filp is still blocking.
 - Split blocking operations in read, write, and exceptions (i.e.,
   blocking on read does not imply the write will block as well).
 - Some loops would iterate over OPEN_MAX file descriptors instead of
   the "highest" file descriptor.
 - Use proper internal error return values.
 - A secondary reply from a synchronous driver is essentially the same
   as from an asynchronous driver (the only difference being how the 
   answer is received). Merge.
 - Return proper error code after a driver failure.
 - Auto-detect whether a driver is synchronous or asynchronous.
 - Remove some code duplication.
 - Clean up code (coding style, add missing comments, put all select
   related code together).
2011-04-13 13:25:34 +00:00
Thomas Veerman f0740680cd Do not print an error message when a binary is corrupt 2011-04-12 13:09:19 +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
Arun Thomas cd9b4b46f4 libexec: return physaddr info from ELF headers 2011-04-07 12:22:36 +00:00
Tomas Hruby b2c2dc72bc 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
2011-04-07 07:44:27 +00:00
Tomas Hruby dca25a1b39 LWIP - the lwip server
The server implements inet-like interface to vfs and drivers. The core
functionality is contained in the liblwip.
2011-04-07 07:44:11 +00:00
David van Moolenbroek 28f2a169da 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
2011-03-25 10:56:43 +00:00
David van Moolenbroek 14e641cb8c PFS: UDS code cleanup:
- coalesce lots of duplicate code
- avoid using errno as much as possible
- fix bugs in some error handling cases
2011-03-25 10:52:53 +00:00
Ben Gras 5f1ab506c8 remove some debugging output from vm/region.c
- don't print verbose process map when legitimate errors occur
2011-03-16 11:57:35 +00:00
Ben Gras c90cdadcfb auto-tune mfs cache size based on FS usage and remaining system memory 2011-02-28 14:19:19 +00:00
Arun Thomas 25a790a631 VM and kernel support for ELF 2011-02-26 23:00:55 +00:00
Dirk Vogt 77fa5b4116 incoporate davman into server/rs 2011-02-25 12:25:03 +00:00
Dirk Vogt 00dcbb9dc6 Added Device Manager (USB hotplug support) 2011-02-23 13:48:03 +00:00
Erik van der Kouwe 36f9c1155a Restart process after response from async driver on non-blocking select 2011-02-23 10:27:48 +00:00
Dirk Vogt 344c18cf73 procfs: only initialize the first time procfs is mounte 2011-02-22 18:03:33 +00:00
Ben Gras 32f3d9842d pm - sys_sigsend can fail legitimately
. specifically, if a signal handler can't be invoked due
    to process memory, EFAULT is returned from the kernel.
    don't panic() then.
2011-02-18 15:44:54 +00:00
Ben Gras 287fee89cb add NOASSERTS make flag that disables assert()s (NDEBUG=1).
. made some checks in vfs/vnode.c also respond to NDEBUG=1.
  . turned on in release builds
2011-02-16 18:58:30 +00:00
Ben Gras c7b2b11ec2 vm: only suspend and resume process with vmctls in pt_writemap in smp mode 2011-02-11 14:56:52 +00:00
Ben Gras ab73ac3b6f procfs - export extra kernel time accounting fields 2011-02-08 13:59:21 +00:00
Ben Gras 0a70e23d1d is - no more getlocktimings. 2011-02-04 13:34:43 +00:00
Ben Gras dc1cc91df1 <ansi.h> -> <minix/ansi.h> 2011-01-28 11:35:02 +00:00
Arun Thomas 6e86430130 Remove code for kernel task stack initialization
We no longer have kernel tasks, so this code is unnecessary
2011-01-27 12:18:33 +00:00
David van Moolenbroek 9b8f37bb27 RS: don't share executable images with a dead process 2011-01-07 17:10:12 +00:00
David van Moolenbroek 16895b67ce RS: move setuid() hack to where it belongs.. again. 2011-01-07 17:09:30 +00:00
David van Moolenbroek 410699874c DS: fix regression in ds_subscribe regex construction 2011-01-07 17:07:46 +00:00
David van Moolenbroek dbcca28c19 DS: update subscriptions for deleted keys upon process exit 2011-01-07 17:06:24 +00:00
David van Moolenbroek 5d8d5e0c3a change bitchunk_t from 16-bit to 32-bit 2010-12-21 10:44:45 +00:00
Ben Gras f0f34dd8d9 vfs - use a static buffer instead of malloc()+free(), solving
recently appeared ENOMEM problems during exec().
2010-12-15 14:43:59 +00:00
Arun Thomas 372b873413 VFS/RS support for ELF 2010-12-10 09:27:56 +00:00
David van Moolenbroek 9639af49d2 RS: fix IPC privilege computation bug
Take into account the ALL and ALL_SYS cases when constructing proper
symmetrical IPC send masks. Fix system.conf accordingly, to keep
userland processes from sending to several non-interface servers and
drivers. Also fix IS's F4 formatting.
2010-12-08 14:54:08 +00:00
David van Moolenbroek 7bef45ad3b system.conf: base ipc permissions on process names rather than labels
From now on, the "ipc" directive in system.conf refers to process names
instead of labels, similar to the "control" directive. The old, more
fine-grained approach is deemed unnecessary and cumbersome at this time.

As side effects, this patch unbreaks late IPC permission computation as
well as the filter driver.
2010-12-07 12:16:31 +00:00
David van Moolenbroek a7285dfabc Kernel/RS: fix permission computation with 32+ system processes 2010-12-07 10:32:42 +00:00
David van Moolenbroek 6bf3c91a0a RS: do not restart file systems 2010-12-03 13:19:15 +00:00
Arun Thomas cc26fb5ec4 vfs: terminate string in rdlink_direct
Fixes test56 when compiled with GCC.
2010-12-01 16:24:50 +00:00
Dirk Vogt 5e1e763506 removed unneeded global var 2010-11-24 16:30:13 +00:00
Dirk Vogt 46ec37365e don't send FS_READY anymore 2010-11-24 16:29:50 +00:00
Dirk Vogt 9ed280d1ec decouple file system server start/termination from mount/umount 2010-11-23 19:34:56 +00:00
Arun Thomas 8173242e01 Remove redundant sha2 code from inet 2010-11-15 11:10:02 +00:00
Arun Thomas f0ab18377d GCC/clang: int64 routines in C 2010-11-12 18:38:10 +00:00
Tomas Hruby 3c6274b8be /proc/cpuinfo
- when /proc/cpuinfo is read procfs retrievs information about cpus
  from the kernel, formats it and prints it
2010-10-26 21:08:00 +00:00
Tomas Hruby de1bcaa69a VM implicitly aligns mappings to a page
- problem when a PCI BAR is not aligned

- together with  David v. Moolenboek
2010-10-21 17:07:05 +00:00
Ben Gras ddde360e3e vm - hash table for block cache 2010-10-15 09:10:14 +00:00
Ben Gras cb2e3a98a2 vm - fix for not placing region outside requested mmap addr 2010-10-15 09:09:29 +00:00
Ben Gras b653422883 mfs - no more WRITE_IMMED 2010-10-11 15:35:43 +00:00
Erik van der Kouwe 9235536f38 Fix select-related bugs: missing cancellations led to potentially forgetting notifies, especially in the case of async drivers 2010-10-08 12:50:52 +00:00
Ben Gras a3f2df124c vm optimisation - maintain hint for new virtual region position. 2010-10-07 10:04:05 +00:00
Ben Gras e2570d9b1b vm: optimisation: avl tree for virtual regions
- regions were preivous stored in a linked list, as 'normally'
    there are just 2 or 3 (text, data, stack), but that's slow
    if lots of regions are made with mmap()

  - measurable performance improvement with gcc and clang
2010-10-04 11:41:10 +00:00
Ben Gras 36189370a5 vm: don't check the range of memory during sanity checking
- too many false positives due to memory that is mapped in
    legitimately (acpi, i/o devices)
2010-10-04 11:38:33 +00:00
David van Moolenbroek 3736ce3f55 hgfs: do not return negative file sizes in stat (reported by Antoine Leca) 2010-09-27 13:19:25 +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
Thomas Veerman af73996d51 Fix failing unmount attempt at shutdown after running test58 2010-09-17 09:34:36 +00:00
Tomas Hruby 1f89845bb2 SMP - can boot even if some cpus fail to boot
- EBADCPU is returned is scheduler tries to run a process on a CPU
  that either does not exist or isn't booted

- this change was originally meant to deal with stupid cpuid
  instruction which provides totally useless information about
  hyper-threading and MPS which does not deal with ht at all. ACPI
  provides correct information. If ht is turned off it looks like some
  CPUs failed to boot.  Nevertheless this patch may be handy for
  testing/benchmarking in the future.
2010-09-15 14:11:21 +00:00
Tomas Hruby 6513d20744 SMP - Process is stopped when VM modifies the page tables
- RTS_VMINHIBIT flag is used to stop process while VM is fiddling with
  its pagetables

- more generic way of sending synchronous scheduling events among cpus

- do the x-cpu smp sched calls only if the target process is runnable.
  If it is not, it cannot be running and it cannot become runnable
  this CPU holds the BKL
2010-09-15 14:11:12 +00:00
Tomas Hruby e87d29171f SMP - Compiles for both single and multi processor again
- this patch adds various fixes as some of the previous patches break
  compilations without CONFIG_SMP being set
2010-09-15 14:11:03 +00:00
Tomas Hruby 311f145bc7 SMP - Balancing run queues for SMP
- it preempts running processes though :( this is not the final
  solution
2010-09-15 14:10:51 +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
Tomas Hruby 1e273f640e SMP - Scheduler can assign process to a cpu
- machine information contains the number of cpus and the bsp id

- a dummy SMP scheduler which keeps all system processes on BSP and
  all other process on APs. The scheduler remembers how many processes
  are assigned to each CPU and always picks the one with the least
  processes for a new process.
2010-09-15 14:10:33 +00:00
David van Moolenbroek 354da24f5b make getsysinfo() a system-land call 2010-09-14 21:50:05 +00:00
David van Moolenbroek 2c5c5c06ea ProcFS server, by Alen Stojanov and David van Moolenbroek 2010-09-14 21:25:25 +00:00
David van Moolenbroek 3eb65448a6 VM: expose secondary cache size 2010-09-14 21:22:56 +00:00
David van Moolenbroek 7763fd67c7 PM: save process frame length 2010-09-14 21:21:54 +00:00
David van Moolenbroek 2e209097b6 IS: delete obsolete is.h 2010-09-09 08:47:39 +00:00
Thomas Veerman 0b00cf70b6 - Return ENOENT when trying to add files to removed (but open) directories.
- Add test58 to test this behavior.
2010-09-01 09:07:18 +00:00
Erik van der Kouwe 1f2054c89c Shutdown changes for multiboot: CTRL-ALT-DEL resets, panic halts 2010-08-30 19:01:58 +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 13ef7f1f38 Prepare VFS to support back calls from PFS. For security reasons and to support
file descriptor passing, PFS does some back calls to VFS. For example, to
verify the validity of a path provided by a process and to tell VFS it must
copy file descriptors from one process to another.
2010-08-30 13:44:07 +00:00
Ben Gras 5d6c2aae0a gcov support, based on work contributed by Anton Kuijsten. 2010-08-25 13:06:43 +00:00
David van Moolenbroek 959026c29a RS: use PM's API instead of its internals 2010-08-24 07:20:41 +00:00
Erik van der Kouwe 3211be5d14 Avoid duplicate type definitions, especially wchar_t which was inconsstent and caused trouble in libarchive 2010-08-23 17:00:04 +00:00
Arun Thomas de231a713e Move MIN() and MAX() macros to sys/params.h 2010-08-21 13:10:41 +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
Thomas Veerman c8cfcab5db - Make sure there's space left in the vmnt table for another mount point.
- Increase mount point limit.
2010-08-17 10:02:50 +00:00
David van Moolenbroek 46624d640e hgfs comment fix: inode status, not statistics 2010-08-07 11:50:15 +00:00
Erik van der Kouwe 0fc71a1154 Increase NR_INODES in the FS servers to match NR_VNODES in VFS 2010-08-05 11:37:37 +00:00
Erik van der Kouwe 912b4e0cb7 Return ENOSPC when out of inodes 2010-08-05 11:37:06 +00:00
Thomas Veerman dff0434eaf Add support for the ext2 file system. Contributed by Evgeniy Ivanov. 2010-08-02 11:44:45 +00:00
Thomas Veerman 253b4b3fe5 - Add support for ST_NOTRUNC to struct statvfs.
- Let tests that test for long file names check for that flag, so that they can
  verify the results properly.
2010-08-02 11:16:32 +00:00
David van Moolenbroek da597227ac put env_arg[cv] declaration in minix/sysutil.h 2010-07-29 21:16:23 +00:00
Erik van der Kouwe 6dec907191 Shorter reporting of contiguous identical blocks for the IS VM dump (F8) to avoid MFS frrom filling many screens 2010-07-27 18:46:08 +00:00
Erik van der Kouwe d7c70a41e5 Allow vm to split blocks in memory map (needed for multiboot, contributed by Feiran "Fam" Zheng 2010-07-23 14:22:13 +00:00
Ben Gras 3badab8b70 vfs - split fp_fd field into fd + callnr fields 2010-07-22 14:55:28 +00:00
David van Moolenbroek 220eafe705 inet: a little more resilience against misbehaving drivers 2010-07-21 13:47:50 +00:00
Tomas Hruby f6f20e1269 Overly restrictive assert
- not true if APIC is enabled
2010-07-21 13:46:29 +00:00
Cristiano Giuffrida 7978f9d2f3 Unbreak gcc compilation for pfs. 2010-07-21 13:39:46 +00:00
Cristiano Giuffrida 0824146978 Disable debug info on trunk. 2010-07-21 08:22:24 +00:00
Cristiano Giuffrida 91a83fe265 Crash recovery and live update support for VM. 2010-07-20 23:03:52 +00:00
Cristiano Giuffrida 0d984b36ef Get rid of static spare pages after VM startup. 2010-07-20 21:59:27 +00:00
Cristiano Giuffrida 40b4e71db2 COW for physically contiguous blocks in VM 2010-07-20 18:57:25 +00:00
Cristiano Giuffrida 1b7d95df29 Generalize interface of some VM functions 2010-07-20 02:08:28 +00:00
Cristiano Giuffrida af424b4e43 Don't always assume NOPINGREPLY as a failure in RS 2010-07-20 01:50:33 +00:00
Ben Gras 16d0609fad vm: restore sanity checks in NONCONTIGUOUS case. 2010-07-19 18:20:14 +00:00
Ben Gras 068944de36 vm: add MEMPROTECT feature in vm.h. 2010-07-19 18:19:59 +00:00
Ben Gras 77267ca28b vm: add missing USE() macros in utility.c. 2010-07-19 18:19:38 +00:00
Ben Gras 5e2c84b119 vm: allow readonly pages when sanity checking when they're supposed to be rw. 2010-07-19 18:19:16 +00:00
Erik van der Kouwe 98725c443e Fix RS warning at start-up by inheriting scdeduling properties from init for unprivileged children of system processes 2010-07-16 14:56:05 +00:00
Tomas Hruby 7f47f4174d Fixed comments in sched
- not only PM can send sched requests. RS too.
2010-07-16 09:40:12 +00:00
Erik van der Kouwe 739f2d7536 Fix comment 2010-07-15 14:47:08 +00:00
Thomas Veerman 5aff633a0b Make RS and VFS aware of new UDS major. Contributed by Thomas Cort 2010-07-15 13:51:38 +00:00
Thomas Veerman ea19830de1 Add UNIX Domain Sockets internals to PFS. Contributed by Thomas Cort 2010-07-15 13:39:57 +00:00
Cristiano Giuffrida f8a8ea0a79 Dynamic configuration in system.conf for boot system services. 2010-07-13 21:11:44 +00:00
Cristiano Giuffrida 8cedace2f5 Scheduling parameters out of the kernel. 2010-07-13 15:30:17 +00:00
Cristiano Giuffrida 8427d774b6 RS live update support. 2010-07-09 18:29:04 +00:00
David van Moolenbroek 895850b8cf move timers code to libsys 2010-07-09 12:58:18 +00:00
Ben Gras 8c925134f9 vm: NONCONTIGUOUS - try to make physical memory as maximally noncontiguous 2010-07-09 12:22:33 +00:00
Cristiano Giuffrida 1f8dbed029 RS crash recovery support. 2010-07-06 22:05:21 +00:00
Cristiano Giuffrida 3de6a807ce Configure settings for system services dynamically with the new service edit command. 2010-07-05 19:37:08 +00:00
Ben Gras fc8f0b9ee2 vm: better fix for clang 'unused expression' warning 2010-07-05 17:34:26 +00:00
Ben Gras 86139e8bf2 vm: last commit should not have included wiping out these calls
(this was done temporarily to make vm work with clang; vm crashes when
the 64-bit arithmetic functions are used when compiled with clang.)
2010-07-05 14:01:34 +00:00
Ben Gras b4bea1bfcb vm: fixes for clang warnings 2010-07-05 13:58:57 +00:00
Erik van der Kouwe 37325bd7c5 Make service ABI backwards compatible again 2010-07-03 05:02:59 +00:00
Thomas Veerman 34a2864e27 Fix a few compile time warnings 2010-07-02 12:41:19 +00:00
Kees van Reeuwijk 630f566d3f Convert a few main() functions to a form that the clang compiler likes. 2010-07-01 22:23:25 +00:00
Cristiano Giuffrida 03f64ac97a Self update support in RS. 2010-07-01 18:48:25 +00:00
Cristiano Giuffrida 9e4312453d Improve memory pinning. 2010-07-01 08:54:25 +00:00
Erik van der Kouwe 23284ee7bd User-space scheduling for system processes 2010-07-01 08:32:33 +00:00
Erik van der Kouwe 5c591816cb Remove warning in inet; this situation is harmless and can be caused by a race 2010-07-01 06:14:38 +00:00
Cristiano Giuffrida 06700d05d1 Give RS a page table. 2010-06-28 21:53:37 +00:00
Cristiano Giuffrida 869a223d43 service clone command to clone system services on demand. 2010-06-28 21:38:29 +00:00
Ben Gras 6e47e2996f sep ${.OBJDIR} fixes by Antoine Leica. 2010-06-27 23:47:23 +00:00
David van Moolenbroek 53866b1ebb oops. 2010-06-27 17:20:17 +00:00
David van Moolenbroek 71435d15cf HGFS: statvfs support 2010-06-27 17:19:50 +00:00
Arun Thomas c0c8d25799 Rename mkfiles from minix.*.mk to bsd.*.mk
Makes things easier for pkgsrc
2010-06-25 18:29:09 +00:00
Erik van der Kouwe c0dfa2f3f1 Get rid of asynsend backup copy in VFS 2010-06-25 14:57:54 +00:00
Cristiano Giuffrida 5c7d64b981 No malloc() in VM. 2010-06-25 12:48:56 +00:00
Ben Gras 33c9d427fd mfs - added put_block() to statvfs loop. 2010-06-24 10:56:45 +00:00
Erik van der Kouwe 498d7d8a4c Don't use kernel responses in servers 2010-06-24 07:37:26 +00:00
Ben Gras 491efeead9 mfs - revert part of previous commit; should not have been commited 2010-06-24 00:32:17 +00:00
Ben Gras 6cd2d1218e mfs - statvfs call, by Buccapatnam Tirumala, Gautam. 2010-06-23 23:58:16 +00:00
Ben Gras 4b496e29bd iso9660fs - statvfs call, by Buccapatnam Tirumala, Gautam. 2010-06-23 23:57:26 +00:00
Ben Gras 13b5dd4a82 statvfs/fstatvfs entries. 2010-06-23 23:56:36 +00:00
Ben Gras fc01683584 include, vfs: statvfs, fstatvfs calls, contributed by Buccapatnam Tirumala, Gautam. 2010-06-23 23:53:50 +00:00
Cristiano Giuffrida ad1f2f2d78 Fix misplaced comment. 2010-06-22 15:10:06 +00:00
Ben Gras a89bcc465b mfs: minor cleanup of readahead: they can be private to read.c. 2010-06-21 18:25:04 +00:00
Erik van der Kouwe 11193f5fa4 Don't allow PM to sys_kill itself, this causes a race with RS calling waitpid during shutdown 2010-06-18 13:49:07 +00:00
Tomas Hruby 8214e5e284 Removed racy COW optimization
- enabling writing in COW once phys block is reference only once is racy if VM
  is preemptible. original memory location may get overwritten before COW copies
  the memory

- problem when DEBUG_RACE is on and a big problem for SMP
2010-06-18 12:46:18 +00:00
Cristiano Giuffrida ad5771aa28 Don't forget about pending signals coming from the kernel. 2010-06-18 12:04:20 +00:00
Arun Thomas 1b2c01db1b Makefile updates:
Turn on optimization
Remove some redundancy in FLAGS
2010-06-11 16:05:36 +00:00
Ben Gras 19b790eb53 vfs: don't use a mountpoint if it's in use for anything else.
(this avoids data structure confusion if a mountpoint is reused as
a mountpoint until that's properly fixed.)
2010-06-11 11:41:56 +00:00
Arun Thomas 1bf6d23f34 Make exec() use entry point in a.out header 2010-06-10 14:59:10 +00:00
Arun Thomas f0a158d8c1 More cleanup to remove MM and FS references 2010-06-10 14:04:46 +00:00
Arun Thomas eec65ac664 Rename tell_fs to tell_vfs 2010-06-09 14:31:30 +00:00
Thomas Veerman be6490f4b3 Turn off debug message. 2010-06-09 11:05:16 +00:00
Thomas Veerman a0eaaa5c9f Fix a bug in put_inode that causes corruption to the file system and another
bug that causes problems when files grow bigger than a certain threshold. Also
fix a few type and code inconsistencies.
2010-06-09 09:56:43 +00:00
Tomas Hruby 1207fcc6f0 int to endpoint_t conversions in mmap 2010-06-09 09:14:53 +00:00
Kees van Reeuwijk 826b9590f2 More endpoint_t correctness.
More const correctness.
Other code cleanup.
2010-06-08 14:09:18 +00:00
Arun Thomas 4c10a31440 Remove legacy MM, FS, and FS_PROC_NR macros 2010-06-08 13:58:01 +00:00
Erik van der Kouwe 7bd7946346 Remove redundant macro cproc_addr 2010-06-08 13:38:44 +00:00
Ben Gras 31adc0a3c4 vm: junkfree feature that fills freed pages with a recognizable pattern. 2010-06-08 00:59:48 +00:00
Arun Thomas b641afc78a VM: Remove legacy non-paging code paths 2010-06-05 14:39:40 +00:00
Cristiano Giuffrida 354d88f883 Put initialization code where it belongs. 2010-06-04 18:08:15 +00:00
Cristiano Giuffrida 332842295a Always skip signals for PM itself when broadcasting. 2010-06-03 11:18:43 +00:00
Kees van Reeuwijk ed0b81c25c Removed some unused variables and functions. 2010-06-02 19:41:38 +00:00
Thomas Veerman 6bbcab3ec4 Clean up MFS a bit:
- Remove unused includes.
 - Add include guards to headers.
 - Use unsigned variables in case they're never going to hold a negative
   value. This causes GCC's complaints to disappear and should make flexelint
   a lot happier, too.
 - Make functions private when they're used only within a module.
 - Remove unused variables.
 - Add casts where appropriate.
2010-06-01 12:35:33 +00:00
Thomas Veerman 5d78cefaf2 Clean up PFS 2010-05-28 09:39:18 +00:00
Erik van der Kouwe 43b589c1cc Avoid use of C++ reserved word class in headers (reported by Aki Goto, tracker item 375) 2010-05-27 08:48:53 +00:00
Arun Thomas b48b037fbe Reorganize some directories
servers/hgfs/hgfs_server => servers/hgfs
servers/hgfs/libhgfs => lib/libhgfs
servers/rs/service => commands/service
drivers/memory/memory_driver => drivers/memory
drivers/memory/ramdisk => drivers/ramdisk
2010-05-26 22:49:57 +00:00
Arun Thomas 007104d60e GCC build fixes/updates
-Set stack sizes for boot image processes
-Increase RS stack size
-Reduce ramdisk size
-HARDWARE task should use kernel stack
-Minor asm tweaks for leading underscores
2010-05-26 18:45:55 +00:00
David van Moolenbroek 7f98ba962a make IS report masked IRQs properly 2010-05-26 08:44:50 +00:00
Tomas Hruby a8111c5027 Various small scheduling related fixes 2010-05-26 07:16:39 +00:00
Tomas Hruby 451a6890d6 scheduling - time quantum in miliseconds
- Currently the cpu time quantum is timer-ticks based. Thus the
  remaining quantum is decreased only if the processes is interrupted
  by a timer tick. As processes block a lot this typically does not
  happen for normal user processes. Also the quantum depends on the
  frequency of the timer.

- This change makes the quantum miliseconds based. Internally the
  miliseconds are translated into cpu cycles. Everytime userspace
  execution is interrupted by kernel the cycles just consumed by the
  current process are deducted from the remaining quantum.

- It makes the quantum system timer frequency independent.

- The boot processes quantum is loosely derived from the tick-based
  quantas and 60Hz timer and subject to future change

- the 64bit arithmetics is a little ugly, will be changes once we have
  compiler support for 64bit integers (soon)
2010-05-25 08:06:14 +00:00
Kees van Reeuwijk ac14a989b3 Fixed some inconsistent strict typing declarations.
Better strict typing.
2010-05-25 07:23:24 +00:00
Erik van der Kouwe 1f11a57141 Oops, last commit included more than was intended 2010-05-20 08:07:47 +00:00
Erik van der Kouwe 5f15ec05b2 More system processes, this was not enough for the release script to run on some configurations 2010-05-20 08:05:07 +00:00
Arun Thomas b0159ad168 Buildsystem changes for GCC
-Makefile updates
-Update mkdep
-Build fixes/warning cleanups for some programs
-Restore leading underscores on global syms in kernel asm files
-Increase ramdisk size
2010-05-19 13:24:15 +00:00
Ben Gras bcdaf033b5 pm - fix sched interaction
For coredumping processes, PM forgets to inform SCHED that the
process has vanished, causing future fork()s to fail.
2010-05-19 13:22:29 +00:00
Tomas Hruby dcc81d73e8 boot image - no need for entry point
- removes the initial_pc from struct boot_image. It is always set
  to 0 and RS uses a.out headers.
2010-05-18 13:51:46 +00:00
Tomas Hruby b09bcf6779 Scheduling server (by Bjorn Swift)
In this second phase, scheduling is moved from PM to its own
scheduler (see r6557 for phase one). In the next phase we hope to a)
include useful information in the "out of quantum" message and b)
create some simple scheduling policy that makes use of that
information.

When the system starts up, PM will iterate over its process table and
ask SCHED to take over scheduling unprivileged processes. This is
done by sending a SCHEDULING_START message to SCHED. This message
includes the processes endpoint, the parent's endpoint and its nice
level. The scheduler adds this process to its schedproc table, issues
a schedctl, and returns its own endpoint to PM - as the endpoint of
the effective scheduler. When a process terminates, a SCHEDULING_STOP
message is sent to the scheduler.

The reason for this effective endpoint is for future compatibility.
Some day, we may have a scheduler that, instead of scheduling the
process itself, forwards the SCHEDULING_START message on to another
scheduler.

PM has information on who schedules whom. As such, scheduling
messages from user-land are sent through PM. An example is when
processes change their priority, using nice(). In that case, a
getsetpriority message is sent to PM, which then sends a
SCHEDULING_SET_NICE to the process's effective scheduler.

When a process is forked through PM, it inherits its parent's
scheduler, but is spawned with an empty quantum. As before, a request
to fork a process flows through VM before returning to PM, which then
wakes up the child process. This flow has been modified slightly so
that PM notifies the scheduler of the new process, before waking up
the child process. If the scheduler fails to take over scheduling,
the child process is torn down and the fork fails with an erroneous
value.

Process priority is entirely decided upon using nice levels. PM
stores a copy of each process's nice level and when a child is
forked, its parent's nice level is sent in the SCHEDULING_START
message. How this level is mapped to a priority queue is up to the
scheduler. It should be noted that the nice level is used to
determine the max_priority and the parent could have been in a lower
priority when it was spawned. To prevent a CPU intensive process from
hawking the CPU by continuously forking children that get scheduled
in the max_priority, the scheduler should determine in which queue
the parent is currently scheduled, and schedule the child in that
same queue.

Other fixes: The USER_Q in kernel/proc.h was incorrectly defined as
NR_SCHED_QUEUES/2. That results in a "off by one" error when
converting priority->nice->priority for nice=0. This also had the
side effect that if someone were to set the MAX_USER_Q to something
else than 0, then USER_Q would be off.
2010-05-18 13:39:04 +00:00
David van Moolenbroek 9ba65d2ea8 This patch switches the MINIX3 ethernet driver stack from a port-based
model to an instance-based model. Each ethernet driver instance is now
responsible for exactly one network interface card. The port field in
/etc/inet.conf now acts as an instance field instead.

This patch also updates the data link protocol. This update:
- eliminates the concept of ports entirely;
- eliminates DL_GETNAME entirely;
- standardizes on using m_source for IPC and DL_ENDPT for safecopies;
- removes error codes from TASK/STAT replies, as they were unused;
- removes a number of other old or unused fields;
- names and renames a few other fields.

All ethernet drivers have been changed to:
- conform to the new protocol, and exactly that;
- take on an instance number based on a given "instance" argument;
- skip that number of PCI devices in probe iterations;
- use config tables and environment variables based on that number;
- no longer be limited to a predefined maximum of cards in any way;
- get rid of any leftover non-safecopy support and other ancient junk;
- have a correct banner protocol figure, or none at all.

Other changes:
* Inet.conf is now taken to be line-based, and supports #-comments.
  No existing installations are expected to be affected by this.
* A new, select-based asynchio library replaces the old one.
  Kindly contributed by Kees J. Bot.
* Inet now supports use of select() on IP devices.
  Combined, the last two changes together speed up dhcpd
  considerably in the presence of multiple interfaces.
* A small bug has been fixed in nonamed.
2010-05-17 22:22:53 +00:00
David van Moolenbroek ce386974bc DS: base number of data entries on NR_SYS_PROCS 2010-05-12 13:21:15 +00:00
Ben Gras c5c25e7abc kernel/vm: change pde table info from single buffer to explicit per-process.
makes code in kernel more readable, and allows better sanity checking on
using the pde info.
2010-05-12 08:31:05 +00:00
Cristiano Giuffrida 23204787d5 - Fixed a bug when running out of priv structures.
- Tell VM about VM calls for every new service instance.
2010-05-11 20:49:42 +00:00
Tomas Hruby d3e991a7b6 PM signal handling check too strict
- this panic may be unnecessarily triggered if PM gets the delayed
  stop signal from kernel before it gets reply from VFS to the UNPAUSE
  call.

- after this change PM does not proceed to delivering the signal until
  the reply from VFS is received. Perhaps PM could deliver the signal
  straight away as it knows that the process does not run. Possibly
 i dangerous.

- the signal is deliverd immediately after the UNPAUSE reply as the
  pending signals are always checked at the moment.
2010-05-10 14:27:22 +00:00
Tomas Hruby 6e25ad8b0a Use of all NIL_* defines converted to NULL 2010-05-10 13:26:00 +00:00
Ben Gras d5a0af826a vm: use arch_map2str to print pagefault info, to properly display code addrs 2010-05-08 17:25:54 +00:00
Tomas Hruby 7c334e2670 RS - fixed timeouts
- rs does not assume hz==60

- rs adjusts its timeout ticks by the system clock frequency

- drivers have time to reply if hz is set too high (e.g. 1000+) for
  instance when debugging
2010-05-07 18:12:16 +00:00
Thomas Veerman 0aceb25535 Small cleanup of dead and/or redundant code. 2010-05-06 09:32:40 +00:00
Ben Gras b6bb75963b vm: remove leftover diag print 2010-05-05 15:26:48 +00:00
Ben Gras 86e1b9d770 fsctl.h doesn't exist. 2010-05-05 11:49:41 +00:00
Ben Gras f78d8e74fd secondary cache feature in vm.
A new call to vm lets processes yield a part of their memory to vm,
together with an id, getting newly allocated memory in return. vm is
allowed to forget about it if it runs out of memory. processes can ask
for it back using the same id. (These two operations are normally
combined in a single call.)

It can be used as a as-big-as-memory-will-allow block cache for
filesystems, which is how mfs now uses it.
2010-05-05 11:35:04 +00:00
Ben Gras 4ac5eb7832 rs: stacktrace if system process exits early. 2010-04-29 08:50:17 +00:00
Cristiano Giuffrida 83ef7119f6 Don't panic when out of priv structures. 2010-04-28 20:41:23 +00:00
Erik van der Kouwe 93f3bf5bda Fix wrong word 2010-04-28 20:37:08 +00:00
Thomas Veerman f9317dc039 Scan all processes for that might be blocked on a lock 2010-04-28 11:54:22 +00:00
Erik van der Kouwe d17590fcf4 Avoid sbrk (in favour of malloc) in RS where possible 2010-04-28 08:35:54 +00:00
Cristiano Giuffrida 0164957abb Unified crash recovery and live update.
RS CHANGES:
- Crash recovery is now implemented like live update. Two instances are kept
side by side and the dead version is live updated into the new one. The endpoint
doesn't change and the failure is not exposed (by default) to other system
services.
- The new instance can be created reactively (when a crash is detected) or
proactively. In the latter case, RS can be instructed to keep a replica of
the system service to perform a hot swap when the service fails. The flag
SF_USE_REPL is set in that case.
- The new flag SF_USE_REPL is supported for services in the boot image and
dynamically started services through the RS interface (i.e. -p option in the
service utility).
- Fixed a free unallocated memory bug for core system services.
2010-04-27 11:17:30 +00:00
Tomas Hruby f51eea4b32 Changed pagefault delivery to VM
this patch changes the way pagefaults are delivered to VM. It adopts
the same model as the out-of-quantum messages sent by kernel to a
scheduler.

- everytime a userspace pagefault occurs, kernel creates a message
  which is sent to VM on behalf of the faulting process

- the process is blocked on delivery to VM in the standard IPC code
  instead of waiting in a spacial in-kernel queue (stack) and is not
  runnable until VM tell kernel that the pagefault is resolved and is
  free to clear the RTS_PAGEFAULT flag.

- VM does not need call kernel and poll the pagefault information
  which saves many (1/2?) calls and kernel calls that return "no more
  data"

- VM notification by kernel does not need to use signals

- each entry in proc table is by 12 bytes smaller (~3k save)
2010-04-26 23:21:26 +00:00
Ben Gras 94edf4fa12 vfs: start at vmnt[0] to sync mounted filesystems, not vmnt[1]. 2010-04-26 17:12:34 +00:00