pipe 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .TH PIPE 3
  2. .SH NAME
  3. pipe \- two-way interprocess communication
  4. .SH SYNOPSIS
  5. .B bind #|
  6. .I dir
  7. .nf
  8. .IB dir /data
  9. .IB dir /data1
  10. .fi
  11. .SH DESCRIPTION
  12. .PP
  13. An
  14. .IR attach (5)
  15. of this device allocates two new cross-connected I/O streams,
  16. .IB dir /data
  17. and
  18. .IB dir /data1\f1.
  19. .PP
  20. Data written to one channel becomes available for reading at
  21. the other.
  22. Write boundaries are preserved: each read terminates
  23. when the read buffer is full or after reading the last byte
  24. of a write, whichever comes first.
  25. .PP
  26. Writes are atomic up to a certain size, typically 32768 bytes,
  27. that is, each write will be delivered in a single read by the
  28. recipient, provided the receiving buffer is large enough.
  29. .PP
  30. If there are multiple writers, each
  31. .I write
  32. is guaranteed to be available in a contiguous piece at the other
  33. end of the pipe.
  34. If there are multiple readers, each read will return data from only
  35. one write.
  36. .PP
  37. The
  38. .IR pipe (2)
  39. system call performs an
  40. .I attach
  41. of this device and returns file descriptors to the new pipe's
  42. .B data
  43. and
  44. .B data1
  45. files.
  46. The files are open with mode
  47. .BR ORDWR .
  48. .SH "SEE ALSO"
  49. .IR pipe (2)
  50. .SH SOURCE
  51. .B /sys/src/9/port/devpipe.c