Assorted fixes for AIX and i (#6934)
commiteef0801f3e3fbeb6b43129ac00a28c15690d7816
authorCalvin <calvin@cmpct.info>
Tue, 20 Feb 2018 20:38:22 +0000 (20 16:38 -0400)
committerLudovic Henry <luhenry@microsoft.com>
Tue, 20 Feb 2018 20:38:22 +0000 (20 15:38 -0500)
treeebbdfacd94cd9f8e09f0311b81e41bb96b6e4a9c
parent38989b012ffe55254dff6c914bedc941cfe69420
Assorted fixes for AIX and i (#6934)

* Assorted fixes for AIX and i

* Fix a bug I introduced when changing the MonoArray vector
  type; array lengths wouldn't match up to what they
  actually were on AIX/i.

* Use a custom mkdtemp implementation on Unices without
  mkdtemp - and ones that do but don't necessarily have it,
  like i 7.1, which lacks mkdtemp in its libc. We can't
  determine this at runtime, so AIX will have to suffer
  with i.

* Enhance PowerPC hwcap on AIX to detect features like
  Linux does.

* Don't use clock_getres on AIX, because i 7.1 doesn't have
  that syscall - it's in libc, but it'll bomb out with a
  SIGILL; the way unimplemented opcodes are handled on i.

* Don't use PROT_NONE for hazard pointer alloc when on AIX

AIX and i 7.2 are OK with doing this, but i 7.1 is not and will
SIGSEGV because we violate access privleges; not even mprotect will
change this. As such, change to r/w protection for AIX/i.

* Fix Environment.OSVersion on AIX/i

Before, it would report "Unix 1.0.0.0" due to the fact AIX only
puts the minor version number where other Unices would put the
whole version in uname. Set up an ifdef for AIX and deal with this
semantic difference with a sprintf.

* Disable mffgpr on AIX

Reports of it not working on i 7.1 on POWER7; tester reports
disabling this in hwcap makes it run. This requires further
investigation.

* Fix threadpool errno delivering bogus values with _THREAD_SAFE

We didn't set this, and we need it so that errno is thread-local on
AIX/i. Oops!

* Make suggested changed to AIX branch

* use sizeof (utsname) for sanity's sake

* use a variable for hazard table protection

* match defines for CPPFLAGS -> libmono_cflags
configure.ac
mono/eglib/gfile-unix.c
mono/metadata/environment.c
mono/metadata/object-internals.h
mono/utils/hazard-pointer.c
mono/utils/mono-hwcap-ppc.c
mono/utils/mono-time.c