simple solution linux glibc >2.2 problem

New Message Reply Date view Thread view Subject view Author view

From: root (pavel.frolov++at++gmd.de)
Date: 05/16/2001 12:35:58


I have written a small library.
And you must load libpfstat.so before start your app using libpf.so in
the following
way, for example:

export LD_PRELOAD=/path/to/libpfstat.so

Here is source files.
-- begining of pfstat.c

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int stat (const char *file, struct stat *buf)
{
  return __xstat(_STAT_VER,file,buf);
}

-- end of pfstat.c
-- begin of Makefile

SHCC= ${CC} -fPIC
MINOR= 1
MAJOR= 0
LIB_NAME= libpfstat
SHLIB= ${LIB_NAME}.so.${MAJOR}.${MINOR}
TARGETS= ${SHLIB}

OBJS= pfstat.o

all: ${TARGETS}

${TARGETS}: ${OBJS}
 ${SHCC} ${CFLAGS} -nostdlib -shared -o ${SHLIB} -Wl,--soname
-Wl,${LIB_NAME}.so.${MAJOR} ${OBJS}
 ln -sf ${SHLIB} ${LIB_NAME}.so

clean:
       -rm -f *.so *.so.* *.o *~ ${TARGETS}

-- end of Makefile

                           Best regards, Pavel.


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed May 16 2001 - 10:36:43 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.