diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-22 23:27:56 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-22 23:30:32 +0100 |
| commit | 0f30d227497418c6d3bef7d52244407e30454504 (patch) | |
| tree | 0e1ac19623d3268380cf74328cdf643648a2f43c /lib/libc/stdio/stdout.c | |
| parent | 90dad97fc07f049383903a166631e2c257f9b8c1 (diff) | |
Added c11 threads, fixed some locks and add *_unlocked functions
Diffstat (limited to 'lib/libc/stdio/stdout.c')
| -rw-r--r-- | lib/libc/stdio/stdout.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/libc/stdio/stdout.c b/lib/libc/stdio/stdout.c deleted file mode 100644 index 471a54b9..00000000 --- a/lib/libc/stdio/stdout.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "__stdio.h" // for __FILE, __libc_fadd - -#include <atomic.h> // for LIBC_LOCK, LIBC_UNLOCK -#include <fcntl.h> // for O_WRONLY -#include <stddef.h> // for NULL -#include <stdio.h> // for stdout -#include <sys/cdefs.h> -#include <unistd.h> // for STDOUT_FILENO - -#define BUFSIZ 4096 - -__weak char __stdout_buffer[0]; -static atomic_flag __stdio_lock = ATOMIC_FLAG_INIT; -struct __FILE __stdout = { .fd = STDOUT_FILENO, - .flags = O_WRONLY, - .type = 1, - .buf = __stdout_buffer, - .buf_len = 0, - .buf_size = BUFSIZ, - .buf_pos = 0, - .eof = 0, - .unget_cnt = 0, - .offset = 0, - .next = NULL, - .lock = ATOMIC_FLAG_INIT }; - -struct __FILE *const stdout = (struct __FILE *)&__stdout; - -void __libc_fadd(struct __FILE *f) -{ - LIBC_LOCK(__stdio_lock); - struct __FILE *cur = &__stdout; - while (cur->next) - cur = cur->next; - cur->next = f; - LIBC_UNLOCK(__stdio_lock); -} |
