/shark/trunk/kernel/pthread.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: pthread.c,v 1.3 2003-11-05 15:05:12 giacomo Exp $ |
CVS : $Id: pthread.c,v 1.2 2003-10-07 09:25:33 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-11-05 15:05:12 $ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-10-07 09:25:33 $ |
------------ |
pthread.c |
135,12 → 135,10 |
struct sched_param *param) |
{ |
int returnvalue; |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
returnvalue = POSIX_getschedparam(level_sched, thread, policy, |
¶m->sched_priority); |
kern_frestore(f); |
kern_sti(); |
return returnvalue; |
} |
147,10 → 145,8 |
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param) |
{ |
int returnvalue; |
SYS_FLAGS f; |
kern_cli(); |
f = kern_fsave(); |
returnvalue = POSIX_setschedparam(level_sched, thread, policy, |
param->sched_priority); |
159,7 → 155,7 |
sched_get_priority_max(SCHED_RR) - |
param->sched_priority); |
kern_frestore(f); |
kern_sti(); |
return returnvalue; |
} |
264,16 → 260,14 |
int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) |
{ |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
if (!(*once_control)) { |
*once_control = 1; |
kern_frestore(f); |
kern_sti(); |
init_routine(); |
} |
else |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
/shark/trunk/kernel/mutex.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: mutex.c,v 1.4 2003-11-05 15:05:12 giacomo Exp $ |
CVS : $Id: mutex.c,v 1.3 2003-09-12 10:10:41 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-11-05 15:05:12 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-09-12 10:10:41 $ |
------------ |
This file contains the mutex and condition variables handling functions. |
89,10 → 89,9 |
int mutex_init(mutex_t *mutex, const mutexattr_t *attr) |
{ |
RLEVEL l; |
SYS_FLAGS f; |
int result; |
f = kern_fsave(); |
kern_cli(); |
mutex->mutexlevel = -1; |
mutex->use = 0; |
103,12 → 102,12 |
/* can the mutex level manage the mutexattr_t ? */ |
if ((result = m->init(l, mutex, attr)) >=0) { |
kern_frestore(f); |
kern_sti(); |
return result; |
} |
} |
} |
kern_frestore(f); |
kern_sti(); |
return EINVAL; |
} |
/shark/trunk/kernel/signal.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: signal.c,v 1.5 2003-11-05 15:05:12 giacomo Exp $ |
CVS : $Id: signal.c,v 1.4 2003-09-12 10:10:41 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.5 $ |
Last update: $Date: 2003-11-05 15:05:12 $ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-09-12 10:10:41 $ |
------------ |
This file contains: |
244,9 → 244,8 |
{ |
proc_des *task; /* current executing task... */ |
int err = 0; |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
task = &proc_table[exec_shadow]; |
285,7 → 284,7 |
kern_deliver_async_signal(sig); |
} |
kern_frestore(f); |
kern_sti(); |
return err; |
} |
297,8 → 296,7 |
task_signal(PID p, int signo) |
{ |
// int enabled; |
SYS_FLAGS f; |
/* Error check? Sure! */ |
if (!signo) |
return 0; |
309,7 → 307,7 |
if (proc_table[p].status == FREE) |
return EINVAL; |
f = kern_fsave(); |
kern_cli(); |
/* |
* Look at the process sigactions. If the "process" is ignoring |
317,7 → 315,7 |
*/ |
if (!(sigactions[signo].sa_flags & SA_SIGINFO) && |
sigactions[signo].sa_handler == SIG_IGN) { |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
349,7 → 347,7 |
kern_deliver_pending_signals(); |
} |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
721,12 → 719,11 |
int thissig; |
LEVEL l; |
SYS_FLAGS f; |
task_testcancel(); |
/* siglock and pthread siglock are taken from an interrupt handler */ |
f = kern_fsave(); |
kern_cli(); |
/* |
* First check for process pending signals. Must take and hold |
747,7 → 744,7 |
sigdelset(&pthread->sigpending, thissig); |
sigdelset(&procsigpending, thissig); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
777,7 → 774,7 |
sig_queue[sos].next = sigqueue_free; |
sigqueue_free = sos; |
} |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
790,7 → 787,7 |
info->si_code = SI_USER; |
info->si_value.sival_int = 0; |
sigdelset(&pthread->sigpending, thissig); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
799,7 → 796,7 |
* is zero, its an error. |
*/ |
if (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0) { |
kern_frestore(f); |
kern_sti(); |
return EAGAIN; |
} |
854,7 → 851,7 |
* Look for timeout. |
*/ |
if (proc_table[exec_shadow].control & SIGTIMEOUT_EXPIRED) { |
kern_frestore(f); |
kern_sti(); |
return EAGAIN; |
} |
876,7 → 873,7 |
info->si_value.sival_int = 0; |
sigdelset(&procsigpending, thissig); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
906,7 → 903,7 |
sigqueue_free = sos; |
} |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
916,7 → 913,7 |
* thread wait was interrupted for some other reason. Return EINTR. |
*/ |
if (! (pthread->sigpending & *set)) { |
kern_frestore(f); |
kern_sti(); |
return EINTR; |
} |
928,7 → 925,7 |
info->si_code = SI_USER; |
info->si_value.sival_int = 0; |
sigdelset(&pthread->sigpending, thissig); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
1019,12 → 1016,12 |
int sigsuspend(const sigset_t *set) |
{ |
proc_des *pthread = &proc_table[exec_shadow]; |
SYS_FLAGS f; |
LEVEL l; |
task_testcancel(); |
f = kern_fsave(); |
kern_cli(); |
/* |
* Now check for pthread pending signals. |
1031,7 → 1028,7 |
*/ |
if (pthread->sigpending & *set) { |
kern_deliver_pending_signals(); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
1067,7 → 1064,7 |
* thread wait was interrupted for some other reason. Return EINTR. |
*/ |
if (! (pthread->sigpending & *set)) { |
kern_frestore(f); |
kern_sti(); |
return EINTR; |
} |
1075,7 → 1072,7 |
* Otherwise, deliver the signals. |
*/ |
kern_deliver_pending_signals(); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
1095,9 → 1092,8 |
unsigned int alarm(unsigned int seconds) |
{ |
struct timespec returnvalue, temp; |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
kern_gettime(&temp); |
1117,7 → 1113,7 |
else |
alarm_timer = -1; |
kern_frestore(f); |
kern_sti(); |
return returnvalue.tv_sec; |
} |
1304,6 → 1300,7 |
sigmask |= act.sa_mask; |
sigdelset(&task->sigpending, sig); |
task->sigmask = sigmask; |
kern_sti(); |
/* |
* and call the handler ... |
1317,6 → 1314,7 |
/* NB: when we pass the kern_cli(), there can be the case that |
an irq (and/or a timer...) fired... and do a context change. |
so, we return here after an indefinite time... */ |
kern_cli(); |
task->sigmask = oldmask; |
kern_frestore(f); |
1330,7 → 1328,6 |
void kern_raise(int n, PID p) |
{ |
union sigval v; |
SYS_FLAGS f; |
PID sos; /* temp. PID */ |
v.sival_int = n; |
1338,7 → 1335,7 |
/* sigqueue set the p field to exec_shadow... so whe change it for a |
little... because sigqueue fill descriptor with exec_shadow... */ |
f = kern_fsave(); |
kern_cli(); |
sos = exec_shadow; |
exec_shadow = p; |
1347,7 → 1344,7 |
active_exc = 0; |
exec_shadow = sos; |
kern_frestore(f); |
kern_sti(); |
/* (*) |
when we are in an exception, we don't have to call the |
/shark/trunk/kernel/cancel.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: cancel.c,v 1.3 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: cancel.c,v 1.2 2003-09-12 10:10:40 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-09-12 10:10:40 $ |
------------ |
This file contains: |
85,12 → 85,10 |
/*+ This primitive set the cancellation state of the task +*/ |
int task_setcancelstate(int state, int *oldstate) |
{ |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
if (state != TASK_CANCEL_ENABLE && |
state != TASK_CANCEL_DISABLE) { |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
98,7 → 96,7 |
proc_table[exec_shadow].control &= ~KILL_ENABLED; |
proc_table[exec_shadow].control |= state; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
105,12 → 103,10 |
/*+ This primitive set the cancellation type of the task +*/ |
int task_setcanceltype(int type, int *oldtype) |
{ |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
if (type != TASK_CANCEL_DEFERRED && |
type != TASK_CANCEL_ASYNCHRONOUS) { |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
118,6 → 114,6 |
proc_table[exec_shadow].control &= ~KILL_DEFERRED; |
proc_table[exec_shadow].control |= type; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
/shark/trunk/kernel/int_sem.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: int_sem.c,v 1.4 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: int_sem.c,v 1.3 2003-01-07 17:07:49 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
Internal semaphores. |
75,10 → 75,12 |
{ |
SYS_FLAGS f; |
//kern_cli(); |
f = kern_fsave(); |
if (s->count) { |
s->count--; |
//kern_sti(); |
kern_frestore(f); |
return; |
} |
112,14 → 114,18 |
{ |
SYS_FLAGS f; |
//kern_cli(); |
f = kern_fsave(); |
if (s->count) { |
s->count--; |
//kern_sti(); |
kern_frestore(f); |
return 0; |
} |
//kern_sti(); |
kern_frestore(f); |
return -1; |
} |
149,6 → 155,7 |
register int returnvalue; |
SYS_FLAGS f; |
//kern_cli(); |
f = kern_fsave(); |
if (s->blocked.first == -1) |
returnvalue = s->count; |
155,6 → 162,7 |
else |
returnvalue = -1; |
//kern_sti(); |
kern_frestore(f); |
return returnvalue; |
} |
/shark/trunk/kernel/activate.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: activate.c,v 1.4 2003-11-05 15:05:10 giacomo Exp $ |
CVS : $Id: activate.c,v 1.3 2003-01-07 17:07:48 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-11-05 15:05:10 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:07:48 $ |
------------ |
task_activate & group_activate |
182,13 → 182,13 |
trc_logevent(TRC_ACTIVATE,&i); |
l = proc_table[i].task_level; |
level_table[l]->public_activate(l,i); |
event_need_reschedule(); |
} |
event_need_reschedule(); |
kern_frestore(f); |
} |
else { |
proc_table[exec_shadow].context = kern_context_save(); |
for (i=0 ; i<MAX_PROC; i++) |
if (proc_table[i].group == g) { |
if (proc_table[i].control & FREEZE_ACTIVATION) { |
/shark/trunk/kernel/mqueue.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: mqueue.c,v 1.4 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: mqueue.c,v 1.3 2003-01-07 17:07:49 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
POSIX message queues |
114,9 → 114,8 |
mode_t m; |
mqd_t mq; |
struct mq_attr *attr; |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
for (i = 0; i < MQ_OPEN_MAX; i++) |
if (mq_table[i].flags & MQ_USED) { |
128,20 → 127,20 |
if (found) { |
if (oflag == (O_CREAT | O_EXCL)) { |
errno = EEXIST; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} else { |
kern_frestore(f); |
kern_sti(); |
return i; |
} |
} else { |
if (!(oflag & O_CREAT)) { |
errno = ENOENT; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} else if (!(oflag & O_RDWR)) { |
errno = EACCES; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} else { |
va_list l; |
156,7 → 155,7 |
mq_table[mq].name = kern_alloc(strlen((char *)name)+1); |
if (!mq_table[mq].name) { |
errno = ENOSPC; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
strcpy(mq_table[mq].name, (char *)name); |
188,7 → 187,7 |
kern_free(mq_table[mq].name,strlen((char *)name)+1); |
errno = ENOSPC; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
200,7 → 199,7 |
mq_table[mq].maxmsg * mq_table[mq].msgsize); |
errno = ENOSPC; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
211,12 → 210,12 |
mq_table[mq].mq_first = 0; |
free_mq = mq_table[mq].next; |
kern_frestore(f); |
kern_sti(); |
return mq; |
} |
else { |
errno = ENOSPC; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
} |
225,15 → 224,13 |
int mq_close(mqd_t mqdes) |
{ |
SYS_FLAGS f; |
kern_cli(); |
f = kern_fsave(); |
if (mqdes < 0 || |
mqdes >= MQ_OPEN_MAX || |
!(mq_table[mqdes].flags & MQ_USED) ) { |
errno = EBADF; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
247,7 → 244,7 |
mq_table[mqdes].next = free_mq; |
free_mq = mqdes; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
255,9 → 252,8 |
{ |
int i; |
int found = 0; |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
for (i = 0; i < MQ_OPEN_MAX; i++) |
if (mq_table[i].flags & MQ_USED) { |
276,11 → 272,11 |
mq_table[i].flags = 0; |
mq_table[i].next = free_mq; |
free_mq = i; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} else { |
errno = ENOENT; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
} |
398,11 → 394,10 |
unsigned int msg_prio) |
{ |
int newmsg; |
SYS_FLAGS f; |
task_testcancel(); |
f = kern_fsave(); |
kern_cli(); |
/* first, if it is the first time that mq_receive or mq_send is called, |
register the cancellation point */ |
416,19 → 411,19 |
mqdes >= MQ_OPEN_MAX || |
!(mq_table[mqdes].flags & MQ_USED) ) { |
errno = EBADF; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
if (msg_len > mq_table[mqdes].msgsize) { |
errno = EMSGSIZE; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
if (msg_prio > MQ_PRIO_MAX) { |
errno = EINVAL; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
437,7 → 432,7 |
/* the message queue is full!!! */ |
if (mq_table[mqdes].flags & O_NONBLOCK) { |
errno = EAGAIN; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
else { |
470,7 → 465,7 |
if (mqproc_table[exec_shadow].intsig) { |
errno = EINTR; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
} |
550,7 → 545,7 |
} |
} |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
560,11 → 555,10 |
int msg; |
PID p; |
ssize_t returnvalue; |
SYS_FLAGS f; |
task_testcancel(); |
f = kern_fsave(); |
kern_cli(); |
/* first, if it is the first time that mq_receive or mq_send is called, |
register the cancellation point */ |
578,13 → 572,13 |
mqdes >= MQ_OPEN_MAX || |
!(mq_table[mqdes].flags & MQ_USED) ) { |
errno = EBADF; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
if (msg_len > mq_table[mqdes].msgsize) { |
errno = EMSGSIZE; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
593,7 → 587,7 |
/* the message queue is empty!!! */ |
if (mq_table[mqdes].flags & O_NONBLOCK) { |
errno = EAGAIN; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
else { |
626,7 → 620,7 |
if (mqproc_table[exec_shadow].intsig) { |
errno = EINTR; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
} |
672,21 → 666,19 |
return returnvalue; |
} |
kern_frestore(f); |
kern_sti(); |
return returnvalue; |
} |
int mq_notify(mqd_t mqdes, const struct sigevent *notification) |
{ |
SYS_FLAGS f; |
kern_cli(); |
f = kern_fsave(); |
if (mqdes < 0 || |
mqdes >= MQ_OPEN_MAX || |
!(mq_table[mqdes].flags & MQ_USED) ) { |
errno = EBADF; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
693,12 → 685,12 |
if (mq_table[mqdes].flags & MQ_NOTIFICATION_PRESENT) { |
if (!notification) { |
mq_table[mqdes].flags &= ~MQ_NOTIFICATION_PRESENT; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
else { |
errno = EBUSY; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
} |
707,7 → 699,7 |
memcpy(&mq_table[mqdes].notification, notification,sizeof(struct sigevent)); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
714,15 → 706,13 |
int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat, |
struct mq_attr *omqstat) |
{ |
SYS_FLAGS f; |
kern_cli(); |
f = kern_fsave(); |
if (mqdes < 0 || |
mqdes >= MQ_OPEN_MAX || |
!(mq_table[mqdes].flags & MQ_USED) ) { |
errno = EBADF; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
735,21 → 725,19 |
mq_table[mqdes].flags = (mq_table[mqdes].flags & ~O_NONBLOCK) | |
(mqstat->mq_flags & O_NONBLOCK); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat) |
{ |
SYS_FLAGS f; |
kern_cli(); |
f = kern_fsave(); |
if (mqdes < 0 || |
mqdes >= MQ_OPEN_MAX || |
!(mq_table[mqdes].flags & MQ_USED) ) { |
errno = EBADF; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
758,6 → 746,6 |
mqstat->mq_msgsize = mq_table[mqdes].msgsize; |
mqstat->mq_curmsgs = mq_table[mqdes].count; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
/shark/trunk/kernel/conditio.c |
---|
20,11 → 20,11 |
/** |
------------ |
CVS : $Id: conditio.c,v 1.4 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: conditio.c,v 1.3 2003-01-07 17:07:49 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
This file contains the condition variables handling functions. |
217,6 → 217,7 |
exec = exec_shadow = -1; |
scheduler(); |
ll_context_to(proc_table[exec_shadow].context); |
kern_sti(); |
/* when we arrive here: |
- the task did't die while it was waiting on the condition |
340,6 → 341,8 |
if (proc_table[exec_shadow].delay_timer != -1) |
kern_event_delete(proc_table[exec_shadow].delay_timer); |
kern_sti(); |
/* when we arrive here: |
- the task did't die while it was waiting on the condition |
(normally, the cancelability state is set to deferred; |
/shark/trunk/kernel/kill.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: kill.c,v 1.4 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: kill.c,v 1.3 2003-01-07 17:07:49 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
This file contains: |
223,10 → 223,8 |
*/ |
void task_abort(void *returnvalue) |
{ |
SYS_FLAGS f; |
kern_cli(); |
f = kern_fsave(); |
task_makefree(returnvalue); |
ll_context_to(proc_table[exec_shadow].context); |
241,19 → 239,18 |
int task_kill(PID i) |
{ |
int j; /* a counter */ |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
if (proc_table[i].control & NO_KILL || |
proc_table[i].status == FREE) { |
errno = EINVALID_KILL; |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
if (proc_table[i].control & KILL_REQUEST) { |
/* the task was already killed before... do nothing!!! */ |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
277,7 → 274,7 |
proc_table[i].control |= KILL_REQUEST; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
288,7 → 285,6 |
{ |
BYTE autokill; |
register PID i; |
SYS_FLAGS f; |
int j; /* a counter */ |
297,7 → 293,7 |
return -1; |
} |
f = kern_fsave(); |
kern_cli(); |
/* Detect suicide */ |
autokill = (g == proc_table[exec].group); |
333,7 → 329,7 |
ll_context_to(proc_table[exec].context); |
} |
else |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
/shark/trunk/kernel/time.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: time.c,v 1.3 2003-11-05 15:05:12 giacomo Exp $ |
CVS : $Id: time.c,v 1.2 2003-01-07 17:07:49 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-11-05 15:05:12 $ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
This file contains the functions defined in time.h |
142,17 → 142,15 |
int timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid) |
{ |
SYS_FLAGS f; |
if (clock_id != CLOCK_REALTIME) { |
errno = EINVAL; |
return -1; |
} |
f = kern_fsave(); |
kern_cli(); |
if (timerqueue_free == -1 || sigqueue_free == -1) { |
kern_frestore(f); |
kern_sti(); |
errno = EAGAIN; |
return -1; |
} |
186,7 → 184,7 |
timer_table[*timerid].overrun = 0; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
197,17 → 195,15 |
int timer_delete(timer_t timerid) |
{ |
SYS_FLAGS f; |
if (timerid < 0 || timerid >= TIMER_MAX) { |
errno = EINVAL; |
return -1; |
} |
f = kern_fsave(); |
kern_cli(); |
if (!timer_table[timerid].used) { |
kern_frestore(f); |
kern_sti(); |
errno = EINVAL; |
return -1; |
} |
232,7 → 228,7 |
~(USED_FOR_TIMER | SIGNAL_POSTED); |
} |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
326,7 → 322,6 |
{ |
struct timespec ct; /* current time */ |
int ct_read = 0; /* we take the current time only once */ |
SYS_FLAGS f; |
if (timerid < 0 || timerid >= TIMER_MAX || !value) { |
errno = EINVAL; |
345,10 → 340,10 |
return -1; |
} |
f = kern_fsave(); |
kern_cli(); |
if (!timer_table[timerid].used) { |
kern_frestore(f); |
kern_sti(); |
errno = EINVAL; |
return -1; |
} |
394,7 → 389,7 |
timer_table[timerid].current.tv_nsec/1000); */ |
} |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
401,7 → 396,6 |
int timer_gettime(timer_t timerid, struct itimerspec *value) |
{ |
struct timespec ct; /* current time */ |
SYS_FLAGS f; |
if (timerid < 0 || timerid >= TIMER_MAX) { |
errno = EINVAL; |
408,10 → 402,10 |
return -1; |
} |
f = kern_fsave(); |
kern_cli(); |
if (!timer_table[timerid].used) { |
kern_frestore(f); |
kern_sti(); |
errno = EINVAL; |
return -1; |
} |
427,7 → 421,7 |
/* and return the reactivation period */ |
TIMESPEC_ASSIGN(&value->it_interval, &timer_table[timerid].period); |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
434,7 → 428,6 |
int timer_getoverrun(timer_t timerid) |
{ |
int returnvalue; |
SYS_FLAGS f; |
if (timerid < 0 || timerid >= TIMER_MAX) { |
errno = EINVAL; |
441,16 → 434,16 |
return -1; |
} |
f = kern_fsave(); |
kern_cli(); |
if (!timer_table[timerid].used) { |
kern_frestore(f); |
kern_sti(); |
errno = EINVAL; |
return -1; |
} |
returnvalue = timer_table[timerid].overrun; |
kern_frestore(f); |
kern_sti(); |
return returnvalue; |
} |
/shark/trunk/kernel/join.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: join.c,v 1.4 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: join.c,v 1.3 2003-01-07 17:07:49 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
task join and related primitives |
199,14 → 199,12 |
returns ESRCH if p is non correct +*/ |
int task_joinable(PID p) |
{ |
SYS_FLAGS f; |
if (p<0 || p>=MAX_PROC) return ESRCH; |
if (proc_table[p].status == FREE) return ESRCH; |
f = kern_fsave(); |
kern_cli(); |
proc_table[p].control |= TASK_JOINABLE; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
217,21 → 215,19 |
ESRCH if p is not correct +*/ |
int task_unjoinable(PID p) |
{ |
SYS_FLAGS f; |
if (p<0 || p>=MAX_PROC) return ESRCH; |
if (proc_table[p].status == FREE) return ESRCH; |
f = kern_fsave(); |
kern_cli(); |
if (!(proc_table[p].control & TASK_JOINABLE) || |
proc_table[p].waiting_for_me != NIL) { |
kern_frestore(f); |
kern_sti(); |
return EINVAL; |
} |
proc_table[p].control |= TASK_JOINABLE; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
/shark/trunk/kernel/tpreempt.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: tpreempt.c,v 1.3 2003-11-05 15:05:12 giacomo Exp $ |
CVS : $Id: tpreempt.c,v 1.2 2003-01-07 17:07:49 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-11-05 15:05:12 $ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
task_preempt and task_nopreempt |
68,16 → 68,14 |
descriptor control field +*/ |
void task_nopreempt(void) |
{ |
SYS_FLAGS f; |
if ((~proc_table[exec_shadow].control) & NO_PREEMPT) { |
f = kern_fsave(); |
kern_cli(); |
proc_table[exec_shadow].control |= NO_PREEMPT; |
if (cap_timer != NIL) { |
kern_event_delete(cap_timer); |
cap_timer = NIL; |
} |
kern_frestore(f); |
kern_sti(); |
} |
} |
/shark/trunk/kernel/grpcreat.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: grpcreat.c,v 1.4 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: grpcreat.c,v 1.3 2003-01-07 17:07:49 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
This file contains: |
289,8 → 289,8 |
if (!c) { // || c == global_context) { |
/* grx_close(); |
{ int i; |
for (i = 0; i<10000; i++) |
kern_printf("!!!\n"); ll_abort(666);*/ |
for (i = 0; i<10000; i++) |
kern_printf("!!!\n"); } ll_abort(666);*/ |
kern_free(tos, proc_table[i].stacksize); |
group_create_reject(i); |
errno = ENO_AVAIL_TSS; |
/shark/trunk/kernel/keys.c |
---|
19,11 → 19,11 |
/** |
------------ |
CVS : $Id: keys.c,v 1.2 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: keys.c,v 1.1.1.1 2002-03-29 14:12:52 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-03-29 14:12:52 $ |
------------ |
task_specific data |
127,12 → 127,11 |
int task_key_create(task_key_t *key, void (*d)(void *)) |
{ |
PID p; |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
if (freekey == -1) { |
kern_frestore(f); |
kern_sti(); |
return (EAGAIN); |
} |
148,7 → 147,7 |
for (p=0; p<MAX_PROC; p++) |
proc_table[p].keys[*key] = NULL; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
159,11 → 158,10 |
void *task_getspecific(task_key_t key) |
{ |
void *ret; |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
ret = proc_table[exec_shadow].keys[key]; |
kern_frestore(f); |
kern_sti(); |
return ret; |
} |
170,15 → 168,13 |
int task_setspecific(task_key_t key, const void *value) |
{ |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
if (key < 0 || key >= PTHREAD_KEYS_MAX || !key_data[key].used) { |
kern_frestore(f); |
kern_sti(); |
return (EINVAL); |
} |
proc_table[exec_shadow].keys[key] = (void *)value; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
/shark/trunk/kernel/jet.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: jet.c,v 1.2 2003-11-05 15:05:11 giacomo Exp $ |
CVS : $Id: jet.c,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-11-05 15:05:11 $ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-03-29 14:12:51 $ |
------------ |
Kernel Job Execution Time functions |
84,14 → 84,12 |
+*/ |
int jet_getstat(PID p, TIME *sum, TIME *max, int *n, TIME *curr) |
{ |
SYS_FLAGS f; |
kern_cli(); |
f = kern_fsave(); |
if (p<0 || p>=MAX_PROC || |
!(proc_table[p].control & JET_ENABLED) || |
proc_table[p].status == FREE) { |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
100,7 → 98,7 |
if (n != NULL) *n = proc_table[p].jet_n; |
if (curr != NULL) *curr= proc_table[p].jet_table[proc_table[p].jet_curr]; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
111,14 → 109,12 |
the task doesn't have the JET_ENABLE bit set. +*/ |
int jet_delstat(PID p) |
{ |
SYS_FLAGS f; |
kern_cli(); |
f = kern_fsave(); |
if (p<0 || p>=MAX_PROC || |
!(proc_table[p].control & JET_ENABLED) || |
proc_table[p].status == FREE) { |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
126,7 → 122,7 |
proc_table[p].jet_n = 0; |
proc_table[p].jet_max = 0; |
kern_frestore(f); |
kern_sti(); |
return 0; |
} |
146,14 → 142,13 |
int jet_gettable(PID p, TIME *table, int n) |
{ |
int i; |
SYS_FLAGS f; |
f = kern_fsave(); |
kern_cli(); |
if (p<0 || p>=MAX_PROC || |
!(proc_table[p].control & JET_ENABLED) || |
proc_table[p].status == FREE) { |
kern_frestore(f); |
kern_sti(); |
return -1; |
} |
170,7 → 165,7 |
i= (i+1) % JET_TABLE_DIM) |
*table++ = proc_table[p].jet_table[i]; |
kern_frestore(f); |
kern_sti(); |
return n; |
} |