applies clang-format fixes
This commit is contained in:
@@ -20,14 +20,14 @@ extern void __libc_fini_array(void);
|
|||||||
|
|
||||||
void __wrap_exit(int code) {
|
void __wrap_exit(int code) {
|
||||||
#ifndef HAVE_NO_INIT_FINI
|
#ifndef HAVE_NO_INIT_FINI
|
||||||
__libc_fini_array();
|
__libc_fini_array();
|
||||||
#endif
|
#endif
|
||||||
const char message[] = "\nProgam has exited with code:";
|
const char message[] = "\nProgram has exited with code:";
|
||||||
write(STDERR_FILENO, message, sizeof(message) - 1);
|
write(STDERR_FILENO, message, sizeof(message) - 1);
|
||||||
write_hex(STDERR_FILENO, code);
|
write_hex(STDERR_FILENO, code);
|
||||||
write(STDERR_FILENO, "\n", 1);
|
write(STDERR_FILENO, "\n", 1);
|
||||||
tohost = (code << 1) + 1;
|
tohost = (code << 1) + 1;
|
||||||
for (;;)
|
for(;;)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
weak_under_alias(exit);
|
weak_under_alias(exit);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
extern int _end;
|
extern int _end;
|
||||||
void* _sbrk(int incr);
|
void* _sbrk(int incr);
|
||||||
int _close(int file);
|
int _close(int file);
|
||||||
int _fstat(int file, struct stat *st);
|
int _fstat(int file, struct stat* st);
|
||||||
int _isatty(int fd);
|
int _isatty(int fd);
|
||||||
int _lseek(int file, int ptr, int dir);
|
int _lseek(int file, int ptr, int dir);
|
||||||
|
|
||||||
@@ -12,68 +12,67 @@ void _kill(int pid, int sig);
|
|||||||
int _getpid(void);
|
int _getpid(void);
|
||||||
void write_hex(int fd, unsigned long int hex);
|
void write_hex(int fd, unsigned long int hex);
|
||||||
|
|
||||||
void *_sbrk(int incr) {
|
void* _sbrk(int incr) {
|
||||||
static unsigned char *heap = NULL;
|
static unsigned char* heap = NULL;
|
||||||
unsigned char *prev_heap;
|
unsigned char* prev_heap;
|
||||||
if (heap == NULL) {
|
if(heap == NULL) {
|
||||||
heap = (unsigned char *)&_end;
|
heap = (unsigned char*)&_end;
|
||||||
}
|
}
|
||||||
prev_heap = heap;
|
prev_heap = heap;
|
||||||
heap += incr;
|
heap += incr;
|
||||||
return prev_heap;
|
return prev_heap;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _close(int file) {
|
int _close(int file) {
|
||||||
(void)file;
|
(void)file;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _fstat(int file, struct stat *st) {
|
int _fstat(int file, struct stat* st) {
|
||||||
(void)file;
|
(void)file;
|
||||||
st->st_mode = S_IFCHR;
|
st->st_mode = S_IFCHR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _isatty(int fd) {
|
int _isatty(int fd) {
|
||||||
if (fd == STDOUT_FILENO || fd == STDERR_FILENO)
|
if(fd == STDOUT_FILENO || fd == STDERR_FILENO)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _lseek(int file, int ptr, int dir) {
|
int _lseek(int file, int ptr, int dir) {
|
||||||
(void)file;
|
(void)file;
|
||||||
(void)ptr;
|
(void)ptr;
|
||||||
(void)dir;
|
(void)dir;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _exit(int status) {
|
void _exit(int status) {
|
||||||
const char message[] = "\nProgam has exited with code:";
|
const char message[] = "\nProgram has exited with code:";
|
||||||
write(STDERR_FILENO, message, sizeof(message) - 1);
|
write(STDERR_FILENO, message, sizeof(message) - 1);
|
||||||
write_hex(STDERR_FILENO, status);
|
write_hex(STDERR_FILENO, status);
|
||||||
write(STDERR_FILENO, "\n", 1);
|
write(STDERR_FILENO, "\n", 1);
|
||||||
for (;;);
|
for(;;)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _kill(int pid, int sig) {
|
void _kill(int pid, int sig) {
|
||||||
(void)pid;
|
(void)pid;
|
||||||
(void)sig;
|
(void)sig;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _getpid(void) {
|
int _getpid(void) { return -1; }
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_hex(int fd, unsigned long int hex){
|
void write_hex(int fd, unsigned long int hex) {
|
||||||
uint8_t ii;
|
uint8_t ii;
|
||||||
uint8_t jj;
|
uint8_t jj;
|
||||||
char towrite;
|
char towrite;
|
||||||
write(fd , "0x", 2);
|
write(fd, "0x", 2);
|
||||||
for (ii = sizeof(unsigned long int) * 2 ; ii > 0; ii--) {
|
for(ii = sizeof(unsigned long int) * 2; ii > 0; ii--) {
|
||||||
jj = ii - 1;
|
jj = ii - 1;
|
||||||
uint8_t digit = ((hex & (0xF << (jj*4))) >> (jj*4));
|
uint8_t digit = ((hex & (0xF << (jj * 4))) >> (jj * 4));
|
||||||
towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA));
|
towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA));
|
||||||
write(fd, &towrite, 1);
|
write(fd, &towrite, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user