Modified to work in a freestanding environment, for linking into the kernel:
* Removed references to headers not supported in a freestanding environment, such as <errno.h>.
* Removed all complex arithmetic, which is unnecessary in a kernel, and doesn't seem to work in a freestanding environment.
* Added references to the __JAZZ__ macro, to not use POSIX headers when it is defined.