Skip site navigation (1)Skip section navigation (2)

CVS log for src/sys/kern/sys_pipe.c

[BACK] Up to [FreeBSD] / src / sys / kern

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.216.2.5: download - view: text, markup, annotated - select for diffs
Fri Feb 3 20:24:18 2012 UTC (5 days, 17 hours ago) by jilles
Branches: RELENG_9
Diff to: previous 1.216.2.4: preferred, colored; branchpoint 1.216: preferred, colored; next MAIN 1.217: preferred, colored
Changes since revision 1.216.2.4: +4 -2 lines
SVN rev 230955 on 2012-02-03 20:24:18Z by jilles

MFC r228510: Fix select/poll/kqueue for write on reverse direction before
first write.

The reverse direction of a pipe is lazily allocated on the first write in
that direction (because pipes are usually used in one direction only).  A
special case is needed to ensure the pipe appears writable before the first
write because there are 0 bytes of pending data in 0 bytes of buffer space
at that point, leaving 0 bytes of data that can be written with the normal
code.

Note that the first write returns [ENOMEM] if kern.ipc.maxpipekva is
exceeded and does not block or return [EAGAIN], so selecting true for write
is correct even in that case.

PR:		kern/93685

Revision 1.216.2.4: download - view: text, markup, annotated - select for diffs
Sun Jan 1 23:51:18 2012 UTC (5 weeks, 3 days ago) by kib
Branches: RELENG_9
Diff to: previous 1.216.2.3: preferred, colored; branchpoint 1.216: preferred, colored
Changes since revision 1.216.2.3: +28 -9 lines
SVN rev 229248 on 2012-01-01 23:51:18Z by kib

MFC r228306:
Most users of pipe(2) do not call fstat(2) on the returned pipe descriptors.
Optimize for the case, by lazily allocating the pipe inode number at the
fstat(2) time.

Revision 1.216.2.3: download - view: text, markup, annotated - select for diffs
Fri Dec 30 19:58:06 2011 UTC (5 weeks, 5 days ago) by kib
Branches: RELENG_9
Diff to: previous 1.216.2.2: preferred, colored; branchpoint 1.216: preferred, colored
Changes since revision 1.216.2.2: +2 -2 lines
SVN rev 229016 on 2011-12-30 19:58:06Z by kib

MFC r228178:
If alloc_unr() call in the pipe_create() failed, then pipe->pipe_ino is
-1. But, because ino_t is unsigned, this case was not covered by the
test ino > 0 in pipeclose(), leading to the free_unr(-1). Fix it by
explicitely comparing with 0 and -1.

Do no access freed memory, the inode number was cached to prevent access
to cpipe after it possibly was freed, but I failed to commit the right
patch.

Revision 1.220: download - view: text, markup, annotated - select for diffs
Wed Dec 14 22:26:39 2011 UTC (8 weeks ago) by jilles
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.219: preferred, colored
Changes since revision 1.219: +4 -2 lines
SVN rev 228510 on 2011-12-14 22:26:39Z by jilles

Fix select/poll/kqueue for write on reverse direction before first write.

The reverse direction of a pipe is lazily allocated on the first write in
that direction (because pipes are usually used in one direction only).  A
special case is needed to ensure the pipe appears writable before the first
write because there are 0 bytes of pending data in 0 bytes of buffer space
at that point, leaving 0 bytes of data that can be written with the normal
code.

Note that the first write returns [ENOMEM] if kern.ipc.maxpipekva is
exceeded and does not block or return [EAGAIN], so selecting true for write
is correct even in that case.

PR:		kern/93685
Submitted by:	gianni
MFC after:	2 weeks

Revision 1.219: download - view: text, markup, annotated - select for diffs
Tue Dec 6 11:24:03 2011 UTC (2 months ago) by kib
Branches: MAIN
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +28 -9 lines
SVN rev 228306 on 2011-12-06 11:24:03Z by kib

Most users of pipe(2) do not call fstat(2) on the returned pipe descriptors.
Optimize for the case, by lazily allocating the pipe inode number at the
fstat(2) time. If alloc_unr(9) returns failure, do not fail fstat(2), since
uses of inode numbers are even rare then fstat(2), but provide zero inode
forever. Note that alloc_unr() failure is unlikely due to total number
of pipes in the system limited by the number of file descriptors.

Based on the submission by:	gianni
MFC after:	2 weeks

Revision 1.218: download - view: text, markup, annotated - select for diffs
Thu Dec 1 11:36:41 2011 UTC (2 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +2 -2 lines
SVN rev 228178 on 2011-12-01 11:36:41Z by kib

If alloc_unr() call in the pipe_create() failed, then pipe->pipe_ino is
-1. But, because ino_t is unsigned, this case was not covered by the
test ino > 0 in pipeclose(), leading to the free_unr(-1). Fix it by
explicitely comparing with 0 and -1. [1]

Do no access freed memory, the inode number was cached to prevent access
to cpipe after it possibly was freed, but I failed to commit the right
patch.

Noted by:	gianni [1]
Pointy hat to:	kib
MFC after:	3 days

Revision 1.216.2.2.2.1: download - view: text, markup, annotated - select for diffs
Fri Nov 11 04:20:22 2011 UTC (2 months, 4 weeks ago) by kensmith
Branches: RELENG_9_0
CVS tags: RELENG_9_0_0_RELEASE
Diff to: previous 1.216.2.2: preferred, colored; next MAIN 1.216.2.3: preferred, colored
Changes since revision 1.216.2.2: +0 -0 lines
SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)

Revision 1.216.2.2: download - view: text, markup, annotated - select for diffs
Thu Oct 20 18:54:05 2011 UTC (3 months, 2 weeks ago) by kib
Branches: RELENG_9
CVS tags: RELENG_9_0_BP
Branch point for: RELENG_9_0
Diff to: previous 1.216.2.1: preferred, colored; branchpoint 1.216: preferred, colored
Changes since revision 1.216.2.1: +26 -2 lines
SVN rev 226578 on 2011-10-20 18:54:05Z by kib

MFC r226042:
Supply unique (st_dev, st_ino) value pair for the fstat(2) done on the pipes.

Approved by:	re (bz)

Revision 1.217: download - view: text, markup, annotated - select for diffs
Wed Oct 5 16:56:06 2011 UTC (4 months ago) by kib
Branches: MAIN
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +26 -2 lines
SVN rev 226042 on 2011-10-05 16:56:06Z by kib

Supply unique (st_dev, st_ino) value pair for the fstat(2) done on the pipes.

Reviewed by:	jhb, Peter Jeremy <peterjeremy acm org>
MFC after:	2 weeks

Revision 1.216.2.1: download - view: text, markup, annotated - select for diffs
Fri Sep 23 00:51:37 2011 UTC (4 months, 2 weeks ago) by kensmith
Branches: RELENG_9
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +0 -0 lines
SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)

Revision 1.216: download - view: text, markup, annotated - select for diffs
Fri Sep 16 13:58:51 2011 UTC (4 months, 3 weeks ago) by kmacy
Branches: MAIN
CVS tags: RELENG_9_BP
Branch point for: RELENG_9
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +1 -1 lines
SVN rev 225617 on 2011-09-16 13:58:51Z by kmacy

In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)

Revision 1.205.2.2: download - view: text, markup, annotated - select for diffs
Thu Sep 15 12:27:26 2011 UTC (4 months, 3 weeks ago) by attilio
Branches: RELENG_8
Diff to: previous 1.205.2.1: preferred, colored; branchpoint 1.205: preferred, colored; next MAIN 1.206: preferred, colored
Changes since revision 1.205.2.1: +1 -0 lines
SVN rev 225585 on 2011-09-15 12:27:26Z by attilio

MFC r225177,225181:
Introduce and use seldrain() function for dealing with fast
selrecord/selinfo destruction.

Sponsored by:	Sandvine Incorporated

Revision 1.215: download - view: text, markup, annotated - select for diffs
Thu Aug 25 15:51:54 2011 UTC (5 months, 2 weeks ago) by attilio
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +1 -0 lines
SVN rev 225177 on 2011-08-25 15:51:54Z by attilio

Fix a deficiency in the selinfo interface:
If a selinfo object is recorded (via selrecord()) and then it is
quickly destroyed, with the waiters missing the opportunity to awake,
at the next iteration they will find the selinfo object destroyed,
causing a PF#.

That happens because the selinfo interface has no way to drain the
waiters before to destroy the registered selinfo object. Also this
race is quite rare to get in practice, because it would require a
selrecord(), a poll request by another thread and a quick destruction
of the selrecord()'ed selinfo object.

Fix this by adding the seldrain() routine which should be called
before to destroy the selinfo objects (in order to avoid such case),
and fix the present cases where it might have already been called.
Sometimes, the context is safe enough to prevent this type of race,
like it happens in device drivers which installs selinfo objects on
poll callbacks. There, the destruction of the selinfo object happens
at driver detach time, when all the filedescriptors should be already
closed, thus there cannot be a race.
For this case, mfi(4) device driver can be set as an example, as it
implements a full correct logic for preventing this from happening.

Sponsored by:	Sandvine Incorporated
Reported by:	rstone
Tested by:	pluknet
Reviewed by:	jhb, kib
Approved by:	re (bz)
MFC after:	3 weeks

