mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 09:37:34 +00:00
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"
This commit is contained in:
parent
aba6e6de6a
commit
c2a8c4cedd
5 changed files with 20 additions and 3 deletions
|
@ -101,6 +101,15 @@ typedef __INTMAX_TYPE__ intmax_t;
|
||||||
#define UINT_LEAST32_MAX UINT32_MAX
|
#define UINT_LEAST32_MAX UINT32_MAX
|
||||||
#define UINT_LEAST64_MAX UINT64_MAX
|
#define UINT_LEAST64_MAX UINT64_MAX
|
||||||
|
|
||||||
|
#define INT8_C(x) x
|
||||||
|
#define UINT8_C(x) x
|
||||||
|
|
||||||
|
#define INT16_C(x) x
|
||||||
|
#define UINT16_C(x) x
|
||||||
|
|
||||||
|
#define INT32_C(x) x
|
||||||
|
#define UINT32_C(x) x
|
||||||
|
|
||||||
#define INT64_C(x) x##LL
|
#define INT64_C(x) x##LL
|
||||||
#define UINT64_C(x) x##ULL
|
#define UINT64_C(x) x##ULL
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
#define PRIx8 "b"
|
#define PRIx8 "b"
|
||||||
#define PRIx16 "w"
|
#define PRIx16 "w"
|
||||||
#define PRIx32 "x"
|
#define PRIx32 "x"
|
||||||
|
#define PRIX32 "X"
|
||||||
#define PRIx64 "llx"
|
#define PRIx64 "llx"
|
||||||
|
#define PRIX64 "llX"
|
||||||
|
|
||||||
#define __PRI64_PREFIX "ll"
|
#define __PRI64_PREFIX "ll"
|
||||||
#define __PRIPTR_PREFIX
|
#define __PRIPTR_PREFIX
|
||||||
|
|
|
@ -437,7 +437,9 @@ void perror(const char* s)
|
||||||
FILE* fopen(const char* pathname, const char* mode)
|
FILE* fopen(const char* pathname, const char* mode)
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if (!strcmp(mode, "r") || !strcmp(mode, "rb"))
|
// NOTE: rt is a non-standard mode which opens a file for read, explicitly
|
||||||
|
// specifying that it's a text file
|
||||||
|
if (!strcmp(mode, "r") || !strcmp(mode, "rb") || !strcmp(mode, "rt"))
|
||||||
flags = O_RDONLY;
|
flags = O_RDONLY;
|
||||||
else if (!strcmp(mode, "r+") || !strcmp(mode, "rb+"))
|
else if (!strcmp(mode, "r+") || !strcmp(mode, "rb+"))
|
||||||
flags = O_RDWR;
|
flags = O_RDWR;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define FILENAME_MAX 1024
|
||||||
#define BUFSIZ 1024
|
#define BUFSIZ 1024
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
@ -96,9 +97,11 @@ char* asctime(const struct tm*)
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t strftime(char*, size_t, const char*, const struct tm*)
|
size_t strftime(char* destination, size_t, const char*, const struct tm*)
|
||||||
{
|
{
|
||||||
ASSERT_NOT_REACHED();
|
// FIXME: Stubbed function to make nasm work. Should be properly implemented
|
||||||
|
strcpy(destination, "strftime_unimplemented");
|
||||||
|
return strlen("strftime_unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
long timezone;
|
long timezone;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue