* Added some padding to the sem_t structure.

* Changed the semantics of unnamed semaphores. Before parent and child
  of a fork() would always share an earlier created semaphore. Now we do
  that only, if the "shared" parameter of sem_init() was true. That's
  still not quite the behavior Linux and Solaris have, but should be
  perfectly fine with how reasonable code would use the API.
* There's a global table for shared unnamed semaphores now. ATM a
  semaphore is leaked when no one explicitly destroys it (just as with
  named sems).
* Enforce per-team and global semaphore number limits.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25362 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-05-08 01:39:49 +00:00
parent 01b1098795
commit 3dfe682f55
4 changed files with 382 additions and 88 deletions
+3 -1
View File
@@ -5,12 +5,14 @@
#ifndef _SEMAPHORE_H_
#define _SEMAPHORE_H_
#include <stdint.h>
#include <sys/cdefs.h>
#include <time.h>
typedef struct {
int id;
int32_t id;
int32_t _padding[3];
} sem_t;
#define SEM_FAILED ((sem_t*)(long)-1)
+3 -3
View File
@@ -77,9 +77,9 @@ extern status_t _kern_get_next_sem_info(team_id team, int32 *cookie,
extern status_t _kern_set_sem_owner(sem_id id, team_id proc);
/* POSIX realtime sem syscalls */
extern status_t _kern_realtime_sem_open(const char* name, int openFlags,
mode_t mode, uint32 semCount, sem_t* userSem,
sem_t** _usedUserSem);
extern status_t _kern_realtime_sem_open(const char* name,
int openFlagsOrShared, mode_t mode, uint32 semCount,
sem_t* userSem, sem_t** _usedUserSem);
extern status_t _kern_realtime_sem_close(sem_id semID,
sem_t** _deleteUserSem);
extern status_t _kern_realtime_sem_unlink(const char* name);