1

I get some problem about LD_PRELOAD.

When I use LD_PRELOAD in HPUX and Solaris, I found that I cannot attach my open64/open/creat64/creat function in /usr/bin/touch, but my unlink can take effect in /usr/bin/rm, why?

I have do a simple test:

int open(int fd, int flag, mode_t mode) 
{
    return -1;
}

int open64(int fd, int flag, mode_t mode) 
{
    return -1;
}

int creat(int fd, mode_t mode)
{
    return -1;
}

int creat64(int fd, mode_t mode)
{
    return -1;
}

when i do this, i found : normally, i cannot open file, but touch can do it!

why!i was puzzled by this for long time. who can help me.thx

at last, sorry for my poor English

j0k
  • 22,600
  • 28
  • 79
  • 90
littletiny
  • 11
  • 3

1 Answers1

1

i think your function signature is wrong. (int instead of char *) on my system i see the following signature:

grep -w creat /usr/include/*

/usr/include/fcntl.h:#define    creat64     creat
/usr/include/fcntl.h:extern int creat(const char *, mode_t);

grep -w open /usr/include/*

/usr/include/fcntl.h:#define    open64      open
/usr/include/fcntl.h:extern int open(const char *, int, ...);
Chris
  • 908
  • 6
  • 11