Commit graph

352 commits

Author SHA1 Message Date
Philip Homburg
1ce2f75627 Additional ptrace commands for fault injection. 2006-10-20 14:14:08 +00:00
Ben Gras
cbfa0f4fb8 Change select() so that only as many words as necessary for the 'nfds'
argument from the fd bitmasks are copied from and back to userspace. This
solves an ABI dependency on OPEN_MAX. If nfds is too big for the current
OPEN_MAX, select() fails (but that's relatively easy to fix by 'just'
recompiling the system and not the application binaries), but if it's
smaller, binaries keep working.
2006-10-04 13:28:38 +00:00
Philip Homburg
66f9a5f508 Do not abort/panic when an ethernet driver does something unexpected. 2006-08-28 12:59:36 +00:00
Ben Gras
b888922d62 Added 'service run' to run a service without restart. 2006-08-15 15:54:51 +00:00
Ben Gras
4539e54d8b . fix for wild store at startup time by calling dev_io without fp
initialized
 . fix for writing exactly PIPE_SIZE to a pipe with O_NONBLOCK blocking
   anyway because of incomplete logic in pipe_check
2006-08-10 11:51:11 +00:00
Ben Gras
c3c08d252c report driver source of grant mismatch 2006-08-04 13:31:06 +00:00
Ben Gras
18327f02a8 Introduced unprivileged getsysinfo variant, to retrieve harmless data
in formats that don't change (or is upwards compatible).
2006-07-27 16:23:01 +00:00
Philip Homburg
baa3ac5853 Fix for 'cleanup: not idle: 2313' bug. 2006-07-25 14:13:09 +00:00
Ben Gras
82173212ee Introduction of a 'big' ioctl, with more bits (20) reserved for encoding the
size field. The TIOCSFON ioctl size (8192) didn't get encoded properly,
as there weren't enough bits for it (12) in the regular format.

The new format has only one type field, and an extra flag (_IOC_BIG)
turned on. FS checks for this flag and uses the alternative decoding
of the ioctl codes to determine the size when doing grants.

This unbreaks loadfont, although that still uses a phys copy in tty.
2006-07-25 09:41:40 +00:00
Philip Homburg
61337d5f7b Allow holes in executables. 2006-07-24 13:07:25 +00:00
Ben Gras
3512a86b44 . DS understands publishing and subscribing where keys are in string
form. Subscriptions are regular expressions.
 . different types are stored per key; currently u32 and/or string.
   the same key can be referenced (publish, subscribe, check) as any type.
 . notify()s are sent when subscriptions are triggered (publishing or
   updating of matching keys); optionally, a subscribe flag sends
   updates for all matching keys at subscription time, instead of only
   after updates after subscribing
 . all interfacing to ds is in /usr/src/lib/syslib/ds.c.
 . subscribe is ds_subscribe
   publish functions are ds_publish_<type>
   retrieve functions are ds_retrieve_<type> (one-time retrieval of a value)
   check functions are ds_check_<type> (check for updated key caller
      subscribes to not yet checked for, or ESRCH for none)
 . ramdisk driver updated with new ds interface
