Commit Graph

3429 Commits

Author SHA1 Message Date
jdolecek e0d29a5578 fix bug in previous - if child was traced and p_opptr == p_pptr,
need to reparent the process to initproc, so that child wouldn't
have its p_pptr pointer still pointing on the exited parent

pointed out by Dave Sainty in private mail (the patch in kern/14443
didn't have this bug)
2002-11-30 09:54:43 +00:00
jdolecek a45e0497c5 selwakeup(): don't bother with pfind() in SI_COLL case; sel_pid is always zero
in this case, and even if not, the process would be already woken up by the
wakeup() call
change sent as part of kern/17517 by David Laight

XXX perhaps should KASSERT() sel_pid is zero in the SI_COLL case
2002-11-29 19:48:22 +00:00
manu 39b522c107 back out the previous change, which is useless. Darwin loads the libraries
that are required by the binary, not the libraries required by the libraries
required by the binary.

Hopefully, binaries should load again on i386.
2002-11-29 15:49:09 +00:00
manu b36d0c1bf6 Maitain a chainedlist of already loaded Mach-O objects, to avoid loading
the same file multiple times because of recursive loading (ie: libx require
liby and libz and liby require libz, so libz would be loaded twice)

This is probably suboptimal, but it enable /bin/sh to load on the PowerPC,
so it's a good interim solution until we figure precisely how things should
work.

I'm not sure whether this makes the excessive recursive check useless or not.
2002-11-29 11:31:11 +00:00
jdolecek b439ca6951 exit1(): make sure that, if orphaned child is being traced, it's
reparented back to original parent before it's killed.
This makes the original parent aware that the child has exited if
the debugger failed to wait() on the debugged zombie before exiting.
Since we clear tracing flags before killing the child, the reparenting
logic in wait4() wouldn't be triggered, so it's necessary to do it here.

Problem reported and fix provided in kern/14443 by David Sainty.
2002-11-28 21:41:29 +00:00
jdolecek dc55168cb6 issignal(): put apparently long-forgotten (at least since 4.4BSD)
debug printf inside #ifdef DEBUG_ISSIGNAL

This adresses kern/16760 by Love.
2002-11-28 21:00:27 +00:00
itojun ae1b88aa21 "tv->tv_sec * hz" could overflow a long. millert@openbsd 2002-11-27 04:07:42 +00:00
itojun dfd721e53e small SO_RCVTIMEO values are mistakenly taken to be zero. FreeBSD PR kern/32827. 2002-11-27 03:36:04 +00:00
christos e22906f6d0 si_ -> sel_ to avoid conflicts with siginfo. 2002-11-26 18:44:34 +00:00
itojun f81516ac1f 1.8 committed by mistake 2002-11-25 08:50:07 +00:00
itojun a1a2fcda1e no need for error check after MEXTMALLOC - jdolecek 2002-11-25 08:31:58 +00:00
itojun 387ba53bc6 MEXTMALLOC() can fail even if M_WAITOK, if arg is too big for malloc(). 2002-11-25 06:32:37 +00:00
manu 589ff87f68 Rewrite the excessive recursive loading protection by actually counting the
recursions instead of the total function calls. We limit to 6 recursion,
which is what Darwin does.
2002-11-24 21:59:43 +00:00
thorpej 3d64e26035 Add an EVCNT_ATTACH_STATIC() macro which gathers static evcnts
into a link set, which are added to the list of event counters
at boot time.
2002-11-24 17:33:43 +00:00
scw 0f91ed3dfa Quell uninitialised variable warnings. 2002-11-24 11:37:54 +00:00
manu 0e734a6755 Libraries do not use relative addresses, they are absolute and should be
treated as such if we want the same mapping as in Darwin.

While we are there KNFify function names
2002-11-22 23:09:46 +00:00
manu f528c56f39 Check for excessive recursive Mach-O loading 2002-11-21 22:30:32 +00:00
manu ae6b5562b1 Remove a debug message that has been committed by mistake. 2002-11-21 22:01:45 +00:00
manu af59b63bbd We now have the exact stack initial stack layout of Darwin:
macho_hdr, argc, *argv, NULL, *envp, NULL, progname, NULL,
*progname, **argv, **envp

Where progname is a pointer to the program name as given in the first
argument to execve(), and macho_hdr a pointer to the Mach-O header at
the beginning of the executable file.
2002-11-21 19:53:40 +00:00
simonb 928196073c White-space nits. 2002-11-20 04:29:31 +00:00
chs ab17ec89d1 add support for __MACHINE_STACK_GROWS_UP platforms. from fredette@ 2002-11-17 22:53:46 +00:00
chs ab08c3ab73 support a variant of the "member" keyword where the symbol defined
is different from the actual member name.
2002-11-17 19:24:50 +00:00
chs 4b2625143d change uvm_uarea_alloc() to indicate whether the returned uarea is already
backed by physical pages (ie. because it reused a previously-freed one),
so that we can skip a bunch of useless work in that case.
this fixes the underlying problem behind PR 18543, and also speeds up fork()
quite a bit (eg. 7% on my pc, 1% on my ultra2) when we get a cache hit.
2002-11-17 08:32:43 +00:00
uebayasi c041971257 Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.
Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.
2002-11-16 07:40:38 +00:00
manu d584ed9598 Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.
2002-11-15 20:06:00 +00:00
jdolecek cedc87712e ELF copyargs: at the time this is executed, process's ucred doesn't
contain the new uid/gid for suid/sgid binaries yet; determine AT_EUID
and AT_EGID by checking executed program vnode attributes in this case
2002-11-13 15:49:44 +00:00
jdolecek cee43b67cc add generic linux compat ELF copyargs function
this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
  even if hz != 100
* glibc gets proper information on real/effective uid and enables
  secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
2002-11-13 15:16:27 +00:00
provos a5883f1616 fix systrace panic that was introduced when postponing pid number allocation
approved itojun
2002-11-13 00:51:02 +00:00
manu 530968e795 The kernel now builds with COMPAT_DARWIN. 2002-11-12 23:40:19 +00:00
blymn c4774e1260 * Don't keep evaluating fingerprint if there is no fingerprints for the
device.  Should help performance when no fingerprints are loaded.
* Back down the securelevel, now securelevel of 2 will make lack of
  fingerprint or fingerprint mismatch a fatal error.  Previously this
  was done at securelevel 3 or greater.
2002-11-12 12:54:36 +00:00
jdolecek c771eafacf add comments for trace_enter()/trace_exit(); particularily comment
expected value of 'code'
2002-11-11 10:43:54 +00:00
fvdl d0e6437e6d Back out previous, it caused compile errors in kern_fork.c. ISSET
and friends should either be made first-class citizens and moved
to an include file (systm.h perhaps), or nuked completely, but
not be redefined in a lot of files.
2002-11-10 14:01:57 +00:00
jdolecek 0a0804119d move definitions of custom SET()/ISSET()/CLR() macros from
sys/systrace.h to kern/kern_systrace.c
2002-11-10 10:01:03 +00:00
thorpej e0fb587e4e Avoid signed/unsigned comparison and strict alias warnings. 2002-11-10 03:35:31 +00:00
thorpej dccc71f1fe Fix signed/unsigned comparison warnings. 2002-11-10 03:28:59 +00:00
thorpej ff114c4a59 Fix signed/unsigned comparison warnings. 2002-11-09 20:06:07 +00:00
manu 99bc517790 Added sysctl to change all IRIX kernel values reported by uname and systeminfo:
OS name, hw name, kernel version, and so forth.
2002-11-09 09:03:56 +00:00
jdolecek 1e0e4766d3 kevent(2): if the specified timeout is >=1ns and <1us, perform a poll
rather than waiting forever due to TIMESPEC_TO_TIMEVAL() conversion
2002-11-08 20:26:50 +00:00
enami c07ab7ce9f Parse the modifier of ddb command as documented. 2002-11-08 02:08:57 +00:00
manu 9a4dfe85fa Added two sysctl-able flags: proc.curproc.stopfork and proc.curproc.stopexec
that can be used to block a process after fork(2) or exec(2) calls. The
new process is created in the SSTOP state and is never scheduled for running.

This feature is designed so that it is esay to attach the process using gdb
before it has done anything.

It works also with sproc, kthread_create, clone...
2002-11-07 00:22:28 +00:00
enami 8f82ec28ee Factor out the COMPAT_16 code. 2002-11-06 02:31:34 +00:00
mrg 3e8df71794 - do the COMPAT_16 dance in sysctl_diskstats() for the where == NULL case
as well.  pointed out by enami@.
- defflag COMPAT_16.
2002-11-05 13:22:32 +00:00
thorpej 80f8dbe30a Add a new VM map, lkm_map, which machine-dependent code can provide
in the event that it needs to use a special VM range (x86_64 falls
into this category).  We fall back onto kernel_map if machine-dependent
code doesn't create a special map.
2002-11-05 01:24:35 +00:00
mrg 5cad86b3ea repair backwards compatibility with netbsd 1.6 - if we are not given the
wanted sizeof(struct disk_sysctl), use the old size.  for non-COMPAT_16,
however, we return EINVAL so that all future programs are forced into
passing the wanted size.  1.6 iostat(8) works with -current kernel again.

as seen on tech-kern.
2002-11-04 03:50:07 +00:00
nisimura da22f42379 Add some informative comments about setrunqueue and remrunqueue. 2002-11-03 13:59:12 +00:00
perry 6858187df6 /*CONTCOND*/ while (0)'ed macros 2002-11-02 07:20:42 +00:00
kristerw 85b746f61a ISO C requires a statement after a label. 2002-11-01 21:46:51 +00:00
jdolecek 6a40f5edcb pipe_read(): initialize ocnt before pipelock() call; it might have been
used unitialized when the pipelock() call would fail
bug found by Krister Walfridsson
2002-11-01 21:34:30 +00:00
jdolecek 2a9e0afa92 set emul_netbsd's e_nsysent to SYS_NSYSENT, not SYS_MAXSYSCALL 2002-11-01 19:27:05 +00:00
simonb 307ae1b2e5 When calculating the space needed for the data, use the supplied
userland structure size (if passed in).
Use the supplied userland structure size (if passed in) to check if
there is enough room to copyout the next structure.
2002-11-01 15:20:03 +00:00
mrg 603098b9b5 implement separate read/write disk statistics:
- disk_unbusy() gets a new parameter to tell the IO direction.
	- struct disk_sysctl gets 4 new members for read/write bytes/transfers.
	when processing hw.diskstats, add the read&write bytes/transfers for
	the old combined stats to attempt to keep backwards compatibility.

unfortunately, due to multiple bugs, this will cause new kernels and old
vmstat/iostat/systat programs to fail.  however, the next time this is
change it will not fail again.

this is just the kernel portion.
2002-11-01 11:31:50 +00:00
enami fc1c4219ef Make this works with QUEUEDEBUG defined; don't use queue pointer after
removing an element from queue.
2002-11-01 03:34:07 +00:00
enami 5eec77bccd Cosmetic changes. 2002-11-01 03:32:21 +00:00
fvdl 4244ef3b22 For INTERLOCK_ACQUIRE, s/splsched/spllock/. 2002-11-01 01:13:32 +00:00
christos e6535bf628 XXX: be32toh on powerpc does not cast to int32_t so passing u_long to
be32toh produces an unsigned long result, causing a printf argument
mismatch. This is the wrong fix, but I am not going to change the
powerpc macros; fix the powerpc macros and revert my change.
2002-10-31 02:40:41 +00:00
manu 293419f314 int format long arg problems 2002-10-30 23:08:00 +00:00
kleink 0917926472 Revert rev. 1.147, as per PR kern/17411.
While a hard link to a symbolic link is not ruled out by POSIX-2001,
the link(2) interface is to perform normal pathname resolution,
which includes the resolution of symbolic links.
2002-10-30 22:36:46 +00:00
christos 74e8fc3424 fix fat binary architecture choosing code. mach binaries now execute as
poorly as before the x86 MP merge.
2002-10-30 15:21:01 +00:00
christos dc5aff13e6 make this compile again. 2002-10-30 15:04:47 +00:00
manu 9b4f3b0464 Introduce an array of supported CPU types by a given arch for Mach-O 2002-10-29 22:22:30 +00:00
manu b57515f2c4 If the magic number is 0xfeedface instead of 0xcafebabe, this means that
the executable is not fat. The binary starts with an object header instead
of a mach fat header.
2002-10-29 19:28:19 +00:00
blymn 29b7b4241f Added support for fingerprinted executables aka verified exec 2002-10-29 12:31:20 +00:00
jdolecek 25f6d9c389 regen: kqueue branch merge, addition of kqueue(2), kevent(2) 2002-10-23 09:18:16 +00:00
jdolecek 25cfe9dabd regen: kqueue branch merge, addition of VOP_KQFILTER() 2002-10-23 09:16:46 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
gmcgarry 3dae1c4857 vclean() isn't part of the interface so make it local.
Sort prototypes by the interface they belong to.
2002-10-23 06:45:49 +00:00
perry 4235f246f8 Gah. I meant Empty. EMPTY!!! 2002-10-23 00:11:00 +00:00
perry 3f95da0362 add a Ignore directive 2002-10-23 00:10:30 +00:00
simonb 63533e7e48 "tmp" in vfs_vnode_print() is set but not used; remove it. 2002-10-22 03:38:21 +00:00
simonb acc3e26536 We go to a lot of effort to choose a suitable value for "docache" in
relookup() ... then ignore it!  Remove it.
2002-10-22 03:35:10 +00:00
simonb 9c8f3f4a77 "ovcase" is set but not used in lf_getblock(); remove it. 2002-10-22 03:32:17 +00:00
simonb a61a7031e1 Remove set but unused variable "t" in m_aux_delete(). 2002-10-22 03:29:51 +00:00
simonb 0b2999620f Remove some variables that are set but not used. 2002-10-22 03:27:47 +00:00
simonb b460a1801e "oatv" in adjtime1() isn't used after being set; remove it. 2002-10-22 03:23:24 +00:00
christos 0ecf004286 Move pid allocation to the bottom of the process allocation, so that we
don't have to deal with partially initialized proc structs in the scheduler.
Pointed out by: Artur Grabowski and Chuck Silvers.
2002-10-21 17:37:53 +00:00
isaki 49e7158ab9 x68k needs config_cfdriver_lookup() to initialize its console.
XXX ad-hoc way?
2002-10-20 02:26:59 +00:00
gmcgarry e109c04d2d vn_stat() can now take a struct vnode * for consistency. Hide away
the opaque file descriptor operations.
2002-10-14 04:18:56 +00:00
chs dd88acd321 fix previous: call vn_marktext() on the right vnode. 2002-10-13 17:37:16 +00:00
provos 61e8c76047 support for privilege elevation.
with privilege elevation no suid or sgid binaries are necessary any
longer.  Applications can be executed completely unprivileged. Systrace
raises the privileges for a single system call depending on the
configured policy.

Idea from discussions with Perry Metzger, Dug Song and Marcus Watts.
Approved by christos and thorpej.
2002-10-11 21:54:55 +00:00
thorpej 194d7347bc Implement config_attach_pseudo(), which creates an instance of
a pseudo-device which behaves like a normal device in the device
tree, including the capability to have children.
2002-10-09 02:59:55 +00:00
junyoung 05f012a447 - char * -> caddr_t
- Fix typo.
2002-10-08 15:50:11 +00:00
provos a8909a2b8b new message to track uid/gid changes 2002-10-08 14:46:24 +00:00
chs 993948e989 count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
2002-10-05 22:34:02 +00:00
junyoung 7ad5fec515 Make this compile with __HAVE_MINIMAL_EMUL. 2002-10-04 18:34:10 +00:00
junyoung 8b656df79c Remove unnecessary code. 2002-10-04 03:17:37 +00:00
thorpej d90d300b7b Overhaul the way cfattach structures are looked up. The cfdata entry
now carries the name of the attachment (e.g. "tlp_pci" or "audio"),
and cfattach structures are registered at boot time on a per-driver
basis.  The cfdriver and cfattach pointers are cached in the device
structure when attached.
2002-10-04 01:50:53 +00:00
itojun 61cb1d92bc backout previous; (u_int) cast makes checks negative case too 2002-10-03 05:18:59 +00:00
itojun b8e0e408a4 check negative arg. from openbsd 2002-10-03 04:57:39 +00:00
itojun 77e92cfb1e check negative arg. from openbsd 2002-10-03 04:52:51 +00:00
thorpej e411f68839 Fix debug printf format. 2002-10-03 01:42:43 +00:00
thorpej 2b99f7cc34 Add a generic config finalization hook, to be called once all real
devices have been discovered.  All finalizer routines are iteratively
invoked until all of them report that they have done no work.

Use this hook to fix a latent bug in RAIDframe autoconfiguration of
RAID sets exposed by the rework of SCSI device discovery.
2002-10-01 18:11:57 +00:00
thorpej 1a6b241b1d Add a config_init() function to initialize the config data structures.
Normally this is called by configure(), but some ports (amiga, atari,
x68k) need to do this early because of how they find the console.
2002-09-30 17:36:31 +00:00
gmcgarry 395d77f3dc Back out __HAVE_CHOOSEPROC stuff. 2002-09-29 21:11:36 +00:00
thorpej bf97c13c6c Declare all cfattach structures const. 2002-09-27 20:41:46 +00:00
drochner 20d06f6b17 SI prefixes apply to decimal multiplies only. For binary (2^n) multiplies
the most "officially looking" is IEC 60027-2, ie "Ki", "Mi", ...,
which is not too popular, and which would require more code changes.
So stick with the traditional capital "K" for (divisor==1024), and use
the SI "k" otherwise (ie (divisor==1000)).
2002-09-27 18:37:43 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
thorpej 6ffacdd722 Oops, missed one place to use the STREQ() macro. 2002-09-27 06:30:05 +00:00
thorpej 64e87fb459 Skip pspec-less entries (root nodes) in cfparent_match(). This fixes
the "kernel crashes" component of PR #18433.
2002-09-27 06:12:55 +00:00
thorpej 97741f5198 Some ports (like Amiga) want to use the config machinery VERY early
(to initialize the console).  Support this when doing cfdriver lookup.
2002-09-27 05:45:03 +00:00
thorpej 6c88de3b53 Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller.  Use it
rather than invoking cfattach->ca_match directly.
2002-09-27 03:17:40 +00:00
thorpej d1ad2ac4f2 Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver.  The cfdriver is then looked
up in a list which is built at run-time.
2002-09-27 02:24:06 +00:00
wiz 079c182094 Kilo abbreviation is a small k (PR 18408). 2002-09-26 15:06:47 +00:00
thorpej fc0fe0347d Overhaul the way parent attachments are specified; instead of using
a vector of indices into the cfdata table to specify potential parents,
record the interface attributes that devices have and add a new "parent
spec" structure which lists the iattr, as well as optionally listing
specific parent device instances.

See:

    http://mail-index.netbsd.org/tech-kern/2002/09/25/0014.html

...for a detailed description.

While here, const poison some things, as suggested by Matt Thomas.
2002-09-26 04:07:35 +00:00
thorpej ca5fd3bd46 Garbage-collect the old rmap code. 2002-09-25 22:27:38 +00:00
thorpej 71404bb533 Don't include <sys/map.h>. 2002-09-25 22:21:01 +00:00
thorpej ac1b37ae05 Add support for multiple cfdata tables to the internals of the
autoconfiguration machinery, derived from PR #2112.

More work is left to do, including revamping how matches against
a candidate parent are done.
2002-09-23 23:16:06 +00:00
simonb 4e3613273b Remove breaks after returns, unreachable returns and returns after
returns(!).
2002-09-23 05:51:10 +00:00
simonb 333a151694 fp->f_count is unsigned, don't check if it's less than zero. 2002-09-23 04:19:16 +00:00
simonb 2a2b50a0d1 Don't return values in a couple of void functions. 2002-09-23 03:37:59 +00:00
jdolecek c0f46c2a40 check_pty(): make sure to zero the newly allocated pt_softc structure 2002-09-22 18:13:38 +00:00
chs 2b73cf7ece encapsulate knowledge of uarea allocation in some new functions. 2002-09-22 07:20:29 +00:00
gmcgarry 6a6ea308fd Separate the scheduler from the context switching code.
This is done by adding an extra argument to mi_switch() and
cpu_switch() which specifies the new process.  If NULL is passed,
then the new function chooseproc() is invoked to wait for a new
process to appear on the run queue.

Also provides an opportunity for optimisations if "switching to self".

Also added are C versions of the setrunqueue() and remrunqueue()
low-level primitives if __HAVE_MD_RUNQUEUE is not defined by MD code.

All these changes are contingent upon the __HAVE_CHOOSEPROC flag being
defined by MD code to indicate that cpu_switch() supports the changes.
2002-09-22 05:36:48 +00:00
manu 80ee637534 - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
2002-09-21 21:14:54 +00:00
christos 2d05cb6a47 Add special handling of VFS_GETARGS (similar to VFS_UPDATE) so that it
can be done non-root, and it does not affect the mount lists.
2002-09-21 18:07:52 +00:00
lha 4fa2032edc uppercase the lkm kernel-userspace dev macros and prefix them with LKM_
make modload print the bdev and cdev major when its a dev lkm
2002-09-18 22:59:36 +00:00
chs 9672ac098f add a new km flag UVM_KMF_CANFAIL, which causes uvm_km_kmemalloc() to
return failure if swap is full and there are no free physical pages.
have malloc() use this flag if M_CANFAIL is passed to it.
use M_CANFAIL to allow amap_extend() to fail when memory is scarce.
this should prevent most of the remaining hangs in low-memory situations.
2002-09-15 16:54:26 +00:00
tsutsui a4c0983618 Fix devsw_name2blk() to return the correct device name for devname arg.
Ok'ed by gehenna.
2002-09-15 14:29:01 +00:00
chs 0e83d71253 print a stack trace in the "spinout" case too. 2002-09-14 21:42:42 +00:00
gehenna a1d78935eb overload block/character into u_long field.
kern/18234: slightly modified
2002-09-13 13:08:53 +00:00
mycroft 30d477000a The entry point address for the interpreter must be adjusted by the text
section VMA on all platforms.  It just happens to 0 normally on everything but
MIPS.
2002-09-12 16:57:44 +00:00
gehenna fcba53f1a9 fix that no major numbers is assigned dynamically if the
not-listed-in-majors device switch is loaded.
2002-09-11 16:33:03 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
jdolecek 32fad21d27 regen: claim syscall slots for kqueue(2) and kevent(2) 2002-09-04 07:46:25 +00:00
jdolecek 281be34ad1 claim syscall slots for kqueue(2) and kevent(2) 2002-09-04 07:45:41 +00:00
jdolecek 4581b93651 Fix comments for #endif, to keep proper nesting and reflect reality.
Fixes kern/18162 by Roskens.
2002-09-04 06:34:21 +00:00
matt 48bbf5f234 Use the queue macros from <sys/queue.h> instead of referring to the queue
members directly.  Use *_FOREACH whenever possible.
2002-09-04 01:32:31 +00:00
sommerfeld 782a77d899 Initialize proc0.p_raslock to avoid a lock assertion on the first fork(). 2002-08-31 20:02:09 +00:00
hannken 815491c0b3 Remove the old device buffer queue interface.
Approved by: Jason R. Thorpe <thorpej@wasabisystems.com>
2002-08-30 15:43:36 +00:00
chs 2f11784ca7 only create a vmcmd for the BSS if there is any BSS. fixes PR 17834. 2002-08-29 06:31:21 +00:00
gmcgarry 366dfb04d7 Attempt to protect restartable atomic sequences of a traced process
being written to.  Breakpoints aren't good in a RAS.  This test isn't
infallible, since we can't protect memory which will be registered
as a RAS in the future.

Also, set the PC before attempting to single-step, so we can backout
from single-stepping.  Just in case we try to single-step into a RAS.
2002-08-28 07:27:14 +00:00
gmcgarry 14e30716d8 Regenerate: rasctl 2002-08-28 07:18:50 +00:00
gmcgarry 5bcbbd40bf MI kernel support for user-level Restartable Atomic Sequences (RAS). 2002-08-28 07:16:33 +00:00
itojun 6e85b03958 reduce diff w/ openbsd 2002-08-28 03:40:54 +00:00
christos fea7af3bbe - Implement passing AT_{R,E}{U,G}ID in the elf aux vector.
- Pass struct proc to copyargs
- fix svr4_copyargs functions
2002-08-26 21:07:38 +00:00
augustss 731d1eccf2 Get rid of sysctl for setting BCM2033 firmware path. It doesn't work
for ports that don't include files.usb, and it's also not done quite
the way it should.
2002-08-26 13:09:39 +00:00
scw a82718b34d Casting from a pointer, to a db_expr_t, has to go via an intptr_t.
(db_expr_t == int64_t on sh5, for example).
2002-08-26 11:34:27 +00:00
scw 41e5042829 Pointers must be cast to {,u}intptr_t before they can be cast to register_t,
at least on sh5, where sizeof(register_t) != sizeof(void *) in ILP32 mode.
2002-08-26 11:26:09 +00:00
thorpej 3767580d1a Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-26 01:26:29 +00:00
thorpej 79111bb802 Fix signed/unsigned comparison warnings from GCC 3.3. 2002-08-26 01:21:58 +00:00
thorpej d2f6f092f9 Avoid signed/unsigned comparison warnings from GCC 3.3. 2002-08-26 01:17:18 +00:00
thorpej fde1164ef5 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 23:23:22 +00:00
thorpej 88e741999d Fix signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 23:16:39 +00:00
thorpej 4d94adc849 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 23:15:21 +00:00
thorpej 4bec56201d Fix signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 22:51:05 +00:00
thorpej 556e3c90c4 Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-25 22:32:02 +00:00
thorpej c57c6b52cb Make uiomove()'s count argument a size_t rather than an int. 2002-08-25 22:28:40 +00:00
thorpej f1e8d159b0 Fix signed/unsigned conditional expression warning from GCC 3.3. 2002-08-25 21:47:50 +00:00
thorpej cc84cfd836 Fix signed/unsigned comparison warning from GCC 3.3. 2002-08-25 21:44:13 +00:00
thorpej 7055457a98 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 21:30:40 +00:00
thorpej 5f7ccd1634 Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-25 21:19:41 +00:00
thorpej cf013daeb3 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 21:18:15 +00:00
thorpej 139cdc3125 Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.
2002-08-25 20:21:33 +00:00
thorpej f02cb5ee27 Make hashinit() use unsigned quantities throughout. 2002-08-25 20:01:12 +00:00
thorpej d4a2567abe Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-25 19:13:08 +00:00
augustss cdbff56c90 Add sysctl support for hw.dev.ubtbcmfw (so I can set the firmware
path for my BCM2033).
2002-08-24 17:27:01 +00:00
lukem 141ac20efe only print "init: trying /some/init" if RB_ASKNAME or if it's not the first
path we're trying.  (the intent but not the behaviour of the previous rev.)
2002-08-24 00:47:17 +00:00
matt 2d290eb699 Use the qtype_FOREACH macros. Print out address of hook that could not
be disestablished.
2002-08-23 20:50:25 +00:00
lukem 76f5313c64 in start_init(), if RB_ASKNAME is set in boothowto, ask for the path
name to start up as init (rather than just cycling thru initpaths[]
and panicing when out of options).  if RB_ASKNAME isn't set, the old
behaviour remains.  inspired by changes in der Mouse's patchtree.
resolves [kern/18027] from me.
2002-08-23 06:17:08 +00:00
thorpej c196b51fad In sbcompress(), if we toss an empty mbuf, make sure to update
sb_lastrecord if necessary.

From Daniel Hartmeier <daniel@benzedrine.cx>.
2002-08-22 20:56:48 +00:00
thorpej b2cc5a4c03 Make use of page loaning for large socket writes the default. The
SOSEND_NO_LOAN option can be used to go back to the old behavior.
2002-08-21 05:13:36 +00:00
itojun fcfced244e avoid integer overflow during computation of nbuf. from enami 2002-08-21 02:48:54 +00:00
thorpej 95cb683cfb Don't pass VM_PROT_EXEC to pmap_kenter_pa(). 2002-08-14 15:21:31 +00:00
manu 04e1708030 In exit1(), moved the call to the emulation exit hook to a place where it is
safet to sleep.
2002-08-13 05:42:27 +00:00
jdolecek 60be0b94a0 selscan(): make flag[] const 2002-08-08 20:40:25 +00:00
itojun f3f3dd4992 cast register_t/size_t to u_long on printing.
From: Havard Eidnes <he@netbsd.org>
2002-08-08 14:43:40 +00:00
itojun f35b1daee4 remove debugging code leftover 2002-08-08 14:38:47 +00:00
briggs 487de1e6b9 Only include sys/pmc.h if PERFCTRS is defined. 2002-08-07 11:13:40 +00:00
briggs 0b956d0b8b Implement pmc(9) -- An interface to hardware performance monitoring
counters.  These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface.  Initially, the Intel XScale
counters are the only ones supported.
2002-08-07 05:14:47 +00:00
briggs 5b1917a886 Regen for pmc_get_info, pmc_control. 2002-08-07 04:54:29 +00:00
briggs a67324a44a New syscalls: sys_pmc_get_info and sys_pmc_control. 2002-08-07 04:52:53 +00:00
pooka 2bc5807797 Add FORK_CLEANFILES flag to fork1(), which makes the new process start out
with a clean descriptor set (ie. not copied or shared from parent).

for rfork()
2002-08-06 13:58:08 +00:00
manu 6e3939dc6a Move the call up exit hooks before curproc = NULL so that we can
use lockmgr in exit hooks.
2002-08-02 22:45:57 +00:00
soren f7f75af9c5 Make NAMEI_DIAGNOSTIC compile. 2002-08-02 04:49:35 +00:00
itojun 4f0c9c76b6 sync up with latest openbsd systrace.
- avoid race conditions by having seqno in ioctl
- better uid/gid tracking
- "replace" policy to replace args
- less diffs, as many of local changes were fed back to openbsd already

due to the 1st item, it was impossible for us to provide backward-compatibility
(new kernel + old bin/systrace won't work).  upgrade both.
2002-07-30 16:29:28 +00:00
thorpej 4c9de392fd Bring down a fix from the "newlock" branch, slightly modified:
* In pool_prime_page(), assert that the object being placed onto the
  free list meets the alignment constraints (that "ioff" within the
  object is aligned to "align").
* In pool_init(), round up the object size to the alignment value (or
  ALIGN(1), if no special alignment is needed) so that the above invariant
  holds true.
2002-07-30 01:41:00 +00:00
manu 08a69f7d15 Make killproc really public, and while we are there, constify. 2002-07-28 22:18:51 +00:00
enami 97d2db87f2 Cosmetic changes. 2002-07-26 06:04:57 +00:00
enami b81058e7fc Add some necessary but missing resource deallocation. 2002-07-26 06:04:12 +00:00
jdolecek 02eb342b57 Make sure that the pointer to old parent process for ptraced children
gets reset properly when the old parent exits before the child. A flag
is set in old parent process when the child is reparented in ptrace(2).
If it's set when process is exiting, all running processes have their
'old parent process' pointer checked and reset if appropriate. Also
change to use 'struct proc *' pointer directly, rather than pid_t.
This fixes security/14444 by David Sainty.

Reviewed by Christos Zoulas.
2002-07-25 20:04:02 +00:00
hannken 91f71a4f61 The buffer returned by BUFQ_PEEK must remain the same until BUFQ_GET is
called. It may be used as the "current" buffer.
2002-07-23 14:00:16 +00:00
jdolecek e462e316fb Make sure repeated TIOCSCTTY doesn't corrupt session hold count.
Fixes kern/17382 by David Laight.
2002-07-21 20:43:53 +00:00
hannken 7de36862a8 Rename bufq_init() to bufq_alloc().
Add bufq_free() to remove a buffer queue.
Avoid MALLOC while holding a spinlock.

From Chuck Silvers.
2002-07-21 15:32:17 +00:00
itojun 7f9bb4693b missing systrace_lock() around lock operation. sync w/openbsd, provos ok 2002-07-21 00:25:01 +00:00
thorpej 67b2a0cf06 * Add copyin_proc() and copyout_proc(), which are like copyin() and
copyout(), except they can operate on any process, not just curproc.
* Use this in uiomove() to allow UIO_USERSPACE to non-curproc.
2002-07-20 03:58:24 +00:00
itojun 09168838b3 comment clarification. from openbsd 2002-07-20 00:03:08 +00:00
itojun 9aa540391b add missing systrace_{un,}lock in systrace_poll. reported to provos.
don't use MALLOC() with variable size.  from openbsd.
2002-07-19 23:55:01 +00:00
christos 100356d547 remove __GNUC__ lossage. 2002-07-16 19:53:37 +00:00
hannken 10ff5e6607 Implement a new device buffer queue interface.
One basic struct, a function to setup a queue with a specific strategy and
three macros to put buf's into the queue, get and remove the next buf or
get the next buf without removal.

The BUFQ_XXX interface will be removed in the future.
The B_ORDERED flag is not longer supported.

Approved by: Jason R. Thorpe <thorpej@wasabisystems.com>
2002-07-16 18:03:17 +00:00
thorpej 64a96a4664 Rename DTYPE_SYSTRACE to DTYPE_MISC. DTYPE_MISC can now be used by
any misc. pseudo-device which requires cloning semantics.
2002-07-16 16:40:55 +00:00
matt 79d770a01a Add wchan to a panic (must have NOWAIT). 2002-07-11 17:18:48 +00:00
pooka 15d9246bb2 Add FORK_NOWAIT flag, which sets init as the parent of the forked
process. Useful for FreeBSD rfork() emulation.

ok'd by Christos
2002-07-11 10:37:26 +00:00
drochner c318ca38c7 fix off-by-one error in string len check 2002-07-10 19:04:09 +00:00
thorpej a08a4aecac Regenerate: Added __sigaction_sigtramp at #340. 2002-07-04 23:34:28 +00:00
thorpej 011d4d5f44 Add kernel support for having userland provide the signal trampoline:
* struct sigacts gets a new sigact_sigdesc structure, which has the
  sigaction and the trampoline/version.  Version 0 means "legacy kernel
  provided trampoline".  Other versions are coordinated with machine-
  dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
  the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
  trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions.  Instead,
  sendsig() looks up the handler by peeking in the sigacts for the
  process getting the signal (since it has to look in there for the
  trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
  its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later.  Kernel
version not bumped; we will ride the 1.6C bump made recently.
2002-07-04 23:32:02 +00:00
thorpej 2807c6789c Rename SB_UPDATE_TAIL() to SB_EMPTY_FIXUP(), per suggestion from
Jonathan Stone.
2002-07-03 21:39:40 +00:00
thorpej 668640a43d Rename sbappend_stream() to sbappendstream(), per suggestion from
Jonathan Stone.
2002-07-03 21:36:57 +00:00
thorpej 0585ce1489 Make insertion of data into socket buffers O(C):
* Keep pointers to the first and last mbufs of the last record in the
  socket buffer.
* Use the sb_lastrecord pointer in the sbappend*() family of functions
  to avoid traversing the packet chain to find the last record.
* Add a new sbappend_stream() function for stream protocols which
  guarantee that there will never be more than one record in the
  socket buffer.  This function uses the sb_mbtail pointer to perform
  the data insertion.  Make TCP use sbappend_stream().

On a profiling run, this makes sbappend of a TCP transmission using
a 1M socket buffer go from 50% of the time to .02% of the time.

Thanks to Bill Sommerfeld and YAMAMOTO Takashi for their debugging
assistance!
2002-07-03 19:06:47 +00:00
yamt d96bff0e27 add KSTACK_CHECK_MAGIC. discussed on tech-kern. 2002-07-02 20:27:44 +00:00
itojun 0a9d2ad2d7 provide KERN_URND, which extracts sizeof(int) random number from the kernel
(similar to /dev/urandom, for use within chroot jail).
2002-07-02 17:06:17 +00:00
thorpej 11bb3d047b Avoid NULL pointer dereference. kern/17438, xs@kittenz.org. 2002-07-02 16:22:28 +00:00
thorpej f055878614 Fix using poll(2) on systrace descriptors. 2002-07-02 16:16:33 +00:00
thorpej 10c252ba47 Changes to allow the IPv4 and IPv6 layers to align headers themseves,
as necessary:
* Implement a new mbuf utility routine, m_copyup(), is is like
  m_pullup(), except that it always prepends and copies, rather
  than only doing so if the desired length is larger than m->m_len.
  m_copyup() also allows an offset into the destination mbuf, which
  allows space for packet headers, in the forwarding case.
* Add *_HDR_ALIGNED_P() macros for IP, IPv6, ICMP, and IGMP.  These
  macros expand to 1 if __NO_STRICT_ALIGNMENT is defined, so that
  architectures which do not have strict alignment constraints don't
  pay for the test or visit the new align-if-needed path.
* Use the new macros to check if a header needs to be aligned, or to
  assert that it already is, as appropriate.

Note: This code is still somewhat experimental.  However, the new
code path won't be visited if individual device drivers continue
to guarantee that packets are delivered to layer 3 already properly
aligned (which are rules that are already in use).
2002-06-30 22:40:32 +00:00
yamt 5154ea5e5b constify diskerr(). 2002-06-28 16:37:20 +00:00
itojun 67c6a98161 disallow ktrace on P_SUGID. from openbsd 2002-06-28 01:59:36 +00:00
christos c96f693db0 PR/17407: Jim Wise: Systrace does not work without procfs.
FIX: use process_domem as thorpej suggested.
2002-06-27 13:22:54 +00:00
wrstuden 6b88bf15ae If we're in a chroot, and we are looking up '..', make sure we are
still in the chroot. If not, teleport the lookup to the chroot
and log. Closes an assisted-jail escape method pointed out by
xs@kittenz.org. Patch from xs@kittenz.org and myself
2002-06-21 02:19:12 +00:00
eeh 4283dfcbf3 Use the number of args in the sysent rather than calculating it from the
sysent's argsize.  It should be faster and fix 32-bit compat emulations.
2002-06-19 23:35:35 +00:00
fvdl 87b285ba0d Repair damage done in systrace commit. Since argsize is nog longer
passed, assume it's sy_narg * sizeof (register_t). The code
made this assumption implicitly anyway. Fixes compat_*32 tracing.
2002-06-18 08:01:30 +00:00
thorpej 2d2b1d78ae sys_fpathconf: Don't panic in the default case; just return EOPNOTSUPP. 2002-06-18 02:04:08 +00:00
thorpej 5cbb1e82f1 * Don't bother protecting the body of the source file with #ifdef SYSTRACE.
It's not even built if the option isn't present.
* Use cdev_decl() to generate prototypes for the devsw functions.
* Minor whitespace cleanup.
* Nuke the SYSTR_CLONE ioctl from orbit; instead, just clone it in
  systraceopen(), like we do with svr4_net.
2002-06-18 01:24:15 +00:00
christos acf2d4083d Niels Provos systrace work, ported to NetBSD by kittenz and reworked... 2002-06-17 16:22:50 +00:00
matt 91650be524 Fix 2 bugs with MSG_WAITALL. The first is to not block forever if one is
trying to MSG_PEEK for more than the socket can hold.  The second is that
before sleeping waiting for more data, upcall the protocol telling it you
have just received data so it can kick itself to re-fill the just drained
socket buffer.
2002-06-11 00:21:33 +00:00
he a8c83879a2 In soreceive(), if any part of a received record has been freed,
and an error occurs, make sure the socket doesn't retain a partial
copy by dropping the rest of the record.

This would otherwise trigger a panic("receive 1a") under DIAGNOSTIC.

Fixes PR#16990, suggested fix adapted.

Reviewed by Matt Thomas.
2002-06-10 20:43:16 +00:00
drochner 49c4cfb2c5 provide a db_vprintf() which is exactly what the name suggests 2002-06-05 17:53:52 +00:00
simonb 4c67158999 Use "#ifdef __mips__" instead of "#ifdef mips"; shared libraries work
for kernels compiled with gcc 3.x.
2002-06-03 13:07:00 +00:00
lukem 06de426449 SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field).  whilst it's O(n),
  this mirrors the functionality of SLIST_REMOVE() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
  this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
2002-06-01 23:50:52 +00:00
itojun 1638da93e1 support setsockopt() with larger data (up to MCLBYTES).
From: Hitoshi Asaeda <Hitoshi.Asaeda@sophia.inria.fr>
2002-05-31 20:33:11 +00:00
atatat c52a7f3287 "a.out" -> "elf" in a comment 2002-05-31 16:49:12 +00:00
eeh cfee9f2e02 Since a register_t is probably not an int, don't try to print it with %d. 2002-05-31 01:10:35 +00:00
eeh 45a9507815 Native 32-bit and 32-bit emulation are mutually exclusive. We should not
even try to execute 32-bit binaries as native on a 64-bit kernel.
2002-05-31 00:52:20 +00:00
itojun ae5a9e211d re-scan all ifnet after domaininit() for if_afdata initialization. 2002-05-27 13:46:45 +00:00
perseant 43ca783b4a Back out rev 1.174 of vfs_subr.c, because the splbio() wasn't protecting
enough to be useful, and broadening it so that it did would have meant
that operations possibly requiring synchronous disk activity would have
to be done in splbio().  This clearly was not going to work.

Worked around this in the LFS case by having lfs_cluster_callback put an
extra hold on the vnode before calling biodone(), and taking the hold
off without HOLDRELE's problematic list swapping.  lfs_vunref() will take
care of that---in thread context---on the next write if need be.

Also, ensure that the list walking in lfs_{writevnodes,segunlock,gather}
takes into account the possibility that the list may change
underneath it (possibly because it itself deleted an element).

Tested on i386, test-compiled on alpha.
2002-05-23 23:05:25 +00:00
itojun e54108f021 in m_aux_delete, no need to chase beyond victim. from Archie Cobbs, sync w/kame 2002-05-23 05:45:34 +00:00
thorpej e839580821 Move kernel_lock manipulation info functions so that they will
show up in a profile.
2002-05-21 01:38:26 +00:00
perseant ec0ca919be Protect v_freelist with splbio(), since HOLDRELE can be called in
interrupt context (through brelvp).  (LFS may be the only subsystem
affected by this problem.)

Tested on i386.
2002-05-20 22:50:57 +00:00
matt 0dc8ee943d Eliminate more commons or redundant declarations. 2002-05-14 02:58:32 +00:00
matt 44b3464a48 debug0, debug1, debug15 are defined elsewhere. XXX there needs to a
better was of doing this.
2002-05-13 07:13:58 +00:00
matt 0cb85bc7b9 Eliminate commons. 2002-05-12 23:06:27 +00:00
matt e89ff519c5 Make domains extern. 2002-05-12 20:36:58 +00:00
enami af81fabf7c Remove #ifdef DIAGNOSTIC around panic(). It is better than NULL pointer
dereference.
2002-05-11 11:56:57 +00:00
enami 3700fdfba4 Don't release the lock on mount point vnode so early when doing update mount.
Otherwise, race condition occurs (e.g., between mountd(8) and next mount(8)
when multiple update mount command is invoked from shell script).
2002-05-11 00:45:06 +00:00
atatat de7144e830 Maintain a short list of the actual descriptors that were closed and
log that intead of being ambiguous about which of 0, 1, and/or 2 it
was that was closed.
2002-05-09 17:57:07 +00:00
thorpej f1f51aa2b8 Move code shared by procfs and the kernel proper out of procfs and
into the kernel proper (renaming functions from procfs_* to process_*).
2002-05-09 15:44:44 +00:00
enami b42b2c8323 In soreceive(), don't call sopendfree() if MSG_DONTWAIT is set
since it may sleep.  nfsrv_rcv() tries to do its jobs in softintr
handler as far as possible.
2002-05-07 08:06:35 +00:00
eeh 80ef33c4c1 Back out previous. 2002-05-03 01:22:30 +00:00
thorpej 654768f185 Let the sosend_loan() path be selected at run-time; patch the variable
use_sosend_loan to enable/disable it.  The SOSEND_LOAN kernel option
now causes it to default to 1.
2002-05-03 00:35:14 +00:00
eeh 89e107d917 Regen. 2002-05-03 00:22:16 +00:00
eeh edc73e0d53 Move the copyout out of ntp_adjtime1 and into the syscall wrapper. 2002-05-03 00:22:15 +00:00
eeh 679cac37b9 Regen. 2002-05-03 00:22:15 +00:00
eeh 9bd29db83b Use #if defined(_LP64) to determine if we're generating 64-bit binaries,
not #if defined(alpha).
2002-05-03 00:20:56 +00:00
thorpej 7a49fee765 Add some experimental page-loaning for writes on sockets. It is disabled
by default, and can be enabled by adding the SOSEND_LOAN option to your
kernel config.  The SOSEND_COUNTERS option can be used to provide some
instrumentation.

Use of this option, combined with an application that does large enough
writes, gets us zero-copy on the TCP and UDP transmit path.
2002-05-02 17:55:48 +00:00
enami e54e7305a2 - Fix more and more white space nits.
- ANSIfy the last K&R function definition in this file.
2002-05-02 13:38:57 +00:00
enami cb3d9867b6 Log who invoked the s[ug]id program. Tested by mozilla. 2002-04-28 22:35:19 +00:00
enami 88ee31f5b9 Fix the return value of logioctl() for unhandled ioctl; return EPASSTHROUGH
instead of -1.  Fix suggested by Andrew Brown.
2002-04-28 04:13:51 +00:00
thorpej 143be0a01b Use M_READONLY() rathern than a home-grown M_SHAREDCLUSTER(). 2002-04-28 00:53:34 +00:00
enami 9a9bf29bcf A loop to expand file descriptor table and retry is move from fdalloc()
to caller.  So, no longer need to loop in fdalloc().
2002-04-27 21:36:50 +00:00
enami a58680a4e2 KNF. 2002-04-27 21:31:41 +00:00
christos ce8e03cd9f Avoid file use underflow; thanks to YAMAMOTO Takashi for noticing. 2002-04-24 16:09:24 +00:00
christos 7ad1c0f407 Don't forget to set mature and unuse the file. 2002-04-23 17:20:58 +00:00
christos 1261c89715 From OpenBSD, via FreeBSD: If a set{u,g}id binary is invoked with fd < 3
closed, open those fds to /dev/null.

XXX: This needs to be fixed in a better way. The kernel should not need to
know about /dev/null or special case 0, 1, 2.
2002-04-23 15:11:25 +00:00
simonb b0b78e1e37 Fix a white-space nit. 2002-04-20 06:04:35 +00:00
gmcgarry acb682fad2 When searching for devices also skip those deleted by userconf.
Problem reported by uwe.
2002-04-15 05:30:12 +00:00
christos 7d930e8572 Use SESSHOLD and SESSRELE consistently.
Add SESSHOLD and SESSRELE to the t_session, so that we don't have dangling
references [inspired by OpenBSD].
2002-04-12 17:02:33 +00:00
matt 2bf9358fc0 Don't use the tqh_ field names, instead use the correspond TAILQ_* macro. 2002-04-06 08:04:17 +00:00
thorpej 605e664094 vfs_mountroot(): provide more info when we panic. 2002-04-04 01:44:30 +00:00
fvdl c2bf6c9615 Split off the backend of the shmat system call, and find removed segments
if requested. This enables the linux compat code to be bug compatible
(under Linux, shmat() to a removed segment works).
2002-04-03 11:53:01 +00:00
fvdl 8cc2d64d7a Include opt_malloc_debug.h so that debug_malloc will actually be used
when enabled, thankyouverymuch.
2002-04-03 09:45:22 +00:00
simonb 8bcefa5e82 Fix a typo that stopped this compiling in the !LKM case.
Remove the buf2 variable from sysctl_sysvipc(), which was only ever
 assigned to but not used.
2002-04-03 08:06:17 +00:00
rafal 8fcad97302 Fix up linux a.out compat entry after move of emul-related sysctl handler
to struct emul.
2002-04-02 23:56:17 +00:00
jdolecek 3ffbb4470d make emul_sysctl() work with emulations loaded via LKM, properly bound check
name[0]
2002-04-02 20:21:51 +00:00
jdolecek ebd670f0bc move emulation-specific sysctl hook from struct execsw to struct emul,
where it belongs
2002-04-02 20:19:59 +00:00
jdolecek 2e327b16be expose emul_search() 2002-04-02 20:18:06 +00:00
itohy ab5fe01c20 Print ttyinfo *before* (not after) sending SIGINFO to processes.
This generates more useful information of a process who catches SIGINFO,
rather than always printing "runnable" (the process is marked runnable
because of the signal).
Inspired by the behavior of BSD/OS.
2002-03-25 04:26:43 +00:00
jdolecek 943f2b4f8a make COMPAT_11 or COMPAT_12 imply EXEC_ELF_NOTELESSS
use #if for the execsw entries, to allow 'options EXEC_ELF_NOTELESS=0'
  to override this

This addresses kern/13520 and kern/14409 by Matthew Green.
2002-03-23 09:50:54 +00:00
jdolecek 083f26646d rename EXEC_ELF_CATCHALL to EXEC_ELF_NOTELESS 2002-03-23 09:40:55 +00:00
jdolecek 225f07a8d4 Make sure file descriptor is properly FILE_UNUSE()d in error case
of writev(2).
Problem found by Alistair G. Crooks.
2002-03-22 18:58:59 +00:00
christos 195539260e emulation specific sysctls. 2002-03-20 00:27:25 +00:00
oki 075769476a Use /emul/pecoff as prefix to run PE/COFF binaries. 2002-03-18 07:11:06 +00:00
christos 18c7399ada oops, forgot to commit the caller of exithook... 2002-03-17 23:41:30 +00:00
christos 22839acdb9 use the exithook mechanism to clean up semaphores. 2002-03-17 22:21:58 +00:00
christos f7d98e2451 - merge all the hook insertion and deletion code so that we don't create
a fourth copy.
- add exithook to be executed when a process exits.
2002-03-17 22:19:20 +00:00
atatat 31144d9976 Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command".  ERESTART is -1, which can lead to
confusion.  ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4.  No ioctl code should now return -1 anywhere.  The
ioctl() system call is now properly restartable.
2002-03-17 19:40:26 +00:00
thorpej 53df727d27 Add a new ptrace request, PT_IO, as proposed by Artur Grabowski
on the <bsd-api-discuss@wasabisystems.com> mailing list.  PT_IO
is a more general inferior I/D space I/O mechanism.  FreeBSD and
OpenBSD have also added PT_IO.

From lha@stacken.kth.se, kern/15945.
2002-03-17 17:02:45 +00:00
simonb 1f467013b2 White space nits. 2002-03-17 11:15:49 +00:00
simonb 21d2b8b53d We don't need to include <uvm/uvm_extern.h> before <sys/sysctl.h> anymore. 2002-03-17 11:10:43 +00:00
chs 4d4825010d fix bread() to return errors from reading past the end of the device.
back in rev. 1.51, bread() and breadn() were changed to assume that
if B_DONE is set on a buffer returned by bio_doread(), that the buffer
must have already been in the cache, and thus the overall bread() should
return success.  but if the requested buffer is not in the cache and
is past the end of the device, bounds_check_with_label() will set B_ERROR
on the buffer and the caller will call biodone(), which will cause bread()
to think the buffer was already in the cache and thus return success.
to fix this, undo rev. 1.51 and instead have biowait() treat both B_DONE
and B_DELWRI as indicators that it doesn't need to sleep waiting for an
i/o to complete.
2002-03-16 23:49:59 +00:00
mjacob ad97873103 size_t is a long on alpha. I forget whether there's actually a 'best'
kernel printf format arg to print size_t in NetBSD, but coercing the
arg to long probably works well enough.
2002-03-16 22:44:41 +00:00
eeh 8bf657ddf1 Don't forget to allocate space for the property name's trailing NUL. 2002-03-15 20:33:50 +00:00
jdolecek fcc4c4d402 Merge the update to FreeBSD rev 1.95.
Changes:
* MP locking changes (mostly FreeBSD specific)
  XXXSMP the MP locking macros are noops on NetBSD for now
* kevent fix (FreeBSD rev. 1.87): when the last reader/writer
  disconnects, ensure that anybody who is waiting for the kevent
  on the other end of the pipe gets EV_EOF
* kill __P
2002-03-13 21:50:24 +00:00
simonb f81b8604f8 Move 'struct pool_cache_group' definition into <sys/pool.h> 2002-03-13 10:57:18 +00:00
simonb 4067afd322 Remove two instances of an "error" variable that is only ever assigned to
but not used.
2002-03-13 08:12:58 +00:00
thorpej d100f2ae43 Put back pool_prime(); the i386 mp pmap uses it. 2002-03-09 18:06:54 +00:00
bjh21 dca4ae94d6 When checking that a potentially-unsigned enum is >= 0, assign it to an int
first.  This is necessary to avoid warnings with -fshort-enums.  Casting
to an int really should be enough, but turns out not to be.

This change will be documented in doc/HACKS.
2002-03-09 13:22:52 +00:00
thorpej 59a96297ef Fix a couple of typos in simple_{,un}lock()'s. 2002-03-09 05:14:33 +00:00
thorpej c4a2ca6a3e Remove pool_prime(). Nothing uses it, and how it should be used it not
really well-defined in the absense of PR_STATIC.
2002-03-09 01:56:27 +00:00
thorpej e21319b482 Make mbpool and mclpool use the new drain hook facaility. Adjust
m_reclaim() to match the drain hook signature.  This allows us to
delete m_retry() and m_retryhdr(), as the pool allocator will now
perform the reclaimation step for us.

From art@openbsd.org.
2002-03-09 01:46:32 +00:00
thorpej 4be86fcc13 If, when a page becomes idle, the backend allocator is waiting for
resources, release the page immediately, rather than letting it sit
around cached.

From art@openbsd.org.
2002-03-09 01:37:19 +00:00
thorpej d54150e78a Remove PR_MALLOCOK and PR_STATIC. The former wasn't actually used,
and the latter, while there was some code tested the bit, was woefully
incomplete and also unused by anything.  Besides, PR_STATIC functionality
could be better handled by backend allocators anyhow.

From art@openbsd.org
2002-03-09 01:33:33 +00:00
thorpej ce635a702a Add a missing simple_unlock. 2002-03-08 21:43:54 +00:00
thorpej 8cdc6121b7 Add an optional "drain" client callback, which can be set by the new
pool_set_drain_hook().  This hook is called in three cases:
* When a pool has hit the hard limit, just before either erroring
  out or sleeping.
* When a backend allocator fails to allocate memory.
* Just before trying to reclaim pages in pool_reclaim().

This hook requests the client to try and free some items back to
the pool.

From art@openbsd.org.
2002-03-08 21:41:59 +00:00
thorpej 7c94c68f10 Remove PR_FREEHEADER; nothing uses it anymore.
From art@openbsd.org.
2002-03-08 20:51:25 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
nathanw 3f0d660168 Make the debugging printfs compile:
- printf format checking doesn't like %x for pointers; use %p like we should.
 - LP64 fixes.
2002-03-05 23:28:58 +00:00
simonb bc7301d415 nlinesw is already declared in <sys/conf.h>. 2002-03-04 02:32:58 +00:00
simonb 8ecad242b9 Use <sys/disk.h> for the prototype of disk_init() rather than declaring
our own locally.
2002-03-04 02:30:27 +00:00
simonb 9a942a34e0 Don't use local extern declarations for the mountroot variable or
declare local prototypes for nfs_mountroot() or md_root_setconf().
2002-03-04 02:25:21 +00:00
mrg d3b3f3e560 move the COMPAT_SUNOS TIOCGPGRP handling in the compat sunos code proper.
this is the final fix needed for it to run properly as an LKM.  no more
COMPAT_SUNOS hacks around the tree!
2002-03-02 12:30:43 +00:00
thorpej 92eb54d5a5 Don't assign NULL to non-pointer variables. 2002-02-28 04:43:16 +00:00
manu 89e46d8a99 Reworked the o32/n32 matching scheme. IRIX uses some e_flags in the ELF
header to distinguish between o32, n32 and n64 ABIs. We now use this.
This suppress the need of the mips_option test, which had some fake positive.
This also removes the mandatory ordering of n32 vs o32 in the exec switch
(exec_conf.c)
2002-02-21 21:53:00 +00:00
christos 8ec87caa7f ICANON is in lflags, by Neelkanth Natu 2002-02-17 19:34:42 +00:00
enami 3528e53ca0 Use sizeof correctly. Fixes PR#15613. 2002-02-16 02:11:43 +00:00
enami 233c254079 - Wrap long line.
- Remove unnecessary semi-colon.
2002-02-16 02:07:56 +00:00
simonb 14ac06f0bd Add a "show event" ddb command to show the event counters. 2002-02-15 11:18:26 +00:00
chs b744097a5f allow writing to write-only mappings. fixes PR 3493. 2002-02-14 07:08:02 +00:00
thorpej daaeb3910f const char *mclpool_warnmsg -> const char mclpool_warnmsg[]
Noted by Matt Thomas.
2002-02-12 00:52:33 +00:00
jdolecek 5798a9a710 Switch default for pipes to the faster John S. Dyson's implementation.
Old, socketpair-based ones are available with option PIPE_SOCKETPAIR.
2002-02-11 18:11:41 +00:00
chs 9784635eb6 getblk()'s "block size invariant" isn't valid for VBLK vnodes
since bounds_check_with_label() will truncate a buffer that crosses
the end of the partition.  adjust the assertion to account for this.
fixes PRs 7938, 12156, 12698, 13076, 13210 and 13288.
2002-02-10 23:14:18 +00:00
bouyer 149c671b66 extent_alloc_subregion1(): when a candidate region doesn't fit after being
rounded up to respect boundary limits, adjust newstart and last before
skiping to the next region. Otherwise we may check the same candidate
region against the start of the next region, no the one immediatly following
the hole, leading to corrupted map.

This fixes the panic seen on sparc64 with scsi drivers, and probably fixes
PR 15489.
2002-02-09 01:00:09 +00:00
christos 980af1007c Andrew Brown found that we overflowed all cases in the TTLINEDNAMELEN.
ouch.
2002-02-08 18:36:53 +00:00
thorpej 7380aa1467 Add a "ddb" command (if DDB is configured into the kernel) for
easy, convenient dropping into DDB at the "root device: " prompt.
Useful if your console can't do it w/o actually taking an interrupt
and you want to, say, look at the boot messages.
2002-02-08 00:58:58 +00:00
chs 90503a3cda add an assert (hopefully to find where we recycle vnodes without
freeing all the pages, like I've seen recently).
2002-02-05 07:50:58 +00:00
tls eeda20f137 Kick DEFAULT_MAXPTYS from 256 to 992 2002-02-02 07:18:55 +00:00
kleink 12135360cf fcntl(..., F_GETOWN, ...): fix LP64-BE bug; raised by der Mouse
on tech-kern.
2002-01-31 22:17:33 +00:00
kleink 935d56d508 Add {POSIX_MONOTONIC_CLOCK} variables. 2002-01-31 00:32:47 +00:00
simonb 346fc0519d Implement the CLOCK_MONOTONIC clock for the posix/opengroup realtime
clock_() functions.  This simply returns the kernel mono_time variable.
As discussed on tech-kern.
2002-01-31 00:13:07 +00:00
thorpej 07d023a3aa Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.
2002-01-28 22:15:54 +00:00
simonb 4aceab2a3d Remember to update the "size copied" counter in sysctl_diskstats(). 2002-01-28 03:33:55 +00:00
simonb 9e42930807 Use TAILQ_FOREACH(). 2002-01-28 03:12:13 +00:00
simonb bfc71f3c10 Add sysctls to read tk_{nin,nout,cancc,rawcc} (under a kern.tkstat node).
"extern" those variables in <sys/dkstat.h>, and add declarations for them
in sys/tty.c
2002-01-28 02:06:02 +00:00
lukem fea75ff830 - kern.maxvnodes: only call vfs_reinit() and nchreinit() if the value
was successfully changed.  previously, successfully viewing the
  current value would flush the cache :-/
- similarly, don't change hostid and sb_max unless the value was
  successfully changed
2002-01-27 13:33:36 +00:00
simonb ed6b438e40 Implement the hw.disknames and hw.diskstats sysctl's that have been listed
in <sys/sysctl.h> since day one but never implemented.
2002-01-27 12:41:07 +00:00
christos 83990b1879 Clear the P_INEXEC flag in other labels. Pointed out by he@netbsd.org 2002-01-12 14:20:30 +00:00
christos d4e7e4c9c4 Fix a ptrace/execve race that could be used to modify the child process's
image during execve. This is a security issue because one can
do that to setuid programs... From FreeBSD.
2002-01-11 21:16:27 +00:00
manu 4398be0cfc Added code to correctly match and launch o32 and n32 IRIX binaires (note that
there is n support yet in the kernel for running n32 binaries)
2002-01-07 22:07:37 +00:00
dbj d5738f5104 add support for the `D' kgdb detach command
add comment about minimum requirement for KGDB_BUFLEN
2002-01-05 22:57:38 +00:00
thorpej 21df9c4a6e Switch ELF emulations to ELF core files (except for netbsd32 and svr4-32). 2002-01-04 06:47:46 +00:00
mrg d6328a8778 fix previous: actually remove the COMPAT_SUNOS code, not just #if 0 it. 2002-01-03 01:16:02 +00:00
mrg af640de164 move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code.  besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
2002-01-03 00:59:00 +00:00
perry dc0e791802 Happy New Year! 2002-01-01 09:17:28 +00:00
ad 281fb6d209 In clalloc(), clear the quoted char bitmap (part of the ring buffer was
being cleared twice).
2001-12-27 02:27:50 +00:00
christos eebee4d7f8 PR/14795: Christos Zoulas: Fix locking problem on MP systems where
ltsleep() is calling CURSIG() which can call issignal() and issignal()
could not deal with being called from a locked context. This happens
when a process receives SIGTTIN, and issignal() calls psignal() to
post SIGCHLD to the parent.

XXX: It is really messy to have issignal() handle the job control
functionality and the whole signal interlocking protocol needs to
be re-designed. For now this fix (provided by enami) does the trick.
I've been running with this fix for weeks, and atatat has stress-tested
the kernel running ~30 make kernels...
2001-12-18 15:51:52 +00:00
chs a8b519c880 unmap loaned pages before dropping the loan. some pmaps aren't
expecting pmap_kenter_pa() to be used to replace an existing mapping,
plus it just seems like a bad idea to keep around mappings of pages
that may be freed and reused.
2001-12-18 08:49:40 +00:00
jdolecek d7129f9255 fix typo in #ifdef __FreeBSD__
Pointed out by Chris Jepeway in private e-mail, thanks!
2001-12-11 18:15:09 +00:00
thorpej 0b63bf16b8 Cast off_t to (long long) for printing. 2001-12-10 02:07:37 +00:00
thorpej 06920aef28 Move the code that walks the process's VM map during a coredump
into uvm_coredump_walkmap(), and use callbacks into the coredump
routine to do something with each section.
2001-12-10 01:52:26 +00:00
enami 8d6b971560 KNF. 2001-12-10 01:49:26 +00:00
chs 62c2e756ed update vnode flags in ddb vnode-printing function. 2001-12-10 01:38:48 +00:00
thorpej f884f172e3 Don't compare an int against NULL. 2001-12-10 00:33:04 +00:00
thorpej 51535d4bf5 Add support for dumping ELF-cormat core files. 2001-12-09 23:05:56 +00:00
manu 3cdc6f6197 Changed clocktl interface to use syscallargs structures 2001-12-09 16:10:43 +00:00
chs 8e9cdbbd63 replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names. 2001-12-09 03:07:43 +00:00
lukem 290cc55a28 - Implement
uint32_t namei_hash(const char *p, const char **ep)
  which determines the equivalent MI hash32_str() hash for p.
  If *ep != NULL, calculate the hash to the character before ep.
  If *ep == NULL, calculate the has to the first / or NUL found, and
  point *ep to that location.
- Use namei_hash() to calculate cn_hash in lookup() and relookup().
  Hash distribution goes from 35-40% to 55-70%, with similar profiled
  time spent in cache_lookup() and cache_enter() on my P3-600.
- Use namei_hash() to calculate cn_hash in nfs_readdirplusrpc(),
  insetad of homegrown code (that differed from that in lookup() !)
  namei_hash() has better spread and is faster than previous code
  (which used a non-constant multiplication).
2001-12-08 04:09:59 +00:00
enami df8cfd38a2 Test ".." correctly when creating reverse cache entry. 2001-12-08 04:09:56 +00:00
thorpej 205c159f0e Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
2001-12-08 00:35:25 +00:00
jdolecek 3d4c59a8ee Back off previous for now, Jason thinks it's not right. Will discuss
on tech-kern@
2001-12-07 07:09:29 +00:00
christos d343ff07bf remove diagnostic test checking for cr_ref = 0. It will never be, because
free() will stick 0xdeadbeef into it.
2001-12-06 23:11:59 +00:00
jdolecek 255ce12e50 replace FIF_WANTCLOSE/FIF_LARVAL with FWANTCLOSE/FLARVAL, which are set
in f_flag of struct file
for now, keep former f_iflags of struct file as _f_spare0, it will be g/c'ed
when struct file will be changed (this will happen soon)
2001-12-06 22:34:24 +00:00
chs 163b4fbc50 in vinvalbuf(), vtruncbuf() and vflushbuf(), don't skip calling
VOP_PUTPAGES() just because the vnode has no pages.  layered filesystems
will want to pass these calls on through to the underlying filesystem,
and non-layered filesystems may need to remove the vnode from the
syncer queues.  fix up MP locking and add some locking assertions.
fixes PRs 12284 and 14640.
2001-12-06 04:34:33 +00:00
augustss 88b5ed0731 Use NULL instead of 0 in a few places. 2001-12-05 16:12:42 +00:00
enami 4654f5c754 Implement sigismasked() correctly. KNF while I'm here. 2001-12-05 07:32:24 +00:00
enami 996ee10484 Introduce new function malloc_roundup(), suggested by Bill Sommerfeld
on tech-kern.
2001-12-05 01:29:04 +00:00
thorpej 03efee5585 * Allow machine-dependent code to specify hooks for ptrace(2)
(__HAVE_PTRACE_MACHDEP) and procfs (__HAVE_PROCFS_MACHDEP).
  These changes will allow platforms like x86 (XMM) and PowerPC
  (AltiVec) to export extended register sets in a sane manner.

* Use __HAVE_PTRACE_MACHDEP to export x86 XMM registers (standard
  FP + SSE/SSE2) using PT_{GET,SET}XMMREGS (in the machdep
  ptrace request space).
* Use __HAVE_PROCFS_MACHDEP to export x86 XMM registers via
  /proc/N/xmmregs in procfs.
2001-12-05 00:58:05 +00:00
enami 769949847d KNF and other cosmetic changes. 2001-12-04 23:56:36 +00:00
jdolecek c152d680d8 Add M_CANFAIL malloc(9) flag. This flag changes behaviour in M_WAITOK
case when the requested memory size can't ever be granted - instead
of panic, malloc(9) would return failure (NULL).
Note kernel code should do proper bound checking, rather than
depend on M_CANFAIL. This flag is only supposed to be used in very
special cases, where common bound checking is not appropriate.

Discussed on tech-kern@, name ``M_CANFAIL'' suggested by Chuck Cranor.
2001-12-04 20:13:19 +00:00
augustss 20e5de88af Add IRFRAMEDISC line discipline.
Also, use symbolic names instead of numbers in a few places.
2001-12-03 23:30:37 +00:00
augustss d845d14a6c Move the code that expands the cd_devs array into a subroutine. 2001-12-02 02:40:57 +00:00
kleink e9d7166203 asm -> __asm. 2001-11-30 16:21:16 +00:00
msaitoh 1c87566f38 fix previous commit 2001-11-30 10:31:32 +00:00
msaitoh 797d100f77 fix printf format 2001-11-30 10:06:46 +00:00
enami b3d722b5b5 Since we know that `va' is non-NULL here, no need to test if it is NULL. 2001-11-30 01:54:21 +00:00
enami ba7af71cd5 Use cached pointer to next buf instead of re-fetching it. GCC actually
generates different code.
2001-11-30 01:31:30 +00:00
christos 0fdce3fa8a sprinkle crcvt() 2001-11-29 21:21:29 +00:00
christos 2a73d40eab introduce crcvt() that converts from struct uucred to struct ucred. 2001-11-29 21:21:13 +00:00
manu 9d2b93114a Updated comment about COMPAT_IRIX: we start working on o32 first... 2001-11-28 11:45:36 +00:00
bouyer 1cd410986d In cn_get_magic() don't increment i in the for(;;) loop, as it's already
set to point to the next value with CNS_MAGIC_NEXT().
Now it's obvious that the magic string on my U5 is +++++ and not +++ :)
2001-11-27 20:00:36 +00:00
jdolecek 577b809930 crfree(): add DIAGNOSTIC sanity check of cr_ref; unfortunately, if the memory
is freed prematurely the check won't be triggered immediatelly, probably
since the memory is likely to be reused fast; but it _would_ be triggered
eventually
2001-11-27 07:30:03 +00:00
manu 12c949a188 Added COMPAT_IRIX (being developped, not functionnal at that time) 2001-11-26 21:38:41 +00:00
jdolecek bf7f67be85 if the LKM support is not compiled in, don't bother using exec_lock
at all, it's only needed in LKM case

use #if defined(LKM) || defined(_LKM) condition for netbsd32_execve.c,
to DTRT when either compiled statically into kernel with LKM support,
or compiled as a LKM
2001-11-23 22:02:39 +00:00
jdolecek 59f63c238e Two changes to setrlimit(2):
* return EINVAL if specified current limit exceeds specified hard limit.
  This behaviour is required by SUSv2 (noted by Giles Lean on tech-kern)
* return EINVAL if an attempt is made to lower stack size limit below
  current usage; this addresses bin/3045 by Jason Thorpe, and conforms to SUSv2
2001-11-23 18:56:33 +00:00
enami f7fa67fcfc Use round_page() instead of roundup(, PAGE_SIZE).
Suggested by chs@netbsd.org.
2001-11-21 01:30:04 +00:00
enami 6a043f1db9 Protect multi statement macro with do {} while (0). This is not cosmetic. 2001-11-21 00:55:39 +00:00
lukem 99bccc3cab - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
	KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
	DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for  options KGDB_DEVNAME="\"com\""
- use correct quotes for  options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
2001-11-20 08:43:19 +00:00
enami 39ab348507 Call pr_log(PRLOG_GET) when POOL_DIAGNOSTIC is defined instead of DIAGNOSTIC
for consistency.
2001-11-20 06:57:04 +00:00
lukem 576eed5512 Add new malloc(9) flag M_ZERO - zeros memory before returning.
From Poul-Henning Kamp's equivalent enhancement in FreeBSD.
2001-11-17 03:50:27 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
christos 88db539589 Make poll(2) ignore negative file descriptors (Bang Jun-Young). 2001-11-14 18:43:58 +00:00
lukem 43369f69d3 add RCSID 2001-11-13 13:33:44 +00:00
christos d1dcd2f401 PR/8657: z@rentaboat.se: alarm takes more seconds that it can handle.
This is a followup to PR/14558.

    - itimerfix(9) limited the number of seconds to 100M, before I changed
      it to 1000M for PR/14558.
    - nanosleep(2) documents a limit of 1000M seconds.
    - setitimer(2), select(2), and other library functions that indirectly
      use setitimer(2) for example alarm(3) don't specify a limit.

So it only seems appropriate that any positive number of seconds in
struct timeval should be accepted by any code that uses itimerfix(9)
directly, except nanosleep(2) which should check for 1000M seconds
manually. This changes makes the manual pages of select(2), nanosleep(2),
setitimer(2), and alarm(3) consistent with the code.
2001-11-13 00:34:21 +00:00
lukem adc783d537 add RCSIDs 2001-11-12 15:25:01 +00:00
lukem 7bbd2f341b clean up whitespace 2001-11-12 15:21:46 +00:00
lukem 6e65bad538 regen (for RCSID) 2001-11-12 15:03:35 +00:00
lukem bbfda04203 add RCSID to generated .c files 2001-11-12 14:57:02 +00:00
christos 6ff985ffa8 PR/14558: Tero Kivinen: There is no point in limiting the number of seconds
to 100 million. Use 1000 million like the man page for nanosleep suggests.
This is much closer to MAXINT, and it conforms to POSIX.
2001-11-12 14:52:33 +00:00
lukem 6e69bda797 regen (for RCSID) 2001-11-12 14:50:28 +00:00
lukem d8dd7943fe add RCSID to generated .c file 2001-11-12 14:34:24 +00:00
christos 5c7505a94f fix compile typo. 2001-11-10 20:49:52 +00:00
bouyer f7bc541779 Fix a memory leak when we change pl_corename several times. 2001-11-08 21:24:47 +00:00
chs 6fbca7d0fc use pmap_kenter_pa() instead of pmap_enter(), this is required for
pages loaned to the kernel.  this implies that we also need to
call pmap_kremove() before uvm_km_free().

other general cleanup:  remove argument names from prototypes,
rename some variables, etc.
2001-11-06 07:30:14 +00:00
fvdl f8ff451a0a Fix reversed wait/nowait logic. 2001-10-31 22:23:18 +00:00
manu 40c8c13901 Made syscallargs.h lint-friendly, so that it can be included in libc sources
more easily.
2001-10-30 21:52:26 +00:00
thorpej e8ee04475d - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings.  Stop overloading VTEXT for this purpose (VTEXT
  also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
  mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
  than making a function call to do this (it no longer makes sense to
  use a function call, since we no longer overload VTEXT with VEXECMAP's
  meaning).

VEXECMAP suggested by Chuq Silvers.
2001-10-30 15:32:01 +00:00
itohy 36a6ce75fe Fix memory leak if
- ktrace enabled for I/O operaion, and
 - readv() causes an error.
2001-10-30 13:37:21 +00:00
simonb 5f717f7c33 Don't need to include <uvm/uvm_extern.h> just to include <sys/sysctl.h>
anymore.
2001-10-29 07:02:30 +00:00
jdolecek 24ba90929c Avoid using microtime(9) for atime/mtime, we don't need to have it
THAT accurate and microtime(9) is painlessly slow on i386 currently.
This speeds up small transfers much. The gain for large transfers
is less significant, but notable too.
Bottleneck was found by Andreas Persson (Re: kern/14246).

Performance improvement with PIII on 661 Mhz according to hbench (with
PIPE_MINDIRECT=8192):

buffersize     before    after
512            17        49
1024           33        110
2048           52        143
4096           77        163
8192           142       190
64K            577       662
128K           372       392
2001-10-28 20:47:15 +00:00
christos f7cb99f9c6 make a copy of the epp->ep_path, because it is too late to use it when
copyargs is called since we've swapped vmspaces.
2001-10-28 04:46:42 +00:00
chs a54f8441f8 in cache_lookup(), if we get a cache hit but then fail to vget() the found
vnode, we should not attempt to remove the namecache entry.  this is because
vget() can sleep (eg. if VXLOCK is set because the vnode is being reclaimed),
and so multiple threads can end up in this context at the same time.
if this happens, each thread ends up removing the cache entry, but
the code to remove the entry assumes that the entry is still valid.
so we should just leave the (now stale) entry in the cache.
if another thread finds the entry again before it is reused,
that thread will notice that the entry is stale and remove it safely.
fixes PR 14042.
2001-10-27 04:53:38 +00:00
chs 6bc926aa9e in pool_drain(), call pool_reclaim() while we still have interrupts blocked
since the pool in question might be one used in interrupt context.
2001-10-21 00:06:05 +00:00
thorpej e45efd967f Deprecate the "m_act" alias of "m_nextpkt" (m_act is a historical
name), and just use m_nextpkt everywhere.
2001-10-18 20:17:24 +00:00
thorpej 9b2f51421c Use a pool cache for namei buffers -- it's faster to allocate from
a pool cache than a pool.
2001-10-17 23:33:29 +00:00
christos bfe76ac87a Allow userland to pass MNT_IGNORE (from enami) 2001-10-11 16:27:24 +00:00