Commit Graph

4274 Commits

Author SHA1 Message Date
wrstuden 6336cd3696 The file being closed is (fdp->fd_lastfile - i), not i. So compare
(fdp->fd_lastfile - i) against fd_knlistsize. Otherwise we can
call knote_fdclose() on a file descriptor that doesn't have a knote.

This issue explains random panics I have had on process exit over the
past few years.
2005-05-20 16:13:00 +00:00
elad 5888b16eef Some changes in veriexec.
New features:

  - Add a veriexec_report() routine to make most reporting consistent and
    remove some common code.
  - Add 'strict' mode that controls how veriexec behaves.
  - Add sysctl knobs:
     o kern.veriexec.verbose controls verbosity levels. Value: 0, 1.
     o kern.veriexec.strict controls strict level. Values: 0, 1, 2. See
       documentation in sysctl(3) for details.
     o kern.veriexec.algorithms returns a string with a space separated
       list of supported hashing algorithms in veriexec.
  - Updated documentation in man pages for sysctl(3) and sysctl(8).

Bug fixes:

  - veriexec_removechk(): Code cleanup + handle FINGERPRINT_NOTEVAL
    correctly.
  - exec_script(): Don't pass 0 as flag when executing a script; use the
    defined VERIEXEC_INDIRECT - which is 1. Makes indirect execution
    enforcement work.
  - Fix some printing formats and types..
2005-05-19 20:16:19 +00:00
cube 9a1ab71f5f Add P_CLDSIGIGN, P_NOCLDSTOP and P_NOCLDWAIT to the list of flags we want
to inherit from the parent process.
2005-05-17 19:22:19 +00:00
christos 362a4a0bd5 Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
2005-05-17 04:14:57 +00:00
christos 6919a4b65c don't unlock twice. 2005-05-09 23:40:20 +00:00
christos 3b37af53b0 lock all uses of uidhash. provide macros to lock and unlock. based on more
discussions with yamt.
2005-05-09 11:10:07 +00:00
christos 0c55badfae Protect chgsbsize() with splsoftnet(). As discussed with yamt. 2005-05-09 03:27:21 +00:00
christos 8dc75b1c08 Panic strings should not end with \n. 2005-05-08 18:44:39 +00:00
christos 761bd09636 PR/30154: YAMAMOTO Takashi: tcp_close locking botch
chgsbsize() as mentioned in the PR can be called from an interrupt context
via tcp_close(). Avoid calling uid_find() in chgsbsize().
- Instead of storing so_uid in struct socketvar, store *so_uidinfo
- Add a simple lock to struct uidinfo.
2005-05-07 17:42:09 +00:00
martin e8c879147d In m_pulldown avoid a prepend to the next mbuf in the chain if the result
would still not have all data we want continous.
Fixes PR kern/30098.
2005-05-06 09:40:40 +00:00
manu 89647c7ca6 First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
2005-05-03 16:26:27 +00:00
blymn 9c99b5674f Don't adjust the size of the hash table on file removes, it breaks things. 2005-04-26 10:45:41 +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 d725d86471 Fix possible bad memory reference, add panic on inconsistent state. 2005-04-24 12:58:26 +00:00
blymn 877d9e76c3 Remove bogus DIAGNOSTIC check and panic. 2005-04-23 09:10:47 +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
mrg 1ec9145306 be explicit in the description for POSIX saved set-id that this is for
POSIX-style, not sane-style.  (ie, add "POSIX " to the description.)
2005-04-18 10:46:39 +00:00
hannken 23bc271d48 `lkmlookup()' is called with its name argument either from kernel or from
user space. Add an argument `need_copyin' to only use `copyinstr()' if
the name is from user space.

modstat -n NAME works again.

Reviewed by: Peter Postma <peter@netbsd.org>
2005-04-12 14:13:16 +00:00
itohy 34088139ab The definition of IRFRAMEDISC (10) is incorrect since the value is dynamic.
The *DISC definition is only for backward compatibility with deprecated
TIOC[GS]ETD ioctls, and not needed for new TIOC[GS]LINED ioctls.
The value of IRFRAMEDISC has never been correct, so we don't have any
compatibility to be kept.
Just remove the IRFRAMEDISC defintion.
2005-04-10 14:28:11 +00:00
christos 92987fed44 Reset SIGCHLD handler if it is ignored, and clear the P_CLDSIGIGN bit. It
does not make sense to inherit this across execs. From FreeBSD.
2005-04-09 16:07:52 +00:00
yamt 9eabef72e3 don't #include unnecessary headers. 2005-04-07 12:12:51 +00:00
yamt 2fc4b4f5e7 sys_mount:
- reject attempts of MNT_GETARGS + other MNT_xxx.
- don't modify mnt_flags needlessly for MNT_GETARGS.
  a stopgap fix for PR/29898.
