port a libc or make one from scratch?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: port a libc or make one from scratch?

Post by Korona »

I like that my distro doesn't need to pull 600 packages whenever libc has a security patch.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: port a libc or make one from scratch?

Post by iansjack »

eekee wrote:Yeah, but they wouldn't even put dynamic linking in Golang which went public in 2011.
Perhaps not in 2011, but with version 1.8 they introduced the Go plugin system to allow dynamic loading of modules.

Good move.
User avatar
AndrewAPrice
Member
Member
Posts: 2300
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: port a libc or make one from scratch?

Post by AndrewAPrice »

I switched from newlib to musl in my non-POSIX OS. Wish me luck. :D

I found the source layout to be very straight forward. As a hook, I have a syscall() function with a giant switch statement. Currently 99.999999999% unimplemented, but I got printf() working.
My OS is Perception.
User avatar
eekee
Member
Member
Posts: 892
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: port a libc or make one from scratch?

Post by eekee »

Have fun Andrew! :D

I think I've got Thompson and co. figured out. Unix was a multiuser system in 64 KB, if I remember right. (Maybe 64 Kwords = 128 KB. Maybe less on the initial PDP-8.) To switch tasks, it wrote the entire program memory to disk and read in the next task's memory. Under those circumstances, I think diving tasks between little programs was a good idea, and shared libraries would have been a liability. What if one user was typesetting, another compiling a program, and a third working with, I don't know... simulating a telephony problem? Why they stuck with it is a bit harder to figure out, but I gather Ken Thompson actually couldn't get on with complexity.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Post Reply