Commit Graph

2817 Commits

Author SHA1 Message Date
kleink 12135360cf fcntl(..., F_GETOWN, ...): fix LP64-BE bug; raised by der Mouse
on tech-kern.
2002-01-31 22:17:33 +00:00
kleink 935d56d508 Add {POSIX_MONOTONIC_CLOCK} variables. 2002-01-31 00:32:47 +00:00
simonb 346fc0519d Implement the CLOCK_MONOTONIC clock for the posix/opengroup realtime
clock_() functions.  This simply returns the kernel mono_time variable.
As discussed on tech-kern.
2002-01-31 00:13:07 +00:00
thorpej 07d023a3aa Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

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

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

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

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

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

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

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

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

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

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

buffersize     before    after
512            17        49
1024           33        110
2048           52        143
4096           77        163
8192           142       190
64K            577       662
128K           372       392
2001-10-28 20:47:15 +00:00
christos f7cb99f9c6 make a copy of the epp->ep_path, because it is too late to use it when
copyargs is called since we've swapped vmspaces.
2001-10-28 04:46:42 +00:00
chs a54f8441f8 in cache_lookup(), if we get a cache hit but then fail to vget() the found
vnode, we should not attempt to remove the namecache entry.  this is because
vget() can sleep (eg. if VXLOCK is set because the vnode is being reclaimed),
and so multiple threads can end up in this context at the same time.
if this happens, each thread ends up removing the cache entry, but
the code to remove the entry assumes that the entry is still valid.
so we should just leave the (now stale) entry in the cache.
if another thread finds the entry again before it is reused,
that thread will notice that the entry is stale and remove it safely.
fixes PR 14042.
2001-10-27 04:53:38 +00:00
chs 6bc926aa9e in pool_drain(), call pool_reclaim() while we still have interrupts blocked
since the pool in question might be one used in interrupt context.
2001-10-21 00:06:05 +00:00
thorpej e45efd967f Deprecate the "m_act" alias of "m_nextpkt" (m_act is a historical
name), and just use m_nextpkt everywhere.
2001-10-18 20:17:24 +00:00
thorpej 9b2f51421c Use a pool cache for namei buffers -- it's faster to allocate from
a pool cache than a pool.
2001-10-17 23:33:29 +00:00
christos bfe76ac87a Allow userland to pass MNT_IGNORE (from enami) 2001-10-11 16:27:24 +00:00
mycroft cbd7c4d140 When a pipe was grown to BIG_PIPE_SIZE, we could get in a select()/write() loop
because pipe_poll() and pipe_write() did not agree on when it was okay to write
more data.  Fix pipe_write(), since it seems to be the broken one.
2001-10-08 07:50:17 +00:00
bjh21 d0844f93bb Add support for allocating pool memory in units smaller than a whole page.
This is activated by defining POOL_SUBPAGE to the size of the new allocation
unit, and makes pools much more efficient on machines with obscenely large
pages.  It might even make four-megabyte arm26 systems usable.
2001-10-07 12:44:06 +00:00
eeh c824ea9b57 Remove the property sysctl interface for now. 2001-10-05 19:05:05 +00:00
pooka 11d8d4dae9 add casts to debug printfs to make this compile on archs where
size_t is of type int
2001-10-05 12:55:24 +00:00
eeh e1bd5ac110 Add generic properties. 2001-10-04 18:56:06 +00:00
chs 90a3a778a7 when attempting to reclaim a vnode, tell the lockmgr() that it's ok
to just fail if we already hold the lock.  we'll skip that vnode
and try another.  fixes PR 14090.
2001-10-04 05:46:45 +00:00
chs adb1a233b7 replace wakeup_one() with wakeup(). wakeup_one() can only be used if the
woken-up thread is guaranteed to pass the buck to the next guy before
going back to sleep, and the rest of the lockmgr() code doesn't do that.
from Bill Sommerfeld.  fixes PR 14097.
2001-09-29 21:27:49 +00:00
jdolecek 560e3c342e Use lmin() instead of min(), and long for mlen & clen, to avoid integer
overflow on LP64 architectures. This fixes kern/10070 by Juergen Weiss.

Fix tested on NetBSD/alpha by Bernd Ernesti, on NetBSD/sparc64
by David Brownlee and Eduardo Horvath.
2001-09-29 14:16:19 +00:00
jdolecek 18c0643bfb Update the uio resid counts appropriately when any error occurs
(not just EPIPE), so that the higher-level code would note partial
write has happened and DTRT if the write was interrupted due to
e.g. delivery of signal.

This fixes kern/14087 by Frank van der Linden.
Much thanks to Frank for extensive help with debugging this, and review
of the fix.

Note: EPIPE/SIGPIPE delivery behaviour was retained - they're delivered
even if the write was partially successful.
2001-09-29 13:48:11 +00:00
chs a76b67cf09 jump through hoops to avoid calling uvm_km_free_poolpage() while holding
spinlocks, since that function can sleep.  (note that there's still one
instance remaining to be fixed.)  use TAILQ_FOREACH where appropriate.
2001-09-26 07:14:56 +00:00
enami b0df86c9e6 In the function getnewvnode:
- Mark file system busy again on retry.
- Don't use the variable `listhd' uninitialized.
2001-09-26 00:59:57 +00:00
jdolecek 25bef3c837 Take care to transfer whole buffer passed via write(2); write(2) should
not do short writes unless when using non-blocking I/O.
This fixes kern/13744 by Geoff C. Wing.

Note this partially undoes rev. 1.5 change. Upon closer examination,
it's been apparent that hbench-OS expectations were not actually justified.
2001-09-25 19:01:21 +00:00