Back to index

glibc  2.9
semaphoreP.h
Go to the documentation of this file.
00001 /* Copyright (C) 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #include <semaphore.h>
00021 #include "pthreadP.h"
00022 
00023 
00024 /* Mount point of the shared memory filesystem.  */
00025 struct mountpoint_info
00026 {
00027   char *dir;
00028   size_t dirlen;
00029 };
00030 
00031 /* Keeping track of currently used mappings.  */
00032 struct inuse_sem
00033 {
00034   dev_t dev;
00035   ino_t ino;
00036   int refcnt;
00037   sem_t *sem;
00038   char name[0];
00039 };
00040 
00041 
00042 /* Variables used in multiple interfaces.  */
00043 extern struct mountpoint_info mountpoint attribute_hidden;
00044 
00045 extern pthread_once_t __namedsem_once attribute_hidden;
00046 
00047 /* The search tree for existing mappings.  */
00048 extern void *__sem_mappings attribute_hidden;
00049 
00050 /* Lock to protect the search tree.  */
00051 extern int __sem_mappings_lock attribute_hidden;
00052 
00053 
00054 /* Initializer for mountpoint.  */
00055 extern void __where_is_shmfs (void) attribute_hidden;
00056 
00057 /* Comparison function for search in tree with existing mappings.  */
00058 extern int __sem_search (const void *a, const void *b) attribute_hidden;
00059 
00060 
00061 /* Prototypes of functions with multiple interfaces.  */
00062 extern int __new_sem_init (sem_t *sem, int pshared, unsigned int value);
00063 extern int __old_sem_init (sem_t *sem, int pshared, unsigned int value);
00064 extern int __new_sem_destroy (sem_t *sem);
00065 extern int __new_sem_post (sem_t *sem);
00066 extern int __new_sem_wait (sem_t *sem);
00067 extern int __old_sem_wait (sem_t *sem);
00068 extern int __new_sem_trywait (sem_t *sem);
00069 extern int __new_sem_getvalue (sem_t *sem, int *sval);