Commit graph

1183 commits

Author SHA1 Message Date
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
Kees van Reeuwijk e24ed988d6 Fix some compilation errors with the gcc compiler, fix some recent warnings. 2010-04-22 13:59:34 +00:00
Kees van Reeuwijk 86a23c1fbd Remove U16_t and most other similar types. Rewrite functions to ansi-style
declaration if necessary.
2010-04-21 11:05:22 +00:00
Kees van Reeuwijk e85f78a20b Add some support for wchar_t. 2010-04-19 15:20:24 +00:00
David van Moolenbroek cfb108afc7 fix mfs/isofs signal handling 2010-04-15 16:10:28 +00:00
Ben Gras e0792d72d7 vm: util.S not used currently; leave it out. 2010-04-13 15:02:32 +00:00
Ben Gras 5c17d5e02f vm: include no-caching bits in PTF_ALLFLAGS for flags sanity check. 2010-04-13 11:08:08 +00:00
Ben Gras 1f1f8d2207 vm: don't force physical addresses to be nonzero. 2010-04-13 11:01:40 +00:00
Kees van Reeuwijk bc314bda91 Remove the types Dev_t, _mnx_Gui, _mnx_Uid, and similar.
Use ANSI-style function declarations where necessary.
2010-04-13 10:58:41 +00:00
Tomas Hruby 86378ff645 PM remembers what it should schedule
- while PM implements fork also for RS it needs to remember what to
  schedule and what not. PM_SCHEDULED flag serves this purpose.

- PM only schedules processes that are descendaints of init, i.e. normal
  user processes

- after a process is forked PM schedules for the first time only
  processes that have PM_SCHEDULED set. The others are handled iether
  by kernel or some other scheduler
2010-04-13 10:45:08 +00:00
Ben Gras 5f7c37bb84 vm: remove assert, map in of phys addr 0 is legit sometimes. 2010-04-13 10:39:46 +00:00
Ben Gras 27fc7ab1f3 vm: use assert() instead of vm_assert(); remove vm_assert(). 2010-04-12 12:37:28 +00:00
Ben Gras c78250332d let vm use physically fragmented memory for allocations.
map_copy_ph_block is replaced by map_clone_ph_block, which can
replace a single physical block by multiple physical blocks.

also,
 . merge map_mem.c with region.c, as they manipulate the same
   data structures
 . NOTRUNNABLE removed as sanity check
 . use direct functions for ALLOC_MEM and FREE_MEM again
 . add some checks to shared memory mapping code
 . fix for data structure integrity when using shared memory
 . fix sanity checks
2010-04-12 11:25:24 +00:00
Ben Gras 76fbf21026 ipc server: don't print as many errors, to make ipc test less noisy. 2010-04-12 11:06:15 +00:00
Cristiano Giuffrida 66a8efba53 Fixed escape warning. 2010-04-12 08:39:59 +00:00
Tomas Hruby 9b599bac1d Quantum in fork
- This patch removes the time slice split between parent and child in
  fork.

- The time slice of the parent remains unchanged and the child does
  not have any.

- If the process has a scheduler, the scheduler must assign the
  quantum and priority of the new process and let it run.

- If the child does not inherit a scheduler, it is scheduled by the
  dummy default kernel policy. (servers, drivers, etc.)

- In theory, the scheduler can change the quantum even of the parent
  process and implement any policy for splitting the quantum as
  neither the parent nor the child are runnable.  Sending the
  out-of_quantum message on behalf of the processes may look like the
  right solution, however, the scheduler would probably handle the
  message before the whole fork protocol is finished. This way the
  scheduler has absolute control when the process should become
  runnable.
2010-04-10 15:27:38 +00:00
Tomas Hruby 1a31d158ad Restructure and simplyfycation of the scheduling code in PM a little bit.
- It introduces schedule_process() which makes a kernel call to set
  the scheduling parameters of a process. It is used in the next patch.
2010-04-10 15:24:49 +00:00
Cristiano Giuffrida 65ef539739 Driver mapping refactory.
VFS CHANGES:
- dmap table no longer statically initialized in VFS
- Dropped FSSIGNON svrctl call no longer used by INET

INET CHANGES:
- INET announces its presence to VFS just like any other driver

RS CHANGES:
- The boot image dev table contains all the data to initialize VFS' dmap table
- RS interface supports asynchronous up and update operations now
- RS interface extended to support driver style and flags
2010-04-09 21:56:44 +00:00
Cristiano Giuffrida 98d1cf7064 Fixed gcc -Wall warnings. 2010-04-08 15:02:32 +00:00
Cristiano Giuffrida 48c6bb79f4 Driver refactory for live update and crash recovery.
SYSLIB CHANGES:
- DS calls to publish / retrieve labels consider endpoints instead of u32_t.

VFS CHANGES:
- mapdriver() only adds an entry in the dmap table in VFS.
- dev_up() is only executed upon reception of a driver up event.

INET CHANGES:
- INET no longer searches for existing drivers instances at startup.
- A newtwork driver is (re)initialized upon reception of a driver up event.
- Networking startup is now race-free by design. No need to waste 5 seconds
at startup any more.

DRIVER CHANGES:
- Every driver publishes driver up events when starting for the first time or
in case of restart when recovery actions must be taken in the upper layers.
- Driver up events are published by drivers through DS. 
- For regular drivers, VFS is normally the only subscriber, but not necessarily.
For instance, when the filter driver is in use, it must subscribe to driver
up events to initiate recovery.
- For network drivers, inet is the only subscriber for now.
- Every VFS driver is statically linked with libdriver, every network driver
is statically linked with libnetdriver.

DRIVER LIBRARIES CHANGES:
- Libdriver is extended to provide generic receive() and ds_publish() interfaces
for VFS drivers.
- driver_receive() is a wrapper for sef_receive() also used in driver_task()
to discard spurious messages that were meant to be delivered to a previous
version of the driver.
- driver_receive_mq() is the same as driver_receive() but integrates support
for queued messages.
- driver_announce() publishes a driver up event for VFS drivers and marks
the driver as initialized and expecting a DEV_OPEN message.
- Libnetdriver is introduced to provide similar receive() and ds_publish()
interfaces for network drivers (netdriver_announce() and netdriver_receive()).
- Network drivers all support live update with no state transfer now.

KERNEL CHANGES:
- Added kernel call statectl for state management. Used by driver_announce() to
unblock eventual callers sendrecing to the driver.
2010-04-08 13:41:35 +00:00
Kees van Reeuwijk 94a81c840a Removed unused variables, added const where possible. 2010-04-07 11:25:51 +00:00
Arun Thomas 4ed3a0cf3a Convert kernel over to bsdmake 2010-04-01 22:22:33 +00:00
Kees van Reeuwijk fc7dced1fa Fix printfs with too few or too many parms, remove unused vars, fix incorrect flag tests, other code cleanup. 2010-04-01 13:25:05 +00:00
Kees van Reeuwijk c3f649557e Lots of const correctness, other cleanup. 2010-04-01 12:51:31 +00:00
Cristiano Giuffrida d8b42a755d Move kernel signal SIGKNDELAY to system signal SIGSNDELAY and fix broken ptrace. 2010-03-31 08:55:12 +00:00
Thomas Veerman 4d686f1616 Move allocation of temporary inodes for cloned character special devices from
MFS to PFS.
2010-03-30 15:00:09 +00:00
Kees van Reeuwijk 4865e3f4f9 More use of endpoint_t. Other code cleanup. 2010-03-30 14:07:15 +00:00
Ben Gras bc0e36f402 fix null deref; vmnt->mounted_on is NULL legitimately for root.
changed check+panic to assert().

added assert().
2010-03-29 11:39:54 +00:00
Tomas Hruby 5b52c5aa02 A reliable way for userspace to check if a msg is from kernel
- IPC_FLG_MSG_FROM_KERNEL status flag is returned to userspace if the
  receive was satisfied by s message which was sent by the kernel on
  behalf of a process. This perfectly reliale information.

- MF_SENDING_FROM_KERNEL flag added to processes to be able to set
  IPC_FLG_MSG_FROM_KERNEL when finishing receive if the receiver
  wasn't ready to receive immediately.

- PM is changed to use this information to confirm that the scheduling
  messages are indeed from the kernel and not faked by a process.

  PM uses sef_receive_status()

- get_work() is removed from PM to make the changes simpler
2010-03-29 11:25:01 +00:00
Tomas Hruby b4cf88a04f Userspace scheduling
- cotributed by Bjorn Swift

- In this first phase, scheduling is moved from the kernel to the PM
  server. The next steps are to a) moving scheduling to its own server
  and b) include useful information in the "out of quantum" message,
  so that the scheduler can make use of this information.

- The kernel process table now keeps record of who is responsible for
  scheduling each process (p_scheduler). When this pointer is NULL,
  the process will be scheduled by the kernel. If such a process runs
  out of quantum, the kernel will simply renew its quantum an requeue
  it.

- When PM loads, it will take over scheduling of all running
  processes, except system processes, using sys_schedctl().
  Essentially, this only results in taking over init. As children
  inherit a scheduler from their parent, user space programs forked by
  init will inherit PM (for now) as their scheduler.

 - Once a process has been assigned a scheduler, and runs out of
   quantum, its RTS_NO_QUANTUM flag will be set and the process
   dequeued. The kernel will send a message to the scheduler, on the
   process' behalf, informing the scheduler that it has run out of
   quantum. The scheduler can take what ever action it pleases, based
   on its policy, and then reschedule the process using the
   sys_schedule() system call.

- Balance queues does not work as before. While the old in-kernel
  function used to renew the quantum of processes in the highest
  priority run queue, the user-space implementation only acts on
  processes that have been bumped down to a lower priority queue.
  This approach reacts slower to changes than the old one, but saves
  us sending a sys_schedule message for each process every time we
  balance the queues. Currently, when processes are moved up a
  priority queue, their quantum is also renewed, but this can be
  fiddled with.

- do_nice has been removed from kernel. PM answers to get- and
  setpriority calls, updates it's own nice variable as well as the
  max_run_queue. This will be refactored once scheduling is moved to a
  separate server. We will probably have PM update it's local nice
  value and then send a message to whoever is scheduling the process.

- changes to fix an issue in do_fork() where processes could run out
  of quantum but bypassing the code path that handles it correctly.
  The future plan is to remove the policy from do_fork() and implement
  it in userspace too.
2010-03-29 11:07:20 +00:00
Cristiano Giuffrida bde2109b7c IPC status code for receive().
IPC changes:
- receive() is changed to take an additional parameter, which is a pointer to
a status code.
- The status code is filled in by the kernel to provide additional information
to the caller. For now, the kernel only fills in the IPC call used by the
sender.

