The NetBSD Project

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

[BACK] Up to [cvs.NetBSD.org] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.148 / (download) - annotate - [select for diffs], Fri Apr 26 17:24:23 2019 UTC (6 months, 3 weeks ago) by mlelstv
Branch: MAIN
CVS Tags: phil-wifi-20190609, netbsd-9-base, netbsd-9, HEAD
Changes since 1.147: +10 -5 lines
Diff to previous 1.147 (colored)

Handle half-closed pipes in FIONWRITE and FIONSPACE.

Revision 1.147 / (download) - annotate - [select for diffs], Fri Apr 26 17:20:49 2019 UTC (6 months, 3 weeks ago) by mlelstv
Branch: MAIN
Changes since 1.146: +4 -2 lines
Diff to previous 1.146 (colored)

Clean up pipe structure before recycling it.

Revision 1.146 / (download) - annotate - [select for diffs], Sun Jun 10 17:54:51 2018 UTC (17 months, 1 week ago) by jdolecek
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, isaki-audio2-base, isaki-audio2
Branch point for: phil-wifi
Changes since 1.145: +76 -102 lines
Diff to previous 1.145 (colored)

convert the (still disabled) 'direct write' for pipes to use the
experimental PMAP_DIRECT if available; the direct code paths now survive
longer than the pmap_enter() variant, but still triggers panic during
build.sh tools run; remove some obsolete sysctls

add some XXXs to mark places which need attention to make this more stable

Note: the loan case is now actually significantly slower than the
non-loan case on MP systems, due to synchronous IPIs triggered by
marking the page read-only by uvm_loan(); this is being discussed
in the email thread
https://mail-index.netbsd.org/tech-kern/2018/05/21/msg023441.html

that is basically the same issue due to which loaning was disabled
for sosend()

Revision 1.145 / (download) - annotate - [select for diffs], Sat May 19 11:39:37 2018 UTC (17 months, 4 weeks ago) by jdolecek
Branch: MAIN
CVS Tags: pgoyette-compat-0521
Changes since 1.144: +16 -20 lines
Diff to previous 1.144 (colored)

Remove emap support. Unfortunately it never got to state where it would be
used and usable, due to reliability and limited & complicated MD support.

Going forward, we need to concentrate on interface which do not map anything
into kernel in first place (such as direct map or KVA-less I/O), rather
than making those mappings cheaper to do.

Revision 1.144 / (download) - annotate - [select for diffs], Fri Apr 20 19:02:18 2018 UTC (18 months, 3 weeks ago) by jdolecek
Branch: MAIN
CVS Tags: pgoyette-compat-0502, pgoyette-compat-0422
Changes since 1.143: +4 -3 lines
Diff to previous 1.143 (colored)

add prot parameter for uvm_emap_enter(), so that it's possible to
enter also read/write mappings

Revision 1.143 / (download) - annotate - [select for diffs], Tue Dec 26 08:30:58 2017 UTC (22 months, 3 weeks ago) by kamil
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.142: +10 -10 lines
Diff to previous 1.142 (colored)

Refactor pipe1() and correct a bug in sys_pipe2() (SYS_pipe2)

sys_pipe2() returns two integers (values), the 2nd one is a copy of the 2nd
file descriptor that lands in fildes[2]. This is a side effect of reusing
the code for sys_pipe() (SYS_pipe) and not cleaning it up.

The first returned value is (on success) 0.

Introduced a small refactoring in pipe1() that it does not operate over
retval[], but on an array int[2]. A user sets retval[] for pipe() when
desired and needed.

This refactoring touches compat code: netbsd32, linux, linux32.

Before the changes on NetBSD/amd64:

$ ktruss -i ./a.out
[...]
 15131      1 a.out    pipe2(0x7f7fff2e62b8, 0)    = 0, 4
[...]

After the changes:

$ ktruss -i ./a.out
[...]
   782      1 a.out    pipe2(0x7f7fff97e850, 0)    = 0
[...]

There should not be a visible change for current users.

Sponsored by <The NetBSD Foundation>

Revision 1.142 / (download) - annotate - [select for diffs], Thu Nov 30 20:25:55 2017 UTC (23 months, 2 weeks ago) by christos
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202
Changes since 1.141: +3 -2 lines
Diff to previous 1.141 (colored)

add fo_name so we can identify the fileops in a simple way.

