Commit Graph

2854 Commits

Author SHA1 Message Date
chs 821ec03ed9 replace vm_map{,_entry}_t with struct vm_map{,_entry} *. 2001-06-02 18:09:08 +00:00
lukem d84d2c6c85 add missing #include "opt_kgdb.h" 2001-05-30 15:24:23 +00:00
mrg 09cf52ad81 regen. 2001-05-30 11:48:07 +00:00
mrg 72d327d434 use _KERNEL_OPT not _KERNEL&&|_LKM 2001-05-30 11:27:46 +00:00
chs 187cadcb77 don't define bpendtsleep in profiling kernels since it confuses gprof. 2001-05-28 22:20:03 +00:00
thorpej 442a329915 Statically-initialize `allevents' so that events can be registered
very early (before main() is called).
2001-05-28 16:40:31 +00:00
thorpej 9ec2953eef Make "reboot" an option at the root device/filesystem prompt (we
already had a "halt").
2001-05-27 01:29:50 +00:00
chs c90ead639a regen. 2001-05-26 21:34:04 +00:00
chs 07cabef8a2 replace vm_page_t with struct vm_page *. 2001-05-26 21:33:11 +00:00
chs 11a9651c8f replace vm_page_t with struct vm_page *. 2001-05-26 21:27:10 +00:00
kristerw 76475ad726 Removed an incorrect use of __CONCAT when formatting panic messages.
The ISO C standard says in 6.10.3.3 that if the result of using the
'##' operator "is not a valid preprocessing token, the behaviour is
undefined." Gcc 3.0 warns about this.
2001-05-24 10:33:08 +00:00
lukem c9b9613b3e for FIOGETOWN, only change the sign of *data if fo_ioctl returned without error 2001-05-24 06:52:43 +00:00
lukem 0fd012d03b regen for whitespace cleanup 2001-05-24 06:44:30 +00:00
manu a3703d68ef Backed out a previous commit that was incomplete and hence broke several
emulation package build
2001-05-19 17:28:33 +00:00
manu 37a42fd1bf Moved e_flags outsied of ifdef __HAVE_MINIMAL_EMUL in struct emul
and removed an ifdef that was taking care of this problem
2001-05-19 08:52:05 +00:00
perry 4be93c9ed7 Add a /* LINTSTUB: include <foo.h> */ mechanism. 2001-05-16 04:17:04 +00:00
perry bf16779f43 allow long typed functions 2001-05-16 03:58:14 +00:00
perry 3fe923fc2c I -> Ignore 2001-05-15 22:32:02 +00:00
perry 7cb4818421 awk script to automatically generate lint stub files from stylized
comments in .S files.
2001-05-15 22:23:09 +00:00
lukem 6cb5e77db5 remove use of gcc syntax for designated initialisers when initialising
unions `union_elem: ...', and use c99 syntax `.union_elem = ...' only
where necessary.
in this case, there's no need to tag elf_probe_func because that's the
first union element, and therefore, the implicit case. only specifically
mention ecoff_probe_func where necessary.

if we decide to not use this c99 feature for now, at least there's now
less stuff to rip out.
2001-05-15 02:00:12 +00:00
sommerfeld b4c4ecb455 Make this build again ifdef DIAGNOSTIC (oops) 2001-05-13 17:17:34 +00:00
sommerfeld 5b2241ad77 Remove pool reentrancy testing overhead unless DIAGNOSTIC is defined.
Previously, we passed __FILE__ and __LINE__ on all pool_get/pool_set calls.

This change results in a measured 1.2% performance improvement in
ping-flood packets-per-second as reported by ping(8).
2001-05-13 17:06:58 +00:00
thorpej 2f58df9a8f Rearrange the code that adds pages of objects to the pool; require
that the caller allocate the pool_item_header when it allocates the
pool page, so we can avoid a locking pitfall (sleeping with a simple
lock held).

Also revive pool_prime(), as there are some letigimate uses of it,
but in doing so, eliminate some of the bogosities of the old version
(i.e. don't do an implicit "setlowat", just prime the pool, and incr
the minpages for each additional page we add, and compute the number
of pages to prime in a way that callers would expect).
2001-05-10 04:51:41 +00:00
thorpej 6ec67f871a Use POOL_NEEDS_CATCHUP() in one more place. 2001-05-10 02:19:32 +00:00
thorpej db26619a5e Encapsulate the test for a pool needing a pool_catchup() in a macro. 2001-05-10 01:37:40 +00:00
thorpej 627edfcb50 Remove pool_create() and pool_prime(). Nothing except pool_create()
used pool_prime(), and no one uses pool_create() anymore.

This makes it easier to fix a locking pitfall.
2001-05-09 23:46:02 +00:00
thorpej 626cb1c3ce Use pool_init() rather then pool_create(). 2001-05-09 23:38:20 +00:00
jdolecek 27a5a43c04 In the check_header() function, bump the number of allowed section headers
to 512. Apparently, there are ELF binaries with more than 128 section
headers - an example is one of Linux Word Perfect 8 utilities.

This fixes kern/12455 by Mark Davies.
2001-05-07 17:09:13 +00:00
manu 7e6929fe90 Changed EMUL_BSD_ASYNCIO_PIPE to EMUL_NO_BSD_ASYNCIO_PIPE, so that
the native emulation (NetBSD) does not have a flag.
2001-05-07 09:55:12 +00:00
lukem 5b2ac78763 regen from vnode_if.sh rev 1.29 2001-05-07 08:48:07 +00:00
lukem e1adc31453 delint: vop_default_desc was declared const but not defined const. 2001-05-07 08:46:02 +00:00
enami 8e5a4722c5 Make this file *just* compiles again when __HAVE_MINIMAL_EMUL is defined. 2001-05-07 02:51:53 +00:00
enami 362af21bc7 Fix broken indentation introduced by previous commit. 2001-05-07 02:28:55 +00:00
manu 573ce64c6b implement the recently introduced EMUL_BSD_ASYNCIO_PIPE emulation package
flag.

EMUL_BSD_ASYNCIO_PIPE notes that the emulated binaries expect the original
BSD pipe behavior for asynchronous I/O, which is to fire SIGIO on read() and
write(). OSes without this flag do not expect any SIGIO to be fired on
read() and write() for pipes, even when async I/O was requested. As far as
we know, the OSes that need EMUL_BSD_ASYNCIO_PIPE are NetBSD, OSF/1 and
Darwin.
2001-05-06 19:22:32 +00:00
manu 5a6b8191b5 Added two flags to emulation packages:
EMUL_BSD_ASYNCIO_PIPE notes that the emulated binaries expect the original
BSD pipe behavior for asynchronous I/O, which is to fire SIGIO on read() and
write(). OSes without this flag do not expect any SIGIO to be fired on
read() and write() for pipes, even when async I/O was requested. As far as
we know, the OSes that need EMUL_BSD_ASYNCIO_PIPE are NetBSD, OSF/1 and
Darwin.

EMUL_NO_SIGIO_ON_READ notes that the emulated binaries that requested
asynchrnous I/O expect the reader process to be notified by a SIGIO, but
not the writer process. OSes without this flag expect the reader and the
writer to be notified when some data has arrived or when some data have been
read. As far as we know, the OSes that need EMUL_NO_SIGIO_ON_READ are Linux
and SunOS.
2001-05-06 19:09:52 +00:00
simonb cbbd901bdc Declare schedhz. 2001-05-06 13:46:34 +00:00
simonb 6a2acde042 Save the start and end positions in the message buffer of the formatted
panic string.

