Bug 1326496 - testing:mozbase: Use find_library to get libc filename. r=ahal
On architectures like alpha and ia64, the glibc does not use the
canonical ABI version number 6 but 6.1 and therefore the filename
of the C library is not libc.so.6 but libc.so.6.1. We're therefore
making the Python code more flexible and use find_library from
ctypes.util to determine the filename from the environment instead
of hard-coding it.
--- a/testing/mozbase/mozinfo/mozinfo/mozinfo.py
+++ b/testing/mozbase/mozinfo/mozinfo/mozinfo.py
@@ -10,17 +10,17 @@
from __future__ import absolute_import
import os
import platform
import re
import sys
from .string_version import StringVersion
-
+from ctypes.util import find_library
# keep a copy of the os module since updating globals overrides this
_os = os
class unknown(object):
"""marker class for unknown information"""
@@ -145,17 +145,17 @@ info.update({'processor': processor,
'bits': int(bits),
})
if info['os'] == 'linux':
import ctypes
import errno
PR_SET_SECCOMP = 22
SECCOMP_MODE_FILTER = 2
- ctypes.CDLL("libc.so.6", use_errno=True).prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0)
+ ctypes.CDLL(find_library("c"), use_errno=True).prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0)
info['has_sandbox'] = ctypes.get_errno() == errno.EFAULT
else:
info['has_sandbox'] = True
# standard value of choices, for easy inspection
choices = {'os': ['linux', 'bsd', 'win', 'mac', 'unix'],
'bits': [32, 64],
'processor': ['x86', 'x86_64', 'ppc']}