summaryrefslogtreecommitdiff
path: root/libmudflap
diff options
context:
space:
mode:
authorfche <fche@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-04 17:33:54 +0000
committerfche <fche@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-04 17:33:54 +0000
commit2e3cd6373e847a2d667a23f56e2b4c8d614ef318 (patch)
tree57606334dc29196000e1c06229646ad4e857de7d /libmudflap
parent9a89afa2ede1c5a88c414f322f5faef1c72cd9fe (diff)
downloadgcc-2e3cd6373e847a2d667a23f56e2b4c8d614ef318.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88517 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libmudflap')
-rw-r--r--libmudflap/ChangeLog10
-rw-r--r--libmudflap/config.h.in30
-rwxr-xr-xlibmudflap/configure325
-rw-r--r--libmudflap/configure.ac15
-rw-r--r--libmudflap/mf-hooks2.c109
-rw-r--r--libmudflap/mf-hooks3.c1
-rw-r--r--libmudflap/mf-runtime.c21
-rw-r--r--libmudflap/mf-runtime.h.in5
8 files changed, 491 insertions, 25 deletions
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
index 97ab17c72f4..65040e59b0b 100644
--- a/libmudflap/ChangeLog
+++ b/libmudflap/ChangeLog
@@ -1,3 +1,13 @@
+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:
diff --git a/libmudflap/config.h.in b/libmudflap/config.h.in
index 2372c226aa9..41e61948905 100644
--- a/libmudflap/config.h.in
+++ b/libmudflap/config.h.in
@@ -1,5 +1,11 @@
/* 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
diff --git a/libmudflap/configure b/libmudflap/configure
index 5672cad090a..6eb77bb6700 100755
--- a/libmudflap/configure
+++ b/libmudflap/configure
@@ -3593,8 +3593,14 @@ done
+
+
+
+
+
for ac_header in 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
+ 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
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -3747,6 +3753,7 @@ done
+
for ac_func in backtrace backtrace_symbols gettimeofday signal
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -3852,7 +3859,6 @@ done
-
for ac_func in fopen64 fseeko64 ftello64 stat64
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -3959,7 +3965,6 @@ done
-
for ac_func in strnlen memrchr strncpy memmem sethostname
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -4064,7 +4069,6 @@ done
-
for ac_func in __ctype_b_loc __ctype_tolower_loc __ctype_toupper_loc
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -4174,7 +4178,6 @@ done
-
for ac_func in getlogin cuserid getpwnam getpwuid getpwent getgrnam getgrgid getgrent
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -4489,6 +4492,316 @@ fi
done
+
+
+for ac_func in getprotoent getprotobyname getprotobynumber
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+for ac_func in getmntent setmntent addmntent
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+for ac_func in inet_ntoa
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -5344,7 +5657,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 5347 "configure"' > conftest.$ac_ext
+ echo '#line 5660 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
diff --git a/libmudflap/configure.ac b/libmudflap/configure.ac
index 7c7b8c76a55..04020b2c839 100644
--- a/libmudflap/configure.ac
+++ b/libmudflap/configure.ac
@@ -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>
diff --git a/libmudflap/mf-hooks2.c b/libmudflap/mf-hooks2.c
index 640b78e6be8..52ff3c1b4a8 100644
--- a/libmudflap/mf-hooks2.c
+++ b/libmudflap/mf-hooks2.c
@@ -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
diff --git a/libmudflap/mf-hooks3.c b/libmudflap/mf-hooks3.c
index b844ee5c2b5..d315b8224a0 100644
--- a/libmudflap/mf-hooks3.c
+++ b/libmudflap/mf-hooks3.c
@@ -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. */
}
diff --git a/libmudflap/mf-runtime.c b/libmudflap/mf-runtime.c
index 312963b017d..a0f9f739f53 100644
--- a/libmudflap/mf-runtime.c
+++ b/libmudflap/mf-runtime.c
@@ -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)
diff --git a/libmudflap/mf-runtime.h.in b/libmudflap/mf-runtime.h.in
index 5630b561b25..298ed6efa8a 100644
--- a/libmudflap/mf-runtime.h.in
+++ b/libmudflap/mf-runtime.h.in
@@ -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