1.\"
2.\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org>
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd November 24, 2017
28.Dt sysdecode_fcntl_arg 3
29.Os
30.Sh NAME
31.Nm sysdecode_fcntl_arg ,
32.Nm sysdecode_fcntl_arg_p
33.Nd output description of fcntl argument
34.Sh LIBRARY
35.Lb libsysdecode
36.Sh SYNOPSIS
37.In sysdecode.h
38.Ft void
39.Fn sysdecode_fcntl_arg "FILE *fp" "int cmd" "uintptr_t arg" "int base"
40.Ft bool
41.Fn sysdecode_fcntl_arg_p "int cmd"
42.Sh DESCRIPTION
43The
44.Fn sysdecode_fcntl_arg
45function outputs a text description of the optional
46.Fa arg
47argument to
48.Xr fcntl 2
49to the stream
50.Fa fp .
51The type and format of
52.Fa arg
53are determined by
54.Fa cmd :
55.Bl -column ".Dv F_SETLKW" "Vt struct flock *"
56.It Sy Command Ta Fa arg Sy Type Ta Sy Output Format
57.It
58.It Dv F_SETFD Ta Vt int Ta
59.Dq FD_CLOEXEC
60or the value of
61.Fa arg
62in the indicated
63.Fa base
64.Pq one of 8, 10, or 16 .
65.It
66.It Dv F_SETFL Ta Vt int Ta
67File flags as output by
68.Xr sysdecode_fcntl_fileflags 3
69with any unknown or remaining bits output in hexadecimal.
70.It
71.It Dv F_GETLK Ta Vt struct flock * Ta
72.It Dv F_SETLK Ta Vt struct flock * Ta
73.It Dv F_SETLKW Ta Vt struct flock * Ta
74The value of
75.Fa arg
76using the
77.Dq %p
78conversion specification.
79.It
80.It Others Ta Vt int Ta
81The value of
82.Fa arg
83in the indicated
84.Fa base
85.Pq one of 8, 10, or 16 .
86.El
87.Pp
88The
89.Fn sysdecode_fcntl_arg_p
90function can be used to determine if a
91.Xr fcntl 2
92command uses the optional third argument to
93.Xr fcntl 2 .
94The function returns
95.Dv true
96if
97.Fa cmd
98accepts a third argument to
99.Xr fcntl 2
100and
101.Dv false
102if it does not.
103.Sh RETURN VALUES
104The
105.Nm sysdecode_fcntl_arg_p
106function returns
107.Dv true
108if
109.Fa cmd
110accepts a third argument to
111.Xr fcntl 2
112and
113.Dv false
114if it does not.
115.Sh SEE ALSO
116.Xr sysdecode 3 ,
117.Xr sysdecode_fcntl_cmd 3 ,
118.Xr sysdecode_fcntl_fileflags 3
119