2006-07-13 14:50:23 +00:00
Philip Homburg
c06bc3ead8 Left consistency checks enabled in INET in the previous commit. 2006-07-13 13:25:55 +00:00
Philip Homburg
04b478f177 More stack for tcpd.
Safecopies renders the NWIOQUERYPARAM ioctl useless. This functionality
is now replaced with /dev/ipstat. Write the request to the device and
read the answer in one read request.
2006-07-13 13:19:48 +00:00
Philip Homburg
9939089dea Safecopy support for INET. 2006-07-10 12:55:33 +00:00
Philip Homburg
7ce17fe655 Support for SI_CALL_STATS (counting systemcalls). 2006-07-10 12:44:43 +00:00
Ben Gras
1561067ee4 Grant system dynamic-only. 2006-06-30 14:40:29 +00:00
Ben Gras
b654c02f55 Give pm its own brk() so malloc() works in pm. pm needs more stack for this. 2006-06-30 14:36:11 +00:00
Ben Gras
b5179d7025 Split do_brk in a stub and a function that does the real work, so that
the real work can be called from elsewhere too. Specifically, to allow PM
its own brk().
2006-06-30 14:35:38 +00:00
Ben Gras
0323892f71 3rd fix for improper behaviour on crashing driver with safe_io_conversion 2006-06-29 14:24:07 +00:00
Ben Gras
bfca7d68ba Fix another bug related to trying i/o more than once 2006-06-28 12:20:30 +00:00
Ben Gras
46646a49a8 Don't print cloexec 2006-06-28 10:04:32 +00:00
Ben Gras
f9fb0ff546 Fix bug where safe conversion doesn't happen after 1st time in loop 2006-06-28 10:03:18 +00:00
Ben Gras
bd535a120b . satisfy some gcc warnings (uninitialized/unused variables)
. change cloexec mask from long to fd_set to remove 32 fd's per
   process restriction (from cloexec at least)
2006-06-27 16:47:35 +00:00
Ben Gras
a587273c56 . expanded grant manipulation interface to more direct
manipulation
. made fs allocate a grant for every ioctl, even if no data
  is being copied, in order to disambiguate concurrent ioctls
  on the same minor
