Welcome to Premium Paper Help

#include “types.h” #include “user.h” #include “param.h” #define assert(x) if (x) { /* pass */ } else { \ printf(1, “assert failed %s %s %d\n”,

#include “types.h”
#include “user.h”
#include “param.h”

#define assert(x) if (x) { /* pass */ } else { \
printf(1, “assert failed %s %s %d\n”, #x , __FILE__, __LINE__); \
exit(); \
}

void readfile(char *file, int howmany) {
int i;
// assumes file opens successfully…
int fd = open(file, 0);
char buf;
// assumes file is big enough…
for (i = 0; i < howmany; i++)
(void) read(fd, &buf, 1);
close(fd);
}

int
main(int argc, char *argv[])
{
int rc1 = getreadcount();
printf(1, “Read count %d\n”, rc1);
int rc = fork();
if (rc < 0) {
printf(1, “Fork failed!\n”);
exit();
}
readfile(“README”, 5);
if (rc > 0) {
wait();
int rc2 = getreadcount();
printf(1, “Read count %d\n”, rc2);
assert((rc2 – rc1) == 10);
printf(1, “TEST PASSED\n”);
int fd1 = open(“ls”, 0);
int fd2 = open(“syscallTest”, 0);
int fd3 = open(“cat”, 0);
if(fd1 * fd2 * fd3 < 0){
printf(1, “Open failed!\n”);
exit();
}
close(fd1);
int of = getopenfilecount();
printf(1, “Number of opened files %d\n”, of – 3);
assert(of == 5);
printf(1, “TEST PASSED\n”);
close(fd2);
close(fd3);
}
exit();
}

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Description 2- strategy discussion: External Growth Strategies and Implementation In this module, we explored the role of the corporate headquarters a

Description 2- strategy discussion: External Growth Strategies and Implementation In this module, we explored the role of the corporate headquarters and its relationship with individual businesses, and how the corporate headquarters creates value by implementing mergers/acquisitions and strategic alliances strategies. Select a Saudi Arabian company. Discuss the decisions and actions

Instructions: 1. Read the Emotional Intelligence (EI) Handout. 2. Then, take

Instructions: 1. Read the Emotional Intelligence (EI) Handout. 2. Then, take the EI quiz 3. After you have completed the quiz, review the scores for the categories: self-awareness; self-management; social awareness and relationship management.. 4. Do a self-evaluation and see whether you are high or low in any of the

Description College of Administration and Finance Sciences Assignment (1) Deadline: Saturday 06/07/2024 @ 23:59 Course Name: Introduction to

Description College of Administration and Finance Sciences Assignment (1) Deadline: Saturday 06/07/2024 @ 23:59 Course Name: Introduction to AIS Student’s Name: Course Code: ACCT402 Student’s ID Number: Semester: Summer CRN: 50201 Academic Year: 1445-6 H For Instructor’s Use only Instructor’s Name: Habiba Moabber Students’ Grade: /15 Level of Marks: High/Middle/Low

Robert Browning’s “My Last Duchess” (poem) Prompt How do the readings address innocence and experience? How do these literary woris explore coming-of age

Robert Browning’s “My Last Duchess” (poem) Prompt How do the readings address innocence and experience? How do these literary woris explore coming-of age or the journey of life? Compare and contrast how the characters/narrators/aufhors reflect on their experiences, including auythig from childhood to married life to resival meetings and more.

Presentation Structure1. Title slide: Title, your name, 4690 ORGL Capstone, date.2. Organizational Leadership outcomes. Devote at least one slide to each

Presentation Structure1. Title slide: Title, your name, 4690 ORGL Capstone, date.2. Organizational Leadership outcomes. Devote at least one slide to each outcome.3. Identify artifacts attesting to your learning for each ORGL outcome.“A” work has two artifacts and rationale per outcome.4. Provide rationale for each artifact. Very Important!Explain how/why the item