Skip to content

Commit

Permalink
OS1 K July 2021: Updating solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
KockaAdmiralac committed Apr 29, 2023
1 parent 440f717 commit d167d6d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions os1/2021/7/k-sol.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int main() {
pid_t pid = fork();
if (pid < 0) return -1;
for (int i = 0; i < 10; i++) {
if (pid == 0) {
if (pid > 0) {
if (sem_wait(sem1) < 0) break;
printf("A");
fflush(stdout);
Expand All @@ -66,13 +66,13 @@ int main() {
--------------------------------------------------------------------------------
io
```cpp
interrupt void packetArrived () {
interrupt void packetArrived() {
if (pbTail == pbHead) { // Buffer full, reject packet
*ioCtrl = IO_REJECT;
} else {
for (int i=0; i < PACKET_SIZE; i++) pbTail[i] = ioData[i];
for (int i = 0; i < PACKET_SIZE; i++) pbTail[i] = ioData[i];
*ioControl = IO_COMPLETE;
if ((pbTail-packetBuffer)/PACKET_SIZE == BUFFER_SIZE - 1) {
if ((pbTail - packetBuffer)/PACKET_SIZE == BUFFER_SIZE - 1) {
pbTail = packetBuffer;
} else {
pbTail = pbTail + PACKET_SIZE;
Expand All @@ -84,7 +84,7 @@ interrupt void packetArrived () {
--------------------------------------------------------------------------------
fsimpl
```cpp
int extendFile (FCB* fcb) {
int extendFile(FCB* fcb) {
size_t entry = (fcb->size + BLOCK_SIZE - 1)/BLOCK_SIZE;
if (entry < SingleIndexSize) {
PBlock newBlock = allocateBlock();
Expand Down

0 comments on commit d167d6d

Please sign in to comment.