summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-05-23 08:23:03 +0000
committerNick Mathewson <nickm@torproject.org>2006-05-23 08:23:03 +0000
commit89a8411acec388612c71a0268752cbc0d5f958d4 (patch)
tree7ba1d7f7abdf839299a203eefd00a1a312cd7866
parent13c4590dd19351f55e8eb6830e44d64897b72c73 (diff)
downloadtor-89a8411acec388612c71a0268752cbc0d5f958d4.tar.gz
tor-89a8411acec388612c71a0268752cbc0d5f958d4.zip
Throw out this UNALIGNED_INT_ACCESS_OK nonsense. Even where it works, it is often way way slower than doing the right thing. Backport candidate.
svn:r6473
-rw-r--r--configure.in29
-rw-r--r--src/common/compat.c2
-rw-r--r--src/common/compat.h11
3 files changed, 0 insertions, 42 deletions
diff --git a/configure.in b/configure.in
index 813510200c..6027a61b1f 100644
--- a/configure.in
+++ b/configure.in
@@ -398,35 +398,6 @@ AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
AC_CHECK_SIZEOF(cell_t)
-# Now, let's see about alignment requirements. On some platforms, we override
-# the default.
-case $host in
- ia64-*-* | arm-*-* | sparc-*-* | sparc64-*-* )
- tor_cv_unaligned_ok=no
- ;;
- # On the following architectures unaligned access works, but is not done in
- # hardware. This means that when you try to do unaligned access the kernel
- # gets to sort out an exception and then work around to somehow make your
- # reqest work, which is quite expensive. Therefore it's probably better to
- # not even do it.
- alpha-*-* | mips-*-* | mipsel-*-* )
- tor_cv_unaligned_ok=no
- ;;
- *)
-AC_CACHE_CHECK([whether unaligned int access is allowed], tor_cv_unaligned_ok,
-[AC_RUN_IFELSE([AC_LANG_SOURCE(
-[[int main () { char s[] = "A\x00\x00\x00\x00\x00\x00\x00";
-return *(int*)(&s[1]); }]])],
- [tor_cv_unaligned_ok=yes],
- [tor_cv_unaligned_ok=no],
- [tor_cv_unaligned_ok=cross])])
-esac
-
-if test $tor_cv_unaligned_ok = yes; then
- AC_DEFINE([UNALIGNED_INT_ACCESS_OK], 1,
- [Define to 1 iff unaligned int access is allowed])
-fi
-
# Now make sure that NULL can be represented as zero bytes.
AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
[AC_RUN_IFELSE([AC_LANG_SOURCE(
diff --git a/src/common/compat.c b/src/common/compat.c
index 3a05c32d45..3d70045eb5 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -206,7 +206,6 @@ tor_fix_source_file(const char *fname)
}
#endif
-#ifndef UNALIGNED_INT_ACCESS_OK
/**
* Read a 16-bit value beginning at <b>cp</b>. Equivalent to
* *(uint16_t*)(cp), but will not cause segfaults on platforms that forbid
@@ -249,7 +248,6 @@ set_uint32(char *cp, uint32_t v)
{
memcpy(cp,&v,4);
}
-#endif
/**
* Rename the file <b>from</b> to the file <b>to</b>. On unix, this is
diff --git a/src/common/compat.h b/src/common/compat.h
index 8e570cb269..25876ef18d 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -223,21 +223,10 @@ const char *tor_socket_strerror(int e);
/* ===== OS compatibility */
const char *get_uname(void);
-/* Some platforms segfault when you try to access a multi-byte type
- * that isn't aligned to a word boundary. The macros and/or functions
- * below can be used to access unaligned data on any platform.
- */
-#ifdef UNALIGNED_INT_ACCESS_OK
-#define get_uint16(cp) (*(uint16_t*)(cp))
-#define get_uint32(cp) (*(uint32_t*)(cp))
-#define set_uint16(cp,v) do { *(uint16_t*)(cp) = (v); } while (0)
-#define set_uint32(cp,v) do { *(uint32_t*)(cp) = (v); } while (0)
-#else
uint16_t get_uint16(const char *cp);
uint32_t get_uint32(const char *cp);
void set_uint16(char *cp, uint16_t v);
void set_uint32(char *cp, uint32_t v);
-#endif
int set_max_file_descriptors(unsigned long limit, unsigned long cap);
int switch_id(char *user, char *group);