Blame sysdeps/unix/sysv/linux/msgctl.c

Packit 6c4009
/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <sys/msg.h>
Packit 6c4009
#include <ipc_priv.h>
Packit 6c4009
#include <sysdep.h>
Packit 6c4009
#include <shlib-compat.h>
Packit 6c4009
#include <errno.h>
Packit 6c4009
Packit 6c4009
#ifndef DEFAULT_VERSION
Packit 6c4009
# define DEFAULT_VERSION GLIBC_2_2
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
int
Packit 6c4009
__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
Packit 6c4009
{
Packit 6c4009
#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
Packit 6c4009
  return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
Packit 6c4009
#else
Packit 6c4009
  return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd | __IPC_64, 0,
Packit 6c4009
			      buf);
Packit 6c4009
#endif
Packit 6c4009
}
Packit 6c4009
versioned_symbol (libc, __new_msgctl, msgctl, DEFAULT_VERSION);
Packit 6c4009
Packit 6c4009
Packit 6c4009
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
Packit 6c4009
struct __old_msqid_ds
Packit 6c4009
{
Packit 6c4009
  struct __old_ipc_perm msg_perm;	/* structure describing operation permission */
Packit 6c4009
  struct msg *__msg_first;		/* pointer to first message on queue */
Packit 6c4009
  struct msg *__msg_last;		/* pointer to last message on queue */
Packit 6c4009
  __time_t msg_stime;			/* time of last msgsnd command */
Packit 6c4009
  __time_t msg_rtime;			/* time of last msgrcv command */
Packit 6c4009
  __time_t msg_ctime;			/* time of last change */
Packit 6c4009
  struct wait_queue *__wwait;		/* ??? */
Packit 6c4009
  struct wait_queue *__rwait;		/* ??? */
Packit 6c4009
  unsigned short int __msg_cbytes;	/* current number of bytes on queue */
Packit 6c4009
  unsigned short int msg_qnum;		/* number of messages currently on queue */
Packit 6c4009
  unsigned short int msg_qbytes;	/* max number of bytes allowed on queue */
Packit 6c4009
  __ipc_pid_t msg_lspid;		/* pid of last msgsnd() */
Packit 6c4009
  __ipc_pid_t msg_lrpid;		/* pid of last msgrcv() */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
int
Packit 6c4009
attribute_compat_text_section
Packit 6c4009
__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
Packit 6c4009
{
Packit 6c4009
#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
Packit 6c4009
  return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
Packit 6c4009
#else
Packit 6c4009
  return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
Packit 6c4009
#endif
Packit 6c4009
}
Packit 6c4009
compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
Packit 6c4009
#endif