Revision 1.214: download - view: text, markup, annotated - select for diffs
Tue Aug 16 20:07:47 2011 UTC (5 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +2 -0 lines
SVN rev 224914 on 2011-08-16 20:07:47Z by kib

Add the fo_chown and fo_chmod methods to struct fileops and use them
to implement fchown(2) and fchmod(2) support for several file types
that previously lacked it. Add MAC entries for chown/chmod done on
posix shared memory and (old) in-kernel posix semaphores.

Based on the submission by:	glebius
Reviewed by:	rwatson
Approved by:	re (bz)

Revision 1.213: download - view: text, markup, annotated - select for diffs
Fri Apr 1 13:28:34 2011 UTC (10 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +2 -2 lines
SVN rev 220245 on 2011-04-01 13:28:34Z by kib

After the r219999 is merged to stable/8, rename fallocf(9) to falloc(9)
and remove the falloc() version that lacks flag argument. This is done
to reduce the KPI bloat.

Requested by:	jhb
X-MFC-note:	do not

Revision 1.212: download - view: text, markup, annotated - select for diffs
Sun Mar 20 15:04:43 2011 UTC (10 months, 3 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +3 -3 lines
SVN rev 219801 on 2011-03-20 15:04:43Z by alc

Update a comment.  The sending process has not mapped the buffer pages
since before r127501.  Strictly speaking, the buffer pages are not
"wired".  They remain in the paging queues.  However, they are pinned in
memory using vm_page_hold().

Revision 1.211: download - view: text, markup, annotated - select for diffs
Sat Dec 25 21:26:56 2010 UTC (13 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +3 -20 lines
SVN rev 216699 on 2010-12-25 21:26:56Z by alc

Introduce and use a new VM interface for temporarily pinning pages.  This
new interface replaces the combined use of vm_fault_quick() and
pmap_extract_and_hold() throughout the kernel.

In collaboration with:	kib@

Revision 1.191.2.6.4.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:10:29 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_7_4
CVS tags: RELENG_7_4_0_RELEASE
Diff to: previous 1.191.2.6: preferred, colored; next MAIN 1.192: preferred, colored
Changes since revision 1.191.2.6: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)

Revision 1.205.2.1.6.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:09:25 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_8_2
CVS tags: RELENG_8_2_0_RELEASE
Diff to: previous 1.205.2.1: preferred, colored; next MAIN 1.205.2.2: preferred, colored
Changes since revision 1.205.2.1: +0 -0 lines
SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)

Revision 1.210: download - view: text, markup, annotated - select for diffs
Fri Dec 17 22:41:22 2010 UTC (13 months, 3 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +3 -12 lines
SVN rev 216511 on 2010-12-17 22:41:22Z by alc

Implement and use a single optimized function for unholding a set of pages.

Reviewed by:	kib@

Revision 1.205.2.1.4.1: download - view: text, markup, annotated - select for diffs
Mon Jun 14 02:09:06 2010 UTC (19 months, 3 weeks ago) by kensmith
Branches: RELENG_8_1
CVS tags: RELENG_8_1_0_RELEASE
Diff to: previous 1.205.2.1: preferred, colored; next MAIN 1.205.2.2: preferred, colored
Changes since revision 1.205.2.1: +0 -0 lines
SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)

Revision 1.209: download - view: text, markup, annotated - select for diffs
Sat May 8 23:01:47 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +1 -4 lines
SVN rev 207805 on 2010-05-08 23:01:47Z by alc

Update a comment: It no longer makes sense to talk about the page queues
lock here.

Revision 1.208: download - view: text, markup, annotated - select for diffs
Fri Apr 30 00:46:43 2010 UTC (21 months, 1 week ago) by kmacy
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +7 -5 lines
SVN rev 207410 on 2010-04-30 00:46:43Z by kmacy

On Alan's advice, rather than do a wholesale conversion on a single
architecture from page queue lock to a hashed array of page locks
(based on a patch by Jeff Roberson), I've implemented page lock
support in the MI code and have only moved vm_page's hold_count
out from under page queue mutex to page lock. This changes
pmap_extract_and_hold on all pmaps.

Supported by: Bitgravity Inc.

Discussed with: alc, jeffr, and kib

Revision 1.207: download - view: text, markup, annotated - select for diffs
Sun Mar 28 13:13:22 2010 UTC (22 months, 1 week ago) by ed
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +3 -3 lines
SVN rev 205792 on 2010-03-28 13:13:22Z by ed

Rename st_*timespec fields to st_*tim for POSIX 2008 compliance.

A nice thing about POSIX 2008 is that it finally standardizes a way to
obtain file access/modification/change times in sub-second precision,
namely using struct timespec, which we already have for a very long
time. Unfortunately POSIX uses different names.

This commit adds compatibility macros, so existing code should still
build properly. Also change all source code in the kernel to work
without any of the compatibility macros. This makes it all a less
ambiguous.

I am also renaming st_birthtime to st_birthtim, even though it was a
local extension anyway. It seems Cygwin also has a st_birthtim.

Revision 1.191.2.6.2.1: download - view: text, markup, annotated - select for diffs
Wed Feb 10 00:26:20 2010 UTC (23 months, 4 weeks ago) by kensmith
Branches: RELENG_7_3
CVS tags: RELENG_7_3_0_RELEASE
Diff to: previous 1.191.2.6: preferred, colored; next MAIN 1.192: preferred, colored
Changes since revision 1.191.2.6: +0 -0 lines
SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)

Revision 1.191.2.6: download - view: text, markup, annotated - select for diffs
Fri Jan 22 17:02:07 2010 UTC (2 years ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_4_BP, RELENG_7_3_BP
Branch point for: RELENG_7_4, RELENG_7_3
Diff to: previous 1.191.2.5: preferred, colored; branchpoint 1.191: preferred, colored; next MAIN 1.192: preferred, colored
Changes since revision 1.191.2.5: +2 -4 lines
SVN rev 202814 on 2010-01-22 17:02:07Z by jhb

MFC 193951:
Adapt vfs kqfilter to the shared vnode lock used by zfs write vop. Use
vnode interlock to protect the knote fields. The locking assumes
that shared vnode lock is held, thus we get exclusive access to knote
either by exclusive vnode lock protection, or by shared vnode lock +
vnode interlock.

Unlike the change in HEAD, this does not remove kl_locked() and replace it
with kl_assert_locked() and kl_assert_unlocked().  Instead, the kl_locked
can now be set to NULL in which case no assertion checks are performed on
the lock.  The vfs kqfilter code uses this mode to disable assertion checks.
This preserves the existing ABI for knlist_init().

Add convenience function knlist_init_mtx to reduce number of arguments
for typical knlist initialization.

Reviewed by:	kib

Revision 1.205.2.1.2.1: download - view: text, markup, annotated - select for diffs
Sun Oct 25 01:10:29 2009 UTC (2 years, 3 months ago) by kensmith
Branches: RELENG_8_0
CVS tags: RELENG_8_0_0_RELEASE
Diff to: previous 1.205.2.1: preferred, colored; next MAIN 1.205.2.2: preferred, colored
Changes since revision 1.205.2.1: +0 -0 lines
SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)

Revision 1.184.2.6: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_6
Diff to: previous 1.184.2.5: preferred, colored; branchpoint 1.184: preferred, colored; next MAIN 1.185: preferred, colored
Changes since revision 1.184.2.5: +23 -17 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.184.2.4.2.3: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_6_4
Diff to: previous 1.184.2.4.2.2: preferred, colored; branchpoint 1.184.2.4: preferred, colored; next MAIN 1.184.2.5: preferred, colored
Changes since revision 1.184.2.4.2.2: +23 -17 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.184.2.2.6.3: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_6_3
Diff to: previous 1.184.2.2.6.2: preferred, colored; branchpoint 1.184.2.2: preferred, colored; next MAIN 1.184.2.3: preferred, colored
Changes since revision 1.184.2.2.6.2: +23 -17 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.206: download - view: text, markup, annotated - select for diffs
Sat Sep 12 20:03:45 2009 UTC (2 years, 4 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +10 -4 lines
SVN rev 197134 on 2009-09-12 20:03:45Z by rwatson

Use C99 initialization for struct filterops.

Obtained from:	Mac OS X
Sponsored by:	Apple Inc.
MFC after:	3 weeks

Revision 1.205.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 3 08:13:06 2009 UTC (2 years, 6 months ago) by kensmith
Branches: RELENG_8
CVS tags: RELENG_8_2_BP, RELENG_8_1_BP, RELENG_8_0_BP
Branch point for: RELENG_8_2, RELENG_8_1, RELENG_8_0
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +0 -0 lines
SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)

Revision 1.205: download - view: text, markup, annotated - select for diffs
Tue Jul 7 09:43:44 2009 UTC (2 years, 7 months ago) by kib
Branches: MAIN
CVS tags: RELENG_8_BP
Branch point for: RELENG_8
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +9 -6 lines
SVN rev 195423 on 2009-07-07 09:43:44Z by kib

Fix poll(2) and select(2) for named pipes to return "ready for read"
when all writers, observed by reader, exited. Use writer generation
counter for fifo, and store the snapshot of the fifo generation in the
f_seqcount field of struct file, that is otherwise unused for fifos.
Set FreeBSD-undocumented POLLINIGNEOF flag only when file f_seqcount is
equal to fifo' fi_wgen, and revert r89376.

Fix POLLINIGNEOF for sockets and pipes, and return POLLHUP for them.
Note that the patch does not fix not returning POLLHUP for fifos.

PR:	kern/94772
Submitted by:	bde (original version)
Reviewed by:	rwatson, jilles
Approved by:	re (kensmith)
MFC after:	6 weeks (might be)

Revision 1.204: download - view: text, markup, annotated - select for diffs
Wed Jun 10 20:59:32 2009 UTC (2 years, 8 months ago) by kib
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +2 -4 lines
SVN rev 193951 on 2009-06-10 20:59:32Z by kib

Adapt vfs kqfilter to the shared vnode lock used by zfs write vop. Use
vnode interlock to protect the knote fields [1]. The locking assumes
that shared vnode lock is held, thus we get exclusive access to knote
either by exclusive vnode lock protection, or by shared vnode lock +
vnode interlock.

Do not use kl_locked() method to assert either lock ownership or the
fact that curthread does not own the lock. For shared locks, ownership
is not recorded, e.g. VOP_ISLOCKED can return LK_SHARED for the shared
lock not owned by curthread, causing false positives in kqueue subsystem
assertions about knlist lock.

Remove kl_locked method from knlist lock vector, and add two separate
assertion methods kl_assert_locked and kl_assert_unlocked, that are
supposed to use proper asserts. Change knlist_init accordingly.

Add convenience function knlist_init_mtx to reduce number of arguments
for typical knlist initialization.

Submitted by:	jhb [1]
Noted by:	jhb [2]
Reviewed by:	jhb
Tested by:	rnoland

Revision 1.203: download - view: text, markup, annotated - select for diffs
Wed Jun 10 10:31:11 2009 UTC (2 years, 8 months ago) by cperciva
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +2 -0 lines
SVN rev 193893 on 2009-06-10 10:31:11Z by cperciva

Prevent integer overflow in direct pipe write code from circumventing
virtual-to-physical page lookups. [09:09]

Add missing permissions check for SIOCSIFINFO_IN6 ioctl. [09:10]

Fix buffer overflow in "autokey" negotiation in ntpd(8). [09:11]

Approved by:	so (cperciva)
Approved by:	re (not really, but SVN wants this...)
Security:	FreeBSD-SA-09:09.pipe
Security:	FreeBSD-SA-09:10.ipv6
Security:	FreeBSD-SA-09:11.ntpd

Revision 1.191.2.5: download - view: text, markup, annotated - select for diffs
Wed Jun 10 10:31:11 2009 UTC (2 years, 8 months ago) by cperciva
Branches: RELENG_7
Diff to: previous 1.191.2.4: preferred, colored; branchpoint 1.191: preferred, colored
Changes since revision 1.191.2.4: +2 -0 lines
SVN rev 193893 on 2009-06-10 10:31:11Z by cperciva

Prevent integer overflow in direct pipe write code from circumventing
virtual-to-physical page lookups. [09:09]

Add missing permissions check for SIOCSIFINFO_IN6 ioctl. [09:10]

Fix buffer overflow in "autokey" negotiation in ntpd(8). [09:11]

Approved by:	so (cperciva)
Approved by:	re (not really, but SVN wants this...)
Security:	FreeBSD-SA-09:09.pipe
Security:	FreeBSD-SA-09:10.ipv6
Security:	FreeBSD-SA-09:11.ntpd

Revision 1.191.2.3.4.2: download - view: text, markup, annotated - select for diffs
Wed Jun 10 10:31:11 2009 UTC (2 years, 8 months ago) by cperciva
Branches: RELENG_7_2
Diff to: previous 1.191.2.3.4.1: preferred, colored; branchpoint 1.191.2.3: preferred, colored; next MAIN 1.191.2.4: preferred, colored
Changes since revision 1.191.2.3.4.1: +2 -0 lines
SVN rev 193893 on 2009-06-10 10:31:11Z by cperciva

Prevent integer overflow in direct pipe write code from circumventing
virtual-to-physical page lookups. [09:09]

Add missing permissions check for SIOCSIFINFO_IN6 ioctl. [09:10]

Fix buffer overflow in "autokey" negotiation in ntpd(8). [09:11]

Approved by:	so (cperciva)
Approved by:	re (not really, but SVN wants this...)
Security:	FreeBSD-SA-09:09.pipe
Security:	FreeBSD-SA-09:10.ipv6
Security:	FreeBSD-SA-09:11.ntpd

Revision 1.191.2.3.2.2: download - view: text, markup, annotated - select for diffs
Wed Jun 10 10:31:11 2009 UTC (2 years, 8 months ago) by cperciva
Branches: RELENG_7_1
Diff to: previous 1.191.2.3.2.1: preferred, colored; branchpoint 1.191.2.3: preferred, colored; next MAIN 1.191.2.4: preferred, colored
Changes since revision 1.191.2.3.2.1: +2 -0 lines
SVN rev 193893 on 2009-06-10 10:31:11Z by cperciva

Prevent integer overflow in direct pipe write code from circumventing
virtual-to-physical page lookups. [09:09]

Add missing permissions check for SIOCSIFINFO_IN6 ioctl. [09:10]

Fix buffer overflow in "autokey" negotiation in ntpd(8). [09:11]

Approved by:	so (cperciva)
Approved by:	re (not really, but SVN wants this...)
Security:	FreeBSD-SA-09:09.pipe
Security:	FreeBSD-SA-09:10.ipv6
Security:	FreeBSD-SA-09:11.ntpd

Revision 1.184.2.5: download - view: text, markup, annotated - select for diffs
Wed Jun 10 10:31:11 2009 UTC (2 years, 8 months ago) by cperciva
Branches: RELENG_6
Diff to: previous 1.184.2.4: preferred, colored; branchpoint 1.184: preferred, colored
Changes since revision 1.184.2.4: +2 -0 lines
SVN rev 193893 on 2009-06-10 10:31:11Z by cperciva

Prevent integer overflow in direct pipe write code from circumventing
virtual-to-physical page lookups. [09:09]

Add missing permissions check for SIOCSIFINFO_IN6 ioctl. [09:10]

Fix buffer overflow in "autokey" negotiation in ntpd(8). [09:11]

Approved by:	so (cperciva)
Approved by:	re (not really, but SVN wants this...)
Security:	FreeBSD-SA-09:09.pipe
Security:	FreeBSD-SA-09:10.ipv6
Security:	FreeBSD-SA-09:11.ntpd

Revision 1.184.2.4.2.2: download - view: text, markup, annotated - select for diffs
Wed Jun 10 10:31:11 2009 UTC (2 years, 8 months ago) by cperciva
Branches: RELENG_6_4
Diff to: previous 1.184.2.4.2.1: preferred, colored; branchpoint 1.184.2.4: preferred, colored
Changes since revision 1.184.2.4.2.1: +2 -0 lines
SVN rev 193893 on 2009-06-10 10:31:11Z by cperciva

Prevent integer overflow in direct pipe write code from circumventing
virtual-to-physical page lookups. [09:09]

Add missing permissions check for SIOCSIFINFO_IN6 ioctl. [09:10]

Fix buffer overflow in "autokey" negotiation in ntpd(8). [09:11]

Approved by:	so (cperciva)
Approved by:	re (not really, but SVN wants this...)
Security:	FreeBSD-SA-09:09.pipe
Security:	FreeBSD-SA-09:10.ipv6
Security:	FreeBSD-SA-09:11.ntpd

Revision 1.184.2.2.6.2: download - view: text, markup, annotated - select for diffs
Wed Jun 10 10:31:11 2009 UTC (2 years, 8 months ago) by cperciva
Branches: RELENG_6_3
Diff to: previous 1.184.2.2.6.1: preferred, colored; branchpoint 1.184.2.2: preferred, colored
Changes since revision 1.184.2.2.6.1: +2 -0 lines
SVN rev 193893 on 2009-06-10 10:31:11Z by cperciva

Prevent integer overflow in direct pipe write code from circumventing
virtual-to-physical page lookups. [09:09]

Add missing permissions check for SIOCSIFINFO_IN6 ioctl. [09:10]

Fix buffer overflow in "autokey" negotiation in ntpd(8). [09:11]

Approved by:	so (cperciva)
Approved by:	re (not really, but SVN wants this...)
Security:	FreeBSD-SA-09:09.pipe
Security:	FreeBSD-SA-09:10.ipv6
Security:	FreeBSD-SA-09:11.ntpd

Revision 1.202: download - view: text, markup, annotated - select for diffs
Fri Jun 5 14:55:22 2009 UTC (2 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +0 -2 lines
SVN rev 193511 on 2009-06-05 14:55:22Z by rwatson

Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC
and used in a large number of files, but also because an increasing number
of incorrect uses of MAC calls were sneaking in due to copy-and-paste of
MAC-aware code without the associated opt_mac.h include.

Discussed with:	pjd

Revision 1.191.2.4: download - view: text, markup, annotated - select for diffs
Fri May 15 19:54:19 2009 UTC (2 years, 8 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.191.2.3: preferred, colored; branchpoint 1.191: preferred, colored
Changes since revision 1.191.2.3: +5 -5 lines
SVN rev 192154 on 2009-05-15 19:54:19Z by jhb

MFC: Adjust some variables (mostly related to the buffer cache) that hold
address space sizes to be longs instead of ints.  This includes an ABI
compat shim for the kern.bufspace sysctl for old binaries.

Revision 1.191.2.3.4.1: download - view: text, markup, annotated - select for diffs
Wed Apr 15 03:14:26 2009 UTC (2 years, 9 months ago) by kensmith
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.191.2.3: preferred, colored
Changes since revision 1.191.2.3: +0 -0 lines
SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)

Revision 1.201: download - view: text, markup, annotated - select for diffs
Tue Mar 10 21:28:43 2009 UTC (2 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +5 -5 lines
SVN rev 189649 on 2009-03-10 21:28:43Z by jhb

- Make maxpipekva a signed long rather than an unsigned long as overflow
  is more likely to be noticed with signed types.
- Make amountpipekva a long as well to match maxpipekva.

Discussed with:	bde

Revision 1.200: download - view: text, markup, annotated - select for diffs
Mon Mar 9 19:35:20 2009 UTC (2 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +1 -1 lines
SVN rev 189595 on 2009-03-09 19:35:20Z by jhb

Adjust some variables (mostly related to the buffer cache) that hold
address space sizes to be longs instead of ints.  Specifically, the follow
values are now longs: runningbufspace, bufspace, maxbufspace,
bufmallocspace, maxbufmallocspace, lobufspace, hibufspace, lorunningspace,
hirunningspace, maxswzone, maxbcache, and maxpipekva.  Previously, a
relatively small number (~ 44000) of buffers set in kern.nbuf would result
in integer overflows resulting either in hangs or bogus values of
hidirtybuffers and lodirtybuffers.  Now one has to overflow a long to see
such problems.  There was a check for a nbuf setting that would cause
overflows in the auto-tuning of nbuf.  I've changed it to always check and
cap nbuf but warn if a user-supplied tunable would cause overflow.

Note that this changes the ABI of several sysctls that are used by things
like top(1), etc., so any MFC would probably require a some gross shims
to allow for that.

MFC after:	1 month

Revision 1.191.2.3.2.1: download - view: text, markup, annotated - select for diffs
Tue Nov 25 02:59:29 2008 UTC (3 years, 2 months ago) by kensmith
Branches: RELENG_7_1
CVS tags: RELENG_7_1_0_RELEASE
Diff to: previous 1.191.2.3: preferred, colored
Changes since revision 1.191.2.3: +0 -0 lines
SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)

Revision 1.199: download - view: text, markup, annotated - select for diffs
Tue Nov 11 14:55:59 2008 UTC (3 years, 2 months ago) by ed
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +22 -9 lines
SVN rev 184849 on 2008-11-11 14:55:59Z by ed

Several cleanups related to pipe(2).

- Use `fildes[2]' instead of `*fildes' to make more clear that pipe(2)
  fills an array with two descriptors.

- Remove EFAULT from the manual page. Because of the current calling
  convention, pipe(2) raises a segmentation fault when an invalid
  address is passed.

- Introduce kern_pipe() to make it easier for binary emulations to
  implement pipe(2).

- Make Linux binary emulation use kern_pipe(), which means we don't have
  to recover td_retval after calling the FreeBSD system call.

Approved by:	rdivacky
Discussed on:	arch

Revision 1.184.2.4.2.1: download - view: text, markup, annotated - select for diffs
Thu Oct 2 02:57:24 2008 UTC (3 years, 4 months ago) by kensmith
Branches: RELENG_6_4
CVS tags: RELENG_6_4_0_RELEASE
Diff to: previous 1.184.2.4: preferred, colored
Changes since revision 1.184.2.4: +0 -0 lines
SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)

Revision 1.191.2.3: download - view: text, markup, annotated - select for diffs
Fri Jun 6 12:17:28 2008 UTC (3 years, 8 months ago) by kib
Branches: RELENG_7
CVS tags: RELENG_7_2_BP, RELENG_7_1_BP
Branch point for: RELENG_7_2, RELENG_7_1
Diff to: previous 1.191.2.2: preferred, colored; branchpoint 1.191: preferred, colored
Changes since revision 1.191.2.2: +22 -11 lines
SVN rev 179616 on 2008-06-06 12:17:28Z by kib

MFC rev. 1.198 of sys/kern/sys_pipe.c,
    rev. 1.30 of sys/sys/pipe.h
AKA r179243.

Another problem caused by the knlist_cleardel() potentially dropping
PIPE_MTX().

Since the pipe_present is cleared before (potentially) sleeping, the
second thread may enter the pipeclose() for the reciprocal pipe end.
The test at the end of the pipeclose() for the pipe_present == 0 would
succeed, allowing the second thread to free the pipe memory. First
threads then accesses the freed memory after being woken up.

Properly track the closing state of the pipe in the pipe_present.
Introduce the intermediate state that marks the pipe as mostly
dismantled but might be sleeping waiting for the knote list to be
cleared. Free the pipe pair memory only when both ends pass that point.

Revision 1.191.2.2: download - view: text, markup, annotated - select for diffs
Fri Jun 6 12:04:31 2008 UTC (3 years, 8 months ago) by kib
Branches: RELENG_7
Diff to: previous 1.191.2.1: preferred, colored; branchpoint 1.191: preferred, colored
Changes since revision 1.191.2.1: +1 -6 lines
SVN rev 179615 on 2008-06-06 12:04:31Z by kib

MFC rev. 1.197 AKA r179242:
The pipe_peer that has the knote for write shall be present. Ignore the
pipe_present value for EVFILT_WRITE in filt_pipedetach().

Revision 1.198: download - view: text, markup, annotated - select for diffs
Fri May 23 11:14:03 2008 UTC (3 years, 8 months ago) by kib
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +22 -11 lines
Another problem caused by the knlist_cleardel() potentially dropping
PIPE_MTX().

Since the pipe_present is cleared before (potentially) sleeping, the
second thread may enter the pipeclose() for the reciprocal pipe end.
The test at the end of the pipeclose() for the pipe_present == 0 would
succeed, allowing the second thread to free the pipe memory. First
threads then accesses the freed memory after being woken up.

Properly track the closing state of the pipe in the pipe_present.
Introduce the intermediate state that marks the pipe as mostly
dismantled but might be sleeping waiting for the knote list to be
cleared. Free the pipe pair memory only when both ends pass that point.

Debugging help and tested by:	pho
Discussed with:	jmg
MFC after:	2 weeks

Revision 1.197: download - view: text, markup, annotated - select for diffs
Fri May 23 11:09:50 2008 UTC (3 years, 8 months ago) by kib
Branches: MAIN
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +1 -6 lines
Destruction of the pipe calls knlist_cleardel() to remove the knotes
monitoring the pipe. The code sets pipe_present = 0 and enters
knlist_cleardel(), where the PIPE_MTX might be dropped when knl->kl_list
cannot be cleared due to influx knotes.

If the following often encountered code fragment
                if (!(kn->kn_status & KN_DETACHED))
                        kn->kn_fop->f_detach(kn);
                knote_drop(kn, td); [1]
is executed while the knlist lock is dropped, then the knote memory is freed
by the knote_drop() without knote being removed from the knlist, since
the filt_pipedetach() contains the following:
        if (kn->kn_filter == EVFILT_WRITE) {
                if (!cpipe->pipe_peer->pipe_present) {
                        PIPE_UNLOCK(cpipe);
                        return;

Now, the memory may be reused in the zone, causing the access to the
freed memory. I got the panics caused by the marker knote appearing on
the knlist, that, I believe, manifestation of the issue. In the Peter
Holm test scenarious, we got unkillable processes too.

The pipe_peer that has the knote for write shall be present. Ignore the
pipe_present value for EVFILT_WRITE in filt_pipedetach().

Debugging help and tested by:	pho
Discussed with:	jmg
MFC after:	2 weeks

Revision 1.196: download - view: text, markup, annotated - select for diffs
Mon Jan 7 20:05:18 2008 UTC (4 years, 1 month ago) by jhb
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +14 -0 lines
Make ftruncate a 'struct file' operation rather than a vnode operation.
This makes it possible to support ftruncate() on non-vnode file types in
the future.
- 'struct fileops' grows a 'fo_truncate' method to handle an ftruncate() on
  a given file descriptor.
- ftruncate() moves to kern/sys_generic.c and now just fetches a file
  object and invokes fo_truncate().
- The vnode-specific portions of ftruncate() move to vn_truncate() in
  vfs_vnops.c which implements fo_truncate() for vnode file types.
- Non-vnode file types return EINVAL in their fo_truncate() method.

Submitted by:	rwatson

Revision 1.195: download - view: text, markup, annotated - select for diffs
Sun Dec 30 01:42:13 2007 UTC (4 years, 1 month ago) by jeff
Branches: MAIN
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +2 -12 lines
Remove explicit locking of struct file.
 - Introduce a finit() which is used to initailize the fields of struct file
   in such a way that the ops vector is only valid after the data, type,
   and flags are valid.
 - Protect f_flag and f_count with atomic operations.
 - Remove the global list of all files and associated accounting.
 - Rewrite the unp garbage collection such that it no longer requires
   the global list of all files and instead uses a list of all unp sockets.
 - Mark sockets in the accept queue so we don't incorrectly gc them.

Tested by:	kris, pho

Revision 1.194: download - view: text, markup, annotated - select for diffs
Sun Dec 16 06:21:19 2007 UTC (4 years, 1 month ago) by jeff
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +6 -3 lines
Refactor select to reduce contention and hide internal implementation
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

Revision 1.184.2.2.6.1: download - view: text, markup, annotated - select for diffs
Sun Nov 25 17:33:54 2007 UTC (4 years, 2 months ago) by dumbbell
Branches: RELENG_6_3
CVS tags: RELENG_6_3_0_RELEASE
Diff to: previous 1.184.2.2: preferred, colored
Changes since revision 1.184.2.2: +4 -0 lines
MFC 1.193:
  The kernel uses two ways to write data on a pipe:
      o  buffered write, for chunks smaller than PIPE_MINDIRECT bytes
      o  direct write, for everything else

  A call to writev(2) may receive struct iov of various size and the
  kernel may have to switch from one solution to the other. Before doing
  this, it must wake reader processes and any select/poll/kqueue up.

  This commit fixes a bug where select/poll/kqueue are not triggered
  when switching from buffered write to direct write. It adds calls to
  pipeselwakeup().

  I give more details on freebsd-arch@:
  http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html

  This should fix issues with Erlang (lang/erlang) and kqueue.

Reported by:	Rickard Green (Erlang)
Approved by:	re (kensmith)

Revision 1.184.2.4: download - view: text, markup, annotated - select for diffs
Sun Nov 25 17:31:42 2007 UTC (4 years, 2 months ago) by dumbbell
Branches: RELENG_6
CVS tags: RELENG_6_4_BP
Branch point for: RELENG_6_4
Diff to: previous 1.184.2.3: preferred, colored; branchpoint 1.184: preferred, colored
Changes since revision 1.184.2.3: +3 -2 lines
The fix for blocked select/poll/kqueue (rev 1.184.2.3) wasn't applied
correctly: one line was missing.

Approved by:	re (kensmith)

Revision 1.184.2.3: download - view: text, markup, annotated - select for diffs
Sun Nov 25 11:54:27 2007 UTC (4 years, 2 months ago) by dumbbell
Branches: RELENG_6
Diff to: previous 1.184.2.2: preferred, colored; branchpoint 1.184: preferred, colored
Changes since revision 1.184.2.2: +3 -0 lines
MFC 1.193:
  The kernel uses two ways to write data on a pipe:
      o  buffered write, for chunks smaller than PIPE_MINDIRECT bytes
      o  direct write, for everything else

  A call to writev(2) may receive struct iov of various size and the
  kernel may have to switch from one solution to the other. Before doing
  this, it must wake reader processes and any select/poll/kqueue up.

  This commit fixes a bug where select/poll/kqueue are not triggered
  when switching from buffered write to direct write. It adds calls to
  pipeselwakeup().

  I give more details on freebsd-arch@:
  http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html

  This should fix issues with Erlang (lang/erlang) and kqueue.

Reported by:	Rickard Green (Erlang)
Approved by:	re (kensmith)

Revision 1.191.2.1: download - view: text, markup, annotated - select for diffs
Sun Nov 25 11:11:28 2007 UTC (4 years, 2 months ago) by dumbbell
Branches: RELENG_7
CVS tags: RELENG_7_0_BP, RELENG_7_0_0_RELEASE, RELENG_7_0
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +4 -0 lines
MFC 1.193:
  The kernel uses two ways to write data on a pipe:
      o  buffered write, for chunks smaller than PIPE_MINDIRECT bytes
      o  direct write, for everything else

  A call to writev(2) may receive struct iov of various size and the
  kernel may have to switch from one solution to the other. Before doing
  this, it must wake reader processes and any select/poll/kqueue up.

  This commit fixes a bug where select/poll/kqueue are not triggered
  when switching from buffered write to direct write. It adds calls to
  pipeselwakeup().

  I give more details on freebsd-arch@:
  http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html

  This should fix issues with Erlang (lang/erlang) and kqueue.

Reported by:	Rickard Green (Erlang)
Approved by:	re (kensmith)

Revision 1.193: download - view: text, markup, annotated - select for diffs
Mon Nov 19 15:05:20 2007 UTC (4 years, 2 months ago) by dumbbell
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +4 -0 lines
The kernel uses two ways to write data on a pipe:
    o  buffered write, for chunks smaller than PIPE_MINDIRECT bytes
    o  direct write, for everything else

A call to writev(2) may receive struct iov of various size and the
kernel may have to switch from one solution to the other. Before doing
this, it must wake reader processes and any select/poll/kqueue up.

This commit fixes a bug where select/poll/kqueue are not triggered
when switching from buffered write to direct write. It adds calls to
pipeselwakeup().

I give more details on freebsd-arch@:
http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html

This should fix issues with Erlang (lang/erlang) and kqueue.

Reported by:	Rickard Green (Erlang)

Revision 1.192: download - view: text, markup, annotated - select for diffs
Wed Oct 24 19:03:55 2007 UTC (4 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +9 -9 lines
Merge first in a series of TrustedBSD MAC Framework KPI changes
from Mac OS X Leopard--rationalize naming for entry points to
the following general forms:

  mac_<object>_<method/action>
  mac_<object>_check_<method/action>

The previous naming scheme was inconsistent and mostly
reversed from the new scheme.  Also, make object types more
consistent and remove spaces from object types that contain
multiple parts ("posix_sem" -> "posixsem") to make mechanical
parsing easier.  Introduce a new "netinet" object type for
certain IPv4/IPv6-related methods.  Also simplify, slightly,
some entry point names.

All MAC policy modules will need to be recompiled, and modules
not updates as part of this commit will need to be modified to
conform to the new KPI.

Sponsored by:	SPARTA (original patches against Mac OS X)
Obtained from:	TrustedBSD Project, Apple Computer

Revision 1.191: download - view: text, markup, annotated - select for diffs
Sun May 27 17:33:10 2007 UTC (4 years, 8 months ago) by rwatson
Branches: MAIN
CVS tags: RELENG_7_BP
Branch point for: RELENG_7
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +2 -19 lines
Remove amountpipes counter for pipes -- this replicates the function of
existing UMA statistics for pipes, and allows us to get rid of both the
per-pipe dtor and two atomic operations per pipe required to maintain
the counter.

Revision 1.190: download - view: text, markup, annotated - select for diffs
Mon Mar 5 13:10:57 2007 UTC (4 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +2 -3 lines
Further system call comment cleanup:

- Remove also "MP SAFE" after prior "MPSAFE" pass. (suggested by bde)
- Remove extra blank lines in some cases.
- Add extra blank lines in some cases.
- Remove no-op comments consisting solely of the function name, the word
  "syscall", or the system call name.
- Add punctuation.
- Re-wrap some comments.

Revision 1.189: download - view: text, markup, annotated - select for diffs
Tue Dec 19 12:52:22 2006 UTC (5 years, 1 month ago) by pjd
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +3 -2 lines
Use pipe_direct_write() optimization only if the data is in process' memory.
This fixes sending data through pipe from the kernel.

Fix suggested by:	rwatson

Revision 1.188: download - view: text, markup, annotated - select for diffs
Sun Oct 22 11:52:13 2006 UTC (5 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +2 -1 lines
Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.h
begun with a repo-copy of mac.h to mac_framework.h.  sys/mac.h now
contains the userspace and user<->kernel API and definitions, with all
in-kernel interfaces moved to mac_framework.h, which is now included
across most of the kernel instead.

This change is the first step in a larger cleanup and sweep of MAC
Framework interfaces in the kernel, and will not be MFC'd.

Obtained from:	TrustedBSD Project
Sponsored by:	SPARTA

Revision 1.187: download - view: text, markup, annotated - select for diffs
Sat Jun 10 14:34:07 2006 UTC (5 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +0 -2 lines
Move some functions and definitions from uipc_socket2.c to uipc_socket.c:

- Move sonewconn(), which creates new sockets for incoming connections on
  listen sockets, so that all socket allocate code is together in
  uipc_socket.c.

- Move 'maxsockets' and associated sysctls to uipc_socket.c with the
  socket allocation code.

- Move kern.ipc sysctl node to uipc_socket.c, add a SYSCTL_DECL() for it
  to sysctl.h and remove lots of scattered implementations in various
  IPC modules.

- Sort sodealloc() after soalloc() in uipc_socket.c for dependency order
  reasons.  Statisticize soalloc() and sodealloc() as they are now
  required only in uipc_socket.c, and are internal to the socket
  implementation.

After this change, socket allocation and deallocation is entirely
centralized in one file, and uipc_socket2.c consists entirely of socket
buffer manipulation and default protocol switch functions.

MFC after:	1 month

Revision 1.184.2.2: download - view: text, markup, annotated - select for diffs
Tue Jan 31 15:44:51 2006 UTC (6 years ago) by glebius
Branches: RELENG_6
CVS tags: RELENG_6_3_BP, RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2, RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1
Branch point for: RELENG_6_3
Diff to: previous 1.184.2.1: preferred, colored; branchpoint 1.184: preferred, colored
Changes since revision 1.184.2.1: +3 -2 lines
MFC:
  - In pipe() return the error returned by pipe_create(), rather then
    hardcoded ENFILES, which is incorrect. pipe_create() can fail due
    to ENOMEM.
  - Update manual page, describing ENOMEM return code.

  Reviewed by:    arch

Revision 1.186: download - view: text, markup, annotated - select for diffs
Mon Jan 30 08:25:04 2006 UTC (6 years ago) by glebius
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +3 -2 lines
- In pipe() return the error returned by pipe_create(), rather then
  hardcoded ENFILES, which is incorrect. pipe_create() can fail due
  to ENOMEM.
- Update manual page, describing ENOMEM return code.

Reviewed by:	arch

Revision 1.177.2.4: download - view: text, markup, annotated - select for diffs
Sat Jan 14 19:57:48 2006 UTC (6 years ago) by delphij
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5
Diff to: previous 1.177.2.3: preferred, colored; branchpoint 1.177: preferred, colored; next MAIN 1.178: preferred, colored
Changes since revision 1.177.2.3: +2 -0 lines
MFC revision 1.185
date: 2005/12/16 18:32:39;  author: delphij;  state: Exp;  lines: +2 -0
In pipe_write(): when uiomove() fails, do not spin on it forever.

Submitted by:   Kostik Belousov <kostikbel at gmail.com> on -current@
Message-ID:     <20051216151016.GE84442@deviant.zoral.local>
Security:	Local DoS

Revision 1.184.2.1: download - view: text, markup, annotated - select for diffs
Sat Jan 14 19:57:17 2006 UTC (6 years ago) by delphij
Branches: RELENG_6
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +2 -0 lines
MFC revision 1.185
date: 2005/12/16 18:32:39;  author: delphij;  state: Exp;  lines: +2 -0
In pipe_write(): when uiomove() fails, do not spin on it forever.

Submitted by:   Kostik Belousov <kostikbel at gmail.com> on -current@
Message-ID:     <20051216151016.GE84442@deviant.zoral.local>
Security:	Local DoS

Revision 1.185: download - view: text, markup, annotated - select for diffs
Fri Dec 16 18:32:39 2005 UTC (6 years, 1 month ago) by delphij
Branches: MAIN
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +2 -0 lines
In pipe_write(): when uiomove() fails, do not spin on it forever.

Submitted by:	Kostik Belousov <kostikbel at gmail.com> on -current@
Message-ID:	<20051216151016.GE84442@deviant.zoral.local>
MFC After:	3 weeks

Revision 1.184: download - view: text, markup, annotated - select for diffs
Fri Jul 1 16:28:30 2005 UTC (6 years, 7 months ago) by ssouhlal
Branches: MAIN
CVS tags: RELENG_6_BP, RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Branch point for: RELENG_6
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +4 -2 lines
Fix the recent panics/LORs/hangs created by my kqueue commit by:

- Introducing the possibility of using locks different than mutexes
for the knlist locking. In order to do this, we add three arguments to
knlist_init() to specify the functions to use to lock, unlock and
check if the lock is owned. If these arguments are NULL, we assume
mtx_lock, mtx_unlock and mtx_owned, respectively.

- Using the vnode lock for the knlist locking, when doing kqueue operations
on a vnode. This way, we don't have to lock the vnode while holding a
mutex, in filt_vfsread.

Reviewed by:	jmg
Approved by:	re (scottl), scottl (mentor override)
Pointyhat to:	ssouhlal
Will be happy:	everyone

Revision 1.177.2.3: download - view: text, markup, annotated - select for diffs
Sun Feb 27 02:39:33 2005 UTC (6 years, 11 months ago) by jeff
Branches: RELENG_5
CVS tags: RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4
Diff to: previous 1.177.2.2: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.2: +1 -9 lines
MFC revision 1.178
 - filedesc locking cleanup.

Revision 1.177.2.2: download - view: text, markup, annotated - select for diffs
Mon Jan 31 23:26:17 2005 UTC (7 years ago) by imp
Branches: RELENG_5
Diff to: previous 1.177.2.1: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.1: +1 -1 lines
MFC: /*- and related license changes

Revision 1.177.2.1: download - view: text, markup, annotated - select for diffs
Mon Jan 24 09:03:27 2005 UTC (7 years ago) by silby
Branches: RELENG_5
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +3 -1 lines
MFC rev 1.183; fix panic when too many pipes are allocated.

Revision 1.183: download - view: text, markup, annotated - select for diffs
Mon Jan 17 07:56:28 2005 UTC (7 years ago) by silby
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +3 -1 lines
Rearrange the kninit calls for both directions of a pipe so that
they both happen before pipe backing allocation occurs.  Previously,
a pipe memory shortage would cause a panic due to a KNOTE call
on an uninitialized si_note.

Reported by:	Peter Holm
MFC after:	1 week

Revision 1.182: download - view: text, markup, annotated - select for diffs
Thu Jan 6 23:35:39 2005 UTC (7 years, 1 month ago) by imp
Branches: MAIN
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +1 -1 lines
/* -> /*- for copyright notices, minor format tweaks as necessary

Revision 1.181: download - view: text, markup, annotated - select for diffs
Tue Nov 23 22:15:08 2004 UTC (7 years, 2 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +5 -2 lines
Correct a bug introduced in sys_pipe.c:1.179: in pipe_ioctl(),
release the pipe mutex before calling fsetown(), as fsetown()
may block.  The sigio code protects the pipe sigio data using
its own mutex, and the pipe reference count held by the caller
will prevent the pipe from being prematurely garbage-collected.

Discovered by:	imp

Revision 1.180: download - view: text, markup, annotated - select for diffs
Tue Nov 16 06:57:52 2004 UTC (7 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +1 -0 lines
Add missing break.

Revision 1.179: download - view: text, markup, annotated - select for diffs
Mon Nov 15 21:51:28 2004 UTC (7 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +13 -17 lines
Straighten the ioctl function out to have only one exit point.

Revision 1.178: download - view: text, markup, annotated - select for diffs
Sun Nov 7 22:16:07 2004 UTC (7 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +1 -9 lines
Introduce fdclose() which will clean an entry in a filedesc.

Replace homerolled versions with call to fdclose().

Make fdunused() static to kern_descrip.c

Revision 1.177: download - view: text, markup, annotated - select for diffs
Mon Aug 16 01:27:24 2004 UTC (7 years, 5 months ago) by silby
Branches: MAIN
CVS tags: RELENG_5_BP, RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Branch point for: RELENG_5
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +136 -55 lines
Major enhancements to pipe memory usage:

- pipespace is now able to resize non-empty pipes; this allows
  for many more resizing opportunities

- Backing is no longer pre-allocated for the reverse direction
  of pipes.  This direction is rarely (if ever) used, so this cuts the
  amount of map space allocated to a pipe in half.

- Pipe growth is now much more dynamic; a pipe will now grow when
  the total amount of data it contains and the size of the write are
  larger than the size of pipe.  Previously, only individual writes greater
  than the size of the pipe would cause growth.

- In low memory situations, pipes will now shrink during both read
  and write operations, where possible.  Once the memory shortage
  ends, the growth code will cause these pipes to grow back to an appropriate
  size.

- If the full PIPE_SIZE allocation fails when a new pipe is created, the
  allocation will be retried with SMALL_PIPE_SIZE.  This helps to deal
  with the situation of a fragmented map after a low memory period has
  ended.

- Minor documentation + code changes to support the above.

In total, these changes increase the total number of pipes that
can be allocated simultaneously, drastically reducing the chances that
pipe allocation will fail.

Performance appears unchanged due to dynamic resizing.

Revision 1.176: download - view: text, markup, annotated - select for diffs
Sun Aug 15 06:24:41 2004 UTC (7 years, 5 months ago) by jmg
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +11 -6 lines
Add locking to the kqueue subsystem.  This also makes the kqueue subsystem
a more complete subsystem, and removes the knowlege of how things are
implemented from the drivers.  Include locking around filter ops, so a
module like aio will know when not to be unloaded if there are outstanding
knotes using it's filter ops.

Currently, it uses the MTX_DUPOK even though it is not always safe to
aquire duplicate locks.  Witness currently doesn't support the ability
to discover if a dup lock is ok (in some cases).

Reviewed by:	green, rwatson (both earlier versions)

Revision 1.175: download - view: text, markup, annotated - select for diffs
Tue Aug 3 02:59:15 2004 UTC (7 years, 6 months ago) by silby
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +115 -152 lines
Standardize pipe locking, ensuring that everything is locked via
pipelock(), not via a mixture of mutexes and pipelock().  Additionally,
add a few KASSERTS, and change some statements that should have been
KASSERTS into KASSERTS.

As a result of these cleanups, some segments of code have become
significantly shorter and/or easier to read.

Revision 1.174: download - view: text, markup, annotated - select for diffs
Mon Aug 2 00:18:35 2004 UTC (7 years, 6 months ago) by green
Branches: MAIN
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +8 -6 lines
* Add a "how" argument to uma_zone constructors and initialization functions
  so that they know whether the allocation is supposed to be able to sleep
  or not.
* Allow uma_zone constructors and initialation functions to return either
  success or error.  Almost all of the ones in the tree currently return
  success unconditionally, but mbuf is a notable exception: the packet
  zone constructor wants to be able to fail if it cannot suballocate an
  mbuf cluster, and the mbuf allocators want to be able to fail in general
  in a MAC kernel if the MAC mbuf initializer fails.  This fixes the
  panics people are seeing when they run out of memory for mbuf clusters.
* Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing
  the default.

Both bmilekic and jeff have reviewed the changes made to make failable
zone allocations work.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Fri Jul 23 14:11:04 2004 UTC (7 years, 6 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +20 -11 lines
Don't perform pipe endpoint locking during pipe_create(), as the pipe
can't yet be referenced by other threads.

In microbenchmarks, this appears to reduce the cost of
pipe();close();close() on UP by 10%, and SMP by 7%.  The vast majority
of the cost of allocating a pipe remains VM magic.

Suggested by:	silby

Revision 1.172: download - view: text, markup, annotated - select for diffs
Tue Jul 20 07:06:43 2004 UTC (7 years, 6 months ago) by silby
Branches: MAIN
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +4 -1 lines
Fix a minor error in pipe_stat - st_size was always reported as 0
when direct writes kicked in.  Whether this affected any applications
is unknown.

Revision 1.171: download - view: text, markup, annotated - select for diffs
Sat Mar 27 19:50:22 2004 UTC (7 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +18 -60 lines
Revise the direct or optimized case to use uiomove_fromphys() by the reader
instead of ephemeral mappings using pmap_qenter() by the writer.  The
writer is still, however, responsible for wiring the pages, just not
mapping them.  Consequently, the allocation of KVA for the direct case is
unnecessary.  Remove it and the sysctls limiting it, i.e.,
kern.ipc.maxpipekvawired and kern.ipc.amountpipekvawired.  The number
of temporarily wired pages is still, however, limited by
kern.ipc.maxpipekva.

Note: On platforms lacking a direct virtual-to-physical mapping,
uiomove_fromphys() uses sf_bufs to cache ephemeral mappings.  Thus,
the number of available sf_bufs can influence the performance of pipes
on platforms such i386.  Surprisingly, I saw the greatest gain from this
change on such a machine: lmbench's pipe bandwidth result increased from
~1050MB/s to ~1850MB/s on my 2.4GHz, 400MHz FSB P4 Xeon.

Revision 1.170: download - view: text, markup, annotated - select for diffs
Thu Feb 26 00:18:22 2004 UTC (7 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +1 -0 lines
Assert pipe mutex in pipeselwakeup(), as we manipulate pipe_state
in a non-atomic manner.  It appears to always be called with the
mutex (good).

Revision 1.169: download - view: text, markup, annotated - select for diffs
Wed Feb 25 23:30:56 2004 UTC (7 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +3 -7 lines
Update comment regarding MAC labels: we no longer pass endpoints
into the MAC Framework, just the pipe pair.

GC 'hadpeer' used in pipedestroy(), which is no longer needed as
we check pipe_present flags on the pair.

Revision 1.168: download - view: text, markup, annotated - select for diffs
Sun Feb 22 23:00:14 2004 UTC (7 years, 11 months ago) by green
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +66 -41 lines
Correct some major SMP-harmful problems in the pipe implementation.  First
of all, PIPE_EOF is not checked pervasively after everything that can drop
the pipe mutex and msleep(), so fix.  Additionally, though it might not
harm anything, pipelock() and pipeunlock() are not used consistently.
Third, the kqueue support functions do not use the pipe mutex correctly.
Last, but absolutely not least, is a race: if pipe_busy is not set on
the closing side of the pipe, the other side that is trying to write to
that will crash BECAUSE PIPE_EOF IS NOT SET!  Unconditionally set
PIPE_EOF, and get rid of all the lockups/crashes I have seen trying
to build ports.

Revision 1.167: download - view: text, markup, annotated - select for diffs
Tue Feb 3 04:55:24 2004 UTC (8 years ago) by rwatson
Branches: MAIN
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +3 -2 lines
Don't dec/inc the amountpipes counter every time we resize a pipe --
instead, just dec/inc in the ctor/dtor.  For now, increment/decrement
in two's, since we're now performing the operation once per pair,
not once per pipe.  Not really any measurable performance change
in my micro-benchmarks, but doing less work is good, especially when
it comes to atomic operations.

Suggested by:	alc

Revision 1.166: download - view: text, markup, annotated - select for diffs
Tue Feb 3 02:50:51 2004 UTC (8 years ago) by rwatson
Branches: MAIN
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +6 -6 lines
Catch instances of (pipe == NULL) that were obsoleted with recent
changes to jointly allocated pipe pairs.  Replace these checks
with pipe_present checks.  This avoids a NULL pointer dereference
when a pipe is half-closed.

Submitted by:	Peter Edwards <peter.edwards@openet-telecom.com>

Revision 1.165: download - view: text, markup, annotated - select for diffs
Sun Feb 1 05:56:50 2004 UTC (8 years ago) by rwatson
Branches: MAIN
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +150 -91 lines
Coalesce pipe allocations and frees.  Previously, the pipe code
would allocate two 'struct pipe's from the pipe zone, and malloc a
mutex.

- Create a new "struct pipepair" object holding the two 'struct
  pipe' instances, struct mutex, and struct label reference.  Pipe
  structures now have a back-pointer to the pipe pair, and a
  'pipe_present' flag to indicate whether the half has been
  closed.

- Perform mutex init/destroy in zone init/destroy, avoiding
  reallocating the mutex for each pipe.  Perform most pipe structure
  setup in zone constructor.

- VM memory mappings for pageable buffers are still done outside of
  the UMA zone.

- Change MAC API to speak 'struct pipepair' instead of 'struct pipe',
  update many policies.  MAC labels are also handled outside of the
  UMA zone for now.  Label-only policy modules don't have to be
  recompiled, but if a module is recompiled, its pipe entry points
  will need to be updated.  If a module actually reached into the
  pipe structures (unlikely), that would also need to be modified.

These changes substantially simplify failure handling in the pipe
code as there are many fewer possible failure modes.

On half-close, pipes no longer free the 'struct pipe' for the closed
half until a full-close takes place.  However, VM mapped buffers
are still released on half-close.

Some code refactoring is now possible to clean up some of the back
references, etc; this patch attempts not to change the structure
of most of the pipe implementation, only allocation/free code
paths, so as to avoid introducing bugs (hopefully).

This cuts about 8%-9% off the cost of sequential pipe allocation
and free in system call tests on UP and SMP in my micro-benchmarks.
May or may not make a difference in macro-benchmarks, but doing
less work is good.

Reviewed by:	juli, tjr
Testing help:	dwhite, fenestro, scottl, et al

Revision 1.164: download - view: text, markup, annotated - select for diffs
Sat Jan 31 23:03:22 2004 UTC (8 years ago) by rwatson
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +1 -1 lines
Fix an error in a KASSERT string: it's pipe_free_kmem(), not
pipespace(), that contains this KASSERT.

Revision 1.163: download - view: text, markup, annotated - select for diffs
Thu Jan 15 10:15:03 2004 UTC (8 years ago) by des
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +1 -0 lines
New file descriptor allocation code, derived from similar code introduced
in OpenBSD by Niels Provos.  The patch introduces a bitmap of allocated
file descriptors which is used to locate available descriptors when a new
one is needed.  It also moves the task of growing the file descriptor table
out of fdalloc(), reducing complexity in both fdalloc() and do_dup().

Debts of gratitude are owed to tjr@ (who provided the original patch on
which this work is based), grog@ (for the gdb(4) man page) and rwatson@
(for assistance with pxeboot(8)).

Revision 1.162: download - view: text, markup, annotated - select for diffs
Sun Jan 11 20:08:57 2004 UTC (8 years, 1 month ago) by des
Branches: MAIN
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +0 -1 lines
Back out 1.160, which was committed by mistake.

Revision 1.161: download - view: text, markup, annotated - select for diffs
Sun Jan 11 19:54:45 2004 UTC (8 years, 1 month ago) by des
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +27 -27 lines
Mechanical whitespace cleanup.

Revision 1.160: download - view: text, markup, annotated - select for diffs
Sun Jan 11 19:42:22 2004 UTC (8 years, 1 month ago) by des
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +3 -1 lines
Mechanical whitespace cleanup + minor style nits.

Revision 1.159: download - view: text, markup, annotated - select for diffs
Sun Dec 28 01:19:58 2003 UTC (8 years, 1 month ago) by silby
Branches: MAIN
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +1 -1 lines
Fix the maxpipekva warning message so that it points to the correct
sysctl, and shorten the message.

Noticed by:	bde

Revision 1.158: download - view: text, markup, annotated - select for diffs
Sun Nov 9 09:17:24 2003 UTC (8 years, 3 months ago) by tanimura
Branches: MAIN
CVS tags: RELENG_5_2_BP, RELENG_5_2_1_RELEASE, RELENG_5_2_0_RELEASE, RELENG_5_2
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +1 -1 lines
- Implement selwakeuppri() which allows raising the priority of a
  thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current

Revision 1.157: download - view: text, markup, annotated - select for diffs
Thu Nov 6 05:58:26 2003 UTC (8 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +1 -5 lines
 - Delay the allocation of memory for the pipe mutex until we need it.
   This avoids the need to free said memory in various error cases along
   the way.

Revision 1.156: download - view: text, markup, annotated - select for diffs
Thu Nov 6 05:08:12 2003 UTC (8 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +2 -10 lines
 - Simplify pipespace() by eliminating the explicit creation of vm objects.
   Instead, let the vm objects be lazily instantiated at fault time.  This
   results in the allocation of fewer vm objects and vm map entries due to
   aggregation in the vm system.

Revision 1.155: download - view: text, markup, annotated - select for diffs
Mon Nov 3 17:58:23 2003 UTC (8 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +3 -1 lines
Unlock pipe mutex when failing MAC pipe ioctl access control check.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories

Revision 1.154: download - view: text, markup, annotated - select for diffs
Tue Oct 21 18:28:34 2003 UTC (8 years, 3 months ago) by silby
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +1 -1 lines
Change all SYSCTLS which are readonly and have a related TUNABLE
from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide
more useful error messages.

Revision 1.153: download - view: text, markup, annotated - select for diffs
Sun Oct 19 20:41:07 2003 UTC (8 years, 3 months ago) by dwmalone
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +3 -1 lines
falloc allocates a file structure and adds it to the file descriptor
table, acquiring the necessary locks as it works. It usually returns
two references to the new descriptor: one in the descriptor table
and one via a pointer argument.

As falloc releases the FILEDESC lock before returning, there is a
potential for a process to close the reference in the file descriptor
table before falloc's caller gets to use the file. I don't think this
can happen in practice at the moment, because Giant indirectly protects
closes.

To stop the file being completly closed in this situation, this change
makes falloc set the refcount to two when both references are returned.
This makes life easier for several of falloc's callers, because the
first thing they previously did was grab an extra reference on the
file.

Reviewed by:	iedowse
Idea run past:	jhb

Revision 1.60.2.18: download - view: text, markup, annotated - select for diffs
Tue Oct 14 05:01:04 2003 UTC (8 years, 3 months ago) by jmg
Branches: RELENG_4
CVS tags: RELENG_4_9_BP, RELENG_4_9_0_RELEASE, RELENG_4_9, RELENG_4_11_BP, RELENG_4_11_0_RELEASE, RELENG_4_11, RELENG_4_10_BP, RELENG_4_10_0_RELEASE, RELENG_4_10
Diff to: previous 1.60.2.17: preferred, colored; branchpoint 1.60: preferred, colored; next MAIN 1.61: preferred, colored
Changes since revision 1.60.2.17: +7 -2 lines
MFC: v1.152

Fix problem with EVFILT_WRITE filters on pipes

Approved by:	re@
Obtained from:	nCircle

Revision 1.152: download - view: text, markup, annotated - select for diffs
Sun Oct 12 07:06:02 2003 UTC (8 years, 4 months ago) by jmg
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +7 -2 lines
fix a problem referencing free'd memory.  This is only a problem for
kqueue write events on a socket and you regularly create tons of pipes
which overwrites the structure causing a panic when removing the knote
from the list.  If the peer has gone away (and it's a write knote), then
don't bother trying to remove the knote from the list.

Submitted by:	Brian Buchanan and myself
Obtained from:	nCircle

Revision 1.151: download - view: text, markup, annotated - select for diffs
Fri Sep 12 07:13:15 2003 UTC (8 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +2 -1 lines
pipe_build_write_buffer() only requires read access of the page that it
obtains from pmap_extract_and_hold().

Revision 1.150: download - view: text, markup, annotated - select for diffs
Mon Sep 8 04:58:32 2003 UTC (8 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +11 -35 lines
Use pmap_extract_and_hold() in pipe_build_write_buffer().  Consequently,
pipe_build_write_buffer() no longer requires Giant on entry.

Reviewed by:	tegge

Revision 1.149: download - view: text, markup, annotated - select for diffs
Sat Sep 6 21:02:10 2003 UTC (8 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +7 -9 lines
Giant is no longer required by pipe_destroy_write_buffer().  Reduce
unnecessary white space from pipe_destroy_write_buffer().

Revision 1.60.2.17: download - view: text, markup, annotated - select for diffs
Sat Aug 23 19:51:11 2003 UTC (8 years, 5 months ago) by tegge
Branches: RELENG_4
Diff to: previous 1.60.2.16: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.16: +3 -3 lines
MFC: Use vm_page_hold() instead of vm_page_wire().

PR:		44950

Revision 1.60.2.16: download - view: text, markup, annotated - select for diffs
Mon Aug 18 07:10:22 2003 UTC (8 years, 5 months ago) by jmg
Branches: RELENG_4
Diff to: previous 1.60.2.15: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.15: +1 -1 lines
MFC src/sys/kern/sys_pipe.c:1.147

  if we got this far, we definately don't have an EBADF.  Return a more
  sane result of EPIPE.

  Reported by:    nCircle dev team
  MFC after:      3 day

Revision 1.148: download - view: text, markup, annotated - select for diffs
Fri Aug 15 04:31:01 2003 UTC (8 years, 5 months ago) by jmg
Branches: MAIN
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +1 -1 lines
if we got this far, we definately don't have an EBADF.  Return a more
sane result of EPIPE.

Reported by:	nCircle dev team
MFC after:	3 day

Revision 1.147: download - view: text, markup, annotated - select for diffs
Wed Aug 13 20:01:38 2003 UTC (8 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +2 -5 lines
 - The vm_object pointer in pipe_buffer is unused.  Remove it.
 - Check for successful initialization of pipe_zone in pipeinit()
   rather than every call to pipe(2).

Revision 1.146: download - view: text, markup, annotated - select for diffs
Mon Aug 11 22:23:25 2003 UTC (8 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +2 -2 lines
Pipespace() no longer requires Giant.

Revision 1.145: download - view: text, markup, annotated - select for diffs
Mon Aug 11 05:51:51 2003 UTC (8 years, 6 months ago) by silby
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +26 -38 lines
More pipe changes:

From alc:
Move pageable pipe memory to a seperate kernel submap to avoid awkward
vm map interlocking issues.  (Bad explanation provided by me.)

From me:
Rework pipespace accounting code to handle this new layout, and adjust
our default values to account for the fact that we now have a solid
limit on allocations.

Also, remove the "maxpipes" limit, as it no longer has a purpose.
(The limit on kva usage solves the problem of having two many pipes.)

Revision 1.144: download - view: text, markup, annotated - select for diffs
Mon Aug 11 00:17:44 2003 UTC (8 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +3 -3 lines
Use vm_page_hold() instead of vm_page_wire().  Otherwise, a multithreaded
application could cause a wired page to be freed.  In general,
vm_page_hold() should be preferred for ephemeral kernel mappings of pages
borrowed from a user-level address space.  (vm_page_wire() should really be
reserved for indefinite duration pinning by the "owner" of the page.)

Discussed with:	silby
Submitted by:	tegge

Revision 1.60.2.15: download - view: text, markup, annotated - select for diffs
Sat Aug 9 16:21:19 2003 UTC (8 years, 6 months ago) by luoqi
Branches: RELENG_4
Diff to: previous 1.60.2.14: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.14: +2 -1 lines
MFC: PAE support, based on Jake Burkholder's work in current. Jake's
work was sponsored by DARPA, Network Associates Laboratories.

Major changes include:
- introduction of vm_paddr_t to represent physical address
- support for page directory pointer table
- removal of (recursive) alternative address space

Reviewed by:	jake

Revision 1.143: download - view: text, markup, annotated - select for diffs
Fri Aug 8 22:38:15 2003 UTC (8 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +0 -4 lines
 - Remove GIANT_REQUIRED from pipespace().
 - Remove a duplicate initialization from pipe_create().

Revision 1.142: download - view: text, markup, annotated - select for diffs
Thu Aug 7 04:32:40 2003 UTC (8 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +0 -3 lines
 - Remove GIANT_REQUIRED from pipe_free_kmem().
 - Remove the acquisition and release of Giant around pipe_kmem_free() and
   uma_zfree() in pipeclose().

Revision 1.60.2.14: download - view: text, markup, annotated - select for diffs
Sun Aug 3 13:04:57 2003 UTC (8 years, 6 months ago) by pb
Branches: RELENG_4
Diff to: previous 1.60.2.13: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.13: +1 -1 lines
MFC rev 1.141: remove test in pipe_write() which causes write(2)
to return EAGAIN on a non-blocking pipe in cases where select(2)
returns the file descriptor as ready for write. This in turns causes
libc_r, for one, to busy wait in such cases.

Revision 1.141: download - view: text, markup, annotated - select for diffs
Wed Jul 30 22:50:37 2003 UTC (8 years, 6 months ago) by pb
Branches: MAIN
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +1 -1 lines
Remove test in pipe_write() which causes write(2) to return EAGAIN
on a non-blocking pipe in cases where select(2) returns the file
descriptor as ready for write. This in turns causes libc_r, for
one, to busy wait in such cases.

Note: it is a quick performance fix, a more complex fix might be
required in case this turns out to have unexpected side effects.

Reviewed by:	silby
MFC after:	3 days

Revision 1.140: download - view: text, markup, annotated - select for diffs
Wed Jul 30 18:55:04 2003 UTC (8 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +1 -1 lines
The introduction of vm object locking has caused witness to reveal
a long-standing mistake in the way a portion of a pipe's KVA is
allocated.  Specifically, kmem_alloc_pageable() is inappropriate
for use in the "direct" case because it allows a preceding vm map entry
and vm object to be extended to support the new KVA allocation.
However, the direct case KVA allocation should not have a backing
vm object.  This is corrected by using kmem_alloc_nofault().

Submitted by:	tegge (with the above explanation by me)

Revision 1.139: download - view: text, markup, annotated - select for diffs
Wed Jul 9 21:59:48 2003 UTC (8 years, 7 months ago) by silby
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +7 -6 lines
A few minor changes:

- Use atomic ops to update the bigpipe count
- Make the bigpipe count sysctl readable
- Remove a duplicate comparison in an if statement
- Comment two SYSCTLs.

Revision 1.138: download - view: text, markup, annotated - select for diffs
Tue Jul 8 04:02:31 2003 UTC (8 years, 7 months ago) by silby
Branches: MAIN
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +68 -17 lines
Put some concrete limits on pipe memory consumption:

- Limit the total number of pipes so that we do not
  exhaust all vm objects in the kernel map.  When
  this limit is reached, a ratelimited message will
  be printed to the console.

- Put a soft limit on the amount of memory consumable
  by pipes.  Once the limit has been reached, all new
  pipes will be limited to 4K in size, rather than the
  default of 16K.

- Put a limit on the number of pages that may be used
  for high speed page flipping in order to reduce the
  amount of wired memory.  Pipe writes that occur
  while this limit is exceeded will fall back to
  non-page flipping mode.

The above values are auto-tuned in subr_param.c and
are scaled to take into account both the size of
physical memory and the size of the kernel map.

These limits help to reduce the "kernel resources exhausted"
panics that could be caused by opening a large
number of pipes.  (Pipes alone are no longer able
to exhaust all resources, but other kernel memory hogs
in league with pipes may still be able to do so.)

PR:			53627
Ideas / comments from:	hsu, tjr, dillon@apollo.backplane.com
MFC after:		1 week

Revision 1.137: download - view: text, markup, annotated - select for diffs
Wed Jun 18 18:16:39 2003 UTC (8 years, 7 months ago) by phk
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +8 -2 lines
Initialize struct fileops with C99 sparse initialization.

Revision 1.136: download - view: text, markup, annotated - select for diffs
Wed Jun 11 00:56:57 2003 UTC (8 years, 8 months ago) by obrien
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +3 -2 lines
Use __FBSDID().

Revision 1.135: download - view: text, markup, annotated - select for diffs
Mon Jun 9 21:57:48 2003 UTC (8 years, 8 months ago) by mux
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +20 -12 lines
style(9).

Revision 1.134: download - view: text, markup, annotated - select for diffs
Wed Apr 2 15:24:50 2003 UTC (8 years, 10 months ago) by hsu
Branches: MAIN
CVS tags: RELENG_5_1_BP, RELENG_5_1_0_RELEASE, RELENG_5_1
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +1 -1 lines
Need to hold the same SMP lock for (knote) list traversal as for
list manipulation.  This lock also protects read-modify-write operations
on the pipe_state field.

Revision 1.133: download - view: text, markup, annotated - select for diffs
Tue Mar 25 00:07:04 2003 UTC (8 years, 10 months ago) by jake
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +2 -1 lines
- Add vm_paddr_t, a physical address type.  This is required for systems
  where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)

Revision 1.132: download - view: text, markup, annotated - select for diffs
Wed Feb 19 05:47:25 2003 UTC (8 years, 11 months ago) by imp
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +2 -2 lines
Back out M_* changes, per decision of the TRB.

Approved by: trb

Revision 1.131: download - view: text, markup, annotated - select for diffs
Sat Feb 15 06:04:54 2003 UTC (8 years, 11 months ago) by alfred
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +1 -1 lines
Do not allow kqueues to be passed via unix domain sockets.

Revision 1.130: download - view: text, markup, annotated - select for diffs
Thu Feb 13 19:39:54 2003 UTC (8 years, 11 months ago) by alc
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +8 -5 lines
Use atomic ops to update amountpipekva.  Amountpipekva represents the
total kernel virtual address space used by all pipes.  It is, thus, outside
the scope of any individual pipe lock.

Revision 1.129: download - view: text, markup, annotated - select for diffs
Tue Jan 21 08:55:54 2003 UTC (9 years ago) by alfred
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +2 -2 lines
Remove M_TRYWAIT/M_WAITOK/M_WAIT.  Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.

Revision 1.128: download - view: text, markup, annotated - select for diffs
Mon Jan 13 00:28:55 2003 UTC (9 years ago) by dillon
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +12 -12 lines
Bow to the whining masses and change a union back into void *.  Retain
removal of unnecessary casts and throw in some minor cleanups to see if
anyone complains, just for the hell of it.

Revision 1.127: download - view: text, markup, annotated - select for diffs
Sun Jan 12 01:37:08 2003 UTC (9 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +12 -12 lines
Change struct file f_data to un_data, a union of the correct struct
pointer types, and remove a huge number of casts from code using it.

Change struct xfile xf_data to xun_data (ABI is still compatible).

If we need to add a #define for f_data and xf_data we can, but I don't
think it will be necessary.  There are no operational changes in this
commit.

Revision 1.126: download - view: text, markup, annotated - select for diffs
Tue Dec 24 09:44:51 2002 UTC (9 years, 1 month ago) by phk
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +7 -7 lines
White-space changes.

Revision 1.125: download - view: text, markup, annotated - select for diffs
Mon Dec 23 21:53:20 2002 UTC (9 years, 1 month ago) by phk
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +7 -12 lines
Detediousficate declaration of fileops array members by introducing
typedefs for them.

Revision 1.124: download - view: text, markup, annotated - select for diffs
Mon Oct 14 21:15:04 2002 UTC (9 years, 3 months ago) by alfred
Branches: MAIN
CVS tags: RELENG_5_0_BP, RELENG_5_0_0_RELEASE, RELENG_5_0
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +0 -2 lines
Remove a KASSERT I added in 1.73 to catch uninitialized pipes.

It must be removed because it is done without the pipe being locked
via pipelock() and therefore is vulnerable to races with pipespace()
erroneously triggering it by temporarily zero'ing out the structure
backing the pipe.

It looks as if this assertion is not needed because all manipulation
of the data changed by pipespace() _is_ protected by pipelock().

Reported by: kris, mckusick

Revision 1.123: download - view: text, markup, annotated - select for diffs
Sat Oct 12 22:26:41 2002 UTC (9 years, 3 months ago) by alfred
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +2 -2 lines
whitespace fixes.

Revision 1.122: download - view: text, markup, annotated - select for diffs
Fri Oct 11 14:58:30 2002 UTC (9 years, 4 months ago) by mike
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +1 -1 lines
Change iov_base's type from `char *' to the standard `void *'.  All
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 *'.

Revision 1.121: download - view: text, markup, annotated - select for diffs
Thu Oct 3 02:12:58 2002 UTC (9 years, 4 months ago) by truckman
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +2 -2 lines
In an SMP environment post-Giant it is no longer safe to blindly
dereference the struct sigio pointer without any locking.  Change
fgetown() to take a reference to the pointer instead of a copy of the
pointer and call SIGIO_LOCK() before copying the pointer and
dereferencing it.

Reviewed by:	rwatson

Revision 1.120: download - view: text, markup, annotated - select for diffs
Tue Oct 1 04:30:19 2002 UTC (9 years, 4 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +12 -4 lines
Improve locking of pipe mutexes in the context of MAC:

(1) Where previously the pipe mutex was selectively grabbed during
    pipe_ioctl(), now always grab it and then release if if not
    needed.  This protects the call to mac_check_pipe_ioctl() to
    make sure the label remains consistent.  (Note: it looks
    like sigio locking may be incorrect for fgetown() since we
    call it not-by-reference and sigio locking assumes call by
    reference).

(2) In pipe_stat(), lock the pipe if MAC is compiled in so that
    the call to mac_check_pipe_stat() gets a locked pipe to
    protect label consistency.  We still release the lock before
    returning actual stat() data, risking inconsistency, but
    apparently our pipe locking model accepts that risk.

(3) In various pipe MAC authorization checks, assert that the pipe
    lock is held.

(4) Grab the lock when performing a pipe relabel operation, and
    assert it a little deeper in the stack.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories

Revision 1.119: download - view: text, markup, annotated - select for diffs
Sat Sep 28 17:14:55 2002 UTC (9 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +2 -2 lines
Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by:    FlexeLint warning #512

Revision 1.118: download - view: text, markup, annotated - select for diffs
Wed Aug 21 23:39:52 2002 UTC (9 years, 5 months ago) by archie
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +2 -2 lines
Don't use "NULL" when "0" is really meant.

Revision 1.117: download - view: text, markup, annotated - select for diffs
Mon Aug 19 16:59:36 2002 UTC (9 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +4 -4 lines
Break out mac_check_pipe_op() into component check entry points:
mac_check_pipe_poll(), mac_check_pipe_read(), mac_check_pipe_stat(),
and mac_check_pipe_write().  This is improves consistency with other
access control entry points and permits security modules to only
control the object methods that they are interested in, avoiding
switch statements.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs

Revision 1.116: download - view: text, markup, annotated - select for diffs
Sat Aug 17 02:36:16 2002 UTC (9 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +4 -3 lines
In continuation of early fileop credential changes, modify fo_ioctl() to
accept an 'active_cred' argument reflecting the credential of the thread
initiating the ioctl operation.

- Change fo_ioctl() to accept active_cred; change consumers of the
  fo_ioctl() interface to generally pass active_cred from td->td_ucred.
- In fifofs, initialize filetmp.f_cred to ap->a_cred so that the
  invocations of soo_ioctl() are provided access to the calling f_cred.
  Pass ap->a_td->td_ucred as the active_cred, but note that this is
  required because we don't yet distinguish file_cred and active_cred
  in invoking VOP's.
- Update kqueue_ioctl() for its new argument.
- Update pipe_ioctl() for its new argument, pass active_cred rather
  than td_ucred to MAC for authorization.
- Update soo_ioctl() for its new argument.
- Update vn_ioctl() for its new argument, use active_cred rather than
  td->td_ucred to authorize VOP_IOCTL() and the associated VOP_GETATTR().

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs

Revision 1.115: download - view: text, markup, annotated - select for diffs
Fri Aug 16 14:12:40 2002 UTC (9 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +1 -1 lines
Correct white space nits that crept in during my recent merges of
trustedbsd_mac material.

Revision 1.114: download - view: text, markup, annotated - select for diffs
Fri Aug 16 12:51:57 2002 UTC (9 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +10 -8 lines
Make similar changes to fo_stat() and fo_poll() as made earlier to
fo_read() and fo_write(): explicitly use the cred argument to fo_poll()
as "active_cred" using the passed file descriptor's f_cred reference
to provide access to the file credential.  Add an active_cred
argument to fo_stat() so that implementers have access to the active
credential as well as the file credential.  Generally modify callers
of fo_stat() to pass in td->td_ucred rather than fp->f_cred, which
was redundantly provided via the fp argument.  This set of modifications
also permits threads to perform these operations on behalf of another
thread without modifying their credential.

Trickle this change down into fo_stat/poll() implementations:

- badfo_poll(), badfo_stat(): modify/add arguments.
- kqueue_poll(), kqueue_stat(): modify arguments.
- pipe_poll(), pipe_stat(): modify/add arguments, pass active_cred to
  MAC checks rather than td->td_ucred.
- soo_poll(), soo_stat(): modify/add arguments, pass fp->f_cred rather
  than cred to pru_sopoll() to maintain current semantics.
- sopoll(): moidfy arguments.
- vn_poll(), vn_statfile(): modify/add arguments, pass new arguments
  to vn_stat().  Pass active_cred to MAC and fp->f_cred to VOP_POLL()
  to maintian current semantics.
- vn_close(): rename cred to file_cred to reflect reality while I'm here.
- vn_stat(): Add active_cred and file_cred arguments to vn_stat()
  and consumers so that this distinction is maintained at the VFS
  as well as 'struct file' layer.  Pass active_cred instead of
  td->td_ucred to MAC and to VOP_GETATTR() to maintain current semantics.

- fifofs: modify the creation of a "filetemp" so that the file
  credential is properly initialized and can be used in the socket
  code if desired.  Pass ap->a_td->td_ucred as the active
  credential to soo_poll().  If we teach the vnop interface about
  the distinction between file and active credentials, we would use
  the active credential here.

Note that current inconsistent passing of active_cred vs. file_cred to
VOP's is maintained.  It's not clear why GETATTR would be authorized
using active_cred while POLL would be authorized using file_cred at
the file system level.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs

Revision 1.113: download - view: text, markup, annotated - select for diffs
Thu Aug 15 20:55:04 2002 UTC (9 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +8 -8 lines
In order to better support flexible and extensible access control,
make a series of modifications to the credential arguments relating
to file read and write operations to cliarfy which credential is
used for what:

- Change fo_read() and fo_write() to accept "active_cred" instead of
  "cred", and change the semantics of consumers of fo_read() and
  fo_write() to pass the active credential of the thread requesting
  an operation rather than the cached file cred.  The cached file
  cred is still available in fo_read() and fo_write() consumers
  via fp->f_cred.  These changes largely in sys_generic.c.

For each implementation of fo_read() and fo_write(), update cred
usage to reflect this change and maintain current semantics:

- badfo_readwrite() unchanged
- kqueue_read/write() unchanged
  pipe_read/write() now authorize MAC using active_cred rather
  than td->td_ucred
- soo_read/write() unchanged
- vn_read/write() now authorize MAC using active_cred but
  VOP_READ/WRITE() with fp->f_cred

Modify vn_rdwr() to accept two credential arguments instead of a
single credential: active_cred and file_cred.  Use active_cred
for MAC authorization, and select a credential for use in
VOP_READ/WRITE() based on whether file_cred is NULL or not.  If
file_cred is provided, authorize the VOP using that cred,
otherwise the active credential, matching current semantics.

Modify current vn_rdwr() consumers to pass a file_cred if used
in the context of a struct file, and to always pass active_cred.
When vn_rdwr() is used without a file_cred, pass NOCRED.

These changes should maintain current semantics for read/write,
but avoid a redundant passing of fp->f_cred, as well as making
it more clear what the origin of each credential is in file
descriptor read/write operations.

Follow-up commits will make similar changes to other file descriptor
operations, and modify the MAC framework to pass both credentials
to MAC policy modules so they can implement either semantic for
revocation.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs

Revision 1.112: download - view: text, markup, annotated - select for diffs
Tue Aug 13 02:47:13 2002 UTC (9 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +60 -0 lines
Introduce support for labeling and access control of pipe objects
as part of the TrustedBSD MAC framework.  Instrument the creation
and destruction of pipes, as well as relevant operations, with
necessary calls to the MAC framework.  Note that the locking
here is probably not quite right yet, but fixes will be forthcoming.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs

Revision 1.60.2.12.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 5 15:13:48 2002 UTC (9 years, 6 months ago) by des
Branches: RELENG_4_6
CVS tags: RELENG_4_6_2_RELEASE
Diff to: previous 1.60.2.12: preferred, colored; next MAIN 1.60.2.13: preferred, colored
Changes since revision 1.60.2.12: +3 -0 lines
MFS: check far end of pipe.

Revision 1.60.2.11.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 5 15:13:44 2002 UTC (9 years, 6 months ago) by des
Branches: RELENG_4_5
Diff to: previous 1.60.2.11: preferred, colored; next MAIN 1.60.2.12: preferred, colored
Changes since revision 1.60.2.11: +3 -0 lines
MFS: check far end of pipe.

Revision 1.60.2.10.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 5 15:13:40 2002 UTC (9 years, 6 months ago) by des
Branches: RELENG_4_4
Diff to: previous 1.60.2.10: preferred, colored; next MAIN 1.60.2.11: preferred, colored
Changes since revision 1.60.2.10: +4 -1 lines
MFS: check far end of pipe.

Revision 1.60.2.13: download - view: text, markup, annotated - select for diffs
Mon Aug 5 15:05:15 2002 UTC (9 years, 6 months ago) by des
Branches: RELENG_4
CVS tags: RELENG_4_8_BP, RELENG_4_8_0_RELEASE, RELENG_4_8, RELENG_4_7_BP, RELENG_4_7_0_RELEASE, RELENG_4_7
Diff to: previous 1.60.2.12: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.12: +3 -0 lines
MFC: check far end of pipe.

Revision 1.111: download - view: text, markup, annotated - select for diffs
Mon Aug 5 15:03:03 2002 UTC (9 years, 6 months ago) by des
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +3 -0 lines
Check the far end before registering an EVFILT_WRITE filter on a pipe.

Revision 1.110: download - view: text, markup, annotated - select for diffs
Mon Jul 22 19:05:44 2002 UTC (9 years, 6 months ago) by alfred
Branches: MAIN
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +5 -5 lines
Remove unneeded caddr_t casts.

Revision 1.109: download - view: text, markup, annotated - select for diffs
Sat Jul 13 04:09:45 2002 UTC (9 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +11 -0 lines
 o Lock accesses to the page queues.
 o Add a comment explaining why hoisting the page queue lock outside
   of a particular loop is not possible.

Revision 1.108: download - view: text, markup, annotated - select for diffs
Sat Jun 29 01:50:25 2002 UTC (9 years, 7 months ago) by alfred
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +3 -2 lines
More caddr_t removal, make fo_ioctl take a void * instead of a caddr_t.

Revision 1.107: download - view: text, markup, annotated - select for diffs
Fri Jun 28 22:35:12 2002 UTC (9 years, 7 months ago) by alfred
Branches: MAIN
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +4 -0 lines
document that the pipe fo_stat routine doesn't need locks because it's
a read operation.

Requested by: rwatson

Revision 1.106: download - view: text, markup, annotated - select for diffs
Mon May 6 19:31:28 2002 UTC (9 years, 9 months ago) by alfred
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +1 -1 lines
Make funsetown() take a 'struct sigio **' so that the locking can
be done internally.

Ensure that no one can fsetown() to a dying process/pgrp.  We need
to check the process for P_WEXIT to see if it's exiting.  Process
groups are already safe because there is no such thing as a pgrp
zombie, therefore the proctree lock completely protects the pgrp
from having sigio structures associated with it after it runs
funsetownlst.

Add sigio lock to witness list under proctree and allproc, but over
proc and pgrp.

Seigo Tanimura helped with this.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Wed May 1 20:44:44 2002 UTC (9 years, 9 months ago) by alfred
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +1 -1 lines
Redo the sigio locking.

Turn the sigio sx into a mutex.

Sigio lock is really only needed to protect interrupts from dereferencing
the sigio pointer in an object when the sigio itself is being destroyed.

In order to do this in the most unintrusive manner change pgsigio's
sigio * argument into a **, that way we can lock internally to the
function.

Revision 1.60.2.12: download - view: text, markup, annotated - select for diffs
Tue Apr 16 02:08:13 2002 UTC (9 years, 9 months ago) by tanimura
Branches: RELENG_4
CVS tags: RELENG_4_6_BP, RELENG_4_6_1_RELEASE, RELENG_4_6_0_RELEASE
Branch point for: RELENG_4_6
Diff to: previous 1.60.2.11: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.11: +1 -0 lines
MFC rev 1.94: track the number of wired pages.

Tested by:	Jung-uk Kim <jkim@niksun.com>

Revision 1.104: download - view: text, markup, annotated - select for diffs
Sat Apr 13 20:09:06 2002 UTC (9 years, 9 months ago) by tmm
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +2 -1 lines
Use pmap_extract() instead of pmap_kextract() to retrieve the physical
address associated with a user virtual address in
pipe_build_write_buffer().

Reviewed by:	alc

Revision 1.103: download - view: text, markup, annotated - select for diffs
Sat Apr 13 00:03:07 2002 UTC (9 years, 10 months ago) by tmm
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +6 -17 lines
Back out the last revision - it does not work correctly when one of
the pages in question is not in the top-level vm object, but in
one of the shadow ones.

Pointed out by: alc
Pointy hat to:	tmm

Revision 1.102: download - view: text, markup, annotated - select for diffs
Fri Apr 12 19:38:41 2002 UTC (9 years, 10 months ago) by tmm
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +17 -6 lines
Do not use pmap_kextract() to find out the physical address of a user
belong to a user virtual address; while this happens to work on some
architectures, it can't on sparc64, since user and kernel virtual
address spaces overlap there (the distinction between them is done via
separate address space identifiers).

Instead, look up the page in the vm_map of the process in question.

Reviewed by:	jake

Revision 1.101: download - view: text, markup, annotated - select for diffs
Thu Apr 4 21:03:26 2002 UTC (9 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +1 -1 lines
Change callers of mtx_init() to pass in an appropriate lock type name.  In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64

Revision 1.100: download - view: text, markup, annotated - select for diffs
Wed Mar 27 21:47:50 2002 UTC (9 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +1 -1 lines
Allow resursion on the pipe mutex because filt_piperead() and filt_pipewrite()
can be called both with and without the pipe mutex held.  (For example,
if called by pipeselwakeup(), it is held.  Whereas, if called by kqueue_scan(),
it is not.)

Reviewed by:	alfred

Revision 1.99: download - view: text, markup, annotated - select for diffs
Fri Mar 22 16:09:22 2002 UTC (9 years, 10 months ago) by alfred
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +2 -2 lines
When "cloning" a pipe's buffer bcopy the data after dropping the pipe's
lock as the data may be paged out and cause a fault.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Wed Mar 20 04:09:58 2002 UTC (9 years, 10 months ago) by jeff
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +4 -4 lines
Remove references to vm_zone.h and switch over to the new uma API.

Also, remove maxsockets.  If you look carefully you'll notice that the old
zone allocator never honored this anyway.

Revision 1.97: download - view: text, markup, annotated - select for diffs
Tue Mar 19 09:11:47 2002 UTC (9 years, 10 months ago) by jeff
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +2 -2 lines
This is the first part of the new kernel memory allocator.  This replaces
malloc(9) and vm_zone with a slab like allocator.

Reviewed by:	arch@

Revision 1.96: download - view: text, markup, annotated - select for diffs
Fri Mar 15 07:18:09 2002 UTC (9 years, 10 months ago) by alfred
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +10 -5 lines
Bug fixes:

Missed a place where the pipe sleep lock was needed in order to safely grab
Giant, fix it and add an assertion to make sure this doesn't happen again.

Fix typos in the PIPE_GET_GIANT/PIPE_DROP_GIANT that could cause the
wrong mutex to get passed to PIPE_LOCK/PIPE_UNLOCK.

Fix a location where the wrong pipe was being passed to
PIPE_GET_GIANT/PIPE_DROP_GIANT.

Revision 1.95: download - view: text, markup, annotated - select for diffs
Sat Mar 9 22:06:31 2002 UTC (9 years, 11 months ago) by alfred
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +51 -30 lines
Don't deref NULL mutex pointer when pipeclose()'ing a pipe that is not
fully instaniated.

Revert the logic in pipeclose so that we don't have the entire function
pretty much under a single if() statement, instead invert the test and
just return if it fails.

Submitted (in different form) by: bde

Don't use pool mutexes for pipes.  We can not use pool mutexes
because we will need to grab the select lock while holding a pipe
lock which is not allowed because you may not aquire additional
mutexes when holding a pool mutex.

Instead malloc(9) space for the mutex that is shared between the
pipes.

Revision 1.94: download - view: text, markup, annotated - select for diffs
Tue Mar 5 00:51:03 2002 UTC (9 years, 11 months ago) by tanimura
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +1 -0 lines
Track the number of wired pages to avoid unwiring unwired pages.

Reviewed by:	alfred

Revision 1.93: download - view: text, markup, annotated - select for diffs
Wed Feb 27 18:51:53 2002 UTC (9 years, 11 months ago) by alfred
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +22 -22 lines
kill __P.

Revision 1.92: download - view: text, markup, annotated - select for diffs
Wed Feb 27 18:49:58 2002 UTC (9 years, 11 months ago) by alfred
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +12 -0 lines
add assertions in the places where giant is required to catch when
the pipe is locked and shouldn't be.

initialize pipe->pipe_mtxp to NULL when creating pipes in order not
to trip the above assertions.

swap pipe lock with giant around calls to pipe_destroy_write_buffer()

pipe_destroy_write_buffer issue noticed by: jhb

Revision 1.91: download - view: text, markup, annotated - select for diffs
Wed Feb 27 17:23:16 2002 UTC (9 years, 11 months ago) by alfred
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +12 -12 lines
Fix a NULL deref panic in pipe_write, we can't blindly lock
pipe->pipe_peer->pipe_mtxp because it may be NULL, so lock the
passed in pipe's mutex instead.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Wed Feb 27 11:27:48 2002 UTC (9 years, 11 months ago) by alfred
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +23 -4 lines
MPsafe fixes:

use SYSINIT to initialize pipe_zone.
use PIPE_LOCK to protect kevent ops.

Revision 1.89: download - view: text, markup, annotated - select for diffs
Wed Feb 27 07:35:59 2002 UTC (9 years, 11 months ago) by alfred
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +68 -22 lines
First rev at making pipe(2) pipe's MPsafe.

Both ends of the pipe share a pool_mutex, this makes allocation
and deadlock avoidance easy.

Remove some un-needed FILE_LOCK ops while I'm here.

There are some issues wrt to select and the f{s,g}etown code that
we'll have to deal with, I think we may also need to move the calls
to vfs_timestamp outside of the sections covered by PIPE_LOCK.

Revision 1.88: download - view: text, markup, annotated - select for diffs
Sun Jan 13 11:57:59 2002 UTC (10 years ago) by alfred
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +20 -4 lines
SMP Lock struct file, filedesc and the global file list.

Seigo Tanimura (tanimura) posted the initial delta.

I've polished it quite a bit reducing the need for locking and
adapting it for KSE.

Locks:

1 mutex in each filedesc
   protects all the fields.
   protects "struct file" initialization, while a struct file
     is being changed from &badfileops -> &pipeops or something
     the filedesc should be locked.

1 mutex in each struct file
   protects the refcount fields.
   doesn't protect anything else.
   the flags used for garbage collection have been moved to
     f_gcflag which was the FILLER short, this doesn't need
     locking because the garbage collection is a single threaded
     container.
  could likely be made to use a pool mutex.

1 sx lock for the global filelist.

struct file *	fhold(struct file *fp);
        /* increments reference count on a file */

struct file *	fhold_locked(struct file *fp);
        /* like fhold but expects file to locked */

struct file *	ffind_hold(struct thread *, int fd);
        /* finds the struct file in thread, adds one reference and
                returns it unlocked */

struct file *	ffind_lock(struct thread *, int fd);
        /* ffind_hold, but returns file locked */

I still have to smp-safe the fget cruft, I'll get to that asap.

Revision 1.60.2.11: download - view: text, markup, annotated - select for diffs
Wed Dec 5 16:19:48 2001 UTC (10 years, 2 months ago) by sobomax
Branches: RELENG_4
CVS tags: RELENG_4_5_BP, RELENG_4_5_0_RELEASE
Branch point for: RELENG_4_5
Diff to: previous 1.60.2.10: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.10: +2 -1 lines
MFC: Make kevents on pipes work as described in the manpage - when the last
     reader/writer disconnects, ensure that anybody who is waiting for the
     kevent on the other end of the pipe gets EV_EOF.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Mon Nov 19 09:25:30 2001 UTC (10 years, 2 months ago) by sobomax
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +2 -1 lines
Make kevents on pipes work as described in the manpage - when the last
reader/writer disconnects, ensure that anybody who is waiting for the
kevent on the other end of the pipe gets EV_EOF.

MFC after:	2 weeks

Revision 1.86: download - view: text, markup, annotated - select for diffs
Fri Sep 21 22:46:53 2001 UTC (10 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +3 -3 lines
Use the passed in thread to selrecord() instead of curthread.

Revision 1.85: download - view: text, markup, annotated - select for diffs
Wed Sep 12 08:37:46 2001 UTC (10 years, 5 months ago) by julian
Branches: MAIN
CVS tags: KSE_MILESTONE_2
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +33 -33 lines
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha

Revision 1.84: download - view: text, markup, annotated - select for diffs
Wed Jul 4 17:11:03 2001 UTC (10 years, 7 months ago) by dillon
Branches: MAIN
CVS tags: KSE_PRE_MILESTONE_2
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +1 -4 lines
cleanup: GIANT macros, rename DEPRECIATE to DEPRECATE
Move p_giant_optional to proc zero'd section
Remove (old) XXX zfree comment in pipe code

Revision 1.83: download - view: text, markup, annotated - select for diffs
Wed Jul 4 16:20:12 2001 UTC (10 years, 7 months ago) by dillon
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +8 -12 lines
With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage).  Also add various GIANT_ macros to
formalize the removal of Giant, making it easy to test in a more piecemeal
fashion. These macros will allow us to test fine-grained locks to a degree
before removing Giant, and also after, and to remove Giant in a piecemeal
fashion via sysctl's on those subsystems which the authors believe can
operate without Giant.

Revision 1.60.2.10: download - view: text, markup, annotated - select for diffs
Fri Jun 15 20:46:06 2001 UTC (10 years, 7 months ago) by jlemon
Branches: RELENG_4
CVS tags: RELENG_4_4_BP, RELENG_4_4_0_RELEASE
Branch point for: RELENG_4_4
Diff to: previous 1.60.2.9: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.9: +8 -6 lines
MFC: r1.82; bugfix for write filter.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Fri Jun 15 20:45:01 2001 UTC (10 years, 7 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +8 -6 lines
Correctly hook up the write kqfilter to pipes.

Submitted by:  Niels Provos <provos@citi.umich.edu>

Revision 1.60.2.9: download - view: text, markup, annotated - select for diffs
Fri Jun 8 06:30:31 2001 UTC (10 years, 8 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.60.2.8: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.8: +21 -6 lines
MFC 1.81, fix a race condition between close and extending the write buffer

Revision 1.81: download - view: text, markup, annotated - select for diffs
Mon Jun 4 04:04:45 2001 UTC (10 years, 8 months ago) by dillon
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +21 -6 lines
The pipe_write() code was locking the pipe without busying it first in
certain cases, and a close() by another process could potentially rip the
pipe out from under the (blocked) locking operation.

Reported-by: Alexander Viro <viro@math.psu.edu>

Revision 1.60.2.8: download - view: text, markup, annotated - select for diffs
Mon May 28 00:14:29 2001 UTC (10 years, 8 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.60.2.7: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.7: +54 -57 lines
MFC a number of low-memory panic fixes from -current

Submitted by: alfred
Reviewed by: dillon

Revision 1.80: download - view: text, markup, annotated - select for diffs
Thu May 24 18:06:22 2001 UTC (10 years, 8 months ago) by alfred
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +3 -2 lines
whitespace/style

Revision 1.79: download - view: text, markup, annotated - select for diffs
Wed May 23 10:26:36 2001 UTC (10 years, 8 months ago) by alfred
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +2 -2 lines
aquire vm_mutex a little bit earlier to protect a pmap call.

Revision 1.78: download - view: text, markup, annotated - select for diffs
Mon May 21 18:47:17 2001 UTC (10 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +7 -2 lines
- Assert that the vm mutex is held in pipe_free_kmem().
- Don't release the vm mutex early in pipespace() but instead hold it
  across vm_object_deallocate() if vm_map_find() returns an error and
  across pipe_free_kmem() if vm_map_find() succeeds.
- Add a XXX above a zfree() since zalloc already has its own locking,
  one would hope that zfree() wouldn't need the vm lock.

Revision 1.77: download - view: text, markup, annotated - select for diffs
Sat May 19 01:28:02 2001 UTC (10 years, 8 months ago) by alfred
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +11 -2 lines
Introduce a global lock for the vm subsystem (vm_mtx).

vm_mtx does not recurse and is required for most low level
vm operations.

faults can not be taken without holding Giant.

Memory subsystems can now call the base page allocators safely.

Almost all atomic ops were removed as they are covered under the
vm mutex.

Alpha and ia64 now need to catch up to i386's trap handlers.

FFS and NFS have been tested, other filesystems will need minor
changes (grabbing the vm lock when twiddling page properties).

Reviewed (partially) by: jake, jhb

Revision 1.76: download - view: text, markup, annotated - select for diffs
Thu May 17 19:47:09 2001 UTC (10 years, 8 months ago) by alfred
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +51 -55 lines
Cleanup

Remove comment about setting error for reads on EOF, read returns 0 on
EOF so the code should be ok.

Remove non-effective priority boost, PRIO+1 doesn't do anything
(according to McKusick), if a real priority boost is needed it should
have been +4.

Style fixes:
.) return foo -> return (foo)
.) FLAG1|FlAG2 -> FLAG1 | FlAG2
.) wrap long lines
.) unwrap short lines
.) for(i=0;i=foo;i++) -> for (i = 0; i=foo; i++)
.) remove braces for some conditionals with a single statement
.) fix continuation lines.

md5 couldn't verify the binary because some code had to
be shuffled around to address the style issues.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Thu May 17 18:22:58 2001 UTC (10 years, 8 months ago) by alfred
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +2 -1 lines
initialize pipe pointers

Revision 1.74: download - view: text, markup, annotated - select for diffs
Thu May 17 17:59:28 2001 UTC (10 years, 8 months ago) by alfred
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +2 -2 lines
pipe_create has to zero out the select record earlier to avoid
returning a half-initialized pipe and causing pipeclose() to follow
a junk pointer.

Discovered by: "Nick S" <snicko@noid.org>

Revision 1.60.2.7: download - view: text, markup, annotated - select for diffs
Wed May 16 16:34:50 2001 UTC (10 years, 8 months ago) by alfred
Branches: RELENG_4
Diff to: previous 1.60.2.6: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.6: +112 -90 lines
MFC: 1.73 (safer bufferspace allocation)

Revision 1.73: download - view: text, markup, annotated - select for diffs
Tue May 8 09:09:18 2001 UTC (10 years, 9 months ago) by alfred
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +112 -90 lines
Remove an 'optimization' I hope to never see again.

The pipe code could not handle running out of kva, it would panic
if that happened.  Instead return ENFILE to the application which
is an acceptable error return from pipe(2).

There was some slightly tricky things that needed to be worked on,
namely that the pipe code can 'realloc' the size of the buffer if
it detects that the pipe could use a bit more room.  However if it
failed the reallocation it could not cope and would panic.  Fix
this by attempting to grow the pipe while holding onto our old
resources.  If all goes well free the old resources and use the
new ones, otherwise continue to use the smaller buffer already
allocated.

While I'm here add a few blank lines for style(9) and remove
'register'.

Revision 1.72: download - view: text, markup, annotated - select for diffs
Tue May 1 08:12:58 2001 UTC (10 years, 9 months ago) by markm
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +3 -3 lines
Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by:	bde (with reservations)

Revision 1.60.2.6: download - view: text, markup, annotated - select for diffs
Mon Feb 26 04:23:16 2001 UTC (10 years, 11 months ago) by jlemon
Branches: RELENG_4
CVS tags: RELENG_4_3_BP, RELENG_4_3_0_RELEASE, RELENG_4_3
Diff to: previous 1.60.2.5: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.5: +24 -9 lines
MFC: sync kq up to current (extend to device layer, plus other fixes)

Revision 1.71: download - view: text, markup, annotated - select for diffs
Thu Feb 15 16:34:06 2001 UTC (10 years, 11 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +24 -9 lines
Extend kqueue down to the device layer.

Backwards compatible approach suggested by: peter

Revision 1.60.2.5: download - view: text, markup, annotated - select for diffs
Thu Jan 11 20:46:50 2001 UTC (11 years, 1 month ago) by dwmalone
Branches: RELENG_4
Diff to: previous 1.60.2.4: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.4: +23 -15 lines
MFC: 1.68 and 1.70. Don't corrupt pipe_zone if pipe creation fails.

Revision 1.70: download - view: text, markup, annotated - select for diffs
Thu Jan 11 00:13:54 2001 UTC (11 years, 1 month ago) by dwmalone
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +20 -20 lines
Style improvements for last fix. Should be functionally the same.

Submitted by:	bde

Revision 1.69: download - view: text, markup, annotated - select for diffs
Tue Jan 9 04:33:29 2001 UTC (11 years, 1 month ago) by wollman
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +2 -2 lines
select() DKI is now in <sys/selinfo.h>.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Mon Jan 8 22:14:48 2001 UTC (11 years, 1 month ago) by dwmalone
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +9 -1 lines
If we failed to allocate the file discriptor for the write end of
the pipe, then we were corrupting the pipe_zone free list by calling
pipeclose on rpipe twice. NULL out rpipe to avoid this.

Reviewed by:	dillon
Reviewed by:	iedowse

Revision 1.60.2.4: download - view: text, markup, annotated - select for diffs
Sun Nov 26 02:30:04 2000 UTC (11 years, 2 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.60.2.3: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.3: +8 -3 lines
    MFC from current the major file descriptor race fixing patchset.
    This fix file descriptor races in open(), close(), fcntl(),
    read(), write(), and most other system calls that take file descriptors
    as arguments.  The races being fixed are mainly due to the file
    descriptor table sharing that rfork()/threading allows.

Revision 1.67: download - view: text, markup, annotated - select for diffs
Sat Nov 18 21:01:02 2000 UTC (11 years, 2 months ago) by dillon
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +8 -3 lines
    This patchset fixes a large number of file descriptor race conditions.
    Pre-rfork code assumed inherent locking of a process's file descriptor
    array.  However, with the advent of rfork() the file descriptor table
    could be shared between processes.  This patch closes over a dozen
    serious race conditions related to one thread manipulating the table
    (e.g. closing or dup()ing a descriptor) while another is blocked in
    an open(), close(), fcntl(), read(), write(), etc...

PR: kern/11629
Discussed with: Alexander Viro <viro@math.psu.edu>

Revision 1.60.2.3: download - view: text, markup, annotated - select for diffs
Thu Sep 14 20:27:13 2000 UTC (11 years, 4 months ago) by jlemon
Branches: RELENG_4
CVS tags: RELENG_4_2_0_RELEASE, RELENG_4_1_1_RELEASE
Diff to: previous 1.60.2.2: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.2: +2 -2 lines
MFC, r1.66 - bugfix for filt_pipewrite.

Revision 1.66: download - view: text, markup, annotated - select for diffs
Thu Sep 14 20:10:19 2000 UTC (11 years, 4 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +2 -2 lines
Pipes are not writeable while a direct write is in progress.  However,
the kqueue filter got the sense of the test reversed, so fix it.

Spotted by:	Michael Elkins <me@sigpipe.org>

Revision 1.65: download - view: text, markup, annotated - select for diffs
Fri May 26 02:04:36 2000 UTC (11 years, 8 months ago) by jake
Branches: MAIN
CVS tags: PRE_SMPNG
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +2 -2 lines
Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others

Revision 1.64: download - view: text, markup, annotated - select for diffs
Tue May 23 20:37:16 2000 UTC (11 years, 8 months ago) by jake
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +2 -2 lines
Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd

Revision 1.63: download - view: text, markup, annotated - select for diffs
Thu May 11 22:08:20 2000 UTC (11 years, 9 months ago) by chris
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +4 -3 lines
Include UID and GID information for stat() calls using the values filled
into the file descriptor data by falloc().

Reviewed by:	phk

Revision 1.60.2.2: download - view: text, markup, annotated - select for diffs
Fri May 5 03:49:56 2000 UTC (11 years, 9 months ago) by jlemon
Branches: RELENG_4
CVS tags: RELENG_4_1_0_RELEASE
Diff to: previous 1.60.2.1: preferred, colored; branchpoint 1.60: preferred, colored
Changes since revision 1.60.2.1: +68 -1 lines
MFC: kqueue() and kevent()

Revision 1.62: download - view: text, markup, annotated - select for diffs
Sun Apr 16 18:53:11 2000 UTC (11 years, 9 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +68 -1 lines
Introduce kqueue() and kevent(), a kernel event notification facility.

Revision 1.46.2.5: download - view: text, markup, annotated - select for diffs
Fri Mar 24 00:48:57 2000 UTC (11 years, 10 months ago) by dillon
Branches: RELENG_3
CVS tags: RELENG_3_5_0_RELEASE
Diff to: previous 1.46.2.4: preferred, colored; branchpoint 1.46: preferred, colored; next MAIN 1.47: preferred, colored
Changes since revision 1.46.2.4: +8 -3 lines
    MFC 1.61 - fix in-kernel infinite loop in pipe_write() when reader goes
	away at just the wrong moment.

Revision 1.60.2.1: download - view: text, markup, annotated - select for diffs
Fri Mar 24 00:48:13 2000 UTC (11 years, 10 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +16 -4 lines
    MFC 1.61 - fix in-kernel infinite loop in pipe_write() when reader goes
    away at just the wrong moment.

Revision 1.61: download - view: text, markup, annotated - select for diffs
Fri Mar 24 00:47:37 2000 UTC (11 years, 10 months ago) by dillon
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +16 -4 lines
    Fix in-kernel infinite loop in pipe_write() when the reader goes away
    at just the wrong time.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Sun Dec 26 13:04:52 1999 UTC (12 years, 1 month ago) by bde
Branches: MAIN
CVS tags: RELENG_4_BP, RELENG_4_0_0_RELEASE
Branch point for: RELENG_4
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +5 -4 lines
Use vfs_timestamp() instead of getnanotime() to set timestamps.  This
fixee incoherency of pipe timestamps relative to file timestamps in
the usual case where getnanotime() is not used for the latter.  (File
and pipe timestamps are still incoherent relative to real time unless
the vfs_timestamp_precision sysctl is set to 2 or 3).

Revision 1.59: download - view: text, markup, annotated - select for diffs
Mon Dec 13 02:55:47 1999 UTC (12 years, 2 months ago) by tegge
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +65 -24 lines
Fix two problems with pipe_write():

 1. Data written beyond end of pipe buffer, causing kernel memory corruption.

    - Check that space is still valid after obtaining the pipe lock.

    - Defer the calculation of transfer size until the pipe
      lock has been obtained.

    - Update the pipe buffer pointers while holding the pipe lock.

 2. Writes of size <= PIPE_BUF not always atomic.

    - Allow an internal write to span two contiguous segments,
      so writes of size <= PIPE_BUF can be kept atomic
      when wrapping around from the end to the start of the
      pipe buffer.

PR:		15235
Reviewed by:	Matt Dillon <dillon@FreeBSD.org>

Revision 1.58: download - view: text, markup, annotated - select for diffs
Mon Nov 8 03:28:48 1999 UTC (12 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +10 -6 lines
Update pipe code for fo_stat() entry point - pipe_stat() is now no longer
used outside the pipe code.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Fri Oct 29 18:08:52 1999 UTC (12 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +1 -2 lines
useracc() the prequel:

Merge the contents (less some trivial bordering the silly comments)
of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>.  This puts
the #defines for the vm_inherit_t and vm_prot_t types next to their
typedefs.

This paves the road for the commit to follow shortly: change
useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE}
as argument.

Revision 1.56: download - view: text, markup, annotated - select for diffs
Mon Sep 20 19:08:48 1999 UTC (12 years, 4 months ago) by dillon
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +3 -4 lines
    Fix bug in pipe code relating to writes of mmap'd but illegal address
    spaces which cross a segment boundry in the page table.  pmap_kextract()
    is not designed for access to the user space portion of the page
    table and cannot handle the null-page-directory-entry case.

    The fix is to have vm_fault_quick() return a success or failure which
    is then used to avoid calling pmap_kextract().

Revision 1.55: download - view: text, markup, annotated - select for diffs
Sun Sep 19 17:00:24 1999 UTC (12 years, 4 months ago) by green
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +7 -5 lines
This is what was "fdfix2.patch," a fix for fd sharing.  It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes.  The biggest change is that now, you don't use
	fp->f_ops->fo_foo(fp, bar)
but instead
	fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided.  Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.

Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)

Reviewed by:	peter

Revision 1.21.2.1: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:15:17 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_2_2
Diff to: previous 1.21: preferred, colored; next MAIN 1.22: preferred, colored
Changes since revision 1.21: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.46.2.4: download - view: text, markup, annotated - select for diffs
Sun Aug 29 16:26:08 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_3
CVS tags: RELENG_3_4_0_RELEASE, RELENG_3_3_0_RELEASE
Diff to: previous 1.46.2.3: preferred, colored; branchpoint 1.46: preferred, colored
Changes since revision 1.46.2.3: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.54: download - view: text, markup, annotated - select for diffs
Sat Aug 28 00:46:19 1999 UTC (12 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.53: download - view: text, markup, annotated - select for diffs
Wed Aug 4 18:53:46 1999 UTC (12 years, 6 months ago) by green
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +6 -5 lines
Fix fd race conditions (during shared fd table usage.) Badfileops is
now used in f_ops in place of NULL, and modifications to the files
are more carefully ordered. f_ops should also be set to &badfileops
upon "close" of a file.

This does not fix other problems mentioned in this PR than the first
one.

PR:		11629
Reviewed by:	peter

Revision 1.46.2.3: download - view: text, markup, annotated - select for diffs
Sat Jun 12 05:58:49 1999 UTC (12 years, 8 months ago) by alc
Branches: RELENG_3
Diff to: previous 1.46.2.2: preferred, colored; branchpoint 1.46: preferred, colored
Changes since revision 1.46.2.2: +53 -74 lines
MFC:
	rev 1.52: Restructure pipe_read in order to eliminate
		several race conditions.
	rev 1.48 and 1.49: Cosmetic changes.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sat Jun 5 03:53:57 1999 UTC (12 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +46 -68 lines
Restructure pipe_read in order to eliminate several race conditions.

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com> and myself

Revision 1.46.2.2: download - view: text, markup, annotated - select for diffs
Wed May 5 22:53:04 1999 UTC (12 years, 9 months ago) by dt
Branches: RELENG_3
CVS tags: RELENG_3_2_PAO_BP, RELENG_3_2_PAO, RELENG_3_2_0_RELEASE
Diff to: previous 1.46.2.1: preferred, colored; branchpoint 1.46: preferred, colored
Changes since revision 1.46.2.1: +7 -5 lines
MFC: pread() and pwrite().

Revision 1.51: download - view: text, markup, annotated - select for diffs
Sun Apr 4 21:41:15 1999 UTC (12 years, 10 months ago) by dt
Branches: MAIN
CVS tags: PRE_VFS_BIO_NFS_PATCH, PRE_SMP_VMSHARE, PRE_NEWBUS, POST_VFS_BIO_NFS_PATCH, POST_SMP_VMSHARE, POST_NEWBUS
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +7 -5 lines
Add standard padding argument to pread and pwrite syscall. That should make them
NetBSD compatible.

Add parameter to fo_read and fo_write. (The only flag FOF_OFFSET mean that
the offset is set in the struct uio).

Factor out some common code from read/pread/write/pwrite syscalls.

Revision 1.46.2.1: download - view: text, markup, annotated - select for diffs
Sat Feb 6 03:30:10 1999 UTC (13 years ago) by dillon
Branches: RELENG_3
CVS tags: RELENG_3_1_0_RELEASE
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +39 -20 lines
Reviewed by:	"Jordan K. Hubbard" <jkh@zippy.cdrom.com>

    Backport bug fix for pipes hanging in piperd from -4.x  to -3.x

Revision 1.50: download - view: text, markup, annotated - select for diffs
Thu Feb 4 23:50:49 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +39 -20 lines
    Fix race in pipe read code whereby a blocked lock can allow another
    process to sneak in and write to or close the pipe.  The read code
    enters a 'piperd' state after doing the lock operation without
    checking to see if the state changed, which can cause the process
    to wait forever.

    The code has also been documented more.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Thu Jan 28 00:57:47 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +3 -3 lines
    Fix warnings in preparation for adding -Wall -Wcast-qual to the
    kernel compile

Revision 1.48: download - view: text, markup, annotated - select for diffs
Wed Jan 27 21:49:57 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +6 -6 lines
        Fix warnings in preparation for adding -Wall -Wcast-qual to the
        kernel compile

Revision 1.47: download - view: text, markup, annotated - select for diffs
Wed Jan 27 10:10:02 1999 UTC (13 years ago) by bde
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +2 -1 lines
Include <sys/select.h> -- don't depend on pollution in <sys/proc.h>.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Mon Dec 7 21:58:29 1998 UTC (13 years, 2 months ago) by archie
Branches: MAIN
CVS tags: RELENG_3_BP
Branch point for: RELENG_3
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +1 -3 lines
The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Wed Nov 11 10:03:55 1998 UTC (13 years, 3 months ago) by truckman
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +15 -11 lines
Installed the second patch attached to kern/7899 with some changes suggested
by bde, a few other tweaks to get the patch to apply cleanly again and
some improvements to the comments.

This change closes some fairly minor security holes associated with
F_SETOWN, fixes a few bugs, and removes some limitations that F_SETOWN
had on tty devices.  For more details, see the description on the PR.

Because this patch increases the size of the proc and pgrp structures,
it is necessary to re-install the includes and recompile libkvm,
the vinum lkm, fstat, gcore, gdb, ipfilter, ps, top, and w.

PR:		kern/7899
Reviewed by:	bde, elvind

Revision 1.44: download - view: text, markup, annotated - select for diffs
Wed Oct 28 13:36:58 1998 UTC (13 years, 3 months ago) by dg
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +3 -3 lines
Added a second argument, "activate" to the vm_page_unwire() call so that
the caller can select either inactive or active queue to put the page on.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:24:40 1998 UTC (13 years, 4 months ago) by dg
Branches: MAIN
CVS tags: RELENG_3_0_0_RELEASE
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +3 -3 lines
Fixed two potentially serious classes of bugs:

1) The vnode pager wasn't properly tracking the file size due to
   "size" being page rounded in some cases and not in others.
   This sometimes resulted in corrupted files. First noticed by
   Terry Lambert.
   Fixed by changing the "size" pager_alloc parameter to be a 64bit
   byte value (as opposed to a 32bit page index) and changing the
   pagers and their callers to deal with this properly.
2) Fixed a bogus type cast in round_page() and trunc_page() that
   caused some 64bit offsets and sizes to be scrambled. Removing
   the cast required adding casts at a few dozen callers.
   There may be problems with other bogus casts in close-by
   macros. A quick check seemed to indicate that those were okay,
   however.

Revision 1.42: download - view: text, markup, annotated - select for diffs
Sun Jun 7 17:11:39 1998 UTC (13 years, 8 months ago) by dfr
Branches: MAIN
CVS tags: PRE_NOBDEV
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +3 -3 lines
This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sat Mar 28 10:33:07 1998 UTC (13 years, 10 months ago) by bde
Branches: MAIN
CVS tags: PRE_DEVFS_SLICE, POST_DEVFS_SLICE
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +2 -1 lines
Moved some #includes from <sys/param.h> nearer to where they are actually
used.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Thu Mar 26 20:51:47 1998 UTC (13 years, 10 months ago) by phk
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +7 -7 lines
Add two new functions, get{micro|nano}time.

They are atomic, but return in essence what is in the "time" variable.
gettime() is now a macro front for getmicrotime().

Various patches to use the two new functions instead of the various
hacks used in their absence.

Some puntuation and grammer patches from Bruce.

A couple of XXX comments.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Mon Feb 9 06:09:25 1998 UTC (14 years ago) by eivind
Branches: MAIN
CVS tags: PRE_SOFTUPDATE, POST_SOFTUPDATE
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +3 -3 lines
Staticize.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Fri Feb 6 12:13:26 1998 UTC (14 years ago) by eivind
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +1 -3 lines
Back out DIAGNOSTIC changes.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Wed Feb 4 22:32:35 1998 UTC (14 years ago) by eivind
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +3 -1 lines
Turn DIAGNOSTIC into a new-style option.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Fri Nov 7 08:53:00 1997 UTC (14 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +1 -2 lines
Remove a bunch of variables which were unused both in GENERIC and LINT.

Found by:	-Wunused

Revision 1.35: download - view: text, markup, annotated - select for diffs
Thu Nov 6 19:29:21 1997 UTC (14 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +5 -6 lines
Move the "retval" (3rd) parameter from all syscall functions and put
it in struct proc instead.

This fixes a boatload of compiler warning, and removes a lot of cruft
from the sources.

I have not removed the /*ARGSUSED*/, they will require some looking at.

libkvm, ps and other userland struct proc frobbing programs will need
recompiled.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Mon Oct 6 08:30:08 1997 UTC (14 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +3 -3 lines
Ack!  Fix excessive cut/paste blunder during poll mods.  Who had the
pointy hat last? :-]

When one is selecting (or polling) for write, it helps if we use the
write side of the pipe when requesting wakeups instead of the read side.
This broke ghostview (at least) - I'm suprised it wasn't noticed for
so long.

Reviewed by:  Greg Lehey <grog@lemis.com>

Revision 1.33: download - view: text, markup, annotated - select for diffs
Sun Sep 14 02:43:25 1997 UTC (14 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +38 -39 lines
Implement the poll backend for the pipe file type.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Tue Sep 2 20:05:53 1997 UTC (14 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +1 -9 lines
Removed unused #includes.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Tue Aug 5 22:24:17 1997 UTC (14 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +2 -3 lines
Another attempt at cleaning up the new memory allocator.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Tue Aug 5 00:05:00 1997 UTC (14 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +1 -10 lines
Fix up come cruft that I left on a previous commit.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Tue Aug 5 00:01:26 1997 UTC (14 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +17 -1 lines
Get rid of the ad-hoc memory allocator for vm_map_entries, in lieu of
a simple, clean zone type allocator.  This new allocator will also be
used for machine dependent pmap PV entries.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Wed Apr 9 16:53:39 1997 UTC (14 years, 10 months ago) by bde
Branches: MAIN
CVS tags: pre_smp_merge, post_smp_merge, WOLLMAN_MBUF, BP_WOLLMAN_MBUF
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +1 -4 lines
Removed support for OLD_PIPE.  <sys/stat.h> is now missing the hack that
supported nameless pipes being indistinguishable from fifos.  We're not
going back.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Mon Mar 24 11:52:26 1997 UTC (14 years, 10 months ago) by bde
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +3 -2 lines
Don't include <sys/ioctl.h> in the kernel.  Stage 4: include
<sys/ttycom.h> and sometimes <sys/filio.h> instead of <sys/ioctl.h>
in miscellaneous files.  Most of these files have nothing to do
with ttys but need to include <sys/ttycom.h> to get the definitions
of TIOC[SG]PGRP which are (ab)used to convert F[SG]ETOWN fcntls into
ioctls.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Sun Mar 23 03:36:24 1997 UTC (14 years, 10 months ago) by bde
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +2 -1 lines
Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Sat Mar 22 06:52:57 1997 UTC (14 years, 10 months ago) by bde
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +9 -16 lines
Fixed some invalid (non-atomic) accesses to `time', mostly ones of the
form `tv = time'.  Use a new function gettime().  The current version
just forces atomicicity without fixing precision or efficiency bugs.
Simplified some related valid accesses by using the central function.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Sat Feb 22 09:39:19 1997 UTC (14 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +1 -1 lines
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$.  We are not
ready for it yet.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Mon Feb 10 02:09:56 1997 UTC (15 years ago) by dyson
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +1 -1 lines
This is the kernel Lite/2 commit.  There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>

Revision 1.22: download - view: text, markup, annotated - select for diffs
Tue Jan 14 06:43:55 1997 UTC (15 years ago) by jkh
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +1 -1 lines
Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Fri Oct 11 02:27:30 1996 UTC (15 years, 4 months ago) by dyson
Branches: MAIN
CVS tags: RELENG_2_2_BP, RELENG_2_2_8_RELEASE, RELENG_2_2_7_RELEASE, RELENG_2_2_6_RELEASE, RELENG_2_2_5_RELEASE, RELENG_2_2_2_RELEASE, RELENG_2_2_1_RELEASE, RELENG_2_2_0_RELEASE
Branch point for: RELENG_2_2
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +19 -11 lines
Mostly some fixes from bde to start support for ASYNC I/O (SIGIO).
Submitted by:	bde

Revision 1.20: download - view: text, markup, annotated - select for diffs
Sat Jul 13 22:52:50 1996 UTC (15 years, 7 months ago) by dyson
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +73 -32 lines
A few minor mods (improvements) to support more efficient pipe
operations for large transfers.  There are essentially no differences
for small transfers, but big transfers should perform about 20%
better.

Revision 1.19: download - view: text, markup, annotated - select for diffs
Fri Jul 12 08:14:58 1996 UTC (15 years, 7 months ago) by bde
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +12 -5 lines
Staticized some variables.

Fixed initialization of pipe_pgid - don't default to pid 0 (swapper) for
SIGIO.

Added comments about other implicit initializations, mostly for struct
stat.

Fixed initialization of st_mode.  S_IFSOCK was for when pipes were sockets.
It is probably safe to fix the bogus S_ISFIFO() now that pipes can be
distinguished from sockets in all cases.

Don't return ENOSYS for inappropriate ioctls.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Thu Jul 4 04:36:56 1996 UTC (15 years, 7 months ago) by dyson
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +15 -27 lines
Get rid of PIPE_NBIO, cleaning up the code a bit.
Reviewed by:	bde

Revision 1.17: download - view: text, markup, annotated - select for diffs
Mon Jun 17 05:15:01 1996 UTC (15 years, 7 months ago) by dyson
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +5 -2 lines
Disable direct writes for non-blocking output.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Wed Jun 12 05:07:32 1996 UTC (15 years, 8 months ago) by gpalmer
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +2 -4 lines
Clean up -Wunused warnings.

Reviewed by:		bde

Revision 1.15: download - view: text, markup, annotated - select for diffs
Mon Mar 25 01:48:28 1996 UTC (15 years, 10 months ago) by dyson
Branches: MAIN
CVS tags: wollman_polling
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +15 -9 lines
Various pipe error return fixes, and a significant typeo fix.  From
Bruce Evans (of course :-)).
Submitted by:	bde

Revision 1.14: download - view: text, markup, annotated - select for diffs
Sun Mar 17 04:52:10 1996 UTC (15 years, 10 months ago) by dyson
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +5 -6 lines
Yet another fix from BDE for the new pipe code.  This fixes a potential
deadlock due to mismanagement of busy counters.

Reviewed by: dyson
Submitted by: bde

Revision 1.13: download - view: text, markup, annotated - select for diffs
Thu Feb 22 03:33:52 1996 UTC (15 years, 11 months ago) by dyson
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +15 -8 lines
Fix a problem that select did not work with direct writes.  Make
wakeup channels more consistant also.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sat Feb 17 14:47:16 1996 UTC (15 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +2 -1 lines
Add missing prototype for pipeselwakeup (a recently added function) - gcc
bitches about it..

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sun Feb 11 22:09:50 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +63 -27 lines
Add ifdefs for non-freebsd system usage.  Add missing select wakeups,
and make the select wakup code a little neater.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Fri Feb 9 04:36:36 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +11 -2 lines
Add some missing requests for the read-side to wakeup the write-side.  Also
add some missing wakeups by the write side to the read side.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Wed Feb 7 06:41:56 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +16 -3 lines
Apparent fix for a pipe hang problem.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Mon Feb 5 05:50:34 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +24 -14 lines
More fixes from bde.
	Only modify times on success.
	splhigh() around time variable usage.
	Make atomic writes more posix compliant.
	Spelling errors.
Submitted by:	bde

Revision 1.7: download - view: text, markup, annotated - select for diffs
Mon Feb 5 05:17:15 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +11 -7 lines
Kva space allocated for direct buffer wasn't quite big enough.  The
system can panic easily without this patch.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sun Feb 4 22:09:05 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +8 -1 lines
Changed vm_fault_quick in vm_machdep.c to be global.  Needed for
new pipe code.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sun Feb 4 19:56:35 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +442 -46 lines
Improve the performance for pipe(2) again.  Also include some
fixes for previous version of new pipes from Bruce Evans.  This
new version:

Supports more properly the semantics of select (BDE).
Supports "OLD_PIPE" correctly (kern_descrip.c, BDE).
Eliminates incorrect EPIPE returns (bash 'pipe broken' messages.)
Much faster yet, currently tuned relatively conservatively -- but now
	gives approx 50% more perf than the new pipes code did originally.
	(That was about 50% more perf than the original BSD pipe code.)

Known bugs outstanding:
	No support for async io (SIGIO).  Will be included soon.

Next to do:
	Merge support for FIFOs.

Submitted by: bde

Revision 1.4: download - view: text, markup, annotated - select for diffs
Wed Jan 31 06:00:45 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +6 -7 lines
Fix another problem with the new pipe code, pointed out by Bruce Evans.
This one fixes a problem with interactions with signals.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Wed Jan 31 02:05:12 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +8 -4 lines
Fix some problems with return codes on the new pipe stuff.  Bruce Evans
found the problems, and this commit will fix the "first batch" :-).

Revision 1.2: download - view: text, markup, annotated - select for diffs
Mon Jan 29 02:57:33 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +8 -5 lines
Fixed an uninitialized variable (argument to vm_map_find) -- problem
that DG detected, and promptly found a fix.
Submitted by:	davidg

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun Jan 28 23:38:26 1996 UTC (16 years ago) by dyson
Branches: MAIN
Added new files to support the new fast pipes.  After the follow-on
commits, pipe performance should increase significantly.  The pipe(2)
system call is currently supported, while fifofs will be added later.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options