Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * (see the web pages for full authors list) |
||
13 | * |
||
14 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
15 | * |
||
16 | * http://www.sssup.it |
||
17 | * http://retis.sssup.it |
||
18 | * http://shark.sssup.it |
||
19 | */ |
||
20 | |||
21 | |||
22 | /** |
||
23 | ------------ |
||
80 | pj | 24 | CVS : $Id: sem.h,v 1.2 2003-03-13 13:39:05 pj Exp $ |
2 | pj | 25 | |
26 | File: $File$ |
||
80 | pj | 27 | Revision: $Revision: 1.2 $ |
28 | Last update: $Date: 2003-03-13 13:39:05 $ |
||
2 | pj | 29 | ------------ |
30 | |||
31 | This file contains the semaphoric primitives |
||
32 | |||
33 | Title: |
||
34 | HARTSEM (Hartik Semaphores) |
||
35 | |||
36 | Resource Models Accepted: |
||
37 | None |
||
38 | |||
39 | Description: |
||
40 | This module contains a semaphore library compatible with Posix, Plus |
||
41 | an extension to permit post and wait with counters > 1 |
||
42 | |||
43 | Exceptions raised: |
||
44 | None |
||
45 | |||
46 | Restrictions & special features: |
||
47 | - a function isBlocked is provided |
||
48 | - the named semaphores are NOT implemented with a filesystem |
||
49 | - the system supports up to _POSIX_SEM_NSEMS_MAX defined in limits.h |
||
50 | |||
51 | **/ |
||
52 | |||
53 | /* |
||
54 | * Copyright (C) 2000 Paolo Gai |
||
55 | * |
||
56 | * This program is free software; you can redistribute it and/or modify |
||
57 | * it under the terms of the GNU General Public License as published by |
||
58 | * the Free Software Foundation; either version 2 of the License, or |
||
59 | * (at your option) any later version. |
||
60 | * |
||
61 | * This program is distributed in the hope that it will be useful, |
||
62 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
63 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
64 | * GNU General Public License for more details. |
||
65 | * |
||
66 | * You should have received a copy of the GNU General Public License |
||
67 | * along with this program; if not, write to the Free Software |
||
68 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
69 | * |
||
70 | */ |
||
71 | |||
72 | #ifndef __MODULES_SEM_H__ |
||
73 | #define __MODULES_SEM_H__ |
||
74 | |||
75 | #include <kernel/types.h> |
||
80 | pj | 76 | #include "ll/sys/cdefs.h" |
2 | pj | 77 | |
80 | pj | 78 | __BEGIN_DECLS |
79 | |||
2 | pj | 80 | #define SEM_FAILED NULL |
81 | typedef int sem_t; |
||
82 | |||
83 | /*+ This function must be inserted in the __hartik_register_levels__ +*/ |
||
84 | void SEM_register_module(void); |
||
85 | |||
86 | int sem_close(sem_t *sem); |
||
87 | int sem_destroy(sem_t *sem); |
||
88 | int sem_getvalue(sem_t *sem, int *sval); |
||
89 | int sem_init(sem_t *sem, int pshared, unsigned int value); |
||
90 | sem_t *sem_open(const char *name, int oflag, ...); |
||
91 | int sem_post(sem_t *sem); |
||
92 | int sem_trywait(sem_t *sem); |
||
93 | int sem_unlink(const char *name); |
||
94 | int sem_wait(sem_t *sem); |
||
95 | |||
96 | |||
97 | |||
98 | int sem_xpost(sem_t *sem, int n); |
||
99 | int sem_xwait(sem_t *sem, int n, int wait); |
||
100 | |||
101 | |||
102 | int isBlocked(PID i); |
||
103 | |||
80 | pj | 104 | __END_DECLS |
2 | pj | 105 | #endif |