
Game Syscalls Flashcards

Flashcard
•
Computers
•
University
•
Hard

Petronela Vieru
FREE Resource
Student preview

8 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Back
Students with: open(), read(), close() step forward in order.
2.
FLASHCARD QUESTION
Front
Back
The program should create a directory named "Hunt1", create a file called "treasures.dat" inside it, write a welcome message, and handle errors at every step.
3.
FLASHCARD QUESTION
Front
Back
1. creat or open
2. fstat
3.write
4. close
5. perror for all of them
4.
FLASHCARD QUESTION
Front
LEVEL 2
A program needs to create a folder, create a file inside it, read some data, and close it.
Back
Expected calls: mkdir(), open(), read(), close()
5.
FLASHCARD QUESTION
Front
LEVEL 3
Inside Directory Dir1, create a file and write to it the text "Hello", read the message from the same file. If any step fails, an error should be printed.
Back
Expected calls: mkdir(), open() or creat(), write(), close(), open(), read(), close(), perror() for each.
6.
FLASHCARD QUESTION
Front
LEVEL 4
The program should check if "entry" is a regular file. In case it is, it reads from it 4 bytes. The read content is written at the end (be careful here) to a newly created file2.txt. In case is a directory, it must be renamed it. In case it is a symbolic link, it removes the link.
Back
lstat() — Check metadata of entry
S_ISREG — Evaluate st_mode to ensure it's a regular file
open() — Open entry in read-only mode
read() — Read 4 bytes from file1.txt
close() — Close file1.txt
creat() or open()— Open file2.txt in write or create mode
lseek() - for writing at the end
write() — Write the 4 bytes read into file2.txt
close() — Close file2.txt
S_ISDIR() + rename()
S_ISLNK + unlink()
perror() — Should step in any time an error occurs
7.
FLASHCARD QUESTION
Front
LEVEL 5
Create a directory called Hunt1, add a treasure file and a log file, and create a symbolic link to the log file. At the end, remove the directory.
Back
✅ mkdir() — Create the Hunt1 directory
✅ open() — Open (or create) Hunt1/treasures.dat with O_CREAT
✅ close() — Close the treasures file
✅ open() — Open (or create) Hunt1/logged_hunt with O_CREAT
✅ close() — Close the log file
✅ symlink() — Create symbolic link from Hunt1/logged_hunt to logged_hunt-Hunt1 in the root directory
rmdir() -
🔁 perror() — May appear after any step to report an error if one occurs (e.g., directory already exists)
8.
FLASHCARD QUESTION
Front
LEVEL 6
You are given a file name.
The program should:
Check whether the path is a symbolic link
If it is, remove its link to the target file.
Check whether is a regular file, in which case we delete the file.
Check whether is a directory, in which case we delete it.
Back
✅ Required System Calls & Macros (in execution order)
StepFunction/MacroPurpose1️⃣lstat()Get file metadata without following symlinks2️⃣S_ISLNK()Check if it's a symbolic link3️⃣unlink()Remove symbolic link
✔️ At this point, if it was a symlink, the job is done.
Otherwise, continue:
StepFunction/MacroPurpose4️⃣stat()Get metadata by following symlinks (e.g., if it points to a real file)5️⃣S_ISREG()Check if it’s a regular file6️⃣unlink()Delete regular file
StepFunction/MacroPurpose7️⃣S_ISDIR()Check if it’s a directory8️⃣rmdir()Remove the directory (if empty)
🔁 perror() is used for error handling in any failure (e.g., file not found, permission denied)
Similar Resources on Wayground
8 questions
Chapter 08 Initial Setup

Flashcard
•
University
5 questions
Untitled Flashcards

Flashcard
•
University
13 questions
Introduction to C#

Flashcard
•
KG - University
11 questions
Gender Equality in Sports History

Flashcard
•
University
10 questions
Chromebook Shortcuts

Flashcard
•
KG - University
9 questions
SWO / Green Path Closure / Part Backlog

Flashcard
•
KG - University
10 questions
06 - Users and Permissions

Flashcard
•
University
10 questions
Irregular verbs

Flashcard
•
KG
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
10 questions
Afterschool Activities & Sports

Quiz
•
6th - 8th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
15 questions
Cool Tool:Chromebook

Quiz
•
6th - 8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
20 questions
Bullying

Quiz
•
7th Grade
18 questions
7SS - 30a - Budgeting

Quiz
•
6th - 8th Grade
Discover more resources for Computers
36 questions
USCB Policies and Procedures

Quiz
•
University
4 questions
Benefits of Saving

Quiz
•
5th Grade - University
20 questions
Disney Trivia

Quiz
•
University
2 questions
Pronouncing Names Correctly

Quiz
•
University
15 questions
Parts of Speech

Quiz
•
1st Grade - University
1 questions
Savings Questionnaire

Quiz
•
6th Grade - Professio...
26 questions
Parent Functions

Quiz
•
9th Grade - University
18 questions
Parent Functions

Quiz
•
9th Grade - University