xref: /freebsd/lib/librt/mq_getfd_np.3 (revision ca2413d216197fd55f9363d6f65c641ff1aa3ec5)
1.\"
2.\" Copyright (c) 2024 Rick Parrish <unitrunker@unitrunker.net>
3.\"
4.\" SPDX-License-Identifier: BSD-2-Clause
5.\"
6.Dd December 18, 2025
7.Dt MQ_GETFD_NP 3
8.Os
9.Sh NAME
10.Nm mq_getfd_np
11.Nd get a file descriptor for an open message queue descriptor
12.Sh SYNOPSIS
13.Lb librt
14.In mqueue.h
15.Ft int
16.Fn mq_getfd_np "mqd_t mqd"
17.Sh DESCRIPTION
18The
19.Nm
20function retrieves the underlying file descriptor
21from the given message queue descriptor returned from
22.Xr mq_open 2 .
23The file descriptor is used by other functions
24to refer to that message queue.
25The
26.Fa mqd
27argument must be an open message queue descriptor.
28.Sh IMPLEMENTATION NOTES
29.Fx
30implements retrieval or alteration of message queue attributes
31based on the file descriptor.
32The open file descriptor is copied into a child after
33.Xr fork 2 .
34The
35.Xr fstat 2 ,
36.Xr fchmod 2 ,
37and
38.Xr fchown 2
39system calls are supported for the file descriptor.
40.Pp
41The file descriptor is safe to use so long as
42the message queue descriptor remains open.
43.Sh RETURN VALUES
44Upon successful completion, the function returns a file descriptor.
45.Sh ERRORS
46The
47.Nm
48function does not return any errors.
49.Sh SEE ALSO
50.Xr mq_close 2 ,
51.Xr mq_open 2 ,
52.Xr mqueuefs 4
53.Sh HISTORY
54Support for the
55.Nm
56function first appeared in
57.Fx 11.0 .
58