diff options
Diffstat (limited to 'sysvipc')
-rw-r--r-- | sysvipc/Makefile | 38 | ||||
-rw-r--r-- | sysvipc/Versions | 20 | ||||
-rw-r--r-- | sysvipc/ftok.c | 35 | ||||
-rw-r--r-- | sysvipc/msgctl.c | 32 | ||||
-rw-r--r-- | sysvipc/msgget.c | 32 | ||||
-rw-r--r-- | sysvipc/msgrcv.c | 35 | ||||
-rw-r--r-- | sysvipc/msgsnd.c | 35 | ||||
-rw-r--r-- | sysvipc/semctl.c | 32 | ||||
-rw-r--r-- | sysvipc/semget.c | 32 | ||||
-rw-r--r-- | sysvipc/semop.c | 31 | ||||
-rw-r--r-- | sysvipc/semtimedop.c | 32 | ||||
-rw-r--r-- | sysvipc/shmat.c | 33 | ||||
-rw-r--r-- | sysvipc/shmctl.c | 31 | ||||
-rw-r--r-- | sysvipc/shmdt.c | 32 | ||||
-rw-r--r-- | sysvipc/shmget.c | 32 | ||||
-rw-r--r-- | sysvipc/sys/ipc.h | 54 | ||||
-rw-r--r-- | sysvipc/sys/msg.h | 82 | ||||
-rw-r--r-- | sysvipc/sys/sem.h | 67 | ||||
-rw-r--r-- | sysvipc/sys/shm.h | 63 | ||||
-rw-r--r-- | sysvipc/test-sysvmsg.c | 128 | ||||
-rw-r--r-- | sysvipc/test-sysvsem.c | 123 | ||||
-rw-r--r-- | sysvipc/test-sysvshm.c | 131 |
22 files changed, 0 insertions, 1130 deletions
diff --git a/sysvipc/Makefile b/sysvipc/Makefile deleted file mode 100644 index 9ac44bafca..0000000000 --- a/sysvipc/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 1995-2017 Free Software Foundation, Inc. -# This file is part of the GNU C Library. - -# The GNU C Library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. - -# The GNU C Library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public -# License along with the GNU C Library; if not, see -# <http://www.gnu.org/licenses/>. - -# -# Sub-makefile for sysvipc portion of the library. -# -subdir := sysvipc - -include ../Makeconfig - -headers := sys/ipc.h sys/msg.h sys/sem.h sys/shm.h \ - bits/ipctypes.h bits/ipc.h bits/msq.h bits/sem.h bits/shm.h - -routines := ftok \ - msgsnd msgrcv msgget msgctl \ - semop semget semctl semtimedop \ - shmat shmdt shmget shmctl - -tests := test-sysvmsg test-sysvsem test-sysvshm - -include ../Rules - -CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables -CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables diff --git a/sysvipc/Versions b/sysvipc/Versions deleted file mode 100644 index 4c797e25ce..0000000000 --- a/sysvipc/Versions +++ /dev/null @@ -1,20 +0,0 @@ -libc { - GLIBC_2.0 { - # f* - ftok; - - # m* - msgctl; msgget; msgrcv; msgsnd; - - # s* - semctl; semget; semop; shmat; shmctl; shmdt; shmget; - } - GLIBC_2.3.3 { - # Non-standard function. - semtimedop; - } - GLIBC_PRIVATE { - # Cancellation point entries. - __libc_msgrcv; __libc_msgsnd; - } -} diff --git a/sysvipc/ftok.c b/sysvipc/ftok.c deleted file mode 100644 index 00749031eb..0000000000 --- a/sysvipc/ftok.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/ipc.h> -#include <sys/stat.h> - -key_t -ftok (const char *pathname, int proj_id) -{ - struct stat64 st; - key_t key; - - if (__xstat64 (_STAT_VER, pathname, &st) < 0) - return (key_t) -1; - - key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) - | ((proj_id & 0xff) << 24)); - - return key; -} diff --git a/sysvipc/msgctl.c b/sysvipc/msgctl.c deleted file mode 100644 index 01a07a8ba5..0000000000 --- a/sysvipc/msgctl.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/msg.h> -#include <errno.h> - -/* Allows to control internal state and destruction of message queue - objects. */ - -int -msgctl (int msqid, int cmd, struct msqid_ds *buf) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (msgctl) diff --git a/sysvipc/msgget.c b/sysvipc/msgget.c deleted file mode 100644 index 0a439444db..0000000000 --- a/sysvipc/msgget.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/msg.h> -#include <errno.h> - -/* Return descriptor for message queue associated with KEY. The MSGFLG - parameter describes how to proceed with clashing of key values. */ - -int -msgget (key_t key, int msgflg) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (msgget) diff --git a/sysvipc/msgrcv.c b/sysvipc/msgrcv.c deleted file mode 100644 index bc7744e430..0000000000 --- a/sysvipc/msgrcv.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/msg.h> -#include <errno.h> - -/* Read a message from the queue associated with the message queue - descriptor MSQID. At most MSGSZ bytes of the message are placed - in the buffer specified by the MSGP parameter. The MSGTYP parameter - describes which message is returned in MSGFLG describes the behaviour - in buffer overflow or queue underflow. */ - -ssize_t -msgrcv (int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (msgrcv) diff --git a/sysvipc/msgsnd.c b/sysvipc/msgsnd.c deleted file mode 100644 index b3346eb7e1..0000000000 --- a/sysvipc/msgsnd.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/msg.h> -#include <errno.h> - -/* Send a message to the queue associated with the message queue - descriptor MSQID. The parameter MSGP points to a structure - describing messages where the parameter MSGSZ gives the length - of the text. The MSGFLG parameter describes the action taken - when the limit of the message queue length is reached. */ - -int -msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (msgsnd) diff --git a/sysvipc/semctl.c b/sysvipc/semctl.c deleted file mode 100644 index 117a86a72c..0000000000 --- a/sysvipc/semctl.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/sem.h> -#include <errno.h> - -/* Return identifier for array of NSEMS semaphores associated with - KEY. */ - -int -semctl (int semid, int semnum, int cmd, ...) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (semctl) diff --git a/sysvipc/semget.c b/sysvipc/semget.c deleted file mode 100644 index 697597181e..0000000000 --- a/sysvipc/semget.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/sem.h> -#include <errno.h> - -/* Return identifier for array of NSEMS semaphores associated with - KEY. */ - -int -semget (key_t key, int nsems, int semflg) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (semget) diff --git a/sysvipc/semop.c b/sysvipc/semop.c deleted file mode 100644 index 11fea80a32..0000000000 --- a/sysvipc/semop.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/sem.h> -#include <errno.h> - -/* Perform user-defined atomical operation of array of semaphores. */ - -int -semop (int semid, struct sembuf *sops, size_t nsops) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (semop) diff --git a/sysvipc/semtimedop.c b/sysvipc/semtimedop.c deleted file mode 100644 index 567730634e..0000000000 --- a/sysvipc/semtimedop.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2003-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/sem.h> -#include <errno.h> - -/* Perform user-defined atomical operation of array of semaphores. */ - -int -semtimedop (int semid, struct sembuf *sops, size_t nsops, - const struct timespec *timeout) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (semtimedop) diff --git a/sysvipc/shmat.c b/sysvipc/shmat.c deleted file mode 100644 index 4872c906ba..0000000000 --- a/sysvipc/shmat.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/shm.h> -#include <errno.h> - -/* Attach the shared memory segment associated with SHMID to the data - segment of the calling process. SHMADDR and SHMFLG determine how - and where the segment is attached. */ - -void * -shmat (int shmid, const void *shmaddr, int shmflg) -{ - __set_errno (ENOSYS); - return (void *) -1; -} - -stub_warning (shmat) diff --git a/sysvipc/shmctl.c b/sysvipc/shmctl.c deleted file mode 100644 index a8e93a32d5..0000000000 --- a/sysvipc/shmctl.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/shm.h> -#include <errno.h> - -/* Provide operations to control over shared memory segments. */ - -int -shmctl (int shmid, int cmd, struct shmid_ds *buf) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (shmctl) diff --git a/sysvipc/shmdt.c b/sysvipc/shmdt.c deleted file mode 100644 index 16f4583d6e..0000000000 --- a/sysvipc/shmdt.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/shm.h> -#include <errno.h> - -/* Detach shared memory segment starting at address specified by SHMADDR - from the caller's data segment. */ - -int -shmdt (const void *shmaddr) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (shmdt) diff --git a/sysvipc/shmget.c b/sysvipc/shmget.c deleted file mode 100644 index 57f6c98f60..0000000000 --- a/sysvipc/shmget.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/shm.h> -#include <errno.h> - -/* Return an identifier for an shared memory segment of at least size SIZE - which is associated with KEY. */ - -int -shmget (key_t key, size_t size, int shmflg) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (shmget) diff --git a/sysvipc/sys/ipc.h b/sysvipc/sys/ipc.h deleted file mode 100644 index 9d724a8884..0000000000 --- a/sysvipc/sys/ipc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _SYS_IPC_H -#define _SYS_IPC_H 1 - -#include <features.h> - -/* Get system dependent definition of `struct ipc_perm' and more. */ -#include <bits/ipctypes.h> -#include <bits/ipc.h> - -#ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -#endif - -#ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -#endif - -#ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -#endif - -#ifndef __key_t_defined -typedef __key_t key_t; -# define __key_t_defined -#endif - -__BEGIN_DECLS - -/* Generates key for System V style IPC. */ -extern key_t ftok (const char *__pathname, int __proj_id) __THROW; - -__END_DECLS - -#endif /* sys/ipc.h */ diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h deleted file mode 100644 index 3610050014..0000000000 --- a/sysvipc/sys/msg.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _SYS_MSG_H -#define _SYS_MSG_H - -#include <features.h> - -#define __need_size_t -#include <stddef.h> - -/* Get common definition of System V style IPC. */ -#include <sys/ipc.h> - -/* Get system dependent definition of `struct msqid_ds' and more. */ -#include <bits/msq.h> - -/* Define types required by the standard. */ -#include <bits/types/time_t.h> - -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif - -/* The following System V style IPC functions implement a message queue - system. The definition is found in XPG2. */ - -#ifdef __USE_GNU -/* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */ -struct msgbuf - { - __syscall_slong_t mtype; /* type of received/sent message */ - char mtext[1]; /* text of the message */ - }; -#endif - - -__BEGIN_DECLS - -/* Message queue control operation. */ -extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; - -/* Get messages queue. */ -extern int msgget (key_t __key, int __msgflg) __THROW; - -/* Receive message from message queue. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz, - long int __msgtyp, int __msgflg); - -/* Send message to message queue. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int msgsnd (int __msqid, const void *__msgp, size_t __msgsz, - int __msgflg); - -__END_DECLS - -#endif /* sys/msg.h */ diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h deleted file mode 100644 index 1fa58c5f09..0000000000 --- a/sysvipc/sys/sem.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _SYS_SEM_H -#define _SYS_SEM_H 1 - -#include <features.h> - -#define __need_size_t -#include <stddef.h> - -/* Get common definition of System V style IPC. */ -#include <sys/ipc.h> - -/* Get system dependent definition of `struct semid_ds' and more. */ -#include <bits/sem.h> - -#ifdef __USE_GNU -# include <bits/types/struct_timespec.h> -#endif - -/* The following System V style IPC functions implement a semaphore - handling. The definition is found in XPG2. */ - -/* Structure used for argument to `semop' to describe operations. */ -struct sembuf -{ - unsigned short int sem_num; /* semaphore number */ - short int sem_op; /* semaphore operation */ - short int sem_flg; /* operation flag */ -}; - - -__BEGIN_DECLS - -/* Semaphore control operation. */ -extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; - -/* Get semaphore. */ -extern int semget (key_t __key, int __nsems, int __semflg) __THROW; - -/* Operate on semaphore. */ -extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; - -#ifdef __USE_GNU -/* Operate on semaphore with timeout. */ -extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops, - const struct timespec *__timeout) __THROW; -#endif - -__END_DECLS - -#endif /* sys/sem.h */ diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h deleted file mode 100644 index c83fd4c3d5..0000000000 --- a/sysvipc/sys/shm.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _SYS_SHM_H -#define _SYS_SHM_H 1 - -#include <features.h> - -#define __need_size_t -#include <stddef.h> - -/* Get common definition of System V style IPC. */ -#include <sys/ipc.h> - -/* Get system dependent definition of `struct shmid_ds' and more. */ -#include <bits/shm.h> - -/* Define types required by the standard. */ -#include <bits/types/time_t.h> - -#ifdef __USE_XOPEN -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -# endif -#endif /* X/Open */ - - -__BEGIN_DECLS - -/* The following System V style IPC functions implement a shared memory - facility. The definition is found in XPG4.2. */ - -/* Shared memory control operation. */ -extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; - -/* Get shared memory segment. */ -extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW; - -/* Attach shared memory segment. */ -extern void *shmat (int __shmid, const void *__shmaddr, int __shmflg) - __THROW; - -/* Detach shared memory segment. */ -extern int shmdt (const void *__shmaddr) __THROW; - -__END_DECLS - -#endif /* sys/shm.h */ diff --git a/sysvipc/test-sysvmsg.c b/sysvipc/test-sysvmsg.c deleted file mode 100644 index a0d84f3a39..0000000000 --- a/sysvipc/test-sysvmsg.c +++ /dev/null @@ -1,128 +0,0 @@ -/* Basic tests for SYSV message queue functions. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/msg.h> - -#include <support/support.h> -#include <support/check.h> -#include <support/temp_file.h> - -#define TEXTSIZE 32 -struct msgbuf_t -{ -#ifdef _GNU_SOURCE - __syscall_slong_t type; -#else - long type; -#endif - char buf[TEXTSIZE]; -}; - -#define MSGTYPE 0x01020304 -#define MSGDATA "0123456789" - -/* These are for the temporary file we generate. */ -static char *name; -static int msqid; - -static void -remove_msq (void) -{ - /* Enforce message queue removal in case of early test failure. - Ignore error since the msgq may already have being removed. */ - msgctl (msqid, IPC_RMID, NULL); -} - -static void -do_prepare (int argc, char *argv[]) -{ - int fd = create_temp_file ("tst-sysvmsg.", &name); - if (fd == -1) - FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno); -} - -#define PREPARE do_prepare - -/* It is not an extensive test, but rather a functional one aimed to check - correct parameter passing on kernel. */ - -#define MSGQ_MODE 0644 - -static int -do_test (void) -{ - atexit (remove_msq); - - key_t key = ftok (name, 'G'); - if (key == -1) - FAIL_EXIT1 ("ftok failed"); - - msqid = msgget (key, MSGQ_MODE | IPC_CREAT); - if (msqid == -1) - { - if (errno == ENOSYS) - FAIL_UNSUPPORTED ("msgget not supported"); - FAIL_EXIT1 ("msgget failed (errno=%d)", errno); - } - - /* Get message queue kernel information and do some sanity checks. */ - struct msqid_ds msginfo; - if (msgctl (msqid, IPC_STAT, &msginfo) == -1) - FAIL_EXIT1 ("msgctl with IPC_STAT failed (errno=%d)", errno); - - if (msginfo.msg_perm.__key != key) - FAIL_EXIT1 ("msgid_ds::msg_perm::key (%d) != %d", - (int) msginfo.msg_perm.__key, (int) key); - if (msginfo.msg_perm.mode != MSGQ_MODE) - FAIL_EXIT1 ("msgid_ds::msg_perm::mode (%o) != %o", - msginfo.msg_perm.mode, MSGQ_MODE); - if (msginfo.msg_qnum != 0) - FAIL_EXIT1 ("msgid_ds::msg_qnum (%lu) != 0", - (long unsigned) msginfo.msg_qnum); - - /* Check if last argument (IPC_NOWAIT) is correctly handled. */ - struct msgbuf_t msg2rcv = { 0 }; - if (msgrcv (msqid, &msg2rcv, sizeof (msg2rcv.buf), MSGTYPE, - IPC_NOWAIT) == -1 - && errno != ENOMSG) - FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno); - - struct msgbuf_t msg2snd = { MSGTYPE, MSGDATA }; - if (msgsnd (msqid, &msg2snd, sizeof (msg2snd.buf), 0) == -1) - FAIL_EXIT1 ("msgsnd failed (errno=%d)", errno); - - if (msgrcv (msqid, &msg2rcv, sizeof (msg2rcv.buf), MSGTYPE, 0) == -1) - FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno); - - int ret = 0; - if (strncmp (msg2snd.buf, msg2rcv.buf, TEXTSIZE) != 0) - ret = 1; - - if (msgctl (msqid, IPC_RMID, NULL) == -1) - FAIL_EXIT1 ("msgctl failed"); - - return ret; -} - -#include <support/test-driver.c> diff --git a/sysvipc/test-sysvsem.c b/sysvipc/test-sysvsem.c deleted file mode 100644 index 279eca9b09..0000000000 --- a/sysvipc/test-sysvsem.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Basic tests for SYSV semaphore functions. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h> - -#include <support/support.h> -#include <support/check.h> -#include <support/temp_file.h> - -/* These are for the temporary file we generate. */ -static char *name; -static int semid; - -static void -remove_sem (void) -{ - /* Enforce message queue removal in case of early test failure. - Ignore error since the sem may already have being removed. */ - semctl (semid, 0, IPC_RMID, 0); -} - -static void -do_prepare (int argc, char *argv[]) -{ - int fd = create_temp_file ("tst-sysvsem.", &name); - if (fd == -1) - FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno); -} - -#define PREPARE do_prepare - -/* It is not an extensive test, but rather a functional one aimed to check - correct parameter passing on kernel. */ - -#define SEM_MODE 0644 - -union semun -{ - int val; - struct semid_ds *buf; - unsigned short *array; -}; - -static int -do_test (void) -{ - atexit (remove_sem); - - key_t key = ftok (name, 'G'); - if (key == -1) - FAIL_EXIT1 ("ftok failed"); - - semid = semget(key, 1, IPC_CREAT | IPC_EXCL | SEM_MODE); - if (semid == -1) - { - if (errno == ENOSYS) - FAIL_UNSUPPORTED ("msgget not supported"); - FAIL_EXIT1 ("semget failed (errno=%d)", errno); - } - - /* Get semaphore kernel information and do some sanity checks. */ - struct semid_ds seminfo; - if (semctl (semid, 0, IPC_STAT, (union semun) { .buf = &seminfo }) == -1) - FAIL_EXIT1 ("semctl with IPC_STAT failed (errno=%d)", errno); - - if (seminfo.sem_perm.__key != key) - FAIL_EXIT1 ("semid_ds::sem_perm::key (%d) != %d", - (int) seminfo.sem_perm.__key, (int) key); - if (seminfo.sem_perm.mode != SEM_MODE) - FAIL_EXIT1 ("semid_ds::sem_perm::mode (%o) != %o", - seminfo.sem_perm.mode, SEM_MODE); - if (seminfo.sem_nsems != 1) - FAIL_EXIT1 ("semid_ds::sem_nsems (%lu) != 1", - (long unsigned) seminfo.sem_nsems); - - /* Some lock/unlock basic tests. */ - struct sembuf sb1 = { 0, 1, 0 }; - if (semop (semid, &sb1, 1) == -1) - FAIL_EXIT1 ("semop failed (errno=%i)", errno); - - struct sembuf sb2 = { 0, -1, 0 }; - if (semop (semid, &sb2, 1) == -1) - FAIL_EXIT1 ("semop failed (errno=%i)", errno); - -#ifdef _GNU_SOURCE - /* Set a time for half a second. The semaphore operation should timeout - with EAGAIN. */ - struct timespec ts = { 0 /* sec */, 500000000 /* nsec */ }; - if (semtimedop (semid, &sb2, 1, &ts) != -1 - || (errno != EAGAIN && errno != ENOSYS)) - FAIL_EXIT1 ("semtimedop succeed or returned errno != {EAGAIN,ENOSYS} " - "(errno=%i)", errno); -#endif - - /* Finally free up the semnaphore resource. */ - if (semctl (semid, 0, IPC_RMID, 0) == -1) - FAIL_EXIT1 ("semctl failed (errno=%d)", errno); - - return 0; -} - -#include <support/test-driver.c> diff --git a/sysvipc/test-sysvshm.c b/sysvipc/test-sysvshm.c deleted file mode 100644 index b7ccd0e20e..0000000000 --- a/sysvipc/test-sysvshm.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Basic tests for SYSV shared memory functions. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> - -#include <support/support.h> -#include <support/check.h> -#include <support/temp_file.h> - -/* These are for the temporary file we generate. */ -static char *name; -static int shmid; - -static void -remove_shm (void) -{ - /* Enforce message queue removal in case of early test failure. - Ignore error since the shm may already have being removed. */ - shmctl (shmid, IPC_RMID, 0); -} - -static void -do_prepare (int argc, char *argv[]) -{ - int fd = create_temp_file ("tst-sysvshm.", &name); - if (fd == -1) - FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno); -} - -#define PREPARE do_prepare - -/* It is not an extensive test, but rather a functional one aimed to check - correct parameter passing on kernel. */ - -#define CHECK_EQ(v, k) \ - if ((v) != (k)) \ - FAIL_EXIT1("%d != %d", v, k) - -#define SHM_MODE 0666 - -static int -do_test (void) -{ - atexit (remove_shm); - - key_t key = ftok (name, 'G'); - if (key == -1) - FAIL_EXIT1 ("ftok failed"); - - long int pgsz = sysconf (_SC_PAGESIZE); - if (pgsz == -1) - FAIL_EXIT1 ("sysconf (_SC_PAGESIZE) failed (errno = %d)", errno); - - shmid = shmget(key, pgsz, IPC_CREAT | IPC_EXCL | SHM_MODE); - if (shmid == -1) - { - if (errno == ENOSYS) - FAIL_UNSUPPORTED ("shmget not supported"); - FAIL_EXIT1 ("shmget failed (errno=%d)", errno); - } - - /* Get shared memory kernel information and do some sanity checks. */ - struct shmid_ds shminfo; - if (shmctl (shmid, IPC_STAT, &shminfo) == -1) - FAIL_EXIT1 ("shmctl with IPC_STAT failed (errno=%d)", errno); - - if (shminfo.shm_perm.__key != key) - FAIL_EXIT1 ("shmid_ds::shm_perm::key (%d) != %d", - (int) shminfo.shm_perm.__key, (int) key); - if (shminfo.shm_perm.mode != SHM_MODE) - FAIL_EXIT1 ("shmid_ds::shm_perm::mode (%o) != %o", - shminfo.shm_perm.mode, SHM_MODE); - if (shminfo.shm_segsz != pgsz) - FAIL_EXIT1 ("shmid_ds::shm_segsz (%lu) != %lu", - (long unsigned) shminfo.shm_segsz, pgsz); - - /* Attach on shared memory and realize some operations. */ - int *shmem = shmat (shmid, NULL, 0); - if (shmem == (void*) -1) - FAIL_EXIT1 ("shmem failed (errno=%d)", errno); - - shmem[0] = 0x55555555; - shmem[32] = 0x44444444; - shmem[64] = 0x33333333; - shmem[128] = 0x22222222; - - if (shmdt (shmem) == -1) - FAIL_EXIT1 ("shmem failed (errno=%d)", errno); - - shmem = shmat (shmid, NULL, SHM_RDONLY); - if (shmem == (void*) -1) - FAIL_EXIT1 ("shmem failed (errno=%d)", errno); - - CHECK_EQ (shmem[0], 0x55555555); - CHECK_EQ (shmem[32], 0x44444444); - CHECK_EQ (shmem[64], 0x33333333); - CHECK_EQ (shmem[128], 0x22222222); - - if (shmdt (shmem) == -1) - FAIL_EXIT1 ("shmem failed (errno=%d)", errno); - - /* Finally free up the semnaphore resource. */ - if (shmctl (shmid, IPC_RMID, 0) == -1) - FAIL_EXIT1 ("semctl failed (errno=%d)", errno); - - return 0; -} - -#include <support/test-driver.c> |