geoff@edm.uucp (Geoff Coleman) (11/09/90)
Help I need to know if the following is considered a bug or not. Given the following code which uses knlist() to poke into the live kernel and find the location of a couple of variables. If compiled with cc -DGOOD test1.c it will return a value of 0 from knlist and 0 in errno. If compiled with cc test1.c it will return a value of-1 from knlist and errno will be zero because swplo does not exist in the aix kernel. This goes against the documentation for knlist() in the manuals. Geoff Coleman Unexsys Systems ____________________________ test1.c _________________________________ #include <stdio.h> #include <errno.h> #include <nlist.h> /* need this for name list function */ struct nlist name_list[4]; /* define an array of nlist structs */ int i; main(){ for(i=0;i<3;i++){ name_list[i].n_value = 0; name_list[i].n_scnum = 0; name_list[i].n_type = 0; name_list[i].n_sclass = NULL; name_list[i].n_numaux = NULL; } name_list[0].n_name = "proc"; #ifdef GOOD name_list[1].n_name = "v"; name_list[2].n_name = "swplo"; #else name_list[1].n_name = "swplo"; name_list[2].n_name = "v"; #endif name_list[3].n_name = NULL; fprintf(stderr,"return from knlist = %d\n", knlist(name_list,2,sizeof(struct nlist))); fprintf(stderr," errno = %d\n",errno); }