Re: How printf output messages to kernel with uclibc lib

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

 



2009/2/1 Denys Vlasenko <vda.linux@xxxxxxxxxxxxxx>:
> On Sunday 01 February 2009 11:00, loody wrote:
>> > [f]printf ultimately results in write() syscalls performed on
>> > open file descriptors.
>> >
>> > If you have trouble verifying that your userspace programs
>> > are able to execute, start with this test program:
>> >
>> > int main() {
>> >        write(1, "Hello\n", 6);
>> >        for (;;)
>> >                continue;
>> > }
>> >
>> > Compile it and run as init. You should see "Hello"
>> > message. If you don't, your toolchain is producing broken
>> > executables.
>> > --
>> > vda
>> >
>>
>> Hi:
>> I have search the calls.S in arch/arm/kernel, but I cannot find the
>> sys call, write, you mention.
>
> You don't know what you are doing.
>
> It's in sysdeps/linux/common/write.c in uclibc tree.
>
>> ( I use arm platform, so I search the syscalls implemented by arm)
>> Is it a wrap function? If so, I guess I should include some header to do so.
>> But I have no idea what header I can use.
>> appreciate your help,
>> miloody
>
> It looks like you think these lists are a proper place to get educated
> in basic C and programming skills. It can be achieved far faster
> by reading abundand info available on the Web.
> --
hi:
please don't feel angry.
I never think so.

When receiving your reply, I try the suggestion you give to me.
And it shows:
    No relocations in code!
(attach the log at the end of letter)
so I guess maybe I need to include some header.

Then I try to check whether the function you mention comes from kernel
sys calls, since in the letter there is a key word, syscalls.
And as far as I know, these functions are passed by SWI interrupt,
which implemented in arch/xx/kernel.
That's the reason why I include linux-arm-kernel mailing list, sorry.

As you say, I am really unfamiliar with the interface between c lib and kernel.
So I tried to trace the uclibc and ask whether my direction is right
or wrong in the first letter.
I NEVER want to take advantage on these mailing list.

If my stupid questions annoyed you, please forgive me,
thanks for your help,
miloody


make[1]: Entering directory `/uClinux-dist/user'
touch hello/.sgbuilt_user && make -j1 -C hello
make[2]: Entering directory `/uClinux-dist/user/hello'
ucfront-gcc arm-linux-gcc  -Os                     -g -pipe
-msoft-float -fno-common -fno-builtin -Wall   -DEMBED -D__PIC__ -fpic
-msingle-pic-base -Dlinux -D__linux__ -Dunix -D__uClinux__   -c -o
hello.o hello.c
hello.c: In function `main':
hello.c:3: warning: implicit declaration of function `write'
ucfront-gcc arm-linux-gcc  -Wl,-elf2flt -msoft-float -D__PIC__ -fpic
-msingle-pic-base -o hello hello.o
No relocations in code!
make[2]: Leaving directory `/uClinux-dist/user/hello'
make[1]: Leaving directory `/uClinux-dist/user'

/uClinux-dis/# cat user/hello/hello.c
int main() {
       write(1, "Hello\n", 6);
       for (;;)
               continue;
}

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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