Invalid argument(s) in call: absolute(0)

解决ResultSet.absolute(0)错误
本文介绍了解决使用ojdbc6包时遇到的ResultSet.absolute(0)导致的Invalidargument(s)incall:absolute(0)错误的方法。通过升级到ojdbc7最新版本,如12.1.0.2,可以有效避免此问题。
Invalid argument(s) in call: absolute(0)
使用ojdbc6的包,当使用jdbc做分页查询时,ResultSet.absolute(0)会抛这个错误:Invalid argument(s) in call: absolute(0)。更换最新的ojdbc包即可,例如;
<dependency>
<groupId>com.github.noraui</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
#!/usr/bin/env python3 # Copyright (C) 2017 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import atexit import hashlib import os import shutil import signal import subprocess import sys import tempfile import time import uuid import platform TRACE_TO_TEXT_SHAS = { 'linux': '7e3e10dfb324e31723efd63ac25037856e06eba0', 'mac': '21f0f42dd019b4f09addd404a114fbf2322ca8a4', } TRACE_TO_TEXT_PATH = tempfile.gettempdir() TRACE_TO_TEXT_BASE_URL = ('https://storage.googleapis.com/perfetto/') NULL = open(os.devnull) NOOUT = { 'stdout': NULL, 'stderr': NULL, } UUID = str(uuid.uuid4())[-6:] def check_hash(file_name, sha_value): file_hash = hashlib.sha1() with open(file_name, 'rb') as fd: while True: chunk = fd.read(4096) if not chunk: break file_hash.update(chunk) return file_hash.hexdigest() == sha_value def load_trace_to_text(os_name): sha_value = TRACE_TO_TEXT_SHAS[os_name] file_name = 'trace_to_text-' + os_name + '-' + sha_value local_file = os.path.join(TRACE_TO_TEXT_PATH, file_name) if os.path.exists(local_file): if not check_hash(local_file, sha_value): os.remove(local_file) else: return local_file url = TRACE_TO_TEXT_BASE_URL + file_name subprocess.check_call(['curl', '-L', '-#', '-o', local_file, url]) if not check_hash(local_file, sha_value): os.remove(local_file) raise ValueError("Invalid signature.") os.chmod(local_file, 0o755) return local_file PACKAGES_LIST_CFG = '''data_sources { config { name: "android.packages_list" } } ''' CFG_INDENT = ' ' CFG = '''buffers {{ size_kb: 63488 }} data_sources {{ config {{ name: "android.heapprofd" heapprofd_config {{ shmem_size_bytes: {shmem_size} sampling_interval_bytes: {interval} {target_cfg} }} }} }} duration_ms: {duration} write_into_file: true flush_timeout_ms: 30000 flush_period_ms: 604800000 ''' # flush_period_ms of 1 week to suppress trace_processor_shell warning. CONTINUOUS_DUMP = """ continuous_dump_config {{ dump_phase_ms: 0 dump_interval_ms: {dump_interval} }} """ PROFILE_LOCAL_PATH = os.path.join(tempfile.gettempdir(), UUID) IS_INTERRUPTED = False def sigint_handler(sig, frame): global IS_INTERRUPTED IS_INTERRUPTED = True def print_no_profile_error(): print("No profiles generated", file=sys.stderr) print( "If this is unexpected, check " "https://perfetto.dev/docs/data-sources/native-heap-profiler#troubleshooting.", file=sys.stderr) def known_issues_url(number): return ('https://perfetto.dev/docs/data-sources/native-heap-profiler' '#known-issues-android{}'.format(number)) KNOWN_ISSUES = { '10': known_issues_url(10), 'Q': known_issues_url(10), '11': known_issues_url(11), 'R': known_issues_url(11), } def maybe_known_issues(): release_or_codename = subprocess.check_output( ['adb', 'shell', 'getprop', 'ro.build.version.release_or_codename'] ).decode('utf-8').strip() return KNOWN_ISSUES.get(release_or_codename, None) SDK = { 'R': 30, } def release_or_newer(release): sdk = int(subprocess.check_output( ['adb', 'shell', 'getprop', 'ro.system.build.version.sdk'] ).decode('utf-8').strip()) if sdk >= SDK[release]: return True codename = subprocess.check_output( ['adb', 'shell', 'getprop', 'ro.build.version.codename'] ).decode('utf-8').strip() return codename == release def main(argv): parser = argparse.ArgumentParser() parser.add_argument( "-i", "--interval", help="Sampling interval. " "Default 4096 (4KiB)", type=int, default=4096) parser.add_argument( "-d", "--duration", help="Duration of profile (ms). 0 to run until interrupted. " "Default: until interrupted by user.", type=int, default=0) # This flag is a no-op now. We never start heapprofd explicitly using system # properties. parser.add_argument( "--no-start", help="Do not start heapprofd.", action='store_true') parser.add_argument( "-p", "--pid", help="Comma-separated list of PIDs to " "profile.", metavar="PIDS") parser.add_argument( "-n", "--name", help="Comma-separated list of process " "names to profile.", metavar="NAMES") parser.add_argument( "-f", "--functions", help="Comma-separated list of functions " "names to profile.", metavar="FUNCTIONS") parser.add_argument( "-c", "--continuous-dump", help="Dump interval in ms. 0 to disable continuous dump.", type=int, default=0) parser.add_argument( "--heaps", help="Comma-separated list of heaps to collect, e.g: malloc,art. " "Requires Android 12.", metavar="HEAPS") parser.add_argument( "--all-heaps", action="store_true", help="Collect allocations from all heaps registered by target." ) parser.add_argument( "--no-android-tree-symbolization", action="store_true", help="Do not symbolize using currently lunched target in the " "Android tree." ) parser.add_argument( "--disable-selinux", action="store_true", help="Disable SELinux enforcement for duration of " "profile.") parser.add_argument( "--no-versions", action="store_true", help="Do not get version information about APKs.") parser.add_argument( "--no-running", action="store_true", help="Do not target already running processes. Requires Android 11.") parser.add_argument( "--no-startup", action="store_true", help="Do not target processes that start during " "the profile. Requires Android 11.") parser.add_argument( "--shmem-size", help="Size of buffer between client and " "heapprofd. Default 8MiB. Needs to be a power of two " "multiple of 4096, at least 8192.", type=int, default=8 * 1048576) parser.add_argument( "--block-client", help="When buffer is full, block the " "client to wait for buffer space. Use with caution as " "this can significantly slow down the client. " "This is the default", action="store_true") parser.add_argument( "--block-client-timeout", help="If --block-client is given, do not block any allocation for " "longer than this timeout (us).", type=int) parser.add_argument( "--no-block-client", help="When buffer is full, stop the " "profile early.", action="store_true") parser.add_argument( "--idle-allocations", help="Keep track of how many " "bytes were unused since the last dump, per " "callstack", action="store_true") parser.add_argument( "--dump-at-max", help="Dump the maximum memory usage " "rather than at the time of the dump.", action="store_true") parser.add_argument( "--disable-fork-teardown", help="Do not tear down client in forks. This can be useful for programs " "that use vfork. Android 11+ only.", action="store_true") parser.add_argument( "--simpleperf", action="store_true", help="Get simpleperf profile of heapprofd. This is " "only for heapprofd development.") parser.add_argument( "--trace-to-text-binary", help="Path to local trace to text. For debugging.") parser.add_argument( "--print-config", action="store_true", help="Print config instead of running. For debugging.") parser.add_argument( "-o", "--output", help="Output directory.", metavar="DIRECTORY", default=None) args = parser.parse_args() fail = False if args.block_client and args.no_block_client: print( "FATAL: Both block-client and no-block-client given.", file=sys.stderr) fail = True if args.pid is None and args.name is None: print("FATAL: Neither PID nor NAME given.", file=sys.stderr) fail = True if args.duration is None: print("FATAL: No duration given.", file=sys.stderr) fail = True if args.interval is None: print("FATAL: No interval given.", file=sys.stderr) fail = True if args.shmem_size % 4096: print("FATAL: shmem-size is not a multiple of 4096.", file=sys.stderr) fail = True if args.shmem_size < 8192: print("FATAL: shmem-size is less than 8192.", file=sys.stderr) fail = True if args.shmem_size & (args.shmem_size - 1): print("FATAL: shmem-size is not a power of two.", file=sys.stderr) fail = True target_cfg = "" if not args.no_block_client: target_cfg += CFG_INDENT + "block_client: true\n" if args.block_client_timeout: target_cfg += ( CFG_INDENT + "block_client_timeout_us: %s\n" % args.block_client_timeout ) if args.no_startup: target_cfg += CFG_INDENT + "no_startup: true\n" if args.no_running: target_cfg += CFG_INDENT + "no_running: true\n" if args.dump_at_max: target_cfg += CFG_INDENT + "dump_at_max: true\n" if args.disable_fork_teardown: target_cfg += CFG_INDENT + "disable_fork_teardown: true\n" if args.all_heaps: target_cfg += CFG_INDENT + "all_heaps: true\n" if args.pid: for pid in args.pid.split(','): try: pid = int(pid) except ValueError: print("FATAL: invalid PID %s" % pid, file=sys.stderr) fail = True target_cfg += CFG_INDENT + 'pid: {}\n'.format(pid) if args.name: for name in args.name.split(','): target_cfg += CFG_INDENT + 'process_cmdline: "{}"\n'.format(name) if args.heaps: for heap in args.heaps.split(','): target_cfg += CFG_INDENT + 'heaps: "{}"\n'.format(heap) if args.functions: for functions in args.functions.split(','): target_cfg += CFG_INDENT + 'function_names: "{}"\n'.format(functions) if fail: parser.print_help() return 1 trace_to_text_binary = args.trace_to_text_binary if args.continuous_dump: target_cfg += CONTINUOUS_DUMP.format(dump_interval=args.continuous_dump) cfg = CFG.format( interval=args.interval, duration=args.duration, target_cfg=target_cfg, shmem_size=args.shmem_size) if not args.no_versions: cfg += PACKAGES_LIST_CFG if args.print_config: print(cfg) return 0 # Do this AFTER print_config so we do not download trace_to_text only to # print out the config. has_trace_to_text = True if trace_to_text_binary is None: os_name = None if sys.platform.startswith('linux'): os_name = 'linux' elif sys.platform.startswith('darwin'): os_name = 'mac' elif sys.platform.startswith('win32'): has_trace_to_text = False else: print("Invalid platform: {}".format(sys.platform), file=sys.stderr) return 1 arch = platform.machine() if arch not in ['x86_64', 'amd64']: has_trace_to_text = False if has_trace_to_text: trace_to_text_binary = load_trace_to_text(os_name) known_issues = maybe_known_issues() if known_issues: print('If you are experiencing problems, please see the known issues for ' 'your release: {}.'.format(known_issues)) # TODO(fmayer): Maybe feature detect whether we can remove traces instead of # this. uuid_trace = release_or_newer('R') if uuid_trace: profile_device_path = '/data/misc/perfetto-traces/profile-' + UUID else: user = subprocess.check_output( ['adb', 'shell', 'whoami']).decode('utf-8').strip() profile_device_path = '/data/misc/perfetto-traces/profile-' + user perfetto_cmd = ('CFG=\'{cfg}\'; echo ${{CFG}} | ' 'perfetto --txt -c - -o ' + profile_device_path + ' -d') if args.disable_selinux: enforcing = subprocess.check_output(['adb', 'shell', 'getenforce']) atexit.register( subprocess.check_call, ['adb', 'shell', 'su root setenforce %s' % enforcing]) subprocess.check_call(['adb', 'shell', 'su root setenforce 0']) if args.simpleperf: subprocess.check_call([ 'adb', 'shell', 'mkdir -p /data/local/tmp/heapprofd_profile && ' 'cd /data/local/tmp/heapprofd_profile &&' '(nohup simpleperf record -g -p $(pidof heapprofd) 2>&1 &) ' '> /dev/null' ]) profile_target = PROFILE_LOCAL_PATH if args.output is not None: profile_target = args.output else: os.mkdir(profile_target) if not os.path.isdir(profile_target): print("Output directory {} not found".format(profile_target), file=sys.stderr) return 1 if os.listdir(profile_target): print("Output directory {} not empty".format(profile_target), file=sys.stderr) return 1 perfetto_pid = subprocess.check_output( ['adb', 'exec-out', perfetto_cmd.format(cfg=cfg)]).strip() try: perfetto_pid = int(perfetto_pid.strip()) except ValueError: print("Failed to invoke perfetto: {}".format(perfetto_pid), file=sys.stderr) return 1 old_handler = signal.signal(signal.SIGINT, sigint_handler) print("Profiling active. Press Ctrl+C to terminate.") print("You may disconnect your device.") print() exists = True device_connected = True while not device_connected or (exists and not IS_INTERRUPTED): exists = subprocess.call( ['adb', 'shell', '[ -d /proc/{} ]'.format(perfetto_pid)], **NOOUT) == 0 device_connected = subprocess.call(['adb', 'shell', 'true'], **NOOUT) == 0 time.sleep(1) print("Waiting for profiler shutdown...") signal.signal(signal.SIGINT, old_handler) if IS_INTERRUPTED: # Not check_call because it could have existed in the meantime. subprocess.call(['adb', 'shell', 'kill', '-INT', str(perfetto_pid)]) if args.simpleperf: subprocess.check_call(['adb', 'shell', 'killall', '-INT', 'simpleperf']) print("Waiting for simpleperf to exit.") while subprocess.call( ['adb', 'shell', '[ -f /proc/$(pidof simpleperf)/exe ]'], **NOOUT) == 0: time.sleep(1) subprocess.check_call( ['adb', 'pull', '/data/local/tmp/heapprofd_profile', profile_target]) print( "Pulled simpleperf profile to " + profile_target + "/heapprofd_profile") # Wait for perfetto cmd to return. while exists: exists = subprocess.call( ['adb', 'shell', '[ -d /proc/{} ]'.format(perfetto_pid)]) == 0 time.sleep(1) profile_host_path = os.path.join(profile_target, 'raw-trace') subprocess.check_call( ['adb', 'pull', profile_device_path, profile_host_path], stdout=NULL) if uuid_trace: subprocess.check_call( ['adb', 'shell', 'rm', profile_device_path], stdout=NULL) if not has_trace_to_text: print('Wrote profile to {}'.format(profile_host_path)) print('This file can be opened using the Perfetto UI, https://ui.perfetto.dev') return 0 binary_path = os.getenv('PERFETTO_BINARY_PATH') if not args.no_android_tree_symbolization: product_out = os.getenv('ANDROID_PRODUCT_OUT') if product_out: product_out_symbols = product_out + '/symbols' else: product_out_symbols = None if binary_path is None: binary_path = product_out_symbols elif product_out_symbols is not None: binary_path += ":" + product_out_symbols trace_file = os.path.join(profile_target, 'raw-trace') concat_files = [trace_file] if binary_path is not None: with open(os.path.join(profile_target, 'symbols'), 'w') as fd: ret = subprocess.call([ trace_to_text_binary, 'symbolize', os.path.join(profile_target, 'raw-trace')], env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), stdout=fd) if ret == 0: concat_files.append(os.path.join(profile_target, 'symbols')) else: print("Failed to symbolize. Continuing without symbols.", file=sys.stderr) proguard_map = os.getenv('PERFETTO_PROGUARD_MAP') if proguard_map is not None: with open(os.path.join(profile_target, 'deobfuscation-packets'), 'w') as fd: ret = subprocess.call([ trace_to_text_binary, 'deobfuscate', os.path.join(profile_target, 'raw-trace')], env=dict(os.environ, PERFETTO_PROGUARD_MAP=proguard_map), stdout=fd) if ret == 0: concat_files.append( os.path.join(profile_target, 'deobfuscation-packets')) else: print("Failed to deobfuscate. Continuing without deobfuscated.", file=sys.stderr) if len(concat_files) > 1: with open(os.path.join(profile_target, 'symbolized-trace'), 'wb') as out: for fn in concat_files: with open(fn, 'rb') as inp: while True: buf = inp.read(4096) if not buf: break out.write(buf) trace_file = os.path.join(profile_target, 'symbolized-trace') trace_to_text_output = subprocess.check_output( [trace_to_text_binary, 'profile', trace_file]) profile_path = None print('caifc trace_file ' + str(trace_file)) print('caifc trace_to_text_output ' + str(trace_to_text_output)) for word in trace_to_text_output.decode('utf-8').split(): if 'heap_profile-' in word: profile_path = word if profile_path is None: print_no_profile_error() return 1 profile_files = os.listdir(profile_path) if not profile_files: print_no_profile_error() return 1 for profile_file in profile_files: shutil.copy(os.path.join(profile_path, profile_file), profile_target) subprocess.check_call( ['gzip'] + [os.path.join(profile_target, x) for x in profile_files]) symlink_path = None if args.output is None: symlink_path = os.path.join( os.path.dirname(profile_target), "heap_profile-latest") if os.path.lexists(symlink_path): os.unlink(symlink_path) os.symlink(profile_target, symlink_path) if symlink_path is not None: print("Wrote profiles to {} (symlink {})".format( profile_target, symlink_path)) else: print("Wrote profiles to {}".format(profile_target)) print("These can be viewed using pprof. Googlers: head to pprof/ and " "upload them.") if __name__ == '__main__': sys.exit(main(sys.argv))
09-10
/* stdlib.h: ANSI draft (X3J11 May 88) library header, section 4.10 */ /* Copyright (C) Codemist Ltd., 1988-1993. */ /* Copyright 1991-1998,2014 ARM Limited. All rights reserved. */ /* * RCS $Revision$ * Checkin $Date$ * Revising $Author: agrant $ */ /* * stdlib.h declares four types, several general purpose functions, * and defines several macros. */ #ifndef __stdlib_h #define __stdlib_h #define __ARMCLIB_VERSION 5060034 #if defined(__clang__) || (defined(__ARMCC_VERSION) && !defined(__STRICT_ANSI__)) /* armclang and non-strict armcc allow 'long long' in system headers */ #define __LONGLONG long long #else /* strict armcc has '__int64' */ #define __LONGLONG __int64 #endif #define _ARMABI __declspec(__nothrow) #define _ARMABI_PURE __declspec(__nothrow) __attribute__((const)) #define _ARMABI_NORETURN __declspec(__nothrow) __declspec(__noreturn) #define _ARMABI_THROW #ifndef __STDLIB_DECLS #define __STDLIB_DECLS /* * Some of these declarations are new in C99. To access them in C++ * you can use -D__USE_C99_STDLIB (or -D__USE_C99ALL). */ #ifndef __USE_C99_STDLIB #if defined(__USE_C99_ALL) || (defined(__STDC_VERSION__) && 199901L <= __STDC_VERSION__) || (defined(__cplusplus) && 201103L <= __cplusplus) #define __USE_C99_STDLIB 1 #endif #endif #undef __CLIBNS #ifdef __cplusplus namespace std { #define __CLIBNS ::std:: extern "C" { #else #define __CLIBNS #endif /* __cplusplus */ #if defined(__cplusplus) || !defined(__STRICT_ANSI__) /* unconditional in C++ and non-strict C for consistency of debug info */ #if __sizeof_ptr == 8 typedef unsigned long size_t; /* see <stddef.h> */ #else typedef unsigned int size_t; /* see <stddef.h> */ #endif #elif !defined(__size_t) #define __size_t 1 #if __sizeof_ptr == 8 typedef unsigned long size_t; /* see <stddef.h> */ #else typedef unsigned int size_t; /* see <stddef.h> */ #endif #endif #undef NULL #define NULL 0 /* see <stddef.h> */ #ifndef __cplusplus /* wchar_t is a builtin type for C++ */ #if !defined(__STRICT_ANSI__) /* unconditional in non-strict C for consistency of debug info */ #if defined(__WCHAR32) || (defined(__ARM_SIZEOF_WCHAR_T) && __ARM_SIZEOF_WCHAR_T == 4) typedef unsigned int wchar_t; /* see <stddef.h> */ #else typedef unsigned short wchar_t; /* see <stddef.h> */ #endif #elif !defined(__wchar_t) #define __wchar_t 1 #if defined(__WCHAR32) || (defined(__ARM_SIZEOF_WCHAR_T) && __ARM_SIZEOF_WCHAR_T == 4) typedef unsigned int wchar_t; /* see <stddef.h> */ #else typedef unsigned short wchar_t; /* see <stddef.h> */ #endif #endif #endif typedef struct div_t { int quot, rem; } div_t; /* type of the value returned by the div function. */ typedef struct ldiv_t { long int quot, rem; } ldiv_t; /* type of the value returned by the ldiv function. */ #if !defined(__STRICT_ANSI__) || __USE_C99_STDLIB typedef struct lldiv_t { __LONGLONG quot, rem; } lldiv_t; /* type of the value returned by the lldiv function. */ #endif #ifdef __EXIT_FAILURE # define EXIT_FAILURE __EXIT_FAILURE /* * an integral expression which may be used as an argument to the exit * function to return unsuccessful termination status to the host * environment. */ #else # define EXIT_FAILURE 1 /* unixoid */ #endif #define EXIT_SUCCESS 0 /* * an integral expression which may be used as an argument to the exit * function to return successful termination status to the host * environment. */ /* * Defining __USE_ANSI_EXAMPLE_RAND at compile time switches to * the example implementation of rand() and srand() provided in * the ANSI C standard. This implementation is very poor, but is * provided for completeness. */ #ifdef __USE_ANSI_EXAMPLE_RAND #define srand _ANSI_srand #define rand _ANSI_rand #define RAND_MAX 0x7fff #else #define RAND_MAX 0x7fffffff #endif /* * RAND_MAX: an integral constant expression, the value of which * is the maximum value returned by the rand function. */ extern _ARMABI int __aeabi_MB_CUR_MAX(void); #define MB_CUR_MAX ( __aeabi_MB_CUR_MAX() ) /* * a positive integer expression whose value is the maximum number of bytes * in a multibyte character for the extended character set specified by the * current locale (category LC_CTYPE), and whose value is never greater * than MB_LEN_MAX. */ /* * If the compiler supports signalling nans as per N965 then it * will define __SUPPORT_SNAN__, in which case a user may define * _WANT_SNAN in order to obtain a compliant version of the strtod * family of functions. */ #if defined(__SUPPORT_SNAN__) && defined(_WANT_SNAN) #pragma import(__use_snan) #endif extern _ARMABI double atof(const char * /*nptr*/) __attribute__((__nonnull__(1))); /* * converts the initial part of the string pointed to by nptr to double * representation. * Returns: the converted value. */ extern _ARMABI int atoi(const char * /*nptr*/) __attribute__((__nonnull__(1))); /* * converts the initial part of the string pointed to by nptr to int * representation. * Returns: the converted value. */ extern _ARMABI long int atol(const char * /*nptr*/) __attribute__((__nonnull__(1))); /* * converts the initial part of the string pointed to by nptr to long int * representation. * Returns: the converted value. */ #if !defined(__STRICT_ANSI__) || __USE_C99_STDLIB extern _ARMABI __LONGLONG atoll(const char * /*nptr*/) __attribute__((__nonnull__(1))); /* * converts the initial part of the string pointed to by nptr to * long long int representation. * Returns: the converted value. */ #endif extern _ARMABI double strtod(const char * __restrict /*nptr*/, char ** __restrict /*endptr*/) __attribute__((__nonnull__(1))); /* * converts the initial part of the string pointed to by nptr to double * representation. First it decomposes the input string into three parts: * an initial, possibly empty, sequence of white-space characters (as * specified by the isspace function), a subject sequence resembling a * floating point constant; and a final string of one or more unrecognised * characters, including the terminating null character of the input string. * Then it attempts to convert the subject sequence to a floating point * number, and returns the result. A pointer to the final string is stored * in the object pointed to by endptr, provided that endptr is not a null * pointer. * Returns: the converted value if any. If no conversion could be performed, * zero is returned. If the correct value is outside the range of * representable values, plus or minus HUGE_VAL is returned * (according to the sign of the value), and the value of the macro * ERANGE is stored in errno. If the correct value would cause * underflow, zero is returned and the value of the macro ERANGE is * stored in errno. */ #if !defined(__STRICT_ANSI__) || __USE_C99_STDLIB extern _ARMABI float strtof(const char * __restrict /*nptr*/, char ** __restrict /*endptr*/) __attribute__((__nonnull__(1))); extern _ARMABI long double strtold(const char * __restrict /*nptr*/, char ** __restrict /*endptr*/) __attribute__((__nonnull__(1))); /* * same as strtod, but return float and long double respectively. */ #endif extern _ARMABI long int strtol(const char * __restrict /*nptr*/, char ** __restrict /*endptr*/, int /*base*/) __attribute__((__nonnull__(1))); /* * converts the initial part of the string pointed to by nptr to long int * representation. First it decomposes the input string into three parts: * an initial, possibly empty, sequence of white-space characters (as * specified by the isspace function), a subject sequence resembling an * integer represented in some radix determined by the value of base, and a * final string of one or more unrecognised characters, including the * terminating null character of the input string. Then it attempts to * convert the subject sequence to an integer, and returns the result. * If the value of base is 0, the expected form of the subject sequence is * that of an integer constant (described in ANSI Draft, section 3.1.3.2), * optionally preceded by a '+' or '-' sign, but not including an integer * suffix. If the value of base is between 2 and 36, the expected form of * the subject sequence is a sequence of letters and digits representing an * integer with the radix specified by base, optionally preceded by a plus * or minus sign, but not including an integer suffix. The letters from a * (or A) through z (or Z) are ascribed the values 10 to 35; only letters * whose ascribed values are less than that of the base are permitted. If * the value of base is 16, the characters 0x or 0X may optionally precede * the sequence of letters and digits following the sign if present. * A pointer to the final string is stored in the object * pointed to by endptr, provided that endptr is not a null pointer. * Returns: the converted value if any. If no conversion could be performed, * zero is returned and nptr is stored in *endptr. * If the correct value is outside the range of * representable values, LONG_MAX or LONG_MIN is returned * (according to the sign of the value), and the value of the * macro ERANGE is stored in errno. */ extern _ARMABI unsigned long int strtoul(const char * __restrict /*nptr*/, char ** __restrict /*endptr*/, int /*base*/) __attribute__((__nonnull__(1))); /* * converts the initial part of the string pointed to by nptr to unsigned * long int representation. First it decomposes the input string into three * parts: an initial, possibly empty, sequence of white-space characters (as * determined by the isspace function), a subject sequence resembling an * unsigned integer represented in some radix determined by the value of * base, and a final string of one or more unrecognised characters, * including the terminating null character of the input string. Then it * attempts to convert the subject sequence to an unsigned integer, and * returns the result. If the value of base is zero, the expected form of * the subject sequence is that of an integer constant (described in ANSI * Draft, section 3.1.3.2), optionally preceded by a '+' or '-' sign, but * not including an integer suffix. If the value of base is between 2 and * 36, the expected form of the subject sequence is a sequence of letters * and digits representing an integer with the radix specified by base, * optionally preceded by a '+' or '-' sign, but not including an integer * suffix. The letters from a (or A) through z (or Z) stand for the values * 10 to 35; only letters whose ascribed values are less than that of the * base are permitted. If the value of base is 16, the characters 0x or 0X * may optionally precede the sequence of letters and digits following the * sign, if present. A pointer to the final string is stored in the object * pointed to by endptr, provided that endptr is not a null pointer. * Returns: the converted value if any. If no conversion could be performed, * zero is returned and nptr is stored in *endptr. * If the correct value is outside the range of * representable values, ULONG_MAX is returned, and the value of * the macro ERANGE is stored in errno. */ /* C90 reserves all names beginning with 'str' */ extern _ARMABI __LONGLONG strtoll(const char * __restrict /*nptr*/, char ** __restrict /*endptr*/, int /*base*/) __attribute__((__nonnull__(1))); /* * as strtol but returns a long long int value. If the correct value is * outside the range of representable values, LLONG_MAX or LLONG_MIN is * returned (according to the sign of the value), and the value of the * macro ERANGE is stored in errno. */ extern _ARMABI unsigned __LONGLONG strtoull(const char * __restrict /*nptr*/, char ** __restrict /*endptr*/, int /*base*/) __attribute__((__nonnull__(1))); /* * as strtoul but returns an unsigned long long int value. If the correct * value is outside the range of representable values, ULLONG_MAX is returned, * and the value of the macro ERANGE is stored in errno. */ extern _ARMABI int rand(void); /* * Computes a sequence of pseudo-random integers in the range 0 to RAND_MAX. * Uses an additive generator (Mitchell & Moore) of the form: * Xn = (X[n-24] + X[n-55]) MOD 2^31 * This is described in section 3.2.2 of Knuth, vol 2. It's period is * in excess of 2^55 and its randomness properties, though unproven, are * conjectured to be good. Empirical testing since 1958 has shown no flaws. * Returns: a pseudo-random integer. */ extern _ARMABI void srand(unsigned int /*seed*/); /* * uses its argument as a seed for a new sequence of pseudo-random numbers * to be returned by subsequent calls to rand. If srand is then called with * the same seed value, the sequence of pseudo-random numbers is repeated. * If rand is called before any calls to srand have been made, the same * sequence is generated as when srand is first called with a seed value * of 1. */ struct _rand_state { int __x[57]; }; extern _ARMABI int _rand_r(struct _rand_state *); extern _ARMABI void _srand_r(struct _rand_state *, unsigned int); struct _ANSI_rand_state { int __x[1]; }; extern _ARMABI int _ANSI_rand_r(struct _ANSI_rand_state *); extern _ARMABI void _ANSI_srand_r(struct _ANSI_rand_state *, unsigned int); /* * Re-entrant variants of both flavours of rand, which operate on * an explicitly supplied state buffer. */ extern _ARMABI void *calloc(size_t /*nmemb*/, size_t /*size*/); /* * allocates space for an array of nmemb objects, each of whose size is * 'size'. The space is initialised to all bits zero. * Returns: either a null pointer or a pointer to the allocated space. */ extern _ARMABI void free(void * /*ptr*/); /* * causes the space pointed to by ptr to be deallocated (i.e., made * available for further allocation). If ptr is a null pointer, no action * occurs. Otherwise, if ptr does not match a pointer earlier returned by * calloc, malloc or realloc or if the space has been deallocated by a call * to free or realloc, the behaviour is undefined. */ extern _ARMABI void *malloc(size_t /*size*/); /* * allocates space for an object whose size is specified by 'size' and whose * value is indeterminate. * Returns: either a null pointer or a pointer to the allocated space. */ extern _ARMABI void *realloc(void * /*ptr*/, size_t /*size*/); /* * changes the size of the object pointed to by ptr to the size specified by * size. The contents of the object shall be unchanged up to the lesser of * the new and old sizes. If the new size is larger, the value of the newly * allocated portion of the object is indeterminate. If ptr is a null * pointer, the realloc function behaves like a call to malloc for the * specified size. Otherwise, if ptr does not match a pointer earlier * returned by calloc, malloc or realloc, or if the space has been * deallocated by a call to free or realloc, the behaviour is undefined. * If the space cannot be allocated, the object pointed to by ptr is * unchanged. If size is zero and ptr is not a null pointer, the object it * points to is freed. * Returns: either a null pointer or a pointer to the possibly moved * allocated space. */ #if !defined(__STRICT_ANSI__) extern _ARMABI int posix_memalign(void ** /*ret*/, size_t /*alignment*/, size_t /*size*/); /* * allocates space for an object of size 'size', aligned to a * multiple of 'alignment' (which must be a power of two and at * least 4). * * On success, a pointer to the allocated object is stored in * *ret, and zero is returned. On failure, the return value is * either ENOMEM (allocation failed because no suitable piece of * memory was available) or EINVAL (the 'alignment' parameter was * invalid). */ #endif typedef int (*__heapprt)(void *, char const *, ...); extern _ARMABI void __heapstats(int (* /*dprint*/)(void * /*param*/, char const * /*format*/, ...), void * /*param*/) __attribute__((__nonnull__(1))); /* * reports current heap statistics (eg. number of free blocks in * the free-list). Output is as implementation-defined free-form * text, provided via the dprint function. `param' gives an * extra data word to pass to dprint. You can call * __heapstats(fprintf,stdout) by casting fprintf to the above * function type; the typedef `__heapprt' is provided for this * purpose. * * `dprint' will not be called while the heap is being examined, * so it can allocate memory itself without trouble. */ extern _ARMABI int __heapvalid(int (* /*dprint*/)(void * /*param*/, char const * /*format*/, ...), void * /*param*/, int /*verbose*/) __attribute__((__nonnull__(1))); /* * performs a consistency check on the heap. Errors are reported * through dprint, like __heapstats. If `verbose' is nonzero, * full diagnostic information on the heap state is printed out. * * This routine probably won't work if the heap isn't a * contiguous chunk (for example, if __user_heap_extend has been * overridden). * * `dprint' may be called while the heap is being examined or * even in an invalid state, so it must perform no memory * allocation. In particular, if `dprint' calls (or is) a stdio * function, the stream it outputs to must already have either * been written to or been setvbuf'ed, or else the system will * allocate buffer space for it on the first call to dprint. */ extern _ARMABI_NORETURN void abort(void); /* * causes abnormal program termination to occur, unless the signal SIGABRT * is being caught and the signal handler does not return. Whether open * output streams are flushed or open streams are closed or temporary * files removed is implementation-defined. * An implementation-defined form of the status 'unsuccessful termination' * is returned to the host environment by means of a call to * raise(SIGABRT). */ extern _ARMABI int atexit(void (* /*func*/)(void)) __attribute__((__nonnull__(1))); /* * registers the function pointed to by func, to be called without its * arguments at normal program termination. It is possible to register at * least 32 functions. * Returns: zero if the registration succeeds, nonzero if it fails. */ #if defined(__EDG__) && !defined(__GNUC__) #define __LANGUAGE_LINKAGE_CHANGES_FUNCTION_TYPE #endif #if defined(__cplusplus) && defined(__LANGUAGE_LINKAGE_CHANGES_FUNCTION_TYPE) /* atexit that takes a ptr to a function with C++ linkage * but not in GNU mode */ typedef void (* __C_exitfuncptr)(); extern "C++" inline int atexit(void (* __func)()) { return atexit((__C_exitfuncptr)__func); } #endif extern _ARMABI_NORETURN void exit(int /*status*/); /* * causes normal program termination to occur. If more than one call to the * exit function is executed by a program, the behaviour is undefined. * First, all functions registered by the atexit function are called, in the * reverse order of their registration. * Next, all open output streams are flushed, all open streams are closed, * and all files created by the tmpfile function are removed. * Finally, control is returned to the host environment. If the value of * status is zero or EXIT_SUCCESS, an implementation-defined form of the * status 'successful termination' is returned. If the value of status is * EXIT_FAILURE, an implementation-defined form of the status * 'unsuccessful termination' is returned. Otherwise the status returned * is implementation-defined. */ extern _ARMABI_NORETURN void _Exit(int /*status*/); /* * causes normal program termination to occur. No functions registered * by the atexit function are called. * In this implementation, all open output streams are flushed, all * open streams are closed, and all files created by the tmpfile function * are removed. * Control is returned to the host environment. The status returned to * the host environment is determined in the same way as for 'exit'. */ extern _ARMABI char *getenv(const char * /*name*/) __attribute__((__nonnull__(1))); /* * searches the environment list, provided by the host environment, for a * string that matches the string pointed to by name. The set of environment * names and the method for altering the environment list are * implementation-defined. * Returns: a pointer to a string associated with the matched list member. * The array pointed to shall not be modified by the program, but * may be overwritten by a subsequent call to the getenv function. * If the specified name cannot be found, a null pointer is * returned. */ extern _ARMABI int system(const char * /*string*/); /* * passes the string pointed to by string to the host environment to be * executed by a command processor in an implementation-defined manner. * A null pointer may be used for string, to inquire whether a command * processor exists. * * Returns: If the argument is a null pointer, the system function returns * non-zero only if a command processor is available. If the * argument is not a null pointer, the system function returns an * implementation-defined value. */ extern _ARMABI_THROW void *bsearch(const void * /*key*/, const void * /*base*/, size_t /*nmemb*/, size_t /*size*/, int (* /*compar*/)(const void *, const void *)) __attribute__((__nonnull__(1,2,5))); /* * searches an array of nmemb objects, the initial member of which is * pointed to by base, for a member that matches the object pointed to by * key. The size of each member of the array is specified by size. * The contents of the array shall be in ascending sorted order according to * a comparison function pointed to by compar, which is called with two * arguments that point to the key object and to an array member, in that * order. The function shall return an integer less than, equal to, or * greater than zero if the key object is considered, respectively, to be * less than, to match, or to be greater than the array member. * Returns: a pointer to a matching member of the array, or a null pointer * if no match is found. If two members compare as equal, which * member is matched is unspecified. */ #if defined(__cplusplus) && defined(__LANGUAGE_LINKAGE_CHANGES_FUNCTION_TYPE) /* bsearch that takes a ptr to a function with C++ linkage * but not in GNU mode */ typedef int (* __C_compareprocptr)(const void *, const void *); extern "C++" void *bsearch(const void * __key, const void * __base, size_t __nmemb, size_t __size, int (* __compar)(const void *, const void *)) __attribute__((__nonnull__(1,2,5))); extern "C++" inline void *bsearch(const void * __key, const void * __base, size_t __nmemb, size_t __size, int (* __compar)(const void *, const void *)) { return bsearch(__key, __base, __nmemb, __size, (__C_compareprocptr)__compar); } #endif extern _ARMABI_THROW void qsort(void * /*base*/, size_t /*nmemb*/, size_t /*size*/, int (* /*compar*/)(const void *, const void *)) __attribute__((__nonnull__(1,4))); /* * sorts an array of nmemb objects, the initial member of which is pointed * to by base. The size of each object is specified by size. * The contents of the array shall be in ascending order according to a * comparison function pointed to by compar, which is called with two * arguments that point to the objects being compared. The function shall * return an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or greater * than the second. If two members compare as equal, their order in the * sorted array is unspecified. */ #if defined(__cplusplus) && defined(__LANGUAGE_LINKAGE_CHANGES_FUNCTION_TYPE) /* qsort that takes a ptr to a function with C++ linkage * but not in GNU mode */ extern "C++" void qsort(void * __base, size_t __nmemb, size_t __size, int (* __compar)(const void *, const void *)) __attribute__((__nonnull__(1,4))); extern "C++" inline void qsort(void * __base, size_t __nmemb, size_t __size, int (* __compar)(const void *, const void *)) { qsort(__base, __nmemb, __size, (__C_compareprocptr)__compar); } #endif extern _ARMABI_PURE int abs(int /*j*/); /* * computes the absolute value of an integer j. If the result cannot be * represented, the behaviour is undefined. * Returns: the absolute value. */ extern _ARMABI_PURE div_t div(int /*numer*/, int /*denom*/); /* * computes the quotient and remainder of the division of the numerator * numer by the denominator denom. If the division is inexact, the resulting * quotient is the integer of lesser magnitude that is the nearest to the * algebraic quotient. If the result cannot be represented, the behaviour is * undefined; otherwise, quot * denom + rem shall equal numer. * Returns: a structure of type div_t, comprising both the quotient and the * remainder. the structure shall contain the following members, * in either order. * int quot; int rem; */ extern _ARMABI_PURE long int labs(long int /*j*/); /* * computes the absolute value of an long integer j. If the result cannot be * represented, the behaviour is undefined. * Returns: the absolute value. */ #ifdef __cplusplus extern "C++" inline _ARMABI_PURE long abs(long int x) { return labs(x); } #endif extern _ARMABI_PURE ldiv_t ldiv(long int /*numer*/, long int /*denom*/); /* * computes the quotient and remainder of the division of the numerator * numer by the denominator denom. If the division is inexact, the sign of * the resulting quotient is that of the algebraic quotient, and the * magnitude of the resulting quotient is the largest integer less than the * magnitude of the algebraic quotient. If the result cannot be represented, * the behaviour is undefined; otherwise, quot * denom + rem shall equal * numer. * Returns: a structure of type ldiv_t, comprising both the quotient and the * remainder. the structure shall contain the following members, * in either order. * long int quot; long int rem; */ #ifdef __cplusplus extern "C++" inline _ARMABI_PURE ldiv_t div(long int __numer, long int __denom) { return ldiv(__numer, __denom); } #endif #if !defined(__STRICT_ANSI__) || __USE_C99_STDLIB extern _ARMABI_PURE __LONGLONG llabs(__LONGLONG /*j*/); /* * computes the absolute value of a long long integer j. If the * result cannot be represented, the behaviour is undefined. * Returns: the absolute value. */ #ifdef __cplusplus extern "C++" inline _ARMABI_PURE __LONGLONG abs(__LONGLONG x) { return llabs(x); } #endif extern _ARMABI_PURE lldiv_t lldiv(__LONGLONG /*numer*/, __LONGLONG /*denom*/); /* * computes the quotient and remainder of the division of the numerator * numer by the denominator denom. If the division is inexact, the sign of * the resulting quotient is that of the algebraic quotient, and the * magnitude of the resulting quotient is the largest integer less than the * magnitude of the algebraic quotient. If the result cannot be represented, * the behaviour is undefined; otherwise, quot * denom + rem shall equal * numer. * Returns: a structure of type lldiv_t, comprising both the quotient and the * remainder. the structure shall contain the following members, * in either order. * long long quot; long long rem; */ #ifdef __cplusplus extern "C++" inline _ARMABI_PURE lldiv_t div(__LONGLONG __numer, __LONGLONG __denom) { return lldiv(__numer, __denom); } #endif #endif #if !(__ARM_NO_DEPRECATED_FUNCTIONS) /* * ARM real-time divide functions for guaranteed performance */ typedef struct __sdiv32by16 { int quot, rem; } __sdiv32by16; typedef struct __udiv32by16 { unsigned int quot, rem; } __udiv32by16; /* used int so that values return in separate regs, although 16-bit */ typedef struct __sdiv64by32 { int rem, quot; } __sdiv64by32; __value_in_regs extern _ARMABI_PURE __sdiv32by16 __rt_sdiv32by16( int /*numer*/, short int /*denom*/); /* * Signed divide: (16-bit quot), (16-bit rem) = (32-bit) / (16-bit) */ __value_in_regs extern _ARMABI_PURE __udiv32by16 __rt_udiv32by16( unsigned int /*numer*/, unsigned short /*denom*/); /* * Unsigned divide: (16-bit quot), (16-bit rem) = (32-bit) / (16-bit) */ __value_in_regs extern _ARMABI_PURE __sdiv64by32 __rt_sdiv64by32( int /*numer_h*/, unsigned int /*numer_l*/, int /*denom*/); /* * Signed divide: (32-bit quot), (32-bit rem) = (64-bit) / (32-bit) */ #endif /* * ARM floating-point mask/status function (for both hardfp and softfp) */ extern _ARMABI unsigned int __fp_status(unsigned int /*mask*/, unsigned int /*flags*/); /* * mask and flags are bit-fields which correspond directly to the * floating point status register in the FPE/FPA and fplib. * __fp_status returns the current value of the status register, * and also sets the writable bits of the word * (the exception control and flag bytes) to: * * new = (old & ~mask) ^ flags; */ #define __fpsr_IXE 0x100000 #define __fpsr_UFE 0x80000 #define __fpsr_OFE 0x40000 #define __fpsr_DZE 0x20000 #define __fpsr_IOE 0x10000 #define __fpsr_IXC 0x10 #define __fpsr_UFC 0x8 #define __fpsr_OFC 0x4 #define __fpsr_DZC 0x2 #define __fpsr_IOC 0x1 /* * Multibyte Character Functions. * The behaviour of the multibyte character functions is affected by the * LC_CTYPE category of the current locale. For a state-dependent encoding, * each function is placed into its initial state by a call for which its * character pointer argument, s, is a null pointer. Subsequent calls with s * as other than a null pointer cause the internal state of the function to be * altered as necessary. A call with s as a null pointer causes these functions * to return a nonzero value if encodings have state dependency, and a zero * otherwise. After the LC_CTYPE category is changed, the shift state of these * functions is indeterminate. */ extern _ARMABI int mblen(const char * /*s*/, size_t /*n*/); /* * If s is not a null pointer, the mblen function determines the number of * bytes compromising the multibyte character pointed to by s. Except that * the shift state of the mbtowc function is not affected, it is equivalent * to mbtowc((wchar_t *)0, s, n); * Returns: If s is a null pointer, the mblen function returns a nonzero or * zero value, if multibyte character encodings, respectively, do * or do not have state-dependent encodings. If s is not a null * pointer, the mblen function either returns a 0 (if s points to a * null character), or returns the number of bytes that compromise * the multibyte character (if the next n of fewer bytes form a * valid multibyte character), or returns -1 (they do not form a * valid multibyte character). */ extern _ARMABI int mbtowc(wchar_t * __restrict /*pwc*/, const char * __restrict /*s*/, size_t /*n*/); /* * If s is not a null pointer, the mbtowc function determines the number of * bytes that compromise the multibyte character pointed to by s. It then * determines the code for value of type wchar_t that corresponds to that * multibyte character. (The value of the code corresponding to the null * character is zero). If the multibyte character is valid and pwc is not a * null pointer, the mbtowc function stores the code in the object pointed * to by pwc. At most n bytes of the array pointed to by s will be examined. * Returns: If s is a null pointer, the mbtowc function returns a nonzero or * zero value, if multibyte character encodings, respectively, do * or do not have state-dependent encodings. If s is not a null * pointer, the mbtowc function either returns a 0 (if s points to * a null character), or returns the number of bytes that * compromise the converted multibyte character (if the next n of * fewer bytes form a valid multibyte character), or returns -1 * (they do not form a valid multibyte character). */ extern _ARMABI int wctomb(char * /*s*/, wchar_t /*wchar*/); /* * determines the number of bytes need to represent the multibyte character * corresponding to the code whose value is wchar (including any change in * shift state). It stores the multibyte character representation in the * array object pointed to by s (if s is not a null pointer). At most * MB_CUR_MAX characters are stored. If the value of wchar is zero, the * wctomb function is left in the initial shift state). * Returns: If s is a null pointer, the wctomb function returns a nonzero or * zero value, if multibyte character encodings, respectively, do * or do not have state-dependent encodings. If s is not a null * pointer, the wctomb function returns a -1 if the value of wchar * does not correspond to a valid multibyte character, or returns * the number of bytes that compromise the multibyte character * corresponding to the value of wchar. */ /* * Multibyte String Functions. * The behaviour of the multibyte string functions is affected by the LC_CTYPE * category of the current locale. */ extern _ARMABI size_t mbstowcs(wchar_t * __restrict /*pwcs*/, const char * __restrict /*s*/, size_t /*n*/) __attribute__((__nonnull__(2))); /* * converts a sequence of multibyte character that begins in the initial * shift state from the array pointed to by s into a sequence of * corresponding codes and stores not more than n codes into the array * pointed to by pwcs. No multibyte character that follow a null character * (which is converted into a code with value zero) will be examined or * converted. Each multibyte character is converted as if by a call to * mbtowc function, except that the shift state of the mbtowc function is * not affected. No more than n elements will be modified in the array * pointed to by pwcs. If copying takes place between objects that overlap, * the behaviour is undefined. * Returns: If an invalid multibyte character is encountered, the mbstowcs * function returns (size_t)-1. Otherwise, the mbstowcs function * returns the number of array elements modified, not including * a terminating zero code, if any. */ extern _ARMABI size_t wcstombs(char * __restrict /*s*/, const wchar_t * __restrict /*pwcs*/, size_t /*n*/) __attribute__((__nonnull__(2))); /* * converts a sequence of codes that correspond to multibyte characters * from the array pointed to by pwcs into a sequence of multibyte * characters that begins in the initial shift state and stores these * multibyte characters into the array pointed to by s, stopping if a * multibyte character would exceed the limit of n total bytes or if a * null character is stored. Each code is converted as if by a call to the * wctomb function, except that the shift state of the wctomb function is * not affected. No more than n elements will be modified in the array * pointed to by s. If copying takes place between objects that overlap, * the behaviour is undefined. * Returns: If a code is encountered that does not correspond to a valid * multibyte character, the wcstombs function returns (size_t)-1. * Otherwise, the wcstombs function returns the number of bytes * modified, not including a terminating null character, if any. */ extern _ARMABI void __use_realtime_heap(void); extern _ARMABI void __use_realtime_division(void); extern _ARMABI void __use_two_region_memory(void); extern _ARMABI void __use_no_heap(void); extern _ARMABI void __use_no_heap_region(void); extern _ARMABI char const *__C_library_version_string(void); extern _ARMABI int __C_library_version_number(void); #ifdef __cplusplus } /* extern "C" */ } /* namespace std */ #endif /* __cplusplus */ #endif /* __STDLIB_DECLS */ #if _AEABI_PORTABILITY_LEVEL != 0 && !defined _AEABI_PORTABLE #define _AEABI_PORTABLE #endif #ifdef __cplusplus #ifndef __STDLIB_NO_EXPORTS #if !defined(__STRICT_ANSI__) || __USE_C99_STDLIB using ::std::atoll; using ::std::lldiv_t; #endif /* !defined(__STRICT_ANSI__) || __USE_C99_STDLIB */ using ::std::div_t; using ::std::ldiv_t; using ::std::atof; using ::std::atoi; using ::std::atol; using ::std::strtod; #if !defined(__STRICT_ANSI__) || __USE_C99_STDLIB using ::std::strtof; using ::std::strtold; #endif using ::std::strtol; using ::std::strtoul; using ::std::strtoll; using ::std::strtoull; using ::std::rand; using ::std::srand; using ::std::_rand_state; using ::std::_rand_r; using ::std::_srand_r; using ::std::_ANSI_rand_state; using ::std::_ANSI_rand_r; using ::std::_ANSI_srand_r; using ::std::calloc; using ::std::free; using ::std::malloc; using ::std::realloc; #if !defined(__STRICT_ANSI__) using ::std::posix_memalign; #endif using ::std::__heapprt; using ::std::__heapstats; using ::std::__heapvalid; using ::std::abort; using ::std::atexit; using ::std::exit; using ::std::_Exit; using ::std::getenv; using ::std::system; using ::std::bsearch; using ::std::qsort; using ::std::abs; using ::std::div; using ::std::labs; using ::std::ldiv; #if !defined(__STRICT_ANSI__) || __USE_C99_STDLIB using ::std::llabs; using ::std::lldiv; #endif /* !defined(__STRICT_ANSI__) || __USE_C99_STDLIB */ #if !(__ARM_NO_DEPRECATED_FUNCTIONS) using ::std::__sdiv32by16; using ::std::__udiv32by16; using ::std::__sdiv64by32; using ::std::__rt_sdiv32by16; using ::std::__rt_udiv32by16; using ::std::__rt_sdiv64by32; #endif using ::std::__fp_status; using ::std::mblen; using ::std::mbtowc; using ::std::wctomb; using ::std::mbstowcs; using ::std::wcstombs; using ::std::__use_realtime_heap; using ::std::__use_realtime_division; using ::std::__use_two_region_memory; using ::std::__use_no_heap; using ::std::__use_no_heap_region; using ::std::__C_library_version_string; using ::std::__C_library_version_number; using ::std::size_t; using ::std::__aeabi_MB_CUR_MAX; #endif /* __STDLIB_NO_EXPORTS */ #endif /* __cplusplus */ #undef __LONGLONG #endif /* __stdlib_h */ /* end of stdlib.h */ 这是啥
07-09
握手和证书验证在httpd模块请求入口那里就已经实现了对https的处理,这里是不是可以不用修改?基本上只要考虑事件推送pull point和basic notify相关,基于我前面给你的onvif协议上对此的规范,能不能重新给出完整的修改,分步骤,对每一步修改繇指出是根据协议规范上的哪一点来修改的?原因是什么?怎么修改?请根据协议重新对soap_tev.c和soap_event.c的代码进行修改——Real-time Pull-Point Notification Interface This section introduces the Real-time Pull-Point Notification Interface. This interface provides a firewall friendly notification interface that enables real-time polling and initiates all client communications. This interface is used in the following way: The client asks the device for a pull point with the CreatePullPointSubscriptionRequest message. The device evaluates the subscription request and returns either a CreatePullPointSubscriptionResponse or one of the Fault codes. If the subscription is accepted, the response contains a WS-EndpointReference to the instantiated pull point. This WS-Endpoint provides a PullMessages operation, which is used by the client to retrieve Notifications. Additionally it provides the Renew and Unsubscribe operations of the Base Subscription Manager Interface. The sequence diagram of the interaction is shown in Figure 6. Client Event Service CreatePullPoint SubscriptionRequest Instantiate CreatePullPoint SubscriptionResponse PullMessages Request PullPoint PullMessages Response Unsubscribe Request Unsubscribe Response Figure 6: Sequence diagram for the Real-time Pull-Point Notification Interface The device immediately responds with notifications that have been aggregated on behalf of the client. If there are no aggregated notifications, the device waits to respond until either a notification is produced for the client or the specified Timeout has exceeded. In any case, the response will contain, at most, the number of notifications specified by the MessageLimit parameter. The client can poll the notifications in real-time when it starts a new PullMessagesRequest immediately after each PullMessagesResponse. For a device implementation it is important to support multiple pull points (including multiple pullpoints per client) in order to allow precise event generation. If a device would only support one subscription at a time a client would need to subscribe without any scope restriction, because changing of event subscription is not possible. Hence this would require the device to serve all available events for which the device would have to activate all subsystems that generate events. This may cause unnecessary load by e.g. activating multiple motion detectors and similar without need. Additionally the traffic produced by all these events may cause a substantial network load. ONVIF™– 86 ONVIF Core Spec – Ver. 24.12 If the device supports persistent notification storage, see 9.1.7, the WS-Endpoint also provides a Seek opera tion. This operation allows to reposition the pull pointer into the past. With the Seek operation it is also possible to reverse the pull direction. There is also a BeginOfBuffer event, as defined in 9.11.1, that signals the start of the buffer. An ONVIF compliant device shall implement the Real Time Pull-Point Notification Interface. 9.1.1 Create pull point subscription An ONVIF compliant device shall provide the CreatePullPointSubscription command. If no Filter element is specified the pullpoint shall notify all occurring events to the client. By default the pull point keep alive is controlled via the PullMessages operation. In this case, after a PullMes sages response is returned, the subscription should be active for at least the timeout specified in the PullMes sages request. A device shall support an absolute time value specified in utc as well as a relative time value for the InitialTer minationTime parameter. A device shall respond both parameters CurrentTime and TerminationTime as utc using the ‘Z’ indicator. The following optional subscription policy elements are defined in tev:SubscriptionPolicy: • tev:ChangedOnly A pullpoint should not provide Initialized nor Deleted events for Properties. Both request and response message contain the same elements as the SubscriptionRequest and Response of [WS-BaseNotification] without the ConsumerReference. REQUEST: • Filter - optional [wsnt:FilterType] Optional filtering for e.g. topics. • InitialTerminationTime - optional [wsnt:AbsoluteOrRelativeTimeType] Initial termination time. • SubscriptionPolicy - optional [xs:any] RESPONSE: • SubscriptionReference [wsa:EndpointReferenceType] Endpoint reference of the subscription to be used for pulling the messages. • CurrentTime [xs:dateTime] Current time of the server for synchronization purposes. • TerminationTime [xs:dateTime] Date time when the PullPoint will be shut down without further pull requests. FAULTS: • The same faults as for Subscription Request of the [WS-BaseNotification] are used. ACCESS CLASS: READ_MEDIA 9.1.2 Pull messages The device shall provide the following PullMessages command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. ONVIF™– 87 ONVIF Core Spec – Ver. 24.12 The device shall support a Timeout of at least one minute. The device shall not respond with a PullMessages FaultResponse when the MessageLimit is greater than the device supports. Instead, the device shall return up to the supported messages in the response. The response behavior shall be one of three types: • If there are one or more messages waiting (i.e., aggregated) when the request arrives, the device shall immediately respond with the waiting messages, up to the MessageLimit. The device shall not discard unsent messages, but shall await the next PullMessages request to send remaining messages. • If there are no messages waiting, and the device generates a message (or multiple simultaneous messages) prior to reaching the Timeout, the device shall immediately respond with the generated messages, up to the MessageLimit. The device shall not wait for additional messages before returning the response. • If there are no messages waiting, and the device does not generate any message prior to reaching the Timeout, the device shall respond with zero messages. The device shall not return a response with zero messages prior to reaching the Timeout. A device shall respond both parameters CurrentTime and TerminationTime as utc using the ‘Z’ indicator. After a seek operation the device shall return the messages in strict message utc time order. Note that this requirement is not applicable to standard realtime message delivery where the delivery order may be affected by device internal computations. A device should return an error (UnableToGetMessagesFault) when receiving a PullMessages request for a subscription where a blocking PullMessage request already exists. REQUEST: • Timeout [xs:duration] Maximum time to block until this method returns. • MessageLimit [xs:int] Upper limit for the number of messages to return at once. A server implementation may decide to return less messages. RESPONSE: • CurrentTime [xs:dateTime] The date and time when the messages have been delivered by the web server to the client. • TerminationTime [xs:dateTime] Date time when the PullPoint will be shut down without further pull requests. • NotificationMessage - optional, unbounded [wsnt:NotificationMessageHolderType] List of messages. This list shall be empty in case of a timeout. PULLMESSAGESFAULTRESPONSE: • MaxTimeout [xs:duration] Only when the Timeout exceeds the upper limit supported by the device. Not sent when the Message Limit is exceeded. The Fault Message shall contain the upper limits for both parameters. • MaxMessageLimit [xs:int] FAULTS: • No specific fault codes. ACCESS CLASS: READ_MEDIA ONVIF™– 88 ONVIF Core Spec – Ver. 24.12 9.1.3 Renew An ONVIF compliant device shall support this command if it signals support for [WS-Base Notification] via the MaxNotificationProducers capability. The command shall at least support a Timeout of one minute. A device shall respond both parameters Cur rentTime and TerminationTime as utc using the ‘Z’ indicator. REQUEST: • TerminationTime [wsnt:AbsoluteOrRelativeTimeType] The new relative or absolute termination time. RESPONSE: • CurrentTime [xs:dateTime] The current server time. • TerminationTime [xs:dateTime] The updated TerminationTime for the SubscriptionManager. RESOURCEUNKNOWNFAULTRESPONSE: • Timestamp [xs:dateTime] The pull point reference is invalid • Originator - optional [wsa:EndpointReferenceType] • ErrorCode - optional [xs:any] UNACCEPTABLETERMINATIONTIMEFAULTRESPONSE: • Timestamp [xs:dateTime] The Timeout exceeds the upper limit supported by the device. • Originator - optional [wsa:EndpointReferenceType] • ErrorCode - optional [xs:any] FAULTS: • No specific fault codes. ACCESS CLASS: READ_MEDIA 9.1.4 Unsubscribe The device shall provide the following Unsubscribe command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. The command is defined in section 6.1.2 of [OASIS Web Ser vices Base Notification 1.3 [http://docs.oasis-open.org/wsn/wsn-ws_base_notification-1.3-spec-os.pdf]]. This command shall terminate the lifetime of a pull point. REQUEST: This is an empty message. RESPONSE: This is an empty message. ONVIF™– 89 ONVIF Core Spec – Ver. 24.12 RESOURCEUNKNOWNFAULTRESPONSE: • Timestamp [xs:dateTime] The pull point reference is invalid • Originator - optional [wsa:EndpointReferenceType] • ErrorCode - optional [xs:any] FAULTS: • No specific fault codes. ACCESS CLASS: READ_MEDIA 9.1.5 Seek A device supporting persistent notification storage as defined in section 9.1.7 shall provide the following Seek command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. On a Seek a pullpoint shall abort any event delivery including any initial states of properties. Furthermore the pullpoint should flush events not already queued for transmission from the transmit queue. After a Seek request a pullpoint shall ignore the behavior described in section 9.6 for properties. A device shall only set the subscription in reverse pull mode if the Reverse argument is present and set to “true”. The UtcTime argument of the Seek request shall be matched against the UtcTime attribute of the notifications in the persistent notification storage. When Seek is used in the forward mode a device shall position the pull pointer to include all NotificationMes sages in the persistent storage with a UtcTime attribute greater than or equal to the Seek argument. When Seek is used in reverse mode a device shall position the pull pointer to include all NotificationMessages in the in the persistent storage with a UtcTime attribute less than or equal to the Seek argument. A device shall not provide information of the initial generate property state as response to a call to the Seek method. REQUEST: • UtcTime [xs:datetime] This message shall be addressed to a PullPoint in order to readjust the pull position: • Reverse - optional [xs:bool] RESPONSE: This is an empty message. FAULTS: • No specific fault codes. ACCESS CLASS: READ_MEDIA 9.1.6 Pull Point Lifecycle Figure 6 depicts the basic operation of a pull point. This chapter states the requirements on the pull point lifecycle. ONVIF™– 90 ONVIF Core Spec – Ver. 24.12 A device shall create a new pull point on each CreatePullPointSubscription command as long as the number of instantiated pull points does not exceed the capability MaxPullPoints. Each pull point shall have a unique endpoint reference to which the client can direct its consecutive operations on the pull point. A pull point shall exist until either its termination time has elapsed or the client has requested its disposal via an Unsubscribe request. There are no requirements regarding persistency of a pull point across a power cycle of a device. 9.1.7 Persistent notification storage To ensure that no notifications are lost by a client a device may store its notifications. The stored notifications can at any time be retrieved by a client. The device shall indicate if its support persistent notification storage with the PersistentNotificationStorage capability. See section 9.8. This specification defines that the interface to the persistent storage allows linear access via the originating message event time. This holds also for events that are delivered out of order in the live streaming case due to e.g. computational delay. The details of what notification and how and where those notifications actually are stored are outside the scope of this specification. Removal policy of stored notifications to get room for new ones is also out of scope. 9.2 Notification Streaming Interface This section defines the transmission of events via RTP streaming packets. For details regarding the configu ration see section “Metadata Configuration“ of the ONVIF Media Service Specification. The following requirements apply if a devices supports transmission of events via RTP streaming packets: • The events shall be encoded as wsnt:NotificationMessage as defined in [WS-BaseNotification] to trans port the Message Payload, the Topic and the ProducerReference. • Multiple instances of the wsnt:NotificationMessage elements can be placed within a metadata docu ment. • Since there is no explicit SubscriptionReference with streaming notifications, the wsnt:NotificationMes sage shall not contain the SubscriptionReference element. 9.3 Basic Notification Interface Section 9.3.1 briefly introduces the Basic Notification Interface of the [WS-BaseNotification] specification. Sec tion 9.3.2 summarizes the mandatory and the optional interfaces of the [WS-BaseNotification] specification. Please refer for a full documentation of the Basic Notification Interface to the [WS-BaseNotification] specifica tion. 9.3.1 Introduction The following logical entities participate in the notification pattern: Client: implements the NotificationConsumer interface. Event Service: implements the NotificationProducer interface. Subscription Manager: implements the BaseSubscriptionManager interface. The Event Service and the Subscription Manager should be instantiated on a device. Typical messages exchanged between the entities are shown in the sequence diagram in Figure 7. First, the client establishes a connection to the Event Service. The client can then subscribe for certain notifications by sending a SubscriptionRequest. If the Event Service accepts the Subscription, it dynamically instantiates a SubscriptionManager representing the Subscription. The Event Service shall return the WS-Endpoint-Address of the SubscriptionManager in the SubscriptionResponse. ONVIF™– 91 ONVIF Core Spec – Ver. 24.12 In order to transmit notifications matching the Subscription, another connection is established from the Event Service to the client. Via this connection, the Event Service sends a one-way Notify message to the Notifica tionConsumer interface of the client. Corresponding notifications can be sent at any time by the Event Service to the client, while the Subscription is active. To control the Subscription, the client directly addresses the SubscriptionManager returned in the Subscrip tionResponse. In the SubscriptionRequest the client can specify a termination time. The SubscriptionManager is automatically destroyed when the termination time is reached. RenewRequests can be initiated by the client in order to postpone the termination time. The client can also explicitly terminate the SubscriptionManager by sending an UnsubscribeRequest. After a successful Unsubscription, the SubscriptionManager no longer exists. The interaction between EventService and SubscriptionManager is not further specified by the [WS-BaseNo tification] and is up to the implementation of the device. Client Event Service SubscriptionRequest Instantiate SubscriptionResponse Notify RenewRequest RenewResponse Subscription Manager Notify UnsubscribeRequest UnsubscribeResponse Figure 7: Sequence diagram for the Base Notification Interface 9.3.2 Requirements This section details those interfaces of the [WS-BaseNotification] that a device shall provide. An ONVIF compliant device shall support the NotificationProducer Interface of the [WS-BaseNotification] if the capability MaxNotificationProducers is non-zero. The device shall support TopicExpression filters with the dialects described in 9.6.3. The support for MessageContent filters is signalled via the GetEventProperties method. If the device does not accept the InitialTerminationTime of a subscription, it shall provide a valid Ini tialTerminationTime within the Fault Message. The device shall be able to provide notifications using the Noti fy wrapper of the [WS-BaseNotification] specification. The SubscriptionPolicy wsnt:UseRaw is optional for the device. Although the [WS-BaseNotification] has CurrentTime and TerminationTime as optional elements in a SubscribeResponse and RenewResponse, an ONVIF compliant device shall list them in both SubscribeRe sponses and RenewResponse. The device may respond to any GetCurrentMessage request with a Fault mes sage indicating that no current message is available on the requested topic. An ONVIF compliant device shall implement the Base Subscription Manager Interface of the [WS-BaseNotifi cation] specification consisting of the Renew and Unsubscribe operations. The Pausable Subscription Manager Interface is optional. The implementation of Subscriptions as WS-Resources is optional. ONVIF™– 92 ONVIF Core Spec – Ver. 24.12 An ONVIF compliant device shall support time values in request parameters that are given in utc with the ‘Z’ indicator and respond all time values as utc including the ‘Z’ indicator
最新发布
10-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值