mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-19 09:17:38 +03:00
Miscellaneous compat work while seeing if GNU coreutils would build.
This commit is contained in:
parent
a7f1d892a9
commit
d7a41579e5
Notes:
sideshowbarker
2024-07-19 18:32:44 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d7a41579e5a
@ -59,10 +59,11 @@ WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings
|
||||
FLAVOR_FLAGS = -mregparm=3 -march=i386 -m32 -fno-exceptions -fno-rtti -fmerge-all-constants -fno-unroll-loops -fno-pie -fno-pic
|
||||
OPTIMIZATION_FLAGS = -Os -fno-asynchronous-unwind-tables
|
||||
INCLUDE_FLAGS = -I.. -I.
|
||||
SUGGEST_FLAGS = -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override
|
||||
|
||||
DEFINES = -DSERENITY -DKERNEL -DSANITIZE_PTRS
|
||||
|
||||
CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(KERNEL_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
|
||||
CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(KERNEL_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(SUGGEST_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
|
||||
#CXX = /usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-g++
|
||||
#LD = /usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-ld
|
||||
CXX = g++-8
|
||||
|
@ -25,6 +25,7 @@ LIBC_OBJS = \
|
||||
termcap.o \
|
||||
setjmp.o \
|
||||
stat.o \
|
||||
mntent.o \
|
||||
entry.o
|
||||
|
||||
OBJS = $(AK_OBJS) $(LIBC_OBJS)
|
||||
|
@ -37,6 +37,8 @@
|
||||
__ERROR(ENAMETOOLONG, "Name too long") \
|
||||
__ERROR(ELOOP, "Too many symlinks") \
|
||||
__ERROR(EOVERFLOW, "Overflow") \
|
||||
__ERROR(EOPNOTSUPP, "Operation not supported") \
|
||||
__ERROR(ENOSYS, "No such syscall") \
|
||||
__ERROR(ENOTIMPL, "Not implemented") \
|
||||
|
||||
enum __errno_values {
|
||||
|
@ -1,3 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define PATH_MAX 4096
|
||||
|
||||
#define INT_MAX INT32_MAX
|
||||
#define INT_MIN INT32_MIN
|
||||
|
13
LibC/mntent.cpp
Normal file
13
LibC/mntent.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <mntent.h>
|
||||
#include <assert.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
struct mntent* getmntent(FILE* stream)
|
||||
{
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
23
LibC/mntent.h
Normal file
23
LibC/mntent.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdio.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define MOUNTED "/etc/mtab"
|
||||
#define MNTTAB "/etc/fstab"
|
||||
|
||||
struct mntent {
|
||||
char* mnt_fsname;
|
||||
char* mnt_dir;
|
||||
char* mnt_type;
|
||||
char* mnt_opts;
|
||||
int mnt_freq;
|
||||
int mnt_passno;
|
||||
};
|
||||
|
||||
struct mntent* getmntent(FILE* stream);
|
||||
|
||||
__END_DECLS
|
||||
|
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
@ -12,5 +12,15 @@ typedef signed int int32_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
#define INT8_MIN (-128)
|
||||
#define INT16_MIN (-32767-1)
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#define INT8_MAX (127)
|
||||
#define INT16_MAX (32767)
|
||||
#define INT32_MAX (2147483647)
|
||||
#define UINT8_MAX (255)
|
||||
#define UINT16_MAX (65535)
|
||||
#define UINT32_MAX (4294967295U)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@ -72,6 +72,8 @@ int fputc(int ch, FILE* stream)
|
||||
{
|
||||
assert(stream);
|
||||
write(stream->fd, &ch, 1);
|
||||
if (stream->eof)
|
||||
return EOF;
|
||||
return (byte)ch;
|
||||
}
|
||||
|
||||
@ -85,10 +87,31 @@ int putchar(int ch)
|
||||
return putc(ch, stdout);
|
||||
}
|
||||
|
||||
int fputs(const char* s, FILE* stream)
|
||||
{
|
||||
for (; *s; ++s) {
|
||||
int rc = putc(*s, stream);
|
||||
if (rc == EOF)
|
||||
return EOF;
|
||||
}
|
||||
return putc('\n', stream);
|
||||
}
|
||||
|
||||
int puts(const char* s)
|
||||
{
|
||||
fputs(s, stdout);
|
||||
}
|
||||
|
||||
void clearerr(FILE* stream)
|
||||
{
|
||||
assert(stream);
|
||||
stream->eof = false;
|
||||
stream->error = false;
|
||||
}
|
||||
|
||||
int ferror(FILE* stream)
|
||||
{
|
||||
return stream->error;
|
||||
}
|
||||
|
||||
size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream)
|
||||
@ -190,6 +213,7 @@ FILE* fopen(const char* pathname, const char* mode)
|
||||
auto* fp = (FILE*)malloc(sizeof(FILE));
|
||||
fp->fd = fd;
|
||||
fp->eof = false;
|
||||
fp->error = 0;
|
||||
return fp;
|
||||
}
|
||||
|
||||
@ -201,6 +225,7 @@ FILE* fdopen(int fd, const char* mode)
|
||||
auto* fp = (FILE*)malloc(sizeof(FILE));
|
||||
fp->fd = fd;
|
||||
fp->eof = false;
|
||||
fp->error = 0;
|
||||
return fp;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ __BEGIN_DECLS
|
||||
struct __STDIO_FILE {
|
||||
int fd;
|
||||
int eof;
|
||||
int error;
|
||||
};
|
||||
|
||||
typedef struct __STDIO_FILE FILE;
|
||||
@ -34,6 +35,7 @@ FILE* fopen(const char* pathname, const char* mode);
|
||||
int fclose(FILE*);
|
||||
void rewind(FILE*);
|
||||
void clearerr(FILE*);
|
||||
int ferror(FILE*);
|
||||
int feof(FILE*);
|
||||
int fflush(FILE*);
|
||||
size_t fread(void* ptr, size_t size, size_t nmemb, FILE*);
|
||||
@ -42,6 +44,9 @@ int fprintf(FILE*, const char* fmt, ...);
|
||||
int printf(const char* fmt, ...);
|
||||
int sprintf(char* buffer, const char* fmt, ...);
|
||||
int putchar(int ch);
|
||||
int putc(int ch, FILE*);
|
||||
int puts(const char*);
|
||||
int fputs(const char*, FILE*);
|
||||
void perror(const char*);
|
||||
int sscanf (const char* buf, const char* fmt, ...);
|
||||
int fscanf(FILE*, const char* fmt, ...);
|
||||
|
@ -6,5 +6,6 @@
|
||||
__BEGIN_DECLS
|
||||
|
||||
mode_t umask(mode_t);
|
||||
int chmod(const char* pathname, mode_t);
|
||||
|
||||
__END_DECLS
|
||||
|
@ -22,8 +22,8 @@ typedef uint32_t blksize_t;
|
||||
typedef uint32_t blkcnt_t;
|
||||
typedef uint32_t time_t;
|
||||
typedef uint32_t suseconds_t;
|
||||
|
||||
typedef uint32_t clock_t;
|
||||
typedef uint32_t socklen_t;
|
||||
|
||||
struct timeval {
|
||||
time_t tv_sec;
|
||||
|
Loading…
Reference in New Issue
Block a user