Syslib changes:
- sef_receive() has been split into sef_receive() (with the original semantics)
and sef_receive_status() which exposes the status code to userland.
- Ideally, every sys process should gradually switch to sef_receive_status()
and use is_ipc_notify() as a dependable way to check for notify.
- SEF has been modified to use is_ipc_notify() and demonstrate how to use the
new status code.
2010-03-23 00:09:11 +00:00
Cristiano Giuffrida ef95bf1bb9 Print stacktrace when a system service fails or when a core dump has to be generated for a user process. 2010-03-22 22:46:29 +00:00
Arun Thomas 436d6012a3 Convert drivers/ and servers/ over to bsdmake
-Move libdriver to lib/
-Install all boot image services on filesystem to aid restartability
2010-03-22 21:25:22 +00:00
Kees van Reeuwijk c33102ea6b Miscellaneous code cleanup. 2010-03-22 20:43:06 +00:00
Tomas Hruby 12ef495cac atomicity fix when enabling paging
- before enabling paging VM asks kernel to resize its segments. This
  may cause kernel to segfault if APIC is used and an interrupt
  happens between this and paging enabled. As these are 2 separate
  vmctl calls it is not atomic. This patch fixes this problem. VM does
  not ask kernel to resize the segments in a separate call anymore.
  The new segments limit is part of the "enable paging" call. It
  generalizes this call in such a way that more information can be
  passed as need be or the information may be completely different if
  another architecture requires this.
2010-03-22 07:42:52 +00:00
Ben Gras ec30f25d0c VM: fix kernel mappings for children of non-paged parents. 2010-03-18 17:17:31 +00:00
Cristiano Giuffrida cb176df60f New RS and new signal handling for system processes.
UPDATING INFO:
20100317:
        /usr/src/etc/system.conf updated to ignore default kernel calls: copy
        it (or merge it) to /etc/system.conf.
        The hello driver (/dev/hello) added to the distribution:
        # cd /usr/src/commands/scripts && make clean install
        # cd /dev && MAKEDEV hello

KERNEL CHANGES:
- Generic signal handling support. The kernel no longer assumes PM as a signal
manager for every process. The signal manager of a given process can now be
specified in its privilege slot. When a signal has to be delivered, the kernel
performs the lookup and forwards the signal to the appropriate signal manager.
PM is the default signal manager for user processes, RS is the default signal
manager for system processes. To enable ptrace()ing for system processes, it
is sufficient to change the default signal manager to PM. This will temporarily
disable crash recovery, though.
- sys_exit() is now split into sys_exit() (i.e. exit() for system processes,
which generates a self-termination signal), and sys_clear() (i.e. used by PM
to ask the kernel to clear a process slot when a process exits).
- Added a new kernel call (i.e. sys_update()) to swap two process slots and
implement live update.

PM CHANGES:
- Posix signal handling is no longer allowed for system processes. System
signals are split into two fixed categories: termination and non-termination
signals. When a non-termination signaled is processed, PM transforms the signal
into an IPC message and delivers the message to the system process. When a
termination signal is processed, PM terminates the process.
- PM no longer assumes itself as the signal manager for system processes. It now
makes sure that every system signal goes through the kernel before being
actually processes. The kernel will then dispatch the signal to the appropriate
signal manager which may or may not be PM.

SYSLIB CHANGES:
- Simplified SEF init and LU callbacks.
- Added additional predefined SEF callbacks to debug crash recovery and
live update.
- Fixed a temporary ack in the SEF init protocol. SEF init reply is now
completely synchronous.
- Added SEF signal event type to provide a uniform interface for system
processes to deal with signals. A sef_cb_signal_handler() callback is
available for system processes to handle every received signal. A
sef_cb_signal_manager() callback is used by signal managers to process
system signals on behalf of the kernel.
- Fixed a few bugs with memory mapping and DS.

VM CHANGES:
- Page faults and memory requests coming from the kernel are now implemented
using signals.
- Added a new VM call to swap two process slots and implement live update.
- The call is used by RS at update time and in turn invokes the kernel call
sys_update().

RS CHANGES:
- RS has been reworked with a better functional decomposition.
- Better kernel call masks. com.h now defines the set of very basic kernel calls
every system service is allowed to use. This makes system.conf simpler and
easier to maintain. In addition, this guarantees a higher level of isolation
for system libraries that use one or more kernel calls internally (e.g. printf).
- RS is the default signal manager for system processes. By default, RS
intercepts every signal delivered to every system process. This makes crash
recovery possible before bringing PM and friends in the loop.
- RS now supports fast rollback when something goes wrong while initializing
the new version during a live update.
- Live update is now implemented by keeping the two versions side-by-side and
swapping the process slots when the old version is ready to update.
- Crash recovery is now implemented by keeping the two versions side-by-side
and cleaning up the old version only when the recovery process is complete.

DS CHANGES:
- Fixed a bug when the process doing ds_publish() or ds_delete() is not known
by DS.
- Fixed the completely broken support for strings. String publishing is now
implemented in the system library and simply wraps publishing of memory ranges.
Ideally, we should adopt a similar approach for other data types as well.
- Test suite fixed.

DRIVER CHANGES:
- The hello driver has been added to the Minix distribution to demonstrate basic
live update and crash recovery functionalities.
- Other drivers have been adapted to conform the new SEF interface.
2010-03-17 01:15:29 +00:00
Thomas Veerman bef0e3eb63 - Add support for the ucontext system calls (getcontext, setcontext,
swapcontext, and makecontext).
- Fix VM to not erroneously think the stack segment and data segment have
  collided when a user-space thread invokes brk().
- Add test51 to test ucontext functionality.
- Add man pages for ucontext system calls.
2010-03-12 15:58:41 +00:00
Arun Thomas 1f9ce647cf Move archtypes.h, fpu.h, and stackframe.h
Move archtypes.h to include/ dir, since several servers require it. Move
fpu.h and stackframe.h to arch-specific header directory. Make source
files and makefiles aware of the new header locations.
2010-03-09 09:41:14 +00:00
David van Moolenbroek 27d53256e4 VFS fixes:
- do not use uninitialized req_breadwrite results upon failure
- improve ".." ELEAVEMOUNT correctness check
2010-03-08 22:05:27 +00:00
Arun Thomas 2a8fabf4ad Include directory reorg and makefile updates.
-Convert the include directory over to using bsdmake
 syntax
-Update/add mkfiles
-Modify install(1) so that it can create symlinks
-Update makefiles to use new install(1) options
-Rename /usr/include/ibm to /usr/include/i386
-Create /usr/include/machine symlink to arch header files
-Move vm_i386.h to its new home in the /usr/include/i386
-Update source files to #include the header files at their
 new homes.
-Add new gnu-includes target for building GCC headers
2010-03-08 11:04:59 +00:00
Ben Gras 35a108b911 panic() cleanup.
this change
   - makes panic() variadic, doing full printf() formatting -
     no more NO_NUM, and no more separate printf() statements
     needed to print extra info (or something in hex) before panicing
   - unifies panic() - same panic() name and usage for everyone -
     vm, kernel and rest have different names/syntax currently
     in order to implement their own luxuries, but no longer
   - throws out the 1st argument, to make source less noisy.
     the panic() in syslib retrieves the server name from the kernel
     so it should be clear enough who is panicing; e.g.
         panic("sigaction failed: %d", errno);
     looks like:
         at_wini(73130): panic: sigaction failed: 0
         syslib:panic.c: stacktrace: 0x74dc 0x2025 0x100a
   - throws out report() - printf() is more convenient and powerful
   - harmonizes/fixes the use of panic() - there were a few places
     that used printf-style formatting (didn't work) and newlines
     (messes up the formatting) in panic()
   - throws out a few per-server panic() functions
   - cleans up a tie-in of tty with panic()

merging printf() and panic() statements to be done incrementally.
2010-03-05 15:05:11 +00:00
Ben Gras adf0b6fb26 No more E{SRC,DST}DIED errno's, replaced by EDEADSRCDST.
The callers don't care about the difference and had to check 3 error
codes instead of one.
2010-03-03 15:47:16 +00:00
Arun Thomas cbd276e4ce Convert library asm files to GAS syntax 2010-03-03 14:27:30 +00:00
Kees van Reeuwijk bf7397b64e More correctly use cp_grant_id_t.
More correctly use vir_bytes.
More correctly use endpoint_t.
2010-03-02 23:12:13 +00:00
Kees van Reeuwijk f3c98fdca2 Fixed a number of cases where a bits in an integer were tested
incorrectly, resulting in real (and nasty) bugs.
2010-03-02 12:55:39 +00:00
Tomas Hruby 975efeac31 Typo in VM server 2010-03-02 10:53:17 +00:00
Kees van Reeuwijk 1ce69592d2 Fixed an array bounds violation.
Let include guards comform to the Minix standard.
2010-02-24 10:39:58 +00:00
Kees van Reeuwijk 3922d45719 Fix an array-bound violation, add some include guards. 2010-02-22 17:44:08 +00:00
Kees van Reeuwijk 1597e701a0 Remove useless variables and the computations on them. 2010-02-19 10:00:32 +00:00
Arun Thomas b706112487 Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
Kees van Reeuwijk 064cb7583a Lots of small code cleanup: make symbols local, remove unused symbols,
fixed a typo, removed a now unused header file.
Use #include <..> for header files that represent libraries.
2010-02-09 15:23:38 +00:00
David van Moolenbroek bdd4f5857f Fixes for truncate system calls:
- VFS: check for negative sizes in all truncate calls
- VFS: update file size after truncating with fcntl(F_FREESP)
- VFS: move pos/len checks for F_FREESP with l_len!=0 from FS to VFS
- MFS: do not zero data block for small files when fully truncating
- MFS: do not write out freed indirect blocks after freeing space
- MFS: make truncate work correctly with differing zone/block sizes
- tests: add new test50 for truncate call family
2010-02-09 08:12:37 +00:00
Ben Gras 157e82e76a philip's inet tcp fix. 2010-02-04 22:06:10 +00:00
Ben Gras 35b471ad94 removal of unused vm<->vfs code. 2010-02-03 13:35:17 +00:00
David van Moolenbroek c7f1b547cb Statistical profiling fixes:
- PM: get rid of umap warning
- sprofalyze.pl: update with recently added servers and drivers
- sprofalyze.pl: properly truncate process names for sample matching
2010-02-03 12:27:52 +00:00
Erik van der Kouwe c107dbe1d0 Man-pages on mkdep, cdprobe, loadramdisk and newroot; thanks to Antoine Leca 2010-02-02 15:10:00 +00:00
Erik van der Kouwe 310876dcec Kill processes which ignore signals thatshould not be ignored 2010-01-31 19:13:20 +00:00
Kees van Reeuwijk 2fe20e5aaf Fix a complaint about a value return from a void function.
Propagate error codes a bit more.
Some code cleanup.
2010-01-29 14:14:22 +00:00
Kees van Reeuwijk 477b616fe8 Fixed a number of complaints about missing return statements.
Some cases were fixed by declaring the function void, others were fixed
by adding a return <value> statement, thereby avoiding potentially
incorrect behavior (usually in error handling).
Some enum correctness in boot.c.
2010-01-28 13:17:07 +00:00
David van Moolenbroek 564e2a4368 HGFS tweaks 2010-01-27 22:59:03 +00:00
Kees van Reeuwijk 2ba237cd4e Fixed a number of uses of uninitialized variables by adding assertions
or other sanity checks, code reshuffling, or fixing broken behavior.
2010-01-27 10:23:58 +00:00
Thomas Veerman 9a7cd8e254 Pipe vnodes are always mapped. 2010-01-27 09:30:39 +00:00
Kees van Reeuwijk b67f788eea Removed a number of useless #includes 2010-01-26 10:59:01 +00:00
David van Moolenbroek e42952c93f typo 2010-01-25 23:48:14 +00:00
David van Moolenbroek 1ff4a7dbc6 update DS label retrieve calls 2010-01-25 23:23:43 +00:00
David van Moolenbroek 71fe2852f4 HGFS - VMware Shared Folders file system server 2010-01-25 23:18:02 +00:00
Tomas Hruby ee4cff8d66 2 copies of taskcall.c removed
- taskcall.c is 3x in the trunk as part of libc, libsysutil and
  libsys.  It should be only part of libsys.

- only system process should be linked with libsys, therefore using
  raw _taskcall() in service.c is replaced by _syscall()

- the same for minix_rs.c

- lib/other/sys_eniop.c can go without replacement as it is part of
  syslib
2010-01-25 14:22:09 +00:00
Kees van Reeuwijk a7cee5bec4 Removed unused symbols.
Minor cleanups.
2010-01-22 22:01:08 +00:00
Thomas Veerman ee2e57b4dc Add return statement after failed dev_open (fixes open count in at_wini) 2010-01-21 15:02:29 +00:00
Thomas Veerman fadbbf7b2e Unmount defunct boot ramdisk at bootup 2010-01-21 09:58:07 +00:00
Thomas Veerman ca9280e097 - Fix dangling symlink regression
- Make open(2) more POSIX compliant
- Add a test case for dangling symlinks and open() syscall with O_CREAT and
  O_EXCL on a symlink.
- Update open(2) man page to reflect change.
2010-01-21 09:32:15 +00:00
Kees van Reeuwijk 24964aa706 Removed unused variable ip_port from icmp_router_advertisment(). 2010-01-20 22:02:25 +00:00
Kees van Reeuwijk 9a755c3a1f Removed unused code in the ethernet driver that was left from an old implementation
Removed/rewritten the use of uninitialized variables in error messages.
2010-01-20 17:02:55 +00:00
David van Moolenbroek 53a6e039de remove SYS_MAPDMA 2010-01-19 21:24:42 +00:00
David van Moolenbroek 61bb82a44b VM information interface 2010-01-19 21:00:20 +00:00
Cristiano Giuffrida c5b309ff07 Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu)
Main changes:
- COW optimization for safecopy.
- safemap, a grant-based interface for sharing memory regions between processes.
- Integration with safemap and complete rework of DS, supporting new data types
  natively (labels, memory ranges, memory mapped ranges).