Suggested by Jason Thorpe eons ago.
2001-05-06 13:23:42 +00:00
thorpej da1f26d65f Add pool_cache_destruct_object(), used to force destruction of
an object and release back into the pool.
2001-05-04 19:41:25 +00:00
scw 2963ff5c58 Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
2001-05-02 10:32:08 +00:00
enami bda65c7816 Define local variable cpu_id only when either MULTIPROCESSOR or DIAGNOSTIC
is defined since it isn't used otherwise.
2001-05-01 04:30:04 +00:00
kleink 50d738a0f0 Add %j, %t and %z modifiers. 2001-04-30 21:29:45 +00:00
kml fc1ebff2b2 Large values of sb_max would cause an overflow in sbreserve(); cast to
u_quad_t to avoid this.  (from FreeBSD uipc_socket2.c v1.19)
2001-04-30 03:32:56 +00:00
bjh21 beb69f2aad Before allowing kgmon to do anything, check that we managed to allocate the
profiling buffer at startup.  If not, pretend the kernel doesn't have
profiling support at all.
2001-04-28 12:56:00 +00:00
jdolecek 27706951af Slighly improve comment for ltsleep(), the previous formulation might
be understood incorrectly (at least, it confused me at first, before
I looked at the actual code).
2001-04-27 08:00:03 +00:00
lukem cdf90834d5 put TAB after #defines 2001-04-27 06:07:27 +00:00
marcus 11ac2c3105 STDC cleanup: multi line string literal removed. 2001-04-27 00:06:11 +00:00
marcus b6240639a2 STDC cleanup: volatile needs to be cast away for lk_flags as well. 2001-04-27 00:05:13 +00:00
enami 5a6a17f734 Make sysctl_msgbuf() to copy message buffer to userland even if
the write pointer points to the beginning of message buffer.
2001-04-26 06:07:13 +00:00
thorpej c24c3604b0 SPINLOCK_INTERLOCK_RELEASE_HOOK should actually be
SPINLOCK_SPIN_HOOK, so that we actually check for
pending IPIs on the Alpha more than once.  Also,
when we call alpha_ipi_process(), make sure to go
to splipi().
2001-04-20 22:58:39 +00:00
thorpej a18eaa4cb6 Make sure there is there is a curproc in ltsleep(). 2001-04-20 17:58:49 +00:00
lukem 63a13d4499 use ${.CURDIR:H:H} instead of ../.. for default setting of SYSDIR,
because the latter doesn't work with objdirs
2001-04-18 11:21:24 +00:00
thorpej 5b35dc8136 When unmounting a file system, acquire the syncer_lock before
vfs_busy'ing just before the dounmount() call.  This is to avoid
sleeping with the mountlist_slock held -- but we must acquire
syncer_lock before vfs_busy because the syncer itself uses
syncer_lock -> vfs_busy locking order.
2001-04-16 22:41:09 +00:00
thorpej bf2dcec4f5 Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
2001-04-13 23:29:55 +00:00
thorpej 4cb159296b Remove an splimp() that really has no purpose in life. 2001-04-12 03:08:42 +00:00
kleink fba80da1d1 Regen. 2001-04-10 11:06:20 +00:00
kleink c73bcbb0f8 Slight indentation nit. 2001-04-10 11:03:56 +00:00
enami c75004b245 Fix the name of some bits in struct vnode.v_flag. 2001-04-09 14:14:10 +00:00
jdolecek b6d1d4db02 Change the first arg to fileops fo_stat routine to struct file *, adjust
callers and appropriate routines to cope. This makes fo_stat more
consistent with rest of fileops routines and also makes the fo_stat
match FreeBSD as an added bonus.
Discussed with Luke Mewburn on tech-kern@.
2001-04-09 10:22:00 +00:00
jdolecek 16b1272b3f Add new 'stat' fileop and call the stat function via f_ops rather
than directly.
For compat syscalls, also add necessary FILE_USE()/FILE_UNUSE().
Now that soo_stat() gets a proc arg, pass it on to usrreq function.
2001-04-07 09:00:57 +00:00
jhawk 4f4abf46ee SYSDIR should be relative here, too.
And actually use it after we define it.

Optimize the find expression (use -prune over -path)
2001-04-05 19:49:40 +00:00
jhawk 0ee6a7e6e9 Remove grossly inefficient "! -path /sys/arch*" construct in favor of -prune.
Use a relative path (../..) instead of /sys.

Enhance the sed expression to work with .'s in paths.
Quote sed expressions in single quotes rather than double
quotes unless there's a good reason otherwise.
2001-04-03 16:56:16 +00:00
chs 702fa72b16 in bwrite(), when deciding whether to convert sync writes into delayed writes,
examine the filesystem contained in a block device rather than the filesystem
containing the block device vnode.  fixes PR 12484.
2001-04-01 16:16:56 +00:00
enami 2ceebb6c0e Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.
2001-03-31 00:35:21 +00:00
jdolecek 466a79b36b Make it possible to use different function for unimplemented syscalls
than sys_nosys().
2001-03-30 16:56:36 +00:00
fvdl 2c310ee4d5 Depending on the NAMECACHE_ENTER_REVERSE option, always enter reverse
mappings (vnode -> name) in the reverse mapping hash table. Without
this option, there is no change; only directories will be entered to
speed up getcwd. This is an option because it will cause getcwd
to hit longer hash chains, and at the moment its usefulness is
still limited.
2001-03-29 22:39:23 +00:00
lukem b4e2b14fe6 convert to ANSI KNF 2001-03-22 04:52:25 +00:00
thorpej 20fe4e2d96 Add a protosw flag, PR_ABRTACPTDIS (Abort on Accept of Disconnected
Socket), and add it to the protocols that use that behavior (all
PR_LISTEN protocols except for PF_LOCAL stream sockets).
2001-03-21 19:22:27 +00:00
pooka 6c3e28927e fix typo in comment 2001-03-17 09:38:36 +00:00
chs ac3bc537bd eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS			0
KERN_INVALID_ADDRESS		EFAULT
KERN_PROTECTION_FAILURE		EACCES
KERN_NO_SPACE			ENOMEM
KERN_INVALID_ARGUMENT		EINVAL
KERN_FAILURE			various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE		ENOMEM
KERN_NOT_RECEIVER		<unused>
KERN_NO_ACCESS			<unused>
KERN_PAGES_LOCKED		<unused>
2001-03-15 06:10:32 +00:00
chs 941da355cf in getnewbuf(), when we need to write a buffer before reusing it,
return NULL instead of restarting the loop since we might sleep
while starting the i/o.  this tells getblk() to check if someone else
created the buffer while we slept.  from OpenBSD.
2001-03-10 18:43:55 +00:00
tsutsui d507b847c6 Declare constty extern. 2001-03-09 13:35:50 +00:00
chs 83d071a318 add UBC memory-usage balancing. we track the number of pages in use for
each of the basic types (anonymous data, executable image, cached files)
and prevent the pagedaemon from reusing a given page if that would reduce
the count of that type of page below a sysctl-setable minimum threshold.
the thresholds are controlled via three new sysctl tunables:
vm.anonmin, vm.vnodemin, and vm.vtextmin.  these tunables are the
percentages of pageable memory reserved for each usage, and we do not allow
the sum of the minimums to be more than 95% so that there's always some
memory that can be reused.
2001-03-09 01:02:10 +00:00
cgd d45416e707 when executing args in the ccode=0 case, send output to a tmp file and
(only if cmd exited successfully) use tmp file as input to sed pipeline.
This works around two issues:
(1) a pathological case where the script would fail in ... interesting
    ways if the command being executed closed its stdout.  (Certain
    commands are used only for their side effects, but not their output,
    and doing some testing on my own i got into hot water when one
    of my mods caused a command to close its output).
(2) the fact that genassym would succeed even when the command in
    fact failed (because the last cmd in the pipeline is the one whose
    exit status would be reported).
2001-03-06 02:20:18 +00:00
fvdl f28b5d3d94 Avoid spinning forever when hardclock() wants to grab the kernel lock
held by the reaper. From Bill Sommerfeld.
2001-03-05 20:38:21 +00:00
eeh 59c87936e0 Oops. Forgot to add this to execsw. Seems like SVR4 64 is not used much. 2001-03-03 01:46:04 +00:00
lukem de1c2690b6 convert to ANSI KNF 2001-02-27 05:19:13 +00:00
lukem 1fa336cced oops; accidentally dropped an initialisation in pollscan() in previous.
called poll() to fail in interesting ways. noted by chs/nathanw
2001-02-27 04:44:51 +00:00
lukem 602451ac6e convert to ANSI KNF 2001-02-26 21:58:30 +00:00
lukem 4637391f86 minor KNF 2001-02-26 21:09:57 +00:00
lukem 735e1dcaa8 convert to ANSI KNF 2001-02-26 20:43:25 +00:00
lukem 7fee352603 convert to ANSI KNF 2001-02-26 20:24:30 +00:00
jdolecek 5a8911a72d Call module "stat" entry where appropriate.
Problem reported and patch provided by SATOU Takashi in kern/12037.
2001-02-24 10:16:46 +00:00
nathanw 214bc3e43f All of our ports have reasonable cpu_coredump()'s that set
core.c_midmag. Garbage collect the "traditional dump" code that
handled the core.c_midmag == 0 case.
2001-02-23 22:01:50 +00:00
jdolecek 522f569810 make some more constant arrays 'const' 2001-02-21 21:39:52 +00:00
eeh 6a9224a06d Remove old compatibility hack. Should no longer be needed. 2001-02-21 00:47:21 +00:00
eeh 8a4a682091 Support flexible process address space limits and bump kernel version number. 2001-02-14 18:21:42 +00:00
itojun d64f080341 make sure we do not return shared M_EXT mbuf. it will avoid possible mbuf
overwrites if bridge/loopback/multicast/whatever is used.  sync with kame
2001-02-14 17:09:19 +00:00
itojun 02bc628319 add pfctlinput2() (pfctlinput() with args). 2001-02-11 06:38:45 +00:00
eeh 52af2be8e9 Add COMPAT_SVR4_32 entries. 2001-02-11 01:29:43 +00:00
eeh 24defd04da Rename the tablet line discipline "tablet". 2001-02-11 01:28:47 +00:00
thorpej b016744976 Don't uvm_deallocate() the address space in exit1(). The address
space is already torn down in uvmspace_free() when the vmspace
refrence count reaches 0.  Move the shmexit() call into uvmspace_free().

Note that there is a beneficial side-effect of deferring the unmap
to uvmspace_free() -- on systems where TLB invalidations are
particularly expensive, the unmapping of the address space won't
have to cause TLB invalidations; uvmspace_free() is going to be
run in a context other than the exiting process's, so the "pmap is
active" test will evaluate to FALSE in the pmap module.
2001-02-10 05:05:27 +00:00
itojun d1507261c4 return ECONNABORTED, if the socket (tcp connection for example)
is disconnected by RST right before accept(2).  fixes PR 10698/12027.
checked with SUSv2, XNET 5.2, and Stevens (unix network programming
vol 1 2nd ed) section 5.11.
2001-02-07 12:20:43 +00:00
eeh ec22628573 Move maxdmap and maxsmap where they belong and make them big enough. 2001-02-06 19:54:43 +00:00
eeh 4380259bc7 Specify a process' address space limits for uvmspace_exec(). 2001-02-06 17:01:51 +00:00
chs eef7499a6c in vtruncbuf(), pass 0 (meaning everything at or past the start of the range)
instead of the vnode's size to pgo_flush() since there can be pages past EOF.
in the same call, cast "lbn" to voff_t to avoid overflow.
2001-02-06 10:58:55 +00:00
pk 11c1f60120 When freeing a session, remove the reference to it from the associated tty. 2001-02-04 22:32:24 +00:00
eeh e938c4e842 *NEVER* cast a reference parameter (unless you're using C++). 2001-02-04 19:12:09 +00:00
mrg d4dfeaf200 add sunos32 support. 2001-02-02 07:30:22 +00:00
enami 6dcc7e3de4 Don't use PR_URGENT to allocate page header. We don't want to just panic
on memory shortage.  Instead, use the same wait/nowait condition with the
item requested, and just cleanup and return failure if we can't allocate
page header while we aren't allowed to wait.
2001-01-29 02:38:02 +00:00
thorpej cfa7048975 Regen; getpid(2) is MP-safe. 2001-01-27 07:48:28 +00:00
thorpej 8740614bad getpid(2), our first MP-safe syscall! 2001-01-27 07:47:26 +00:00
thorpej 1b6a66420e Regen; add sy_flags. 2001-01-27 07:23:06 +00:00
thorpej 1628dd441e Add a "sy_flags" to struct sysent, define a SYCALL_MPSAFE
system call flag (indicating that the kernel lock does not
need to be acquired when entering the kernel on that syscall).
2001-01-27 07:21:43 +00:00
itojun 6e24d735f0 when the peer is disconnected before accept(2) is issued,
do not return junk data in mbuf (= sockaddr on accept(2)'s 2nd arg).
set the length zero.

behavior checked with bsdi and freebsd.
partial solution to PR 12027 and 10698 (need more investigation).
2001-01-22 18:14:11 +00:00
jdolecek d9466585b7 make filesystem vnodeop, specop, fifoop and vnodeopv_* arrays const 2001-01-22 12:17:35 +00:00
jdolecek d0a540b250 rename vfs_op_init() to vfs_op_check() and make it only check the offsets
and number of ops, not touch anything - vnode_if.sh now generated
proper offset numbers; vfs_op_check() is only defined and called for DEBUG
kernels

constify extern declaration of vfs_op_descs[]
g/c vfs_opv_numops, use VNODE_OPS_COUNT instead
make vfs_opv_init_explicit() and vfs_opv_init_default() static
2001-01-22 09:57:25 +00:00
jdolecek c3f6f769a3 regen: *_desc are generated correctly, new VNODE_OPS_COUNT,
structures constified
2001-01-22 09:53:31 +00:00
jdolecek 950412b4f5 when generating individual *_desc, generate also proper offsets so that
then don't need to be patched at runtime
add new define VNODE_OPS_COUNT (to vnode_if.h) so that the number is known
at compile-time
make stuff const, it now can be
2001-01-22 09:52:21 +00:00
martin d1ff650a0c Regen after de-const-ing. 2001-01-19 12:24:09 +00:00
martin c9803fbf98 Remove over-const-ification.
This structures are actually modified at kernel init time by vfs_op_init.

XXX - looks like the state after initialization is pretty const and with
some magic in the generator script (and appropriate changes to vfs_op_init)
it could be made const.
2001-01-19 12:22:56 +00:00
jdolecek 34c8ae80da constify 2001-01-18 20:28:15 +00:00
thorpej 2f89e3d744 Explicitly include <machine/intr.h> if __HAVE_GENERIC_SOFT_INTERRUPTS. 2001-01-17 18:21:41 +00:00
fvdl ea08a209b5 Adapt for procfs_valid* argument change. 2001-01-17 01:13:23 +00:00
thorpej d74e432ed3 Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
2001-01-15 20:19:50 +00:00
thorpej 7200d34a76 Whenever ps_sigcheck is set to true, signotify() the process, and
wrap this all up in a CHECKSIGS() macro.  Also, in psignal1(),
signotify() SRUN and SIDL processes if __HAVE_AST_PERPROC is defined.

Per discussion w/ mycroft.
2001-01-14 22:31:58 +00:00
thorpej a624c70966 Use splvm(), not the home-grown splmem(). 2001-01-14 02:08:35 +00:00
thorpej b5104c1ca5 Change some low-hanging splimp() calls to splvm(). 2001-01-14 02:06:21 +00:00
cgd 926244ff0d nuke extra token (;) after #endif 2001-01-12 22:55:10 +00:00
fvdl 6907c4ded8 Do syscall_intern after p_traceflag has been copied to the new
process (if it is inherited), so that ktrace continues to work
properly on the child.
2001-01-09 23:36:50 +00:00
nathanw d75edd2077 Reserve system call slots for getcontext, setcontext, LWPs, and
scheduler activations.
2001-01-08 18:25:35 +00:00
chs 6717a2ac1b in vtruncbuf(), use a "synchronous freeing" flush to prevent a race
between write i/os in a disk-based filesystem vs. the disk block being
freed by a truncation, allocated to a new file, and written again with
different data.  if the disk driver reorders the requests and does
the second i/o first, the old data will clobber the new, corrupting
the new file.
2001-01-08 07:05:47 +00:00
jdolecek d7f811d098 utrace(2): limit size of user data to KTR_USER_MAXLEN (currently 2048); return EINVAL if 'len' is bigger 2001-01-05 22:25:26 +00:00
jdolecek 2bd5bf0ec2 regen after utrace() parameter rename 2001-01-05 21:53:38 +00:00
jdolecek fbc7e223d7 utrace(2): rename 'id' parameter to 'label' 2001-01-05 21:42:08 +00:00
thorpej eb80878b1b Happy new year! 2001-01-01 20:18:34 +00:00
jdolecek df458f620b Avoid generating duplicate SYS_* defines to *syscall.h - is possible
for kern/syscalls.master's sys_getpid()/sys_getpid_with_ppid().
This fixes kern/11853 by Bernd Ernesti.
2001-01-01 16:41:43 +00:00
sommerfeld aace86f946 MULTIPROCESSOR: The two calls to psignal() inside mi_switch() are
inside the scheduler lock perimeter and should be sched_psignal() instead.
2001-01-01 16:02:51 +00:00
ad e3514a4191 PR 4853: we fork a lot more during startup these days. Wrap nextpid to 500. 2000-12-31 17:43:41 +00:00
sommerfeld f2bdd546dd Add a missing simple_unlock() to the LK_NOWAIT/VXLOCK error case in vget(). 2000-12-31 03:13:51 +00:00
jdolecek 7899fd7798 regen - utrace(2) addition 2000-12-28 11:16:48 +00:00
jdolecek a80dee65df add utrace(2) - this syscall allows to add user ktrace entries
idea from FreeBSD, but added argument (const char *id) so that it's possible
to differentiate between entries from different sources
2000-12-28 11:10:15 +00:00
jmc ca607b87cf Default lock_printf to syslog rather than printf. Some of the lock debug checks
are done inside of wakeup which is holding the sched lock. Printf can cause
wakeup to get called again (pty redirection of console message) which will
panic with sched lock already held.

This isn't a long term fix as not being able to printf vs. sched lock should
be cleaned up better but this avoids continual panics with lockdebug running
and an xterm -C.
2000-12-24 23:56:24 +00:00
jdolecek e9e91a0fb5 split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
2000-12-22 22:58:52 +00:00
fvdl 0d4862bed1 Regen. 2000-12-22 20:07:09 +00:00
fvdl 8eaf6e8d8e Make that defined(LKM) || defined(_LKM), to catch both the cases
of compiling a kernel with LKM support and compiling an LKM.
2000-12-22 20:05:35 +00:00
fvdl 2ac441ddfb LKM -> _LKM around opt_ include. 2000-12-22 20:00:16 +00:00
mrg 264248925f regen 2000-12-22 15:10:38 +00:00
mrg 80ab63644e redo the previous correctly 2000-12-22 15:09:46 +00:00
mrg af36640df1 regen 2000-12-22 14:59:40 +00:00
mrg 62230909f1 avoid redefinition of VNODE_OP_NOINLINE 2000-12-22 14:58:39 +00:00
mrg a0e71c9ca7 avoid redefinition of VNODE_OP_NOINLINE 2000-12-22 14:45:50 +00:00
scw 96698d967e Change struct emul's "char e_name[8]" field to "const char *e_name"
to allow for emulation names >= 8 characters.
2000-12-19 22:08:36 +00:00
mrg 7284657373 only print the magic number changing if not cold 2000-12-19 04:39:19 +00:00
jdolecek 5c6130a2b1 hum, use freebsd_setregs for FreeBSD ELF binaries (this bug was introduced with
the execsw[] changes)
2000-12-17 21:36:49 +00:00
fvdl 89b5cfa9c5 Jump out of the scandir loop if VOP_READDIR returns an error, avoiding
running around in circles.
2000-12-15 11:52:14 +00:00
mycroft b29180b2ff Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.
2000-12-15 06:14:21 +00:00
jdolecek 03354da279 this doesn't need <sys/trace.h> 2000-12-13 17:48:46 +00:00
jdolecek 0c74ffb7fd if the third argument in syscall.conf matches [a-z0-9_], use it as
a function alias instead of the function name in { ... }
2000-12-12 17:32:45 +00:00
martin ac28b114d2 Make this compilable again on ports without __HAVE_SYSCALL_INTERN. 2000-12-11 19:53:06 +00:00
mycroft 11fcbfe7a6 Call e_syscall_intern every time ktrace flags are modified. 2000-12-11 16:39:01 +00:00
tsutsui aaa48a8d25 Use USPACE_ALIGN for an alignment argument on allocating U-area.
The default value is 0, and could be overridden by machine/vmparam.h.
2000-12-11 15:35:42 +00:00
mycroft f495cd9dc6 Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN.  If this is defined, e_syscall is replaced by
  e_syscall_intern, which is called at key places in the kernel.  This can be
  used to set a MD syscall handler pointer.  This obsoletes and replaces the
  *_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL.  If this is defined, certain (deprecated) elements in
  struct emul are omitted.
2000-12-11 05:28:59 +00:00
thorpej 105cf38061 Add some basic statistics to pool_cache. 2000-12-11 05:22:55 +00:00
fvdl 405b695086 Make sobind() take a struct proc *. It already took curproc and
passed it down to the appropriate usrreq function, and this
allows usage for contexts that need to be explicitly different
from curproc (like in the NFS code when binding to a reserved port).
2000-12-10 23:16:28 +00:00
mycroft 66610a4779 Introduce PROC_PC(), which is used to get a process's user PC. If this is
defined, call addupc_intr() directly from statclock() in the system time case,
using the same P_OWEUPC path if the copyin/copyout fails.
Use this in i386 to remove profiling code from the normal userret() path.
2000-12-10 19:29:30 +00:00
thorpej ce866cd0e8 Don't hold a pool cache lock across any call to pool_get() or pool_put().
This allows us to change a try-lock into a normal lock in the reclaim
case.
2000-12-10 17:03:34 +00:00
fvdl 538c381225 findblkname is not static (and is in fact used outside this file). 2000-12-10 14:14:15 +00:00
jdolecek 7a2157f1f3 emul_unregister(): fix incorrect loop condition - execsw[] is not NULL
terminated
2000-12-10 12:42:30 +00:00
jdolecek 9b6d040095 fork1(): write the ktrace entry before the parent is put to sleep for
FORK_PPWAIT case, so that this DTRT for vfork() too
2000-12-10 11:41:20 +00:00
jdolecek a6ca890142 always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
2000-12-09 12:38:23 +00:00
mycroft acbeba20e1 Fix compile glitch. 2000-12-09 07:17:32 +00:00
mycroft 547de8a6a3 Regen. 2000-12-09 07:05:10 +00:00
mycroft 02d8d5f9bf Define 3 new functions:
* sys_getpid_with_ppid()
* sys_getuid_with_euid()
* sys_getgid_with_egid()
that do the retval[1] hack.  Use them when COMPAT_43 is defined.
2000-12-09 07:04:47 +00:00
mycroft 51e3b887d7 Regen. 2000-12-09 06:19:40 +00:00
mycroft e2743f72a9 Round up the sysent table size. 2000-12-09 06:15:42 +00:00
mycroft 8cb9be1967 s/unimplemented/filler/ 2000-12-09 05:41:12 +00:00
mycroft f348afacb9 Regen. 2000-12-09 05:37:01 +00:00
mycroft 23284f8acf Add another const. 2000-12-09 05:33:27 +00:00
mycroft 9682cf0b09 Add the %% separators. 2000-12-09 05:27:28 +00:00
mycroft 060456b651 Couple of changes:
* Make the syscallnames[] table const.
* Add a separator between the #include section and the syscalls section, so
  that #if/#else/#endif can be handled differently in the two.
* Add support for rounding up the size of the sysent table.
2000-12-09 05:27:08 +00:00
jdolecek a65f2129f3 call exec_init() with before letting init(8) exec 2000-12-08 22:07:36 +00:00
jdolecek 0576f87ad3 add infrastructure to load emulations and their executable support dynamically
via LKM
2000-12-08 19:42:11 +00:00
augustss 246260555f Use correct type for todo variable.
Use more explicit panics messages.
2000-12-08 02:25:50 +00:00
thorpej 21ca07bb5c ...and when freeing cache groups, clear `freeto' if that's the one
we're freeing.
2000-12-07 21:30:07 +00:00
thorpej 3e9d93b241 When we invalidate a pool cache, make sure to clear `allocfrom' if
we empty out that cache group.
2000-12-07 20:16:56 +00:00
thorpej 1a658211bc Add a /c modifier to "show pool" to display pool caches. 2000-12-07 19:30:31 +00:00
jdolecek 6ae23b9300 update comment about the sense of placement of NDINIT() 2000-12-07 16:14:35 +00:00
thorpej 7553470722 This is a first-cut implementation of support for caching of
constructed objects in the pool allocator, similar to caching
of constructed objects in the Solaris SLAB allocator.

This implementation is a separate API (pool_cache_*()) layered
on top of pools to keep the caching complexity out of the way
of pools that won't benefit from it.

While we're here, allow pool items to be as large as the pool
page size.
2000-12-07 05:45:57 +00:00
thorpej 581799e1f8 ANSI'ify. 2000-12-06 18:20:52 +00:00
thorpej 131ac36401 pool_handle_t -> struct pool * 2000-12-06 18:05:57 +00:00
scw 6afa06dad6 Add support for COMPAT_AOUT_M68K. 2000-12-02 20:44:09 +00:00
jdolecek fc181f91c6 use EMUL_GETPID_PASS_PPID or EMUL_GETID_PASS_EID to find out if one should
pass parent pid for getpid() or effective id for get[ug]id(), instead
of compile-time dependency
2000-12-01 20:34:17 +00:00
jdolecek d06ce6de86 set the EMUL_HAS_SYS___syscall flag for emul_netbsd 2000-12-01 19:41:49 +00:00
jdolecek 30760da04a no need to define emul_osf1, <compat/osf1/osf1_exec.h> defines it for us now
set execsw[] entrys' priority to appropriate values
2000-12-01 12:57:55 +00:00
jdolecek 01040d97a2 add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
2000-12-01 12:28:30 +00:00
nathanw be487a2752 Set doreallocblks=1 here. 2000-11-30 20:56:53 +00:00
jdolecek 7d3a48b31d recognize ^if and ^endif in input master syscall file specially - output it
like #if and #endif to sysdcl; this can be used to insert ifdefs
to generated *sysent.c
2000-11-29 22:09:05 +00:00
thorpej aa77dea4c2 No need to play silly name trickery when we know we're talking about
64-bit ELF binaries.
2000-11-28 21:58:12 +00:00
mrg 51858ad725 backout part of execsw/LKM changes: netbsd_elf32_signature() is used by
the compat/netbsd32 code so de-static it again.
2000-11-28 13:10:41 +00:00
mrg b4e53bf009 wrap newly introduced >80 char lines. 2000-11-28 12:24:34 +00:00
jdolecek e650ecc818 prototype netbsd_elf64_probe() ifdef EXEC_ELF64, not for if !defined(EXEC_ELF32) 2000-11-27 18:04:32 +00:00
jdolecek 414f0ac116 netbsd32 emulation doesn't exec 64bit binaries 2000-11-27 17:21:22 +00:00
chs 69ad0d84c0 regen. 2000-11-27 09:04:59 +00:00
chs aeda8d3b77 Initial integration of the Unified Buffer Cache project. 2000-11-27 08:39:39 +00:00
nisimura 10571faa84 Introduce uvm_km_valloc_align() and use it to glab process's USPACE
aligned on USPACE boundary in kernel virutal address.  It's benefitial
for MIPS R4000's paired TLB entry design.
2000-11-27 04:36:40 +00:00
takemura 3c9d9276dc Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and
PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt
priority level while others are protected with splhigh().
2000-11-26 11:08:57 +00:00
jdolecek d9a0883770 define COMPAT_OLDSOCK unconditionally - the code is used virtually for all
emulations besides NetBSD, and this way it's LKM-safe
2000-11-24 21:38:28 +00:00
chs 55a751c9d5 add ddb commands "show uvmexp" and "show ncache".
the former used to be "call uvm_dump", the latter is new.
2000-11-24 07:25:50 +00:00
chs ab077e1ed4 change cache_purgevfs() from O(N^2) to O(N).
use queue.h macros where possible.
2000-11-24 05:02:23 +00:00
chs fa19fe52db adjust the spinlock macros in the non-MULTIPROCESSOR, non-LOCKDEBUG case
so that gcc will think that static spinlock are used.
this allows us to remove the ugly conditionalization of
static spinlock declarations.
2000-11-24 03:59:07 +00:00
chs 22d140fd0b ifdef DEBUG, increase the max size we'll overwrite in freed memory blocks
to detect modifications after frees from 32 bytes to 1 page.
2000-11-24 00:34:32 +00:00
thorpej 113dd58233 Add a LOCKDEBUG check for a r/w spinlock spinning out of control.
Partially from Bill Sommerfeld.
2000-11-22 06:31:22 +00:00
itojun 6c7e531e99 make COMPAT_OSF1 to compile. not tested (could someone review?). 2000-11-22 03:48:33 +00:00
enami 29f1bcd8e2 Unlock mutex before jumping off from the critical region instead of
testing if locked.
2000-11-21 03:53:27 +00:00
jdolecek baae0324b9 restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
  provide single struct emul per emulation
* elf:
  - kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
    per emulation and contains pointer to respective probe function
  - interp is allocated via MALLOC() rather than on stack
  - elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
  to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
  emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
  part of appropriate execsw[] entry
* constify couple of structures
2000-11-21 00:37:49 +00:00
jdolecek e5b244c609 disable the LM_EXEC stuff for now, it doesn't work anyway
this will be fixed 'soon'
2000-11-21 00:11:38 +00:00
thorpej 3075dec01a Allow machine dependent code to specify a hook to be run when a
spinlock's interlock is released.

Idea from Bill Sommerfeld.
2000-11-20 20:04:49 +00:00
veego a174b8a595 simple_lock_held is only defined when you use LOCKDEBUG.
Put it for now in an ifdef LOCKDEBUG.
2000-11-20 06:36:02 +00:00
simonb f104ee65be Add a sysctl_rdminstruct() function - same as sysctl_rdstruct() but
can return short data if *oldlenp is less than len.
2000-11-20 01:46:56 +00:00
jdolecek 26fe6166ed check_pty(): simple_unlock() might have been called even if the lock was
not locked previously in some cases; unlock only if the lock is held
2000-11-19 22:34:56 +00:00
sommerfeld 0cc75528c8 If MULTIPROCESSOR, count cpus and use that for hw.ncpu 2000-11-19 01:46:26 +00:00
sommerfeld 89b4aa9918 Preliminary MULTIPROCESSOR support:
- for CP_TIME, sum the times across all processors.
 - for kinfo_proc2, fill in cpu_id.
2000-11-19 01:34:58 +00:00
sommerfeld f276315e1c In pool_setlowat(), only call pool_catchup() if the pool is under the
low water mark.  (Avoids annoying warning when you setlowat a static
pool).
2000-11-19 00:29:51 +00:00
simonb 3f9e6ed0b8 Don't use alloca() - breaks compile on alpha (alloca is not prototyped
anywhere).
2000-11-18 15:58:13 +00:00
jdolecek 4ba9d75b97 pass pointer to used exec_package to emulation-specific exec hook -
emulation code may make decisions based on e.g. exec format
2000-11-16 20:04:33 +00:00
enami c4c6285008 Don't allow t_linesw to be NULL. 2000-11-15 01:47:14 +00:00
enami c816e13706 Adjust nlinesw correctly. 2000-11-15 01:42:53 +00:00
enami 54f723723a Cosmetic changes. 2000-11-15 01:41:22 +00:00
thorpej be14fd9db1 Use round_page() instead of roundup(..., NBPG). 2000-11-14 22:23:06 +00:00
thorpej e39f7bbe1c NBPG -> PAGE_SIZE 2000-11-14 22:16:38 +00:00
thorpej 38ee35826a NBPG -> PAGE_SIZE. 2000-11-14 22:14:53 +00:00
thorpej b7d004daa6 Use round_page() instead of roundup(..., NBPG). 2000-11-14 22:13:20 +00:00
itojun 68f0fe3840 make sure every m_aux will be freed.
there are direct use of MFREE() from sys/kern.
(we experienced no memory leak so far, but if we use m_aux for other purposes,
we will need this change)
2000-11-14 20:05:28 +00:00
jdolecek 78b866e95a change the type of *syscallnames[] array to 'const char * const foo[]' 2000-11-13 21:32:15 +00:00
jdolecek ab8c5177be use SIGACTION() macro to get on appropriate sigaction
structure
2000-11-12 18:17:56 +00:00
eeh df87630144 Add console magic sequence framework. 2000-11-08 22:41:58 +00:00
ad 642267bcc7 Update for hashinit() change. 2000-11-08 14:28:12 +00:00
ad 5fcf59fd7c Allow for creation of both LIST and TAILQ based hashes by adding a `hash
type' argument to hashinit().
2000-11-08 14:25:23 +00:00
chs ff1e758c8c use round_page(...) instead of roundup(..., NBPG). 2000-11-08 05:53:10 +00:00
chs a74393b970 remove unneeded includes. 2000-11-08 05:47:56 +00:00
chs a284236c04 in fork1(), only add make the new proc visible (by giving it a pid
and adding it to allproc) after it's fully initialized.
this prevents the scheduler from coming in via a clock interrupt
and tripping over a partially-initialized proc.
2000-11-08 05:16:23 +00:00
jdolecek 7d8eefdffc add void *p_emuldata into struct proc - this can be used to hold per-process
emulation-specific data
add process exit, exec and fork function hooks into struct emul:
* e_proc_fork() - called in fork1() after the new forked process is setup
* e_proc_exec() - called in sys_execve() after the executed process is setup
* e_proc_exit() - called in exit1() after all the other process cleanups are
  done, right before machine-dependant switch to new context; also called
  for "old" emulation from sys_execve() if emulation of executed program and
  the original process is different

This was discussed on tech-kern.
2000-11-07 12:41:52 +00:00
jdolecek 75823fcfc2 write KTR_EMUL entry on end of fork1() - primarily usable when the new
process never does execve(2), such as when creating a thread
2000-11-07 12:31:17 +00:00
tv c6a1ef4f70 8 spaces -> tab 2000-11-05 22:41:35 +00:00
jdolecek e8e4da6b87 add new function sigismasked(), which checks whether passed signal
is ignored or masked by the process, and use it appropriately
instead of directly checking p->p_sigmask and p->p_sigignore
2000-11-05 15:37:09 +00:00
enami 08810e4e74 Make this file compile again. 2000-11-02 06:57:01 +00:00
eeh d85adca51f Make line disciplines modular so they can be added or removed dynamically. 2000-11-01 23:51:38 +00:00
he a08889417a Use an rlim_t to store "available memory", so we don't needlessly
overflow and/or sign extend.
2000-10-29 18:38:47 +00:00
christos 0628f0a87e knf [from charles] 2000-10-17 23:38:55 +00:00
christos 23c15f1578 Don't set P_SUGID if the calls to set{e,}{u,g}id(), setreuid(),
setgroups() did not result in actual changes. This has the nice
side effect that we don't needlesly allocate new credential and
resource limit data structures.

This is so that non setuid programs that call seteuid(getuid()),
don't end up setting P_SUGID, resulting in broken behavior [i.e.
non setuid ssh, doesn't read ~/.hostaliases...].

This is a good candidate for a pullup, if someone reviews it.
2000-10-17 20:53:45 +00:00
itojun da566268df attach ARP domain only if INET is compiled into the kernel. 2000-10-02 04:27:21 +00:00
ad 50cf734d26 (*minphys)() musn't return zero. 2000-09-29 13:27:12 +00:00
eeh 1ecf6779be Add support for variable end of user stacks needed to support COMPAT_NETBSD32:
`struct vmspace' has a new field `vm_minsaddr' which is the user TOS.

	PS_STRINGS is deprecated in favor of curproc->p_pstr which is derived
	from `vm_minsaddr'.

	Bump the kernel version number.
2000-09-28 19:05:06 +00:00
enami 656bf989ab Factor out common code to manupilate file flags into separate function
like others do.
2000-09-28 06:43:20 +00:00
thorpej 69d28474b7 PHOLD/PRELE around uvm_io() to user address space is unnecessary. There
is nothing in the U-area that we need.
2000-09-26 23:59:23 +00:00
erh 3392996d23 Prevent ptrace on system processes. Avoids panic when attempting to ptrace pid 0, which has no parent. 2000-09-24 07:31:28 +00:00
bjh21 cf9703617a Conditionalise the declaration of sysctl_pty() so that we don't get a
compiler warning in the NPTY==0 case.
2000-09-23 11:33:05 +00:00
enami 6cf8248614 Stop runnable but swapped out user processes also in suspendsched(). 2000-09-23 01:00:35 +00:00
enami 25ea453471 Pathname of length 1023 (MAXPATHLEN - 1) should be valid as corename. 2000-09-23 00:48:29 +00:00
eeh ef06aa4d68 Fix unbalanced #endif. 2000-09-22 01:37:27 +00:00
eeh 3ec2906321 The files "kbd.h" and "ms.h" are defined in sys/dev/sun/files.sun. Only
include them for ports that are likely to use the Sun line disciplines.
2000-09-22 01:24:07 +00:00
eeh 9220a0cf6b Sun Keyboard/Mouse line discipline support. 2000-09-21 23:31:14 +00:00
bjh21 1f4240a461 Extend NFS_V2_ONLY to remove NQNFS lease support as well. Saves another 10k. 2000-09-19 23:26:25 +00:00
fvdl a6a5e6cca7 Adapt for VOP_FSYNC parameter change.
Small optimization to shutdown code: only take the syncer lock if
the FS actually used it.
2000-09-19 22:01:41 +00:00
fvdl 8c28d7e864 Adapt for VOP_FSYNC parameter change. 2000-09-19 22:00:01 +00:00
fvdl 9d8dbdad9a Regen. 2000-09-19 21:58:01 +00:00
fvdl bf60f8be2e Add start and end parameters to the fsync VOP, giving a range of the
file to write out. If both are 0, the whole file is synced. A filesystem
that is not able to sync out a range of a file may elect to sync
the whole file anyway.
2000-09-19 21:57:14 +00:00
enami 48b7bc7f16 The struct prochd isn't a proc. Start scaning from prochd.ph_link instead
of &prochd.
2000-09-15 06:36:25 +00:00
thorpej 03810b147f Make sure to lock the proclist when we're traversing allproc. 2000-09-14 19:13:29 +00:00
thorpej e3d2277d32 Regen: VNODE_OP_NOINLINE vs. LKM. 2000-09-13 16:09:52 +00:00
thorpej 7f3e4b0331 If building an LKM, always cause it to use the non-inline version
of the vnode ops, and if LKM support is included in the kernel,
always include the non-inline stubs regardless of whether or not
they're being used in the static kernel iamge.
2000-09-13 16:09:27 +00:00
thorpej 5d879e9012 Regen for VNODE_OP_NOINLINE. 2000-09-13 15:51:19 +00:00
thorpej 9d482308b1 Allow the VOP_*() calls to be un-inlined with the VNODE_OP_NOINLINE
kernel option.  Saves 36k of kernel text on an i386 GENERIC.  Useful
for install media kernels, small memory systems, embedded systems.
2000-09-13 15:50:26 +00:00
thorpej 72a24b4eae Add an align argument to uvm_map() and some callers of that
routine.  Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.
2000-09-13 15:00:15 +00:00
thorpej e0797e1775 Fix 0 vs. NULL confusion. 2000-09-11 18:45:29 +00:00
pk 13275642e0 make compile #if LOCKDEBUG is on. 2000-09-11 13:51:29 +00:00
jdolecek ae3a3247bb handle KERN_MAXPTYS via new sysctl_pty(), which uses pty_maxptys() provided
by tty_pty.c
2000-09-10 17:29:50 +00:00
jdolecek 9bdbbbc834 change DEFAULT_MAXPTYS to 256
make all local variables static
use simplelocks - we really need only mutexes, full locks are not necessary
update couple of comments to be more accurate

add function pty_maxptys(), which provides a safe way to get&set maxptys - this
	also supports setting maxptys to lower than current value, if the
	value is lower or equal current number of ptys
2000-09-10 17:26:45 +00:00
jdolecek 1ef0c139f9 allocate pty kernel structures on demand at run-time - this allows
to support arbitrary number of ptys without need of kernel recompile
(the extra device special files in /dev/ still need to be created, of course)

upper limit of supported ptys is controlled via new sysctl variable
kern.maxptys (KERN_MAXPTYS), which is raise-only and defaults to 512.
2000-09-09 16:42:04 +00:00
sommerfeld c9febd72cb Lock scheduler before putting new proc on run queues. 2000-09-06 14:06:42 +00:00
bouyer ca5824ec3b Implement suspendsched() by putting all sleeping and runnable processes
in SSTOP state, execpt P_SYSTEM and curproc processes. We have to way to
find the original state of the process so we can't restart scheduling,
so this can only be used at shutdown time.

XXX suspendsched() should also deal with processes running on other CPUs.
I don't know how to do that, and as long as we have a kernel big lock,
this shouldn't be a problem.
2000-09-05 16:27:51 +00:00
bouyer aacf1f7a6a Back out the suspendsched()/resumesched() thing, per request of Jason Thorpe &
Bill Sommerfeld. suspendsched() will be implemented in a different way.
2000-09-05 16:20:27 +00:00
enami 445cbcb8c1 Accquire vnode interlock while playing with flags to see if there
is someone waiting this vnode.
2000-09-05 05:13:43 +00:00
bouyer 6720d310ef wakeup()->sched_wakeup() 2000-09-01 17:14:04 +00:00
bouyer efc4435cb3 in vfs_shutdown(), use sched_suspend() to suspend scheduling, and use
tsleep() instead of DELAY. Also, keep trying flushing buffers when the
number of dirty buffers decreases (20 rounds may not be enouth for a
very large buffer cache).

Using tsleep instead of delay gives a chance to others kernel threads to run,
which is needed for raidframe. With this change I've not been able to
reproduce the 'dirty buffer not flushed' problem with raidframe.
2000-08-31 14:41:35 +00:00
bouyer 629150f864 Add the sched_suspend/sched_resume functions, as discussed on tech-kern,
with the following modifications to the initial patch:
- rename SHOLD and P_HOST to SSUSPEND and P_SUSPEND to avoid confusion with
  PHOLD()
- don't deal with SSUSPEND/P_SUSPEND in fork1(), if we come here while
  scheduler is suspended we're forking proc0, which can't have P_SUSPEND set.

sched_suspend() suspends the scheduling of users process, by removing all
processes from the run queues and changing their state from SRUN to
SSUSPEND. Also mark all user process but curproc P_SUSPEND.
When a process has to be put in SRUN and is marked P_SUSPEND, it's placed in
the SSUSPEND state instead.
sched_resume() places all SSUSPEND processes back in SRUN, clear the P_SUSPEND
flag.
2000-08-31 14:36:19 +00:00
jhawk a022cf9d37 Use
${MAKE}
instead of
  make
2000-08-30 23:51:46 +00:00
sommerfeld 1cbfb08951 Fix !LOCKDEBUG && !DIAGNOSTIC case 2000-08-28 21:07:52 +00:00
sommerfeld bdc30aed03 Since the spinlock count is per-cpu, we don't need atomic operations
to update it, so don't bother with <machine/atomic.h>

Flush kernel_lock_release_all() and kernel_lock_acquire_count() (which
didn't do spinlock accounting correctly), and replace them with
spinlock_release_all() and spinlock_acquire_count().
2000-08-26 19:26:43 +00:00
thorpej fe036cae9a Fix a printf format (for Alpha). 2000-08-26 17:02:16 +00:00
sommerfeld 340951f9d1 On second thought.. pass cpu_info * to roundrobin() explicitly. 2000-08-26 04:01:16 +00:00
sommerfeld ec08310fab More MP clock/scheduler changes:
- Periodically invoke roundrobin() from hardclock() on all cpu's rather
than from a timer callout; this allows time-slicing on non-primary cpu's.
 - Make pscnt per-cpu.
 - Notice psdiv changes on each cpu, and adjust pscnt at that point.
Also, invoke setstatclockrate() from the clock interrupt when each cpu
notices the divisor change, rather than when starting/stopping the
profiling clock.
2000-08-26 03:34:36 +00:00
sommerfeld 392f867be8 MULTIPROCESSOR: Initialize new proc's p_cpu pointer to NULL, so
anything which looks at it before it runs won't explode.
2000-08-25 02:55:49 +00:00
thorpej 4db6fc7542 Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity.  Its use in
roundrobin() still needs some work.
2000-08-25 01:04:06 +00:00
thorpej 4f944290a2 Correct a comment. 2000-08-24 06:14:34 +00:00
sommerfeld 6d8ab92a1a Move kernel_lock release/switch/reacquire from ltsleep() to
mi_switch(), so we don't botch the locking around preempt() or
yield().
2000-08-24 02:37:27 +00:00
sommerfeld 11eae2ffaf Default simple_lock_debugger to "on" on MULTIPROCESSOR.
Change uninitialized simple_lock check from KASSERT to use SLOCK_WHERE
(to show the "real" source line where the error was detected).
2000-08-23 15:17:47 +00:00
thorpej 7508bd7231 Use spllock() rather than splhigh(). 2000-08-22 19:47:26 +00:00
thorpej a2f2d10800 Slight adjustment to INTERLOCK_*() macros to make it easier
for the compiler to optimize.
2000-08-22 17:31:32 +00:00
thorpej f759220f40 Define the MI parts of the "big kernel lock" perimeter. From
Bill Sommerfeld.
2000-08-22 17:28:28 +00:00
eeh 3787c3f7fd Should use an `intrptr_t' for address calculations rather than `int'. 2000-08-22 16:44:51 +00:00
thorpej 25fe521af4 Fix a locking glitch in callwheel_slock handling. Noted by Bill Sommerfeld. 2000-08-22 15:30:59 +00:00
thorpej 14c0be9cd4 Protect hardclock_ticks and softclock_ticks with the callwheel
lock to prevent a race between hardclock() and callout_reset().
2000-08-21 23:51:33 +00:00
thorpej b7e86fa7a8 spllowersoftclock() is already void; no need to cast it. 2000-08-21 23:43:30 +00:00
thorpej 012500bf1f Add a lock for the callwheel (callout facility), and only go to
splclock() while holding it.
2000-08-21 23:40:56 +00:00
enami d707b78562 Declare this static simplelock data only when MULTIPROCESSOR or LOCKDEBUG is
defined to prevent compiler warning.
2000-08-21 06:42:57 +00:00
thorpej 7da965dade splsched() is appropriate for select()/poll(). 2000-08-21 06:27:59 +00:00
thorpej 5573e863c7 - Clean up _simple_lock_held()
- In simple_lock_switchcheck(), allow/enforce exactly one lock to be
  held: sched_lock.
- Per e-mail to tech-smp from Bill Sommerfeld, r/w spin locks have
  an interlock at splsched(), rather than splhigh().
2000-08-21 02:17:45 +00:00
sommerfeld 78e4a089b8 Don't bother reinitializing statically-inited locks 2000-08-21 02:16:30 +00:00
thorpej f42254818f splhigh() -> splsched() 2000-08-21 02:09:33 +00:00
thorpej a86d1f4891 Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it).  Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.
2000-08-20 21:50:06 +00:00
thorpej 8bc6ee56cb Lock debugging fix: Make sure a simplelock's lock_holder gets
initialized properly, and consistently tracks the owning CPU's
cpuid.  Add some diagnostic assertions to enforce this.
2000-08-19 19:36:18 +00:00
sommerfeld 8875442492 Statically initialize statically-allocated locks 2000-08-19 17:25:33 +00:00
cgd 0199b04bef update for changed makesyscalls.master 2000-08-18 19:35:15 +00:00
cgd 6858b430d3 tweak white space around generated NetBSD rcs ids 2000-08-18 19:33:30 +00:00
cgd c07a11c347 nuke __P for generated syscall prototypes and sy_call_t 2000-08-18 19:14:33 +00:00
itojun f5fa53578a repair m_dup(). specifically, now it is safe against non-MCLBYTES cluster
mbuf.  noone seem to be using this function at this moment.
2000-08-18 16:19:22 +00:00
itojun 243eebc256 disable m_dup(), as it makes false assumption on cluster mbuf and unsafe
(does not do the right thing).
2000-08-18 14:23:48 +00:00
itojun 1905ac079e add a comment about false assumption made by m_dup() 2000-08-18 14:12:47 +00:00
thorpej 3a1f5cdbfc If maniuplating a read lock on the proc list, we no longer need
to go to splclock() -- spinlockmgr() handles the interrupt blocking
while holding the interlock for us, now.
2000-08-17 14:37:54 +00:00
thorpej 391e1e1f44 For spinlocks, block interrupts while holding the interlock. Partially
from Bill Sommerfeld.
2000-08-17 14:36:32 +00:00
thorpej b6aaff9c44 Add a DIAGNOSTIC check for release of an unlocked lock.
From Bill Sommerfeld.
2000-08-17 04:18:21 +00:00
thorpej f2098b2382 Some more lock debugging support:
- LOCK_ASSERT(), which expands to KASSERT() if LOCKDEBUG.
- new simple_lock_held(), which tests if the calling CPU holds
  the specified simple lock.