2005-04-06 13:49:31 +00:00
yamt dad03fda36 introduce new types, blist_bitmap_t and blist_blkno_t,
and use them instead of uint64_t.
make them 32-bit for now because it's what swap slot allocation code uses.
2005-04-06 13:09:10 +00:00
yamt a1bde39425 move implementation details from blist.h into subr_blist.c. 2005-04-06 11:36:37 +00:00
yamt a1e1c4e82e - add a missing cast in the 1-bit optimization case of blst_leaf_alloc.
- use uint64_t rather than daddr_t/u_daddr_t and rename SWAP -> BLIST.

XXX 32 bit is enough?  will revisit later.
2005-04-06 11:35:54 +00:00
yamt 2c8d11ba2b make blist compilable on netbsd. 2005-04-06 11:33:54 +00:00
yamt 186b3b1026 bring in blist from freebsd as-is. 2005-04-06 11:32:06 +00:00
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
yamt 99229e5d39 introduce a function to drain bufq and use it where appropriate. 2005-03-31 11:28:53 +00:00
chs c92634930b fix validation of new values when setting vm.{hi,low}water. fixes PR 29651. 2005-03-31 02:34:10 +00:00
christos f9a341d1f6 PR/19837: Stephen Ma: signal(SIGCHLD, SIG_IGN) should not create zombies. 2005-03-30 17:07:50 +00:00
christos 518587967d Re-enable chgsbsize. It should work now. 2005-03-29 18:18:06 +00:00
he 8c10d661b0 Properly disable the bulk of chgsbsize(), completing revision 1.84.
This does an #if 0 / #endif, so that no code (or declarations!) are
left after the first "return 1", making this compilable for vax and
playsation2 again, both of which use gcc 2.95.3 or similar.
2005-03-29 15:57:17 +00:00
thorpej e633e8b61b - Define a VFS_ATTACH() macro that places a reference to a vfsops structure
into the "vfsops" link set.
- Use VFS_ATTACH() where vfsops are declared for individual file systems.
- In vfsinit(), traverse the "vfsops" link set, rather than vfs_list_initial[].
2005-03-29 02:41:05 +00:00
matt 9034eca609 Add code to preen proc0 cache fter loading a LKM.
(conditional on PMAP_NEED_PROCWR)
2005-03-27 08:34:41 +00:00
fvdl c487efe4a7 Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
  that will return the default VM map address. The default function
  is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
  macro. This gives emulations control over the default map address,
  and allows things to be mapped at the right address (in 32bit range)
  for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
  or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
  instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
2005-03-26 05:12:34 +00:00
christos b279845eed Don't free the wrong lock. Pointed out by Konrad Schroder 2005-03-25 22:48:23 +00:00
christos ae9d3eacae Avoid a possible race during the time we give up our lock in order to
allocate memory. (From yamt)
2005-03-23 04:01:04 +00:00
christos e0ba8227a7 Don't call malloc with a simple_lock held. Thanks to Greg Oster for pointing
my stupid mistake.
2005-03-23 01:16:44 +00:00
christos cb282cd325 Keep track and limit the number of locks per uid. From OpenBSD 2005-03-20 19:16:33 +00:00
christos f7c5085de0 It does not make sense to free the uidinfo struct since it is used now
for multiple things (proccnt,lockcnt,sbsize) and it adds too much code
complexity. Instead add a uid_find() routine that returns the existing
struct or allocates a new one.

Re-enable the sbsize limit code.
2005-03-20 19:15:48 +00:00
bouyer e97ceab999 Fix off-by-one bug which would cause a region at the end of the extent
to be alloctated multiple times:
- we're allocating region of size 1
- there are holes in the extent, but all of size larger than 1
- there are 2 contigous allocations at the end of the extent, the last one
  being of size 1.
