Commit 07c2f075 by Frank Ch. Eigler Committed by Frank Ch. Eigler

configure.ac: Look for more headers & functions.

2004-10-04  Frank Ch. Eigler  <fche@redhat.com>

	* configure.ac: Look for more headers & functions.
	* mf-hooks2.c (getmntent, inet_ntoa, getproto*): New wrapper functions.
	* mf-runtime.h.in: Add new "#pragma redefine_extname"s for them.
	* mf-runtime.c (options): Clean up integer signedness warnings.
	(main): Add a declaration to fix a warning.
	* mf-hooks3.c (pthread_exit): Add not-reached exit() to wrapper.
	* configure, config.h.in: Regenerated.

From-SVN: r88517
parent 8f920ef7
2004-10-04 Frank Ch. Eigler <fche@redhat.com>
* configure.ac: Look for more headers & functions.
* mf-hooks2.c (getmntent, inet_ntoa, getproto*): New wrapper functions.
* mf-runtime.h.in: Add new "#pragma redefine_extname"s for them.
* mf-runtime.c (options): Clean up integer signedness warnings.
(main): Add a declaration to fix a warning.
* mf-hooks3.c (pthread_exit): Add not-reached exit() to wrapper.
* configure, config.h.in: Regenerated.
2004-10-02 Frank Ch. Eigler <fche@redhat.com>
* testsuite/libmudflap.c/pass50-frag.c, fail33-frag.c, fail34-frag.c:
......
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `addmntent' function. */
#undef HAVE_ADDMNTENT
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `backtrace' function. */
#undef HAVE_BACKTRACE
......@@ -60,6 +66,18 @@
/* Define to 1 if you have the `getlogin_r' function. */
#undef HAVE_GETLOGIN_R
/* Define to 1 if you have the `getmntent' function. */
#undef HAVE_GETMNTENT
/* Define to 1 if you have the `getprotobyname' function. */
#undef HAVE_GETPROTOBYNAME
/* Define to 1 if you have the `getprotobynumber' function. */
#undef HAVE_GETPROTOBYNUMBER
/* Define to 1 if you have the `getprotoent' function. */
#undef HAVE_GETPROTOENT
/* Define to 1 if you have the `getpwent' function. */
#undef HAVE_GETPWENT
......@@ -90,6 +108,9 @@
/* Define to 1 if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define to 1 if you have the `inet_ntoa' function. */
#undef HAVE_INET_NTOA
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
......@@ -105,9 +126,15 @@
/* Define to 1 if you have the `memrchr' function. */
#undef HAVE_MEMRCHR
/* Define to 1 if you have the <mntent.h> header file. */
#undef HAVE_MNTENT_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* define if you have <pthread.h> */
#undef HAVE_PTHREAD_H
......@@ -117,6 +144,9 @@
/* Define to 1 if you have the `sethostname' function. */
#undef HAVE_SETHOSTNAME
/* Define to 1 if you have the `setmntent' function. */
#undef HAVE_SETMNTENT
/* Define to 1 if you have the `signal' function. */
#undef HAVE_SIGNAL
......
......@@ -60,22 +60,19 @@ AC_TRY_COMPILE([
enable_shared=no])
AC_CHECK_HEADERS(stdint.h execinfo.h signal.h dlfcn.h dirent.h pwd.h grp.h \
netdb.h sys/ipc.h sys/sem.h sys/shm.h sys/wait.h sys/socket.h ctype.h)
AC_CHECK_FUNCS(backtrace backtrace_symbols gettimeofday signal)
netdb.h sys/ipc.h sys/sem.h sys/shm.h sys/wait.h sys/socket.h ctype.h mntent.h \
sys/socket.h netinet/in.h arpa/inet.h dlfcn.h)
dnl Check for 64-bit stdio calls related to Large File Support
AC_CHECK_FUNCS(backtrace backtrace_symbols gettimeofday signal)
AC_CHECK_FUNCS(fopen64 fseeko64 ftello64 stat64)
dnl Check for nonstandard functions
AC_CHECK_FUNCS(strnlen memrchr strncpy memmem sethostname)
dnl Check for glibc ctype functions
AC_CHECK_FUNCS(__ctype_b_loc __ctype_tolower_loc __ctype_toupper_loc)
dnl Check for pwd.h / grp.h family of functions
AC_CHECK_FUNCS(getlogin cuserid getpwnam getpwuid getpwent getgrnam getgrgid getgrent)
AC_CHECK_FUNCS(getlogin_r getpwnam_r getpwuid_r getgrnam_r getgrgid_r)
AC_CHECK_FUNCS(getservent getservbyname getservbyport getaddrinfo gai_strerror)
AC_CHECK_FUNCS(getprotoent getprotobyname getprotobynumber)
AC_CHECK_FUNCS(getmntent setmntent addmntent)
AC_CHECK_FUNCS(inet_ntoa)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/ipc.h>
......
......@@ -63,6 +63,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <limits.h>
#include <time.h>
#include <ctype.h>
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
......@@ -90,6 +93,18 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
#ifdef HAVE_MNTENT_H
#include <mntent.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include "mf-runtime.h"
#include "mf-impl.h"
......@@ -1871,3 +1886,97 @@ WRAPPER2(const char *, gai_strerror, int errcode)
return buf;
}
#endif
#ifdef HAVE_GETMNTENT
WRAPPER2(struct mntent *, getmntent, FILE *filep)
{
struct mntent *m;
static struct mntent *last = NULL;
MF_VALIDATE_EXTENT (filep, sizeof (*filep), __MF_CHECK_WRITE,
"getmntent stream");
#define UR(field) __mf_unregister(last->field, strlen (last->field)+1, __MF_TYPE_STATIC)
if (last)
{
UR (mnt_fsname);
UR (mnt_dir);
UR (mnt_type);
UR (mnt_opts);
__mf_unregister (last, sizeof (*last), __MF_TYPE_STATIC);
}
#undef UR
m = getmntent (filep);
last = m;
#define R(field) __mf_register(last->field, strlen (last->field)+1, __MF_TYPE_STATIC, "mntent " #field)
if (m)
{
R (mnt_fsname);
R (mnt_dir);
R (mnt_type);
R (mnt_opts);
__mf_register (last, sizeof (*last), __MF_TYPE_STATIC, "getmntent result");
}
#undef R
return m;
}
#endif
#ifdef HAVE_INET_NTOA
WRAPPER2(char *, inet_ntoa, struct in_addr in)
{
static char *last_buf = NULL;
char *buf;
if (last_buf)
__mf_unregister (last_buf, strlen (last_buf)+1, __MF_TYPE_STATIC);
buf = inet_ntoa (in);
last_buf = buf;
if (buf)
__mf_register (last_buf, strlen (last_buf)+1, __MF_TYPE_STATIC, "inet_ntoa result");
return buf;
}
#endif
#ifdef HAVE_GETPROTOENT
WRAPPER2(struct protoent *, getprotoent, void)
{
struct protoent *buf;
buf = getprotoent ();
if (buf != NULL)
__mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC, "getproto*() return");
return buf;
}
#endif
#ifdef HAVE_GETPROTOBYNAME
WRAPPER2(struct protoent *, getprotobyname, const char *name)
{
struct protoent *buf;
MF_VALIDATE_EXTENT(name, strlen(name)+1, __MF_CHECK_READ,
"getprotobyname name");
buf = getprotobyname (name);
if (buf != NULL)
__mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
"getproto*() return");
return buf;
}
#endif
#ifdef HAVE_GETPROTOBYNUMBER
WRAPPER2(struct protoent *, getprotobynumber, int port)
{
struct protoent *buf;
buf = getprotobynumber (port);
if (buf != NULL)
__mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
"getproto*() return");
return buf;
}
#endif
......@@ -597,4 +597,5 @@ WRAPPER(void, pthread_exit, void *rc)
/* __mf_state = reentrant; */
CALL_REAL (pthread_exit, rc);
/* NOTREACHED */
exit (0); /* Satisfy noreturn attribute of pthread_exit. */
}
......@@ -310,36 +310,36 @@ static struct option
set_option,
read_integer_option,
} type;
int value;
int *target;
unsigned value;
unsigned *target;
}
options [] =
{
{"mode-nop",
"mudflaps do nothing",
set_option, (int)mode_nop, (int *)&__mf_opts.mudflap_mode},
set_option, (unsigned)mode_nop, (unsigned *)&__mf_opts.mudflap_mode},
{"mode-populate",
"mudflaps populate object tree",
set_option, (int)mode_populate, (int *)&__mf_opts.mudflap_mode},
set_option, (unsigned)mode_populate, (unsigned *)&__mf_opts.mudflap_mode},
{"mode-check",
"mudflaps check for memory violations",
set_option, (int)mode_check, (int *)&__mf_opts.mudflap_mode},
set_option, (unsigned)mode_check, (unsigned *)&__mf_opts.mudflap_mode},
{"mode-violate",
"mudflaps always cause violations (diagnostic)",
set_option, (int)mode_violate, (int *)&__mf_opts.mudflap_mode},
set_option, (unsigned)mode_violate, (unsigned *)&__mf_opts.mudflap_mode},
{"viol-nop",
"violations do not change program execution",
set_option, (int)viol_nop, (int *)&__mf_opts.violation_mode},
set_option, (unsigned)viol_nop, (unsigned *)&__mf_opts.violation_mode},
{"viol-abort",
"violations cause a call to abort()",
set_option, (int)viol_abort, (int *)&__mf_opts.violation_mode},
set_option, (unsigned)viol_abort, (unsigned *)&__mf_opts.violation_mode},
{"viol-segv",
"violations are promoted to SIGSEGV signals",
set_option, (int)viol_segv, (int *)&__mf_opts.violation_mode},
set_option, (unsigned)viol_segv, (unsigned *)&__mf_opts.violation_mode},
{"viol-gdb",
"violations fork a gdb process attached to current program",
set_option, (int)viol_gdb, (int *)&__mf_opts.violation_mode},
set_option, (unsigned)viol_gdb, (unsigned *)&__mf_opts.violation_mode},
{"trace-calls",
"trace calls to mudflap runtime library",
set_option, 1, &__mf_opts.trace_mf_calls},
......@@ -728,6 +728,7 @@ __wrap_main (int argc, char* argv[])
{
extern char **environ;
extern int main ();
extern int __real_main ();
static int been_here = 0;
if (__mf_opts.heur_std_data && ! been_here)
......
......@@ -197,6 +197,11 @@ extern int __mf_set_options (const char *opts);
#pragma redefine_extname getservbyname __mfwrap_getservbyname
#pragma redefine_extname getservbyport __mfwrap_getservbyport
#pragma redefine_extname gai_strerror __mfwrap_gai_strerror
#pragma redefine_extname getmntent __mfwrap_getmntent
#pragma redefine_extname inet_ntoa __mfwrap_inet_ntoa
#pragma redefine_extname getprotoent __mfwrap_getprotoent
#pragma redefine_extname getprotobyname __mfwrap_getprotobyname
#pragma redefine_extname getprotobynumber __mfwrap_getprotobynumber
/* Disable glibc macros. */
#define __NO_STRING_INLINES
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment