Commit Graph

250 Commits

Author SHA1 Message Date
christos 1510fe1543 defopt verified_exec. 2005-07-16 22:47:18 +00:00
simonb bf458186f4 White space KNF nit. 2005-07-15 03:59:31 +00:00
thorpej 65412a2710 Implement expansion of special "magic" strings in symlinks into
system-specific values.  Submitted by Chris Demetriou in Nov 1995 (!)
in PR kern/1781, modified only slighly by me.

This is enabled on a per-mount basis with the MNT_MAGICLINKS mount
flag.  It can be enabled at mountroot() time by building the kernel
with the ROOTFS_MAGICLINKS option.

The following magic strings are supported by the implementation:

	@machine	value of MACHINE for the system
	@machine_arch	value of MACHINE_ARCH for the system
	@hostname	the system host name, as set with sethostname()
	@domainname	the system domain name, as set with setdomainname()
	@kernel_ident	the kernel config file name
	@osrelease	the releaes number of the OS
	@ostype		the name of the OS (always "NetBSD" for NetBSD)

Example usage:

	mkdir /arch/i386/bin
	mkdir /arch/sparc/bin
	ln -s /arch/@machine_arch/bin /bin
2005-06-23 00:30:28 +00:00
christos efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
lukem 3fd1802e62 Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.
2005-04-25 15:02:02 +00:00
blymn 8387760ed1 Rototill of the verified exec functionality.
* We now use hash tables instead of a list to store the in kernel
    fingerprints.
  * Fingerprint methods handling has been made more flexible, it is now
    even simpler to add new methods.
  * the loader no longer passes in magic numbers representing the
    fingerprint method so veriexecctl is not longer kernel specific.
  * fingerprint methods can be tailored out using options in the kernel
    config file.
  * more fingerprint methods added - rmd160, sha256/384/512
  * veriexecctl can now report the fingerprint methods supported by the
    running kernel.
  * regularised the naming of some portions of veriexec.
2005-04-20 13:44:45 +00:00
chs ad79fc3015 move the call to link_pool_init() to the end of uvm_init(). needed for sun3. 2005-01-23 19:02:02 +00:00
mycroft 0461b30ac3 Rework the mountroot interface so that vfs_mountroot() opens the root device
and just passes it on to the file system functions.  This avoids opening and
closing the device several times.

Mentioned on tech-kern some time ago, IIRC.  I've been running this for a
long time.
2005-01-09 03:11:48 +00:00
thorpej 11103d1865 No longer need <sys/disk.h> 2004-10-15 07:22:02 +00:00
thorpej 99e5d764c1 - Eliminate the need to call disk_init().
- disk_count needs to be protected with disklist_slock, too.
2004-10-15 07:19:01 +00:00
yamt 0994e6acb8 introduce a function, proclist_foreach_call, to iterate all procs on
a proclist and call the specified function for each of them.
primarily to fix a procfs locking problem, but i think that it's useful for
others as well.

