<filename>platform_bionic-android-vts-12.0_r2/libc/kernel/tools/defaults.py
# this module contains all the defaults used by the generation of cleaned-up headers
# for the Bionic C library
#

import time, os, sys
from utils import *

# the list of supported architectures
kernel_archs = [ 'arm', 'arm64', 'x86' ]

# the list of include directories that belong to the kernel
# tree. used when looking for sources...
kernel_dirs = [ "linux", "asm", "asm-generic", "mtd" ]

# a special value that is used to indicate that a given macro is known to be
# undefined during optimization
kCppUndefinedMacro = "<<<undefined>>>"

# this is the set of known macros we want to totally optimize out from the
# final headers
kernel_known_macros = {
    "__KERNEL__": kCppUndefinedMacro,
    "__KERNEL_STRICT_NAMES":"1",
    "__CHECKER__": kCppUndefinedMacro,
    "__CHECK_ENDIAN__": kCppUndefinedMacro,
    "CONFIG_64BIT": "__LP64__",
    "CONFIG_X86_32": "__i386__",
    "__EXPORTED_HEADERS__": "1",
    "__HAVE_BUILTIN_BSWAP16__": "1",
    "__HAVE_BUILTIN_BSWAP32__": "1",
    "__HAVE_BUILTIN_BSWAP64__": "1",
    # Use this to remove the struct __kernel_old_timeval definition.
    # Otherwise, there will be two struct timeval definitions when
    # __kernel_old_timeval is renamed to timeval.
    "__kernel_old_timeval": "1",
    }

# this is the set of known kernel data structures we want to remove from
# the final headers
kernel_structs_to_remove = set(
        [
          # Remove the structures since they are still the same as
          # timeval, itimerval.
          "__kernel_old_timeval",
          "__kernel_old_itimerval",
        ]
    )

# define to true if you want to remove all defined(CONFIG_FOO) tests
# from the clean headers. testing shows that this is not strictly necessary
# but just generates cleaner results
kernel_remove_config_macros = True

# maps an architecture to a set of default macros that would be provided by
# toolchain preprocessor
kernel_default_arch_macros = {
    "arm": {"__ARMEB__": kCppUndefinedMacro, "__ARM_EABI__": "1"},
    "arm64": {},
    "x86": {},
    }

kernel_arch_token_replacements = {
    "arm": {},
    "arm64": {},
    "x86": {},
    }

# Replace tokens in the output according to this mapping.
kernel_token_replacements = {
    # The kernel usage of __unused for unused struct fields conflicts with the macro defined in <sys/cdefs.h>.
    "__unused": "__linux_unused",
    # The kernel usage of C++ keywords causes problems for C++ code so rename.
    "private": "__linux_private",
    "virtual": "__linux_virtual",
    # The non-64 stuff is legacy; msqid64_ds/ipc64_perm is what userspace wants.
    "msqid_ds": "__kernel_legacy_msqid_ds",
    "semid_ds": "__kernel_legacy_semid_ds",
    "shmid_ds": "__kernel_legacy_shmid_ds",
    "ipc_perm": "__kernel_legacy_ipc_perm",
    # The kernel semun isn't usable (https://github.com/android-ndk/ndk/issues/400).
    "semun": "__kernel_legacy_semun",
    # The kernel's _NSIG/NSIG are one less than the userspace value, so we need to move them aside.
    "_NSIG": "_KERNEL__NSIG",
    "NSIG": "_KERNEL_NSIG",
    # The kernel's SIGRTMIN/SIGRTMAX are absolute limits; userspace steals a few.
    "SIGRTMIN": "__SIGRTMIN",
    "SIGRTMAX": "__SIGRTMAX",
    # We want to support both BSD and Linux member names in struct udphdr.
    "udphdr": "__kernel_udphdr",
    # This causes problems when trying to export the headers for the ndk.
    "__attribute_const__": "__attribute__((__const__))",
    # In this case the kernel tries to keep out of our way, but we're happy to use its definition.
    "__kernel_sockaddr_storage": "sockaddr_storage",
    # The kernel started using struct __kernel_old_timeval in some places,
    # which is the exact same as struct timeval. Replace that name with
    # timeval so that kernel structures all use the same named structure.
    # If struct __kernel_old_timeval and struct timeval become different,
    # then a different solution needs to be implemented.
    "__kernel_old_timeval": "timeval",
    # Do the same for __kernel_old_itimerval as for timeval.
    "__kernel_old_itimerval": "itimerval",
    }


