Date: Mon, 10 Feb 2003 12:12:02 +0200 (EET) From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> To: "Auge Mike" <tobe_better@hotmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: printf....! Message-ID: <200302101012.h1AAC2GR008192@pm514-9.comsys.ntu-kpi.kiev.ua> In-Reply-To: <F93rBLSAQV6uPDVniSn0000956b@hotmail.com.lucky.freebsd.hackers>
next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302101012.h1AAC2GR008192>