mq_open(3) Library Functions Manual mq_open(3) mq_open - LIBRARY Real-time library (librt, -lrt) #include /* O_* */ #include /* mode */ #include mqd_t mq_open(const char *name, int oflag); mqd_t mq_open(const char *name, int oflag, mode_t mode, struct mq_attr *attr); mq_open() POSIX . name. name, mq_overview(7). oflag , ( ). oflag : O_RDONLY . O_WRONLY . O_RDWR . oflag , : O_CLOEXEC ( Linux 2.6.26) close-on-exec . open(2). O_CREAT , . (ID ) ID . - (ID ) ID . O_EXCL oflag O_CREAT name , EEXIST. O_NONBLOCK . , - mq_receive(3) mq_send(3), , , EAGAIN. oflag O_CREAT, . mode , open(2) ( , ). umask . struct mq_attr, attr, , . : struct mq_attr { long mq_flags; /* ( mq_open()) */ long mq_maxmsg; /* . - */ long mq_msgsize; /* . ( ) */ long mq_curmsgs; /* - ( mq_open()) */ }; mq_open() mq_maxmsg mq_msgsize; . attr NULL, , . Linux 3.5, /proc; mq_overview(7). mq_open() . mq_open() (mqd_t) -1, errno . EACCES , mode . EACCES name . EEXIST oflag O_CREAT O_EXCL, name . EINVAL name , mq_overview(7). EINVAL oflag O_CREAT attr NULL, attr->mq_maxmsg attr->mq_msqsize . . ( CAP_SYS_RESOURCE), attr->mq_maxmsg msg_max attr->mq_msgsize msgsize_max. , , attr->mq_maxmsg HARD_MAX ( mq_overview(7)). EMFILE ( RLIMIT_NOFILE getrlimit(2)). ENAMETOOLONG name. ENFILE . ENOENT oflag O_CREAT name. ENOENT name <> . ENOMEM . ENOSPC . , - queues_max; mq_overview(7). attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |mq_open() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ C mq_open() . , name (/) EINVAL, . name , C name (. ., name+1). POSIX.1-2008. POSIX.1-2001. Before Linux 2.6.14, the process umask was not applied to the permissions specified in mode. . mq_close(3), mq_getattr(3), mq_notify(3), mq_receive(3), mq_send(3), mq_unlink(3), mq_overview(7) aereiae , Alexey , Azamat Hackimov , Dmitriy S. Seregin , Dmitry Bolkhovskikh , ITriskTI , Max Is , Yuri Kozlov , ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . mq_open(3)