2006-06-26 16:08:42 +00:00
Philip Homburg
2f50f92eb3 Move inet to safe copies. 2006-06-26 16:03:35 +00:00
Philip Homburg
de07a562d1 Vectored safe copies for inet. 2006-06-26 14:20:11 +00:00
Philip Homburg
14c9743ecf First cut at safe copies for inet. Breaks tcpstat. 2006-06-26 11:17:19 +00:00
Philip Homburg
8dfac43a75 Print ipc_to in hex. Also print the 'system' call mask. 2006-06-23 13:27:03 +00:00
Ben Gras
82855e9cf5 . leave out dead code from device.c
. don't loop doing a receive() after sendrec() - chance of recovering is not
  high, and can lead to receive()ing a notify() (which can't happen in sendrec()),
  which is terrible
. return status from device when DEV_CANCEL is done on a signal; hardcode EAGAIN to
  become EINTR though
2006-06-23 11:51:56 +00:00
Ben Gras
7b6a1e5f59 More space for rs 2006-06-20 10:59:45 +00:00
Ben Gras
0d39b17655 Changed order of -lsys and -lsysutil for printf() 2006-06-20 10:50:29 +00:00
Ben Gras
705f1039d9 order changed for printf() 2006-06-20 10:47:25 +00:00
Ben Gras
150c964b49 Fix for losing REVIVE 2006-06-20 10:12:30 +00:00
Ben Gras
2384a85296 FS support for grant-based i/o.
For character device i/o, FS does a so-called 'magic' grant to let the
driver copy from or to user space. As this is done in FS address space,
the driver is told to do this in FS address space. The redirection to
the right user process then happens at copy-time in the kernel, using the
FS grant table. This also happens for DEV_READ and DEV_WRITE on block
devices.

For other block device i/o, which happens from/to FS buffers, FS does
a 'direct' grant to its own address space for the driver.

After the i/o returns, this access has to be K-I-L-L-E-D, revoked.
Sometimes this is after a SUSPEND and DEV_REVIVE, in which case the
revoking happens in pipe.c.

This conversion happens in safe_io_conversion() in device.c, called
by dev_io and dev_bio.

FS has to pre-allocate its own space for these grant tables. This happens
in main.c.
2006-06-20 10:12:09 +00:00
Ben Gras
54f1e6d3d4 Use endpoint_t 2006-06-20 10:04:33 +00:00
Ben Gras
7a76a7a495 Rename protected to prot
Also print size of grant table known in system
2006-06-20 10:03:48 +00:00
Philip Homburg
221e731e45 Wake up writer when selecting for read on an empty pipe.
Set fp_revived to NOT_REVIVING when decrementing reviving.
2006-06-14 13:17:41 +00:00
Philip Homburg
cb02a90b77 Fixed some select bugs related to pipes. Removed SELFD_* because they were
bogus and unused.
2006-06-07 14:41:47 +00:00
Philip Homburg
e9aabcf2f8 Disabled building rescue driver (no longer needed). Moved allocmem from
library to the memory driver. Always put output from within TTY directly on
the console. Removed second include of driver.h from tty.c. Made tty_inrepcode
bigger. First step to move PM and FS calls that are not regular (API)
system calls out of callnr.h (renumbered them, and removed them from the
table.c files). Imported the Minix-vmd uname implementation. This provides
a more stable ABI than the current implementation. Added a bit of security
checking. Unfortunately not nearly enough to get a secure system. Fixed a
bug related to the sizes of the programs in the image (in PM patch_mem_chunks).
2006-05-19 12:19:37 +00:00
Philip Homburg
c3cf4ef460 Fixed off by one error in backoff code. Limit backoff to 1 second for
disk drivers.
2006-05-15 12:08:43 +00:00
Philip Homburg
c9ff3994f1 Unpause requests (to FS) can be generated in parallel to other requests. 2006-05-15 12:06:19 +00:00
Philip Homburg
f0186f4179 Do not unmap a driver when the driver dies (it interferes with restarting
disk drivers). Fixed accounting for REVIVING/reviving.
2006-05-15 11:43:06 +00:00
Philip Homburg
ae92cc208d The new service command managed to escape. 2006-05-11 15:30:56 +00:00
Philip Homburg
14b7a72ba3 Init need more space (the results of removing the special case for init in
adjust in PM). Better flags dump in IS.
2006-05-11 15:00:46 +00:00
Philip Homburg
e4967b06bb Special code for restarting disk drivers (-c flag in service). 2006-05-11 14:58:33 +00:00
Philip Homburg
773844a816 New interface between PM and FS. 2006-05-11 14:57:23 +00:00
Ben Gras
461a4fafb1 Added fchmod() and fchown() 2006-04-18 11:26:04 +00:00
Ben Gras
7497a76779 More filesystems. 2006-03-28 11:34:59 +00:00
Ben Gras
2d5058685d Don't open pipes readwrite as it leads to confusion. 2006-03-28 11:28:16 +00:00
Ben Gras
52cd12195e Typo 2006-03-28 10:09:43 +00:00
Ben Gras
7b58dd7f9b Renamed findproc() to _pm_findproc() to reduce polluting of application
namespace.
2006-03-25 04:49:04 +00:00
Ben Gras
df9f4f4369 . minor fix in select() logic on pipes
. fix in pipe_check when 'notouch' is on - we touched something!
2006-03-24 20:53:10 +00:00
Philip Homburg
6e0bf57f82 Fixed bug in tcp select, added NWIOTCPGERROR. 2006-03-24 14:06:03 +00:00
Philip Homburg
e695deb8f8 Fixed mq leak in NWIOQUERYPARAM. 2006-03-24 14:05:11 +00:00
Ben Gras
26a59eea43 readlink(); check bounds
top: add 'system' cpu time to 'kernel', 'idle' and 'user'
2006-03-17 13:34:40 +00:00
Ben Gras
eae250dea4 . load average calculation changed to calculate it all over every tick
instead of keeping a running total of enqueued processes
   (because somehow the load average was broken)
 . added SI_KPROC_TAB to get a copy of kernel process table from PM, for
   a top implementation
 . fixed arg to sys_nice() to make it an endpoint, not a slot number
2006-03-16 09:33:35 +00:00
Ben Gras
6e7ba75acb Driver disappearing during dev_io() is not a fatal error. 2006-03-15 21:55:32 +00:00
Ben Gras
ff67776995 FS:
. loops checked for PID_FREE
  . exit broken down in exit and cleanup functions; when reboot happens,
    cleanup is done but not exit (as processes have not actually exited),
    this keeps drivers working
  . fixed a few uninitialized and unused variables

scripts:
  . new packaging system
2006-03-15 15:34:12 +00:00
Ben Gras
557d865b35 Removed some debug prints 2006-03-15 15:16:16 +00:00
Philip Homburg
50d805144c dmap_io now returns a status. map_driver no longer calls dev_up. 2006-03-15 13:37:20 +00:00
Philip Homburg
454dc8a180 Disabled special processing of KILL signals that are passed to pm by the kernel 2006-03-15 11:35:53 +00:00
Philip Homburg
57ed4b2bf7 Pass endpoint to sys_trace instead of slot number. 2006-03-15 11:32:00 +00:00
Ben Gras
def8c13ba8 Do a sync() before reboot()ing in FS. 2006-03-14 13:54:20 +00:00
Ben Gras
1a7f7d6333 at_wini: removed RO_BIT misfeature, not used any more
pm: fixed rebooting by making a copy of the monitor code from the user
    process. this is necessary because that process is dead by the time
    sys_abort() is called.

    also added more info to the "can't reply" panic.
2006-03-13 13:21:13 +00:00
Ben Gras
cd8905f906 Don't need this change with new reboot 2006-03-13 10:36:52 +00:00
Ben Gras
9b1d4ef233 special case when exiting FS - don't core dump and don't tell FS about it
Because if FS is hanging in a signal, the exit won't work.
This way FS gets exited on e.g. SIGSEGV.
2006-03-10 17:35:55 +00:00
Ben Gras
c236121692 Let reboot work again by making PM check for RBT_REBOOT 2006-03-10 16:50:27 +00:00
Jorrit Herder
021e3234d8 Jorrit's ... "progress?" 2006-03-10 16:10:05 +00:00
Ben Gras
6fe89cfbe8 Hack small and big fs into a single image. Must now set BIG or SMALL label. 2006-03-10 14:11:19 +00:00
Ben Gras
25fdc7657d panic() on inconsistent endpoints 2006-03-10 12:59:46 +00:00
Ben Gras
6746ee10f5 If re-open fails, mark fd as unusable but not-reusable either (until
close()d).
2006-03-09 16:00:33 +00:00
Ben Gras
9a6987e9cd Medium stack for ds and rs 2006-03-09 14:03:39 +00:00
Ben Gras
925dd3321f Don't blindly skip 0-group processes in signals 2006-03-08 14:46:42 +00:00
Ben Gras
6c2a1bac7b endpoint fixes for RS 2006-03-08 14:38:35 +00:00
Ben Gras
acb804f0bd RS formatting fixes 2006-03-08 14:37:26 +00:00
Ben Gras
d63e366944 Less stack for ds and rs 2006-03-07 13:22:36 +00:00
Ben Gras
b31d93aaa4 Comment fixes mailed to bugs@ 2006-03-04 22:51:52 +00:00
Ben Gras
10eeb788f9 Generation number printed too 2006-03-03 16:34:37 +00:00
Ben Gras
b103bf5dc7 Fix of endpointless slot message in FS
Removed some leftover '#if 0'ed debug code in PM
2006-03-03 10:25:28 +00:00
Ben Gras
7967177710 endpoint-aware conversion of servers.
'who', indicating caller number in pm and fs and some other servers, has
been removed in favour of 'who_e' (endpoint) and 'who_p' (proc nr.).

In both PM and FS, isokendpt() convert endpoints to process slot
numbers, returning OK if it was a valid and consistent endpoint number.
okendpt() does the same but panic()s if it doesn't succeed. (In PM,
this is pm_isok..)

