On Sat, 8 Feb 2003 22:13:32 +0000 (UTC) in lucky.freebsd.hackers, Auge Mike wrote:

> Hi all,
> 
> I was trying to know how "printf" works in FreeBSD... I hvae reached to this
> point :
> 
> #define _write(fd, s, n) \
>        __syscall(SYS_write, (int)(fd), (const void *)(s), (size_t)(n))
> 
> I'am not really familiar with the way FreeBSD handle interrupts. I like from
> any one of you to tell me what functions will be called next and in which
> files, till we get the string of the printf function argment displayed in
> the terminal.
> 

That means that printf(3) uses write(2).  Write(2) is a system call with
syscall number SYS_write (look at __syscall(2)).  Syscalls are described in
syscalls.master like files.  There is at least one such file for every
supported binary: /sys/kern/syscals.master, /sys/i386/linux/syscalls.master,
etc.

Syscalls implementation is a part of the kernel, so you need to get
information about the name of the appropriate function for the syscall with
the SYS_write number from the syscalls.master file and find this function
in /sys sources.

I suppose you need this one /sys/kern/sys_generic.c:write()

See also: manual pages for write(2), syscall(2);  "System Calls" chapter
from the "x86 Assembly Language Programming" (available in "FreeBSD Developers'
Handbook").

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to