- For further information:
  http://wiki.minix3.org/en/SummerOfCode2009/MemoryGrants

Additional changes not included in the original Wu's branch:
- Fixed unhandled case in VM when using COW optimization for safecopy in case
  of a block that has already been shared as SMAP.
- Better interface and naming scheme for sys_saferevmap and ds_retrieve_map
  calls.
- Better input checking in syslib: check for page alignment when creating
  memory mapping grants.
- DS notifies subscribers when an entry is deleted.
- Documented the behavior of indirect grants in case of memory mapping.
- Test suite in /usr/src/test/safeperf|safecopy|safemap|ds/* reworked
  and extended.
- Minor fixes and general cleanup.
- TO-DO: Grant ids should be generated and managed the way endpoints are to make
sure grant slots are never misreused.
2010-01-14 15:24:16 +00:00
Kees van Reeuwijk 5459f3a607 Removed a whole herd of unused variables.
Some other cleanup.
2010-01-14 13:53:12 +00:00
Tomas Hruby d96360e4d4 Uninitialized variable fix in VM to kernel protocol
- index must be initialized to 0 otherwise bad things happen like the mappings
  for local APIC are not correct after turning paging on.
2010-01-14 11:30:02 +00:00
Kees van Reeuwijk ad4c0ff698 Fixed a bug in apic.c that broke lapic_stop_timer().
Fixed bugs in liveupdate.c that rendered load_state_info() meaningless.
More informative error message in do_config() in service.c.
2010-01-13 14:44:19 +00:00
David van Moolenbroek b31119abf5 Mount updates:
- allow mounting with "none" block device
- allow unmounting by mountpoint
- make VFS aware of file system process labels
- allow m3_ca1 to use the full available message size
- use *printf in u/mount(1), as mount(2) uses it already
- fix reference leaks for some mount error cases in VFS
2010-01-12 23:08:50 +00:00
Cristiano Giuffrida d1fd04e72a Initialization protocol for system services.
SYSLIB CHANGES:
- SEF framework now supports a new SEF Init request type from RS. 3 different
callbacks are available (init_fresh, init_lu, init_restart) to specify
initialization code when a service starts fresh, starts after a live update,
or restarts.

SYSTEM SERVICE CHANGES:
- Initialization code for system services is now enclosed in a callback SEF will
automatically call at init time. The return code of the callback will
tell RS whether the initialization completed successfully.
- Each init callback can access information passed by RS to initialize. As of
now, each system service has access to the public entries of RS's system process
table to gather all the information required to initialize. This design
eliminates many existing or potential races at boot time and provides a uniform
initialization interface to system services. The same interface will be reused
for the upcoming publish/subscribe model to handle dynamic 
registration / deregistration of system services.

VM CHANGES:
- Uniform privilege management for all system services. Every service uses the
same call mask format. For boot services, VM copies the call mask from init
data. For dynamic services, VM still receives the call mask via rs_set_priv
call that will be soon replaced by the upcoming publish/subscribe model.

RS CHANGES:
- The system process table has been reorganized and split into private entries
and public entries. Only the latter ones are exposed to system services.
- VM call masks are now entirely configured in rs/table.c
- RS has now its own slot in the system process table. Only kernel tasks and
user processes not included in the boot image are now left out from the system
process table.
- RS implements the initialization protocol for system services.
- For services in the boot image, RS blocks till initialization is complete and
panics when failure is reported back. Services are initialized in their order of
appearance in the boot image priv table and RS blocks to implements synchronous
initialization for every system service having the flag SF_SYNCH_BOOT set.
- For services started dynamically, the initialization protocol is implemented
as though it were the first ping for the service. In this case, if the
system service fails to report back (or reports failure), RS brings the service
down rather than trying to restart it.
2010-01-08 01:20:42 +00:00
David van Moolenbroek ac9ab099c8 General cleanup:
- clean up kernel section of minix/com.h somewhat
- remove ALLOCMEM and VM_ALLOCMEM calls
- remove non-safecopy and minix-vmd support from Inet
- remove SYS_VIRVCOPY and SYS_PHYSVCOPY calls
- remove obsolete segment encoding in SYS_SAFECOPY*
- remove DEVCTL call, svrctl(FSDEVUNMAP), map_driverX
- remove declarations of unimplemented svrctl requests
- remove everything related to swapping to disk
- remove floppysetup.sh
- remove traces of rescue device
- update DESCRIBE.sh with new devices
- some other small changes
2010-01-05 19:39:27 +00:00
David van Moolenbroek be992434e7 VM: make munmap(2) round length up, not down (reported by Althaf K Backer) 2010-01-05 09:40:07 +00:00
David van Moolenbroek 0dcf5b7aa8 add ptrace(2) TO_NOEXEC flag 2010-01-05 09:30:28 +00:00
David van Moolenbroek ac9a5829a2 suppress kernel/VM memory debugging information 2009-12-29 21:35:12 +00:00
David van Moolenbroek e423c86009 ptrace(2) modifications:
- add T_GETRANGE/T_SETRANGE to get/set ranges of values
- change EIO error code to EFAULT
- move common-I&D text-to-data translation to umap_local
2009-12-29 21:32:15 +00:00
David van Moolenbroek c8f8d69204 Fix MFS ftruncate crash (Bug#370, reported by Aki Goto) 2009-12-24 23:43:16 +00:00
Cristiano Giuffrida f24f987b95 Move setuid() hack where it belongs. 2009-12-23 16:26:28 +00:00
Cristiano Giuffrida 6f912993ff Share exec images in RS.
RS CHANGES:
- RS retains information on both labels and process names now. Labels for boot
processes are configured in the boot image priv table. Process names are
inherited from the in-kernel boot image table.
- When RS_REUSE is specified in do_up, RS looks for an existing slot having the
same process name as the one we are about to start. If one is found with
an in-memory copy of its executable image, the image is then shared between
the two processes, rather than copying it again. This behavior can be specified
by using 'service -r' when starting a system service from the command line.
2009-12-23 14:05:20 +00:00
Cristiano Giuffrida 1f5841c8ed Basic System Event Framework (SEF) with ping and live update.
SYSLIB CHANGES:
- SEF must be used by every system process and is thereby part of the system
library.
- The framework provides a receive() interface (sef_receive) for system
processes to automatically catch known system even messages and process them.
- SEF provides a default behavior for each type of system event, but allows
system processes to register callbacks to override the default behavior.
- Custom (local to the process) or predefined (provided by SEF) callback
implementations can be registered to SEF.
- SEF currently includes support for 2 types of system events:
  1. SEF Ping. The event occurs every time RS sends a ping to figure out
  whether a system process is still alive. The default callback implementation
  provided by SEF is to notify RS back to let it know the process is alive
  and kicking.
  2. SEF Live update. The event occurs every time RS sends a prepare to update
  message to let a system process know an update is available and to prepare
  for it. The live update support is very basic for now. SEF only deals with
  verifying if the prepare state can be supported by the process, dumping the
  state for debugging purposes, and providing an event-driven programming
  model to the process to react to state changes check-in when ready to update.
- SEF should be extended in the future to integrate support for more types of
system events. Ideally, all the cross-cutting concerns should be integrated into
SEF to avoid duplicating code and ease extensibility. Examples include:
  * PM notify messages primarily used at shutdown.
  * SYSTEM notify messages primarily used for signals.
  * CLOCK notify messages used for system alarms.
  * Debug messages. IS could still be in charge of fkey handling but would
  forward the debug message to the target process (e.g. PM, if the user
  requested debug information about PM). SEF would then catch the message and
  do nothing unless the process has registered an appropriate callback to
  deal with the event. This simplifies the programming model to print debug
  information, avoids duplicating code, and reduces the effort to print
  debug information.

SYSTEM PROCESSES CHANGES:
- Every system process registers SEF callbacks it needs to override the default
system behavior and calls sef_startup() right after being started.
- sef_startup() does almost nothing now, but will be extended in the future to
support callbacks of its own to let RS control and synchronize with every
system process at initialization time.
- Every system process calls sef_receive() now rather than receive() directly,
to let SEF handle predefined system events.

RS CHANGES:
- RS supports a basic single-component live update protocol now, as follows:
  * When an update command is issued (via "service update *"), RS notifies the
  target system process to prepare for a specific update state.
  * If the process doesn't respond back in time, the update is aborted.
  * When the process responds back, RS kills it and marks it for refreshing.
  * The process is then automatically restarted as for a buggy process and can
  start running again.
  * Live update is currently prototyped as a controlled failure.
2009-12-21 14:12:21 +00:00
Thomas Veerman 48ef79f78d Fix typo 2009-12-21 13:59:04 +00:00
David van Moolenbroek d5dee93bee Support for larger disks.
- MFS, df(1), fsck(1), badblocks(8), de(1x) now compute the
  superblock's s_firstdatazone value if the on-disk value is zero
- mkfs(1) sets s_firstdatazone in the superblock to zero if the
  on-disk field is too small to store the actual value
- more agressive mkfs(1) inode number heuristic, copied from r5261
2009-12-21 11:20:30 +00:00
Thomas Veerman 6aa43dc9e4 Fix typo and a bug causing vnode references to become too low. 2009-12-21 09:36:34 +00:00
Thomas Veerman 951c5f6b73 Add PFS (missing in previous commit) 2009-12-20 20:41:50 +00:00
Thomas Veerman 958b25be50 - Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
  the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
  functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
  the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
  - Several path lookup bugs in MFS.
  - A link can be too big for the path buffer.
  - A mountpoint can become inaccessible when the creation of a new inode
    fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
  suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
  unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
  named pipes. However, named pipes still reside on the (M)FS, as they are part
  of the file system on disk. To make this work VFS now has a concept of
  'mapped' inodes, which causes read, write, truncate and stat requests to be
  redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 20:27:14 +00:00
Cristiano Giuffrida e090013056 Drivers and servers are simply known as services.
/etc CHANGES:
- /etc/drivers.conf has been renamed to /etc/system.conf. Every entry in 
the file is now marked as "service" rather than driver.
- user "service" has been added to password file /etc/passwd.
- docs/UPDATING updated accordingly, as well as every other mention to the old
drivers.conf in the system.

RS CHANGES:
- No more distinction between servers and drivers.
- RS_START has been renamed to RS_UP and the old legacy RS_UP and RS_UP_COPY
dropped.
- RS asks PCI to set / remove ACL entries only for services whose ACL properties
have been set. This change eliminates unnecessary warnings.
- Temporarily minimize the risk of potential races at boot time or when starting
a new service. Upcoming changes will eliminate races completely.
- General cleanup.
2009-12-17 01:53:26 +00:00
Cristiano Giuffrida f4574783dc Rewrite of boot process
KERNEL CHANGES:
- The kernel only knows about privileges of kernel tasks and the root system
process (now RS).
- Kernel tasks and the root system process are the only processes that are made
schedulable by the kernel at startup. All the other processes in the boot image
don't get their privileges set at startup and are inhibited from running by the
RTS_NO_PRIV flag.
- Removed the assumption on the ordering of processes in the boot image table.
System processes can now appear in any order in the boot image table.
- Privilege ids can now be assigned both statically or dynamically. The kernel
assigns static privilege ids to kernel tasks and the root system process. Each
id is directly derived from the process number.
- User processes now all share the static privilege id of the root user
process (now INIT).
- sys_privctl split: we have more calls now to let RS set privileges for system
processes. SYS_PRIV_ALLOW / SYS_PRIV_DISALLOW are only used to flip the
RTS_NO_PRIV flag and allow / disallow a process from running. SYS_PRIV_SET_SYS /
SYS_PRIV_SET_USER are used to set privileges for a system / user process.
- boot image table flags split: PROC_FULLVM is the only flag that has been
moved out of the privilege flags and is still maintained in the boot image
table. All the other privilege flags are out of the kernel now.

RS CHANGES:
- RS is the only user-space process who gets to run right after in-kernel
startup.
- RS uses the boot image table from the kernel and three additional boot image
info table (priv table, sys table, dev table) to complete the initialization
of the system.
- RS checks that the entries in the priv table match the entries in the boot
image table to make sure that every process in the boot image gets schedulable.
- RS only uses static privilege ids to set privileges for system services in
the boot image.
- RS includes basic memory management support to allocate the boot image buffer
dynamically during initialization. The buffer shall contain the executable
image of all the system services we would like to restart after a crash.
- First step towards decoupling between resource provisioning and resource
requirements in RS: RS must know what resources it needs to restart a process
and what resources it has currently available. This is useful to tradeoff
reliability and resource consumption. When required resources are missing, the
process cannot be restarted. In that case, in the future, a system flag will
tell RS what to do. For example, if CORE_PROC is set, RS should trigger a
system-wide panic because the system can no longer function correctly without
a core system process.

PM CHANGES:
- The process tree built at initialization time is changed to have INIT as root
with pid 0, RS child of INIT and all the system services children of RS. This
is required to make RS in control of all the system services.
- PM no longer registers labels for system services in the boot image. This is
now part of RS's initialization process.
2009-12-11 00:08:19 +00:00
Ben Gras 8d800b3df7 Make VM fix up memory for kernel that crosses region boundaries
too.

Add a test to make this happen (triggers a vm panic before this commit).
2009-12-08 13:35:52 +00:00
Ben Gras f0db9bb328 - map in as much memory as is necessary in 4MB chunks to
let boot processes run with segments
 - allow segment-only processes to fork() by copying them
   and giving them an identity page table
2009-12-07 12:10:44 +00:00
Tomas Hruby ec1fec6c3f A debug print with no meaning removed from VM. 2009-12-03 10:53:56 +00:00
David van Moolenbroek fce9fd4b4e Add 'getidle' CPU utilization measurement infrastructure 2009-12-02 11:52:26 +00:00
David van Moolenbroek be2087ecf9 Filter driver by Wu Bingzheng et al 2009-12-02 10:08:58 +00:00
David van Moolenbroek f197bcb435 Allow servers to run with fewer privileges:
- allow non-root processes to get their own endpoint
- make alloc_contig() call sys_umap() only when requested
2009-12-02 10:06:58 +00:00
David van Moolenbroek 4924d1a9b5 RS changes:
- add new "control" config directive, to let drivers restart drivers
  (by Jorrit Herder)
- fix bug causing system processes to be started twice sometimes
2009-12-02 09:54:50 +00:00
David van Moolenbroek ad259e92af Alternative VirtualBox/Lance driver workaround 2009-11-28 13:28:55 +00:00
David van Moolenbroek fe7b2f1652 RS fixes:
- fix resource leak (PCI ACLs) when child fails right after exec
- fix resource leak (memory) when child exec fails at all
- fix race condition setting VM call privileges for new child
- make dev_execve() return a proper result, and check this result
- remove RS_EXECFAILED, as it should behave exactly like RS_EXITING
- add more clarifying comments about starting servers
2009-11-28 13:23:45 +00:00
David van Moolenbroek 45123f83d3 PM: remove 'boottime' global variable 2009-11-28 13:22:01 +00:00
David van Moolenbroek c6cce1823d Portability: POSIXize some of inet's error codes 2009-11-28 13:18:33 +00:00
David van Moolenbroek bdb85248d4 VM: don't send arbitrary status values to kernel 2009-11-22 13:06:18 +00:00
David van Moolenbroek 2dc9e354f7 ugly double blank line, my fault 2009-11-16 18:22:28 +00:00
Tomas Hruby 37a7e1b76b Use of isemptyp() macro instead of testing RTS_SLOT_FREE flag
- some code used to test if only this flag is set, some if also this flag is
  set. This change unifies the test
2009-11-12 08:35:26 +00:00
Tomas Hruby f98bea8f67 The rest of the r5641 commit 2009-11-11 17:02:45 +00:00
Tomas Hruby a972f4bacc All macros defining rts flags are prefixed with RTS_
- macros used with RTS_SET group of macros to define struct proc p_rts_flags are
  now prefixed with RTS_ to make things clear
2009-11-10 09:11:13 +00:00
Tomas Hruby ae75f9d4e5 Removal of the executable flag from files that cannot be executed
- 755 -> 644
2009-11-09 10:26:00 +00:00
David van Moolenbroek a07f8d7646 Fix ptrace bug when reattaching to a detached process 2009-11-09 08:12:25 +00:00
Tomas Hruby d2c10fb85e inodes - using types with known size
- fixes a problem in inodes truct definitions. The original definitions use
  posix types. These types don't have well defined size. Therefore when
  compiling mkfs on a different system natively the inodes sizes do not match.
  This patch replaces the posix types with interger types of the same size and
  signedness as the original types in use.
2009-11-06 08:55:07 +00:00
Ben Gras 7e73260cf5 - enable remembering of device memory ranges set by PCI and
told to kernel
  - makes VM ask the kernel if a certain process is allowed
    to map in a range of physical memory (VM rounds it to page
    boundaries afterwards - but it's impossible to map anything
    smaller otherwise so I assume this is safe, i.e. there won't
    be anything else in that page; certainly no regular memory)
  - VM permission check cleanup (no more hardcoded calls, less
    hardcoded logic, more readable main loop), a loose end left
    by GQ
  - remove do_copy warning, as the ipc server triggers this but
    it's no more harmful than the special cases already excluded
    explicitly (VFS, PM, etc).
2009-11-03 11:12:23 +00:00
David van Moolenbroek 56d485c1d6 Various small IS, TTY, isofs fixes
IS:
- do not use p_getfrom_e for a process that is sending
- register with TTY only function keys that are used
- various header and formatting fixes
- proper shutdown code

TTY:
- restore proper Ctrl+F1 dump contents

isofs:
- don't even try to call sys_exit()
2009-11-02 23:04:52 +00:00
David van Moolenbroek f89388c241 Kernel, servers: remove unused proto.h definitions 2009-10-31 14:11:50 +00:00
David van Moolenbroek 4c263d6002 PM: clean up endpoint info API/ABI 2009-10-31 14:09:28 +00:00
David van Moolenbroek 6c4197f77e PM, VFS: remove unused param.h definitions 2009-10-29 13:29:04 +00:00
David van Moolenbroek 66998b594f PM: remove unused core_name variable 2009-10-29 12:07:53 +00:00
David van Moolenbroek 20ca68f5c9 DS: do not panic when sending reply fails 2009-10-27 17:06:45 +00:00
David van Moolenbroek bd30f2a988 Ground work for larger file systems, and miscellaneous fixes:
- MFS and mkfs(1) now perform extra sanity checks
- fsck(1) can now deal with inode tables extending beyond the file
  system's first 4GB
- badblocks(8) no longer writes out the superblock for no reason
- mkfs(1) no longer crashes when given no parameters
- more(1) no longer crashes when standard output is redirected
2009-10-26 13:35:39 +00:00
Erik van der Kouwe 204f9d496a Increase limits on PCI devices to have space for the new RTL8139 ACLSs 2009-10-21 09:14:58 +00:00
Erik van der Kouwe 44a4c8c0d2 Add more identifiers to drivers.conf for orinoco and rtl8137.
Increase RSS_NR_PCI_ID and remove dumplicate reference
to /etc/drivers.conf; each such reference uses _PATH_DRIVERS_CONF
from <minix/paths.h> now.
2009-10-14 07:20:13 +00:00
Erik van der Kouwe cb6dbfca2c Add lspci command and SI_PCI_INFO getsysinfo call 2009-10-09 10:48:46 +00:00
David van Moolenbroek 045f1cdb10 inet: fix TCP connection corruption bug (causing test40 to fail sometimes) 2009-10-06 20:32:58 +00:00
Ben Gras dbbc0c23d5 fix compiler warning by including for prototype. 2009-10-05 16:45:03 +00:00
Ben Gras c373473f24 add prototype for wait_for() to fix compiler warning. 2009-10-05 16:43:02 +00:00
Tomas Hruby 982f4a0cbb isofs links with libsysutil which does not exist anymore 2009-10-02 12:07:46 +00:00
David van Moolenbroek e913d66749 INET: fix panic when network drivers are started late (Bug#309, reported by Niek Linnenbank) 2009-10-01 21:24:12 +00:00
David van Moolenbroek 8f9a90192f RS: disable harmless warning 2009-10-01 19:21:57 +00:00
Thomas Veerman cb6f6a94f7 Fixes to ISOFS 2009-10-01 14:34:17 +00:00
Thomas Veerman 471ad9384f Initial import of ISOFS by Jacopo Urbani 2009-10-01 14:00:27 +00:00
David van Moolenbroek 49808dcf77 PM delay call infrastructure improvements
- allow PM to tell sys_runctl() whether to use delay call feature
- only use this feature in PM for delivering signals - not for exits
- do better error checking in PM on sys_runctl() calls
- rename SIGKREADY to SIGNDELAY
2009-10-01 10:36:09 +00:00
David van Moolenbroek b423d7b477 Merge of David's ptrace branch. Summary:
o Support for ptrace T_ATTACH/T_DETACH and T_SYSCALL
o PM signal handling logic should now work properly, even with debuggers
  being present
o Asynchronous PM/VFS protocol, full IPC support for senda(), and
  AMF_NOREPLY senda() flag

DETAILS

Process stop and delay call handling of PM:
o Added sys_runctl() kernel call with sys_stop() and sys_resume()
  aliases, for PM to stop and resume a process
o Added exception for sending/syscall-traced processes to sys_runctl(),
  and matching SIGKREADY pseudo-signal to PM
o Fixed PM signal logic to deal with requests from a process after
  stopping it (so-called "delay calls"), using the SIGKREADY facility
o Fixed various PM panics due to race conditions with delay calls versus
  VFS calls
o Removed special PRIO_STOP priority value
o Added SYS_LOCK RTS kernel flag, to stop an individual process from
  running while modifying its process structure

Signal and debugger handling in PM:
o Fixed debugger signals being dropped if a second signal arrives when
  the debugger has not retrieved the first one
o Fixed debugger signals being sent to the debugger more than once
o Fixed debugger signals unpausing process in VFS; removed PM_UNPAUSE_TR
  protocol message
o Detached debugger signals from general signal logic and from being
  blocked on VFS calls, meaning that even VFS can now be traced
o Fixed debugger being unable to receive more than one pending signal in
  one process stop
o Fixed signal delivery being delayed needlessly when multiple signals
  are pending
o Fixed wait test for tracer, which was returning for children that were
  not waited for
o Removed second parallel pending call from PM to VFS for any process
o Fixed process becoming runnable between exec() and debugger trap
o Added support for notifying the debugger before the parent when a
  debugged child exits
o Fixed debugger death causing child to remain stopped forever
o Fixed consistently incorrect use of _NSIG

Extensions to ptrace():
o Added T_ATTACH and T_DETACH ptrace request, to attach and detach a
  debugger to and from a process
o Added T_SYSCALL ptrace request, to trace system calls
o Added T_SETOPT ptrace request, to set trace options
o Added TO_TRACEFORK trace option, to attach automatically to children
  of a traced process
o Added TO_ALTEXEC trace option, to send SIGSTOP instead of SIGTRAP upon
  a successful exec() of the tracee
o Extended T_GETUSER ptrace support to allow retrieving a process's priv
  structure
o Removed T_STOP ptrace request again, as it does not help implementing
  debuggers properly
o Added MINIX3-specific ptrace test (test42)
o Added proper manual page for ptrace(2)

Asynchronous PM/VFS interface:
o Fixed asynchronous messages not being checked when receive() is called
  with an endpoint other than ANY
o Added AMF_NOREPLY senda() flag, preventing such messages from
  satisfying the receive part of a sendrec()
o Added asynsend3() that takes optional flags; asynsend() is now a
  #define passing in 0 as third parameter
o Made PM/VFS protocol asynchronous; reintroduced tell_fs()
o Made PM_BASE request/reply number range unique
o Hacked in a horrible temporary workaround into RS to deal with newly
  revealed RS-PM-VFS race condition triangle until VFS is asynchronous

System signal handling:
o Fixed shutdown logic of device drivers; removed old SIGKSTOP signal
o Removed is-superuser check from PM's do_procstat() (aka getsigset())
o Added sigset macros to allow system processes to deal with the full
  signal set, rather than just the POSIX subset

Miscellaneous PM fixes:
o Split do_getset into do_get and do_set, merging common code and making
  structure clearer
o Fixed setpriority() being able to put to sleep processes using an
  invalid parameter, or revive zombie processes
o Made find_proc() global; removed obsolete proc_from_pid()
o Cleanup here and there

Also included:
o Fixed false-positive boot order kernel warning
o Removed last traces of old NOTIFY_FROM code

THINGS OF POSSIBLE INTEREST

o It should now be possible to run PM at any priority, even lower than
  user processes
o No assumptions are made about communication speed between PM and VFS,
  although communication must be FIFO
o A debugger will now receive incoming debuggee signals at kill time
  only; the process may not yet be fully stopped
o A first step has been made towards making the SYSTEM task preemptible
2009-09-30 09:57:22 +00:00
Ben Gras 8d9aa1fe4f throw out exec debugging message. 2009-09-30 08:36:13 +00:00
Tomas Hruby 4dad30937b Removed macros that depend on NOTIFY_FROM from servers and drivers. They
determine the information defined by these macros from the m_source field of the
notify message.
2009-09-29 18:47:56 +00:00
Ben Gras 0e43db1375 disable address space randomisation feature in normal mode. 2009-09-29 12:10:30 +00:00
Ben Gras 856ec906bd assert overammbitious. 2009-09-28 01:23:11 +00:00
Ben Gras 7a45f80bd5 threw out sanity checks before pagetable rewrites, triggering false
page table inconsistencies.

fix handle_memory logic. again.
2009-09-27 12:44:36 +00:00
Ben Gras 67602ce85e field for sanity check feature. 2009-09-27 12:37:37 +00:00
Ben Gras 5715637aa2 new prototypes. 2009-09-27 12:37:16 +00:00
Ben Gras 5cf59f9225 verbose printing and sanity checking functions. 2009-09-27 12:36:48 +00:00
Ben Gras a02d9aae0a re-enable munmap(). 2009-09-25 19:01:27 +00:00
Ben Gras e114ae8195 unnecessarily verbose message. 2009-09-25 17:59:38 +00:00
Ben Gras aa1c90fdd7 correct logic error in region.c. 2009-09-25 17:39:39 +00:00
Tomas Hruby 97fe6a4ba5 Broken pipes fix
- fix for the broken partial pipes r/w operations
2009-09-24 16:03:25 +00:00
Ben Gras f236d1dd9c throw out the debugging stuff again. 2009-09-23 16:26:05 +00:00
Ben Gras af77f4e964 debug output in SANITYCHECKS mode 2009-09-23 16:02:27 +00:00
Ben Gras f87a91ce95 missing level-- in out-of-memory case. 2009-09-23 15:19:36 +00:00
Ben Gras 74616a057b temporarily disable munmap() to mask memory problem. 2009-09-23 13:34:04 +00:00
Ben Gras 4c11d7e6f5 - simplify findhole() for use for 1 page only
- do WMF_FREE
 - added WMF_VERIFY to check page table contents
 - randomize address space usage in vm self
2009-09-23 13:33:01 +00:00
Tomas Hruby f53377ed67 Removed the broken PROC_EVENT and SYN_ALARM from VFS 2009-09-22 22:11:20 +00:00
Tomas Hruby 8590ac260d Removed dependency of vfs on NR_TASKS macro
- all macros in consts.h that depend on NR_TASKS replaced by a FP_BLOCKED_ON_*

- fp_suspended removed and replaced by fp_blocked_on. Testing whether a process
  is supended is qeual to testing whether fp_blocked_on is FP_BLOCKED_ON_NONE or
  not

- fp_task is valid only if fp_blocked_on == FP_BLOCKED_ON_OTHER

- no need of special values that do not colide with valid and special endpoints
  since they are not used as endpoints anymore

- suspend only takes FP_BLOCKED_ON_* values not endpoints anymore

- suspend(task) replaced by wait_for(task) which sets fp_task so we remember who
  are we waiting for and suspend sets fp_blocked_on to FP_BLOCKED_ON_OTHER to
  signal that we are waiting for some other process

- some functions should take endpoint_t instead of int, fixed
2009-09-22 21:48:26 +00:00
Ben Gras 0b713b0de5 unmap VR_DIRECT mappings too (fix for X) 2009-09-22 11:51:17 +00:00
Ben Gras 76a02db5e7 unused, thanks david 2009-09-21 21:00:36 +00:00
Ben Gras 32fa22fc2d RS_LOOKUP feature for libc functions that want to access servers.
let ipc talk to all USER processes and vice versa.

pm sig wrapper notify has to be called from two files.

actually install include files.
2009-09-21 15:25:15 +00:00
Ben Gras 75d3db4911 new ipc server that implements shared memory and semaphores.
this server, tests, vm support, library stubs and other contributions
are the work of Guanqun Lu, a 2009 GSOC student.
2009-09-21 14:53:13 +00:00
Ben Gras 32fbbd370c - pages that points to page directory values of all processes,
shared with the kernel, mapped into kernel address space; 
   kernel is notified of its location. kernel segment size is
   increased to make it fit.
 - map in kernel and other processes that don't have their
   own page table using single 4MB (global) mapping.
 - new sanity check facility: objects that are allocated with
   the slab allocator are, when running with sanity checking on,
   marked readonly until they are explicitly unlocked using the USE()
   macro.
 - another sanity check facility: collect all uses of memory and
   see if they don't overlap with (a) eachother and (b) free memory
 - own munmap() and munmap_text() functions.
 - exec() recovers from out-of-memory conditions properly now; this
   solves some weird exec() behaviour
 - chew off memory from the same side of the chunk as where we
   start scanning, solving some memory fragmentation issues
 - use avl trees for freelist and phys_ranges in regions
 - implement most useful part of munmap()
 - remap() stuff is GQ's for shared memory
2009-09-21 14:49:49 +00:00
Ben Gras f5459e38db - some exec debugging prints when errors happen
- lookup mounted_on check to avoid NULL dereference
 - some errors in exec() shouldn't be fatal
2009-09-21 14:49:26 +00:00
Ben Gras e402927576 support for vm priv system.
fix NULL envp ptr.
2009-09-21 14:49:04 +00:00
Ben Gras 5f497bcf22 - Introduce some macros for field names, so that endpt, pendpt,
addr and taddr don't have to be defined any more, so that <sys/mman.h>
    can be included for proper prototypes of munmap() and friends.
  - rename our GETPID to MINIX_GETPID to avoid a name conflict with
    other sources
  - PM needs its own munmap() and munmap_text() to avoid sending messages
    to VM at the startup phase. It *does* want to do that, but only
    after initialising. So they're called again with unmap_ok set to 1
    later.
  - getnuid(), getngid() implementation
2009-09-21 14:48:19 +00:00
Ben Gras a0d8cc0765 - No maximum block size any more.
- If allocation of a new buffer fails, use an already-allocated
   unused buffer if available (low memory conditions)
 - Allocate buffers dynamically, so memory isn't wasted on wrong-sized
   buffers.
 - No more _MAX_BLOCK_SIZE.
2009-09-21 14:47:51 +00:00
Ben Gras 08d291da53 no more scheduling queue dumps (kernel will print this over serial);
initial vm stats retrieve support
2009-09-21 14:47:24 +00:00
Ben Gras 90be3a051f clever hack to avoid starting from 0 disabled because
when own 0-pages are mapped out, this doesn't work and
isn't necessary.
2009-09-21 14:46:42 +00:00
Erik van der Kouwe 3615d93383 Handle SIGSTOP more consistently and according to POSIX rules; it can no longer be ignored 2009-09-13 12:24:23 +00:00
David van Moolenbroek ba83b7663d PM: some tiny fixes 2009-09-12 18:36:07 +00:00
David van Moolenbroek 18ae423990 it's/its 2009-09-06 17:13:08 +00:00
David van Moolenbroek 979bcfc195 - sys_privctl: don't mix message types
- sys_privctl: remove CTL_MM_PRIV (third parameter)
- remove obsolete sys_svrctl.c library file
2009-09-06 12:37:13 +00:00
David van Moolenbroek 42f0bf7dda VFS: fetch_name() buffer underflow (reported by John Peace, bug #305) 2009-08-29 08:22:50 +00:00
Tomas Hruby f3e0c5c381 VFS quits gracefully if mount fails and mounted_on remains uninitialized 2009-08-18 13:30:05 +00:00
Thomas Veerman b47483433c Added a hack to start binaries from the boot image only. In particular, setting
bin_img=1 in the boot monitor will make sure that during the boot procedure the
mfs binary that is part of the boot image is the only binary that is used to
mount partitions. This is useful when for some reason the mfs binary on disk 
malfunctions, rendering Minix unable to boot. By setting bin_img=1, the binary
on disk is ignored and the binary in the boot image is used instead.

- 'service' now accepts an additional flag -r. -r implies -c. -r instructs RS
  to first look in memory if the binary has already been copied to memory and
  execute that version, instead of loading the binary from disk. For example,
  the first time a MFS is being started it is copied (-c) to memory and
  executed from there. The second time MFS is being started this way, RS will
  look in memory for a previously copied MFS binary and reuse it if it exists.
- The mount and newroot commands now accept an additional flag -i, which
  instructs them to set the MS_REUSE flag in the mount flags.
- The mount system call now supports the MS_REUSE flag and invokes 'service'
  with the -r flag when MS_REUSE is set.
- /etc/rc and the rc script that's included in the boot image check for the
  existence of the bin_img flag in the boot monitor, and invoke mount and 
  newroot with the -i flag accordingly.
2009-08-18 11:36:01 +00:00
David van Moolenbroek 769a0cdb35 PM: make SIGBUS, but not SIGUSR1 or SIGUSR2, cause a core dump 2009-08-15 23:23:24 +00:00
David van Moolenbroek 323f0abdd6 Support for setitimer(ITIMER_VIRTUAL/ITIMER_PROF). New test (41) for setitimer. 2009-08-15 21:37:26 +00:00
David van Moolenbroek d82e260a90 Support for setitimer(ITIMER_REAL). 2009-08-15 16:09:32 +00:00
Tomas Hruby 09a47e6a40 vm_assert macros fix up 2009-08-11 07:53:32 +00:00
David van Moolenbroek 5a370afc8e MFS put_inode issues (reported by Maurizio Lombardi) 2009-07-22 08:54:28 +00:00
Thomas Veerman ce916bcb91 Fixed a minor select bug:
- When one does a select on a file descriptor that is meaningless for that particular file type, select shall indicate that the file descriptor is ready for that particular operation and that the file descriptor has no exceptional condition pending.
2009-07-14 09:39:05 +00:00
David van Moolenbroek b21beea985 IS: fix up PM flags field somewhat 2009-07-12 15:30:59 +00:00
David van Moolenbroek f80aaae86a MFS: remove some redundant code (reported by Maurizio Lombardi) 2009-07-12 13:57:34 +00:00
David van Moolenbroek 013241a006 RS: the plural of 'child' is 'children' 2009-07-11 17:59:05 +00:00
David van Moolenbroek 9e075d8623 PM cleanup: remove unused fields from mproc structure 2009-07-11 17:15:33 +00:00
David van Moolenbroek 1a9e07b0e5 PM: fix ptrace(T_EXIT) 'exit_proc: not idle' race condition. 2009-07-11 13:22:56 +00:00
David van Moolenbroek 14f3a0e018 PM: add clarifying comment about exiting system processes early (thanks Philip) 2009-07-11 11:19:39 +00:00
David van Moolenbroek 9808816c14 MFS fixes:
- Don't dereference NULL dir inode in advance_* (reported by Maurizio Lombardi)
- Fix potential inode reference leak in fs_slink_*
2009-07-11 10:36:57 +00:00
David van Moolenbroek 73c5bbf1a3 PM: add EXITING process flag as stopgap between starting coredump and setting ZOMBIE flag 2009-07-09 22:33:56 +00:00
David van Moolenbroek 693a6652ca PM cleanup: remove obsolete HAS_DMA flag 2009-07-08 20:08:46 +00:00
David van Moolenbroek 67d986f882 PM cleanup: merge exit and coredump paths 2009-07-08 17:16:53 +00:00
David van Moolenbroek 12451e6b06 Miscellaneous PM fixes:
o Don't call vm_willexit() more than once upon normal process exit
o Correct two cases of indenting of the no-discussion-possible kind
o Perform slightly stricter ptrace(2) checks:
  - process calling ptrace must be target process's parent
  - process must call wait/waitpid before using ptrace on stopped child
  - no ptrace on zombies
o Allow user processes to use ptrace(T_STOP) to stop an active child
2009-07-05 22:48:18 +00:00
David van Moolenbroek b8b8f537bd IPC privileges fixes
Kernel:
o Remove s_ipc_sendrec, instead using s_ipc_to for all send primitives
o Centralize s_ipc_to bit manipulation,
  - disallowing assignment of bits pointing to unused priv structs;
  - preventing send-to-self by not setting bit for own priv struct;
  - preserving send mask matrix symmetry in all cases
o Add IPC send mask checks to SENDA, which were missing entirely somehow
o Slightly improve IPC stats accounting for SENDA
o Remove SYSTEM from user processes' send mask
o Half-fix the dependency between boot image order and process numbers,
  - correcting the table order of the boot processes;
  - documenting the order requirement needed for proper send masks;
  - warning at boot time if the order is violated

RS:
o Add support in /etc/drivers.conf for servers that talk to user processes,
  - disallowing IPC to user processes if no "ipc" field is present
  - adding a special "USER" label to explicitly allow IPC to user processes
o Always apply IPC masks when specified; remove -i flag from service(8)
o Use kernel send mask symmetry to delay adding IPC permissions for labels
  that do not exist yet, adding them to that label's process upon creation
o Add VM to ipc permissions list for rtl8139 and fxp in drivers.conf

Left to future fixes:
o Removal of the table order vs process numbers dependency altogether,
  possibly using per-process send list structures as used for SYSTEM calls
o Proper assignment of send masks to boot processes;
  some of the assigned (~0) masks are much wider than necessary
o Proper assignment of IPC send masks for many more servers in drivers.conf
o Removal of the debugging warning about the now legitimate case where RS's
  add_forward_ipc cannot find the IPC destination's label yet
2009-07-02 16:25:31 +00:00
David van Moolenbroek 9797d17d54 move symlink type check for readlink() into VFS, and return the right POSIX error 2009-05-20 09:46:06 +00:00
David van Moolenbroek 50b77e3529 VFS consistency: use I_PIPE/NO_PIPE when checking v_pipe 2009-05-19 14:34:44 +00:00
Ben Gras f86da99e67 map in kernel in 4MB, global-bit-set 'pages' if hardware
supports it. helps performance.

broken use of region data structure for kernel mapping to be fixed.
2009-05-18 15:34:42 +00:00
David van Moolenbroek f76d75a5ec Various VFS and MFS fixes to improve correctness, consistency and
POSIX compliance.

VFS changes:
* truncate() on a file system mounted read-only no longer panics MFS.
* ftruncate() and fcntl(F_FREESP) now check for write permission on
  the file descriptor instead of the file, write().
* utime(), chown() and fchown() now check for file system read-only
  status.

MFS changes:
* link() and rename() no longer return the internal EENTERMOUNT and
  ELEAVEMOUNT errors to the application as part of a check on the
  source path.
* rename() now treats EENTERMOUNT from the destination path check as
  an error, preventing file system corruption from renaming a normal
  directory to an existing mountpoint directory.
* mountpoints (mounted-on dirs) are hidden better during lookups:
  - if a lookup starts from a mountpoint, the first component has to
    be ".." (anything else being a VFS-FS protocol violation).
  - in that case, the permissions of the mountpoint are not checked.
  - in all other cases, visiting a mountpoint always results in
    EENTERMOUNT.
* a lookup on ".." from a mount root or chroot(2) root no longer
  succeeds if the caller does not have search permission on that
  directory.
* POSIX: getdents() now updates directory access times.
* POSIX: readlink() now returns partial results instead of ERANGE.

Miscellaneous changes:
* semaphore file handling bug (leading to hangs) fixed in test 32.

The VFS changes should now put the burden of checking for read-only
status of file systems entirely on VFS, and limit the access
permission checks that file systems have to perform, to checking
search permission on directories during lookups. From this point on,
any deviation from that spceification should be considered a bug.
Note that for legacy reasons, the root partition is assumed to be
mounted read-write.
2009-05-18 11:27:12 +00:00
Ben Gras bdab3c4cfb Library call for cpu features; make kernel and vm use this to query cpu
features (specifically: 4MB pages and TLB global bit).  Only enable
these features in CR4 if available. 4MB pages to be used in the near
future.
2009-05-15 17:07:36 +00:00
David van Moolenbroek 3affa4c796 'service' null pointer dereference fix 2009-05-12 16:52:00 +00:00
Ben Gras 909c1bb8a7 don't bother with unmapping physical memory in non-sanitycheck mode. 2009-05-12 11:51:53 +00:00
Ben Gras 581e68433a basic sparepage optimisation
some simplification of linear/virtual address translation
(less hardcoding and more use of arch_*2* functions)
2009-05-12 11:38:29 +00:00
Ben Gras f9e81cb57b remove bogus arch_map2vir calls 2009-05-12 11:36:15 +00:00
Ben Gras 6fad23f500 don't call this function with a bogus addr (done by region.c print code) 2009-05-12 11:35:49 +00:00
Ben Gras d2caeb6146 start all processes, including VM, in VM_PROCSTART in linear address space,
to make space for kernel to be able to map in things below there.
2009-05-11 19:11:37 +00:00
Ben Gras ade4c03b73 Don't build arch objs more than once. 2009-05-11 19:05:45 +00:00
Ben Gras 7c88767f75 remove debug msg 2009-05-11 11:57:20 +00:00
David van Moolenbroek 0ac1aaccca Limited support for nested FS->VFS requests during VFS->FS call.
- Changed VFS-FS protocol to only store OK or negative error code in
  m_type field of reply messages.
- Changed VFS to treat nonzero positive replies from FS as requests.
- Added backwards compatibility to VFS and MFS.
No protection of global data structures is provided in VFS, so many
VFS calls cannot be made safely by FS servers during many FS calls.
Use with caution (or, preferably, not at all).
2009-05-11 10:02:28 +00:00
David van Moolenbroek e08b38a5c4 regression fix: vfs lookup passes incorrect chroot information after crossing mountpoints 2009-05-09 17:53:22 +00:00
David van Moolenbroek 293be6b80b quick cleanup of old mfs cruft from vfs 2009-05-08 14:12:41 +00:00
Ben Gras dc1238b7b9 make unpause() decrease susp_count, as it shouldn't be decreased
if the process was REVIVING. (susp_count doesn't count those
 processes.) this together with dev_io SELECT suspend side effect
 for asynch. character devices solves the hanging pipe bug. or
 at last vastly improves it.

 added sanity checks, turned off by default.

 made the {NOT_,}{SUSPENDING,REVIVING} constants weirder to
 help sanity checking.
2009-05-08 13:56:41 +00:00
David van Moolenbroek 113b1ec5f3 remove unused global variable from vfs 2009-05-08 13:54:01 +00:00
Ben Gras ece26e2731 don't suspend the process as a side-effect if
device returns SUSPEND if it's select; select already
does this.
2009-05-08 13:50:29 +00:00
David van Moolenbroek 2a48c4ad48 Reenable RS table dump from IS (Shift+F6) 2009-05-08 12:38:14 +00:00
Ben Gras a38287067a disable scary looking debug messages. 2009-05-07 09:58:16 +00:00
Ben Gras 746e138036 turn off scary looking debug messages. 2009-05-07 09:57:43 +00:00
Ben Gras 8b72765e39 ignore errors of pipe read (can happen with shutdown now,
now that all fd's are closed neatly in vfs), change messaging
in unexpected restarts
2009-05-06 15:38:32 +00:00
Ben Gras fd7ef243e4 cleanup of vfs shutdown logic; makes clean unmounts easier (but
needs checking if fp_wd or fp_rd is NULL before use)
2009-04-29 16:59:18 +00:00
Ben Gras b7e23b70e8 - delete unused .h files
- slight code cleanup
 - neater exit procedure: exit when unmount
   message received and kill signal (from RS 'down' or
   reboot/shutdown) received (speed up unmount, but don't
   confuse VFS by exiting before/during unmount msg)
2009-04-27 16:13:51 +00:00
Ben Gras a12113e476 process restarts are pretty rare/serious. 2009-04-27 14:07:47 +00:00
Ben Gras 60e7602aad When we receive a PROC_EVENT message from PM, exit nicely; avoids
annoying graceful RS timeout on unmount.
2009-04-27 12:02:31 +00:00
Ben Gras ef8a741301 set global flag for kernel pages, so tlb entries for kernel aren't thrown
away on cr3 reload. minor optimization.
2009-04-23 15:11:16 +00:00
Arun Thomas e9e1ae1cfc Move queue.h to include/sys so that it can be used elsewhere. Pull in
FreeBSD's r179210 queue.h.
2009-04-22 20:02:39 +00:00
Arun Thomas 3b37103fa3 Make the rtl8139 and orinoco drivers handle the system shutdown case
like other drivers. Also, some minor cleanups.
2009-04-22 12:42:37 +00:00
Ben Gras 2dd02cc560 mark pages whose refcount were >1 and drop to 1 and are
read/write writable in the pagetable right away instead of waiting for
a pagefault. minor optimization.

some a sanity check of SLAB-allocated pointers.

vm gets its own _exit and __exit like PM, so the stock (library) panic works.
2009-04-22 12:39:29 +00:00
Ben Gras e0f3a5acf1 - enable ipc warnings by default
- ipc checking code in kernel didn't properly catch the
   sendrec() to self case; added special case check
 - triggered by PM using stock panic() - needs its own _exit()

reported by Joren l'Ami.
2009-04-17 13:46:37 +00:00
Ben Gras e5717f7aef clarify not found error message a bit. 2009-04-14 14:16:24 +00:00
Ben Gras 51596bc608 print who the message is from. 2009-04-02 11:56:50 +00:00
Ben Gras 73ee8b8b99 don't make susp_count negative. 2009-04-02 11:44:26 +00:00
Ben Gras dc9a1bc30c increment nph when printing physical regions; suggested by Guanqun Lu 2009-03-31 14:26:24 +00:00
Ben Gras 3bb80322d9 suppress more mostly-harmless messages. 2009-03-26 16:11:27 +00:00
Ben Gras 2d1c884e35 suppress these noisy, alarming messages. 2009-03-26 15:56:08 +00:00
Ben Gras 8af5f877bc 2009-03-04 17:44:34 +00:00
Ben Gras 3f6e061948 fix error check 2009-03-04 17:38:27 +00:00
Ben Gras 733d6c1ef6 help debugging cause of these sometimes odd calls. 2009-02-17 12:09:59 +00:00
Ben Gras 570b9cd753 Checking wrong inode pointer for refcount in mount (!) 2009-02-17 09:50:02 +00:00
Ben Gras 59e972f074 let drivers allocate memory at 64k physical boundary. 2009-02-12 12:26:08 +00:00
Ben Gras b696823379 stingy stack. 2009-02-06 16:29:00 +00:00
Ben Gras c628f24bc2 moved stacktrace to sysctl, as vmctl is very privileged so can't
be used outside VM. IS code cleanup. added stacktrace feature to IS.
2009-01-27 12:54:33 +00:00
Ben Gras 3cc092ff06 . new kernel call sysctl for generic unprivileged system operations;
now used for printing diagnostic messages through the kernel message
   buffer. this lets processes print diagnostics without sending messages
   to tty and log directly, simplifying the message protocol a lot and
   reducing difficulties with deadlocks and other situations in which
   diagnostics are blackholed (e.g. grants don't work). this makes
   DIAGNOSTICS(_S), ASYN_DIAGNOSTICS and DIAG_REPL obsolete, although tty
   and log still accept the codes for 'old' binaries. This also simplifies
   diagnostics in several servers and drivers - only tty needs its own
   kputc() now.
 . simplifications in vfs, and some effort to get the vnode references
   right (consistent) even during shutdown. m_mounted_on is now NULL
   for root filesystems (!) (the original and new root), a less awkward
   special case than 'm_mounted_on == m_root_node'. root now has exactly
   one reference, to root, if no files are open, just like all other
   filesystems. m_driver_e is unused.
2009-01-26 17:43:59 +00:00
Ben Gras 4984a86f32 don't hang on disappearing filesystem. 2009-01-26 13:02:41 +00:00
Ben Gras 539192f4c3 must be unsigned for base+limit check to to work 2009-01-22 13:05:20 +00:00
Ben Gras 86e7e4828e sanity check function 2009-01-20 13:43:18 +00:00
Ben Gras 45ec30f6af mostly harmless sanity checks. 2009-01-20 13:43:00 +00:00
Ben Gras 4f08002c2c RS needs a bit more memory 2009-01-14 08:55:48 +00:00
Ben Gras 5cbcc11ed3 compile fix for new lock timings 2009-01-12 22:14:43 +00:00
Ben Gras 628ed99101 CPROFILE wants this 2009-01-09 21:11:23 +00:00
Ben Gras d2757d4b73 debug buffer slightly usabler. 2008-12-19 15:19:42 +00:00
Ben Gras 866a4a667e phys addr arg of 0 must be possible for pt_writemap too (instead of meaning
unmap).
2008-12-19 13:29:12 +00:00
Ben Gras 8072ef5509 oops, shouldn't be on in svn. 2008-12-18 17:42:29 +00:00
Ben Gras 3121eec6bd . map text (kernel's and processes') in readonly
. map kernel in non-user
 . don't map in first pages of kernel code and data
   if possible

these first pages could actually be freed but as the
kernel isn't allowed to touch them either we can't reuse
them until VM has totally taken over page table management
and kernel doesn't rely on identity mapping any more.
2008-12-18 15:35:22 +00:00
Ben Gras 834d9d34e8 Initialize deferred field. This seems to fix a hanging select() bug. 2008-12-17 14:20:08 +00:00
Ben Gras 34d5401ed4 put put_vnode() back where it belongs! 2008-12-16 16:11:24 +00:00
Ben Gras 710f44c4b8 added code for debugging pagefaults 2008-12-16 14:33:53 +00:00
Ben Gras e4e3995fb0 don't force vm to print to serial; don't kill processes when they
have 'bad' memory ranges (as it's the requestor's fault)
2008-12-11 17:36:33 +00:00
Ben Gras 70f1f28439 dynamic HZ, library stacktrace 2008-12-11 14:54:42 +00:00
Ben Gras 2024bf0bcf . no more HZ
. let user processes query HZ
 . no more custom panic()
2008-12-11 14:49:17 +00:00
Ben Gras ccf70aa989 system_hz replaces HZ 2008-12-11 14:48:05 +00:00
Ben Gras 7d674f4b8e no more HZ; less debugging statements 2008-12-11 14:47:48 +00:00
Ben Gras b9a0d46ea9 debug out 2008-12-11 14:46:46 +00:00
Ben Gras 3287b7f7d8 don't hang old binaries 2008-12-11 14:45:49 +00:00
Ben Gras 5e1bb6eb63 added some code to debug why filesystems won't unmount 2008-12-11 14:45:31 +00:00
Ben Gras e96f86ed8c throw out debugging code. 2008-12-11 14:44:10 +00:00
Ben Gras eeba8ef01f No more HZ. 2008-12-11 14:43:53 +00:00
Ben Gras e9f0c576a3 Open stdin, stdout and stderr only after /etc/rc has executed. (/etc/rc
executes it itself.) This avoids keeping /dev nodes on the temporary
root filesystem (initial mfs) in use unnecessarily.
2008-12-11 14:43:25 +00:00
Ben Gras 68d0c4defe - code shared with exec() letting boot-time processes have
their own fully fledged virtual address space and freeing
   their pre-allocated heap+stack area (necessary to let memory
   driver map in arbitrary areas of memory for /dev/mem without
   sys_vm_map)
 - small optimization preallocating memory on exec
 - finished VR_DIRECT physical mapping code
2008-12-08 16:43:20 +00:00
Ben Gras 9b33056d2b make allocmem accept and return values in bytes, ramdisk expects this. 2008-11-19 15:40:17 +00:00
Ben Gras 51fdce1d36 minor fixes 2008-11-19 14:10:33 +00:00
Ben Gras 6c92081a5a paged mode is default. 2008-11-19 13:19:37 +00:00
Ben Gras 7b3d952a77 lingering file 2008-11-19 12:38:31 +00:00
Ben Gras c078ec0331 Basic VM and other minor improvements.
Not complete, probably not fully debugged or optimized.
2008-11-19 12:26:10 +00:00
David van Moolenbroek f73b541952 Backport of fix from asynchvfs branch for PM-LOG-VFS-PM deadlock that resulted in VFS panics. 2008-06-24 13:53:03 +00:00
Philip Homburg 4696d74480 Select support for eth by Erik van der Kouwe. 2008-03-12 14:10:21 +00:00
Philip Homburg 9d62f56ea1 SYS_MAPDMAx -> SYS_MAPDMA. 2008-02-25 14:36:28 +00:00
Philip Homburg f82a1c4df7 Fixed include files. 2008-02-25 14:35:54 +00:00
Philip Homburg bc7e3c02a3 Asynchronous select implementation. 2008-02-22 15:46:59 +00:00
Philip Homburg ff7eae2ad8 Private copy of kputc to support asynch communication with log device. 2008-02-22 15:43:33 +00:00
Philip Homburg 2ec762c60c Asynchronous communication with character specials. 2008-02-22 15:41:07 +00:00
Philip Homburg d9a9b727e2 Added dmap_async_driver and dmap_sel_filp fields. Support for asynch character
drivers (needs cleaning up).
2008-02-22 15:01:00 +00:00
Philip Homburg 9df94c5ee8 Use dev_t instead of Dev_t in structures. 2008-02-22 14:54:00 +00:00
Philip Homburg 097d8fee66 Use nonblocking send for reply. Support for asynchronous message passing
(needs cleaning up).
2008-02-22 14:53:02 +00:00
Philip Homburg 66c930ef8b Higher NCALLS requires bigger table. New calls are in PM. 2008-02-22 14:51:38 +00:00
Philip Homburg 93ff4c327f Added XDOPEN. 2008-02-22 14:50:41 +00:00
Philip Homburg 9388a27070 Support for O_REOPEN flag and pass the filp numbet to dev_open. 2008-02-22 14:49:02 +00:00
Philip Homburg 7387449b23 Support for suspending on character device open and on drivers that need to
be restarted.
2008-02-22 14:47:40 +00:00
Philip Homburg ca91b3b5be New fp_flags. Currently used to signal that is process should be suspended
a driver is restarted.
2008-02-22 14:32:23 +00:00
Philip Homburg 6ef71b8198 Pass suspend_reopen flag to dev_io. 2008-02-22 14:26:41 +00:00
Philip Homburg 047cc090e4 Added filp_state for driver recovery and filp_select_flags to store select
state for character specials that use asynch I/O.
2008-02-22 14:19:23 +00:00
Philip Homburg 1d7d5aa629 dev_close needs the filp number for asynch I/O, dev_io gets suspend_reopen
flag to suspend a process until the filedescriptor is re-opened. Added 
dev_reopen, asyn_io, suspended_ep, reopen_reply, asynsend, diag_repl, 
close_filp, close_reply, unpause, select_reply1, select_reply2.
2008-02-22 14:03:14 +00:00
Philip Homburg e5df351245 Support for blocking open on char specials (due to asynch message passing),
asynch. close, added close_filp function.
2008-02-22 13:57:11 +00:00
Philip Homburg 1cffa69d2c Support for I/O MMU: do not re-use a memory segment until the I/O MMU has
removed it from its map.
2008-02-21 16:33:34 +00:00
Philip Homburg 3f23bca404 Removed defines not needed by mfs (XPIPE, XLOCK, XPOPEN, XSELECT, DUP_MASK). 2008-02-21 16:22:36 +00:00
Philip Homburg ca8291c815 Support for restricting limiting IPC to a set of endpoints. Not enabled by
default, pass -i to service. Do not reply to bogus request types. Reply using
sendnb.
2008-02-21 16:20:22 +00:00
Philip Homburg d9858cfabf Removed some debug output. 2008-02-21 16:08:08 +00:00
Ben Gras 2876d5c4ba Optimization in searching for new zones to allocate contributed
by Jens de Smit.
2008-02-06 15:05:57 +00:00
Ben Gras 67d1b67805 exit prototype 2007-10-23 14:19:16 +00:00
Ben Gras e8aec69c7b tweak to panic functions of mfs and vfs.
. print newline
  . when recursive panic detected, don't simply return, confusing
    the caller, but print a diagnostic and exit
  . don't call sys_exit as this may confuse PM; it should be OK
    to call PM exit() nowadays.
2007-10-23 14:17:51 +00:00
Ben Gras 21ae963cf1 Fixes two wrong grant return checks and one 'grant leak'. 2007-10-17 10:46:20 +00:00
Ben Gras b6e07e1835 close device if mount fails after device opened. 2007-09-26 15:06:41 +00:00
Ben Gras 38604e4e3a Don't truncate read requests based on v_size; v_size can be stale in the
case of directories extended by subfilesystem. Rely on subfilesystem to
do read size truncating and return actual i/o size. This fixes bug 81 in
gforge, and unbreaks test 23.
2007-09-11 15:52:22 +00:00
Philip Homburg ab3062c8c0 REQ_FSTATFS now operates on the root inode (the inode parameter has been
removed)
2007-08-17 11:20:59 +00:00
Philip Homburg 9c3f85d14f Better interface for sys_times. 2007-08-16 13:16:26 +00:00
Philip Homburg 4b1cd8c0ec Return EIO if a filedescriptor cannot be re-opened after a driver restart.
Select now returns such a filedescriptor as ready (instead of EBADF). 
Reply before dev_up in FSSIGNON to avoid the problem that a DEV_OPEN
request is received by a driver that expects a reply from the FSSIGNON.
2007-08-15 12:53:52 +00:00
Philip Homburg 90fde6e97d cleanup 2007-08-10 13:02:39 +00:00
Philip Homburg 06e1f0da61 Better recovery when req_readsuper fails. 2007-08-10 13:01:38 +00:00
Philip Homburg 57c6f099f2 Removed old debug code. 2007-08-08 15:27:07 +00:00
Philip Homburg e2f06e7c89 Directory check before access check. 2007-08-08 15:26:47 +00:00
Philip Homburg a116b3aa55 To return the right error, check first is an object is a directory (for
mkdir, rmdir/unlink, mknod), simply pipe code by using v_pipe_rd_pos and
v_pipe_wr_pos directly. Some cleanup work in open.c
2007-08-08 14:01:36 +00:00
Philip Homburg c2bf536a55 Disable POSIX-required behavior wrt trailing slashes. 2007-08-08 11:40:47 +00:00
Philip Homburg d232b2ef42 Removed invalid consistency check. 2007-08-07 14:27:19 +00:00
Philip Homburg 9c51f0b92a O_EXCL check went missing. 2007-08-07 14:26:56 +00:00
Philip Homburg d01d630727 include "../vfs/dmap.h". 2007-08-07 13:26:25 +00:00
Philip Homburg 1b883a3613 Removed references to stacktrace. 2007-08-07 13:21:55 +00:00
Philip Homburg a318cd291f Somehow request.c got garbled. 2007-08-07 13:12:27 +00:00
Philip Homburg f46319037b New VFS interface 2007-08-07 12:52:47 +00:00
Philip Homburg 2ca2b86a3a Added new interface to VFS. 2007-08-07 12:38:35 +00:00
Philip Homburg a81e82b3da Tell the kernel about the new boottime and don't tell VFS.
Tell DS about all processes in the boot image. PM_STIME is removed.
Diagnostic for calls to do_getprocnr (DS should be used to get endpoints).
2007-08-07 12:28:42 +00:00
Philip Homburg fd151245e9 Removed sigaction call. PM tries to talk to DS. DS should not talk to PM. 2007-08-07 12:25:21 +00:00
Philip Homburg 1f04287b3f Removed dmap table. Publish endpoint in DS before calling mapdriver5. 2007-08-07 12:24:06 +00:00
Ben Gras 30ba1ec187 also allow vm_map. 2007-07-11 13:45:06 +00:00
Ben Gras eb4609c108 Don't exit when rebooting. 2007-07-11 13:44:45 +00:00
Philip Homburg 56a68dc32b Hack in service to use RS_START instead of RS_UP. RS reports the use of RS_UP. 2007-05-02 15:20:28 +00:00
Philip Homburg 33d31720a5 Use ds_retrieve_u32 to get the endpoint of inet and of the ethernet drivers. 2007-05-02 11:30:16 +00:00
Philip Homburg 02a229f14d Publish endpoints in ds. 2007-04-27 13:03:33 +00:00
Philip Homburg 93f9bb4a57 Restrict access to rs to root's processes. 2007-04-27 12:27:40 +00:00
Philip Homburg 69ca935251 getpeuid implementation. Get the uid of a process (by endpoint) 2007-04-27 12:21:06 +00:00
Ben Gras 8eb09f6ddc . readall: use lseek64() to read more than 4GB of a device
. vfs: 64-bit offset support for character device i/o
   (also remove unused dev_bio function)
 . memory: /dev/null and /dev/zero are infinitely large, don't stop
   reading/writing at 4GB
2007-04-24 13:27:33 +00:00
Philip Homburg 0bd4c5ee7d Initial convertion to asynchronous sends for communicating with ethernet
drivers.
2007-04-23 14:49:20 +00:00
Philip Homburg b613f5cb4b Report and detect exec failures using a pipe.
XXX Hardcoded values for s_ipc_to and s_ipc_sendrec.
2007-04-23 14:47:04 +00:00
Philip Homburg 727ce18aa8 Initialize exec_pipe. 2007-04-23 14:43:25 +00:00
Philip Homburg 849285f66d Diagnostics from service go to standard error. 2007-04-23 14:42:58 +00:00
Philip Homburg e68a2b4d6a Extra flags RS_SIGNALED and RS_EXECFAILED. Pipe for detecting exec failures. 2007-04-23 14:42:08 +00:00
Philip Homburg b4a88a3705 Removed ECHO from dump, added SENDA. Also dump s_ipc_sendrec. 2007-04-23 14:40:13 +00:00
Philip Homburg 77f5b40141 Round memory size up for VM. 2007-04-23 14:38:55 +00:00
Philip Homburg b5e6319ae7 Removed some indentation. 2007-04-23 14:33:42 +00:00
Ben Gras 1d7cea10ed str[] is too small - reported by Erik van der Kouwe <vdkouwe@cs.vu.nl>. 2007-04-23 13:36:13 +00:00
Ben Gras dc67b37a10 more removing of warning and debug messages. 2007-04-13 14:00:31 +00:00
Ben Gras 6b2ad6fdfd verbose message out 2007-04-12 17:01:54 +00:00