From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: fa528,e1d068564724cf89,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-10-17 12:48:36 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: pablo_endres@digitel.com.ve (Pablo Endres) Newsgroups: comp.unix.tru64 Subject: Tru64 compile/link problem Date: 17 Oct 2003 12:48:36 -0700 Organization: http://groups.google.com Message-ID: <336f1a66.0310171148.11eeb41e@posting.google.com> NNTP-Posting-Host: 206.49.165.101 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1066420116 30522 127.0.0.1 (17 Oct 2003 19:48:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 17 Oct 2003 19:48:36 +0000 (UTC) Xref: archiver1.google.com comp.unix.tru64:10844 I've been trying to port a linx program to Tru64 for sometime now but haven�t been able to do it. I've learned a lot from your page and wan't to see if you can help me out. The software is called snoopylogger (http://www.citi.umich.edu/u/marius/snoopy/). Basiclly it works like this: You compile the software and place it first in the library_path. All it does is log all the calls to execv and execve and then call the correct symbol in the C library. In Linux it works perfectlly, but when I try tu use it in Tru64 all I get is: seg fault. The Linux/Solaris Makefile uses de '-ldl' flag, on Tru64 it doesn't work. I'm using gcc-3.2.2 20030222. Could you help me out. There must be some ld flag that I'm missing but i have no idea where else to look. Here is the code: #include #include #include #include "snoopy.h" #if defined(RTLD_NEXT) # define REAL_LIBC RTLD_NEXT #else # define REAL_LIBC ((void *) -1L) #endif #define FN(ptr,type,name,args) ptr = (type (*)args)dlsym (REAL_LIBC, name) inline void log(const char *filename, char **argv) { static char **ptr, *logstring; static int size = MAX; static int (*guid)(void); FN(guid,int,"getuid",(void)); ptr = (char **)&argv[1]; logstring = (char *)malloc((size_t *)size+2); openlog("snoopy", LOG_PID, LOG_AUTHPRIV); size -= snprintf(logstring, size,"[%s, uid:%d sid:%d]: %s", getlogin(), (*guid)(), getsid(0), filename); while (*ptr && size > 0) size -= snprintf((logstring+MAX-size), size," %s",&(**ptr++)); syslog(LOG_INFO, "%s", logstring); free(logstring); closelog(); } int execve(const char *filename, char **argv, char **envp) { static int (*func)(const char *, char **, char **); FN(func,int,"execve",(const char *, char **, char **)); #if ROOT_ONLY if ((*guid)() != 0) return (*func) (filename, argv, envp); #endif log(filename, argv); return (*func) (filename, argv, envp); } int execv(const char *filename, char **argv) { static int (*func)(const char *, char **); FN(func,int,"execv",(const char *, char **)); #if ROOT_ONLY if ((*guid)() != 0) return (*func) (filename, argv); #endif log(filename, argv); return (*func) (filename, argv); } Thanks in advance Pablo