Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


msgctl(3p) — Linux manual page

PROLOG |NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |ERRORS |EXAMPLES |APPLICATION USAGE |RATIONALE |FUTURE DIRECTIONS |SEE ALSO |COPYRIGHT

MSGCTL(3P)              POSIX Programmer's ManualMSGCTL(3P)

PROLOG        top

       This manual page is part of the POSIX Programmer's Manual.  The       Linux implementation of this interface may differ (consult the       corresponding Linux manual page for details of Linux behavior), or       the interface may not be implemented on Linux.

NAME        top

       msgctl — XSI message control operations

SYNOPSIS        top

       #include <sys/msg.h>       int msgctl(intmsqid, intcmd, struct msqid_ds *buf);

DESCRIPTION        top

       Themsgctl() function operates on XSI message queues (see the Base       Definitions volume of POSIX.1‐2017,Section 3.226,Message Queue).       It is unspecified whether this function interoperates with the       realtime interprocess communication facilities defined inSection2.8,Realtime.       Themsgctl() function shall provide message control operations as       specified bycmd.  The following values forcmd, and the message       control operations they specify, are:       IPC_STAT    Place the current value of each member of themsqid_ds                   data structure associated withmsqid into the                   structure pointed to bybuf.  The contents of this                   structure are defined in<sys/msg.h>.       IPC_SET     Set the value of the following members of themsqid_ds                   data structure associated withmsqid to the                   corresponding value found in the structure pointed to                   bybuf:                       msg_perm.uid                       msg_perm.gid                       msg_perm.mode                       msg_qbytes                   Also, themsg_ctime timestamp shall be set to the                   current time, as described inSection 2.7.1,IPCGeneral Description.                   IPC_SET can only be executed by a process with                   appropriate privileges or that has an effective user                   ID equal to the value ofmsg_perm.cuidormsg_perm.uid                   in themsqid_dsdata structure associated withmsqid.                   Only a process with appropriate privileges can raise                   the value ofmsg_qbytes.       IPC_RMID    Remove the message queue identifier specified bymsqid                   from the system and destroy the message queue andmsqid_dsdata structure associated with it. IPC_RMD                   can only be executed by a process with appropriate                   privileges or one that has an effective user ID equal                   to the value ofmsg_perm.cuidormsg_perm.uidin themsqid_dsdata structure associated withmsqid.

RETURN VALUE        top

       Upon successful completion,msgctl() shall return 0; otherwise, it       shall return -1 and seterrno to indicate the error.

ERRORS        top

       Themsgctl() function shall fail if:EACCESThe argumentcmd is IPC_STAT and the calling process does              not have read permission; seeSection 2.7,XSI InterprocessCommunication.EINVALThe value ofmsqid is not a valid message queue identifier;              or the value ofcmd is not a valid command.EPERMThe argumentcmd is IPC_RMID or IPC_SET and the effective              user ID of the calling process is not equal to that of a              process with appropriate privileges and it is not equal to              the value ofmsg_perm.cuidormsg_perm.uidin the data              structure associated withmsqid.EPERMThe argumentcmd is IPC_SET, an attempt is being made to              increase to the value ofmsg_qbytes, and the effective user              ID of the calling process does not have appropriate              privileges.The following sections are informative.

EXAMPLES        top

       None.

APPLICATION USAGE        top

       The POSIX Realtime Extension defines alternative interfaces for       interprocess communication (IPC). Application developers who need       to use IPC should design their applications so that modules using       the IPC routines described inSection 2.7,XSI InterprocessCommunication can be easily modified to use the alternative       interfaces.

RATIONALE        top

       None.

FUTURE DIRECTIONS        top

       None.

SEE ALSO        top

Section 2.7,XSI Interprocess Communication,Section 2.8,Realtime,mq_close(3p),mq_getattr(3p),mq_notify(3p),mq_open(3p),mq_receive(3p),mq_send(3p),mq_setattr(3p),mq_unlink(3p),msgget(3p),msgrcv(3p),msgsnd(3p)       The Base Definitions volume of POSIX.1‐2017,Section 3.226,Message Queue,sys_msg.h(0p)

COPYRIGHT        top

       Portions of this text are reprinted and reproduced in electronic       form from IEEE Std 1003.1-2017, Standard for Information       Technology -- Portable Operating System Interface (POSIX), The       Open Group Base Specifications Issue 7, 2018 Edition, Copyright       (C) 2018 by the Institute of Electrical and Electronics Engineers,       Inc and The Open Group.  In the event of any discrepancy between       this version and the original IEEE and The Open Group Standard,       the original IEEE and The Open Group Standard is the referee       document. The original Standard can be obtained online athttp://www.opengroup.org/unix/online.html .       Any typographical or formatting errors that appear in this page       are most likely to have been introduced during the conversion of       the source files to man page format. To report such errors, seehttps://www.kernel.org/doc/man-pages/reporting_bugs.html .IEEE/The Open Group                2017MSGCTL(3P)

Pages that refer to this page:sys_msg.h(0p)ipcrm(1p)mq_close(3p)mq_getattr(3p)mq_notify(3p)mq_open(3p)mq_receive(3p)mq_setattr(3p)mq_unlink(3p)msgget(3p)msgrcv(3p)msgsnd(3p)



HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2025 Movatter.jp