Clean up pal configure stage
authorGeoff Norton <grompf@gmail.com>
Sat, 14 Feb 2015 21:07:35 +0000 (13:07 -0800)
committerGeoff Norton <grompf@gmail.com>
Sat, 14 Feb 2015 21:48:26 +0000 (13:48 -0800)
This commit removes a bunch of dead checks in the configure stage, as well
as fixing inconsistencies in HAVE_FTRUNCATE_LENGTH_ISSUE/HAVE_FTRUNCATE_LENGTH_BUG
off_t in file.cpp was declared after the goto, making it a protected scope, so it
needed to be moved up.

src/pal/src/config.h.in
src/pal/src/configure.cmake
src/pal/src/file/file.cpp
src/pal/src/misc/identity.cpp

index 5133756..639c780 100644 (file)
@@ -3,28 +3,18 @@
 
 #define _NO_DEBUG_MESSAGES_ 0
 
-#cmakedefine01 HAVE_WCHAR_H
 #cmakedefine01 HAVE_IEEEFP_H
 #cmakedefine01 HAVE_ALLOCA_H
-#cmakedefine01 HAVE_STDINT_H
-#cmakedefine01 HAVE_NETDB_H
-#cmakedefine01 HAVE_INTTYPES_H
-#cmakedefine01 HAVE_STROPTS_H
 #cmakedefine01 HAVE_SYS_VMPARAM_H
 #cmakedefine01 HAVE_MACH_VM_TYPES_H
 #cmakedefine01 HAVE_MACH_VM_PARAM_H
-#cmakedefine01 HAVE_SYS_PARAM_H
-#cmakedefine01 HAVE_SYS_FILIO_H
-#cmakedefine01 HAVE_SYS_SOCKIO_H
 #cmakedefine01 HAVE_PROCFS_H
 #cmakedefine01 HAVE_CRT_EXTERNS_H
 #cmakedefine01 HAVE_SYS_TIME_H
 #cmakedefine01 HAVE_PTHREAD_NP_H
 #cmakedefine01 HAVE_SYS_LWP_H
-#cmakedefine01 HAVE_XLOCALE
 
 #cmakedefine01 HAVE_KQUEUE
-#cmakedefine01 HAVE_TOLOWER
 #cmakedefine01 HAVE_GETPWUID_R
 #cmakedefine01 HAVE_PTHREAD_SUSPEND
 #cmakedefine01 HAVE_PTHREAD_SUSPEND_NP
 #cmakedefine01 HAVE_UTIMES
 #cmakedefine01 HAVE_SYSCTL
 #cmakedefine01 HAVE_SYSCONF
-#cmakedefine01 HAVE_STRTOK_R
 #cmakedefine01 HAVE_LOCALTIME_R
-#cmakedefine01 HAVE_CTIME_R
 #cmakedefine01 HAVE_GMTIME_R
 #cmakedefine01 HAVE_TIMEGM
 #cmakedefine01 HAVE__SNWPRINTF
 #cmakedefine01 HAVE_POLL
-#cmakedefine01 HAVE_STATFS
 #cmakedefine01 HAVE_STATVFS
 #cmakedefine01 HAVE_THREAD_SELF
 #cmakedefine01 HAVE__LWP_SELF
@@ -63,7 +50,6 @@
 
 #cmakedefine01 HAVE_STAT_TIMESPEC
 #cmakedefine01 HAVE_STAT_NSEC
-#cmakedefine01 HAVE_SOCKADDR_SA_LEN
 #cmakedefine01 HAVE_TM_GMTOFF
 
 #cmakedefine01 HAVE_BSD_REGS_T
@@ -71,9 +57,6 @@
 #cmakedefine01 HAVE_GREGSET_T
 #cmakedefine01 HAVE_SIGINFO_T
 #cmakedefine01 HAVE_UCONTEXT_T
-#cmakedefine01 HAVE_IN_ADDR_T
-#cmakedefine01 HAVE_SOCKLEN_T
-#cmakedefine01 HAVE_SOCKADDR_EXT
 #cmakedefine01 HAVE_PTHREAD_RWLOCK_T
 #cmakedefine01 HAVE_PRWATCH_T
 #cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@
@@ -94,7 +77,7 @@
 #cmakedefine01 HAVE_BROKEN_FIFO_SELECT
 #cmakedefine01 HAVE_BROKEN_FIFO_KEVENT
 #cmakedefine01 HAVE_FTRUNCATE_LARGE_LENGTH_SUPPORT
