blob: 1ab3579aa4b45f65d850705816b33281cb011da3 (
plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
// CODE FOR Stack Smashing Protector, TODO: MOVE / and do not duplicate
// with kernel.c
// http://wiki.osdev.org/Stack_Smashing_Protector
#include <stdint.h>
#include <stdlib.h>
#if UINT32_MAX == UINTPTR_MAX
#define STACK_CHK_GUARD 0xe2dee396
#else
#define STACK_CHK_GUARD 0x595e9fbd94fda766
#endif
uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
__attribute__((noreturn))
void __stack_chk_fail(void)
{
write(1,"stack smashing!\n",16);
exit(99);
}
///////////////////
// required by binutils!
long sysconf(int name)
{
printf("SYSCONF CALLED WITH : %s",name);
return 0;
}
// set file mode creation mask
mode_t umask(mode_t mask)
{
return mask;
}
// chmod
int chmod(const char * path, mode_t mode)
{
return -1;
}
// manipulating file descriptor
int fcntl(int fd, int cmd, ...)
{
return -1;
}
// working directory
char *getwd(char *buf)
{
static char wd[]="/";
buf=wd;
return buf;
}
// check if access allowed
int access(const char *pathname, int mode)
{
//TODO: at leas check if this file exists!
return 0;
}
// update time
int utime(const char *filename, const int *x)
{
return -1;
}
// rmdir
int rmdir (const char *pathname)
{
return -1;
}
// chonw
int chown(const char *path, uid_t owner, gid_t group)
{
return -1;
}
|