# This is the set of struct definitions that we want to replace with
# a #include of <bits/struct.h> instead.
kernel_struct_replacements = set(
        [
          "epoll_event",
          "flock",
          "flock64",
          "in_addr",
          "ip_mreq_source",
          "ip_msfilter",
        ]
    )


# This is the set of known static inline functions that we want to keep
# in the final kernel headers.
kernel_known_generic_statics = set(
        [
          "ipt_get_target",  # uapi/linux/netfilter_ipv4/ip_tables.h
          "ip6t_get_target", # uapi/linux/netfilter_ipv6/ip6_tables.h
          # Byte swapping inlines from uapi/linux/swab.h
          # The below functions are the ones we are guaranting we export.
          "__swab16",
          "__swab32",
          "__swab64",
          "__swab16p",
          "__swab32p",
          "__swab64p",
          "__swab16s",
          "__swab32s",
          "__swab64s",
          "__swahw32",
          "__swahb32",
          "__swahw32p",
          "__swahb32p",
          "__swahw32s",
          "__swahb32s",
          # These are required to support the above functions.
          "__fswahw32",
          "__fswahb32",
        ]
    )

# this is the standard disclaimer
#
kernel_disclaimer = """\
/****************************************************************************
 ****************************************************************************
 ***
 ***   This header was automatically generated from a Linux kernel header
 ***   of the same name, to make information necessary for userspace to
 ***   call into the kernel available to libc.  It contains only constants,
 ***   structures, and macros generated from the original header, and thus,
 ***   contains no copyrightable information.
 ***
 ***   To edit the content of this header, modify the corresponding
 ***   source file (e.g. under external/kernel-headers/original/) then
 ***   run bionic/libc/kernel/tools/update_all.py
 ***
 ***   Any manual change here will be lost the next time this script will
 ***   be run. You've been warned!
 ***
 ****************************************************************************
 ****************************************************************************/
"""

<filename>platform_bionic-android-vts-12.0_r2/libc/kernel/tools/defaults.py
# this module contains all the defaults used by the generation of cleaned-up headers
# for the Bionic C library
#

import time, os, sys
from utils import *

# the list of supported architectures
kernel_archs = [ 'arm', 'arm64', 'x86' ]

# the list of include directories that belong to the kernel
# tree. used when looking for sources...
kernel_dirs = [ "linux", "asm", "asm-generic", "mtd" ]

# a special value that is used to indicate that a given macro is known to be
# undefined during optimization
kCppUndefinedMacro = "<<<undefined>>>"

# this is the set of known macros we want to totally optimize out from the
# final headers
kernel_known_macros = {
    "__KERNEL__": kCppUndefinedMacro,
    "__KERNEL_STRICT_NAMES":"1",
    "__CHECKER__": kCppUndefinedMacro,
    "__CHECK_ENDIAN__": kCppUndefinedMacro,
    "CONFIG_64BIT": "__LP64__",
    "CONFIG_X86_32": "__i386__",
    "__EXPORTED_HEADERS__": "1",
    "__HAVE_BUILTIN_BSWAP16__": "1",
    "__HAVE_BUILTIN_BSWAP32__": "1",
    "__HAVE_BUILTIN_BSWAP64__": "1",
    # Use this to remove the struct __kernel_old_timeval definition.
    # Otherwise, there will be two struct timeval definitions when
    # __kernel_old_timeval is renamed to timeval.
    "__kernel_old_timeval": "1",
    }