-#cmakedefine01 HAS_FTRUNCATE_LENGTH_BUG
+#cmakedefine01 HAS_FTRUNCATE_LENGTH_ISSUE
 #cmakedefine01 HAVE_SCHED_GET_PRIORITY
 #cmakedefine01 HAVE_WORKING_GETTIMEOFDAY
 #cmakedefine01 HAVE_WORKING_CLOCK_GETTIME
 #cmakedefine01 PTHREAD_CREATE_MODIFIES_ERRNO
 #cmakedefine01 SEM_INIT_MODIFIES_ERRNO
 #cmakedefine01 HAVE_PROCFS_CTL
-#cmakedefine01 SHUTDOWN_FAILS_ON_CONNECTIONLESS_SOCKETS
-#cmakedefine01 BROADCAST_ALLOWED_WITHOUT_SO_BROADCAST
 #cmakedefine01 HAVE_COMPATIBLE_ACOS
 #cmakedefine01 HAVE_COMPATIBLE_ASIN
 #cmakedefine01 HAVE_COMPATIBLE_POW
 #cmakedefine ZH_TW_LOCALE_NAME "@ZH_TW_LOCALE_NAME@"
 
 #define CHECK_TRACE_SPECIFIERS 0
-#define CLOSE_BLOCKS_ON_OUTSTANDING_SYSCALLS 0
 #define PROCFS_MEM_NAME ""
 #define DIRECTIO_DISABLED 0
-#define HAS_FTRUNCATE_LENGTH_ISSUE 0
-#define HAVE_CADDR_T 0
 #define HAVE_GETHRTIME 0
 #define HAVE_LOWERCASE_ISO_NAME 0
 #define HAVE_READ_REAL_TIME 0
 #define MALLOC_ZERO_RETURNS_NULL 0
 #define MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP 0
 #define NEED_DLCOMPAT 0
-#define NEED_STACK_PROTECTOR_IMPL 0
-#define NETDB_DEFINES_MAXHOSTNAMELEN 0
 #define OPEN64_IS_USED_INSTEAD_OF_OPEN 0
 #define PAL_IGNORE_NORMAL_THREAD_PRIORITY 0
 #define SELF_SUSPEND_FAILS_WITH_NATIVE_SUSPENSION 0
-#define SENDTO_RETURNS_UNREACH_ON_WRONG_AF 0
 #define SET_SCHEDPARAM_NEEDS_PRIVS 0
 #define SIGWAIT_FAILS_WHEN_PASSED_FULL_SIGSET 0
 #define SYNCHMGR_PIPE_BASED_THREAD_BLOCKING 0
-#define SYS_PARAM_DEFINES_MAXHOSTNAMELEN 0
 #define WRITE_0_BYTES_HANGS_TTY 0
-#define SO_TIMEO_NOT_SUPPORTED 0
 #endif
index 2c34510..88113ff 100644 (file)
@@ -6,28 +6,18 @@ include(CheckIncludeFiles)
 include(CheckStructHasMember)
 include(CheckTypeSize)
 
-check_include_files(wchar.h HAVE_WCHAR_H)
 check_include_files(ieeefp.h HAVE_IEEEFP_H)
 check_include_files(alloca.h HAVE_ALLOCA_H)
-check_include_files(stdint.h HAVE_STDINT_H)
-check_include_files(netdb.h HAVE_NETDB_H)
-check_include_files(inttypes.h HAVE_INTTYPES_H)
-check_include_files(stropts.h HAVE_STROPTS_H)
 check_include_files(sys/vmparam.h HAVE_SYS_VMPARAM_H)
 check_include_files(mach/vm_types.h HAVE_MACH_VM_TYPES_H)
 check_include_files(mach/vm_param.h HAVE_MACH_VM_PARAM_H)
-check_include_files(sys/param.h HAVE_SYS_PARAM_H)
-check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
-check_include_files(sys/sockio.h HAVE_SYS_SOCKIO_H)
 check_include_files(procfs.h HAVE_PROCFS_H)
 check_include_files(crt_externs.h HAVE_CRT_EXTERNS_H)
 check_include_files(sys/time.h HAVE_SYS_TIME_H)
 check_include_files(pthread_np.h HAVE_PTHREAD_NP_H)
 check_include_files(sys/lwp.h HAVE_SYS_LWP_H)
