Fix MODE=tinylinux build

This commit is contained in:
Justine Tunney 2024-07-06 01:39:15 -07:00
parent 8c645fa1ee
commit 6be030cd7c
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
8 changed files with 77 additions and 98 deletions

View file

@ -16,27 +16,25 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/stdio/internal.h"
#include "libc/stdio/stdio.h"
#include "libc/sysv/consts/fileno.h"
#include "libc/sysv/consts/o.h"
#include "libc/thread/thread.h"
static FILE __stderr = {
.fd = STDERR_FILENO,
.bufmode = _IONBF,
.iomode = O_WRONLY,
.buf = __stderr.mem,
.size = sizeof(stderr->mem),
.lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
};
/**
* Pointer to standard error stream.
*/
FILE *stderr;
static FILE __stderr;
FILE *stderr = &__stderr;
__attribute__((__constructor__(60))) static textstartup void errinit(void) {
stderr = &__stderr;
stderr->fd = STDERR_FILENO;
stderr->bufmode = _IONBF;
stderr->iomode = O_WRONLY;
stderr->buf = stderr->mem;
stderr->size = sizeof(stderr->mem);
stderr->lock._word = PTHREAD_MUTEX_RECURSIVE;
__fflush_register(stderr);
}