From Bill Sommerfeld, modified slightly by me.
2000-08-17 04:15:43 +00:00
fvdl 4ca7344324 Fix omission in previous. 2000-08-15 17:54:59 +00:00
eeh 2ce37274f1 Fix LP64BE bug. 2000-08-15 16:26:42 +00:00
augustss ce60088d05 Define ltsleep() in the case of _EXTENT_TESTING so regressions testing
works again.
2000-08-12 23:56:50 +00:00
thorpej a91e7a7c6d Don't bother with a trampoline to start the pagedaemon and
reaper threads.
2000-08-12 22:41:53 +00:00
thorpej d66573f747 In reaper(), use ltsleep() instead of simple_unlock()/tsleep(). 2000-08-12 22:26:01 +00:00
sommerfeld 861fcc44b7 Use ltsleep(...,PNORELOCK..) instead of simple_unlock()/tsleep() 2000-08-12 16:43:00 +00:00
sommerfeld a6cdaddbe6 Use ltsleep(... PNORELOCK ) instead of simple_unlock()/tsleep() 2000-08-12 16:29:36 +00:00
sommerfeld 01233143b9 Use ltsleep instead of simple_unlock/tsleep/simple_lock 2000-08-12 16:28:30 +00:00
eeh cd557cfb3c Nother __kprintf_attribute__ to be removed. 2000-08-10 04:37:59 +00:00
tv 5b0a45ec9b Strip %b and DDB formats out of kprintf, as they are no longer supported. 2000-08-09 10:22:31 +00:00
thorpej 414765c253 In fill_kproc2(), testing p->p_stats != NULL doesn't do much good,
instead test for (p->p_flag & I_INMEM), and don't access the U-area
(via p->p_stats) if that bit is clear.  Fixes the hangs people have
seen when the system is paging and the user runs top/ps/w.
2000-08-08 23:42:07 +00:00
thorpej c70ada6428 Fix printf format error pointed out by Steve Woodford. 2000-08-08 19:55:26 +00:00
thorpej b9d2d53fb8 Add a DIAGNOSTIC or LOCKDEBUG check for held spin locks. 2000-08-07 22:10:52 +00:00
thorpej b24441d4d1 It doesn't make sense to charge simple locks to proc's, because
simple locks are held by CPUs.  Remove p_simple_locks (which was
unused anyway, really), and add a LOCKDEBUG check for held simple
locks in mi_switch().  Grow p_locks to an int to take up the space
previously used by p_simple_locks so that the proc structure doens't
change size.
2000-08-07 21:55:22 +00:00
bjh21 24f9914cb3 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
2000-08-07 18:10:20 +00:00
bjh21 a9397f5bfc Changes to syscalls.master to exclude ntp_adjtime(2) entirely if NTP is not
defined.  Changes to other files will follow in a moment.
2000-08-07 17:59:33 +00:00
thorpej 7cc27a88c0 Convert namei pathname buffer allocation to use the pool allocator. 2000-08-03 20:41:05 +00:00
thorpej 831865b30e MALLOC()/FREE() are not to be used for variable sized allocations. 2000-08-02 20:53:07 +00:00
thorpej c80a866888 MALLOC()/FREE() are not to be used for variable sized allocations. 2000-08-02 20:42:03 +00:00
thorpej 0b3ef940d0 MALLOC()/FREE() should not be used for variable sized allocations.
(A few remain here -- need to fix exec_script.c)
2000-08-02 20:36:33 +00:00
nathanw 729e93de71 principal -> principle (in a comment) 2000-08-02 20:21:36 +00:00
itojun eb0816bfcb allow admins to disable pps rate limitation, by setting "maxpps"
parameter to negative value.
2000-08-02 12:24:11 +00:00
thorpej cd32ace8bb ANSI'ify. 2000-08-01 04:57:28 +00:00
mrg a8fc5226d3 fix rev 1.44; make this cast look like:
sig = (int)(long)*(caddr_t *)data;
to *properly* dereference the passed data.  this makes signals on
ptys actually *work* on the sparc64 port.  from mycroft.


