Operating System - HP-UX
1834632 Members
3460 Online
110069 Solutions
New Discussion

How can I validate the functionality of libc?

 
Marc Sweeney
Occasional Contributor

How can I validate the functionality of libc?

I've been attempting to compile code, however it fails and cores. I'm running on a rp3440 and HP 11.11. I ran the code on one rp3440 with no problems but on another it dropped a core file:

Output from good server:

lccas243$ gcc -o buggy buggy.c
lccas243$ gcc -Wall -g -o buggy buggy.c
lccas243$ ./buggy
res->ai_flags = 4
res->ai_family = 2
res->ai_socktype = 0
res->ai_addrlen = 16
res->ai_canonname = (NULL)
res->ai_addr = 0x40003170
res->ai_next = 0x0
---

And from server with issues:

armsweb3$ ./buggy
/usr/lib/dld.sl: Unresolved symbol: getaddrinfo (code) from ./buggy
Abort(coredump)

If I try to compile it on armsweb3, I get this result:

armsweb3$ gcc -Wall -g -o buggy buggy.c
buggy.c: In function 'main':
buggy.c:12: error: storage size of 'hints' isn't known
buggy.c:17: error: 'AI_PASSIVE' undeclared (first use in this function)
buggy.c:17: error: (Each undeclared identifier is reported only once
buggy.c:17: error: for each function it appears in.)
buggy.c:18: error: 'AI_CANONNAME' undeclared (first use in this function)
buggy.c:22: warning: implicit declaration of function 'getaddrinfo'
buggy.c:28: error: dereferencing pointer to incomplete type
buggy.c:29: error: dereferencing pointer to incomplete type
buggy.c:30: error: dereferencing pointer to incomplete type
buggy.c:31: error: dereferencing pointer to incomplete type
buggy.c:33: error: dereferencing pointer to incomplete type
buggy.c:33: error: dereferencing pointer to incomplete type
buggy.c:34: error: dereferencing pointer to incomplete type
buggy.c:35: error: dereferencing pointer to incomplete type
buggy.c:37: error: dereferencing pointer to incomplete type
buggy.c:12: warning: unused variable 'hints'

I'm NOT asking HP to support apache. I'm asking them to support their operating system.


Here's the illustrative code snippet:

#include
#include
#include
#include
#include
#include

int
main()
{
int i;
struct addrinfo hints;
struct addrinfo *res;
char addr[] = "1.81.22.11";

memset(&hints,0,sizeof(hints));
hints.ai_family |= AI_PASSIVE;
hints.ai_family |= AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;

if((i = getaddrinfo(addr, NULL, NULL, &res)) != 0){
perror("getaddrinfo failed");
exit(1);
}

do {
printf ("res->ai_flags = %d\n", res->ai_flags);
printf ("res->ai_family = %d\n", res->ai_family);
printf ("res->ai_socktype = %d\n", res->ai_socktype);
printf ("res->ai_addrlen = %d\n", (int) res->ai_addrlen);
printf ("res->ai_canonname = %s\n",
(res->ai_canonname? res->ai_canonname:"(NULL)"));
printf ("res->ai_addr = 0x%0x\n", (unsigned int) res->ai_addr);
printf ("res->ai_next = 0x%0x\n", (unsigned int) res->ai_next);
printf ("---\n");
} while ((res = res->ai_next));
exit(0);
}

Any hints will be greatly appreciated.

Regards,
2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: How can I validate the functionality of libc?

Shalom,

Could be a system problem.

Maybe the library is corrupted on the system its being compiled on where it drops a core.

Maybe the system needs to be patched.

Make sure the systems are totally equal before investing time in validation.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Cheryl Griffin
Honored Contributor

Re: How can I validate the functionality of libc?

You probably dont have all the systems at the same patch level or code level. Have you checked that?

Seems to be a common error with getaddrinfo
This thread mentions specific patches to look at
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1076123&admit=-682735245+1175692835899+28353475
"Downtime is a Crime."