Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

Commit

Permalink
Fix dei commit 68ea2a3 #19 1c25def #12
Browse files Browse the repository at this point in the history
  • Loading branch information
jjak0b committed May 20, 2020
1 parent 68ea2a3 commit e9414be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
23 changes: 11 additions & 12 deletions src/handler/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ word Syscaller( state_t *state, word sysNo, word param1, word param2, word param
Sys5_Passeren( (int*)param1 );
break;
case WAITIO:
Sys6_DoIO( param1, (word*)param2, (int)param3 );
b_hasReturnValue = TRUE;
*returnValue = (int) Sys6_DoIO( param1, (word*)param2, (int)param3 );
break;
case SPECPASSUP:
b_hasReturnValue = TRUE;
Expand Down Expand Up @@ -135,22 +136,20 @@ int Sys6_DoIO( word command, word *devregAddr, int subdevice ) {
int *semKey = device_GetSem( devLine, devNo, subdevice );
int b_error = semKey == NULL;
pcb_t *pid = scheduler_GetRunningProcess();
if( !b_error ) {
b_error = semaphore_P( semKey, pid );

// un semaforo di un device è sempre almeno inizializzato a 0, e quindi è sempre sospeso
if( !b_error && *semKey >= 0 ){
if( devLine == IL_TERMINAL ) {
if( !subdevice ) {
devreg->term.transm_command = command;
}
else {
devreg->term.recv_command = command;
}
if( !b_error && *semKey >= 0 && !(b_error = semaphore_P( semKey, pid ) ) ) {
if( devLine == IL_TERMINAL ) {
if( !subdevice ) {
devreg->term.transm_command = command;
}
else {
devreg->dtp.command = command;
devreg->term.recv_command = command;
}
}
else {
devreg->dtp.command = command;
}
}
return b_error;
}
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int scheduler_RemoveProgeny( pcb_t* p ) {
* e poi elimina il padre appena elaborato dallo stack per deallocarlo
*/

if( !scheduler_RemoveProcessFromAnyQ( parent ) ){
if( scheduler_RemoveProcessFromAnyQ( parent ) ){
return -1;
}
list_add( &p->p_next, &pcb_stack );
Expand Down
1 change: 1 addition & 0 deletions src/utilities/semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ int semaphore_P( int *semkey, pcb_t * p ) {
int b_error = 0;
if( --(*semkey) < 0 ) {
b_error = scheduler_StateToWaiting( p, semkey );
if( b_error ) ++(*semkey);
}
return b_error;
}
Expand Down

0 comments on commit e9414be

Please sign in to comment.