Skip to content

Tip: Returning a System Call

Sue Moon edited this page Apr 1, 2021 · 7 revisions

TCPAssignment::systemCallback method does not have a return value. Those system calls that may not return immediately, such as accept(), need to be blocked until ready. You should store the corresponding UUID to return it later. For all system calls to return a value, you must use a returnSystemCall method.

Note that returning systemCallback without calling returnSystemCall will block the application.

Example

void TCPAssignment::systemCallback(UUID syscallUUID, int pid,
                                   const SystemCallParameter &param) {

    this->returnSystemCall(syscallUUID, -ENOSYS); // returns -ENOSYS (Function not implemented) from system call `syscallUUID`
}