Back to index

glibc  2.9
Classes | Functions
msgctl.c File Reference
#include <errno.h>
#include <sys/msg.h>
#include <ipc_priv.h>
#include <sysdep.h>
#include <string.h>
#include <sys/syscall.h>
#include <bp-checks.h>
#include <kernel-features.h>
#include <shlib-compat.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  __old_msqid_ds


int __new_msgctl (int, int, struct msqid_ds *)
 versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2)

Class Documentation

struct __old_msqid_ds

Definition at line 31 of file msgctl.c.

Class Members
unsigned short int __msg_cbytes
struct msg *__unbounded __msg_first
struct msg *__unbounded __msg_last
struct wait_queue *__unbounded __rwait
struct wait_queue *__unbounded __wwait
__time_t msg_ctime
__ipc_pid_t msg_lrpid
__ipc_pid_t msg_lspid
unsigned short int msg_qbytes
unsigned short int msg_qnum
__time_t msg_rtime
__time_t msg_stime

Function Documentation

int __new_msgctl ( int  msqid,
int  cmd,
struct msqid_ds buf 

Definition at line 53 of file msgctl.c.

  /* This is a misnomer -- Alpha had 32-bit uids at the beginning
     of time.  However, msg_qnum and msg_qbytes changed size at
     the same time the size of uid changed elsewhere.  */
#if __ASSUME_32BITUIDS > 0
  return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, CHECK_1 (buf));
  switch (cmd) {
    case MSG_STAT:
    case IPC_STAT:
    case IPC_SET:
      return INLINE_SYSCALL (msgctl, 3, msqid, cmd, CHECK_1 (buf));

    int save_errno = errno, result;
    struct __old_msqid_ds old;

    /* Unfortunately there is no way how to find out for sure whether
       we should use old or new msgctl.  */
    result = INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, CHECK_1 (buf));
    if (result != -1 || errno != EINVAL)
      return result;

    if (cmd == IPC_SET)
       old.msg_perm.uid = buf->msg_perm.uid;
       old.msg_perm.gid = buf->msg_perm.gid;
       old.msg_perm.mode = buf->msg_perm.mode;
       old.msg_qbytes = buf->msg_qbytes;
       if (old.msg_perm.uid != buf->msg_perm.uid ||
           old.msg_perm.gid != buf->msg_perm.gid ||
           old.msg_qbytes != buf->msg_qbytes)
           __set_errno (EINVAL);
           return -1;
    result = INLINE_SYSCALL (msgctl, 3, msqid, cmd, __ptrvalue (&old));
    if (result != -1 && cmd != IPC_SET)
       memset(buf, 0, sizeof(*buf));
       buf->msg_perm.__key = old.msg_perm.__key;
       buf->msg_perm.uid = old.msg_perm.uid;
       buf->msg_perm.gid = old.msg_perm.gid;
       buf->msg_perm.cuid = old.msg_perm.cuid;
       buf->msg_perm.cgid = old.msg_perm.cgid;
       buf->msg_perm.mode = old.msg_perm.mode;
       buf->msg_perm.__seq = old.msg_perm.__seq;
       buf->msg_stime = old.msg_stime;
       buf->msg_rtime = old.msg_rtime;
       buf->msg_ctime = old.msg_ctime;
       buf->__msg_cbytes = old.__msg_cbytes;
       buf->msg_qnum = old.msg_qnum;
       buf->msg_qbytes = old.msg_qbytes;
       buf->msg_lspid = old.msg_lspid;
       buf->msg_lrpid = old.msg_lrpid;
    return result;

Here is the call graph for this function:

versioned_symbol ( libc  ,
__new_msgctl  ,
msgctl  ,