DosMakePipe: Difference between revisions
Appearance
Created page with "==Description== This call creates a pipe. ==Syntax== <PRE> DosMakePipe (ReadHandle, WriteHandle, PipeSize) </PRE> ==Parameters== ; ReadHandle (PHFILE) - output : Addre..." |
mNo edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This call creates a pipe. | This call creates a pipe. | ||
==Syntax== | ==Syntax== | ||
DosMakePipe (ReadHandle, WriteHandle, PipeSize) | |||
DosMakePipe | |||
==Parameters== | ==Parameters== | ||
; ReadHandle (PHFILE) - output : Address of the read handle of the pipe. | ;ReadHandle (PHFILE) - output: Address of the read handle of the pipe. | ||
;WriteHandle (PHFILE) - output: Address of the write handle of the pipe. | |||
; WriteHandle (PHFILE) - output : Address of the write handle of the pipe. | ;PipeSize (USHORT) - input: Storage size, in bytes, to reserve for the pipe. | ||
; PipeSize (USHORT) - input : Storage size, in bytes, to reserve for the pipe. | |||
==Return Code== | ==Return Code== | ||
;rc (USHORT) - return:Return code descriptions are: | |||
*0 NO_ERROR | |||
Return code descriptions are: | *4 ERROR_TOO_MANY_OPEN_FILES | ||
*8 ERROR_NOT_ENOUGH_MEMORY | |||
* 0 | *109 ERROR_BROKEN_PIPE | ||
* 4 | |||
* 8 | |||
* 109 | |||
==Remarks== | ==Remarks== | ||
Line 30: | Line 21: | ||
When there is insufficient space in a pipe for the data being written, a requesting thread blocks until enough data is removed to allow the write request to be satisfied. If the PipeSize parameter is 0, then the pipe is created with a default size of 512 bytes. | When there is insufficient space in a pipe for the data being written, a requesting thread blocks until enough data is removed to allow the write request to be satisfied. If the PipeSize parameter is 0, then the pipe is created with a default size of 512 bytes. | ||
When all users close the handles, a pipe is deleted. If two processes are communicating by a pipe and the process reading the pipe ends, the next write gets the "ERROR_BROKEN_PIPE" error code. | When all users close the handles, a pipe is deleted. If two processes are communicating by a pipe and the process reading the pipe ends, the next write gets the "ERROR_BROKEN_PIPE" error code. | ||
== | ==Bindings== | ||
===C | ===C=== | ||
<PRE> | <PRE> | ||
#define INCL_DOSQUEUES | #define INCL_DOSQUEUES | ||
Line 40: | Line 30: | ||
USHORT rc = DosMakePipe(ReadHandle, WriteHandle, PipeSize); | USHORT rc = DosMakePipe(ReadHandle, WriteHandle, PipeSize); | ||
PHFILE | PHFILE ReadHandle; /* Address to put read handle (returned) */ | ||
PHFILE | PHFILE WriteHandle; /* Address to put write handle (returned) */ | ||
USHORT | USHORT PipeSize; /* Size to reserve for the pipe */ | ||
USHORT | USHORT rc; /* return code */ | ||
</PRE> | </PRE> | ||
===MASM | ===MASM=== | ||
<PRE> | <PRE> | ||
EXTRN DosMakePipe:FAR | EXTRN DosMakePipe:FAR | ||
Line 59: | Line 49: | ||
Returns WORD | Returns WORD | ||
</PRE> | </PRE> | ||
[[Category: | [[Category:Dos16]] |
Latest revision as of 04:46, 26 January 2020
This call creates a pipe.
Syntax
DosMakePipe (ReadHandle, WriteHandle, PipeSize)
Parameters
- ReadHandle (PHFILE) - output
- Address of the read handle of the pipe.
- WriteHandle (PHFILE) - output
- Address of the write handle of the pipe.
- PipeSize (USHORT) - input
- Storage size, in bytes, to reserve for the pipe.
Return Code
- rc (USHORT) - return
- Return code descriptions are:
- 0 NO_ERROR
- 4 ERROR_TOO_MANY_OPEN_FILES
- 8 ERROR_NOT_ENOUGH_MEMORY
- 109 ERROR_BROKEN_PIPE
Remarks
Pipes are mechanisms used within a closely related group of processes. There are no control, permission mechanisms, or checks performed on operations to pipes.
When there is insufficient space in a pipe for the data being written, a requesting thread blocks until enough data is removed to allow the write request to be satisfied. If the PipeSize parameter is 0, then the pipe is created with a default size of 512 bytes.
When all users close the handles, a pipe is deleted. If two processes are communicating by a pipe and the process reading the pipe ends, the next write gets the "ERROR_BROKEN_PIPE" error code.
Bindings
C
#define INCL_DOSQUEUES USHORT rc = DosMakePipe(ReadHandle, WriteHandle, PipeSize); PHFILE ReadHandle; /* Address to put read handle (returned) */ PHFILE WriteHandle; /* Address to put write handle (returned) */ USHORT PipeSize; /* Size to reserve for the pipe */ USHORT rc; /* return code */
MASM
EXTRN DosMakePipe:FAR INCL_DOSQUEUES EQU 1 PUSH@ WORD ReadHandle ;Read handle (returned) PUSH@ WORD WriteHandle ;Write handle (returned) PUSH WORD PipeSize ;Size to reserve for the pipe CALL DosMakePipe Returns WORD