Unix Technical Forum

nlist() is not working!!

This is a discussion on nlist() is not working!! within the HP-UX Operating System forums, part of the Unix Operating Systems category; --> My environment : # uname -a HP-UX hp B.11.11 U 9000/785 2001212688 unlimited-user license # gcc -v Reading specs ...


Go Back   Unix Technical Forum > Unix Operating Systems > HP-UX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-16-2008, 06:09 PM
Jeong YunGon
 
Posts: n/a
Default nlist() is not working!!

My environment :

# uname -a
HP-UX hp B.11.11 U 9000/785 2001212688 unlimited-user license

# gcc -v
Reading specs from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux11.00/3.2/specs
Configured with:
.../gcc/configure --enable-languages=c,c++ --host=hppa1.1-hp-hpux11.00 --targ
et=hppa1.1-hp-hpux11.00 --with-g
Thread model: single
gcc version 3.2 20020708 (experimental)

I wrote a simple program using the function nlist().
But, I can't get the return value 0.

This is code.
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <netdb.h>
#include <nlist.h>
#include <stdlib.h>
#include <nlist.h>


#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/protosw.h>
#include <sys/ioctl.h>
#include <sys/mbuf.h>

#include <net/route.h>
#include <net/if.h>

#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/tcp.h>

struct nlist nlst[] = {
{ "_tcb" },
{ "_tcp_debug" },
{ "_tcp_debx" },
{ "_mbstat" },
{ "_tcpstat" },
{0}
};

int main(argc, argv)
int argc;
char *argv[];
{
int kmem;
int rNlist = 0;

if ( (rNlist = nlist("/stand/vmunix", nlst)) < 0 )
{
printf( "Return value of nlist() is %d.\n", rNlist );
}

if( (kmem = open("/dev/kmem", 0)) < 0) {
perror("/dev/kmem");
exit(1);
}

close( kmem );

return 0;
}


Here is error?

Thanks in advance!!


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:29 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com