Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 37 → Rev 38

/shark/trunk/kernel/modules/pi.c
20,11 → 20,11
 
/**
------------
CVS : $Id: pi.c,v 1.1.1.1 2002-03-29 14:12:52 pj Exp $
CVS : $Id: pi.c,v 1.2 2003-01-07 17:07:50 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:52 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:07:50 $
------------
 
Priority Inhertitance protocol. see pi.h for more details...
56,7 → 56,6
#include <ll/ll.h>
#include <ll/string.h>
#include <ll/stdio.h>
#include <modules/codes.h>
#include <kernel/const.h>
#include <sys/types.h>
#include <kernel/descr.h>
83,6 → 82,7
 
 
 
#if 0
/*+ print resource protocol statistics...+*/
static void PI_resource_status(RLEVEL r)
{
94,19 → 94,14
kern_printf("%-4d", m->nlocked[i]);
}
}
#endif
 
 
static int PI_level_accept_resource_model(RLEVEL l, RES_MODEL *r)
static int PI_res_register(RLEVEL l, PID p, RES_MODEL *r)
{
/* priority inheritance works with all tasks without Resource parameters */
return -1;
}
 
static void PI_res_register(RLEVEL l, PID p, RES_MODEL *r)
{
/* never called!!! */
}
 
static void PI_res_detach(RLEVEL l, PID p)
{
PI_mutex_resource_des *m = (PI_mutex_resource_des *)(resource_table[l]);
115,18 → 110,13
kern_raise(XMUTEX_OWNER_KILLED, p);
}
 
static int PI_level_accept_mutexattr(RLEVEL l, const mutexattr_t *a)
{
if (a->mclass == PI_MCLASS || a->mclass == (PI_MCLASS | l) )
return 0;
else
return -1;
}
 
static int PI_init(RLEVEL l, mutex_t *m, const mutexattr_t *a)
{
PI_mutex_t *p;
 
if (a->mclass != PI_MCLASS)
return -1;
 
p = (PI_mutex_t *) kern_alloc(sizeof(PI_mutex_t));
 
/* control if there is enough memory; no control on init on a
299,7 → 289,7
return 0;
}
 
void PI_register_module(void)
RLEVEL PI_register_module(void)
{
RLEVEL l; /* the level that we register */
PI_mutex_resource_des *m; /* for readableness only */
317,20 → 307,11
resource_table[l] = (resource_des *)m;
 
/* fill the resource_des descriptor */
strncpy(m->m.r.res_name, PI_MODULENAME, MAX_MODULENAME);
m->m.r.res_code = PI_MODULE_CODE;
m->m.r.res_version = PI_MODULE_VERSION;
 
m->m.r.rtype = MUTEX_RTYPE;
 
m->m.r.resource_status = PI_resource_status;
m->m.r.level_accept_resource_model = PI_level_accept_resource_model;
m->m.r.res_register = PI_res_register;
 
m->m.r.res_detach = PI_res_detach;
 
/* fill the mutex_resource_des descriptor */
m->m.level_accept_mutexattr = PI_level_accept_mutexattr;
m->m.init = PI_init;
m->m.destroy = PI_destroy;
m->m.lock = PI_lock;
342,5 → 323,7
m->nlocked[i] = 0;
m->blocked[i] = NIL;
}
return l;
}