C
Project design
Design the skeleton of the expert final mini app.
Project: Mini system app
In this five-lesson project you'll build a mini system app. It combines three topics from the expert section: a kernel module (kernel_init and syscall), a compiler component (parse_command for command parsing) and a security layer (security_check for buffer overflow checks).
Each lesson adds a piece; the previous lesson's solution is included in the starting code. In the first lesson you lay out the module skeleton: three function declarations and main. In the following lessons you add the kernel, the compiler and the security layer. In the final lesson you combine all pieces into a working app.
Module skeleton
The skeleton of a C project consists of function declarations (prototypes) and main. Declarations tell the compiler each function's signature in advance; definitions come later.
In this project you'll declare three functions: void kernel_init(void);, int parse_command(const char *cmd); and int security_check(const char *buf, int len);. The main function is the program's entry point; everything is called from here. Declarations come before main; definitions may come after. This structure improves readability.
Exercise Write the project skeleton
Write three function declarations: void kernel_init(void);, int parse_command(const char *cmd);, int security_check(const char *buf, int len);. Write int main(void) that calls printf("Proje başladı\n").
Show example solution
#include <stdio.h>
#include <string.h>
void kernel_init(void);
int parse_command(const char *cmd);
int security_check(const char *buf, int len);
int main(void) {
printf("Proje başladı\n");
return 0;
}
Test yourself
-
Which three topics does this project combine?
- Only compiler
- Only kernel
- Kernel + compiler + security
- Only security
Show answer
Kernel + compiler + security — The project combines three expert topics: kernel, compiler and security.
-
Complete the kernel_init declaration
void ____(void);
Show answer
void kernel_init(void);
-
Match module to purpose
- kernel_init
- Kernel init
- parse_command
- Command parsing
- security_check
- Overflow check
- main
- Entry point
Next lesson: Kernel module