While there fix a DIAGNOSTIC check: to check that a region is inside the extent
we need to check start and end, not only start.
2005-03-15 18:22:24 +00:00
christos d232675d86 PR/29679: Gunnar.Ritter: fstat() blksize on the write side of the pipe returns
0. Fix it by returning the peer's block size.
XXX: This is the minimal fix. Probably the buffer size should be initialized
somewhere else, but probably this would need some more code changes.
2005-03-12 18:43:42 +00:00
atatat 5b8a6c916d Revert the change that made kern.file2 and net.*.*.pcblist into nodes
instead of structs.  It had other deleterious side-effects that are
rather nasty.  Another solution must be found.
2005-03-11 06:16:15 +00:00
atatat ca63da437a Change types of kern.file2 and net.*.*.pcblist to NODE 2005-03-10 05:43:25 +00:00
atatat 7c62c74d09 Add the following nodes to the sysctl tree:
net.local.stream.pcblist
	net.local.dgram.pcblist
	net.inet.tcp.pcblist
	net.inet.udp.pcblist
	net.inet.raw.pcblist
	net.inet6.tcp6.pcblist
	net.inet6.udp6.pcblist
	net.inet6.raw6.pcblist

which allow retrieval of the pcbs in use for those protocols.  The
struct involved is 32/64 bit clean and incorporates parts of struct
inpcb, struct unpcb, a bit of struct tcpcb, and two socket addresses.
2005-03-09 05:07:19 +00:00
atatat 529b14ddf5 Add kern.file2. As kern.proc2 is to kern.proc, so is kern.file2 to
kern.file, namely a 32/64 bit clean sysctl interface to the same data.
It also borrows a few things from struct vnode (if applicable) and
from struct proc, just to tie things together a bit more.

You can walk this list "by file" or "by pid".  The former method is
similar to kern.file but omits the filehead, and the latter can give
you duplicates if multiple processes have the same struct file open,
but tells you which process it is.
2005-03-09 05:02:17 +00:00
wrstuden a758abc39e Adjust error case handling. If the VOP_LOOKUP() call unlocked the
parent directory node, remember that.

Addresses locking/lookup issues seen in:

http://mail-index.NetBSD.org/tech-kern/2004/06/20/0019.html
http://mail-index.netbsd.org/tech-kern/2005/01/08/0000.html
2005-03-08 17:29:29 +00:00
yamt f81c9770f3 bufq_priocscan_get: don't update state in the case of !remove. fix BUFQ_PEEK. 2005-03-03 05:00:22 +00:00
christos 8eb274055a Some ibcs2 binaries need executable stacks. Thanks to J Chapman Flack
for determining this and coming up with a fix.
2005-03-03 04:39:37 +00:00
mycroft b9c71ccc7a Copyright maintenance. 2005-03-02 11:05:34 +00:00
perry 77f2a006d0 regen 2005-02-26 23:58:19 +00:00
perry aaec764348 get rid of trailing spaces in the "created from" line (constructed by
stripping the $s from $NetBSD$ in the source file.)
2005-02-26 23:32:31 +00:00
perry b244cb9316 regen 2005-02-26 22:15:10 +00:00
perry 573311af21 revert trailing whitespace change -- it had unintended consequences 2005-02-26 22:14:39 +00:00
perry ba7c4ed2a6 regen 2005-02-26 22:10:31 +00:00
perry f05ce97c60 remove some trailing spaces in generated output when removing $s from $NetBSD$ 2005-02-26 22:06:38 +00:00
perry deef459f67 Change the DO NOT EDIT warning slightly, including the text "DO NOT EDIT".
(It is nice if all files that should not be edited have DO NOT EDIT in them.)
2005-02-26 21:40:45 +00:00
perry da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
matt 7eddba88c0 Add the code for pselect and pollts. Add selcommon and pollcommon to
<sys/select.h> and <sys/poll.h>.
2005-02-25 19:56:07 +00:00
matt 47a6f2d4b0 Regen. (for pselect and pollts) 2005-02-25 19:55:18 +00:00
matt 124745835a Add pselect and pollts 2005-02-25 19:53:56 +00:00
heas 57cef74601 Expose sysctl_root node to kernel sources. It will be used by FreeBSD sysctl
emulation.
2005-02-20 19:43:46 +00:00
matt 832084d8ae Regen. (no actual differences) 2005-02-19 22:19:02 +00:00
matt 16cf76fdc3 Add placeholders for sys_pselect and sys_pollts 2005-02-19 22:15:51 +00:00
peter e5d29518c6 Remove one repeated word. From Martin Végiard. 2005-02-18 00:21:37 +00:00
peter dc3b7c44eb Fix a typo, recieve -> receive. From Martin Végiard. 2005-02-18 00:17:13 +00:00
elric e6e79dacef The API for ksyms_getval_from_kernel changed. 2005-02-16 00:30:28 +00:00
cube 9367bbf87b The way I handled /dev/ksyms requests vs. kernel requests was completely
broken.  Inside the kernel, we always have to use the real values of the
st_name fields, and only do the math when the request comes from userland.

