RE: where is the printf source for busybox?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dave, (and Mohan)
Thanks for the nice info.
 
I've downloaded uClibc code and ran ctags -R and searched down printf.
It looks like the main print path is  (assuming __STDIO_BUFFERS : I guess user level buffer for stdin, stdout, stderr) and assuming STDIO_GETC/PUTC_MACRO defined. without the macro, it seems to directly go to __fputc_unlocked..)
printf -> vfprintf (very complex doing all the format conversions..) -> PUTC -> putc_unlocked -> __FPUTC_UNLOCKED ->(after some macro conversion) __fputc_unlocked -> __stdio_WRITE (sometime write only to buffer) -> __WRITE -> __gcs.write -> write
 
in libc/stdio/_stdio.h, the __gcs.wirte is assigned to _cs_write and
in libc/stdio/_cs_funcs.c,  the _cs_write function is defined as below.
ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize)
{
        return write(*((int *) cookie), (char *) buf, bufsize);
}
what does cs stand for here? (Hm.. seems like custom streams..in the code) and I couldn't follow past write above. Where is the function write defined?
Any hint will be deeply appreciated and if I'm wrong with something, please correct me.
Thanks and regards,
 
Chan

From : "Dave Hylands" <dhylands@xxxxxxxxx>
Sent : 2014-03-12 13:39:11 ( +09:00 )
To : Kim Chan <ckim@xxxxxxxxxx>
Cc : kernelnewbies@xxxxxxxxxxxxxxxxx <kernelnewbies@xxxxxxxxxxxxxxxxx>
Subject : Re: where is the printf source for busybox?

Hi,

On Tue, Mar 11, 2014 at 6:44 PM, Kim Chan <ckim@xxxxxxxxxx> wrote:
>
>
> Hi,
> I've had this question for some time past and I would like to know the answer now..
> I wanted to follow a printf in busybox but couldn't find the source of the printf function.
> Then I throught probably the printf is provided by the system library where printf is connected to proper linux system call. (Is it printk?)

busybox is typically built using uclibc, which is here:
http://www.uclibc.org/

The printf source code within uclibc is here:
http://git.uclibc.org/uClibc/tree/libc/stdio/printf.c

It eveentually winds up in _vfprintf here:
http://git.uclibc.org/uClibc/tree/libc/stdio/_vfprintf.c

--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux