Reference

mq_getfd_np(3)

get a file descriptor for an open message queue descriptor

NAME

mq_getfd_np – get a file descriptor for an open message queue descriptor

SYNOPSIS

library “librt”

#include <mqueue.h>

int

mq_getfd_np(mqd_t mqd);

DESCRIPTION

The mq_getfd_np function retrieves the underlying file descriptor from the given message queue descriptor returned from mq_open(2). The file descriptor is used by other functions to refer to that message queue. The mqd argument must be an open message queue descriptor.

IMPLEMENTATION NOTES

FreeBSD implements retrieval or alteration of message queue attributes based on the file descriptor. The open file descriptor is copied into a child after fork(2). The fstat(2), fchmod(2), and fchown(2) system calls are supported for the file descriptor.

The file descriptor is safe to use so long as the message queue descriptor remains open.

RETURN VALUES

Upon successful completion, the function returns a file descriptor.

ERRORS

The mq_getfd_np function does not return any errors.

SEE ALSO

mq_close(2), mq_open(2), mqueuefs(4)

HISTORY

Support for the mq_getfd_np function first appeared in FreeBSD 11.0.