[NSWI004] Lab machine problem

Vojtech Horky horky at d3s.mff.cuni.cz
Tue Oct 6 14:01:48 CEST 2020


Hello.

Dne 06. 10. 20 v 13:36 Georgii Ekserdzhian napsal(a):
> trying to include some headers in print.c needed for the printk function 
> like stdlib.h needed for malloc, or time.h needed for struct timespec 
> produces an error:
> "fatal error: stdlib.h: No such file and directory"

That is a correct behavior. As stated in the assignment:

In kernel mode, you are on your own -- there is no runtime library that
you can rely on, even for things such as printing formatted strings, let
alone memory allocation, time management, or file access.

In other words: there is no other functionality than the one you find in 
your repository (including headers). You have to implement it by yourself.


Note that for this assignment you do not need malloc or struct timespec.

I assume you used malloc for allocating buffer when converting int to 
string: that buffer is small enough to fit onto the stack.

Regarding struct timespec - that part of printf is not supposed to be 
ported to A01.


Hope this helps,
- VH


More information about the NSWI004 mailing list