pm and fs keep their own records of process endpoints in their proc tables,
which are needed to make kernel calls about those processes.

message field names have changed.

fs drivers are endpoints.

fs now doesn't try to get out of driver deadlock, as the protocol isn't
supposed to let that happen any more. (A warning is printed if ELOCKED
is detected though.)

fproc[].fp_task (indicating which driver the process is suspended on)
became an int.

PM and FS now get endpoint numbers of initial boot processes from the
kernel. These happen to be the same as the old proc numbers, to let
user processes reach them with the old numbers, but FS and PM don't know
that. All new processes after INIT, even after the generation number
wraps around, get endpoint numbers with generation 1 and higher, so
the first instances of the boot processes are the only processes ever
to have endpoint numbers in the old proc number range.

More return code checks of sys_* functions have been added.

IS has become endpoint-aware. Ditched the 'text' and 'data' fields
in the kernel dump (which show locations, not sizes, so aren't terribly
useful) in favour of the endpoint number. Proc number is still visible.

Some other dumps (e.g. dmap, rs) show endpoint numbers now too which got
the formatting changed.

PM reading segments using rw_seg() has changed - it uses other fields
in the message now instead of encoding the segment and process number and
fd in the fd field. For that it uses _read_pm() and _write_pm() which to
_taskcall()s directly in pm/misc.c.