No need for ksyms_getval_from{kernel,userland} hack anymore.  However, a
different version will be asked for pull-up in -2{,-0}, one that doesn't
break the API, that is.

Fixes PR#29133 from Jens Kessmeier.
2005-02-15 21:09:57 +00:00
christos be3704c73f pass the flag to fdclone. 2005-02-12 23:14:03 +00:00
fvdl 7b10f1cabc Don't panic when lwp_suspend finds an LWP on another CPU, just return
EINVAL for now.
2005-02-12 21:39:00 +00:00
jmc 02a4880993 vm_map_max needs a struct pointer, so add a missing deref here 2005-02-12 09:38:25 +00:00
chs 467487d274 use vm_map_{min,max}() instead of dereferencing the vm_map pointer directly.
define and use vm_map_set{min,max}() for modifying these values.
remove the {min,max}_offset aliases for these vm_map fields to be more
namespace-friendly.  PR 26475.
2005-02-11 02:12:03 +00:00
christos 7651651a23 Don't de-reference a NULL ktd on error. Fix from enami, thanks. 2005-02-09 16:15:16 +00:00
fvdl af5309b07c Change the 'sz' variable in bounds_check_* to int64_t to avoid overflows
when a very large blocknumber is passed in.
2005-02-08 08:56:21 +00:00
christos a9fed9480a Allow 32K instead of 1K of section headers. Solaris opera binary has 15K
section headers. We only allocate memory for those headers on compat_linux
and compat_ibcs2 while we probe, and although 32K is not such a big number,
we could fix the code in those two places to read section-by-section instead
of all the sections at once as it does now, if we really felt like it.
2005-02-07 00:12:49 +00:00
christos 4cf9bb2fc2 Change an if/panic statement to a KASSERT and disable a chatty printf. 2005-02-06 23:57:29 +00:00
chs 9a3f782ac4 define a new LWP flag which indicates that we're in the process of
doing a context switch.  use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).
2005-01-30 16:56:26 +00:00
christos 8633e293d5 make sure that bss size > 0 before we add a vmcmd for it. 2005-01-29 20:14:04 +00:00
wrstuden e384a44e9d Extend fsync_range(2) to support the FDISKSYNC flag, which requests
that the sync be propogated out through the disk drive caches.
2005-01-25 23:55:20 +00:00
dbj 208b0b3a89 clear p->p_cwdi of exiting processes and
avoid dereferencing invalid p_cwdi in checkdirs
this fixes a race condition between exiting processes and mount
see discussion on tech-kern:
 http://mail-index.netbsd.org/tech-kern/2004/10/04/0006.html
 http://mail-index.netbsd.org/tech-kern/2004/10/08/0005.html
2005-01-24 21:27:02 +00:00
matt 027c11539b Add IFNET_FOREACH and IFADDR_FOREACH macros and start using them. 2005-01-24 21:25:09 +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
matt d341be30f4 Change initialzie of domains to use link sets. Switch to using STAILQ.
Add a convenience macro DOMAIN_FOREACH to interate through the domain.
2005-01-23 18:41:56 +00:00
yamt f6e639255b lkmunreserve: free memory to the correct vm_map when kernel_map != lkm_map. 2005-01-23 08:41:02 +00:00
yamt c3b17808da cc_microset: #if 0 out a diagnositc printf.
this functions is called from ipi handler.
2005-01-23 08:39:51 +00:00
christos 201de1bdd0 Cast nkmempages to vsize_t before shifting to avoid overflow. Requested
by soda.
XXX: should be pulled up to 2.0.
2005-01-14 17:03:58 +00:00
cube fade05f67f As fd_lastfile might be negative, we can't use the (u_int) cast trick to
compare fd and fdp->fd_lastfile in fdrelease(), so change the test to a
more explicit one.  Spotted by Matt Thomas.

Should fix the panic reported by Matthias Scheler.
2005-01-14 00:25:12 +00:00
yamt 48355cdf13 kmeminit_nkmempages: don't limit the size of kmem_map to physmem/4
because, while there's little benefit to do so, it easily causes
"out of space in kmem_map" panic on machines with small memory.
2005-01-13 11:49:09 +00:00
christos 53aa30e2eb s/vp->v_uobj.vmobjlock/vp->v_interlock/. This is the last instance in kern/*.c 2005-01-12 21:51:52 +00:00
cube 8ec7c6764b fd_lastfile should be -1 when there are no opened file descriptors.
Hence, make find_last_set return -1 in such situation, and initialize it
such.  Otherwise, with 0 meaning two things, it confused the F_CLOSEM
fcntl which could end up looping indifintely (PR#28929 by Brian Marcotte).

However, this change enlightens another bug in fdcopy(), where more entries
than needed were cleared in the new file descriptor table, so the memset()
call there is fixed too.

Analyzed with the help of Greg Oster.
2005-01-12 20:41:45 +00:00
tls abcbeb46d9 Users have observed that the amount of memory used by the metadata cache
can in some situations exceed the high-water mark, and stay there once it
gets there.  Adjust the canrelease function so that it will immediately
bring us back down to the high-water mark in this situation.

How can this happen at all?  Consider a machine with two filesystems, one
with a much larger blocksize than the other.  If the small-block filesystem
is very busy, growing the cache up to the high-water mark, and then the
large-block filesystem becomes busy, buffers will be recycled (since we
are at the high-water mark) but _grow each time they're recycled_.  Once
we're above the high-water mark, the canrelease call in allocbuf (without
this change) doesn't shrink us back down below it; so things get worse and
worse.
2005-01-10 15:29:50 +00:00
christos 4bfe82cbac Flip the order of two lines I mixed. Thanks to wiz for noticing. 2005-01-09 20:25:26 +00:00
christos 82ee9647b8 Allow PT_DUMPCORE to specify the core filename. 2005-01-09 19:22:55 +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
mycroft 13495aa242 If sa_upcall() fails (which is always going to be due to resource exhaustion),
do not leak siginfo structures.

Note that in the cases of trap signals and timer events, losing this
information could be very bad; right now it will cause us to spin until the
process is SIGKILLed.

"Needs work."
2005-01-06 19:26:41 +00:00
thorpej 4dfb0d5670 Regen for extended attribute system calls. 2005-01-02 17:47:29 +00:00
thorpej aee687701e Regen for extended attribute VOPs. 2005-01-02 17:46:41 +00:00
thorpej 1c95472d01 Add the system call and VFS infrastructure for file system extended
attributes.

From FreeBSD.
2005-01-02 16:08:28 +00:00
yamt 097f0ea734 PR_NOTOUCH:
- use uint8_t instead of uint16_t for freelist index.
- set ph_off only if PR_NOTOUCH.
- comment.
2005-01-01 21:09:56 +00:00
yamt a880e5e2b5 in the case of !PMAP_MAP_POOLPAGE, gather pool backend allocations to
large chunks for kernel_map and kmem_map to ease kva fragmentation.
2005-01-01 21:08:02 +00:00
yamt aa64686bba introduce a new flag for pool_init, PR_NOTOUCH.
if it's specified, don't use free items as storage for internal state.
so that we can use pools for non memory backed objects.
inspired from solaris's KMC_NOTOUCH.
2005-01-01 21:04:39 +00:00
yamt 95c82bfee4 introduce vm_map_kernel, a subclass of vm_map, and
move some kernel-only members of vm_map to it.
2005-01-01 21:02:12 +00:00
simonb 60e6b50deb Spell "available" correctly. 2005-01-01 03:24:43 +00:00
jdolecek f201f239e3 #ifdef DDB rdyfail label, too 2004-12-30 12:12:16 +00:00
jdolecek aca74c5304 only do the temporary symbol table load #ifdef DDB and add comment for
the code block, so that the purpose is more clear

avoid NULL pointer dereference in lkmunreserve() called on lkm device
close when ksym_addsymtab() fails for the temporary symbol table
(sanity change only, this can never happen at the moment)
2004-12-30 11:47:02 +00:00
jdolecek b90395b379 fix two issues regarding handling of ksyms (modload -s):
* only add the symbol table for the current module if the LKM_E_LOAD
  hook returns success; otherwise we overwrite the LKM_E_LOAD error,
  which may ultimately lead to (incorrectly) allowing the module load
* only delete the sumbol table for current module if we actually added
  the symbol table; avoids deleting symbol table of previously loaded
  module when the same module is loaded twice, when the second load
  fails with EEXIST

fixes PR kern/28803 by Jens Kessmeier
2004-12-30 11:35:41 +00:00
dbj b2c6a6a4ea also define bioops if FFS is not defined. 2004-12-23 20:11:28 +00:00
christos 91a90a7c68 - Move string array definitions and bitmap array definitions to the appropriate
header files, so that they don't become out of sync (again).
- Use bitmask_snprintf() instead of hand-rolled code.
- Always check array bounds before dereferencing print arrays.
- Order arguments in the vnode printing functions consistently.
2004-12-18 03:07:40 +00:00
yamt 819738713e sys_acct: use VOP_SETATTR instead of VOP_TRUNCATE as the latter's
filesystem internal.  while i'm here, fix vnode locking.

XXX vn_start_write
2004-12-13 08:46:43 +00:00
yamt 3290f3a078 vn_lock: #if 0 out an assertion for now. (until PR/27021 is fixed) 2004-12-12 04:46:46 +00:00
matt 108f8fbc51 Add some debug code to validate the runqueues if RQDEBUG is defined. 2004-12-09 21:52:24 +00:00
jrf ac053b9ef0 Fix previous commit, got bufcache and bufmem messages reversed. 2004-12-05 06:12:54 +00:00
jrf cd5b5ced44 Change sysctl -d vm.bufcache to say percent of physical memory not
kernel memory. Addresses PR misc/27233. Approved by atatat@netbsd.org.
2004-12-05 06:00:20 +00:00
christos 31c81b28f5 Cloning cleanup:
1. make fileops const
2. add 2 new negative errno's to `officially' support the cloning hack:
    - EDUPFD (used to overload ENODEV)
    - EMOVEFD (used to overload ENXIO)
3. Created an fdclone() function to encapsulate the operations needed for
   EMOVEFD, and made all cloners use it.
4. Centralize the local noop/badop fileops functions to:
   fnullop_fcntl, fnullop_poll, fnullop_kqfilter, fbadop_stat
2004-11-30 04:25:43 +00:00
thorpej 29671d6616 Fix the fcntl entry points; cmd is a command, not the flags themselves.
Pointed out by Christos (he wrote the broken code originally, and I copied
it to another file later :-)
2004-11-28 07:44:05 +00:00
yamt eb54e7db24 lookup bufq using link_set rather than a switch statement. 2004-11-25 04:52:23 +00:00
christos 96832589f8 Limit the hard-coding of things to tty_bsdpty.c. 2004-11-24 22:19:27 +00:00
yamt 548e34d26e pipe_direct_write: fallback to non-loan write in the case of
any errors from uvm_loan(), rather than only for ENOMEM, which is
never returned by uvm_loan().
2004-11-21 04:30:33 +00:00
peter 5dc9788b36 Fix a typo, dependancy -> dependency
ok wiz@
2004-11-19 14:18:53 +00:00
atatat 612e86b46d Wrap TIMEVAL_TO_TIMESPEC and TIMESPEC_TO_TIMEVAL macros in
do { ... } while(/*CONSTCOND*/0)

