-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsyscalls.c
More file actions
61 lines (48 loc) · 816 Bytes
/
Copy pathsyscalls.c
File metadata and controls
61 lines (48 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Copyright (c) 2018 Hiroki Mori. All rights reserved.
*/
#include <_ansi.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>
extern char _end[];
int kill()
{
return 0;
}
int getpid()
{
return 0;
}
int _exit()
{
return 0;
}
void *
_sbrk (incr)
int incr;
{
static char * heap_end = _end;
char * prev_heap_end;
prev_heap_end = heap_end;
heap_end += incr;
return (void *) prev_heap_end;
}
char * sbrk (int) __attribute__((weak, alias ("_sbrk")));
/* copy from FreeBSD kernel code */
int
strncmp(const char *s1, const char *s2, size_t n)
{
if (n == 0)
return (0);
do {
if (*s1 != *s2++)
return (*(const unsigned char *)s1 -
*(const unsigned char *)(s2 - 1));
if (*s1++ == '\0')
break;
} while (--n != 0);
return (0);
}
dprintf()
{}