while i'm here, introduce PROCLIST_FOREACH macro, which is similar to
LIST_FOREACH but skips marker entries which are used by proclist_foreach_call.
2004-10-01 16:30:52 +00:00
pk a7c40722d8 Call inittodr() from main(). Let file system code set the recorded `last
update' time (if any) through the new function setrootfstime().
2004-07-05 07:28:45 +00:00
nathanw 956448b619 Initialize simple_lock in struct cwd; otherwise, one gets an
uninitialized lock panic at the first use of cwdshare().
2004-06-03 20:35:30 +00:00
pk fba1aa540d Provide a mutex for the process limits data structure. 2004-05-06 22:20:30 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
matt b173c9d332 Make kernel continuations optional for now. 2004-03-28 22:43:56 +00:00
jonathan 63fe9ef057 Use proper NetBSD conventions for deferred kthread creation, not the
other semantics from an earlier incarnation.

Call kcont_init() from init_main before device autoconfiguration,
so kcont is availble to device drivers if required.

Also ensure the kthread process runs any pending continuations once
the kthread is finally up and running. For now, use a non-null timeout
to poll the queue periodically.  Draining any pending requests just
before the kthread enters its ltsleep()/kc_run loop is cleaner, but
this is the version I tested with an early-in-boot kcont request.)
2004-03-27 00:42:38 +00:00
junyoung 70706199eb Whitespaces. 2004-03-09 02:35:45 +00:00
tls 0d6723b09f Bump default size of vnode cache to 1% of physical memory, instead of
0.5%, based on some quick measurements on a number of workstations and
small fileservers (including my home fileserver running simultaneous
builds of the NetBSD source tree and several NetBSD kernels).  This
brings the hit rate on my machines from below 70% to above 90%.  We
should be able to tune this as we run, by tracking the hit rate and
increasing the size of the cache if memory permits.

Some systems will still require significantly larger cache sizes.  Some
ports -- notably the 64-bit ones -- probably should use more than 1% of
physmem as the default due to the larger size of struct vnode.
2004-01-09 00:04:53 +00:00
lukem 7bb9d6c875 Store the copyright text in conf/copyright, and use conf/newvers.sh
to generate the appropriate  const char copyright[] = "...";
statement instead of hard coding it into kern/init_main.c.
Idea from Simon Burge.
2004-01-05 03:33:06 +00:00
jdolecek 089abdad44 Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
  as FPU state), and is the last potentially blocking operation;
  all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
  by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
  for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread
2004-01-04 11:33:29 +00:00
mycroft a9866938b5 Welcome to 2004! 2004-01-01 00:00:05 +00:00
pk 70f20a1217 Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes).  It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms.  Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.
2003-12-30 12:33:13 +00:00
jonathan a03a5696d5 include <sys/mbuf.h> before FAST_IPSEC-dependent headers. 2003-11-14 07:13:25 +00:00
dsl 2ffbd2ab99 Remove p_nras from struct proc - use LIST_EMPTY(&p->p_raslist) instead.
Remove p_raslock and rename p_lwplock p_lock (one lock is enough).
Simplify window test when adding a ras and correct test on VM_MAXUSER_ADDRESS.
Avoid unpredictable branch in i386 locore.S
(pad fields left in struct proc to avoid kernel bump)
2003-11-04 10:33:15 +00:00
jdolecek 1cfc34d60f use LIST_FOREACH() as appropriate 2003-11-02 16:42:22 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
jonathan 333cceb477 (FAST_IPSEC): Pull in option header-test for FAST_IPSEC (and IPSEC).
If FAST_IPSEC is configured, attach fast-ipsec transforms after
autoconfiguring devices (perhaps including crypto hardware)
but before starting up network-device packet input.
2003-08-06 20:30:38 +00:00
jonathan 460c06b905 Move the initialization of the crypto framework from the userland
pseudo-device to init_main(), so the framework is ready for
registration requests at autoconfiguration time.

Thanks to Quentin Garnier for confirming the change was required, and
for testing a similar fix.
2003-07-30 18:45:31 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
thorpej a06b275edc Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget().  Turns out
  that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
  and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
  above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
  just to appease the above.
2003-06-29 18:43:21 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
dsl 9be8ac5294 Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
2003-03-19 11:36:32 +00:00
christos 1df6f4ff40 add support for p1003.1b semaphores. From FreeBSD 2003-01-20 20:02:56 +00:00
thorpej e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00
mycroft d73e77b28c Update copyright notice. 2003-01-01 00:00:13 +00:00
abs 39387a63f4 Define nofile and maxuprc variables (set to NOFILE and MAXUPRC), so they can
be patched in a compiled kernel.
2002-12-11 23:23:45 +00:00
yamt 172a847692 initialize uvm.aiodoned_proc. 2002-12-05 10:30:00 +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
chs ab17ec89d1 add support for __MACHINE_STACK_GROWS_UP platforms. from fredette@ 2002-11-17 22:53:46 +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
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
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 71404bb533 Don't include <sys/map.h>. 2002-09-25 22:21:01 +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
thorpej d4a2567abe Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-25 19:13:08 +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
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
christos acf2d4083d Niels Provos systrace work, ported to NetBSD by kittenz and reworked... 2002-06-17 16:22:50 +00:00