summaryrefslogtreecommitdiffstats
path: root/sys/netncp
Commit message (Collapse)AuthorAgeFilesLines
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).des2008-10-234-9/+9
| | | | MFC after: 3 months
* lockmgrs need to be released before to be destroyed and draining doesn'tattilio2008-03-301-0/+1
| | | | | | | make an exception. Add correct stub for it. Reviewed by: rwatson
* Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.ru2008-03-251-1/+1
| | | | | | | | | | Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true since the advent of MBUMA. Reviewed by: arch There are ongoing disputes as to whether we want to switch to directly using UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.
* - Handle buffer lock waiters count directly in the buffer cache insteadattilio2008-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than rely on the lockmgr support [1]: * bump the waiters only if the interlock is held * let brelvp() return the waiters count * rely on brelvp() instead than BUF_LOCKWAITERS() in order to check for the waiters number - Remove a namespace pollution introduced recently with lockmgr.h including lock.h by including lock.h directly in the consumers and making it mandatory for using lockmgr. - Modify flags accepted by lockinit(): * introduce LK_NOPROFILE which disables lock profiling for the specified lockmgr * introduce LK_QUIET which disables ktr tracing for the specified lockmgr [2] * disallow LK_SLEEPFAIL and LK_NOWAIT to be passed there so that it can only be used on a per-instance basis - Remove BUF_LOCKWAITERS() and lockwaiters() as they are no longer used This patch breaks KPI so __FreBSD_version will be bumped and manpages updated by further commits. Additively, 'struct buf' changes results in a disturbed ABI also. [2] Really, currently there is no ktr tracing in the lockmgr, but it will be added soon. [1] Submitted by: kib Tested by: pho, Andrea Barberio <insomniac at slackware dot it>
* Axe the 'thread' argument from VOP_ISLOCKED() and lockstatus() as it isattilio2008-02-251-1/+1
| | | | | | | | | always curthread. As KPI gets broken by this patch, manpages and __FreeBSD_version will be updated by further commits. Tested by: Andrea Barberio <insomniac at slackware dot it>
* Introduce some functions in the vnode locks namespace and in the ffsattilio2008-02-241-1/+1
| | | | | | | | | | | | | | | namespace in order to handle lockmgr fields in a controlled way instead than spreading all around bogus stubs: - VN_LOCK_AREC() allows lock recursion for a specified vnode - VN_LOCK_ASHARE() allows lock sharing for a specified vnode In FFS land: - BUF_AREC() allows lock recursion for a specified buffer lock - BUF_NOREC() disallows recursion for a specified buffer lock Side note: union_subr.c::unionfs_node_update() is the only other function directly handling lockmgr fields. As this is not simple to fix, it has been left behind as "sole" exception.
* Cleanup lockmgr interface and exported KPI:attilio2008-01-241-16/+16
| | | | | | | | | | | | | | | | | | | | - Remove the "thread" argument from the lockmgr() function as it is always curthread now - Axe lockcount() function as it is no longer used - Axe LOCKMGR_ASSERT() as it is bogus really and no currently used. Hopefully this will be soonly replaced by something suitable for it. - Remove the prototype for dumplockinfo() as the function is no longer present Addictionally: - Introduce a KASSERT() in lockstatus() in order to let it accept only curthread or NULL as they should only be passed - Do a little bit of style(9) cleanup on lockmgr.h KPI results heavilly broken by this change, so manpages and FreeBSD_version will be modified accordingly by further commits. Tested by: matteo
* Refactor select to reduce contention and hide internal implementationjeff2007-12-163-111/+9
| | | | | | | | | | | | | | | | | | | | | details from consumers. - Track individual selecters on a per-descriptor basis such that there are no longer collisions and after sleeping for events only those descriptors which triggered events must be rescaned. - Protect the selinfo (per descriptor) structure with a mtx pool mutex. mtx pool mutexes were chosen to preserve api compatibility with existing code which does nothing but bzero() to setup selinfo structures. - Use a per-thread wait channel rather than a global wait channel. - Hide select implementation details in a seltd structure which is opaque to the rest of the kernel. - Provide a 'selsocket' interface for those kernel consumers who wish to select on a socket when they have no fd so they no longer have to be aware of select implementation details. Tested by: kris Reviewed on: arch
* Commit 14/14 of sched_lock decomposition.jeff2007-06-051-11/+11
| | | | | | | | | | | - Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
* In ncp_conn_alloc(), a new credential pointer, 'owner', is set up to pointrwatson2007-05-271-3/+4
| | | | | | | | | | | | | | | at the credential to be used by the connection. However, the pointer's value was ignored when actually setting hcp->nc_owner. (1) Do set nc_owner to the owner pointer value so that the credential is not discarded after being carefully configured. (2) In the case where we create a new credential with modified uid, copy the existing credential to initialize non-uid fields to existing values, which will lead to a fully initialized MAC label, groups, etc. Found with: Coverity Prevent(tm) CID: 2226
* Use pause() rather than tsleep() on stack variables and function pointers.jhb2007-02-271-2/+1
|
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-063-1/+3
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* - Fix ncp_poll() to not panic if the socket doesn't have any pending data.jhb2006-08-031-7/+27
| | | | | | | | | | | | | | | | | | | | We have to adjust curthread's state enough so that it appears to be in a poll(2) or select(2) call so that selrecord() will work and then teardown that state after calling sopoll(). - Fix some minor nits in nearby ncp_sock_rselect() and in the identical nbssn_rselect() function in the netsmb code: - Don't call nb_poll()/ncp_poll() now that ncp_poll() already fakes up poll(2) state since the rselect() functions already do that. Just invoke sopoll() directly. - To make things slightly more intuitive, store the results of sopoll() in a new 'revents' variable rather than 'error' since that's what sopoll() actually returns. - If the requested timeout time has been exceeded by the time we get ready to block, then return EWOULDBLOCK rather than 0 to signal a timeout as this is what the calling code expects. Tested by: Eric Christeson <eric.j.christeson AT gmail> (1) MFC after: 1 week
* soreceive_generic(), and sopoll_generic(). Add new functions sosend(),rwatson2006-07-241-9/+8
| | | | | | | | | | | | | | | | soreceive(), and sopoll(), which are wrappers for pru_sosend, pru_soreceive, and pru_sopoll, and are now used univerally by socket consumers rather than either directly invoking the old so*() functions or directly invoking the protocol switch method (about an even split prior to this commit). This completes an architectural change that was begun in 1996 to permit protocols to provide substitute implementations, as now used by UDP. Consumers now uniformly invoke sosend(), soreceive(), and sopoll() to perform these operations on sockets -- in particular, distributed file systems and socket system calls. Architectural head nod: sam, gnn, wollman
* In ncp_sysctl_connstat(), the SLIST_FOREACH() logic to check 'error'rwatson2006-01-141-7/+1
| | | | | | | | | resulted in deadcode, as 'error' could never be 0. What this logic was originally meant to handle is not clear -- it's been this way (broken) since at least RELENG_4. Found with: Coverity Prevent(tm) MFC after: 3 days
* Normalize a significant number of kernel malloc type names:rwatson2005-10-311-1/+1
| | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names.
* Change API of mb_copy_t in libmchain so that netsmb can handleimura2005-07-291-1/+11
| | | | | | multibyte character share name correctly. Reviewed by: bp
* avoid potential null ptr derefssam2005-02-231-2/+11
| | | | Noticed by: Coverity Prevent analysis tool
* /* -> /*- for license, minor formatting changesimp2005-01-0719-19/+20
|
* Use byteorder(9) functions to implement the [g,s]et[d,w][b,l]e macros somarius2005-01-031-36/+14
| | | | | | | | | only one set is needed for either endianess. This also completes them for big endian archs and fixes the compilation of libncp, netncp, etc. there. Reviewed by: bp, rwatson Compile tested on: i386, sparc64 MFC after: 1 week
* Add missing zero flag argument.phk2004-10-121-1/+1
|
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-2/+2
| | | | Bump __FreeBSD_version accordingly.
* add missing #include <sys/module.h>phk2004-05-301-0/+1
|
* Make the process_exit eventhandler run without Giant. Add Giant hookspeter2004-03-141-0/+2
| | | | | | in the two consumers that need it.. processes using AIO and netncp. Update docs. Say that process_exec is called with Giant, but not to depend on it. All our consumers can handle it without Giant.
* Split the mlock() kernel code into two parts, mlock(), which unpackstruckman2004-02-261-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the syscall arguments and does the suser() permission check, and kern_mlock(), which does the resource limit checking and calls vm_map_wire(). Split munlock() in a similar way. Enable the RLIMIT_MEMLOCK checking code in kern_mlock(). Replace calls to vslock() and vsunlock() in the sysctl code with calls to kern_mlock() and kern_munlock() so that the sysctl code will obey the wired memory limits. Nuke the vslock() and vsunlock() implementations, which are no longer used. Add a member to struct sysctl_req to track the amount of memory that is wired to handle the request. Modify sysctl_wire_old_buffer() to return an error if its call to kern_mlock() fails. Only wire the minimum of the length specified in the sysctl request and the length specified in its argument list. It is recommended that sysctl handlers that use sysctl_wire_old_buffer() should specify reasonable estimates for the amount of data they want to return so that only the minimum amount of memory is wired no matter what length has been specified by the request. Modify the callers of sysctl_wire_old_buffer() to look for the error return. Modify sysctl_old_user to obey the wired buffer length and clean up its implementation. Reviewed by: bms
* Device megapatch 4/6:phk2004-02-211-0/+2
| | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
* The present defaults for the open and close for device drivers whichphk2003-09-271-2/+0
| | | | | | | | | | | | | | provide no methods does not make any sense, and is not used by any driver. It is a pretty hard to come up with even a theoretical concept of a device driver which would always fail open and close with ENODEV. Change the defaults to be nullopen() and nullclose() which simply does nothing. Remove explicit initializations to these from the drivers which already used them.
* size_t != int. Make this compile on 64 bit platforms (eg: amd64).peter2003-07-241-1/+2
| | | | Also, "u_short value; if (value > 0xffff)" can never be true.
* Use __FBSDID().obrien2003-06-119-24/+36
|
* - Merge struct procsig with struct sigacts.jhb2003-05-131-1/+3
| | | | | | | | | | | | | | | | | - Move struct sigacts out of the u-area and malloc() it using the M_SUBPROC malloc bucket. - Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(), sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared(). - Remove the p_sigignore, p_sigacts, and p_sigcatch macros. - Add a mutex to struct sigacts that protects all the members of the struct. - Add sigacts locking. - Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now that sigacts is locked. - Several in-kernel functions such as psignal(), tdsignal(), trapsignal(), and thread_stopped() are now MP safe. Reviewed by: arch@ Approved by: re (rwatson)
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-311-2/+3
| | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
* Replace the at_fork, at_exec, and at_exit functions with the slightly morejhb2003-03-241-7/+7
| | | | | | | | | flexible process_fork, process_exec, and process_exit eventhandlers. This reduces code duplication and also means that I don't have to go duplicate the eventhandler locking three more times for each of at_fork, at_exec, and at_exit. Reviewed by: phk, jake, almost complete silence on arch@
* Use td->td_ucred instead of td->td_proc->p_ucred.jhb2003-03-201-1/+1
|
* Note that MAJOR_AUTO is now the default if d_maj is not initialized. Thisphk2003-03-091-1/+0
| | | | | | | | is more robust and prevents the hijacking of /dev/console for the typical mistake. Remove unneeded MAJOR_AUTO uses, it is only needed explicitly now if the driver source has cross-branch compatibility to old releases.
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-13/+5
| | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl)
* Use a character device and ioctl() for communication between libncptjr2003-02-283-138/+155
| | | | | and the kernel instead of adding more syscalls at runtime. As a bonus, you can now restrict access to the kernel NCP interface with chmod.
* Catch up with KSE changes.fjoe2003-02-2611-314/+369
| | | | Reviewed by: tjr
* Back out M_* changes, per decision of the TRB.imp2003-02-194-5/+5
| | | | Approved by: trb
* Lock proc while accessing p_siglist p_sigmask and p_sigignore.tjr2003-02-141-1/+5
| | | | Not tested because netncp does not compile.
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-214-5/+5
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* - Change mb_copy_t to take a size_t as the length argument instead of anjhb2002-11-081-1/+1
| | | | | | | int. - Change the local variable in smb_copy_iconv() from an int to a size_t. These make smb_copy_iconv() happy in a 64-bit world.
* Change iov_base's type from `char *' to the standard `void *'. Allmike2002-10-111-1/+2
| | | | | uses of iov_base which assume its type is `char *' (in order to do pointer arithmetic) have been updated to cast iov_base to `char *'.
* Back our kernel support for reliable signal queues.jmallett2002-10-011-3/+2
| | | | Requested by: rwatson, phk, and many others
* Convert use of p_siglist and old SIG*() macros to use <sys/ksiginfo.h>jmallett2002-09-301-2/+3
| | | | | | prototyped functions to get a sigset_t, and further to check for any queued signals, rather than an empty signal set, to go with the move to signal queues rather than signal sets.
* use __packed.alfred2002-09-233-14/+14
|
* Wire the sysctl output buffer before grabbing any locks to preventtruckman2002-07-281-0/+1
| | | | | | | SYSCTL_OUT() from blocking while locks are held. This should only be done when it would be inconvenient to make a temporary copy of the data and defer calling SYSCTL_OUT() until after the locks are released.
* Make bn_name a const char * to quieten some warnings.dwmalone2002-07-271-1/+1
| | | | Approved by: bp (long ago)
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.tanimura2002-05-311-4/+1
| | | | Requested by: hsu
* CURSIG() is not a macro so rename it cursig().julian2002-05-291-1/+1
| | | | Obtained from: KSE tree
* Lock down a socket, milestone 1.tanimura2002-05-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred
OpenPOWER on IntegriCloud