Commit Graph

5544 Commits

Author SHA1 Message Date
ad 0a0689eebd Merge from vmlocking: fix LWP reference counting problems. 2007-10-08 18:11:11 +00:00
ad 16598eeedf Merge from vmlocking: don't hold scheduler locks across copyout(). 2007-10-08 18:09:37 +00:00
ad 9f56dfa520 Merge brelse() changes from the vmlocking branch. 2007-10-08 18:02:53 +00:00
ad 6eb1b4f21a Include sys/cpu.h for archs that don't have CPU_INFO_ITERATOR. Spotted
by dsieger@.
2007-10-08 17:26:40 +00:00
ad fbf4a82ac2 Merge from vmlocking: cosmetic change. 2007-10-08 17:02:51 +00:00
ad d50d28b794 Merge from vmlocking: in cdev_tty() check d_tty != NULL. 2007-10-08 16:54:09 +00:00
ad 2af68666da Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
2007-10-08 16:41:05 +00:00
ad 46ed8f7d77 Use the softint API. 2007-10-08 16:18:02 +00:00
ad 342d5fc94f Add stubs that provide new soft interrupt API from the vmlocking branch.
For now these just pass through to the current softintr code.

(The naming is different to allow softint/softintr to co-exist for a while.
I'm hoping that should make it easier to transition.)
2007-10-08 15:51:02 +00:00
ad b6e1f76ba0 Fix merge error. 2007-10-08 15:13:12 +00:00
ad 451aacda90 Merge file descriptor locking, cwdi locking and cross-call changes
from the vmlocking branch.
2007-10-08 15:12:05 +00:00
ad 15b0a1106e Merge from vmlocking: don't add a refrerence to a dying LWP. 2007-10-08 14:08:26 +00:00
ad 0b87fda284 Merge from vmlocking: relax an assertion if panicstr != NULL. 2007-10-08 14:07:08 +00:00
hannken c775e7cb24 fscow_run(): Check for NULL mount and don't run the cow handler in this case. 2007-10-08 09:09:47 +00:00
hannken c103a5683e Remove an include committed by accident.
From Chris Ross via current-users.
2007-10-07 14:48:38 +00:00
hannken 3856acafe2 Update the file system copy-on-write handler.
- Instead of hooking the handler on the specdev of a mounted file system
  hook directly on the `struct mount'.

- Rename from `vn_cow_*' to `fscow_*' and move to `kern/vfs_trans.c'.  Use
  `mount_*specific' instead of clobbering `struct mount' or `struct specinfo'.

- Replace the hand-made reader/writer lock with a krwlock.

- Keep `vn_cow_*' functions and mark as obsolete.

- Welcome to NetBSD 4.99.32 - `struct specinfo' changed size.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
2007-10-07 13:38:53 +00:00
dyoung c3d21ddcd4 Cosmetic: KNF. Shorten a staircase. Indent a complicated
if-condition.  This code remains hard to read.
2007-10-05 02:40:25 +00:00
dyoung b7300a687a Use getsombuf(). 2007-10-05 02:34:58 +00:00
ad 2222038772 G/C the HIGHBALL stuff. 2007-10-04 12:55:48 +00:00
ad bf299679c7 Make kaputt code compile. 2007-10-03 14:49:24 +00:00
ad 0a4c80e2c7 Protect ksiginfo_pool with splvm to be on the safe side. 2007-10-03 13:21:22 +00:00
ad b30dffc0e4 - sched_yield: When yielding, drop the priority to MAXPRI ensuring that the
calling thread really does yield. The scheduler will adjust it back to a
  reasonable level within 1 second. This contradicts POSIX, which specifies
  that sched_yield() put the thread onto the back of its current runqueue.
  However, POSIX doesn't really have any business specifying what should
  happen for SCHED_OTHER (i.e.  a timesharing scheduler like ours), and
  Java, MySQL and libpthread rely on sched_yield() doing something useful.

- mi_switch: adjust spc_curpriority and newl->l_priority if we avoided
  the runqueues and are doing a direct switch. Since nothing currently
  does that, there should be no functional change.
2007-10-03 11:20:09 +00:00
ad b4bc650271 Fix a dodgy bit of code in the PERFCTRS case. 2007-10-03 11:05:58 +00:00
ad f10a4e3b61 Fix assertion that broke debug kernels. 2007-10-02 13:17:16 +00:00
pooka 87319696e5 Add a comment clarifying that in the succesful case the function
returns from the middle of the loop.
2007-10-02 12:01:17 +00:00
ad b58e305699 Enter mi_switch() from the idle loop if ci_want_resched is set. If there
are no jobs to run it will clear it while under lock. Should fix idle.
2007-10-01 22:14:23 +00:00
martin cadfc6aaa0 No need to db_init_commands() early any more - it will happen on first
entry to ddb.
2007-10-01 22:05:15 +00:00
dsl 2e20a70dbf Change the way p->p_limit (and hence p->p_rlimit) is locked.
Should fix PR/36939 and make the rlimit code MP safe.
Posted for comment to tech-kern (non received!)

The p_limit field (for a process) is only be changed once (on the first
  write), and a reference to the old structure is kept (for code paths
  that have cached the pointer).
Only p->p_limit is now locked by p->p_mutex, and since the referenced memory
  will not go away, is only needed if the pointer is to be changed.
The contents of 'struct plimit' are all locked by pl_mutex, except that the
  code doesn't bother to acquire it for reads (which are basically atomic).
Add FORK_SHARELIMIT that causes fork1() to share the limits between parent
  and child, use it for the IRIX_PR_SULIMIT.
Fix borked test for both IRIX_PR_SUMASK and IRIX_PR_SDIR being set.
2007-09-29 12:22:30 +00:00
joerg 9e4ace25c5 Add kern.no_sa_support to easily detect whether a kernel supports
Scheduler Activation or not. This is a negative name as ld.so.conf
conditionals threat undefined sysctls like 0.
2007-09-28 21:25:21 +00:00
he 2bf864fe60 Add an explicit include of <sys/device.h> to make sparc64 and sun2
build.  Needed for device_xname() and device_t, use added by previous
change.
2007-09-26 07:40:36 +00:00
ad 19e070934b Make previous conditional upon !__i386__ && !__x86_64__. I know this is
gross but it's a debug check that's not intended to live very long.
curlwp is about to become a function on x86 (and so can't be assigned to).
2007-09-25 22:33:59 +00:00
ad 0c1c910f91 If curlwp is not set before main(), moan about it but continue to set it.
curlwp will need to be available earlier for UVM/pmap bootstrap.
2007-09-25 21:41:59 +00:00
ad e36f46b00e curlwp appears to be set by all active copies of cpu_switchto - remove
the MI assignments and assert that it's set in mi_switch().
2007-09-25 21:38:56 +00:00
ad 1934283e4a Use selinit() / seldestroy(). 2007-09-25 14:04:07 +00:00
ad 604692c130 Use selinit() / seldestroy(). 2007-09-25 13:53:31 +00:00
ad f8d23a5f1b Add selinit() / seldestroy() from the vmlocking branch. 2007-09-25 13:53:11 +00:00
joerg f381694bae Extend the aprint family with _dev and _ifnet versions that take
a device_t or struct ifnet * as first argument and prefix the log
message with the corresponding device/interface name.
2007-09-24 20:01:03 +00:00
joerg 8c5de3a623 Introduce CFATTACH_DECL_NEW and CFATTACH_DECL2_NEW for drivers that
don't expect struct device as first field of softc. device_private uses
a new field of struct device to give the softc address and that field is
either set the struct device for old-style devices or a separate
allocation by config_devalloc. Both macros are intended as temporary
bandaid until all drivers are converted and will be removed later.
2007-09-24 18:47:56 +00:00
martin 2fd15d17ad db_init_commands() early 2007-09-24 00:00:52 +00:00
yamt 97427fb0e4 use a correct type for UIO_*. 2007-09-23 16:00:08 +00:00
dsl 890c5b989c Allocate the temporary path buffer before we acquire any locks.
Only check PK_SUGID once.  Still looks to have MP timing windows.
Copy out p->p_limit->pl_corename with pl_lock held - it can be a shared
  string, and might be updated by another process.
  Part of fix for PR/3696
Add XXX note that check for MNT_NOCOREDUMP doesn't actually check the
correct directory.
2007-09-22 13:34:23 +00:00
dsl 4bacff8183 Rename members of 'struct plimit' so that the fields are 'pl_xxx' and
no longer have the same names as members of 'struct proc'.
2007-09-21 19:19:20 +00:00
dsl 0ca3d21b5b Include sys/cdefs.h first. 2007-09-21 19:14:12 +00:00
ad d62c40efb5 - mq_receive1, mq_send1: deal with spurious wakeup. XXX should adjust the
timeout but this is a wider problem.
- MQ_SEND is unused, remove it.
2007-09-21 01:40:09 +00:00
christos 861eaa84d8 - add debugging info to the remaining failure cases in execve1.
- use size_t where appropriate.
2007-09-20 20:51:38 +00:00
christos f3ac6ef2b6 minor nits; no code change. 2007-09-19 19:28:25 +00:00
dyoung 8cbfeac89a Make uipc_ctloutput() return ENOPROTOOPT instead of EINVAL when it
is passed a handle socket-option level that it does not care about.
2007-09-19 06:23:53 +00:00
dyoung 4c9b6756a5 1) Introduce a new socket option, (SOL_SOCKET, SO_NOHEADER), that
tells a socket that it should both add a protocol header to tx'd
   datagrams and remove the header from rx'd datagrams:

        int onoff = 1, s = socket(...);
        setsockopt(s, SOL_SOCKET, SO_NOHEADER, &onoff);

2) Add an implementation of (SOL_SOCKET, SO_NOHEADER) for raw IPv4
   sockets.

3) Reorganize the protocols' pr_ctloutput implementations a bit.
   Consistently return ENOPROTOOPT when an option is unsupported,
   and EINVAL if a supported option's arguments are incorrect.
   Reorganize the flow of code so that it's more clear how/when
   options are passed down the stack until they are handled.

   Shorten some pr_ctloutput staircases for readability.

4) Extract common mbuf code into subroutines, add new sockaddr
   methods, and introduce a new subroutine, fsocreate(), for reuse
   later; use it first in sys_socket():

struct mbuf *m_getsombuf(struct socket *so)

        Create an mbuf and make its owner the socket `so'.

struct mbuf *m_intopt(struct socket *so, int val)

        Create an mbuf, make its owner the socket `so', put the
        int `val' into it, and set its length to sizeof(int).


int fsocreate(..., int *fd)

        Create a socket, a la socreate(9), put the socket into the
        given LWP's descriptor table, return the descriptor at `fd'
        on success.

void *sockaddr_addr(struct sockaddr *sa, socklen_t *slenp)
const void *sockaddr_const_addr(const struct sockaddr *sa, socklen_t *slenp)

        Extract a pointer to the address part of a sockaddr.  Write
        the length of the address  part at `slenp', if `slenp' is
        not NULL.

socklen_t sockaddr_getlen(const struct sockaddr *sa)

        Return the length of a sockaddr.  This just evaluates to
        sa->sa_len.  I only add this for consistency with code that
        appears in a portable userland library that I am going to
        import.

const struct sockaddr *sockaddr_any(const struct sockaddr *sa)

        Return the "don't care" sockaddr in the same family as
        `sa'.  This is the address a client should sobind(9) if it
        does not care the source address and, if applicable, the
        port et cetera that it uses.

const void *sockaddr_anyaddr(const struct sockaddr *sa, socklen_t *slenp)

        Return the "don't care" sockaddr in the same family as
        `sa'.  This is the address a client should sobind(9) if it
        does not care the source address and, if applicable, the
        port et cetera that it uses.
2007-09-19 04:33:42 +00:00
hannken d72d03c5d7 Stop abusing a `struct buf' for state information. Use new `struct physio_stat'
and use kmutex and kcondvar here.
Fix an error introduced with B_ERROR removal where reading at EOM returned EIO.

Approved by: Andrew Doran <ad@netbsd.org>
2007-09-18 08:34:34 +00:00
ad 5b3ae27b0d __FUNCTION__ -> __func__ 2007-09-17 21:33:34 +00:00