diff options
author | fche <fche@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-04 17:33:54 +0000 |
---|---|---|
committer | fche <fche@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-04 17:33:54 +0000 |
commit | 2e3cd6373e847a2d667a23f56e2b4c8d614ef318 (patch) | |
tree | 57606334dc29196000e1c06229646ad4e857de7d /libmudflap/mf-hooks2.c | |
parent | 9a89afa2ede1c5a88c414f322f5faef1c72cd9fe (diff) | |
download | gcc-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/mf-hooks2.c')
-rw-r--r-- | libmudflap/mf-hooks2.c | 109 |
1 files changed, 109 insertions, 0 deletions
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 |