Compare commits
No commits in common. "d6f45c284e4bf2bf6d05f0b66968b9cb3b529dc3" and "71e15e94af794051dacf6495029095998ebd2bad" have entirely different histories.
d6f45c284e
...
71e15e94af
@ -1,7 +1,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define CHUNK 4194304 // 4 MB
|
#define CHUNK 4194304 // 4 MB
|
||||||
@ -15,6 +14,6 @@ int main()
|
|||||||
printf("Allocating 4 MB of memory... %lx\n", (unsigned long)allocated);
|
printf("Allocating 4 MB of memory... %lx\n", (unsigned long)allocated);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
} while ((allocated = malloc(CHUNK)));
|
} while ((allocated = malloc(CHUNK)));
|
||||||
printf("Out of memory. (errno=%d, %s)\n", errno, strerror(errno));
|
printf("Out of memory. (errno=%d)\n", errno);
|
||||||
printf("Press any key to restart.\n");
|
printf("Press any key to restart.\n");
|
||||||
}
|
}
|
@ -23,8 +23,6 @@ extern "C"
|
|||||||
deprecated("strcat is unsafe and should not be used; use strncat instead") char* strcat(char*, const char*);
|
deprecated("strcat is unsafe and should not be used; use strncat instead") char* strcat(char*, const char*);
|
||||||
char* strncat(char*, const char*, size_t);
|
char* strncat(char*, const char*, size_t);
|
||||||
|
|
||||||
char* strerror(int);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include <errno.h>
|
|
||||||
#include <luna.h>
|
#include <luna.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -109,20 +108,4 @@ extern "C"
|
|||||||
// we return "m_start" + the amount of bytes that were transfered
|
// we return "m_start" + the amount of bytes that were transfered
|
||||||
return (void*)(((size_t)start) + i);
|
return (void*)(((size_t)start) + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC push_options
|
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
|
||||||
|
|
||||||
char* strerror(int errnum)
|
|
||||||
{
|
|
||||||
switch (errnum)
|
|
||||||
{
|
|
||||||
case EPERM: return "Operation not permitted";
|
|
||||||
case EINVAL: return "Invalid argument";
|
|
||||||
case ENOMEM: return "Out of memory";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma GCC pop_options
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user