# this is the set of known kernel data structures we want to remove from
# the final headers
kernel_structs_to_remove = set(
        [
          # Remove the structures since they are still the same as
          # timeval, itimerval.
          "__kernel_old_timeval",
          "__kernel_old_itimerval",
        ]
    )

# define to true if you want to remove all defined(CONFIG_FOO) tests
# from the clean headers. testing shows that this is not strictly necessary
# but just generates cleaner results
kernel_remove_config_macros = True

# maps an architecture to a set of default macros that would be provided by
# toolchain preprocessor
kernel_default_arch_macros = {
    "arm": {"__ARMEB__": kCppUndefinedMacro, "__ARM_EABI__": "1"},
    "arm64": {},
    "x86": {},
    }

kernel_arch_token_replacements = {
    "arm": {},
    "arm64": {},
    "x86": {},
    }

# Replace tokens in the output according to this mapping.
kernel_token_replacements = {
    # The kernel usage of __unused for unused struct fields conflicts with the macro defined in <sys/cdefs.h>.
    "__unused": "__linux_unused",
    # The kernel usage of C++ keywords causes problems for C++ code so rename.
    "private": "__linux_private",
    "virtual": "__linux_virtual",
    # The non-64 stuff is legacy; msqid64_ds/ipc64_perm is what userspace wants.
    "msqid_ds": "__kernel_legacy_msqid_ds",
    "semid_ds": "__kernel_legacy_semid_ds",
    "shmid_ds": "__kernel_legacy_shmid_ds",
    "ipc_perm": "__kernel_legacy_ipc_perm",
    # The kernel semun isn't usable (https://github.com/android-ndk/ndk/issues/400).
    "semun": "__kernel_legacy_semun",
    # The kernel's _NSIG/NSIG are one less than the userspace value, so we need to move them aside.
    "_NSIG": "_KERNEL__NSIG",
    "NSIG": "_KERNEL_NSIG",
    # The kernel's SIGRTMIN/SIGRTMAX are absolute limits; userspace steals a few.
    "SIGRTMIN": "__SIGRTMIN",
    "SIGRTMAX": "__SIGRTMAX",
    # We want to support both BSD and Linux member names in struct udphdr.
    "udphdr": "__kernel_udphdr",
    # This causes problems when trying to export the headers for the ndk.
    "__attribute_const__": "__attribute__((__const__))",
    # In this case the kernel tries to keep out of our way, but we're happy to use its definition.
    "__kernel_sockaddr_storage": "sockaddr_storage",
    # The kernel started using struct __kernel_old_timeval in some places,
    # which is the exact same as struct timeval. Replace that name with
    # timeval so that kernel structures all use the same named structure.
    # If struct __kernel_old_timeval and struct timeval become different,
    # then a different solution needs to be implemented.
    "__kernel_old_timeval": "timeval",
    # Do the same for __kernel_old_itimerval as for timeval.
    "__kernel_old_itimerval": "itimerval",
    }


# This is the set of struct definitions that we want to replace with
# a #include of <bits/struct.h> instead.
kernel_struct_replacements = set(
        [
          "epoll_event",
          "flock",
          "flock64",
          "in_addr",
          "ip_mreq_source",
          "ip_msfilter",
        ]
    )


# This is the set of known static inline functions that we want to keep
# in the final kernel headers.
kernel_known_generic_statics = set(
        [
          "ipt_get_target",  # uapi/linux/netfilter_ipv4/ip_tables.h
          "ip6t_get_target", # uapi/linux/netfilter_ipv6/ip6_tables.h
          # Byte swapping inlines from uapi/linux/swab.h
          # The below functions are the ones we are guaranting we export.
          "__swab16",
          "__swab32",
          "__swab64",
          "__swab16p",
          "__swab32p",
          "__swab64p",
          "__swab16s",
          "__swab32s",
          "__swab64s",
          "__swahw32",
          "__swahb32",
          "__swahw32p",
          "__swahb32p",
          "__swahw32s",
          "__swahb32s",
          # These are required to support the above functions.
          "__fswahw32",
          "__fswahb32",
        ]
    )

