blob: 7d6fd25259122aa012feed6ee8f03354e092f61c [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* Copyright (C) 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
19
20#include <semaphore.h>
21#include "pthreadP.h"
22
23
24/* Mount point of the shared memory filesystem. */
25struct mountpoint_info
26{
27 char *dir;
28 size_t dirlen;
29};
30
31/* Keeping track of currently used mappings. */
32struct inuse_sem
33{
34 dev_t dev;
35 ino_t ino;
36 int refcnt;
37 sem_t *sem;
38 char name[0];
39};
40
41
42/* Variables used in multiple interfaces. */
43extern struct mountpoint_info mountpoint attribute_hidden;
44
45extern pthread_once_t __namedsem_once attribute_hidden;
46
47/* The search tree for existing mappings. */
48extern void *__sem_mappings attribute_hidden;
49
50/* Lock to protect the search tree. */
51extern int __sem_mappings_lock attribute_hidden;
52
53
54/* Initializer for mountpoint. */
55extern void __where_is_shmfs (void) attribute_hidden;
56
57/* Comparison function for search in tree with existing mappings. */
58extern int __sem_search (const void *a, const void *b) attribute_hidden;
59
60
61/* Prototypes of functions with multiple interfaces. */
62extern int __new_sem_init (sem_t *sem, int pshared, unsigned int value);
63extern int __old_sem_init (sem_t *sem, int pshared, unsigned int value);
64extern int __new_sem_destroy (sem_t *sem);
65extern int __new_sem_post (sem_t *sem);
66extern int __new_sem_wait (sem_t *sem);
67extern int __old_sem_wait (sem_t *sem);
68extern int __new_sem_trywait (sem_t *sem);
69extern int __new_sem_getvalue (sem_t *sem, int *sval);