summaryrefslogtreecommitdiff
path: root/nptl/sem_open.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sem_open.c')
-rw-r--r--nptl/sem_open.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/nptl/sem_open.c b/nptl/sem_open.c
index e17a583bf8..a80ed30579 100644
--- a/nptl/sem_open.c
+++ b/nptl/sem_open.c
@@ -53,6 +53,7 @@ void
attribute_hidden
__where_is_shmfs (void)
{
+#ifndef STATIC_DEV_SHM
char buf[512];
struct statfs f;
struct mntent resmem;
@@ -119,6 +120,16 @@ __where_is_shmfs (void)
/* Close the stream. */
__endmntent (fp);
+#else
+ int mode = S_IRWXU | S_IRWXG | S_IRWXO;
+ int res = mkdir (STATIC_DEV_SHM, mode);
+ if (res != 0 && errno != EEXIST)
+ return;
+ if (res == 0 && chmod (STATIC_DEV_SHM, mode) != 0)
+ return;
+ mountpoint.dir = (char *)STATIC_DEV_SHM_PREFIX;
+ mountpoint.dirlen = sizeof (STATIC_DEV_SHM_PREFIX) - 1;
+#endif
}
@@ -146,7 +157,11 @@ __sem_search (const void *a, const void *b)
void *__sem_mappings attribute_hidden;
/* Lock to protect the search tree. */
+#ifndef lll_define_initialized
int __sem_mappings_lock attribute_hidden = LLL_LOCK_INITIALIZER;
+#else
+lll_define_initialized (, __sem_mappings_lock);
+#endif
/* Search for existing mapping and if possible add the one provided. */
@@ -314,6 +329,10 @@ sem_open (const char *name, int oflag, ...)
/* Initialize the remaining bytes as well. */
memset ((char *) &sem.initsem + sizeof (struct new_sem), '\0',
sizeof (sem_t) - sizeof (struct new_sem));
+#else
+ if (sem_init (&initsem, 1, value) != 0)
+ return SEM_FAILED;
+#endif
tmpfname = (char *) alloca (mountpoint.dirlen + 6 + 1);
char *xxxxxx = __mempcpy (tmpfname, mountpoint.dir, mountpoint.dirlen);