so that they can be used unadorned in if/else blocks, etc.  This means
that you now *have* to put a ; at the end of the "call" to these
macros.
2004-11-14 03:30:08 +00:00
christos 7ea1254f12 vgoneall is no more. remove redundant decl. 2004-11-14 00:36:21 +00:00
christos 6665736bf9 Truncate the last incomplete accounting record, if the file size is not
a multiple of the accounting size structure. This can happen after a system
crash when fsck truncates the accounting file.
2004-11-13 20:41:41 +00:00
christos dfa8d84485 PR/25749: Peter Postma: Missing splx() in kernel. 2004-11-13 19:16:18 +00:00
christos 81021e3081 In TIOCPTSNAME return the minor number of the device in the fd portion of
the structures. It is more useful than -1 and cheap to do. Linux pty emulation
uses it.
2004-11-13 08:46:46 +00:00
christos f03f3b9452 Split the ptm driver out of tty_pty.c into its own file. From that split
the code that `knows' about /dev/[pt]tyXX names (the BSD ptys) into a separate
file. Make an interface to be used by the tty creating provider. The code
to enable old PTY searching via ptm is enabled via COMPAT_BSDPTY, and it
is turned on by default on all kernels that have compatibility options enabled.
2004-11-10 17:29:54 +00:00
christos ed77e93ea9 Fix another stupid typo. 2004-11-06 07:34:53 +00:00
christos d99b25032a I guess compiling code before committing is a lost art! 2004-11-06 07:31:55 +00:00
wrstuden 16029d56b5 Add support for FIONWRITE and FIONSPACE ioctls. FIONWRITE reports
the number of bytes in the send queue, and FIONSPACE reports the
number of free bytes in the send queue. These ioctls permit applications
to monitor file descriptor transmission dynamics.

In examining prior art, FIONWRITE exists with the semantics given
here. FIONSPACE is provided so that programs may easily determine how
much space is left in the send queue; they do not need to know the
send queue size.

The fact that a write may block even if there is enough space in the
send queue for it is noted in the documentation.

FIONWRITE functionality may be used to implement TIOCOUTQ for Linux
emulation - Linux extended this ioctl to sockets, even though they are
not ttys.
2004-11-06 02:03:20 +00:00
matt 2f15be42ae Check to see if the script has an ELF header, and if so, return ENOEXEC. 2004-11-04 23:55:28 +00:00
skrll 59abd634ef We emulate more than SVR4, and IBCS2 on the i386 and Linux on the i386
and the Alpha there days. Remove this statement in a comment.
2004-10-30 09:38:15 +00:00
yamt 05f25dcc2a move buffer queue related stuffs from buf.h to their own header, bufq.h. 2004-10-28 07:07:35 +00:00
skrll 1d0409de9a Fix bug in siginfo handling introduced in revision 1.93 2004-10-26 06:58:05 +00:00
yamt 4dd708bfff a relatively lightweight implementation of kernel_lock. 2004-10-26 00:14:46 +00:00
peter 8270ea3f59 Use ANSI function decls. 2004-10-25 23:37:58 +00:00
peter 7101691fa3 Remove two redundant conditionals. 2004-10-25 23:06:41 +00:00
peter 993460fbb1 Change the static array to a linked list, removes the limit of max 20 LKMs.
Mostly from OpenBSD.
Reviewed by several people on tech-kern.
2004-10-25 22:59:12 +00:00
cube 85c68ec88d Add a check in DEV_USES_PARTITIONS macro in case dv->dv_cfdata is NULL,
as it is the case for md and raid. Raid case tested by Martin Husemann,
I could test the install floppies work again.
2004-10-24 17:06:24 +00:00
yamt c0ebe301d7 don't reference kernel_lock directly. 2004-10-23 21:27:33 +00:00
thorpej a6be1570c7 - Centralize the declaration of booted_device and booted_partition.
- Add a booted_wedge variable that indicates the wedge that was booted
  from.  If this is NULL, booted_partition is consulted.
- Adjust setroot() and its support routines for root-on-wedges.  Could
  use some tidy-up, but this works for now.
2004-10-23 17:14:11 +00:00
peter 5d3f22a6e3 Remove the confusing PAGESIZE macro and calculate the size by doing
size / 1024.

Approved by mrg.
2004-10-22 09:49:18 +00:00
matt 2fefa174c9 Make panic messages print out what condition they though was panic-worthy
instead of a 1 word message.
2004-10-20 22:10:31 +00:00
jdolecek 065df3bb84 fix typo (missing &) 2004-10-17 11:24:42 +00:00
jdolecek 84e86b0dce use nointr allocator for shmmap_entry_pool - this is always accessed
from process context
2004-10-17 11:23:16 +00:00
jdolecek 3b6adcdea1 kill the indirection via struct shm_handle and store pointer to the uvm
object direct to _shm_private; the indirection doesn't serve any
useful purpose and just wastes memory and cpu cycles
2004-10-16 13:34:07 +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
thorpej f8335cf6c2 Don't initialize ttylist or tty_count in tty_init(). 2004-10-15 07:15:39 +00:00
thorpej 45bba4e135 Change config_attach_pseudo() to take a cfdata * that contains the
necessary information to create the pseudo-device instance.  Pseudo-device
device's will reference this cfdata, just as normal devices reference
their corresponding cfdata.

Welcome to 2.99.10.
2004-10-15 04:38:36 +00:00
yamt 1c2a2dcad3 move i/o schedulers to their own files.
namely, from kern/subr_disk.c to kern/bufq_{fcfs,disksort,readprio,priocscan}.c.
2004-10-14 05:12:28 +00:00