-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
112 lines (82 loc) · 2.4 KB
/
notes.txt
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
1. cat diary/day1.txt crashes with page fault
cd diary && cd .. && cd ..
pmemsave 0x674000 4096 out.mem
echo "pmemsave 0x674000 4096 home/sergey/Desktop/os/out.mem" | sudo socat - unix-connect:qemu-monitor-socket
// dirent
https://www.reddit.com/r/osdev/comments/139pet/porting_newlib/
// docker run
docker run -it --rm -v $PWD/build:/src/build -v $PWD:/os -v $PWD/ports/newlib/myos:/src/newlib-2.5.0/newlib/libc/sys/myos -v $PWD/sysroot/:/os/sysroot os_tools
// docker build
docker build -f ./toolchain/Dockerfile -t os_tools .
// for signals
https://github.com/eblot/newlib/blob/master/newlib/libc/signal/signal.c
https://wiki.osdev.org/Porting_Newlib#Signal_handling
https://github.com/stevej/osdev/blob/master/toolchain/patches/newlib/toaru/syscalls.c
./configure --bindir=$PWD/bin --mandir=$PWD/man --host=i686-myos CPPFLAGS=-DHAVE_KILLPG=1
https://forum.osdev.org/viewtopic.php?t=27005&p=226203
https://www.gnu.org/software/make/manual/make.html#Directory-Variables
// possible libc implementations
// dietlib ?????
https://github.com/torvalds/linux/blob/e326df53af0021f48a481ce9d489efda636c2dc6/kernel/groups.c#L161???
THERE IS A BUG WITH WAKING UP A THREAD THAT HAS
ACQUIRED SOME LOCK BUT NEEDS TO HANDLE SIGNAL!
// void
setjobctl(int on)
void
opentrace(void)
{
char s[100];
#ifdef O_APPEND
int flags;
#endif
if (debug != 1) {
if (tracefile)
fflush(tracefile);
/* leave open because libedit might be using it */
return;
}
#ifdef not_this_way
{
char *p;
if ((p = getenv(homestr)) == NULL) {
if (geteuid() == 0)
p = "/";
else
p = "/tmp";
}
scopy(p, s);
strcat(s, "./dev/serial0");
}
#else
scopy("./dev/serial0", s);
#endif /* not_this_way */
if (tracefile) {
#ifndef __KLIBC__
if (!freopen(s, "a", tracefile)) {
#else
if (!(!fclose(tracefile) && (tracefile = fopen(s, "a")))) {
#endif /* __KLIBC__ */
fprintf(stderr, "Can't re-open %s\n", s);
debug = 0;
return;
}
} else {
if ((tracefile = fopen(s, "a")) == NULL) {
fprintf(stderr, "Can't open %s\n", s);
debug = 0;
return;
}
}
#ifdef O_APPEND
if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND);
#endif
#ifndef __KLIBC__
setlinebuf(tracefile);
#endif /* __KLIBC__ */
fputs("\nTracing started.\n", tracefile);
}
#endif /* DEBUG */
[BUGS]
1. what happens if a first process in a pipe
calls exit before the initialization of the second one?