Commit Graph

22 Commits

Author SHA1 Message Date
Andreas Kling
94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andreas Kling
e380142853 Kernel: Pass a parameter struct to rename() 2020-01-11 10:36:54 +01:00
Paweł Cholewa
b5c3bc6a71 LibC: implement fgetpos and fsetpos
They're just "front ends" for ftell and fseek, but they do their
job.

Fixes #913
2019-12-27 23:09:08 +01:00
Andreas Kling
9d681beaf0 LibC: Oops x2, we can't use "bool" in stdlib.h either 2019-12-26 10:30:34 +01:00
Shannon Booth
bbf878e987 LibC: Implement tmpfile() 2019-12-26 10:05:59 +01:00
Sergey Bugaev
b64cee4589 LibC: Remove a leftover default_stream
Long ago, there was a fourth stdio default stream, stddbg, connected to the
debug console. It has since been replaced by the dbgputstr() and dbgputch()
syscalls.

3fce2fb205

Remove the last remains of stddbg, as fd 3 is soon going to be reused for socket
takeover.
2019-11-26 19:58:25 +01:00
Brandon Scott
3069988a75 LibC: Implemented getc_unlocked, stubbed flockfile
Implemented getc_unlocked and stubbed out flockfile() and funlockfile().
2019-11-16 12:50:50 +01:00
Paweł Cholewa
c2a8c4cedd LibC: Minor changes to make nasm work
* Added some missing macros to headers
 * Stubbed strftime() time function to not assert
 * Added "rt" mode to fopen(), working just like "r" or "rb"
2019-11-09 20:52:34 +01:00
Vincent Sanders
1be4c6e9cf LibC: Stop stdio from adding null terminators out of bounds (#685)
When using the bounded string operations (e.g. snprintf), the null
terminator was always being written even if there was no space for
it (or indeed any valid buffer at all)

This overwriting caused segmentation faults and memory corruption
2019-10-24 14:12:37 +02:00
Andreas Kling
14f0a5943b LibC: Have perror() show the input string on the debugger as well 2019-10-12 14:47:06 +02:00
Andreas Kling
676af444ca LibC: Clear any ungetc()'ed data in fflush() 2019-09-27 10:15:42 +02:00
Andreas Kling
edac8704de LibC: Fix dumb off-by-two in fgets() :^)
"Play C games, win C prizes."
2019-09-22 20:03:02 +02:00
Andreas Kling
64948fa701 LibC: ungetc(EOF) should fail (and return EOF) 2019-09-22 19:51:39 +02:00
Andreas Kling
804df54296 LibC: Let's assert in rewind() that fseek()ing to the beginning worked 2019-09-22 19:41:21 +02:00
Andreas Kling
8b0d530584 LibC: fgets() shouldn't stop on '\0' 2019-09-11 23:01:55 +02:00
Andreas Kling
ada1f504fd LibC: Make sure perror() is consistent about the errno it prints 2019-09-10 19:35:51 +02:00
Andreas Kling
6cd9c020ea LibC: Write to the dbg() every time we perror() in userspace
There's a high chance that we're interested in whatever errors come out
of perror(), so let's output those on the debugger as well.
2019-08-19 17:25:49 +02:00
Andreas Kling
bd08664f05 LibC: In fgetc(), fread() will never return < 0.
Furthermore, fread() has already handled EOF, so there's no need to do
it again. If we read a character, return it, otherwise return EOF.
Note that EOF means "EOF or error" here.
2019-08-01 10:50:51 +02:00
Andreas Kling
9fb2a65716 AK: Rename ValueRestorer => ScopedValueRollback.
Qt had a pretty good name for this concept, so let's steal it. :^)
2019-07-25 15:15:46 +02:00
Andreas Kling
af81645a2a Kernel+LibC: Add a dbgputstr() syscall for sending strings to debug output.
This is very handy for the DebugLogStream implementation, among others. :^)
2019-07-21 21:43:37 +02:00
Andreas Kling
3fce2fb205 Kernel+LibC: Add a dbgputch() syscall and use it for userspace dbgprintf().
The "stddbg" stream was a cute idea but we never ended up using it in
practice, so let's simplify this and implement userspace dbgprintf() on top
of a simple dbgputch() syscall instead.

This makes debugging LibC startup a little bit easier. :^)
2019-07-21 19:45:31 +02:00
Andreas Kling
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00