Lines 3-11
Link Here
|
3 |
*/ |
3 |
*/ |
4 |
|
4 |
|
5 |
#include <stdio.h> |
5 |
#include <stdio.h> |
|
|
6 |
#include <stdlib.h> |
6 |
#include <sys/types.h> |
7 |
#include <sys/types.h> |
7 |
#include <sys/stat.h> |
8 |
#include <sys/stat.h> |
8 |
#include <fcntl.h> |
9 |
#include <fcntl.h> |
|
|
10 |
#include <unistd.h> |
11 |
#include <sys/wait.h> |
12 |
#include <string.h> |
9 |
|
13 |
|
10 |
const char dev_wd_str[] = "/dev/watchdog"; |
14 |
const char dev_wd_str[] = "/dev/watchdog"; |
11 |
const char root_str[] = "/"; |
15 |
const char root_str[] = "/"; |
Lines 18-24
Link Here
|
18 |
static inline void try_malloc() { |
22 |
static inline void try_malloc() { |
19 |
void *heap; |
23 |
void *heap; |
20 |
|
24 |
|
21 |
heap = (void*)sbrk(NULL); |
25 |
heap = (void*)sbrk(0); |
22 |
if (brk(heap + 4096)) |
26 |
if (brk(heap + 4096)) |
23 |
exit(1); |
27 |
exit(1); |
24 |
memset(heap, 0, 4096); |
28 |
memset(heap, 0, 4096); |
Lines 52-58
Link Here
|
52 |
void *heap; |
56 |
void *heap; |
53 |
int ret; |
57 |
int ret; |
54 |
|
58 |
|
55 |
heap = (void*)sbrk(NULL); |
59 |
heap = (void*)sbrk(0); |
56 |
if (brk(heap + sizeof (struct stat))) |
60 |
if (brk(heap + sizeof (struct stat))) |
57 |
exit(1); |
61 |
exit(1); |
58 |
memset(heap, 0, sizeof (struct stat)); |
62 |
memset(heap, 0, sizeof (struct stat)); |