libc: Stub out more functionality so part of binutils builds
This commit is contained in:
parent
9db1e8cdb3
commit
32e09d3417
@ -16,6 +16,9 @@ struct stat // FIXME: This struct is quite stubbed out.
|
|||||||
int st_dev; // FIXME: Implement this.
|
int st_dev; // FIXME: Implement this.
|
||||||
uid_t st_uid;
|
uid_t st_uid;
|
||||||
gid_t st_gid;
|
gid_t st_gid;
|
||||||
|
time_t st_atime; // Not implemented.
|
||||||
|
time_t st_mtime; // Not implemented.
|
||||||
|
time_t st_ctime; // Not implemented.
|
||||||
};
|
};
|
||||||
|
|
||||||
void do_stat(Context* context, VFS::Node* node, struct stat* buf)
|
void do_stat(Context* context, VFS::Node* node, struct stat* buf)
|
||||||
|
@ -8,6 +8,7 @@ extern int errno;
|
|||||||
#define ENOENT 2 // No such file or directory
|
#define ENOENT 2 // No such file or directory
|
||||||
#define ESRCH 3 // No such process
|
#define ESRCH 3 // No such process
|
||||||
#define EINTR 4 // Interrupted system call. Not implemented.
|
#define EINTR 4 // Interrupted system call. Not implemented.
|
||||||
|
#define EIO 5 // Input/output error. Not implemented.
|
||||||
#define E2BIG 7 // Argument list too long
|
#define E2BIG 7 // Argument list too long
|
||||||
#define ENOEXEC 8 // Exec format error
|
#define ENOEXEC 8 // Exec format error
|
||||||
#define EBADF 9 // Bad file descriptor
|
#define EBADF 9 // Bad file descriptor
|
||||||
@ -21,8 +22,10 @@ extern int errno;
|
|||||||
#define EINVAL 22 // Invalid argument
|
#define EINVAL 22 // Invalid argument
|
||||||
#define EMFILE 24 // Too many open files
|
#define EMFILE 24 // Too many open files
|
||||||
#define ENOTTY 25 // Inappropriate ioctl for device
|
#define ENOTTY 25 // Inappropriate ioctl for device
|
||||||
|
#define EFBIG 27 // File too large. Not implemented.
|
||||||
#define ENOSPC 28 // No space left on device
|
#define ENOSPC 28 // No space left on device
|
||||||
#define EPIPE 32 // Broken pipe. Not implemented.
|
#define EPIPE 32 // Broken pipe. Not implemented.
|
||||||
|
#define EDOM 33 // Numerical argument out of domain. Not implemented.
|
||||||
#define ERANGE 34 // Numerical result out of range
|
#define ERANGE 34 // Numerical result out of range
|
||||||
#define ENOSYS 38 // Function not implemented
|
#define ENOSYS 38 // Function not implemented
|
||||||
#define ENOTSUP 95 // Operation not supported
|
#define ENOTSUP 95 // Operation not supported
|
||||||
|
@ -142,6 +142,7 @@ extern "C"
|
|||||||
int vsnprintf(char* str, size_t max, const char* format, va_list ap);
|
int vsnprintf(char* str, size_t max, const char* format, va_list ap);
|
||||||
|
|
||||||
int sscanf(const char*, const char*, ...); // Not implemented.
|
int sscanf(const char*, const char*, ...); // Not implemented.
|
||||||
|
int fscanf(FILE*, const char*, ...); // Not implemented.
|
||||||
|
|
||||||
/* Writes the string str followed by a trailing newline to stdout. */
|
/* Writes the string str followed by a trailing newline to stdout. */
|
||||||
int puts(const char* str);
|
int puts(const char* str);
|
||||||
|
@ -109,6 +109,11 @@ extern "C"
|
|||||||
|
|
||||||
void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); // Not implemented.
|
void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); // Not implemented.
|
||||||
|
|
||||||
|
size_t mbstowcs(wchar_t* dest, const char* src,
|
||||||
|
size_t n); // Not implemented.
|
||||||
|
|
||||||
|
char* mktemp(char* base); // Not implemented.
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
0
libs/libc/include/sys/param.h
Normal file
0
libs/libc/include/sys/param.h
Normal file
@ -12,6 +12,9 @@ struct stat // FIXME: This struct is quite stubbed out.
|
|||||||
int st_dev; // Not implemented.
|
int st_dev; // Not implemented.
|
||||||
uid_t st_uid;
|
uid_t st_uid;
|
||||||
gid_t st_gid;
|
gid_t st_gid;
|
||||||
|
time_t st_atime; // Not implemented.
|
||||||
|
time_t st_mtime; // Not implemented.
|
||||||
|
time_t st_ctime; // Not implemented.
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Type of file. */
|
/* Type of file. */
|
||||||
@ -61,6 +64,9 @@ extern "C"
|
|||||||
/* Returns information about the file pointed at path in buf. */
|
/* Returns information about the file pointed at path in buf. */
|
||||||
int stat(const char* pathname, struct stat* buf);
|
int stat(const char* pathname, struct stat* buf);
|
||||||
|
|
||||||
|
mode_t umask(mode_t cmask); // Not implemented.
|
||||||
|
int chmod(const char* pathname, mode_t mode); // Not implemented.
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,6 +45,7 @@ extern "C"
|
|||||||
struct tm* localtime(const time_t* timep); // Not implemented.
|
struct tm* localtime(const time_t* timep); // Not implemented.
|
||||||
struct tm* gmtime(const time_t* timep); // Not implemented.
|
struct tm* gmtime(const time_t* timep); // Not implemented.
|
||||||
size_t strftime(char* str, size_t max, const char* format, const struct tm* time); // Not implemented.
|
size_t strftime(char* str, size_t max, const char* format, const struct tm* time); // Not implemented.
|
||||||
|
char* ctime(const time_t* timep); // Not implemented.
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,8 @@ extern "C"
|
|||||||
/* Writes the current process's current working directory to buf. */
|
/* Writes the current process's current working directory to buf. */
|
||||||
char* getcwd(char* buf, size_t size);
|
char* getcwd(char* buf, size_t size);
|
||||||
|
|
||||||
|
int unlink(const char* path); // Not implemented.
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
0
libs/libc/include/wchar.h
Normal file
0
libs/libc/include/wchar.h
Normal file
@ -59,6 +59,11 @@ extern "C"
|
|||||||
NOT_IMPLEMENTED("sscanf");
|
NOT_IMPLEMENTED("sscanf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int fscanf(FILE*, const char*, ...)
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED("fscanf");
|
||||||
|
}
|
||||||
|
|
||||||
FILE* tmpfile()
|
FILE* tmpfile()
|
||||||
{
|
{
|
||||||
errno = ENOTSUP;
|
errno = ENOTSUP;
|
||||||
|
@ -121,4 +121,14 @@ extern "C"
|
|||||||
{
|
{
|
||||||
NOT_IMPLEMENTED("qsort");
|
NOT_IMPLEMENTED("qsort");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t mbstowcs(wchar_t*, const char*, size_t)
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED("mbstowcs");
|
||||||
|
}
|
||||||
|
|
||||||
|
char* mktemp(char*)
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED("mktemp");
|
||||||
|
}
|
||||||
}
|
}
|
@ -261,6 +261,7 @@ extern "C"
|
|||||||
case ENOENT: return "No such file or directory";
|
case ENOENT: return "No such file or directory";
|
||||||
case ESRCH: return "No such process";
|
case ESRCH: return "No such process";
|
||||||
case EINTR: return "Interrupted system call";
|
case EINTR: return "Interrupted system call";
|
||||||
|
case EIO: return "Input/output error";
|
||||||
case E2BIG: return "Argument list too long";
|
case E2BIG: return "Argument list too long";
|
||||||
case ENOEXEC: return "Exec format error";
|
case ENOEXEC: return "Exec format error";
|
||||||
case EBADF: return "Bad file descriptor";
|
case EBADF: return "Bad file descriptor";
|
||||||
@ -274,8 +275,10 @@ extern "C"
|
|||||||
case EINVAL: return "Invalid argument";
|
case EINVAL: return "Invalid argument";
|
||||||
case EMFILE: return "Too many open files";
|
case EMFILE: return "Too many open files";
|
||||||
case ENOTTY: return "Inappropriate ioctl for device";
|
case ENOTTY: return "Inappropriate ioctl for device";
|
||||||
|
case EFBIG: return "File too large";
|
||||||
case ENOSPC: return "No space left on device";
|
case ENOSPC: return "No space left on device";
|
||||||
case EPIPE: return "Broken pipe";
|
case EPIPE: return "Broken pipe";
|
||||||
|
case EDOM: return "Numerical argument out of domain";
|
||||||
case ERANGE: return "Numerical result out of range";
|
case ERANGE: return "Numerical result out of range";
|
||||||
case ENOSYS: return "Function not implemented";
|
case ENOSYS: return "Function not implemented";
|
||||||
case ENOTSUP: return "Operation not supported";
|
case ENOTSUP: return "Operation not supported";
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <luna.h>
|
||||||
#include <luna/syscall.h>
|
#include <luna/syscall.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
@ -18,4 +19,14 @@ extern "C"
|
|||||||
{
|
{
|
||||||
return (int)__lc_fast_syscall2(SYS_stat, path, buf);
|
return (int)__lc_fast_syscall2(SYS_stat, path, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode_t umask(mode_t)
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED("umask");
|
||||||
|
}
|
||||||
|
|
||||||
|
int chmod(const char*, mode_t)
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED("chmod");
|
||||||
|
}
|
||||||
}
|
}
|
@ -34,4 +34,9 @@ extern "C"
|
|||||||
{
|
{
|
||||||
NOT_IMPLEMENTED("strftime");
|
NOT_IMPLEMENTED("strftime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* ctime(const time_t*)
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED("ctime");
|
||||||
|
}
|
||||||
}
|
}
|
@ -143,4 +143,9 @@ extern "C"
|
|||||||
strlcpy(buf, dummy_cwd, 2);
|
strlcpy(buf, dummy_cwd, 2);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int unlink(const char*)
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED("unlink");
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user