From da66f026fd436bdab6f3a90cd80009c2bb7c03ec Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 2 May 2007 14:07:09 +0000 Subject: [PATCH] Buffed maximal semaphore count. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20972 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/build/libroot/sem.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/build/libroot/sem.cpp b/src/build/libroot/sem.cpp index 4dc66cecc3..9935724f8d 100644 --- a/src/build/libroot/sem.cpp +++ b/src/build/libroot/sem.cpp @@ -10,12 +10,12 @@ // semaphores. Simple fakes are sufficient. struct semaphore { - char name[B_OS_NAME_LENGTH]; + char* name; int32 count; bool inUse; }; -static const int kSemaphoreCount = 1024; +static const int kSemaphoreCount = 10240; static semaphore sSemaphores[kSemaphoreCount]; @@ -34,9 +34,13 @@ create_sem(int32 count, const char *name) for (int i = 0; i < kSemaphoreCount; i++) { semaphore &sem = sSemaphores[i]; if (!sem.inUse) { + sem.name = strdup(name ? name : "unnamed sem"); + if (!sem.name) + return B_NO_MEMORY; + sem.inUse = true; sem.count = count; - strlcpy(sem.name, name, sizeof(sem.name)); + return i; } } @@ -178,7 +182,7 @@ _get_sem_info(sem_id id, struct sem_info *info, size_t infoSize) info->sem = id; info->team = 1; - info->name[0] = '\0'; + strlcpy(info->name, sSemaphores[id].name, sizeof(info->name)); info->count = sSemaphores[id].count; info->latest_holder = -1;