-check_include_files(xlocale.h HAVE_XLOCALE)
 
 check_function_exists(kqueue HAVE_KQUEUE)
-check_function_exists(tolower HAVE_TOLOWER)
 check_function_exists(getpwuid_r HAVE_GETPWUID_R)
 check_function_exists(pthread_suspend HAVE_PTHREAD_SUSPEND)
 check_function_exists(pthread_suspend_np HAVE_PTHREAD_SUSPEND_NP)
@@ -44,14 +34,11 @@ check_function_exists(futimes HAVE_FUTIMES)
 check_function_exists(utimes HAVE_UTIMES)
 check_function_exists(sysctl HAVE_SYSCTL)
 check_function_exists(sysconf HAVE_SYSCONF)
-check_function_exists(strtok_r HAVE_STRTOK_R)
 check_function_exists(localtime_r HAVE_LOCALTIME_R)
-check_function_exists(ctime_r HAVE_CTIME_R)
 check_function_exists(gmtime_r HAVE_GMTIME_R)
 check_function_exists(timegm HAVE_TIMEGM)
 check_function_exists(_snwprintf HAVE__SNWPRINTF)
 check_function_exists(poll HAVE_POLL)
-check_function_exists(statfs HAVE_STATFS)
 check_function_exists(statvfs HAVE_STATVFS)
 check_function_exists(thread_self HAVE_THREAD_SELF)
 check_function_exists(_lwp_self HAVE__LWP_SELF)
@@ -67,7 +54,6 @@ check_function_exists(ttrace HAVE_TTRACE)
 set(CMAKE_REQUIRED_DEFINITIONS "-D_DEFAULT_SOURCE")
 check_struct_has_member ("struct stat" st_atimespec "sys/types.h;sys/stat.h" HAVE_STAT_TIMESPEC)
 check_struct_has_member ("struct stat" st_atimensec "sys/types.h;sys/stat.h" HAVE_STAT_NSEC)
-check_struct_has_member ("struct sockaddr" sa_len "sys/types.h;sys/socket.h" HAVE_SOCKADDR_SA_LEN)
 check_struct_has_member ("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
 check_struct_has_member ("ucontext_t" uc_mcontext.gregs[0] ucontext.h HAVE_GREGSET_T)
 
@@ -83,13 +69,6 @@ set(CMAKE_EXTRA_INCLUDE_FILES)
 set(CMAKE_EXTRA_INCLUDE_FILES ucontext.h)
 check_type_size(ucontext_t UCONTEXT_T)
 set(CMAKE_EXTRA_INCLUDE_FILES)
-set(CMAKE_EXTRA_INCLUDE_FILES netinet/in.h sys/types.h)
-check_type_size(in_addr_t IN_ADDR_T)
-set(CMAKE_EXTRA_INCLUDE_FILES)
-set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
-check_type_size(socklen_t SOCKLEN_T)
-check_type_size(sockaddr_ext SOCKADDR_EXT)
-set(CMAKE_EXTRA_INCLUDE_FILES)
 set(CMAKE_EXTRA_INCLUDE_FILES pthread.h)
 check_type_size(pthread_rwlock_t PTHREAD_RWLOCK_T)
 set(CMAKE_EXTRA_INCLUDE_FILES)
@@ -331,7 +310,7 @@ int main(void)
   }
 
   exit(has_bug ? 0 : 1);
-}" HAS_FTRUNCATE_LENGTH_BUG)
+}" HAS_FTRUNCATE_LENGTH_ISSUE)
 set(CMAKE_REQUIRED_LIBRARIES pthread)
 check_cxx_source_runs("
 #include <stdio.h>
@@ -648,88 +627,6 @@ int main(void) {
   }
   exit(0);
 }" HAVE_PROCFS_CTL)