Revision 1.141 / (download) - annotate - [select for diffs], Wed Oct 25 08:12:39 2017 UTC (2 years ago) by maya
Branch: MAIN
Changes since 1.140: +15 -6 lines
Diff to previous 1.140 (colored)

Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- 	{ a, b, c, d
+ 	{
+ 	.f_isfd = a,
+ 	.f_attach = b,
+ 	.f_detach = c,
+ 	.f_event = d,
};

Revision 1.140 / (download) - annotate - [select for diffs], Fri Sep 5 09:20:59 2014 UTC (5 years, 2 months ago) by matt
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base, nick-nhusb, netbsd-8-base, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: netbsd-8
Changes since 1.139: +16 -16 lines
Diff to previous 1.139 (colored)

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.

Revision 1.139 / (download) - annotate - [select for diffs], Fri Sep 5 05:57:21 2014 UTC (5 years, 2 months ago) by matt
Branch: MAIN
Changes since 1.138: +10 -10 lines
Diff to previous 1.138 (colored)

Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.

Revision 1.138 / (download) - annotate - [select for diffs], Tue Feb 25 18:30:11 2014 UTC (5 years, 8 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, rmind-smpnet-nbase, rmind-smpnet-base, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Branch point for: netbsd-7
Changes since 1.137: +2 -7 lines
Diff to previous 1.137 (colored)

Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.

Revision 1.137 / (download) - annotate - [select for diffs], Fri Jun 28 01:21:06 2013 UTC (6 years, 4 months ago) by matt
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Branch point for: rmind-smpnet
Changes since 1.136: +48 -42 lines
Diff to previous 1.136 (colored)

Make page loaning in pipes color aware.

Revision 1.136 / (download) - annotate - [select for diffs], Wed May 16 09:41:11 2012 UTC (7 years, 6 months ago) by martin
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, khorben-n900, jmcneill-usbmp-base10, agc-symver-base, agc-symver
Branch point for: tls-maxphys
Changes since 1.135: +10 -8 lines
Diff to previous 1.135 (colored)

Make sure we can deliver two file descriptors for pipe2() before we set
up anything special (like close on exec).
Fixes PR kern/46457.

Revision 1.135 / (download) - annotate - [select for diffs], Wed Jan 25 00:28:36 2012 UTC (7 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base4, netbsd-6-base, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2
Branch point for: netbsd-6
Changes since 1.134: +3 -3 lines
Diff to previous 1.134 (colored)

As discussed in tech-kern, provide the means to prevent delivery of SIGPIPE
on EPIPE for all file descriptor types:

- provide O_NOSIGPIPE for open,kqueue1,pipe2,dup3,fcntl(F_{G,S}ETFL) [NetBSD]
- provide SOCK_NOSIGPIPE for socket,socketpair [NetBSD]
- provide SO_NOSIGPIPE for {g,s}seckopt [NetBSD/FreeBSD/MacOSX]
- provide F_{G,S}ETNOSIGPIPE for fcntl [MacOSX]

Revision 1.134 / (download) - annotate - [select for diffs], Thu Oct 20 18:18:21 2011 UTC (8 years ago) by njoly
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: yamt-pagecache, jmcneill-usbmp
Changes since 1.133: +4 -2 lines
Diff to previous 1.133 (colored)

Do call fd_set_exclose() on both file descriptors, to set the
close-on-exec flag.

Revision 1.133 / (download) - annotate - [select for diffs], Wed Oct 5 13:30:24 2011 UTC (8 years, 1 month ago) by apb
Branch: MAIN
Changes since 1.132: +4 -5 lines
Diff to previous 1.132 (colored)

When pipe1() calls pipe_create() and it fails, use the error
result from pipe_create(), don't assume it will always be ENOMEM.

From PR 45423 by Greg Woods.

Revision 1.132 / (download) - annotate - [select for diffs], Fri Jul 15 14:50:19 2011 UTC (8 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.131: +4 -2 lines
Diff to previous 1.131 (colored)

fail with EINVAL if flags not are not O_CLOEXEC|O_NONBLOCK in pipe2(2) and
dup3(2)

Revision 1.131 / (download) - annotate - [select for diffs], Sun Jun 26 16:42:42 2011 UTC (8 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.130: +2 -8 lines
Diff to previous 1.130 (colored)

* Arrange for interfaces that create new file descriptors to be able to
  set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).

    - Add F_DUPFD_CLOEXEC to fcntl(2).
    - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing.
    - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
    - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
    - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter
      for socket(2) and socketpair(2).
    - Add new paccept(2) syscall that takes an additional sigset_t to alter
      the sigmask temporarily and a flags argument to set SOCK_CLOEXEC,
      SOCK_NONBLOCK.
    - Add new mode character 'e' to fopen(3) and popen(3) to open pipes
      and file descriptors for close on exec.
    - Add new kqueue1(2) syscall with a new flags argument to open the
      kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.

* Fix the system calls that take socklen_t arguments to actually do so.

* Don't include userland header files (signal.h) from system header files
  (rump_syscallargs.h).

* Bump libc version for the new syscalls.

Revision 1.130 / (download) - annotate - [select for diffs], Sun Apr 10 15:45:33 2011 UTC (8 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base, cherry-xenmp
Changes since 1.129: +11 -5 lines
Diff to previous 1.129 (colored)

- Add O_CLOEXEC to open(2)
- Add fd_set_exclose() to encapsulate uses of FIO{,N}CLEX, O_CLOEXEC, F{G,S}ETFD
- Add a pipe1() function to allow passing flags to the fd's that pipe(2)
  opens to ease implementation of linux pipe2(2)
- Factor out fp handling code from open(2) and fhopen(2)

Revision 1.129 / (download) - annotate - [select for diffs], Mon Jan 17 07:13:32 2011 UTC (8 years, 10 months ago) by uebayasi
Branch: MAIN
CVS Tags: bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Changes since 1.128: +3 -3 lines
Diff to previous 1.128 (colored)

Include internal definitions (uvm/uvm.h) only where necessary.

Revision 1.128 / (download) - annotate - [select for diffs], Wed Aug 11 11:46:32 2010 UTC (9 years, 3 months ago) by pgoyette
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, matt-mips64-premerge-20101231, jruoho-x86intr-base
Branch point for: jruoho-x86intr
Changes since 1.127: +6 -6 lines
Diff to previous 1.127 (colored)

Keep condvar wmesg within 8-char limit

Revision 1.127 / (download) - annotate - [select for diffs], Sun Dec 20 09:36:06 2009 UTC (9 years, 10 months ago) by dsl
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9, yamt-nfs-mp-base10, uebayasi-xip-base1, uebayasi-xip-base
Branch point for: uebayasi-xip, rmind-uvmplock
Changes since 1.126: +20 -17 lines
Diff to previous 1.126 (colored)

If a multithreaded app closes an fd while another thread is blocked in
read/write/accept, then the expectation is that the blocked thread will
exit and the close complete.
Since only one fd is affected, but many fd can refer to the same file,
the close code can only request the fs code unblock with ERESTART.
Fixed for pipes and sockets, ERESTART will only be generated after such
a close - so there should be no change for other programs.
Also rename fo_abort() to fo_restart() (this used to be fo_drain()).
Fixes PR/26567

Revision 1.126 / (download) - annotate - [select for diffs], Tue Dec 15 18:35:18 2009 UTC (9 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.125: +4 -2 lines
Diff to previous 1.125 (colored)

Don't ERESTART write() calls for now.
I suspect some programs don't allow for the partial transfer.

Revision 1.125 / (download) - annotate - [select for diffs], Sun Dec 13 20:02:23 2009 UTC (9 years, 11 months ago) by dsl
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.124: +18 -2 lines
Diff to previous 1.124 (colored)

Another, better, fix for PR/26567.
Only sleep once within each pipe_read/pipe_write call.
If there is no data/space available after we wakeup return ERESTART so
then the 'fd' number is validated again.
A simple broadcast of the cvs is then enough to evict the correct threads
when close() is called from an active thread.

Revision 1.124 / (download) - annotate - [select for diffs], Sun Dec 13 18:27:02 2009 UTC (9 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.123: +10 -16 lines
Diff to previous 1.123 (colored)

Revert most of the previous change.
Only one fd needs clobbering, not all fds that reference the pipe.
This may be what ad@ realised when he tried to add the same code to
sockets. Unfixes part of PR/26567.

Revision 1.123 / (download) - annotate - [select for diffs], Sat Dec 12 21:28:04 2009 UTC (9 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.122: +29 -4 lines
Diff to previous 1.122 (colored)

Add support for unblocking read/write when close called.
Fixes PR/26567 for pipes.
(NB ad backed out the fix for sockets)

Revision 1.122 / (download) - annotate - [select for diffs], Thu Dec 10 20:55:17 2009 UTC (9 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.121: +23 -21 lines
Diff to previous 1.121 (colored)

Avoid leaking a mutex_obj when pipe_create() fails for the read pipe.
Remove the unused argument from pipeclose().

Revision 1.121 / (download) - annotate - [select for diffs], Wed Dec 9 21:32:59 2009 UTC (9 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.120: +3 -3 lines
Diff to previous 1.120 (colored)

Rename fo_drain() to fo_abort(), 'drain' is used to mean 'wait for output
do drain' in many places, whereas fo_drain() was called in order to force
blocking read()/write() etc calls to return to userspace so that a close()
call from a different thread can complete.
In the sockets code comment out the broken code in the inner function,
it was being called from compat code.

Revision 1.120 / (download) - annotate - [select for diffs], Sun Dec 6 20:26:55 2009 UTC (9 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.119: +2 -3 lines
Diff to previous 1.119 (colored)

Correct comment, pipelock() no longer releases the mutex.

Revision 1.119 / (download) - annotate - [select for diffs], Mon Aug 31 20:48:14 2009 UTC (10 years, 2 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-nfs-mp-base8, jym-xensuspend-nbase
Changes since 1.118: +5 -2 lines
Diff to previous 1.118 (colored)

Turn off pipe's direct I/O again, it corrupts the data (although build and
various activity survived while testing this).  Corruptions also happen on
sparc64 where emap is not in effect, therefore bugs are in direct I/O code.

Revision 1.118 / (download) - annotate - [select for diffs], Sat Aug 29 00:06:43 2009 UTC (10 years, 2 months ago) by rmind
Branch: MAIN
Changes since 1.117: +2 -5 lines
Diff to previous 1.117 (colored)

- Re-enable direct I/O with emap for pipe.
- While not used, #ifdef KVA allocation in emap (so it wont burn the space).

Revision 1.117 / (download) - annotate - [select for diffs], Wed Jul 15 21:09:41 2009 UTC (10 years, 4 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-nfs-mp-base7, yamt-nfs-mp-base6, jymxensuspend-base
Changes since 1.116: +5 -2 lines
Diff to previous 1.116 (colored)

Revert previous: disable direct I/O on pipe, it cought a problem with emap.

Revision 1.116 / (download) - annotate - [select for diffs], Mon Jul 13 02:49:08 2009 UTC (10 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.115: +2 -5 lines
Diff to previous 1.115 (colored)

Re-enable direct I/O for pipe:
- Larger writes (2 or more pages) will use emap.
- Might help to catch rare hang (some very old bug).

Revision 1.115 / (download) - annotate - [select for diffs], Sun Jun 28 15:18:50 2009 UTC (10 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.114: +22 -13 lines
Diff to previous 1.114 (colored)

Ephemeral mapping (emap) implementation.  Concept is based on the idea that
activity of other threads will perform the TLB flush for the processes using
emap as a side effect.  To track that, global and per-CPU generation numbers
are used.  This idea was suggested by Andrew Doran; various improvements to
it by me.  Notes:

- For now, zero-copy on pipe is not yet enabled.
- TCP socket code would likely need more work.
- Additional UVM loaning improvements are needed.

Proposed on <tech-kern>, silence there.
Quickly reviewed by <ad>.

Revision 1.114 / (download) - annotate - [select for diffs], Sun Jun 28 14:34:48 2009 UTC (10 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.113: +3 -3 lines
Diff to previous 1.113 (colored)

Amend previous.

Revision 1.113 / (download) - annotate - [select for diffs], Sun Jun 28 14:22:11 2009 UTC (10 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.112: +61 -88 lines
Diff to previous 1.112 (colored)

- Convert some #ifdefs to KASSERT()s.
- KNF, style, no parameters in function declarations.
- No functional changes.

Revision 1.112 / (download) - annotate - [select for diffs], Sat Apr 11 23:05:26 2009 UTC (10 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: yamt-nfs-mp-base5, yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base, jym-xensuspend-base
Changes since 1.111: +5 -3 lines
Diff to previous 1.111 (colored)

Fix locking as Andy explained. Also fill in uid and gid like sys_pipe did.

Revision 1.111 / (download) - annotate - [select for diffs], Sat Apr 11 15:46:18 2009 UTC (10 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.110: +6 -7 lines
Diff to previous 1.110 (colored)

rename ctime to btime for consistency.

Revision 1.110 / (download) - annotate - [select for diffs], Sat Apr 11 14:42:28 2009 UTC (10 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.109: +9 -9 lines
Diff to previous 1.109 (colored)

- maintain timespec internally.
- set birthtime too.

Revision 1.109 / (download) - annotate - [select for diffs], Sat Apr 4 10:12:51 2009 UTC (10 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.108: +11 -4 lines
Diff to previous 1.108 (colored)

Add fileops::fo_drain(), to be called from fd_close() when there is more
than one active reference to a file descriptor. It should dislodge threads
sleeping while holding a reference to the descriptor. Implemented only for
sockets but should be extended to pipes, fifos, etc.

Fixes the case of a multithreaded process doing something like the
following, which would have hung until the process got a signal.

thr0	accept(fd, ...)
thr1	close(fd)

Revision 1.108 / (download) - annotate - [select for diffs], Sun Feb 15 00:07:54 2009 UTC (10 years, 9 months ago) by enami
Branch: MAIN
CVS Tags: nick-hppapmap-base2
Changes since 1.107: +9 -2 lines
Diff to previous 1.107 (colored)

The knote objects attached by peer will still be linked in our list
if we are closed before the peer.  So, remove them.  It didn't matter
when pipe objects are directly returned to pool, but nowadays they
are cached.

Revision 1.107 / (download) - annotate - [select for diffs], Fri Feb 6 23:04:57 2009 UTC (10 years, 9 months ago) by enami
Branch: MAIN
Branch point for: jym-xensuspend
Changes since 1.106: +6 -6 lines
Diff to previous 1.106 (colored)

Instead of missing NULL check in pipe_create, let the pipe_ctor to wait
on buffer allocation.  The other allocation is simply an optimization,
so leave it as is.

Revision 1.106 / (download) - annotate - [select for diffs], Sun Feb 1 18:23:04 2009 UTC (10 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.105: +104 -97 lines
Diff to previous 1.105 (colored)

Apply pipe patch posted to tech-kern, slightly updated:

- Cache kva.
- Convert to use mutex_obj_alloc().
- Make better use of pool_cache.

Also:

Disable direct transfers for the moment. I believe there may be a bug that
can cause transfers to stall when switching between direct/buffered access.
I think this has most recently been run into on 'denver' but I have seen it
as far back as 3.1.

(As an aside, direct is a not a clear win on modern systems with large cache
and high TLB invalidation overhead. Particularly so on MP systems, although
micro benchmarks may report otherwise because they typically do not tax the
system. Anyone want to write a decent benchmark?)

Revision 1.105 / (download) - annotate - [select for diffs], Tue Jan 20 14:51:43 2009 UTC (10 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.104: +5 -5 lines
Diff to previous 1.104 (colored)

fix inverted POLL_ directions.

Revision 1.104 / (download) - annotate - [select for diffs], Tue Jan 20 14:50:22 2009 UTC (10 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.103: +2 -4 lines
Diff to previous 1.103 (colored)

pipeselwakeup: now POLL_HUP != POLL_ERR.  remove unnecessary #if.

Revision 1.103 / (download) - annotate - [select for diffs], Wed Sep 17 14:00:41 2008 UTC (11 years, 2 months ago) by pooka
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, netbsd-5-base, netbsd-5-0-RC1, mjf-devfs2-base, matt-mips64-base2, haad-nbase2, haad-dm-base2, haad-dm-base1, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Branch point for: nick-hppapmap, netbsd-5
Changes since 1.102: +2 -4 lines
Diff to previous 1.102 (colored)

remove M_PIPE (hi rmind!)

Revision 1.102 / (download) - annotate - [select for diffs], Sat Sep 6 23:05:52 2008 UTC (11 years, 2 months ago) by rmind
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-2
Changes since 1.101: +6 -6 lines
Diff to previous 1.101 (colored)

Replace malloc with kmem.

Revision 1.101 / (download) - annotate - [select for diffs], Mon Apr 28 20:24:04 2008 UTC (11 years, 6 months ago) by martin
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-nfs-mp-base2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, simonb-wapbl-nbase, simonb-wapbl-base, simonb-wapbl, hpcarm-cleanup-nbase
Branch point for: wrstuden-revivesa, haad-dm
Changes since 1.100: +2 -9 lines
Diff to previous 1.100 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.100 / (download) - annotate - [select for diffs], Thu Mar 27 18:30:15 2008 UTC (11 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base, yamt-nfs-mp-base
Branch point for: yamt-pf42, yamt-nfs-mp
Changes since 1.99: +4 -7 lines
Diff to previous 1.99 (colored)

Replace use of CACHE_LINE_SIZE in some obvious places.

Revision 1.99 / (download) - annotate - [select for diffs], Fri Mar 21 21:55:00 2008 UTC (11 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: yamt-lazymbuf-base15, yamt-lazymbuf-base14, ad-socklock-base1
Changes since 1.98: +35 -41 lines
Diff to previous 1.98 (colored)

Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.

Revision 1.98 / (download) - annotate - [select for diffs], Sat Mar 1 14:16:51 2008 UTC (11 years, 8 months ago) by rmind
Branch: MAIN
CVS Tags: matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base
Changes since 1.97: +7 -7 lines
Diff to previous 1.97 (colored)

Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>

Revision 1.97 / (download) - annotate - [select for diffs], Fri Feb 29 12:04:48 2008 UTC (11 years, 8 months ago) by yamt
Branch: MAIN
Changes since 1.96: +34 -24 lines
Diff to previous 1.96 (colored)

fix a livelock with multiple readers by separating condvar.

Revision 1.96 / (download) - annotate - [select for diffs], Sat Feb 23 16:05:17 2008 UTC (11 years, 8 months ago) by chris
Branch: MAIN
CVS Tags: hpcarm-cleanup-base
Changes since 1.95: +3 -2 lines
Diff to previous 1.95 (colored)

Add missing pmap_update(pmap_kernel()); calls after pmap_kenter_pa and
pmap_remove.

Revision 1.95 / (download) - annotate - [select for diffs], Mon Jan 28 20:01:50 2008 UTC (11 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: nick-net80211-sync-base, nick-net80211-sync, mjf-devfs-base
Branch point for: mjf-devfs2, keiichi-mipv6
Changes since 1.94: +52 -48 lines
Diff to previous 1.94 (colored)

- Update global counters using atomics before allocating. When freeing,
  update the couters afterwards.
- Cosmetic / code generation changes.

Revision 1.94 / (download) - annotate - [select for diffs], Fri Jan 4 21:18:14 2008 UTC (11 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: matt-armv6-base, bouyer-xeni386-nbase, bouyer-xeni386-base
Changes since 1.93: +2 -3 lines
Diff to previous 1.93 (colored)

Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.

Revision 1.93 / (download) - annotate - [select for diffs], Wed Jan 2 19:16:01 2008 UTC (11 years, 10 months ago) by yamt
Branch: MAIN
Changes since 1.92: +10 -55 lines
Diff to previous 1.92 (colored)

remove PIPE_WANTW, PIPE_WANTR and PIPE_WANTCLOSE.  cv_waiters is enough.
this fixes a deadlock between pipe_direct_write and pipeclose.

XXX this code should be simplified.
it's mostly pointless to have two struct pipes linked together,
esp. when we don't support bi-directional pipes.

Revision 1.92 / (download) - annotate - [select for diffs], Fri Dec 28 13:11:16 2007 UTC (11 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.91: +17 -10 lines
Diff to previous 1.91 (colored)

Pull up 1.87.2.8.

Revision 1.91 / (download) - annotate - [select for diffs], Thu Dec 27 15:25:22 2007 UTC (11 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.90: +2 -3 lines
Diff to previous 1.90 (colored)

pipe_direct_write: kill a mutex_exit() that escaped.

Revision 1.90 / (download) - annotate - [select for diffs], Wed Dec 26 16:01:37 2007 UTC (11 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: vmlocking2-base3
Changes since 1.89: +138 -152 lines
Diff to previous 1.89 (colored)

Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.

Revision 1.89 / (download) - annotate - [select for diffs], Thu Dec 20 23:03:11 2007 UTC (11 years, 10 months ago) by dsl
Branch: MAIN
Changes since 1.88: +3 -3 lines
Diff to previous 1.88 (colored)

Convert all the system call entry points from:
    int foo(struct lwp *l, void *v, register_t *retval)
to:
    int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.

Revision 1.88 / (download) - annotate - [select for diffs], Wed Dec 5 17:19:58 2007 UTC (11 years, 11 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-kmem-base3, yamt-kmem-base2, yamt-kmem-base, yamt-kmem, vmlocking2-base2, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, jmcneill-pm-base, cube-autoconf-base, cube-autoconf
Branch point for: bouyer-xeni386
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored)

Do not "return 1" from kqfilter for errors.  That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.

Revision 1.87 / (download) - annotate - [select for diffs], Wed Nov 7 00:23:23 2007 UTC (12 years ago) by ad
Branch: MAIN
CVS Tags: vmlocking2-base1, vmlocking-nbase, bouyer-xenamd64-base2, bouyer-xenamd64-base
Branch point for: vmlocking2
Changes since 1.86: +8 -7 lines
Diff to previous 1.86 (colored)

Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.

Revision 1.86 / (download) - annotate - [select for diffs], Tue Sep 25 13:53:31 2007 UTC (12 years, 1 month ago) by ad
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3, yamt-x86pmap-base2, vmlocking-base, jmcneill-base
Branch point for: mjf-devfs, bouyer-xenamd64
Changes since 1.85: +4 -2 lines
Diff to previous 1.85 (colored)

Use selinit() / seldestroy().

Revision 1.85 / (download) - annotate - [select for diffs], Mon Jul 9 21:10:56 2007 UTC (12 years, 4 months ago) by ad
Branch: MAIN
CVS Tags: yamt-x86pmap-base, nick-csl-alignment-base5, nick-csl-alignment-base, nick-csl-alignment, mjf-ufs-trans-base, matt-mips64-base, matt-mips64, hpcarm-cleanup
Branch point for: yamt-x86pmap, matt-armv6, jmcneill-pm
Changes since 1.84: +76 -64 lines
Diff to previous 1.84 (colored)

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements

Revision 1.84 / (download) - annotate - [select for diffs], Mon Mar 26 22:52:44 2007 UTC (12 years, 7 months ago) by hubertf
Branch: MAIN
CVS Tags: yamt-idlelwp-base8, thorpej-atomic-base, thorpej-atomic
Changes since 1.83: +2 -3 lines
Diff to previous 1.83 (colored)

Remove duplicate #include's
From: Slava Semushin <php-coder@altlinux.ru>

Revision 1.83 / (download) - annotate - [select for diffs], Fri Mar 23 18:33:43 2007 UTC (12 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.82: +30 -23 lines
Diff to previous 1.82 (colored)

Fix a deadlock w/kqueue that was introduced with the last set of changes.
Spotted by yamt@.

Revision 1.82 / (download) - annotate - [select for diffs], Mon Mar 12 21:31:12 2007 UTC (12 years, 8 months ago) by ad
Branch: MAIN
Branch point for: reinoud-bufcleanup
Changes since 1.81: +61 -16 lines
Diff to previous 1.81 (colored)

Put a lock around pipe->pipe_peer.

Revision 1.81 / (download) - annotate - [select for diffs], Mon Mar 12 19:05:05 2007 UTC (12 years, 8 months ago) by ad
Branch: MAIN
Branch point for: mjf-ufs-trans
Changes since 1.80: +3 -3 lines
Diff to previous 1.80 (colored)

Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.

Revision 1.80 / (download) - annotate - [select for diffs], Mon Mar 12 16:20:53 2007 UTC (12 years, 8 months ago) by ad
Branch: MAIN
Changes since 1.79: +93 -89 lines
Diff to previous 1.79 (colored)

Use mutexes & condvars.

Revision 1.79 / (download) - annotate - [select for diffs], Sun Mar 4 06:03:09 2007 UTC (12 years, 8 months ago) by christos
Branch: MAIN
Branch point for: vmlocking
Changes since 1.78: +14 -14 lines
Diff to previous 1.78 (colored)

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.

Revision 1.78 / (download) - annotate - [select for diffs], Fri Feb 9 21:55:31 2007 UTC (12 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: post-newlock2-merge, ad-audiomp-base, ad-audiomp
Branch point for: yamt-idlelwp
Changes since 1.77: +2 -3 lines
Diff to previous 1.77 (colored)

Merge newlock2 to head.

Revision 1.77 / (download) - annotate - [select for diffs], Wed Nov 1 10:17:59 2006 UTC (13 years ago) by yamt
Branch: MAIN
CVS Tags: yamt-splraiseipl-base5, yamt-splraiseipl-base4, yamt-splraiseipl-base3, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, newlock2-nbase, newlock2-base, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, matt-nb4-arm-base, matt-nb4-arm
Changes since 1.76: +12 -13 lines
Diff to previous 1.76 (colored)

remove some __unused from function parameters.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Oct 12 01:32:18 2006 UTC (13 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: yamt-splraiseipl-base2
Changes since 1.75: +13 -12 lines
Diff to previous 1.75 (colored)

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386

Revision 1.75 / (download) - annotate - [select for diffs], Sat Sep 23 15:36:12 2006 UTC (13 years, 1 month ago) by xtraeme
Branch: MAIN
Changes since 1.74: +2 -3 lines
Diff to previous 1.74 (colored)

Remove duplicated includes, from Jeff Ito -> PR kern/26113. Thanks.

Revision 1.74 / (download) - annotate - [select for diffs], Sun Jul 23 22:06:11 2006 UTC (13 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: yamt-splraiseipl-base, yamt-pdpolicy-base9, yamt-pdpolicy-base8, yamt-pdpolicy-base7, rpaulo-netinet-merge-pcb-base, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: yamt-splraiseipl, newlock2
Changes since 1.73: +5 -7 lines
Diff to previous 1.73 (colored)

Use the LWP cached credentials where sane.

Revision 1.73 / (download) - annotate - [select for diffs], Wed Jun 7 22:33:41 2006 UTC (13 years, 5 months ago) by kardel
Branch: MAIN
CVS Tags: yamt-pdpolicy-base6, gdamore-uart-base, gdamore-uart, chap-midi-nbase, chap-midi-base
Changes since 1.72: +5 -13 lines
Diff to previous 1.72 (colored)

merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html

Revision 1.72 / (download) - annotate - [select for diffs], Sun May 14 21:15:11 2006 UTC (13 years, 6 months ago) by elad
Branch: MAIN
CVS Tags: yamt-pdpolicy-base5, simonb-timecounters-base
Branch point for: chap-midi
Changes since 1.71: +9 -8 lines
Diff to previous 1.71 (colored)

integrate kauth.

Revision 1.71 / (download) - annotate - [select for diffs], Wed Mar 1 12:38:21 2006 UTC (13 years, 8 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-pdpolicy-base4, yamt-pdpolicy-base3, yamt-pdpolicy-base2, yamt-pdpolicy-base, peter-altq-base, elad-kernelauth-base
Branch point for: yamt-pdpolicy, peter-altq, elad-kernelauth
Changes since 1.70: +3 -3 lines
Diff to previous 1.70 (colored)

merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.

Revision 1.70 / (download) - annotate - [select for diffs], Sat Dec 24 19:12:23 2005 UTC (13 years, 10 months ago) by perry
Branch: MAIN
CVS Tags: yamt-uio_vmspace-base5
Branch point for: yamt-uio_vmspace, simonb-timecounters, rpaulo-netinet-merge-pcb
Changes since 1.69: +4 -4 lines
Diff to previous 1.69 (colored)

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.

Revision 1.69 / (download) - annotate - [select for diffs], Sun Dec 11 12:24:30 2005 UTC (13 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.68: +17 -16 lines
Diff to previous 1.68 (colored)

merge ktrace-lwp.

Revision 1.68 / (download) - annotate - [select for diffs], Wed Dec 7 06:05:20 2005 UTC (13 years, 11 months ago) by thorpej
Branch: MAIN
CVS Tags: ktrace-lwp-base
Changes since 1.67: +21 -62 lines
Diff to previous 1.67 (colored)

Use ANSI function decls.

Revision 1.67 / (download) - annotate - [select for diffs], Sat Oct 29 12:31:07 2005 UTC (14 years ago) by yamt
Branch: MAIN
CVS Tags: yamt-vop-base3, yamt-readahead-pervnode, yamt-readahead-perfile, yamt-readahead-base3, yamt-readahead-base2, yamt-readahead-base, yamt-readahead
Changes since 1.66: +24 -34 lines
Diff to previous 1.66 (colored)

just use ltsleep rather than lockmgr + PCATCH with horrible timeout dance.

Revision 1.66 / (download) - annotate - [select for diffs], Sun Sep 11 17:55:26 2005 UTC (14 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: yamt-vop-base2, yamt-vop-base, thorpej-vnode-attr-base, thorpej-vnode-attr
Branch point for: yamt-vop
Changes since 1.65: +14 -19 lines
Diff to previous 1.65 (colored)

PR/27185: Christian Biere: kqueue: EOF on pipe gains no EVFILT_READ event
Set the PIPE_EOF flag before we wakeup() our peer. While here GC unused
argument from pipeselwakeup() and call it even when fp == NULL.

Revision 1.65 / (download) - annotate - [select for diffs], Fri Apr 1 11:59:37 2005 UTC (14 years, 7 months ago) by yamt
Branch: MAIN
CVS Tags: kent-audio2-base
Branch point for: yamt-lazymbuf
Changes since 1.64: +8 -6 lines
Diff to previous 1.64 (colored)

merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.

Revision 1.64 / (download) - annotate - [select for diffs], Sat Mar 12 18:43:42 2005 UTC (14 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: yamt-km-base4, yamt-km-base3, netbsd-3-base
Branch point for: netbsd-3
Changes since 1.63: +4 -2 lines
Diff to previous 1.63 (colored)

PR/29679: Gunnar.Ritter: fstat() blksize on the write side of the pipe returns
0. Fix it by returning the peer's block size.
XXX: This is the minimal fix. Probably the buffer size should be initialized
somewhere else, but probably this would need some more code changes.

Revision 1.63 / (download) - annotate - [select for diffs], Sat Feb 26 21:34:55 2005 UTC (14 years, 8 months ago) by perry
Branch: MAIN
Changes since 1.62: +8 -8 lines
Diff to previous 1.62 (colored)

nuke trailing whitespace

Revision 1.62 / (download) - annotate - [select for diffs], Tue Nov 30 04:25:44 2004 UTC (14 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: yamt-km-base2, yamt-km-base, kent-audio1-beforemerge, kent-audio1-base, kent-audio1
Branch point for: yamt-km, kent-audio2
Changes since 1.61: +4 -19 lines
Diff to previous 1.61 (colored)

Cloning cleanup:
1. make fileops const
2. add 2 new negative errno's to `officially' support the cloning hack:
    - EDUPFD (used to overload ENODEV)
    - EMOVEFD (used to overload ENXIO)
3. Created an fdclone() function to encapsulate the operations needed for
   EMOVEFD, and made all cloners use it.
4. Centralize the local noop/badop fileops functions to:
   fnullop_fcntl, fnullop_poll, fnullop_kqfilter, fbadop_stat

Revision 1.61 / (download) - annotate - [select for diffs], Sun Nov 21 04:30:33 2004 UTC (14 years, 11 months ago) by yamt
Branch: MAIN
Changes since 1.60: +3 -3 lines
Diff to previous 1.60 (colored)

pipe_direct_write: fallback to non-loan write in the case of
any errors from uvm_loan(), rather than only for ENOMEM, which is
never returned by uvm_loan().

Revision 1.60 / (download) - annotate - [select for diffs], Sun Nov 14 03:30:09 2004 UTC (15 years ago) by atatat
Branch: MAIN
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored)

Wrap TIMEVAL_TO_TIMESPEC and TIMESPEC_TO_TIMEVAL macros in

	do { ... } while(/*CONSTCOND*/0)

so that they can be used unadorned in if/else blocks, etc.  This means
that you now *have* to put a ; at the end of the "call" to these
macros.

Revision 1.59 / (download) - annotate - [select for diffs], Sat Nov 6 02:03:20 2004 UTC (15 years ago) by wrstuden
Branch: MAIN
Changes since 1.58: +34 -2 lines
Diff to previous 1.58 (colored)

Add support for FIONWRITE and FIONSPACE ioctls. FIONWRITE reports
the number of bytes in the send queue, and FIONSPACE reports the
number of free bytes in the send queue. These ioctls permit applications
to monitor file descriptor transmission dynamics.

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

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

FIONWRITE functionality may be used to implement TIOCOUTQ for Linux
emulation - Linux extended this ioctl to sockets, even though they are
not ttys.

Revision 1.58 / (download) - annotate - [select for diffs], Sat Jul 17 20:50:08 2004 UTC (15 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.57: +10 -10 lines
Diff to previous 1.57 (colored)

PRIBIO -> PSOCK.  This emulates the pre-sys_pipe behavior, and avoids including
processes blocked on pipe I/O in the load average.

Revision 1.57 / (download) - annotate - [select for diffs], Sun Apr 25 16:42:41 2004 UTC (15 years, 6 months ago) by simonb
Branch: MAIN
Changes since 1.56: +4 -14 lines
Diff to previous 1.56 (colored)

Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.

Revision 1.56 / (download) - annotate - [select for diffs], Thu Apr 8 06:20:30 2004 UTC (15 years, 7 months ago) by atatat
Branch: MAIN
Changes since 1.55: +16 -8 lines
Diff to previous 1.55 (colored)

Lots of sysctl descriptions (if someone wants to help out here, that
would be good) mostly copied from sysctl(3).  This takes care of the
top-level, most of kern.* and hw.* (modulo the ath and bge stuff), and
all of proc.*.

If you don't want the added rodata in your kernel, use "options
SYSCTL_NO_DESCR" in your kernel config.

Revision 1.55 / (download) - annotate - [select for diffs], Wed Mar 24 20:25:28 2004 UTC (15 years, 7 months ago) by pooka
Branch: MAIN
CVS Tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Changes since 1.54: +6 -6 lines
Diff to previous 1.54 (colored)

* replace incorrect M_WAITOK flag from pool_get() by proper PR_WAITOK
  and remove redundant check for NULL return value
* switch pool page allocator to nointr allocator

jdolecek sayeth ok

Revision 1.54 / (download) - annotate - [select for diffs], Wed Mar 24 15:34:53 2004 UTC (15 years, 7 months ago) by atatat
Branch: MAIN
Changes since 1.53: +16 -9 lines
Diff to previous 1.53 (colored)

Tango on sysctl_createv() and flags.  The flags have all been renamed,
and sysctl_createv() now uses more arguments.

Revision 1.53 / (download) - annotate - [select for diffs], Wed Mar 3 22:00:34 2004 UTC (15 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.52: +6 -6 lines
Diff to previous 1.52 (colored)

No need to initialise [rw]pipe twice.
Initialise locks before trying to allocate pipe buffer, when allocate
fails we'll not explode trying to acquire the locks when tidying up.

Revision 1.52 / (download) - annotate - [select for diffs], Wed Mar 3 21:35:52 2004 UTC (15 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.51: +3 -3 lines
Diff to previous 1.51 (colored)

initialize rpipe and wpipe to NULL, so that they are initialized in the
error path.

Revision 1.51 / (download) - annotate - [select for diffs], Thu Feb 26 08:15:31 2004 UTC (15 years, 8 months ago) by jdolecek
Branch: MAIN
Changes since 1.50: +4 -3 lines
Diff to previous 1.50 (colored)

pipelock() must release the pipe simplelock during tsleep()
fixes PR kern/24551 by Havard Eidnes

Revision 1.50 / (download) - annotate - [select for diffs], Tue Feb 24 20:57:26 2004 UTC (15 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.49: +2 -3 lines
Diff to previous 1.49 (colored)

remove error(1) comment.

Revision 1.49 / (download) - annotate - [select for diffs], Tue Feb 24 15:12:52 2004 UTC (15 years, 8 months ago) by wiz
Branch: MAIN
Changes since 1.48: +3 -3 lines
Diff to previous 1.48 (colored)

occured -> occurred. From Peter Postma.

Revision 1.48 / (download) - annotate - [select for diffs], Sun Feb 22 17:51:25 2004 UTC (15 years, 8 months ago) by jdolecek
Branch: MAIN
Changes since 1.47: +15 -9 lines
Diff to previous 1.47 (colored)

use the new NOTE_SUBMIT to flag if the locking is necessary
for EVFILT_READ/EVFILT_WRITE knotes

fixes PR kern/23915 by Martin Husemann (pipes), and similar locking problem
in tty code

Revision 1.47 / (download) - annotate - [select for diffs], Thu Dec 4 19:38:24 2003 UTC (15 years, 11 months ago) by atatat
Branch: MAIN
Changes since 1.46: +34 -30 lines
Diff to previous 1.46 (colored)

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.

Revision 1.46 / (download) - annotate - [select for diffs], Thu Nov 13 11:59:46 2003 UTC (16 years ago) by yamt
Branch: MAIN
Changes since 1.45: +3 -4 lines
Diff to previous 1.45 (colored)

plug memory leak on error.

Revision 1.45 / (download) - annotate - [select for diffs], Sat Oct 25 09:10:35 2003 UTC (16 years ago) by christos
Branch: MAIN
Changes since 1.44: +4 -2 lines
Diff to previous 1.44 (colored)

fix uninitialized variable

Revision 1.44 / (download) - annotate - [select for diffs], Mon Sep 22 12:59:57 2003 UTC (16 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

- pass signo to fownsignal [ok by jd]
- make urg signal handling use fownsignal
- remove out of band detection in sowakeup

Revision 1.43 / (download) - annotate - [select for diffs], Sun Sep 21 19:17:07 2003 UTC (16 years, 1 month ago) by jdolecek
Branch: MAIN
Changes since 1.42: +15 -32 lines
Diff to previous 1.42 (colored)

cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
  the owner of descriptor, according to appropriate sematics
  of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
  these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
  properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
  in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
  pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@

Revision 1.42 / (download) - annotate - [select for diffs], Sun Sep 14 23:47:09 2003 UTC (16 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.41: +58 -24 lines
Diff to previous 1.41 (colored)

ksiginfo_t support.

Revision 1.41 / (download) - annotate - [select for diffs], Mon Aug 11 10:24:41 2003 UTC (16 years, 3 months ago) by pk
Branch: MAIN
Changes since 1.40: +20 -2 lines
Diff to previous 1.40 (colored)

Workaround to prevent a lockup in pipelock() in the case that signals are
pending while we must wait for the lock.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Jun 29 22:31:26 2003 UTC (16 years, 4 months ago) by fvdl
Branch: MAIN
Branch point for: ktrace-lwp
Changes since 1.39: +22 -22 lines
Diff to previous 1.39 (colored)

Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Jun 28 14:21:56 2003 UTC (16 years, 4 months ago) by darrenr
Branch: MAIN
Changes since 1.38: +24 -24 lines
Diff to previous 1.38 (colored)

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V

Revision 1.38 / (download) - annotate - [select for diffs], Fri Mar 21 21:13:51 2003 UTC (16 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.37: +6 -6 lines
Diff to previous 1.37 (colored)

Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)

Revision 1.37 / (download) - annotate - [select for diffs], Wed Mar 12 23:00:03 2003 UTC (16 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.36: +15 -8 lines
Diff to previous 1.36 (colored)

Validate that pgid argument to TIOCSPGRP in part of current session.
Treat +ve numbers as process group ids and -ve as pids (see tcsetpgrp() in part of current session.
Treat +ve numbers as process group ids and -ve as pids - see tcsetpgrp(3).
(approved by christos)

Revision 1.36 / (download) - annotate - [select for diffs], Fri Feb 14 13:16:44 2003 UTC (16 years, 9 months ago) by pk
Branch: MAIN
Changes since 1.35: +11 -10 lines
Diff to previous 1.35 (colored)

On pipe reads, check for EOF before FNONBLOCK to avoid spurious EAGAIN errors.

Revision 1.35 / (download) - annotate - [select for diffs], Wed Feb 12 21:54:16 2003 UTC (16 years, 9 months ago) by pk
Branch: MAIN
Changes since 1.34: +430 -1009 lines
Diff to previous 1.34 (colored)

Make the pipe code mostly MP-safe.  There are a few unaddressed race
conditions at points where it's necessary to access both the up-stream
and down-stream parts of the bi-directional pipe data structure. These
are marked `XXXSMP' in the code.

Also, since the changes are pretty invasive, there little point in keeping
all the "#ifdef FreeBSD" code around; so all of that has been stripped out.

Revision 1.34 / (download) - annotate - [select for diffs], Sat Feb 1 06:23:44 2003 UTC (16 years, 9 months ago) by thorpej
Branch: MAIN
Changes since 1.33: +4 -2 lines
Diff to previous 1.33 (colored)

Add extensible malloc types, adapted from FreeBSD.  This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.

Revision 1.33 / (download) - annotate - [select for diffs], Sat Jan 18 10:06:34 2003 UTC (16 years, 10 months ago) by thorpej
Branch: MAIN
Changes since 1.32: +7 -4 lines
Diff to previous 1.32 (colored)

Merge the nathanw_sa branch.

Revision 1.32 / (download) - annotate - [select for diffs], Thu Dec 5 16:30:55 2002 UTC (16 years, 11 months ago) by jdolecek
Branch: MAIN
CVS Tags: nathanw_sa_before_merge, nathanw_sa_base, gmcgarry_ucred_base, gmcgarry_ucred, gmcgarry_ctxsw_base, gmcgarry_ctxsw, fvdl_fs64_base
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (colored)

pipe_stat(): add S_IRUSR and S_IWUSR to mode; this is what Linux does,
and seems like generally sensible (more sensible than not doing so), so done
in generic code rather than compat glue only

Change proposed in PR kern/18767 by Emmanuel Dreyfus.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Nov 26 18:44:35 2002 UTC (16 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.30: +8 -8 lines
Diff to previous 1.30 (colored)

si_ -> sel_ to avoid conflicts with siginfo.

Revision 1.30 / (download) - annotate - [select for diffs], Sat Nov 2 07:25:23 2002 UTC (17 years ago) by perry
Branch: MAIN
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)

/*CONTCOND*/ while (0)'ed macros

Revision 1.29 / (download) - annotate - [select for diffs], Fri Nov 1 21:46:51 2002 UTC (17 years ago) by kristerw
Branch: MAIN
Changes since 1.28: +3 -2 lines
Diff to previous 1.28 (colored)

ISO C requires a statement after a label.

Revision 1.28 / (download) - annotate - [select for diffs], Fri Nov 1 21:34:30 2002 UTC (17 years ago) by jdolecek
Branch: MAIN
Changes since 1.27: +4 -4 lines
Diff to previous 1.27 (colored)

pipe_read(): initialize ocnt before pipelock() call; it might have been
used unitialized when the pipelock() call would fail
bug found by Krister Walfridsson

Revision 1.27 / (download) - annotate - [select for diffs], Wed Oct 23 09:14:22 2002 UTC (17 years ago) by jdolecek
Branch: MAIN
CVS Tags: kqueue-aftermerge
Changes since 1.26: +63 -39 lines
Diff to previous 1.26 (colored)

merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe

Revision 1.26 / (download) - annotate - [select for diffs], Sun Aug 25 23:16:39 2002 UTC (17 years, 2 months ago) by thorpej
Branch: MAIN
CVS Tags: kqueue-beforemerge, kqueue-base, gehenna-devsw-base
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

Fix signed/unsigned comparison warnings from GCC 3.3.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Mar 17 19:41:07 2002 UTC (17 years, 8 months ago) by atatat
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6, eeh-devprop-base, eeh-devprop
Branch point for: gehenna-devsw
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command".  ERESTART is -1, which can lead to
confusion.  ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4.  No ioctl code should now return -1 anywhere.  The
ioctl() system call is now properly restartable.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Mar 13 21:50:24 2002 UTC (17 years, 8 months ago) by jdolecek
Branch: MAIN
Changes since 1.23: +290 -103 lines
Diff to previous 1.23 (colored)

Merge the update to FreeBSD rev 1.95.
Changes:
* MP locking changes (mostly FreeBSD specific)
  XXXSMP the MP locking macros are noops on NetBSD for now
* kevent fix (FreeBSD rev. 1.87): 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
* kill __P

Revision 1.23 / (download) - annotate - [select for diffs], Fri Mar 8 20:48:41 2002 UTC (17 years, 8 months ago) by thorpej
Branch: MAIN
CVS Tags: newlock-base, newlock
Changes since 1.22: +3 -4 lines
Diff to previous 1.22 (colored)

Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Feb 28 04:43:16 2002 UTC (17 years, 8 months ago) by thorpej
Branch: MAIN
CVS Tags: ifpoll-base
Changes since 1.21: +7 -7 lines
Diff to previous 1.21 (colored)

Don't assign NULL to non-pointer variables.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Dec 18 08:49:40 2001 UTC (17 years, 11 months ago) by chs
Branch: MAIN
Changes since 1.20: +5 -4 lines
Diff to previous 1.20 (colored)

unmap loaned pages before dropping the loan.  some pmaps aren't
expecting pmap_kenter_pa() to be used to replace an existing mapping,
plus it just seems like a bad idea to keep around mappings of pages
that may be freed and reused.

Revision 1.20 / (download) - annotate - [select for diffs], Tue Dec 11 18:15:09 2001 UTC (17 years, 11 months ago) by jdolecek
Branch: MAIN
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored)

fix typo in #ifdef __FreeBSD__
Pointed out by Chris Jepeway in private e-mail, thanks!

Revision 1.19 / (download) - annotate - [select for diffs], Mon Nov 12 15:25:24 2001 UTC (18 years ago) by lukem
Branch: MAIN
CVS Tags: thorpej-mips-cache-base
Changes since 1.18: +4 -1 lines
Diff to previous 1.18 (colored)

add RCSIDs

Revision 1.18 / (download) - annotate - [select for diffs], Tue Nov 6 07:30:15 2001 UTC (18 years ago) by chs
Branch: MAIN
Changes since 1.17: +64 -62 lines
Diff to previous 1.17 (colored)

use pmap_kenter_pa() instead of pmap_enter(), this is required for
pages loaned to the kernel.  this implies that we also need to
call pmap_kremove() before uvm_km_free().

other general cleanup:  remove argument names from prototypes,
rename some variables, etc.

Revision 1.17 / (download) - annotate - [select for diffs], Sun Oct 28 20:47:15 2001 UTC (18 years ago) by jdolecek
Branch: MAIN
Changes since 1.16: +8 -2 lines
Diff to previous 1.16 (colored)

Avoid using microtime(9) for atime/mtime, we don't need to have it
THAT accurate and microtime(9) is painlessly slow on i386 currently.
This speeds up small transfers much. The gain for large transfers
is less significant, but notable too.
Bottleneck was found by Andreas Persson (Re: kern/14246).

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

buffersize     before    after
512            17        49
1024           33        110
2048           52        143
4096           77        163
8192           142       190
64K            577       662
128K           372       392

Revision 1.16 / (download) - annotate - [select for diffs], Mon Oct 8 07:50:17 2001 UTC (18 years, 1 month ago) by mycroft
Branch: MAIN
CVS Tags: thorpej-devvp-base3
Branch point for: thorpej-mips-cache
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

When a pipe was grown to BIG_PIPE_SIZE, we could get in a select()/write() loop
because pipe_poll() and pipe_write() did not agree on when it was okay to write
more data.  Fix pipe_write(), since it seems to be the broken one.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Sep 29 13:48:11 2001 UTC (18 years, 1 month ago) by jdolecek
Branch: MAIN
CVS Tags: thorpej-devvp-base2
Changes since 1.14: +12 -13 lines
Diff to previous 1.14 (colored)

Update the uio resid counts appropriately when any error occurs
(not just EPIPE), so that the higher-level code would note partial
write has happened and DTRT if the write was interrupted due to
e.g. delivery of signal.

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

Note: EPIPE/SIGPIPE delivery behaviour was retained - they're delivered
even if the write was partially successful.

Revision 1.14 / (download) - annotate - [select for diffs], Tue Sep 25 19:01:21 2001 UTC (18 years, 1 month ago) by jdolecek
Branch: MAIN
Changes since 1.13: +23 -19 lines
Diff to previous 1.13 (colored)

Take care to transfer whole buffer passed via write(2); write(2) should
not do short writes unless when using non-blocking I/O.
This fixes kern/13744 by Geoff C. Wing.

Note this partially undoes rev. 1.5 change. Upon closer examination,
it's been apparent that hbench-OS expectations were not actually justified.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Sep 22 05:58:04 2001 UTC (18 years, 1 month ago) by jdolecek
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

add new UVM_LOAN_WIRED flag - the memory pages loaned in TOPAGE case
are only wired if this flag is present (i.e. they are not wired by default now)
loaned pages are unloaned via new uvm_unloan(), uvm_unloananon() and
uvm_unloanpage() are no longer exported
adjust uvm_unloanpage() to unwire the pages if UVM_LOAN_WIRED is specified
mark uvm_loanuobj() and uvm_loanzero() static also in function implementation

kern/sys_pipe.c: uvm_unloanpage() --> uvm_unloan()

Revision 1.12 / (download) - annotate - [select for diffs], Thu Sep 20 19:09:13 2001 UTC (18 years, 2 months ago) by jdolecek
Branch: MAIN
Changes since 1.11: +4 -3 lines
Diff to previous 1.11 (colored)

call pmap_update() after pmap_enter()s
ALWAYS call uvm_unloanpage() in cleanup - it's necessary even
in pipe_loan_free() case, since uvm_km_free() doesn't seem
to implicitly unloan the loaned pages

Revision 1.11 / (download) - annotate - [select for diffs], Thu Jul 26 14:14:28 2001 UTC (18 years, 3 months ago) by jdolecek
Branch: MAIN
CVS Tags: thorpej-devvp-base, pre-chs-ubcperf, post-chs-ubcperf
Branch point for: thorpej-devvp
Changes since 1.10: +6 -28 lines
Diff to previous 1.10 (colored)

pipe_create(): explicitly zero whole memory returned from pool_get(), instead
of some selective pieces. This fixes problem with NEW_PIPE in kernels
with DEBUG option, reported via e-mail by Chuck Silvers.

sys_pipe(): g/c fdp, provide it at the chunk of FreeBSD code where it's used

Revision 1.10 / (download) - annotate - [select for diffs], Wed Jul 18 06:51:38 2001 UTC (18 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

bcopy -> memcpy

Revision 1.9 / (download) - annotate - [select for diffs], Wed Jul 18 06:48:27 2001 UTC (18 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (colored)

bzero -> memset

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jul 17 18:21:59 2001 UTC (18 years, 4 months ago) by jdolecek
Branch: MAIN
Changes since 1.7: +4 -4 lines
Diff to previous 1.7 (colored)

comment police

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jul 17 18:18:52 2001 UTC (18 years, 4 months ago) by jdolecek
Branch: MAIN
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

fix bogus uio->uio_offset check introduced in rev. 1.5, which effectively
disabled loans for writes (a.k.a "direct write"), oops; use uio->uio_resid
for the check instead

don't bother updating uio->uio_offset in pipe_direct_write(), it's not used
by upper layers anyway

Revision 1.6 / (download) - annotate - [select for diffs], Tue Jul 17 06:05:28 2001 UTC (18 years, 4 months ago) by jdolecek
Branch: MAIN
Changes since 1.5: +13 -7 lines
Diff to previous 1.5 (colored)

only allocate buffer kva for the end which needs it

Revision 1.5 / (download) - annotate - [select for diffs], Mon Jul 2 20:43:39 2001 UTC (18 years, 4 months ago) by jdolecek
Branch: MAIN
Branch point for: kqueue
Changes since 1.4: +108 -122 lines
Diff to previous 1.4 (colored)

Don't try to be too smart about chunking - if the data size is bigger
than PIPE_CHUNK_SIZE, just transfer first PIPE_CHUNK_SIZE and return short
write, expecting the caller to call us again later (if they need). Previous
behaviour (besides being wrong for O_NONBLOCK reads) hung hbench under some
circumstances and other applications may have similar expectations as hbench.
This might also fix port-vax/13333 by Manuel Bowyer.

Other changes to pipe_direct_write() include:
* return short write (and success) on EOF if any data were already read;
  we return EPIPE on next write(2) call
* simplify error handling, actually handle uvm_loan() failure correctly,
  call pipe_loan_free() on error explicitly and only call uvm_unloan()
  if the address space was _not_ already freed by pipe_loan_free()
  Thanks Chuck Silvers for uvm_unloan() hints :)

Fallthough to common write in pipe_write() if pipe_direct_write()
returns ENOMEM, otherwise always break out immediatelly.
Use uvm_km_valloc_wait() instead uvm_km_valloc() in pipe_loan_alloc().

Revision 1.4 / (download) - annotate - [select for diffs], Thu Jun 21 18:59:51 2001 UTC (18 years, 5 months ago) by jdolecek
Branch: MAIN
Branch point for: nathanw_sa
Changes since 1.3: +1 -5 lines
Diff to previous 1.3 (colored)

Don't include opt_new_pipe.h, it's not needed here

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 21 18:46:22 2001 UTC (18 years, 5 months ago) by jdolecek
Branch: MAIN
Changes since 1.2: +30 -30 lines
Diff to previous 1.2 (colored)

Oops, fell into rpipe/wpipe trap:
The end we want to do selwakeup() on is not necessarily same as the one
we send SIGIO to. Make pipeselwakeup() accept two parameters and update
callers accordingly. This change fixes behaviour for code, which does
select(2)s on the write end waiting for reader (watched on gv, the problem
manifestated itself as a too long delay before the document was displayed).

Clearly separate the resource free code for FreeBSD
and NetBSD case in pipeclose(), so that it's a bit clearer what's going on.
Also LK_DRAIN the lock before the memory is returned to pipe_pool.

Add missing wakeup() in pipe_write() for PIPE_WANTCLOSE case.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Jun 16 12:00:02 2001 UTC (18 years, 5 months ago) by jdolecek
Branch: MAIN
Changes since 1.1: +750 -218 lines
Diff to previous 1.1 (colored)

Add port of high performance pipe implementation written by John S. Dyson
for FreeBSD project. Besides huge speed boost compared with socketpair-based
pipes, this implementation also uses pagable kernel memory instead of mbufs.

Significant differences to FreeBSD version:
* uses uvm_loan() facility for direct write
* async/SIGIO handling correct also for sync writer, async reader
* limits settable via sysctl, amountpipekva and nbigpipes available via sysctl
* pipes are unidirectional - this is enforced on file descriptor level
	for now only, the code would be updated to take advantage of it
	eventually
* uses lockmgr(9)-based locks instead of home brew variant
* scatter-gather write is handled correctly for direct write case, data
  is transferred by PIPE_DIRECT_CHUNK bytes maximum, to avoid running out of kva

All FreeBSD/NetBSD specific code is within appropriate #ifdef, in preparation
to feed changes back to FreeBSD tree.

This pipe implementation is optional for now, add 'options NEW_PIPE'
to your kernel config to use it.

Revision 1.1 / (download) - annotate - [select for diffs], Sat Jun 16 09:21:34 2001 UTC (18 years, 5 months ago) by jdolecek
Branch: MAIN

Initial revision

This form allows you to request diff's 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.




CVSweb <webmaster@jp.NetBSD.org>