Subversion Repositories shark

Compare Revisions

Regard whitespace Rev 227 → Rev 228

/shark/trunk/kernel/mutex.c
18,11 → 18,11
 
/**
------------
CVS : $Id: mutex.c,v 1.2 2003-01-07 17:07:49 pj Exp $
CVS : $Id: mutex.c,v 1.3 2003-09-12 10:10:41 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:07:49 $
Revision: $Revision: 1.3 $
Last update: $Date: 2003-09-12 10:10:41 $
------------
 
This file contains the mutex and condition variables handling functions.
101,10 → 101,12
mutex_resource_des *m = (mutex_resource_des *)resource_table[l];
 
/* can the mutex level manage the mutexattr_t ? */
if ((result = m->init(l, mutex, attr)) >=0)
if ((result = m->init(l, mutex, attr)) >=0) {
kern_sti();
return result;
}
}
}
kern_sti();
 
return EINVAL;
/shark/trunk/kernel/modules/pc.c
20,11 → 20,11
 
/**
------------
CVS : $Id: pc.c,v 1.2 2003-01-07 17:07:50 pj Exp $
CVS : $Id: pc.c,v 1.3 2003-09-12 10:10:41 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:07:50 $
Revision: $Revision: 1.3 $
Last update: $Date: 2003-09-12 10:10:41 $
------------
 
Priority Ceiling protocol. see pc.h for more details...
259,9 → 259,11
kern_cli();
 
p = (PC_mutex_t *)m->opt;
if (!p)
if (!p) {
/* if the mutex is not initialized, return an error! */
kern_sti();
return (EINVAL);
}
 
if (p->owner == exec_shadow) {
/* the task already owns the mutex */
269,9 → 271,11
return (EDEADLK);
}
 
if (p->ceiling > lev->priority[exec_shadow])
if (p->ceiling > lev->priority[exec_shadow]) {
/* see POSIX standard p. 258 */
kern_sti();
return (EINVAL);
}
 
while (!PC_accept(lev, lev->priority[exec_shadow])) {
/* the mutex is locked by someone,
315,9 → 319,11
kern_cli();
 
p = (PC_mutex_t *)m->opt;
if (!p)
if (!p) {
/* if the mutex is not initialized, return an error! */
kern_sti();
return (EINVAL);
}
 
if (p->owner == exec_shadow) {
/* the task already owns the mutex */
325,9 → 331,11
return (EDEADLK);
}
 
if (p->ceiling < lev->priority[exec_shadow])
if (p->ceiling < lev->priority[exec_shadow]) {
/* see POSIX standard p. 258 */
kern_sti();
return (EINVAL);
}
 
while (!PC_accept(lev, lev->priority[exec_shadow])) {
/* a task already owns the mutex */
/shark/trunk/kernel/signal.c
18,11 → 18,11
 
/**
------------
CVS : $Id: signal.c,v 1.3 2003-01-07 17:07:49 pj Exp $
CVS : $Id: signal.c,v 1.4 2003-09-12 10:10:41 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2003-01-07 17:07:49 $
Revision: $Revision: 1.4 $
Last update: $Date: 2003-09-12 10:10:41 $
------------
 
This file contains:
1279,8 → 1279,10
* Ignored?
*/
if (!(act.sa_flags & SA_SIGINFO) && (act.sa_handler == SIG_IGN ||
act.sa_handler == SIG_ERR) )
act.sa_handler == SIG_ERR) ) {
kern_frestore(f);
return;
}
 
if (!(act.sa_flags & SA_SIGINFO) && act.sa_handler == SIG_DFL) {
/* Default action for all signals is termination */
/shark/trunk/kernel/cancel.c
18,11 → 18,11
 
/**
------------
CVS : $Id: cancel.c,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: cancel.c,v 1.2 2003-09-12 10:10:40 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-09-12 10:10:40 $
------------
 
This file contains:
87,8 → 87,10
{
kern_cli();
if (state != TASK_CANCEL_ENABLE &&
state != TASK_CANCEL_DISABLE)
state != TASK_CANCEL_DISABLE) {
kern_sti();
return -1;
}
 
*oldstate = (proc_table[exec_shadow].control & KILL_ENABLED) != 0;
proc_table[exec_shadow].control &= ~KILL_ENABLED;
103,8 → 105,10
{
kern_cli();
if (type != TASK_CANCEL_DEFERRED &&
type != TASK_CANCEL_ASYNCHRONOUS)
type != TASK_CANCEL_ASYNCHRONOUS) {
kern_sti();
return -1;
}
 
*oldtype = (proc_table[exec_shadow].control & KILL_DEFERRED) != 0;
proc_table[exec_shadow].control &= ~KILL_DEFERRED;
/shark/trunk/libc/stdlib/malloc.c
20,11 → 20,11
 
/**
------------
CVS : $Id: malloc.c,v 1.1.1.1 2002-03-29 14:12:53 pj Exp $
CVS : $Id: malloc.c,v 1.2 2003-09-12 10:11:27 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:53 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-09-12 10:11:27 $
------------
 
malloc:
59,17 → 59,15
SYS_FLAGS f;
 
f = kern_fsave();
//kern_cli();
 
p = kern_alloc(size + sizeof(size_t));
if (!p) {
kern_sti();
kern_frestore(f);
return 0;
}
 
*((size_t *) p) = size + sizeof(size_t);
 
//kern_sti();
kern_frestore(f);
 
return p + sizeof(size_t);
/shark/trunk/drivers/block/sstf/sstf.c
100,7 → 100,7
request_prologue_t *ret;
__b_fastmutex_lock(&q->mutex);
ret=q->actual;
__b_fastmutex_lock(&q->mutex);
__b_fastmutex_unlock(&q->mutex);
return ret;
}
 
/shark/trunk/drivers/block/fcfs/fcfs.c
79,7 → 79,7
 
__b_fastmutex_lock(&q->mutex);
ret=q->head;
__b_fastmutex_lock(&q->mutex);
__b_fastmutex_unlock(&q->mutex);
return ret;
}
/shark/trunk/drivers/block/edf/edf.c
111,7 → 111,7
__b_fastmutex_lock(&q->mutex);
ret=q->queue;
if (ret!=NULL) q->inservice=1;
__b_fastmutex_lock(&q->mutex);
__b_fastmutex_unlock(&q->mutex);
return ret;
}
/shark/trunk/drivers/block/pscan/pscan.c
152,7 → 152,7
}
}
//cprintf("{%i}",i);
__b_fastmutex_lock(&q->mutex);
__b_fastmutex_unlock(&q->mutex);
return ret;
}
 
/shark/trunk/drivers/block/clook/clook.c
107,7 → 107,7
q->act^=1;
ret=q->queue[q->act];
}
__b_fastmutex_lock(&q->mutex);
__b_fastmutex_unlock(&q->mutex);
return ret;
}
 
/shark/trunk/drivers/oldchar/8042.c
20,11 → 20,11
 
/**
------------
CVS : $Id: 8042.c,v 1.3 2003-04-30 14:40:14 pj Exp $
CVS : $Id: 8042.c,v 1.4 2003-09-12 10:09:55 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2003-04-30 14:40:14 $
Revision: $Revision: 1.4 $
Last update: $Date: 2003-09-12 10:09:55 $
------------
 
8042.h
433,10 → 433,16
/* Set keyboard typematic rate */
trace("Sending keyboard rate command...");
c=C8042_keyboardhandshake(KBD_CMD_SET_RATE);
if (c) return;
if (c) {
kern_frestore(f);
return;
}
trace("Sending rate...");
c=C8042_keyboardhandshake(DEFAULT_KEYBRATE);
if (c) return;
if (c) {
kern_frestore(f);
return;
}
 
/* restore interrupts status */
kern_frestore(f);
1071,7 → 1077,10
/* Disable keyboard (for the following phase) */
trace("disabling keyboard");
c=C8042_keyboardhandshake(KBD_CMD_DISABLE);
if (c) return -5;
if (c) {
kern_frestore(f);
return -5;
}
 
/* Disable PS/2 mouse port */
trace("disabling PS/2 mouse port");
1112,7 → 1121,10
/* Disable keyboard (for the following phase) */
trace("disabling keyboard");
c=C8042_keyboardhandshake(KBD_CMD_DISABLE);
if (c) return -5;
if (c) {
kern_frestore(f);
return -5;
}
/* Initialize controller "command register" */
trace("senfing WRITE_MODE command");
1123,12 → 1135,18
/* Enable PS/2 mouse port */
trace("enabling ps/2 mouse port");
c=C8042_sendctrldata(KBD_CCMD_MOUSE_ENABLE);
if (c) return -18;
if (c) {
kern_frestore(f);
return -18;
}
 
/* Enable keyboard */
trace("enabling keyboard");
c=C8042_keyboardhandshake(KBD_CMD_ENABLE);
if (c) return -37;
if (c) {
kern_frestore(f);
return -37;
}
 
/* restore interrupt mask */
trace("enabling interrupts");