1 /* Basic definition for Sysv IPC test functions.
2 Copyright (C) 2020-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
26 #include <include/array_length.h>
28 /* Return the first invalid SysV IPC command from common shared
29 between message queue, shared memory, and semaphore. */
31 first_common_invalid_cmd (void)
33 const int common_cmds[] = {
41 for (int i = 0; i < array_length (common_cmds); i++)
43 if (invalid == common_cmds[i])
53 /* Return the first invalid SysV IPC command for semaphore. */
55 first_sem_invalid_cmd (void)
57 const int sem_cmds[] = {
72 int invalid = first_common_invalid_cmd ();
73 for (int i = 0; i < array_length (sem_cmds); i++)
75 if (invalid == sem_cmds[i])
85 /* Return the first invalid SysV IPC command for message queue. */
87 first_msg_invalid_cmd (void)
89 const int msg_cmds[] = {
97 int invalid = first_common_invalid_cmd ();
98 for (int i = 0; i < array_length (msg_cmds); i++)
100 if (invalid == msg_cmds[i])
110 /* Return the first invalid SysV IPC command for shared memory. */
112 first_shm_invalid_cmd (void)
114 const int shm_cmds[] = {
124 int invalid = first_common_invalid_cmd ();
125 for (int i = 0; i < array_length (shm_cmds); i++)
127 if (invalid == shm_cmds[i])
137 #endif /* _TEST_SYSV_H */