1/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#include <sys/msg.h>
20#include <ipc_priv.h>
21#include <sysdep.h>
22#include <shlib-compat.h>
23#include <errno.h>
24
25#ifndef DEFAULT_VERSION
26# define DEFAULT_VERSION GLIBC_2_2
27#endif
28
29int
30__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
31{
32#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
33 return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
34#else
35 return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd | __IPC_64, 0,
36 buf);
37#endif
38}
39versioned_symbol (libc, __new_msgctl, msgctl, DEFAULT_VERSION);
40
41
42#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
43struct __old_msqid_ds
44{
45 struct __old_ipc_perm msg_perm; /* structure describing operation permission */
46 struct msg *__msg_first; /* pointer to first message on queue */
47 struct msg *__msg_last; /* pointer to last message on queue */
48 __time_t msg_stime; /* time of last msgsnd command */
49 __time_t msg_rtime; /* time of last msgrcv command */
50 __time_t msg_ctime; /* time of last change */
51 struct wait_queue *__wwait; /* ??? */
52 struct wait_queue *__rwait; /* ??? */
53 unsigned short int __msg_cbytes; /* current number of bytes on queue */
54 unsigned short int msg_qnum; /* number of messages currently on queue */
55 unsigned short int msg_qbytes; /* max number of bytes allowed on queue */
56 __ipc_pid_t msg_lspid; /* pid of last msgsnd() */
57 __ipc_pid_t msg_lrpid; /* pid of last msgrcv() */
58};
59
60int
61attribute_compat_text_section
62__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
63{
64#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
65 return INLINE_SYSCALL_CALL (msgctl, msqid, cmd, buf);
66#else
67 return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
68#endif
69}
70compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
71#endif
72