Page 1 of 1
Headers used by system, kernel, and libc
Posted: Thu Dec 27, 2012 3:09 pm
by Caleb1994
I've just ported newlib recently, and as I started writing a driver for the text mode screen and keyboard separately I realized I really needed to implement a TTY type driver mechanism. It would just make my life easier. As far as controlling attributes of terminal devices, I knew that termios was a standard way of doing it, so I was going to implement that. My problem is that I'm not sure what to do about header files like termios.h which are fairly standard (at least parts of them). There is a termios.h in my newlib/include/ folder, but it simply includes newlib/include/sys/termios.h, which doesn't exist. I'm trying to figure out if I was intended to create that file in newlib/include/sys or if I did something wrong when compiling/installing it. I could write one and put it there, but I don't want to pollute my libc includes with that, and I'm not sure what the purpose of sys/ directory is (is it for the system as in the kernel or what?).
Re: Headers used by system, kernel, and libc
Posted: Thu Dec 27, 2012 4:03 pm
by bluemoon
There are (at least) 2 ways to use newlib:
1. Build directly - in this case you deal with the default
nosys with minimum features, and provide libgloss for the "glue".
2. Tell newlib about your OS, in this case you put your system dependent files in the "sys" directory and configure it (check the manual).
I'm not sure what the purpose of sys/ directory is (is it for the system as in the kernel or what?).
The sys/ directory is meant for system dependent files, although many OS (including Mac OS) also put system specific code on topmost directory.
If you plan to write your own termios, I recommend to take a look at:
http://pubs.opengroup.org/onlinepubs/00 ... ios.h.html
And, don't copy the linux header - not because of the license but it's a mess.
Re: Headers used by system, kernel, and libc
Posted: Thu Dec 27, 2012 4:32 pm
by Brynet-Inc
Re: Headers used by system, kernel, and libc
Posted: Thu Dec 27, 2012 11:00 pm
by Caleb1994
Alright, so everything should just go with my libgloss. Thanks for the quick reply, everyone! Newlib doesn't have very much documentation, so I wasn't sure of the standard way of doing things.
Also, thanks for the link. That happens to be the one I've been following, anyway!