typedef signed short Sint16;
typedef signed long Sint32;
typedef signed long long Sint64;
-typedef Uint size_t;
typedef char BOOL;
typedef Uint32 tPAddr;
* \brief Acess2 Kernel API Core
*/
+#include <stddef.h>
#include <arch.h>
-//! NULL Pointer
-#define NULL ((void*)0)
//! Pack a structure
#define PACKED __attribute__((packed))
//! Mark a function as not returning
#define DEPRECATED __attribute__((deprecated))
//! Mark a parameter as unused
#define UNUSED(x) UNUSED_##x __attribute__((unused))
-//! Get the offset of a member in a structure
-#define offsetof(st, m) ((Uint)((char *)&((st *)(0))->m - (char *)0 ))
/**
* \name Boolean constants
#ifndef _ERRNO_H
#define _ERRNO_H
-enum eErrorNums
-{
- EOK,
-
- ENOSYS, // Invalid Instruction
- EINVAL, // Invalid Paramater
- ENOMEM, // No free memory
- EACCES, // Not permitted
- EBUSY, // Resource is busy
- ENOTFOUND, // Item not found
- EREADONLY, // Read only
- ENOTIMPL, // Not implemented
- ENOENT, // No entry?
- EEXIST, // Already exists
- ENFILE, // Too many open files
- ENOTDIR, // Not a directory
- EIO, // IO Error
- EINTR, // Operation interrupted (signal)
-
- EALREADY, // Operation was a NOP
- EINTERNAL, // Internal Error
-
- NUM_ERRS
-};
+#include "../../../Usermode/Libraries/libc.so_src/include_exp/errno.enum.h"
#endif
#define SYS_DEBUG 0x100
#ifndef __ASSEMBLER__
-#ifndef NO_SYSCALL_STRS
static const char *cSYSCALL_NAMES[] = {
"SYS_EXIT",
"SYS_CLONE",
""
};
#endif
-#endif
#endif
EXPORT(CheckMem);
// === CODE ===
-/**
- * \brief Convert a string into an integer
- */
-int atoi(const char *string)
-{
- int ret = 0;
- ParseInt(string, &ret);
- return ret;
-}
+// - Import userland stroi.c file
+#define _LIB_H_
+#include "../../Usermode/Libraries/libc.so_src/strtoi.c"
+
int ParseInt(const char *string, int *Val)
{
int ret = 0;
/**
* \fn Uint ATA_ReadRaw(Uint64 Address, Uint Count, void *Buffer, Uint Disk)
*/
-int ATA_ReadRaw(void *Ptr, Uint64 Address, Uint Count, void *Buffer)
+int ATA_ReadRaw(void *Ptr, Uint64 Address, size_t Count, void *Buffer)
{
int Disk = (tVAddr)Ptr;
int ret;
/**
* \fn Uint ATA_WriteRaw(Uint64 Address, Uint Count, const void *Buffer, Uint Disk)
*/
-int ATA_WriteRaw(void *Ptr, Uint64 Address, Uint Count, const void *Buffer)
+int ATA_WriteRaw(void *Ptr, Uint64 Address, size_t Count, const void *Buffer)
{
int Disk = (tVAddr)Ptr;
int ret;
}
// Destination IP
- addrType = ParseIPAddress(argv[3], dest, &subnetBits);
+ addrType = ParseIPAddress(argv[2], dest, &subnetBits);
if( subnetBits == -1 ) {
subnetBits = Net_GetAddressSize(addrType)*8;
}
// Interface Name / Next Hop
- if( (nextHopType = ParseIPAddress(argv[4], nextHop, &nextHopBits)) == 0 )
+ if( (nextHopType = ParseIPAddress(argv[3], nextHop, &nextHopBits)) == 0 )
{
// Interface name
- ifaceName = argv[4];
+ ifaceName = argv[3];
}
else
{
// Metric
if( argc - 3 >= 3 )
{
- metric = atoi(argv[5]);
- if( metric == 0 && argv[5][0] != '0' ) {
+ metric = atoi(argv[4]);
+ if( metric == 0 && argv[4][0] != '0' ) {
fprintf(stderr, "ERROR: Metric should be a number\n");
return -1;
}
--- /dev/null
+
+enum {
+ EOK,
+ ENOSYS, // Invalid Instruction
+ EINVAL, // Invalid Paramater
+ ENOMEM, // No free memory
+ EACCES, // Not permitted
+ EBUSY, // Resource is busy
+ ERANGE, // Value out of range
+ ENOTFOUND, // Item not found
+ EREADONLY, // Read only
+ ENOTIMPL, // Not implemented
+ ENOENT, // No entry?
+ EEXIST, // Already exists
+ ENFILE, // Too many open files
+ ENOTDIR, // Not a directory
+ EIO, // IO Error
+ EINTR, // Operation interrupted (signal)
+
+ EALREADY, // Operation was a NOP
+ EINTERNAL, // Internal Error
+
+ NUM_ERRNO
+};
+
#define strerror(_x) "Unimplemented"
-enum
-{
- EOK,
- EINVAL,
- ERANGE,
- ENODEV,
- EBADF,
- EINTR,
- EAGAIN,
- ENOMEM,
-
- EADDRNOTAVAIL,
- EINPROGRESS,
-
- E_LAST
-};
+#include "errno.enum.h"
#endif
* strtoi.c
* - strto[u][l]l/atoi implimentation
*/
-#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
-#include "lib.h"
+#include <stddef.h>
-EXPORT unsigned long long strtoull(const char *str, char **end, int base)
+unsigned long long strtoull(const char *str, char **end, int base)
{
long long ret = 0;
return ret;
}
-EXPORT unsigned long strtoul(const char *ptr, char **end, int base)
+unsigned long strtoul(const char *ptr, char **end, int base)
{
unsigned long long tmp = strtoull(ptr, end, base);
return tmp;
}
-EXPORT long long strtoll(const char *str, char **end, int base)
+long long strtoll(const char *str, char **end, int base)
{
int neg = 0;
unsigned long long ret;
return ret;
}
-EXPORT long strtol(const char *str, char **end, int base)
+long strtol(const char *str, char **end, int base)
{
long long tmp = strtoll(str, end, base);
if( tmp > LONG_MAX || tmp < LONG_MIN ) {
}
/**
- * \fn EXPORT int atoi(const char *str)
+ * \fn int atoi(const char *str)
* \brief Convert a string to an integer
*/
-EXPORT int atoi(const char *str)
+int atoi(const char *str)
{
long long tmp = strtoll(str, NULL, 0);
if( tmp > INT_MAX || tmp < INT_MIN ) {