# this is the standard disclaimer
#
kernel_disclaimer = """\
/****************************************************************************
 ****************************************************************************
 ***
 ***   This header was automatically generated from a Linux kernel header
 ***   of the same name, to make information necessary for userspace to
 ***   call into the kernel available to libc.  It contains only constants,
 ***   structures, and macros generated from the original header, and thus,
 ***   contains no copyrightable information.
 ***
 ***   To edit the content of this header, modify the corresponding
 ***   source file (e.g. under external/kernel-headers/original/) then
 ***   run bionic/libc/kernel/tools/update_all.py
 ***
 ***   Any manual change here will be lost the next time this script will
 ***   be run. You've been warned!
 ***
 ****************************************************************************
 ****************************************************************************/
"""

# this module contains all the defaults used by the generation of cleaned-up headers # for the Bionic C library # # the list of supported architectures # the list of include directories that belong to the kernel # tree. used when looking for sources... # a special value that is used to indicate that a given macro is known to be # undefined during optimization # this is the set of known macros we want to totally optimize out from the # final headers # Use this to remove the struct __kernel_old_timeval definition. # Otherwise, there will be two struct timeval definitions when # __kernel_old_timeval is renamed to timeval. # this is the set of known kernel data structures we want to remove from # the final headers # Remove the structures since they are still the same as # timeval, itimerval. # define to true if you want to remove all defined(CONFIG_FOO) tests # from the clean headers. testing shows that this is not strictly necessary # but just generates cleaner results # maps an architecture to a set of default macros that would be provided by # toolchain preprocessor # Replace tokens in the output according to this mapping. # The kernel usage of __unused for unused struct fields conflicts with the macro defined in <sys/cdefs.h>. # The kernel usage of C++ keywords causes problems for C++ code so rename. # The non-64 stuff is legacy; msqid64_ds/ipc64_perm is what userspace wants. # The kernel semun isn't usable (https://github.com/android-ndk/ndk/issues/400). # The kernel's _NSIG/NSIG are one less than the userspace value, so we need to move them aside. # The kernel's SIGRTMIN/SIGRTMAX are absolute limits; userspace steals a few. # We want to support both BSD and Linux member names in struct udphdr. # This causes problems when trying to export the headers for the ndk. # In this case the kernel tries to keep out of our way, but we're happy to use its definition. # The kernel started using struct __kernel_old_timeval in some places, # which is the exact same as struct timeval. Replace that name with # timeval so that kernel structures all use the same named structure. # If struct __kernel_old_timeval and struct timeval become different, # then a different solution needs to be implemented. # Do the same for __kernel_old_itimerval as for timeval. # This is the set of struct definitions that we want to replace with # a #include of <bits/struct.h> instead. # This is the set of known static inline functions that we want to keep # in the final kernel headers. # uapi/linux/netfilter_ipv4/ip_tables.h # uapi/linux/netfilter_ipv6/ip6_tables.h # Byte swapping inlines from uapi/linux/swab.h # The below functions are the ones we are guaranting we export. # These are required to support the above functions. # this is the standard disclaimer # \ /****************************************************************************  ****************************************************************************  ***  ***   This header was automatically generated from a Linux kernel header  ***   of the same name, to make information necessary for userspace to  ***   call into the kernel available to libc.  It contains only constants,  ***   structures, and macros generated from the original header, and thus,  ***   contains no copyrightable information.  ***  ***   To edit the content of this header, modify the corresponding  ***   source file (e.g. under external/kernel-headers/original/) then  ***   run bionic/libc/kernel/tools/update_all.py  ***  ***   Any manual change here will be lost the next time this script will  ***   be run. You've been warned!  ***  ****************************************************************************  ****************************************************************************/