]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/msgctl.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / msgctl.c
CommitLineData
04277e02 1/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
3e5f5557
UD
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
28f540f4 4
3e5f5557 5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
28f540f4 9
3e5f5557
UD
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
41bdb6e2 13 Lesser General Public License for more details.
28f540f4 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
28f540f4 18
d2f5be2a 19#include <sys/msg.h>
973209d8 20#include <ipc_priv.h>
e9dcb080 21#include <sysdep.h>
b5567b2a 22#include <shlib-compat.h>
356c0aab
AZ
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);
e9dcb080 40
0482576e 41
356c0aab 42#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
973209d8
UD
43struct __old_msqid_ds
44{
45 struct __old_ipc_perm msg_perm; /* structure describing operation permission */
70d9946a
JM
46 struct msg *__msg_first; /* pointer to first message on queue */
47 struct msg *__msg_last; /* pointer to last message on queue */
973209d8
UD
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 */
70d9946a
JM
51 struct wait_queue *__wwait; /* ??? */
52 struct wait_queue *__rwait; /* ??? */
973209d8
UD
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
d2f5be2a 60int
d3a4a571 61attribute_compat_text_section
0482576e 62__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
d2f5be2a 63{
356c0aab 64#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
dfba907f 65 return INLINE_SYSCALL_CALL (msgctl, msqid, cmd, buf);
356c0aab
AZ
66#else
67 return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
68#endif
d2f5be2a 69}
b5567b2a
UD
70compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
71#endif