PM now sys_exit()s itself on panic(), instead of sys_abort().

RS also talks in endpoints instead of process numbers.
2006-03-03 10:20:58 +00:00
Ben Gras
7d83ef196d Don't include cdprobe any more 2006-02-24 12:56:06 +00:00
Philip Homburg
b6d12e81aa Change to some debug code. 2006-02-24 12:55:00 +00:00
Philip Homburg
1d78f4a203 Fixed bug in canceling TCP ioctls before INET got an IP address. 2006-02-20 14:35:01 +00:00
Philip Homburg
c367670fa8 improved tcp_acceptto. 2006-02-17 13:47:31 +00:00
Philip Homburg
df92754d67 Fixed two memory leaks. 2006-02-16 14:13:36 +00:00
Philip Homburg
c3a88d15d8 Initial root filesystem is now on a ramdisk that is part of the image. 2006-02-15 11:18:21 +00:00
Ben Gras
b9bdbcba1b Don't sync before exiting drivers.
Wipe inodes of pipes in truncate_inode(), to avoid the size remaining
at PIPE_SIZE causing pipes to break.
2006-02-13 10:28:42 +00:00
Ben Gras
040cebcefe Don't kill processes by signals in process group 0, and do a sync before
killing all processes in FS reboot.
2006-02-03 15:21:00 +00:00
Ben Gras
bcb67841a5 Give init process group 1. 2006-02-03 14:54:20 +00:00
Philip Homburg
8aa8552e95 Added SIGCONT to the list of signal that are to be ignored by default. 2006-01-30 16:27:49 +00:00
Philip Homburg
f4ae126596 Cosmetic changes. 2006-01-27 13:26:42 +00:00
Philip Homburg
ee2253ec52 Use the sys_privctl library function. 2006-01-27 13:20:06 +00:00
Ben Gras
43051c182a Safety feature for symlink() - verify length of symlink contents
buffer with strlen()
2006-01-26 14:31:00 +00:00
Ben Gras
f806a66edf Fix for fchdir(). 2006-01-20 12:43:35 +00:00
Ben Gras
3bddaaf580 Let other uids (temporarily) set their mapping. 2006-01-20 12:43:19 +00:00
Ben Gras
966905d295 Not having a driver isn't a print-worthy error. Just return ENXIO. 2006-01-17 17:55:35 +00:00
Ben Gras
39f1fb81ea Don't print usage if service can't find binary. 2006-01-17 15:56:55 +00:00
Philip Homburg
21163c8da2 Print masked IRQs. 2006-01-12 14:41:40 +00:00
Philip Homburg
ce7b2f64c5 Fixed bug in VLAN support. 2006-01-12 14:31:06 +00:00
Ben Gras
50b06261b6 Implementation of truncate(), ftruncate() and the F_FREESP fcntl().
Implemented by changing write_map to accept a WMAP_FREE flag. In that
case, it doesn't update the datablock (creating indirect zones as
necessary) pointer, but it frees the datablock if present. Also it
frees the single and double indirect blocks if unused.

This makes the implementation of truncate_inode() simpler.
truncate_inode() now accepts a truncation length which makes
implementing truncate() and ftruncate() simple.

This also allowed implementing the F_FREESP fcntl().
2006-01-11 17:14:51 +00:00