1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
.TH PEX 3
.SH NAME
pex, unpex \- obtain process-exclusive file access
.SH SYNOPSIS
.B #include <sys/pex.h>
.PP
.B int pex(fd, seconds, pexbuf)
.br
.B struct pexclude *pexbuf;
.PP
.B int unpex(fd, seconds)
.SH DESCRIPTION
.I Pex
tries, using the
.CW FIOPX
ioctl call, to obtain exclusive access to the file designated by
file descriptor
.IR fd ;
see
.IR pex (4).
If
.I pexbuf
is nonzero, facts about the
other end of the pipe are placed in the object
.I pexbuf
points to, as described in
.IR pex (4).
.PP
If
.I fd
refers to a stream,
.I pex
first empties the input and output queues,
flushing if
.I seconds
is negative, and otherwise waiting up to the specified
time interval for the queues to drain.
If the queues do not drain, an error results.
.PP
.I Unpex
uses
.CW FIONPX
to try to reverse the effect of
.I pex,
again flushing or draining queues as specified by
.I seconds.
.PP
On a pipe,
.I pex
or
.I unpex
succeeds only if the process at the other end answers
with an FIOPX or FIONPX ioctl respectively.
.I Pex
and
.I unpex
should not be used to answer.
.SH SEE ALSO
.IR pex (4)
.SH DIAGNOSTICS
.I Pex
returns \-1 on failure, 0 on success, and 1 for a half-pexed
pipe.
|