#ifndef _LIBLOAD_H #define _LIBLOAD_H #include #include #include enum {OPEN_I = 0, OPEN64_I, READ_I, WRITE_I, CLOSE_I, LSEEK_I, DUP_I, DUP2_I, READV_I, WRITEV_I, FCNTL_I, FORK_I, PREAD_I, PWRITE_I, FDOPEN_I, FOPEN64_I, FOPEN_I, FCLOSE_I, FREAD_I, FWRITE_I, FSEEK_I, /* FSEEK64_I, */ REWIND_I, FSETPOS_I, CREAT_I, CREAT64_I, FGETC_I, FGETS_I, GETC_I, GETS_I, FPUTC_I, FPUTS_I, PUTC_I, PUTS_I, UNGETC_I, VFSCANF_I, FSCANF_I, VFPRINTF_I, FPRINTF_I, SOCKET_I, ACCEPT_I, SEND_I, SENDTO_I, SENDMSG_I, RECV_I, RECVFROM_I, RECVMSG_I, EXECVE_I, EXECL_I, EXECLP_I, EXECLE_I, EXECV_I, EXECVP_I }; extern void *farray[]; /* #define REAL_WRITE (*(((ssize_t (*)(int, const void *, size_t)))farray[WRITE_I])) */ #define REAL_OPEN ((int (*)(const char *, int, mode_t))farray[OPEN_I]) #define REAL_OPEN64 ((int (*)(const char *, int, mode_t))farray[OPEN_I]) #define REAL_WRITE ((ssize_t (*)(int, const void *, size_t))farray[WRITE_I]) #define REAL_CLOSE ((int (*)(int))farray[CLOSE_I]) #define REAL_LSEEK ((off_t (*)(int, off_t, int))farray[LSEEK_I]) #define REAL_READ ((ssize_t (*)(int, void *, size_t))farray[READ_I]) #define REAL_DUP ((int (*)(int))farray[DUP_I]) #define REAL_DUP2 ((int (*)(int, int))farray[DUP2_I]) #define REAL_READV ((int (*)(int, const struct iovec *, size_t))farray[READV_I]) #define REAL_WRITEV ((int (*)(int, const struct iovec *, size_t))farray[WRITEV_I]) #define REAL_FCNTL ((int (*)(int, int, struct flock *))farray[FCNTL_I]) #define REAL_FORK ((pid_t (*)())farray[FORK_I]) #define REAL_LSEEK64 ((off_t (*)(int, off_t, int))farray[LSEEK_I]) #define REAL_PREAD ((ssize_t (*)(int, void *, size_t, off_t))farray[PREAD_I]) #define REAL_PWRITE ((ssize_t (*)(int, const void *, size_t, off_t))farray[PWRITE_I]) #define REAL_FDOPEN ((FILE *(*)(int, const char *))farray[FDOPEN_I]) #define REAL_FOPEN ((FILE *(*)(const char *, const char *))farray[FOPEN_I]) #define REAL_FOPEN64 ((FILE *(*)(const char *, const char *))farray[FOPEN64_I]) #define REAL_FCLOSE ((int (*)(FILE *))farray[FCLOSE_I]) #define REAL_FREAD ((size_t (*)(void *, size_t, size_t, FILE *))farray[FREAD_I]) #define REAL_FWRITE ((size_t (*)(const void *, size_t, size_t, FILE *))farray[FWRITE_I]) #define REAL_FSEEK ((int (*)(FILE *, long, int))farray[FSEEK_I]) /* #define REAL_FSEEK64 ((int (*)(FILE *, long, int))farray[FSEEK64_I]) */ #define REAL_REWIND ((void (*)(FILE *))farray[REWIND_I]) #define REAL_FSETPOS ((int (*)(FILE *, fpos_t *))farray[FSETPOS_I]) #define REAL_CREAT ((int (*)(const char *, mode_t))farray[CREAT_I]) #define REAL_CREAT64 ((int (*)(const char *, mode_t))farray[CREAT64_I]) #define REAL_FGETC ((int (*)(FILE *))farray[FGETC_I]) #define REAL_FGETS ((char *(*)(char *, int, FILE *))farray[FGETS_I]) #define REAL_GETC ((int (*)(FILE *))farray[GETC_I]) #define REAL_GETS ((char *(*)(char *))farray[GETS_I]) #define REAL_FPUTC ((int (*)(int, FILE *))farray[FPUTC_I]) #define REAL_FPUTS ((int (*)(const char *, FILE *))farray[FPUTS_I]) #define REAL_PUTC ((int (*)(int, FILE *))farray[PUTC_I]) #define REAL_PUTS ((int (*)(const char *))farray[PUTS_I]) #define REAL_UNGETC ((int (*)(int, FILE *))farray[UNGETC_I]) #define REAL_VFSCANF ((int (*)(FILE *, const char *, va_list))farray[VFSCANF_I]) #define REAL_FSCANF ((int (*)(FILE *, const char *, ...))farray[FSCANF_I]) #define REAL_VFPRINTF ((int (*)(FILE *, const char *, va_list))farray[VFPRINTF_I]) #define REAL_FPRINTF ((int (*)(FILE *, const char *, ...))farray[FPRINTF_I]) #define REAL_SOCKET ((int (*)(int, int, int))farray[SOCKET_I]) #define REAL_ACCEPT ((int (*)(int, struct sockaddr *, socklen_t *))farray[ACCEPT_I]) #define REAL_SEND ((ssize_t (*)(int, const void *, size_t, int))farray[SEND_I]) #define REAL_SENDTO ((ssize_t (*)(int, const void *, size_t, int, const struct sockaddr *, socklen_t))farray[SENDTO_I]) #define REAL_SENDMSG ((ssize_t (*)(int, const struct msghdr *, int))farray[SENDMSG_I]) #define REAL_RECV ((ssize_t (*)(int, void *, size_t, int))farray[RECV_I]) #define REAL_RECVFROM ((ssize_t (*)(int, void *, size_t, int, struct sockaddr *, socklen_t *))farray[RECVFROM_I]) #define REAL_RECVMSG ((ssize_t (*)(int, struct msghdr *, int))farray[RECVMSG_I]) #define REAL_EXECVE ((int (*)(const char *, char *const argv[], char *const envp[]))farray[EXECVE_I]) #define REAL_EXECL ((int (*)(const char *, const char *, ...))farray[EXECL_I]) #define REAL_EXECLP ((int (*)(const char *, const char *, ...))farray[EXECLP_I]) #define REAL_EXECLE ((int (*)(const char *, const char *, ...))farray[EXECLE_I]) #define REAL_EXECV ((int (*)(const char *, char *const argc[]))farray[EXECV_I]) #define REAL_EXECVP ((int (*)(const char *, char *const argc[]))farray[EXECVP_I]) int libload(); #include #if defined(NPTL) #define __thread __threadp #endif /* #define REAL_EXECVE __execve */ /* static inline int REAL_EXECV(const char *path, char *const argv[]) */ /* { */ /* return REAL_EXECVE(path, argv, environ); */ /* } */ #endif