-check_cxx_source_runs("
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-
-int main()
-{
-  int ret = 0;
-  int s;
-  struct sockaddr_in targetAddr;
-  char buff[10];
-
-  s = socket(AF_INET, SOCK_DGRAM, 0);
-  if (-1 == s)
-  {
-    exit (1);
-  }
-
-  memset (&targetAddr, 0, sizeof(targetAddr));
-  targetAddr.sin_family = AF_INET;
-  targetAddr.sin_addr.s_addr = htonl(inet_addr(\"127.0.0.1\"));
-  targetAddr.sin_port = htons(11000);
-
-  ret = shutdown(s,2);
-  if ((ret < 0) && (errno == ENOTCONN))
-    ret = 0;
-  else
-    ret = 1;
-
-  close(s);
-  exit(ret);
-}" SHUTDOWN_FAILS_ON_CONNECTIONLESS_SOCKETS)
-check_cxx_source_runs("
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-
-int main()
-{
-  int ret = 0;
-  int ival = 0;
-  int s;
-  struct sockaddr_in targetAddr;
-  char chr;
-
-  s = socket(AF_INET, SOCK_DGRAM, 0);
-  if (-1 == s)
-  {
-    exit (1);
-  }
-
-  /* Make sure SO_BROADCAST it is off (it should be by default) */
-  ret = setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&ival, sizeof(int));
-  if (-1 == ret)
-  {
-    exit (1);
-  }
-
-  memset (&targetAddr, 0, sizeof(targetAddr));
-  targetAddr.sin_family = AF_INET;
-  targetAddr.sin_addr.s_addr = htonl(inet_addr(\"255.255.255.255\"));
-  targetAddr.sin_port = htons(11000);
-
-  ret = sendto(s, &chr, 1, 0, (struct sockaddr *)&targetAddr, sizeof(targetAddr));
-  if ((ret < 0) && (errno == EACCES))
-    ret = 1;
-  else
-    ret = 0;
-
-  close(s);
-  exit(ret);
-}" BROADCAST_ALLOWED_WITHOUT_SO_BROADCAST)
 set(CMAKE_REQUIRED_LIBRARIES m)
 check_cxx_source_runs("
 #include <math.h>
@@ -995,53 +892,6 @@ int main()
 
   return 1;
 }" FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL)
-check_cxx_source_runs("
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-
-int main()
-{
-  int ret = 0;
-  int ival = 0;
-  int s;
-  struct sockaddr_in targetAddr;
-  char chr;
-
-  s = socket(AF_INET, SOCK_DGRAM, 0);
-  if (-1 == s)
-  {
-    exit (1);
-  }
-
-  /* Make sure SO_BROADCAST it is off (it should be by default) */
-  ret = setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&ival, sizeof(int));
-  if (-1 == ret)
-  {
-    exit (1);
-  }
-
-  memset (&targetAddr, 0, sizeof(targetAddr));
-  targetAddr.sin_family = AF_INET;
-  targetAddr.sin_addr.s_addr = htonl(inet_addr(\"255.255.255.255\"));
-  targetAddr.sin_port = htons(11000);
-
-  ret = sendto(s, &chr, 1, 0, (struct sockaddr *)&targetAddr, sizeof(targetAddr));
-  if ((ret < 0) && (errno == EACCES))
-    ret = 1;
-  else
-    ret = 0;
-
-  close(s);
-  exit(ret);
-}" BROADCAST_ALLOWED_WITHOUT_SO_BROADCAST)
-
-
 
 if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
   set(HAVE_COREFOUNDATION 1)
index 93aa141..c6ce2f2 100644 (file)
@@ -2505,6 +2505,7 @@ CorUnix::InternalSetEndOfFile(
     // extend the file to consume the remainder of free space.
     // 
     struct statfs sFileSystemStats;
+    off_t cbFreeSpace;
     if (fstatfs(pLocalData->unix_fd, &sFileSystemStats) != 0)
     {
         ERROR("fstatfs failed\n");
@@ -2513,7 +2514,7 @@ CorUnix::InternalSetEndOfFile(
     } 
 
     // Free space is free blocks times the size of each block in bytes.
-    off_t cbFreeSpace = (off_t)sFileSystemStats.f_bavail * (off_t)sFileSystemStats.f_bsize;
+    cbFreeSpace = (off_t)sFileSystemStats.f_bavail * (off_t)sFileSystemStats.f_bsize;
 
     if (curr > cbFreeSpace)
     {
index 74f1830..245484a 100644 (file)
@@ -32,12 +32,6 @@ Implementation of GetComputerNameW and GetUserNameW functions.
 #include <errno.h>
 #include <string.h>
 
-#if HAVE_NETDB_H && NETDB_DEFINES_MAXHOSTNAMELEN
-#include <netdb.h>
-#elif HAVE_SYS_PARAM_H && SYS_PARAM_DEFINES_MAXHOSTNAMELEN
-#include <sys/param.h>
-#endif
-
 #if HAVE_SYSCONF && defined(_SC_GETPW_R_SIZE_MAX)
 #include <limits.h> // for INT_MAX
 #endif