getprotobyname failure

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

 



Hello,

I have a problem with getprotobyname() function.

I wrote a simple program that only uses getprotobyname function

I can run this program on my development machine
but when I try to run this program on my basic kernel it gives me the
"memory fault" error.

the "getprotobyname" function returns NULL and i don't know the reason,
becouse i have the /etc/protocols file containing "tcp 6 TCP" line

I'm using Denx embedded linux development kit with libc-2.2.5 with an cross
compiler

my development machine has celeron  type processor
and my target board is TQM850L (powerpc 850)

I've replaced my protocols and nsswitch.conf files with host machines (my
protocols file contians "tcp 6 TCP" line)
and that's made no difference.

Why the getprotobyname function returns NULL?

please help,


 my program :

#include <netdb.h>
#include <stdio.h>

 int main(void){

    struct sockaddr_in addr;
    struct protoent *protocol=NULL;
    protocol=getprotobyname("tcp");
    printf("\n RESULT : %02x \n",protocol->p_proto);

    return 0;
}

Yigit CAN



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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