XXX: the release branch version needs this ASAP as it is probably
unstable on ILP32BE.
2000-07-28 04:31:19 +00:00
eeh 2152b574c0 Fix LP64BE bug. 2000-07-28 04:21:26 +00:00
mason fa62f74f37 Moving to a default of 64 PTYs. 2000-07-27 17:32:11 +00:00
mrg 705b50bf32 fix LP64 warnings. 2000-07-27 14:00:56 +00:00
mycroft 9daa55017e Fix the sparc_v9 hack... 2000-07-27 13:45:59 +00:00
mycroft 93a8d5ffea The ELF ABI declares that argc must fill an `argument slot'. Make it so.
For __sparc_v9__ only, do a hack to make old executables continue to work --
for now.
2000-07-26 15:42:09 +00:00
augustss 72afbf03cf Run power hooks in reverse installation order when powering down and
installation order when powering up.  This allows drivers in a hierarchy
to DTRT.
2000-07-26 12:24:52 +00:00
tron 6f6272c9e9 Include "uvm/uvm_param.h" to get definition of "VM_MAX_KERNEL_BUF" as
suggested by Richard Earnshaw. This fixes PR kern/10649.
2000-07-23 10:41:35 +00:00
simonb da251cb08f Delete a couple of <uvm/uvm_extern.h> includes that were for
<sys/sysctl.h> only.
2000-07-22 16:11:02 +00:00
jdolecek b0fb24279c change the lf_advlock() arguments from
int     lf_advlock __P((struct lockf **,
           off_t, caddr_t, int, struct flock *, int));
to

int     lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).
2000-07-22 15:26:11 +00:00
jeffs ddc66457b1 Same change in the kgdb code as was done in ddb:
Move platform db_trap callback from arch/mips into ddb as suggested by
  jhawk.  This callback is used by platform code to manage things like
  watchdogs that should be disabled while in ddb.  Done as a callback
  for processors such as mips that support lots of different systems.
2000-07-18 21:49:08 +00:00
fvdl 57e3691758 Don't wait for B_READ buffers to finish in vfs_shutdown, it makes no sense
to do so.

From Ethan Solomita.
2000-07-16 21:07:24 +00:00
fvdl 9067306192 Don't use *(unsigned int *)data to get the signal number out; this will
fail on LP64-BE systems. Also, fix up the invalid signal number check.
2000-07-14 12:10:58 +00:00
thorpej 195bf5c09f - Fix the likely cause of the "ps(1) hangs machine" problem. Always
vslock the user pages for the data being copied out to userspace,
  so that we won't sleep while holding a lock in case we need to
  fault the pages in.
- Sprinkle some const and ANSI'ify some things while here.
2000-07-14 07:21:21 +00:00