Page 1 of 1
System calls
Posted: Fri May 16, 2003 2:02 am
by Banuba
Hello,
Can anyone tellme a link about the system calls? I know system calls are an interrup number X that calls a funtion. But I want to know how to do libs with functions that call the sys-call. And i want to know the most common systems calls.
Thanks for all
Re:System calls
Posted: Fri May 16, 2003 2:58 am
by Pype.Clicker
i think you can learn alot from the linux sources (syscall.h, or something). Building libraries atop of system calls implies that
- [-] you should be able to access the library from any program (did you meant "shared libraries" or statically linked ones ?)
[-] you must know what the library will offer. Usually, whatever a library do, the user program could do it without the library. Get a look at f<operation> interface of stdio.h, for instance: all it does is adding buffering and data formatting on top of the classic read/write system calls. usually, the library has additionnal internal state that makes the use of the system call less frequent and thus make the program run more efficiently.
Note that i don't really like the legacy "system call" approach, and that i'm
working on an alternative approach that is fully Object-Oriented
The usual system calls depend on what your system is able of, but imho, you should at least have
- [-] process control: start new programs, terminate program, etc.
[-] user interaction : get input, parameters, and show results (may depend on whether you have TUI or GUI)
[-] process communication : find another software component and talk to it.
Now, depending on what you have inside of your kernel, functions like file operations (read/write/open/close, etc), window management (raise, close, popup, settitle, get_draw_context ...), networking (connect, send, recv, ...) may be available to the program through system calls or through inter-program communication (for instance, if you decide to have the window manager as a separate program, like in X-window approach, it will not have it's own system call, but send commands through a socket - i.e. an IPC bytes tunnel.
btw, i dunno how windows NT handles it ... If someone has additionnal knowledge to share (Tim?)...
Re:System calls
Posted: Fri May 16, 2003 11:44 am
by df
send message
receive message
Re:System calls
Posted: Fri May 16, 2003 11:54 am
by Whatever5k
These two system calls df just described are the only two system calls in a *Microkernel*. In a monolothic kernel, you have different system calls, also depending on the system you want to implement. For example in UNIX, you will need the essential system calls FORK, EXEC, READ, WRITE, OPEN and CLOSE.
Re:System calls
Posted: Fri May 16, 2003 12:57 pm
by df
well.. what is an interrupt other than a send message?
smsg(EXEC, "/blah/my.exe");
exec()
maybe should explain the differenfce between an API and a SysCall?
i wrote a tiny asm kernel, there was no send message or interrupts, just a vector table your app called directly at a fixed address.. it was all 'soft'.
you could also setup task gates instead of intterupt gates...
task gates / call gates worth looking into..