From b359e82ceabbf42b1e3d8069627701fde5d7cb90 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 28 May 2003 22:04:40 +0000 Subject: 2003-05-28 Jeff Johnston Tom Fitzsimmons * configure.in: Add iconvdata support for x86 linux. * configure: Regenerated. * libc/sys/linux/Makefile.am: Add EL/IX level 3 network, dynamic library, iconv, and linuxthreads support. * libc/sys/linux/configure.in: Ditto. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/configure: Ditto. * iconvdata/EUC-JP.irreversible: New file. * iconvdata/Makefile.am: Ditto. * iconvdata/Makefile.in: Ditto. * iconvdata/SJIS.irreversible: Ditto. * iconvdata/aclocal.m4: Ditto. * iconvdata/configure: Ditto. * iconvdata/configure.in: Ditto. * iconvdata/dummy.c: Ditto. * iconvdata/euc-jp.c: Ditto. * iconvdata/gconv-modules: Ditto. * iconvdata/jis0201.c: Ditto. * iconvdata/jis0201.h: Ditto. * iconvdata/jis0208.c: Ditto. * iconvdata/jis0208.h: Ditto. * iconvdata/jis0212.c: Ditto. * iconvdata/jis0212.h: Ditto. * iconvdata/sjis.c: Ditto. * libc/include/errno.h: Protect definition of error_t. * libc/sys/linux/gethostid.c: New file. * libc/sys/linux/sethostid.c: Ditto. * libc/sys/linux/dl/Makefile.am: Ditto. * libc/sys/linux/dl/Makefile.in: Ditto. * libc/sys/linux/dl/abi-tag.h: Ditto. * libc/sys/linux/dl/atomicity.h: Ditto. * libc/sys/linux/dl/dl-addr.c: Ditto. * libc/sys/linux/dl/dl-cache.c: Ditto. * libc/sys/linux/dl/dl-cache.h: Ditto. * libc/sys/linux/dl/dl-close.c: Ditto. * libc/sys/linux/dl/dl-debug.c: Ditto. * libc/sys/linux/dl/dl-deps.c: Ditto. * libc/sys/linux/dl/dl-dst.h: Ditto. * libc/sys/linux/dl/dl-error.c: Ditto. * libc/sys/linux/dl/dl-fini.c: Ditto. * libc/sys/linux/dl/dl-init.c: Ditto. * libc/sys/linux/dl/dl-iteratephdr.c: Ditto. * libc/sys/linux/dl/dl-libc.c: Ditto. * libc/sys/linux/dl/dl-librecon.h: Ditto. * libc/sys/linux/dl/dl-load.c: Ditto. * libc/sys/linux/dl/dl-lookup.c: Ditto. * libc/sys/linux/dl/dl-lookupcfg.h: Ditto. * libc/sys/linux/dl/dl-minimal.c: Ditto. * libc/sys/linux/dl/dl-misc.c: Ditto. * libc/sys/linux/dl/dl-object.c: Ditto. * libc/sys/linux/dl/dl-open.c: Ditto. * libc/sys/linux/dl/dl-osinfo.h: Ditto. * libc/sys/linux/dl/dl-profile.c: Ditto. * libc/sys/linux/dl/dl-profstub.c: Ditto. * libc/sys/linux/dl/dl-reloc.c: Ditto. * libc/sys/linux/dl/dl-runtime.c: Ditto. * libc/sys/linux/dl/dl-support.c: Ditto. * libc/sys/linux/dl/dl-sym.c: Ditto. * libc/sys/linux/dl/dl-version.c: Ditto. * libc/sys/linux/dl/dlfcn.h: Ditto. * libc/sys/linux/dl/do-lookup.h: Ditto. * libc/sys/linux/dl/do-rel.h: Ditto. * libc/sys/linux/dl/dynamic-link.h: Ditto. * libc/sys/linux/dl/kernel-features.h: Ditto. * libc/sys/linux/dl/ldsodefs.h: Ditto. * libc/sys/linux/dl/libintl.h: Ditto. * libc/sys/linux/dl/trusted-dirs.h: Ditto. * libc/sys/linux/dl/unsecvars.h: Ditto. * libc/sys/linux/iconv/Makefile.am: Ditto. * libc/sys/linux/iconv/Makefile.in: Ditto. * libc/sys/linux/iconv/categories.def: Ditto. * libc/sys/linux/iconv/dummy-repertoire.c: Ditto. * libc/sys/linux/iconv/gconv.c: Ditto. * libc/sys/linux/iconv/gconv_builtin.c: Ditto. * libc/sys/linux/iconv/gconv_builtin.h: Ditto. * libc/sys/linux/iconv/gconv_cache.c: Ditto. * libc/sys/linux/iconv/gconv_charset.h: Ditto. * libc/sys/linux/iconv/gconv_close.c: Ditto. * libc/sys/linux/iconv/gconv_conf.c: Ditto. * libc/sys/linux/iconv/gconv_db.c: Ditto. * libc/sys/linux/iconv/gconv_dl.c: Ditto. * libc/sys/linux/iconv/gconv_int.h: Ditto. * libc/sys/linux/iconv/gconv_open.c: Ditto. * libc/sys/linux/iconv/gconv_simple.c: Ditto. * libc/sys/linux/iconv/gconv_trans.c: Ditto. * libc/sys/linux/iconv/hash-string.h: Ditto. * libc/sys/linux/iconv/iconv.c: Ditto. * libc/sys/linux/iconv/iconv.h: Ditto. * libc/sys/linux/iconv/iconv_charmap.c: Ditto. * libc/sys/linux/iconv/iconv_close.c: Ditto. * libc/sys/linux/iconv/iconv_open.c: Ditto. * libc/sys/linux/iconv/iconvconfig.c: Ditto. * libc/sys/linux/iconv/iconvconfig.h: Ditto. * libc/sys/linux/iconv/loadinfo.h: Ditto. * libc/sys/linux/iconv/localeinfo.h: Ditto. * libc/sys/linux/iconv/loop.c: Ditto. * libc/sys/linux/iconv/skeleton.c: Ditto. * libc/sys/linux/iconv/strtab.c: Ditto. * libc/sys/linux/include/dl-hash.h: Ditto. * libc/sys/linux/include/dlfcn.h: Ditto. * libc/sys/linux/include/fnmatch.h: Ditto. * libc/sys/linux/include/gconv.h: Ditto. * libc/sys/linux/include/glob.h: Ditto. * libc/sys/linux/include/hesiod.h: Ditto. * libc/sys/linux/include/ifaddrs.h: Ditto. * libc/sys/linux/include/libc_private.h: Ditto. * libc/sys/linux/include/link.h: Ditto. * libc/sys/linux/include/namespace.h: Ditto. * libc/sys/linux/include/netconfig.h: Ditto. * libc/sys/linux/include/netdb.h: Ditto. * libc/sys/linux/include/nsswitch.h: Ditto. * libc/sys/linux/include/regex.h: Ditto. * libc/sys/linux/include/resolv.h: Ditto. * libc/sys/linux/include/rune.h: Ditto. * libc/sys/linux/include/runetype.h: Ditto. * libc/sys/linux/include/semaphore.h: Ditto. * libc/sys/linux/include/setlocale.h: Ditto. * libc/sys/linux/include/un-namespace.h: Ditto. * libc/sys/linux/include/wordexp.h: Ditto. * libc/sys/linux/include/arpa/ftp.h: Ditto. * libc/sys/linux/include/arpa/inet.h: Ditto. * libc/sys/linux/include/arpa/nameser.h: Ditto. * libc/sys/linux/include/arpa/nameser_compat.h: Ditto. * libc/sys/linux/include/arpa/telnet.h: Ditto. * libc/sys/linux/include/arpa/tftp.h: Ditto. * libc/sys/linux/include/net/bpf.h: Ditto. * libc/sys/linux/include/net/bpf_compat.h: Ditto. * libc/sys/linux/include/net/bpfdesc.h: Ditto. * libc/sys/linux/include/net/bridge.h: Ditto. * libc/sys/linux/include/net/ethernet.h: Ditto. * libc/sys/linux/include/net/fddi.h: Ditto. * libc/sys/linux/include/net/if.h: Ditto. * libc/sys/linux/include/net/if_arc.h: Ditto. * libc/sys/linux/include/net/if_arp.h: Ditto. * libc/sys/linux/include/net/if_atm.h: Ditto. * libc/sys/linux/include/net/if_dl.h: Ditto. * libc/sys/linux/include/net/if_gif.h: Ditto. * libc/sys/linux/include/net/if_ieee80211.h: Ditto. * libc/sys/linux/include/net/if_llc.h: Ditto. * libc/sys/linux/include/net/if_media.h: Ditto. * libc/sys/linux/include/net/if_mib.h: Ditto. * libc/sys/linux/include/net/if_ppp.h: Ditto. * libc/sys/linux/include/net/if_pppvar.h: Ditto. * libc/sys/linux/include/net/if_slvar.h: Ditto. * libc/sys/linux/include/net/if_sppp.h: Ditto. * libc/sys/linux/include/net/if_stf.h: Ditto. * libc/sys/linux/include/net/if_tap.h: Ditto. * libc/sys/linux/include/net/if_tapvar.h: Ditto. * libc/sys/linux/include/net/if_tun.h: Ditto. * libc/sys/linux/include/net/if_tunvar.h: Ditto. * libc/sys/linux/include/net/if_types.h: Ditto. * libc/sys/linux/include/net/if_var.h: Ditto. * libc/sys/linux/include/net/if_vlan_var.h: Ditto. * libc/sys/linux/include/net/intrq.h: Ditto. * libc/sys/linux/include/net/iso88025.h: Ditto. * libc/sys/linux/include/net/net_osdep.h: Ditto. * libc/sys/linux/include/net/netisr.h: Ditto. * libc/sys/linux/include/net/pfil.h: Ditto. * libc/sys/linux/include/net/pfkeyv2.h: Ditto. * libc/sys/linux/include/net/ppp_comp.h: Ditto. * libc/sys/linux/include/net/ppp_defs.h: Ditto. * libc/sys/linux/include/net/radix.h: Ditto. * libc/sys/linux/include/net/raw_cb.h: Ditto. * libc/sys/linux/include/net/route.h: Ditto. * libc/sys/linux/include/net/slcompress.h: Ditto. * libc/sys/linux/include/net/slip.h: Ditto. * libc/sys/linux/include/net/zlib.h: Ditto. * libc/sys/linux/include/netinet/icmp6.h: Ditto. * libc/sys/linux/include/netinet/icmp_var.h: Ditto. * libc/sys/linux/include/netinet/if_atm.h: Ditto. * libc/sys/linux/include/netinet/if_ether.h: Ditto. * libc/sys/linux/include/netinet/igmp.h: Ditto. * libc/sys/linux/include/netinet/igmp_var.h: Ditto. * libc/sys/linux/include/netinet/in.h: Ditto. * libc/sys/linux/include/netinet/in_gif.h: Ditto. * libc/sys/linux/include/netinet/in_pcb.h: Ditto. * libc/sys/linux/include/netinet/in_systm.h: Ditto. * libc/sys/linux/include/netinet/in_var.h: Ditto. * libc/sys/linux/include/netinet/ip.h: Ditto. * libc/sys/linux/include/netinet/ip6.h: Ditto. * libc/sys/linux/include/netinet/ip_dummynet.h: Ditto. * libc/sys/linux/include/netinet/ip_ecn.h: Ditto. * libc/sys/linux/include/netinet/ip_encap.h: Ditto. * libc/sys/linux/include/netinet/ip_flow.h: Ditto. * libc/sys/linux/include/netinet/ip_fw.h: Ditto. * libc/sys/linux/include/netinet/ip_icmp.h: Ditto. * libc/sys/linux/include/netinet/ip_mroute.h: Ditto. * libc/sys/linux/include/netinet/ip_var.h: Ditto. * libc/sys/linux/include/netinet/ipprotosw.h: Ditto. * libc/sys/linux/include/netinet/tcp.h: Ditto. * libc/sys/linux/include/netinet/tcp_debug.h: Ditto. * libc/sys/linux/include/netinet/tcp_fsm.h: Ditto. * libc/sys/linux/include/netinet/tcp_seq.h: Ditto. * libc/sys/linux/include/netinet/tcp_timer.h: Ditto. * libc/sys/linux/include/netinet/tcp_var.h: Ditto. * libc/sys/linux/include/netinet/tcpip.h: Ditto. * libc/sys/linux/include/netinet/udp.h: Ditto. * libc/sys/linux/include/netinet/udp_var.h: Ditto. * libc/sys/linux/include/netinet6/ah.h: Ditto. * libc/sys/linux/include/netinet6/ah6.h: Ditto. * libc/sys/linux/include/netinet6/esp.h: Ditto. * libc/sys/linux/include/netinet6/esp6.h: Ditto. * libc/sys/linux/include/netinet6/esp_rijndael.h: Ditto. * libc/sys/linux/include/netinet6/icmp6.h: Ditto. * libc/sys/linux/include/netinet6/in6.h: Ditto. * libc/sys/linux/include/netinet6/in6_gif.h: Ditto. * libc/sys/linux/include/netinet6/in6_ifattach.h: Ditto. * libc/sys/linux/include/netinet6/in6_pcb.h: Ditto. * libc/sys/linux/include/netinet6/in6_prefix.h: Ditto. * libc/sys/linux/include/netinet6/in6_var.h: Ditto. * libc/sys/linux/include/netinet6/ip6.h: Ditto. * libc/sys/linux/include/netinet6/ip6_ecn.h: Ditto. * libc/sys/linux/include/netinet6/ip6_fw.h: Ditto. * libc/sys/linux/include/netinet6/ip6_mroute.h: Ditto. * libc/sys/linux/include/netinet6/ip6_var.h: Ditto. * libc/sys/linux/include/netinet6/ip6protosw.h: Ditto. * libc/sys/linux/include/netinet6/ipcomp.h: Ditto. * libc/sys/linux/include/netinet6/ipcomp6.h: Ditto. * libc/sys/linux/include/netinet6/ipsec.h: Ditto. * libc/sys/linux/include/netinet6/ipsec6.h: Ditto. * libc/sys/linux/include/netinet6/mld6_var.h: Ditto. * libc/sys/linux/include/netinet6/nd6.h: Ditto. * libc/sys/linux/include/netinet6/pim6.h: Ditto. * libc/sys/linux/include/netinet6/pim6_var.h: Ditto. * libc/sys/linux/include/netinet6/raw_ip6.h: Ditto. * libc/sys/linux/include/netinet6/scope6_var.h: Ditto. * libc/sys/linux/include/netinet6/tcp6_var.h: Ditto. * libc/sys/linux/include/netinet6/udp6_var.h: Ditto. * libc/sys/linux/include/netns/idp.h: Ditto. * libc/sys/linux/include/netns/idp_var.h: Ditto. * libc/sys/linux/include/netns/ns.h: Ditto. * libc/sys/linux/include/netns/ns_error.h: Ditto. * libc/sys/linux/include/netns/ns_if.h: Ditto. * libc/sys/linux/include/netns/ns_pcb.h: Ditto. * libc/sys/linux/include/netns/sp.h: Ditto. * libc/sys/linux/include/netns/spidp.h: Ditto. * libc/sys/linux/include/netns/spp_debug.h: Ditto. * libc/sys/linux/include/netns/spp_timer.h: Ditto. * libc/sys/linux/include/netns/spp_var.h: Ditto. * libc/sys/linux/include/rpc/Makefile: Ditto. * libc/sys/linux/include/rpc/auth.h: Ditto. * libc/sys/linux/include/rpc/auth_des.h: Ditto. * libc/sys/linux/include/rpc/auth_kerb.h: Ditto. * libc/sys/linux/include/rpc/auth_unix.h: Ditto. * libc/sys/linux/include/rpc/clnt.h: Ditto. * libc/sys/linux/include/rpc/clnt_soc.h: Ditto. * libc/sys/linux/include/rpc/clnt_stat.h: Ditto. * libc/sys/linux/include/rpc/des.h: Ditto. * libc/sys/linux/include/rpc/des_crypt.h: Ditto. * libc/sys/linux/include/rpc/nettype.h: Ditto. * libc/sys/linux/include/rpc/pmap_clnt.h: Ditto. * libc/sys/linux/include/rpc/pmap_prot.h: Ditto. * libc/sys/linux/include/rpc/pmap_rmt.h: Ditto. * libc/sys/linux/include/rpc/raw.h: Ditto. * libc/sys/linux/include/rpc/rpc.h: Ditto. * libc/sys/linux/include/rpc/rpc_com.h: Ditto. * libc/sys/linux/include/rpc/rpc_msg.h: Ditto. * libc/sys/linux/include/rpc/rpcb_clnt.h: Ditto. * libc/sys/linux/include/rpc/rpcb_prot.h: Ditto. * libc/sys/linux/include/rpc/rpcb_prot.x: Ditto. * libc/sys/linux/include/rpc/rpcent.h: Ditto. * libc/sys/linux/include/rpc/svc.h: Ditto. * libc/sys/linux/include/rpc/svc_auth.h: Ditto. * libc/sys/linux/include/rpc/svc_dg.h: Ditto. * libc/sys/linux/include/rpc/svc_soc.h: Ditto. * libc/sys/linux/include/rpc/types.h: Ditto. * libc/sys/linux/include/rpc/xdr.h: Ditto. * libc/sys/linux/intl/Makefile.am: Ditto. * libc/sys/linux/intl/Makefile.in: Ditto. * libc/sys/linux/intl/bindtextdom.c: Ditto. * libc/sys/linux/intl/catgets.c: Ditto. * libc/sys/linux/intl/catgetsinfo.h: Ditto. * libc/sys/linux/intl/config.h: Ditto. * libc/sys/linux/intl/dcgettext.c: Ditto. * libc/sys/linux/intl/dcigettext.c: Ditto. * libc/sys/linux/intl/dcngettext.c: Ditto. * libc/sys/linux/intl/dgettext.c: Ditto. * libc/sys/linux/intl/dngettext.c: Ditto. * libc/sys/linux/intl/explodename.c: Ditto. * libc/sys/linux/intl/finddomain.c: Ditto. * libc/sys/linux/intl/gettext.c: Ditto. * libc/sys/linux/intl/gettext.h: Ditto. * libc/sys/linux/intl/gettextP.h: Ditto. * libc/sys/linux/intl/hash-string.h: Ditto. * libc/sys/linux/intl/l10nflist.c: Ditto. * libc/sys/linux/intl/loadinfo.h: Ditto. * libc/sys/linux/intl/loadmsgcat.c: Ditto. * libc/sys/linux/intl/locale.alias: Ditto. * libc/sys/linux/intl/localealias.c: Ditto. * libc/sys/linux/intl/ngettext.c: Ditto. * libc/sys/linux/intl/open_catalog.c: Ditto. * libc/sys/linux/intl/plural.c: Ditto. * libc/sys/linux/intl/plural.y: Ditto. * libc/sys/linux/intl/stpcpy.c: Ditto. * libc/sys/linux/intl/textdomain.c: Ditto. * libc/sys/linux/linuxthreads/LICENSE: Ditto. * libc/sys/linux/linuxthreads/Makefile.am: Ditto. * libc/sys/linux/linuxthreads/Makefile.in: Ditto. * libc/sys/linux/linuxthreads/aclocal.m4: Ditto. * libc/sys/linux/linuxthreads/attr.c: Ditto. * libc/sys/linux/linuxthreads/barrier.c: Ditto. * libc/sys/linux/linuxthreads/bp-sym.h: Ditto. * libc/sys/linux/linuxthreads/cancel.c: Ditto. * libc/sys/linux/linuxthreads/condvar.c: Ditto. * libc/sys/linux/linuxthreads/config.h: Ditto. * libc/sys/linux/linuxthreads/configure: Ditto. * libc/sys/linux/linuxthreads/configure.in: Ditto. * libc/sys/linux/linuxthreads/defs.awk: Ditto. * libc/sys/linux/linuxthreads/ecmutex.c: Ditto. * libc/sys/linux/linuxthreads/events.c: Ditto. * libc/sys/linux/linuxthreads/getcpuclockid.c: Ditto. * libc/sys/linux/linuxthreads/getreent.c: Ditto. * libc/sys/linux/linuxthreads/internals.h: Ditto. * libc/sys/linux/linuxthreads/join.c: Ditto. * libc/sys/linux/linuxthreads/joinrace.c: Ditto. * libc/sys/linux/linuxthreads/kernel-features.h: Ditto. * libc/sys/linux/linuxthreads/libc-internal.h: Ditto. * libc/sys/linux/linuxthreads/libc-symbols.h: Ditto. * libc/sys/linux/linuxthreads/linuxthreads.texi: Ditto. * libc/sys/linux/linuxthreads/lockfile.c: Ditto. * libc/sys/linux/linuxthreads/manager.c: Ditto. * libc/sys/linux/linuxthreads/mq_notify.c: Ditto. * libc/sys/linux/linuxthreads/mutex.c: Ditto. * libc/sys/linux/linuxthreads/no-tsd.c: Ditto. * libc/sys/linux/linuxthreads/oldsemaphore.c: Ditto. * libc/sys/linux/linuxthreads/posix-timer.h: Ditto. * libc/sys/linux/linuxthreads/prio.c: Ditto. * libc/sys/linux/linuxthreads/proc_service.h: Ditto. * libc/sys/linux/linuxthreads/pt-machine.c: Ditto. * libc/sys/linux/linuxthreads/ptclock_gettime.c: Ditto. * libc/sys/linux/linuxthreads/ptclock_settime.c: Ditto. * libc/sys/linux/linuxthreads/ptfork.c: Ditto. * libc/sys/linux/linuxthreads/pthread.c: Ditto. * libc/sys/linux/linuxthreads/ptlongjmp.c: Ditto. * libc/sys/linux/linuxthreads/queue.h: Ditto. * libc/sys/linux/linuxthreads/reent.c: Ditto. * libc/sys/linux/linuxthreads/reqsyscalls.c: Ditto. * libc/sys/linux/linuxthreads/restart.h: Ditto. * libc/sys/linux/linuxthreads/rwlock.c: Ditto. * libc/sys/linux/linuxthreads/semaphore.c: Ditto. * libc/sys/linux/linuxthreads/semaphore.h: Ditto. * libc/sys/linux/linuxthreads/shlib-compat.h: Ditto. * libc/sys/linux/linuxthreads/signals.c: Ditto. * libc/sys/linux/linuxthreads/specific.c: Ditto. * libc/sys/linux/linuxthreads/spinlock.c: Ditto. * libc/sys/linux/linuxthreads/spinlock.h: Ditto. * libc/sys/linux/linuxthreads/sysctl.c: Ditto. * libc/sys/linux/linuxthreads/td_init.c: Ditto. * libc/sys/linux/linuxthreads/td_log.c: Ditto. * libc/sys/linux/linuxthreads/td_symbol_list.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_clear_event.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_delete.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_enable_stats.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_event_addr.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_event_getmsg.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_get_nthreads.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_get_ph.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_get_stats.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_map_id2thr.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_map_lwp2thr.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_new.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_reset_stats.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_set_event.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_setconcurrency.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_thr_iter.c: Ditto. * libc/sys/linux/linuxthreads/td_ta_tsd_iter.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_clear_event.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_dbresume.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_dbsuspend.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_event_enable.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_event_getmsg.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_get_info.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_getfpregs.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_getgregs.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_getxregs.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_getxregsize.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_set_event.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_setfpregs.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_setgregs.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_setprio.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_setsigpending.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_setxregs.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_sigsetmask.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_tsd.c: Ditto. * libc/sys/linux/linuxthreads/td_thr_validate.c: Ditto. * libc/sys/linux/linuxthreads/testrtsig.h: Ditto. * libc/sys/linux/linuxthreads/thread_db.h: Ditto. * libc/sys/linux/linuxthreads/thread_dbP.h: Ditto. * libc/sys/linux/linuxthreads/timer_create.c: Ditto. * libc/sys/linux/linuxthreads/timer_delete.c: Ditto. * libc/sys/linux/linuxthreads/timer_getoverr.c: Ditto. * libc/sys/linux/linuxthreads/timer_gettime.c: Ditto. * libc/sys/linux/linuxthreads/timer_routines.c: Ditto. * libc/sys/linux/linuxthreads/timer_settime.c: Ditto. * libc/sys/linux/linuxthreads/tst-cancel.c: Ditto. * libc/sys/linux/linuxthreads/tst-context.c: Ditto. * libc/sys/linux/linuxthreads/tststack.c: Ditto. * libc/sys/linux/linuxthreads/unload.c: Ditto. * libc/sys/linux/linuxthreads/weaks.c: Ditto. * libc/sys/linux/linuxthreads/wrapsyscall.c: Ditto. * libc/sys/linux/linuxthreads/bits/initspin.h: Ditto. * libc/sys/linux/linuxthreads/bits/libc-lock.h: Ditto. * libc/sys/linux/linuxthreads/bits/libc-tsd.h: Ditto. * libc/sys/linux/linuxthreads/bits/local_lim.h: Ditto. * libc/sys/linux/linuxthreads/bits/posix_opt.h: Ditto. * libc/sys/linux/linuxthreads/bits/pthreadtypes.h: Ditto. * libc/sys/linux/linuxthreads/bits/sigthread.h: Ditto. * libc/sys/linux/linuxthreads/machine/Makefile.am: Ditto. * libc/sys/linux/linuxthreads/machine/Makefile.in: Ditto. * libc/sys/linux/linuxthreads/machine/aclocal.m4: Ditto. * libc/sys/linux/linuxthreads/machine/configure: Ditto. * libc/sys/linux/linuxthreads/machine/configure.in: Ditto. * libc/sys/linux/linuxthreads/machine/generic/generic-sysd: Ditto.ep.h * libc/sys/linux/linuxthreads/machine/i386/Makefile.am: Ditto. * libc/sys/linux/linuxthreads/machine/i386/Makefile.in: Ditto. * libc/sys/linux/linuxthreads/machine/i386/aclocal.m4: Ditto. * libc/sys/linux/linuxthreads/machine/i386/bp-asm.h: Ditto. * libc/sys/linux/linuxthreads/machine/i386/clone.S: Ditto. * libc/sys/linux/linuxthreads/machine/i386/configure: Ditto. * libc/sys/linux/linuxthreads/machine/i386/configure.in: Ditto. * libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.S: Ditto. * libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.h: Ditto. * libc/sys/linux/linuxthreads/machine/i386/pspinlock.c: Ditto. * libc/sys/linux/linuxthreads/machine/i386/pt-machine.h: Ditto. * libc/sys/linux/linuxthreads/machine/i386/sigcontextinfo.h: Ditto. * libc/sys/linux/linuxthreads/machine/i386/stackinfo.h: Ditto. * libc/sys/linux/linuxthreads/machine/i386/sysdep.S: Ditto. * libc/sys/linux/linuxthreads/machine/i386/sysdep.h: Ditto. * libc/sys/linux/linuxthreads/machine/i386/useldt.h: Ditto. * libc/sys/linux/machine/i386/dl-machine.h: Ditto. * libc/sys/linux/net/Makefile.am: Ditto. * libc/sys/linux/net/Makefile.in: Ditto. * libc/sys/linux/net/addr2ascii.3: Ditto. * libc/sys/linux/net/addr2ascii.c: Ditto. * libc/sys/linux/net/ascii2addr.c: Ditto. * libc/sys/linux/net/base64.c: Ditto. * libc/sys/linux/net/bindresvport.c: Ditto. * libc/sys/linux/net/byteorder.3: Ditto. * libc/sys/linux/net/ether_addr.c: Ditto. * libc/sys/linux/net/ethers.3: Ditto. * libc/sys/linux/net/getaddrinfo.3: Ditto. * libc/sys/linux/net/getaddrinfo.c: Ditto. * libc/sys/linux/net/gethostbydns.c: Ditto. * libc/sys/linux/net/gethostbyht.c: Ditto. * libc/sys/linux/net/gethostbyname.3: Ditto. * libc/sys/linux/net/gethostbynis.c: Ditto. * libc/sys/linux/net/gethostnamadr.c: Ditto. * libc/sys/linux/net/getifaddrs.3: Ditto. * libc/sys/linux/net/getifaddrs.c: Ditto. * libc/sys/linux/net/getipnodebyname.3: Ditto. * libc/sys/linux/net/getnameinfo.3: Ditto. * libc/sys/linux/net/getnameinfo.c: Ditto. * libc/sys/linux/net/getnetbydns.c: Ditto. * libc/sys/linux/net/getnetbyht.c: Ditto. * libc/sys/linux/net/getnetbynis.c: Ditto. * libc/sys/linux/net/getnetent.3: Ditto. * libc/sys/linux/net/getnetnamadr.c: Ditto. * libc/sys/linux/net/getproto.c: Ditto. * libc/sys/linux/net/getprotoent.3: Ditto. * libc/sys/linux/net/getprotoent.c: Ditto. * libc/sys/linux/net/getprotoname.c: Ditto. * libc/sys/linux/net/getservbyname.c: Ditto. * libc/sys/linux/net/getservbyport.c: Ditto. * libc/sys/linux/net/getservent.3: Ditto. * libc/sys/linux/net/getservent.c: Ditto. * libc/sys/linux/net/herror.c: Ditto. * libc/sys/linux/net/hesiod.3: Ditto. * libc/sys/linux/net/hesiod.c: Ditto. * libc/sys/linux/net/if_indextoname.3: Ditto. * libc/sys/linux/net/ifname.c: Ditto. * libc/sys/linux/net/inet.3: Ditto. * libc/sys/linux/net/inet6_option_s: Ditto.pace.3 * libc/sys/linux/net/inet6_rthdr_space.3: Ditto. * libc/sys/linux/net/inet_addr.c: Ditto. * libc/sys/linux/net/inet_lnaof.c: Ditto. * libc/sys/linux/net/inet_makeaddr.c: Ditto. * libc/sys/linux/net/inet_net.3: Ditto. * libc/sys/linux/net/inet_net_ntop.c: Ditto. * libc/sys/linux/net/inet_net_pton.c: Ditto. * libc/sys/linux/net/inet_neta.c: Ditto. * libc/sys/linux/net/inet_netof.c: Ditto. * libc/sys/linux/net/inet_network.c: Ditto. * libc/sys/linux/net/inet_ntoa.c: Ditto. * libc/sys/linux/net/inet_ntop.c: Ditto. * libc/sys/linux/net/inet_pton.c: Ditto. * libc/sys/linux/net/innetgr-stub.c: Ditto. * libc/sys/linux/net/ip6opt.c: Ditto. * libc/sys/linux/net/iso_addr.3: Ditto. * libc/sys/linux/net/iso_addr.c: Ditto. * libc/sys/linux/net/issetugid-stub.c: Ditto. * libc/sys/linux/net/linkaddr.3: Ditto. * libc/sys/linux/net/linkaddr.c: Ditto. * libc/sys/linux/net/map_v4v6.c: Ditto. * libc/sys/linux/net/name6.c: Ditto. * libc/sys/linux/net/namespace.h: Ditto. * libc/sys/linux/net/ns.3: Ditto. * libc/sys/linux/net/ns_addr.c: Ditto. * libc/sys/linux/net/ns_name.c: Ditto. * libc/sys/linux/net/ns_netint.c: Ditto. * libc/sys/linux/net/ns_ntoa.c: Ditto. * libc/sys/linux/net/ns_parse.c: Ditto. * libc/sys/linux/net/ns_print.c: Ditto. * libc/sys/linux/net/ns_ttl.c: Ditto. * libc/sys/linux/net/nsap_addr.c: Ditto. * libc/sys/linux/net/nsdispatch.3: Ditto. * libc/sys/linux/net/nsdispatch.c: Ditto. * libc/sys/linux/net/nslexer.c: Ditto. * libc/sys/linux/net/nslexer.l: Ditto. * libc/sys/linux/net/nsparser.c: Ditto. * libc/sys/linux/net/nsparser.h: Ditto. * libc/sys/linux/net/nsparser.y: Ditto. * libc/sys/linux/net/rcmd.3: Ditto. * libc/sys/linux/net/rcmd.c: Ditto. * libc/sys/linux/net/rcmdsh.3: Ditto. * libc/sys/linux/net/rcmdsh.c: Ditto. * libc/sys/linux/net/recv.c: Ditto. * libc/sys/linux/net/res_comp.c: Ditto. * libc/sys/linux/net/res_config.h: Ditto. * libc/sys/linux/net/res_data.c: Ditto. * libc/sys/linux/net/res_debug.c: Ditto. * libc/sys/linux/net/res_init.c: Ditto. * libc/sys/linux/net/res_mkquery.c: Ditto. * libc/sys/linux/net/res_mkupdate.c: Ditto. * libc/sys/linux/net/res_query.c: Ditto. * libc/sys/linux/net/res_send.c: Ditto. * libc/sys/linux/net/res_update.c: Ditto. * libc/sys/linux/net/resolver.3: Ditto. * libc/sys/linux/net/rthdr.c: Ditto. * libc/sys/linux/net/send.c: Ditto. * libc/sys/linux/net/un-namespace.h: Ditto. * libc/sys/linux/net/vars.c: Ditto. * libc/sys/linux/stdlib/COPYRIGHT: Ditto. * libc/sys/linux/stdlib/Makefile.am: Ditto. * libc/sys/linux/stdlib/Makefile.in: Ditto. * libc/sys/linux/stdlib/cclass.h: Ditto. * libc/sys/linux/stdlib/cname.h: Ditto. * libc/sys/linux/stdlib/collate.c: Ditto. * libc/sys/linux/stdlib/collate.h: Ditto. * libc/sys/linux/stdlib/collcmp.c: Ditto. * libc/sys/linux/stdlib/engine.c: Ditto. * libc/sys/linux/stdlib/fnmatch.3: Ditto. * libc/sys/linux/stdlib/fnmatch.c: Ditto. * libc/sys/linux/stdlib/glob.3: Ditto. * libc/sys/linux/stdlib/glob.c: Ditto. * libc/sys/linux/stdlib/reallocf.c: Ditto. * libc/sys/linux/stdlib/regcomp.c: Ditto. * libc/sys/linux/stdlib/regerror.c: Ditto. * libc/sys/linux/stdlib/regex.3: Ditto. * libc/sys/linux/stdlib/regex2.h: Ditto. * libc/sys/linux/stdlib/regexec.c: Ditto. * libc/sys/linux/stdlib/regfree.c: Ditto. * libc/sys/linux/stdlib/utils.h: Ditto. * libc/sys/linux/stdlib/wordexp.c: Ditto. * libc/sys/linux/stdlib/wordfree.c: Ditto. * libc/sys/linux/sys/dlfcn.h: Ditto. * libc/sys/linux/sys/elfclass.h: Ditto. * libc/sys/linux/sys/event.h: Ditto. * libc/sys/linux/sys/ioccom.h: Ditto. * libc/sys/linux/sys/libc-tsd.h: Ditto. * libc/sys/linux/sys/link.h: Ditto. * libc/sys/linux/sys/lock.h: Ditto. * libc/sys/linux/sys/param.h: Ditto. * libc/sys/linux/sys/socket.h: Ditto. * libc/sys/linux/sys/sockio.h: Ditto. --- newlib/ChangeLog | 568 +++ newlib/configure | 6 + newlib/configure.in | 6 + newlib/iconvdata/EUC-JP.irreversible | 2 + newlib/iconvdata/Makefile.am | 25 + newlib/iconvdata/Makefile.in | 389 ++ newlib/iconvdata/SJIS.irreversible | 5 + newlib/iconvdata/aclocal.m4 | 1181 +++++ newlib/iconvdata/configure | 3291 +++++++++++++ newlib/iconvdata/configure.in | 21 + newlib/iconvdata/dummy.c | 1 + newlib/iconvdata/euc-jp.c | 246 + newlib/iconvdata/gconv-modules | 1511 ++++++ newlib/iconvdata/jis0201.c | 58 + newlib/iconvdata/jis0201.h | 60 + newlib/iconvdata/jis0208.c | 5012 ++++++++++++++++++++ newlib/iconvdata/jis0208.h | 108 + newlib/iconvdata/jis0212.c | 3940 +++++++++++++++ newlib/iconvdata/jis0212.h | 110 + newlib/iconvdata/sjis.c | 4512 ++++++++++++++++++ newlib/libc/include/errno.h | 3 + newlib/libc/sys/linux/Makefile.am | 2 + newlib/libc/sys/linux/Makefile.in | 2 + newlib/libc/sys/linux/configure | 15 +- newlib/libc/sys/linux/configure.in | 13 +- newlib/libc/sys/linux/dl/Makefile.am | 25 + newlib/libc/sys/linux/dl/Makefile.in | 379 ++ newlib/libc/sys/linux/dl/abi-tag.h | 4 + newlib/libc/sys/linux/dl/atomicity.h | 56 + newlib/libc/sys/linux/dl/dl-addr.c | 101 + newlib/libc/sys/linux/dl/dl-cache.c | 271 ++ newlib/libc/sys/linux/dl/dl-cache.h | 140 + newlib/libc/sys/linux/dl/dl-close.c | 334 ++ newlib/libc/sys/linux/dl/dl-debug.c | 57 + newlib/libc/sys/linux/dl/dl-deps.c | 561 +++ newlib/libc/sys/linux/dl/dl-dst.h | 45 + newlib/libc/sys/linux/dl/dl-error.c | 189 + newlib/libc/sys/linux/dl/dl-fini.c | 172 + newlib/libc/sys/linux/dl/dl-init.c | 149 + newlib/libc/sys/linux/dl/dl-iteratephdr.c | 65 + newlib/libc/sys/linux/dl/dl-libc.c | 156 + newlib/libc/sys/linux/dl/dl-librecon.h | 87 + newlib/libc/sys/linux/dl/dl-load.c | 1830 +++++++ newlib/libc/sys/linux/dl/dl-lookup.c | 654 +++ newlib/libc/sys/linux/dl/dl-lookupcfg.h | 22 + newlib/libc/sys/linux/dl/dl-minimal.c | 250 + newlib/libc/sys/linux/dl/dl-misc.c | 277 ++ newlib/libc/sys/linux/dl/dl-object.c | 163 + newlib/libc/sys/linux/dl/dl-open.c | 487 ++ newlib/libc/sys/linux/dl/dl-osinfo.h | 108 + newlib/libc/sys/linux/dl/dl-profile.c | 539 +++ newlib/libc/sys/linux/dl/dl-profstub.c | 43 + newlib/libc/sys/linux/dl/dl-reloc.c | 213 + newlib/libc/sys/linux/dl/dl-runtime.c | 231 + newlib/libc/sys/linux/dl/dl-support.c | 184 + newlib/libc/sys/linux/dl/dl-sym.c | 158 + newlib/libc/sys/linux/dl/dl-version.c | 385 ++ newlib/libc/sys/linux/dl/dlfcn.h | 84 + newlib/libc/sys/linux/dl/do-lookup.h | 200 + newlib/libc/sys/linux/dl/do-rel.h | 118 + newlib/libc/sys/linux/dl/dynamic-link.h | 244 + newlib/libc/sys/linux/dl/kernel-features.h | 193 + newlib/libc/sys/linux/dl/ldsodefs.h | 535 +++ newlib/libc/sys/linux/dl/libintl.h | 2 + newlib/libc/sys/linux/dl/trusted-dirs.h | 7 + newlib/libc/sys/linux/dl/unsecvars.h | 19 + newlib/libc/sys/linux/gethostid.c | 114 + newlib/libc/sys/linux/iconv/Makefile.am | 27 + newlib/libc/sys/linux/iconv/Makefile.in | 375 ++ newlib/libc/sys/linux/iconv/categories.def | 344 ++ newlib/libc/sys/linux/iconv/dummy-repertoire.c | 37 + newlib/libc/sys/linux/iconv/gconv.c | 73 + newlib/libc/sys/linux/iconv/gconv_builtin.c | 84 + newlib/libc/sys/linux/iconv/gconv_builtin.h | 115 + newlib/libc/sys/linux/iconv/gconv_cache.c | 459 ++ newlib/libc/sys/linux/iconv/gconv_charset.h | 73 + newlib/libc/sys/linux/iconv/gconv_close.c | 65 + newlib/libc/sys/linux/iconv/gconv_conf.c | 680 +++ newlib/libc/sys/linux/iconv/gconv_db.c | 803 ++++ newlib/libc/sys/linux/iconv/gconv_dl.c | 237 + newlib/libc/sys/linux/iconv/gconv_int.h | 288 ++ newlib/libc/sys/linux/iconv/gconv_open.c | 326 ++ newlib/libc/sys/linux/iconv/gconv_simple.c | 1327 ++++++ newlib/libc/sys/linux/iconv/gconv_trans.c | 230 + newlib/libc/sys/linux/iconv/hash-string.h | 60 + newlib/libc/sys/linux/iconv/iconv.c | 96 + newlib/libc/sys/linux/iconv/iconv.h | 51 + newlib/libc/sys/linux/iconv/iconv_charmap.c | 563 +++ newlib/libc/sys/linux/iconv/iconv_close.c | 37 + newlib/libc/sys/linux/iconv/iconv_open.c | 65 + newlib/libc/sys/linux/iconv/iconvconfig.c | 1176 +++++ newlib/libc/sys/linux/iconv/iconvconfig.h | 67 + newlib/libc/sys/linux/iconv/loadinfo.h | 100 + newlib/libc/sys/linux/iconv/localeinfo.h | 209 + newlib/libc/sys/linux/iconv/loop.c | 450 ++ newlib/libc/sys/linux/iconv/skeleton.c | 696 +++ newlib/libc/sys/linux/iconv/strtab.c | 341 ++ newlib/libc/sys/linux/include/arpa/ftp.h | 109 + newlib/libc/sys/linux/include/arpa/inet.h | 156 + newlib/libc/sys/linux/include/arpa/nameser.h | 449 ++ .../libc/sys/linux/include/arpa/nameser_compat.h | 182 + newlib/libc/sys/linux/include/arpa/telnet.h | 342 ++ newlib/libc/sys/linux/include/arpa/tftp.h | 83 + newlib/libc/sys/linux/include/dl-hash.h | 74 + newlib/libc/sys/linux/include/dlfcn.h | 65 + newlib/libc/sys/linux/include/fnmatch.h | 59 + newlib/libc/sys/linux/include/gconv.h | 175 + newlib/libc/sys/linux/include/glob.h | 93 + newlib/libc/sys/linux/include/hesiod.h | 98 + newlib/libc/sys/linux/include/ifaddrs.h | 56 + newlib/libc/sys/linux/include/libc_private.h | 72 + newlib/libc/sys/linux/include/link.h | 269 ++ newlib/libc/sys/linux/include/namespace.h | 153 + newlib/libc/sys/linux/include/net/bpf.h | 326 ++ newlib/libc/sys/linux/include/net/bpf_compat.h | 55 + newlib/libc/sys/linux/include/net/bpfdesc.h | 120 + newlib/libc/sys/linux/include/net/bridge.h | 114 + newlib/libc/sys/linux/include/net/ethernet.h | 134 + newlib/libc/sys/linux/include/net/fddi.h | 106 + newlib/libc/sys/linux/include/net/if.h | 341 ++ newlib/libc/sys/linux/include/net/if_arc.h | 148 + newlib/libc/sys/linux/include/net/if_arp.h | 121 + newlib/libc/sys/linux/include/net/if_atm.h | 107 + newlib/libc/sys/linux/include/net/if_dl.h | 86 + newlib/libc/sys/linux/include/net/if_gif.h | 92 + newlib/libc/sys/linux/include/net/if_ieee80211.h | 273 ++ newlib/libc/sys/linux/include/net/if_llc.h | 160 + newlib/libc/sys/linux/include/net/if_media.h | 409 ++ newlib/libc/sys/linux/include/net/if_mib.h | 170 + newlib/libc/sys/linux/include/net/if_ppp.h | 137 + newlib/libc/sys/linux/include/net/if_pppvar.h | 109 + newlib/libc/sys/linux/include/net/if_slvar.h | 86 + newlib/libc/sys/linux/include/net/if_sppp.h | 215 + newlib/libc/sys/linux/include/net/if_stf.h | 38 + newlib/libc/sys/linux/include/net/if_tap.h | 73 + newlib/libc/sys/linux/include/net/if_tapvar.h | 66 + newlib/libc/sys/linux/include/net/if_tun.h | 48 + newlib/libc/sys/linux/include/net/if_tunvar.h | 56 + newlib/libc/sys/linux/include/net/if_types.h | 251 + newlib/libc/sys/linux/include/net/if_var.h | 469 ++ newlib/libc/sys/linux/include/net/if_vlan_var.h | 82 + newlib/libc/sys/linux/include/net/intrq.h | 45 + newlib/libc/sys/linux/include/net/iso88025.h | 143 + newlib/libc/sys/linux/include/net/net_osdep.h | 343 ++ newlib/libc/sys/linux/include/net/netisr.h | 89 + newlib/libc/sys/linux/include/net/pfil.h | 80 + newlib/libc/sys/linux/include/net/pfkeyv2.h | 392 ++ newlib/libc/sys/linux/include/net/ppp_comp.h | 151 + newlib/libc/sys/linux/include/net/ppp_defs.h | 157 + newlib/libc/sys/linux/include/net/radix.h | 170 + newlib/libc/sys/linux/include/net/raw_cb.h | 84 + newlib/libc/sys/linux/include/net/route.h | 301 ++ newlib/libc/sys/linux/include/net/slcompress.h | 161 + newlib/libc/sys/linux/include/net/slip.h | 62 + newlib/libc/sys/linux/include/net/zlib.h | 1013 ++++ newlib/libc/sys/linux/include/netconfig.h | 96 + newlib/libc/sys/linux/include/netdb.h | 277 ++ newlib/libc/sys/linux/include/netinet/icmp6.h | 740 +++ newlib/libc/sys/linux/include/netinet/icmp_var.h | 91 + newlib/libc/sys/linux/include/netinet/if_atm.h | 47 + newlib/libc/sys/linux/include/netinet/if_ether.h | 122 + newlib/libc/sys/linux/include/netinet/igmp.h | 96 + newlib/libc/sys/linux/include/netinet/igmp_var.h | 109 + newlib/libc/sys/linux/include/netinet/in.h | 569 +++ newlib/libc/sys/linux/include/netinet/in_gif.h | 42 + newlib/libc/sys/linux/include/netinet/in_pcb.h | 335 ++ newlib/libc/sys/linux/include/netinet/in_systm.h | 62 + newlib/libc/sys/linux/include/netinet/in_var.h | 243 + newlib/libc/sys/linux/include/netinet/ip.h | 190 + newlib/libc/sys/linux/include/netinet/ip6.h | 308 ++ .../libc/sys/linux/include/netinet/ip_dummynet.h | 361 ++ newlib/libc/sys/linux/include/netinet/ip_ecn.h | 49 + newlib/libc/sys/linux/include/netinet/ip_encap.h | 64 + newlib/libc/sys/linux/include/netinet/ip_flow.h | 57 + newlib/libc/sys/linux/include/netinet/ip_fw.h | 350 ++ newlib/libc/sys/linux/include/netinet/ip_icmp.h | 192 + newlib/libc/sys/linux/include/netinet/ip_mroute.h | 263 + newlib/libc/sys/linux/include/netinet/ip_var.h | 206 + newlib/libc/sys/linux/include/netinet/ipprotosw.h | 102 + newlib/libc/sys/linux/include/netinet/tcp.h | 137 + newlib/libc/sys/linux/include/netinet/tcp_debug.h | 83 + newlib/libc/sys/linux/include/netinet/tcp_fsm.h | 114 + newlib/libc/sys/linux/include/netinet/tcp_seq.h | 84 + newlib/libc/sys/linux/include/netinet/tcp_timer.h | 139 + newlib/libc/sys/linux/include/netinet/tcp_var.h | 486 ++ newlib/libc/sys/linux/include/netinet/tcpip.h | 63 + newlib/libc/sys/linux/include/netinet/udp.h | 51 + newlib/libc/sys/linux/include/netinet/udp_var.h | 114 + newlib/libc/sys/linux/include/netinet6/ah.h | 94 + newlib/libc/sys/linux/include/netinet6/ah6.h | 52 + newlib/libc/sys/linux/include/netinet6/esp.h | 109 + newlib/libc/sys/linux/include/netinet6/esp6.h | 48 + .../libc/sys/linux/include/netinet6/esp_rijndael.h | 39 + newlib/libc/sys/linux/include/netinet6/icmp6.h | 4 + newlib/libc/sys/linux/include/netinet6/in6.h | 651 +++ newlib/libc/sys/linux/include/netinet6/in6_gif.h | 42 + .../libc/sys/linux/include/netinet6/in6_ifattach.h | 46 + newlib/libc/sys/linux/include/netinet6/in6_pcb.h | 111 + .../libc/sys/linux/include/netinet6/in6_prefix.h | 91 + newlib/libc/sys/linux/include/netinet6/in6_var.h | 608 +++ newlib/libc/sys/linux/include/netinet6/ip6.h | 4 + newlib/libc/sys/linux/include/netinet6/ip6_ecn.h | 41 + newlib/libc/sys/linux/include/netinet6/ip6_fw.h | 231 + .../libc/sys/linux/include/netinet6/ip6_mroute.h | 277 ++ newlib/libc/sys/linux/include/netinet6/ip6_var.h | 354 ++ .../libc/sys/linux/include/netinet6/ip6protosw.h | 163 + newlib/libc/sys/linux/include/netinet6/ipcomp.h | 71 + newlib/libc/sys/linux/include/netinet6/ipcomp6.h | 46 + newlib/libc/sys/linux/include/netinet6/ipsec.h | 354 ++ newlib/libc/sys/linux/include/netinet6/ipsec6.h | 83 + newlib/libc/sys/linux/include/netinet6/mld6_var.h | 53 + newlib/libc/sys/linux/include/netinet6/nd6.h | 404 ++ newlib/libc/sys/linux/include/netinet6/pim6.h | 69 + newlib/libc/sys/linux/include/netinet6/pim6_var.h | 70 + newlib/libc/sys/linux/include/netinet6/raw_ip6.h | 54 + .../libc/sys/linux/include/netinet6/scope6_var.h | 46 + newlib/libc/sys/linux/include/netinet6/tcp6_var.h | 88 + newlib/libc/sys/linux/include/netinet6/udp6_var.h | 82 + newlib/libc/sys/linux/include/netns/idp.h | 52 + newlib/libc/sys/linux/include/netns/idp_var.h | 55 + newlib/libc/sys/linux/include/netns/ns.h | 154 + newlib/libc/sys/linux/include/netns/ns_error.h | 96 + newlib/libc/sys/linux/include/netns/ns_if.h | 89 + newlib/libc/sys/linux/include/netns/ns_pcb.h | 85 + newlib/libc/sys/linux/include/netns/sp.h | 58 + newlib/libc/sys/linux/include/netns/spidp.h | 68 + newlib/libc/sys/linux/include/netns/spp_debug.h | 65 + newlib/libc/sys/linux/include/netns/spp_timer.h | 128 + newlib/libc/sys/linux/include/netns/spp_var.h | 221 + newlib/libc/sys/linux/include/nsswitch.h | 184 + newlib/libc/sys/linux/include/regex.h | 106 + newlib/libc/sys/linux/include/resolv.h | 319 ++ newlib/libc/sys/linux/include/rpc/Makefile | 37 + newlib/libc/sys/linux/include/rpc/auth.h | 356 ++ newlib/libc/sys/linux/include/rpc/auth_des.h | 126 + newlib/libc/sys/linux/include/rpc/auth_kerb.h | 143 + newlib/libc/sys/linux/include/rpc/auth_unix.h | 84 + newlib/libc/sys/linux/include/rpc/clnt.h | 504 ++ newlib/libc/sys/linux/include/rpc/clnt_soc.h | 106 + newlib/libc/sys/linux/include/rpc/clnt_stat.h | 83 + newlib/libc/sys/linux/include/rpc/des.h | 83 + newlib/libc/sys/linux/include/rpc/des_crypt.h | 106 + newlib/libc/sys/linux/include/rpc/nettype.h | 64 + newlib/libc/sys/linux/include/rpc/pmap_clnt.h | 86 + newlib/libc/sys/linux/include/rpc/pmap_prot.h | 107 + newlib/libc/sys/linux/include/rpc/pmap_rmt.h | 65 + newlib/libc/sys/linux/include/rpc/raw.h | 58 + newlib/libc/sys/linux/include/rpc/rpc.h | 108 + newlib/libc/sys/linux/include/rpc/rpc_com.h | 83 + newlib/libc/sys/linux/include/rpc/rpc_msg.h | 214 + newlib/libc/sys/linux/include/rpc/rpcb_clnt.h | 85 + newlib/libc/sys/linux/include/rpc/rpcb_prot.h | 660 +++ newlib/libc/sys/linux/include/rpc/rpcb_prot.x | 554 +++ newlib/libc/sys/linux/include/rpc/rpcent.h | 69 + newlib/libc/sys/linux/include/rpc/svc.h | 429 ++ newlib/libc/sys/linux/include/rpc/svc_auth.h | 55 + newlib/libc/sys/linux/include/rpc/svc_dg.h | 51 + newlib/libc/sys/linux/include/rpc/svc_soc.h | 116 + newlib/libc/sys/linux/include/rpc/types.h | 108 + newlib/libc/sys/linux/include/rpc/xdr.h | 365 ++ newlib/libc/sys/linux/include/rune.h | 67 + newlib/libc/sys/linux/include/runetype.h | 113 + newlib/libc/sys/linux/include/semaphore.h | 1 + newlib/libc/sys/linux/include/setlocale.h | 37 + newlib/libc/sys/linux/include/un-namespace.h | 140 + newlib/libc/sys/linux/include/wordexp.h | 40 + newlib/libc/sys/linux/intl/Makefile.am | 36 + newlib/libc/sys/linux/intl/Makefile.in | 386 ++ newlib/libc/sys/linux/intl/bindtextdom.c | 387 ++ newlib/libc/sys/linux/intl/catgets.c | 142 + newlib/libc/sys/linux/intl/catgetsinfo.h | 56 + newlib/libc/sys/linux/intl/config.h | 26 + newlib/libc/sys/linux/intl/dcgettext.c | 59 + newlib/libc/sys/linux/intl/dcigettext.c | 1284 +++++ newlib/libc/sys/linux/intl/dcngettext.c | 61 + newlib/libc/sys/linux/intl/dgettext.c | 62 + newlib/libc/sys/linux/intl/dngettext.c | 64 + newlib/libc/sys/linux/intl/explodename.c | 204 + newlib/libc/sys/linux/intl/finddomain.c | 220 + newlib/libc/sys/linux/intl/gettext.c | 75 + newlib/libc/sys/linux/intl/gettext.h | 103 + newlib/libc/sys/linux/intl/gettextP.h | 256 + newlib/libc/sys/linux/intl/hash-string.h | 60 + newlib/libc/sys/linux/intl/l10nflist.c | 421 ++ newlib/libc/sys/linux/intl/loadinfo.h | 100 + newlib/libc/sys/linux/intl/loadmsgcat.c | 562 +++ newlib/libc/sys/linux/intl/locale.alias | 75 + newlib/libc/sys/linux/intl/localealias.c | 443 ++ newlib/libc/sys/linux/intl/ngettext.c | 77 + newlib/libc/sys/linux/intl/open_catalog.c | 334 ++ newlib/libc/sys/linux/intl/plural.c | 1319 ++++++ newlib/libc/sys/linux/intl/plural.y | 406 ++ newlib/libc/sys/linux/intl/stpcpy.c | 10 + newlib/libc/sys/linux/intl/textdomain.c | 155 + newlib/libc/sys/linux/linuxthreads/LICENSE | 501 ++ newlib/libc/sys/linux/linuxthreads/Makefile.am | 139 + newlib/libc/sys/linux/linuxthreads/Makefile.in | 705 +++ newlib/libc/sys/linux/linuxthreads/aclocal.m4 | 1191 +++++ newlib/libc/sys/linux/linuxthreads/attr.c | 308 ++ newlib/libc/sys/linux/linuxthreads/barrier.c | 125 + newlib/libc/sys/linux/linuxthreads/bits/initspin.h | 28 + .../libc/sys/linux/linuxthreads/bits/libc-lock.h | 327 ++ newlib/libc/sys/linux/linuxthreads/bits/libc-tsd.h | 44 + .../libc/sys/linux/linuxthreads/bits/local_lim.h | 77 + .../libc/sys/linux/linuxthreads/bits/posix_opt.h | 141 + .../sys/linux/linuxthreads/bits/pthreadtypes.h | 142 + .../libc/sys/linux/linuxthreads/bits/sigthread.h | 38 + newlib/libc/sys/linux/linuxthreads/bp-sym.h | 26 + newlib/libc/sys/linux/linuxthreads/cancel.c | 220 + newlib/libc/sys/linux/linuxthreads/condvar.c | 301 ++ newlib/libc/sys/linux/linuxthreads/config.h | 14 + newlib/libc/sys/linux/linuxthreads/configure | 3461 ++++++++++++++ newlib/libc/sys/linux/linuxthreads/configure.in | 31 + newlib/libc/sys/linux/linuxthreads/defs.awk | 27 + newlib/libc/sys/linux/linuxthreads/ecmutex.c | 157 + newlib/libc/sys/linux/linuxthreads/events.c | 37 + newlib/libc/sys/linux/linuxthreads/getcpuclockid.c | 40 + newlib/libc/sys/linux/linuxthreads/getreent.c | 11 + newlib/libc/sys/linux/linuxthreads/internals.h | 576 +++ newlib/libc/sys/linux/linuxthreads/join.c | 218 + newlib/libc/sys/linux/linuxthreads/joinrace.c | 48 + .../libc/sys/linux/linuxthreads/kernel-features.h | 193 + newlib/libc/sys/linux/linuxthreads/libc-internal.h | 29 + newlib/libc/sys/linux/linuxthreads/libc-symbols.h | 352 ++ .../libc/sys/linux/linuxthreads/linuxthreads.texi | 1630 +++++++ newlib/libc/sys/linux/linuxthreads/lockfile.c | 97 + .../sys/linux/linuxthreads/machine/Makefile.am | 10 + .../sys/linux/linuxthreads/machine/Makefile.in | 356 ++ .../libc/sys/linux/linuxthreads/machine/aclocal.m4 | 1191 +++++ .../libc/sys/linux/linuxthreads/machine/configure | 3430 ++++++++++++++ .../sys/linux/linuxthreads/machine/configure.in | 26 + .../linuxthreads/machine/generic/generic-sysdep.h | 46 + .../linux/linuxthreads/machine/i386/Makefile.am | 26 + .../linux/linuxthreads/machine/i386/Makefile.in | 411 ++ .../sys/linux/linuxthreads/machine/i386/aclocal.m4 | 1191 +++++ .../sys/linux/linuxthreads/machine/i386/bp-asm.h | 144 + .../sys/linux/linuxthreads/machine/i386/clone.S | 95 + .../sys/linux/linuxthreads/machine/i386/configure | 3351 +++++++++++++ .../linux/linuxthreads/machine/i386/configure.in | 22 + .../linux/linuxthreads/machine/i386/i386-sysdep.S | 60 + .../linux/linuxthreads/machine/i386/i386-sysdep.h | 130 + .../linux/linuxthreads/machine/i386/pspinlock.c | 97 + .../linux/linuxthreads/machine/i386/pt-machine.h | 98 + .../linuxthreads/machine/i386/sigcontextinfo.h | 51 + .../linux/linuxthreads/machine/i386/stackinfo.h | 28 + .../sys/linux/linuxthreads/machine/i386/sysdep.S | 41 + .../sys/linux/linuxthreads/machine/i386/sysdep.h | 291 ++ .../sys/linux/linuxthreads/machine/i386/useldt.h | 205 + newlib/libc/sys/linux/linuxthreads/manager.c | 981 ++++ newlib/libc/sys/linux/linuxthreads/mq_notify.c | 106 + newlib/libc/sys/linux/linuxthreads/mutex.c | 366 ++ newlib/libc/sys/linux/linuxthreads/no-tsd.c | 34 + newlib/libc/sys/linux/linuxthreads/oldsemaphore.c | 245 + newlib/libc/sys/linux/linuxthreads/posix-timer.h | 210 + newlib/libc/sys/linux/linuxthreads/prio.c | 65 + newlib/libc/sys/linux/linuxthreads/proc_service.h | 70 + newlib/libc/sys/linux/linuxthreads/pt-machine.c | 25 + .../libc/sys/linux/linuxthreads/ptclock_gettime.c | 46 + .../libc/sys/linux/linuxthreads/ptclock_settime.c | 33 + newlib/libc/sys/linux/linuxthreads/ptfork.c | 120 + newlib/libc/sys/linux/linuxthreads/pthread.c | 1248 +++++ newlib/libc/sys/linux/linuxthreads/ptlongjmp.c | 73 + newlib/libc/sys/linux/linuxthreads/queue.h | 61 + newlib/libc/sys/linux/linuxthreads/reent.c | 18 + newlib/libc/sys/linux/linuxthreads/reqsyscalls.c | 20 + newlib/libc/sys/linux/linuxthreads/restart.h | 49 + newlib/libc/sys/linux/linuxthreads/rwlock.c | 658 +++ newlib/libc/sys/linux/linuxthreads/semaphore.c | 304 ++ newlib/libc/sys/linux/linuxthreads/semaphore.h | 88 + newlib/libc/sys/linux/linuxthreads/shlib-compat.h | 84 + newlib/libc/sys/linux/linuxthreads/signals.c | 243 + newlib/libc/sys/linux/linuxthreads/specific.c | 228 + newlib/libc/sys/linux/linuxthreads/spinlock.c | 774 +++ newlib/libc/sys/linux/linuxthreads/spinlock.h | 218 + newlib/libc/sys/linux/linuxthreads/sysctl.c | 43 + newlib/libc/sys/linux/linuxthreads/td_init.c | 32 + newlib/libc/sys/linux/linuxthreads/td_log.c | 32 + .../libc/sys/linux/linuxthreads/td_symbol_list.c | 55 + .../sys/linux/linuxthreads/td_ta_clear_event.c | 53 + newlib/libc/sys/linux/linuxthreads/td_ta_delete.c | 58 + .../sys/linux/linuxthreads/td_ta_enable_stats.c | 35 + .../libc/sys/linux/linuxthreads/td_ta_event_addr.c | 73 + .../sys/linux/linuxthreads/td_ta_event_getmsg.c | 128 + .../sys/linux/linuxthreads/td_ta_get_nthreads.c | 42 + newlib/libc/sys/linux/linuxthreads/td_ta_get_ph.c | 36 + .../libc/sys/linux/linuxthreads/td_ta_get_stats.c | 35 + .../libc/sys/linux/linuxthreads/td_ta_map_id2thr.c | 66 + .../sys/linux/linuxthreads/td_ta_map_lwp2thr.c | 81 + newlib/libc/sys/linux/linuxthreads/td_ta_new.c | 132 + .../sys/linux/linuxthreads/td_ta_reset_stats.c | 35 + .../libc/sys/linux/linuxthreads/td_ta_set_event.c | 53 + .../sys/linux/linuxthreads/td_ta_setconcurrency.c | 35 + .../libc/sys/linux/linuxthreads/td_ta_thr_iter.c | 142 + .../libc/sys/linux/linuxthreads/td_ta_tsd_iter.c | 55 + .../sys/linux/linuxthreads/td_thr_clear_event.c | 57 + .../libc/sys/linux/linuxthreads/td_thr_dbresume.c | 30 + .../libc/sys/linux/linuxthreads/td_thr_dbsuspend.c | 30 + .../sys/linux/linuxthreads/td_thr_event_enable.c | 41 + .../sys/linux/linuxthreads/td_thr_event_getmsg.c | 60 + .../libc/sys/linux/linuxthreads/td_thr_get_info.c | 76 + .../libc/sys/linux/linuxthreads/td_thr_getfpregs.c | 49 + .../libc/sys/linux/linuxthreads/td_thr_getgregs.c | 49 + .../libc/sys/linux/linuxthreads/td_thr_getxregs.c | 30 + .../sys/linux/linuxthreads/td_thr_getxregsize.c | 30 + .../libc/sys/linux/linuxthreads/td_thr_set_event.c | 57 + .../libc/sys/linux/linuxthreads/td_thr_setfpregs.c | 46 + .../libc/sys/linux/linuxthreads/td_thr_setgregs.c | 46 + .../libc/sys/linux/linuxthreads/td_thr_setprio.c | 30 + .../sys/linux/linuxthreads/td_thr_setsigpending.c | 31 + .../libc/sys/linux/linuxthreads/td_thr_setxregs.c | 30 + .../sys/linux/linuxthreads/td_thr_sigsetmask.c | 30 + newlib/libc/sys/linux/linuxthreads/td_thr_tsd.c | 76 + .../libc/sys/linux/linuxthreads/td_thr_validate.c | 57 + newlib/libc/sys/linux/linuxthreads/testrtsig.h | 36 + newlib/libc/sys/linux/linuxthreads/thread_db.h | 439 ++ newlib/libc/sys/linux/linuxthreads/thread_dbP.h | 105 + newlib/libc/sys/linux/linuxthreads/timer_create.c | 179 + newlib/libc/sys/linux/linuxthreads/timer_delete.c | 70 + .../libc/sys/linux/linuxthreads/timer_getoverr.c | 45 + newlib/libc/sys/linux/linuxthreads/timer_gettime.c | 71 + .../libc/sys/linux/linuxthreads/timer_routines.c | 584 +++ newlib/libc/sys/linux/linuxthreads/timer_settime.c | 137 + newlib/libc/sys/linux/linuxthreads/tst-cancel.c | 213 + newlib/libc/sys/linux/linuxthreads/tst-context.c | 109 + newlib/libc/sys/linux/linuxthreads/tststack.c | 72 + newlib/libc/sys/linux/linuxthreads/unload.c | 45 + newlib/libc/sys/linux/linuxthreads/weaks.c | 121 + newlib/libc/sys/linux/linuxthreads/wrapsyscall.c | 251 + newlib/libc/sys/linux/machine/i386/dl-machine.h | 403 ++ newlib/libc/sys/linux/net/Makefile.am | 89 + newlib/libc/sys/linux/net/Makefile.in | 466 ++ newlib/libc/sys/linux/net/addr2ascii.3 | 222 + newlib/libc/sys/linux/net/addr2ascii.c | 86 + newlib/libc/sys/linux/net/ascii2addr.c | 70 + newlib/libc/sys/linux/net/base64.c | 315 ++ newlib/libc/sys/linux/net/bindresvport.c | 160 + newlib/libc/sys/linux/net/byteorder.3 | 84 + newlib/libc/sys/linux/net/ether_addr.c | 231 + newlib/libc/sys/linux/net/ethers.3 | 197 + newlib/libc/sys/linux/net/getaddrinfo.3 | 620 +++ newlib/libc/sys/linux/net/getaddrinfo.c | 1979 ++++++++ newlib/libc/sys/linux/net/gethostbydns.c | 815 ++++ newlib/libc/sys/linux/net/gethostbyht.c | 285 ++ newlib/libc/sys/linux/net/gethostbyname.3 | 380 ++ newlib/libc/sys/linux/net/gethostbynis.c | 281 ++ newlib/libc/sys/linux/net/gethostnamadr.c | 221 + newlib/libc/sys/linux/net/getifaddrs.3 | 164 + newlib/libc/sys/linux/net/getifaddrs.c | 401 ++ newlib/libc/sys/linux/net/getipnodebyname.3 | 461 ++ newlib/libc/sys/linux/net/getnameinfo.3 | 311 ++ newlib/libc/sys/linux/net/getnameinfo.c | 372 ++ newlib/libc/sys/linux/net/getnetbydns.c | 327 ++ newlib/libc/sys/linux/net/getnetbyht.c | 183 + newlib/libc/sys/linux/net/getnetbynis.c | 190 + newlib/libc/sys/linux/net/getnetent.3 | 172 + newlib/libc/sys/linux/net/getnetnamadr.c | 113 + newlib/libc/sys/linux/net/getproto.c | 57 + newlib/libc/sys/linux/net/getprotoent.3 | 149 + newlib/libc/sys/linux/net/getprotoent.c | 121 + newlib/libc/sys/linux/net/getprotoname.c | 64 + newlib/libc/sys/linux/net/getservbyname.c | 81 + newlib/libc/sys/linux/net/getservbyport.c | 76 + newlib/libc/sys/linux/net/getservent.3 | 158 + newlib/libc/sys/linux/net/getservent.c | 282 ++ newlib/libc/sys/linux/net/herror.c | 103 + newlib/libc/sys/linux/net/hesiod.3 | 159 + newlib/libc/sys/linux/net/hesiod.c | 600 +++ newlib/libc/sys/linux/net/if_indextoname.3 | 142 + newlib/libc/sys/linux/net/ifname.c | 227 + newlib/libc/sys/linux/net/inet.3 | 271 ++ newlib/libc/sys/linux/net/inet6_option_space.3 | 445 ++ newlib/libc/sys/linux/net/inet6_rthdr_space.3 | 323 ++ newlib/libc/sys/linux/net/inet_addr.c | 201 + newlib/libc/sys/linux/net/inet_lnaof.c | 69 + newlib/libc/sys/linux/net/inet_makeaddr.c | 72 + newlib/libc/sys/linux/net/inet_net.3 | 157 + newlib/libc/sys/linux/net/inet_net_ntop.c | 148 + newlib/libc/sys/linux/net/inet_net_pton.c | 214 + newlib/libc/sys/linux/net/inet_neta.c | 92 + newlib/libc/sys/linux/net/inet_netof.c | 68 + newlib/libc/sys/linux/net/inet_network.c | 100 + newlib/libc/sys/linux/net/inet_ntoa.c | 67 + newlib/libc/sys/linux/net/inet_ntop.c | 200 + newlib/libc/sys/linux/net/inet_pton.c | 222 + newlib/libc/sys/linux/net/innetgr-stub.c | 7 + newlib/libc/sys/linux/net/ip6opt.c | 387 ++ newlib/libc/sys/linux/net/iso_addr.3 | 113 + newlib/libc/sys/linux/net/iso_addr.c | 119 + newlib/libc/sys/linux/net/issetugid-stub.c | 5 + newlib/libc/sys/linux/net/linkaddr.3 | 140 + newlib/libc/sys/linux/net/linkaddr.c | 160 + newlib/libc/sys/linux/net/map_v4v6.c | 128 + newlib/libc/sys/linux/net/name6.c | 1812 +++++++ newlib/libc/sys/linux/net/namespace.h | 152 + newlib/libc/sys/linux/net/ns.3 | 133 + newlib/libc/sys/linux/net/ns_addr.c | 239 + newlib/libc/sys/linux/net/ns_name.c | 592 +++ newlib/libc/sys/linux/net/ns_netint.c | 53 + newlib/libc/sys/linux/net/ns_ntoa.c | 104 + newlib/libc/sys/linux/net/ns_parse.c | 189 + newlib/libc/sys/linux/net/ns_print.c | 744 +++ newlib/libc/sys/linux/net/ns_ttl.c | 150 + newlib/libc/sys/linux/net/nsap_addr.c | 113 + newlib/libc/sys/linux/net/nsdispatch.3 | 231 + newlib/libc/sys/linux/net/nsdispatch.c | 266 ++ newlib/libc/sys/linux/net/nslexer.c | 1712 +++++++ newlib/libc/sys/linux/net/nslexer.l | 114 + newlib/libc/sys/linux/net/nsparser.c | 541 +++ newlib/libc/sys/linux/net/nsparser.h | 13 + newlib/libc/sys/linux/net/nsparser.y | 178 + newlib/libc/sys/linux/net/rcmd.3 | 298 ++ newlib/libc/sys/linux/net/rcmd.c | 779 +++ newlib/libc/sys/linux/net/rcmdsh.3 | 116 + newlib/libc/sys/linux/net/rcmdsh.c | 169 + newlib/libc/sys/linux/net/recv.c | 54 + newlib/libc/sys/linux/net/res_comp.c | 268 ++ newlib/libc/sys/linux/net/res_config.h | 10 + newlib/libc/sys/linux/net/res_data.c | 82 + newlib/libc/sys/linux/net/res_debug.c | 1003 ++++ newlib/libc/sys/linux/net/res_init.c | 585 +++ newlib/libc/sys/linux/net/res_mkquery.c | 245 + newlib/libc/sys/linux/net/res_mkupdate.c | 412 ++ newlib/libc/sys/linux/net/res_query.c | 424 ++ newlib/libc/sys/linux/net/res_send.c | 954 ++++ newlib/libc/sys/linux/net/res_update.c | 515 ++ newlib/libc/sys/linux/net/resolver.3 | 422 ++ newlib/libc/sys/linux/net/rthdr.c | 319 ++ newlib/libc/sys/linux/net/send.c | 54 + newlib/libc/sys/linux/net/un-namespace.h | 134 + newlib/libc/sys/linux/net/vars.c | 45 + newlib/libc/sys/linux/sethostid.c | 2 + newlib/libc/sys/linux/stdlib/COPYRIGHT | 56 + newlib/libc/sys/linux/stdlib/Makefile.am | 44 + newlib/libc/sys/linux/stdlib/Makefile.in | 380 ++ newlib/libc/sys/linux/stdlib/cclass.h | 63 + newlib/libc/sys/linux/stdlib/cname.h | 142 + newlib/libc/sys/linux/stdlib/collate.c | 217 + newlib/libc/sys/linux/stdlib/collate.h | 67 + newlib/libc/sys/linux/stdlib/collcmp.c | 85 + newlib/libc/sys/linux/stdlib/engine.c | 1140 +++++ newlib/libc/sys/linux/stdlib/fnmatch.3 | 151 + newlib/libc/sys/linux/stdlib/fnmatch.c | 233 + newlib/libc/sys/linux/stdlib/glob.3 | 466 ++ newlib/libc/sys/linux/stdlib/glob.c | 909 ++++ newlib/libc/sys/linux/stdlib/reallocf.c | 41 + newlib/libc/sys/linux/stdlib/regcomp.c | 2089 ++++++++ newlib/libc/sys/linux/stdlib/regerror.c | 179 + newlib/libc/sys/linux/stdlib/regex.3 | 701 +++ newlib/libc/sys/linux/stdlib/regex2.h | 177 + newlib/libc/sys/linux/stdlib/regexec.c | 183 + newlib/libc/sys/linux/stdlib/regfree.c | 87 + newlib/libc/sys/linux/stdlib/utils.h | 58 + newlib/libc/sys/linux/stdlib/wordexp.c | 186 + newlib/libc/sys/linux/stdlib/wordfree.c | 38 + newlib/libc/sys/linux/sys/dlfcn.h | 64 + newlib/libc/sys/linux/sys/elfclass.h | 14 + newlib/libc/sys/linux/sys/event.h | 196 + newlib/libc/sys/linux/sys/ioccom.h | 75 + newlib/libc/sys/linux/sys/libc-tsd.h | 52 + newlib/libc/sys/linux/sys/link.h | 4 + newlib/libc/sys/linux/sys/lock.h | 29 + newlib/libc/sys/linux/sys/param.h | 57 + newlib/libc/sys/linux/sys/socket.h | 471 ++ newlib/libc/sys/linux/sys/sockio.h | 115 + 564 files changed, 147374 insertions(+), 3 deletions(-) create mode 100644 newlib/iconvdata/EUC-JP.irreversible create mode 100644 newlib/iconvdata/Makefile.am create mode 100644 newlib/iconvdata/Makefile.in create mode 100644 newlib/iconvdata/SJIS.irreversible create mode 100644 newlib/iconvdata/aclocal.m4 create mode 100755 newlib/iconvdata/configure create mode 100644 newlib/iconvdata/configure.in create mode 100644 newlib/iconvdata/dummy.c create mode 100644 newlib/iconvdata/euc-jp.c create mode 100644 newlib/iconvdata/gconv-modules create mode 100644 newlib/iconvdata/jis0201.c create mode 100644 newlib/iconvdata/jis0201.h create mode 100644 newlib/iconvdata/jis0208.c create mode 100644 newlib/iconvdata/jis0208.h create mode 100644 newlib/iconvdata/jis0212.c create mode 100644 newlib/iconvdata/jis0212.h create mode 100644 newlib/iconvdata/sjis.c create mode 100644 newlib/libc/sys/linux/dl/Makefile.am create mode 100644 newlib/libc/sys/linux/dl/Makefile.in create mode 100644 newlib/libc/sys/linux/dl/abi-tag.h create mode 100644 newlib/libc/sys/linux/dl/atomicity.h create mode 100644 newlib/libc/sys/linux/dl/dl-addr.c create mode 100644 newlib/libc/sys/linux/dl/dl-cache.c create mode 100644 newlib/libc/sys/linux/dl/dl-cache.h create mode 100644 newlib/libc/sys/linux/dl/dl-close.c create mode 100644 newlib/libc/sys/linux/dl/dl-debug.c create mode 100644 newlib/libc/sys/linux/dl/dl-deps.c create mode 100644 newlib/libc/sys/linux/dl/dl-dst.h create mode 100644 newlib/libc/sys/linux/dl/dl-error.c create mode 100644 newlib/libc/sys/linux/dl/dl-fini.c create mode 100644 newlib/libc/sys/linux/dl/dl-init.c create mode 100644 newlib/libc/sys/linux/dl/dl-iteratephdr.c create mode 100644 newlib/libc/sys/linux/dl/dl-libc.c create mode 100644 newlib/libc/sys/linux/dl/dl-librecon.h create mode 100644 newlib/libc/sys/linux/dl/dl-load.c create mode 100644 newlib/libc/sys/linux/dl/dl-lookup.c create mode 100644 newlib/libc/sys/linux/dl/dl-lookupcfg.h create mode 100644 newlib/libc/sys/linux/dl/dl-minimal.c create mode 100644 newlib/libc/sys/linux/dl/dl-misc.c create mode 100644 newlib/libc/sys/linux/dl/dl-object.c create mode 100644 newlib/libc/sys/linux/dl/dl-open.c create mode 100644 newlib/libc/sys/linux/dl/dl-osinfo.h create mode 100644 newlib/libc/sys/linux/dl/dl-profile.c create mode 100644 newlib/libc/sys/linux/dl/dl-profstub.c create mode 100644 newlib/libc/sys/linux/dl/dl-reloc.c create mode 100644 newlib/libc/sys/linux/dl/dl-runtime.c create mode 100644 newlib/libc/sys/linux/dl/dl-support.c create mode 100644 newlib/libc/sys/linux/dl/dl-sym.c create mode 100644 newlib/libc/sys/linux/dl/dl-version.c create mode 100644 newlib/libc/sys/linux/dl/dlfcn.h create mode 100644 newlib/libc/sys/linux/dl/do-lookup.h create mode 100644 newlib/libc/sys/linux/dl/do-rel.h create mode 100644 newlib/libc/sys/linux/dl/dynamic-link.h create mode 100644 newlib/libc/sys/linux/dl/kernel-features.h create mode 100644 newlib/libc/sys/linux/dl/ldsodefs.h create mode 100644 newlib/libc/sys/linux/dl/libintl.h create mode 100644 newlib/libc/sys/linux/dl/trusted-dirs.h create mode 100644 newlib/libc/sys/linux/dl/unsecvars.h create mode 100644 newlib/libc/sys/linux/gethostid.c create mode 100644 newlib/libc/sys/linux/iconv/Makefile.am create mode 100644 newlib/libc/sys/linux/iconv/Makefile.in create mode 100644 newlib/libc/sys/linux/iconv/categories.def create mode 100644 newlib/libc/sys/linux/iconv/dummy-repertoire.c create mode 100644 newlib/libc/sys/linux/iconv/gconv.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_builtin.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_builtin.h create mode 100644 newlib/libc/sys/linux/iconv/gconv_cache.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_charset.h create mode 100644 newlib/libc/sys/linux/iconv/gconv_close.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_conf.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_db.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_dl.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_int.h create mode 100644 newlib/libc/sys/linux/iconv/gconv_open.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_simple.c create mode 100644 newlib/libc/sys/linux/iconv/gconv_trans.c create mode 100644 newlib/libc/sys/linux/iconv/hash-string.h create mode 100644 newlib/libc/sys/linux/iconv/iconv.c create mode 100644 newlib/libc/sys/linux/iconv/iconv.h create mode 100644 newlib/libc/sys/linux/iconv/iconv_charmap.c create mode 100644 newlib/libc/sys/linux/iconv/iconv_close.c create mode 100644 newlib/libc/sys/linux/iconv/iconv_open.c create mode 100644 newlib/libc/sys/linux/iconv/iconvconfig.c create mode 100644 newlib/libc/sys/linux/iconv/iconvconfig.h create mode 100644 newlib/libc/sys/linux/iconv/loadinfo.h create mode 100644 newlib/libc/sys/linux/iconv/localeinfo.h create mode 100644 newlib/libc/sys/linux/iconv/loop.c create mode 100644 newlib/libc/sys/linux/iconv/skeleton.c create mode 100644 newlib/libc/sys/linux/iconv/strtab.c create mode 100644 newlib/libc/sys/linux/include/arpa/ftp.h create mode 100644 newlib/libc/sys/linux/include/arpa/inet.h create mode 100644 newlib/libc/sys/linux/include/arpa/nameser.h create mode 100644 newlib/libc/sys/linux/include/arpa/nameser_compat.h create mode 100644 newlib/libc/sys/linux/include/arpa/telnet.h create mode 100644 newlib/libc/sys/linux/include/arpa/tftp.h create mode 100644 newlib/libc/sys/linux/include/dl-hash.h create mode 100644 newlib/libc/sys/linux/include/dlfcn.h create mode 100644 newlib/libc/sys/linux/include/fnmatch.h create mode 100644 newlib/libc/sys/linux/include/gconv.h create mode 100644 newlib/libc/sys/linux/include/glob.h create mode 100644 newlib/libc/sys/linux/include/hesiod.h create mode 100644 newlib/libc/sys/linux/include/ifaddrs.h create mode 100644 newlib/libc/sys/linux/include/libc_private.h create mode 100644 newlib/libc/sys/linux/include/link.h create mode 100644 newlib/libc/sys/linux/include/namespace.h create mode 100644 newlib/libc/sys/linux/include/net/bpf.h create mode 100644 newlib/libc/sys/linux/include/net/bpf_compat.h create mode 100644 newlib/libc/sys/linux/include/net/bpfdesc.h create mode 100644 newlib/libc/sys/linux/include/net/bridge.h create mode 100644 newlib/libc/sys/linux/include/net/ethernet.h create mode 100644 newlib/libc/sys/linux/include/net/fddi.h create mode 100644 newlib/libc/sys/linux/include/net/if.h create mode 100644 newlib/libc/sys/linux/include/net/if_arc.h create mode 100644 newlib/libc/sys/linux/include/net/if_arp.h create mode 100644 newlib/libc/sys/linux/include/net/if_atm.h create mode 100644 newlib/libc/sys/linux/include/net/if_dl.h create mode 100644 newlib/libc/sys/linux/include/net/if_gif.h create mode 100644 newlib/libc/sys/linux/include/net/if_ieee80211.h create mode 100644 newlib/libc/sys/linux/include/net/if_llc.h create mode 100644 newlib/libc/sys/linux/include/net/if_media.h create mode 100644 newlib/libc/sys/linux/include/net/if_mib.h create mode 100644 newlib/libc/sys/linux/include/net/if_ppp.h create mode 100644 newlib/libc/sys/linux/include/net/if_pppvar.h create mode 100644 newlib/libc/sys/linux/include/net/if_slvar.h create mode 100644 newlib/libc/sys/linux/include/net/if_sppp.h create mode 100644 newlib/libc/sys/linux/include/net/if_stf.h create mode 100644 newlib/libc/sys/linux/include/net/if_tap.h create mode 100644 newlib/libc/sys/linux/include/net/if_tapvar.h create mode 100644 newlib/libc/sys/linux/include/net/if_tun.h create mode 100644 newlib/libc/sys/linux/include/net/if_tunvar.h create mode 100644 newlib/libc/sys/linux/include/net/if_types.h create mode 100644 newlib/libc/sys/linux/include/net/if_var.h create mode 100644 newlib/libc/sys/linux/include/net/if_vlan_var.h create mode 100644 newlib/libc/sys/linux/include/net/intrq.h create mode 100644 newlib/libc/sys/linux/include/net/iso88025.h create mode 100644 newlib/libc/sys/linux/include/net/net_osdep.h create mode 100644 newlib/libc/sys/linux/include/net/netisr.h create mode 100644 newlib/libc/sys/linux/include/net/pfil.h create mode 100644 newlib/libc/sys/linux/include/net/pfkeyv2.h create mode 100644 newlib/libc/sys/linux/include/net/ppp_comp.h create mode 100644 newlib/libc/sys/linux/include/net/ppp_defs.h create mode 100644 newlib/libc/sys/linux/include/net/radix.h create mode 100644 newlib/libc/sys/linux/include/net/raw_cb.h create mode 100644 newlib/libc/sys/linux/include/net/route.h create mode 100644 newlib/libc/sys/linux/include/net/slcompress.h create mode 100644 newlib/libc/sys/linux/include/net/slip.h create mode 100644 newlib/libc/sys/linux/include/net/zlib.h create mode 100644 newlib/libc/sys/linux/include/netconfig.h create mode 100644 newlib/libc/sys/linux/include/netdb.h create mode 100644 newlib/libc/sys/linux/include/netinet/icmp6.h create mode 100644 newlib/libc/sys/linux/include/netinet/icmp_var.h create mode 100644 newlib/libc/sys/linux/include/netinet/if_atm.h create mode 100644 newlib/libc/sys/linux/include/netinet/if_ether.h create mode 100644 newlib/libc/sys/linux/include/netinet/igmp.h create mode 100644 newlib/libc/sys/linux/include/netinet/igmp_var.h create mode 100644 newlib/libc/sys/linux/include/netinet/in.h create mode 100644 newlib/libc/sys/linux/include/netinet/in_gif.h create mode 100644 newlib/libc/sys/linux/include/netinet/in_pcb.h create mode 100644 newlib/libc/sys/linux/include/netinet/in_systm.h create mode 100644 newlib/libc/sys/linux/include/netinet/in_var.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip6.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip_dummynet.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip_ecn.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip_encap.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip_flow.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip_fw.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip_icmp.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip_mroute.h create mode 100644 newlib/libc/sys/linux/include/netinet/ip_var.h create mode 100644 newlib/libc/sys/linux/include/netinet/ipprotosw.h create mode 100644 newlib/libc/sys/linux/include/netinet/tcp.h create mode 100644 newlib/libc/sys/linux/include/netinet/tcp_debug.h create mode 100644 newlib/libc/sys/linux/include/netinet/tcp_fsm.h create mode 100644 newlib/libc/sys/linux/include/netinet/tcp_seq.h create mode 100644 newlib/libc/sys/linux/include/netinet/tcp_timer.h create mode 100644 newlib/libc/sys/linux/include/netinet/tcp_var.h create mode 100644 newlib/libc/sys/linux/include/netinet/tcpip.h create mode 100644 newlib/libc/sys/linux/include/netinet/udp.h create mode 100644 newlib/libc/sys/linux/include/netinet/udp_var.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ah.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ah6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/esp.h create mode 100644 newlib/libc/sys/linux/include/netinet6/esp6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/esp_rijndael.h create mode 100644 newlib/libc/sys/linux/include/netinet6/icmp6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/in6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/in6_gif.h create mode 100644 newlib/libc/sys/linux/include/netinet6/in6_ifattach.h create mode 100644 newlib/libc/sys/linux/include/netinet6/in6_pcb.h create mode 100644 newlib/libc/sys/linux/include/netinet6/in6_prefix.h create mode 100644 newlib/libc/sys/linux/include/netinet6/in6_var.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ip6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ip6_ecn.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ip6_fw.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ip6_mroute.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ip6_var.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ip6protosw.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ipcomp.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ipcomp6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ipsec.h create mode 100644 newlib/libc/sys/linux/include/netinet6/ipsec6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/mld6_var.h create mode 100644 newlib/libc/sys/linux/include/netinet6/nd6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/pim6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/pim6_var.h create mode 100644 newlib/libc/sys/linux/include/netinet6/raw_ip6.h create mode 100644 newlib/libc/sys/linux/include/netinet6/scope6_var.h create mode 100644 newlib/libc/sys/linux/include/netinet6/tcp6_var.h create mode 100644 newlib/libc/sys/linux/include/netinet6/udp6_var.h create mode 100644 newlib/libc/sys/linux/include/netns/idp.h create mode 100644 newlib/libc/sys/linux/include/netns/idp_var.h create mode 100644 newlib/libc/sys/linux/include/netns/ns.h create mode 100644 newlib/libc/sys/linux/include/netns/ns_error.h create mode 100644 newlib/libc/sys/linux/include/netns/ns_if.h create mode 100644 newlib/libc/sys/linux/include/netns/ns_pcb.h create mode 100644 newlib/libc/sys/linux/include/netns/sp.h create mode 100644 newlib/libc/sys/linux/include/netns/spidp.h create mode 100644 newlib/libc/sys/linux/include/netns/spp_debug.h create mode 100644 newlib/libc/sys/linux/include/netns/spp_timer.h create mode 100644 newlib/libc/sys/linux/include/netns/spp_var.h create mode 100644 newlib/libc/sys/linux/include/nsswitch.h create mode 100644 newlib/libc/sys/linux/include/regex.h create mode 100644 newlib/libc/sys/linux/include/resolv.h create mode 100644 newlib/libc/sys/linux/include/rpc/Makefile create mode 100644 newlib/libc/sys/linux/include/rpc/auth.h create mode 100644 newlib/libc/sys/linux/include/rpc/auth_des.h create mode 100644 newlib/libc/sys/linux/include/rpc/auth_kerb.h create mode 100644 newlib/libc/sys/linux/include/rpc/auth_unix.h create mode 100644 newlib/libc/sys/linux/include/rpc/clnt.h create mode 100644 newlib/libc/sys/linux/include/rpc/clnt_soc.h create mode 100644 newlib/libc/sys/linux/include/rpc/clnt_stat.h create mode 100644 newlib/libc/sys/linux/include/rpc/des.h create mode 100644 newlib/libc/sys/linux/include/rpc/des_crypt.h create mode 100644 newlib/libc/sys/linux/include/rpc/nettype.h create mode 100644 newlib/libc/sys/linux/include/rpc/pmap_clnt.h create mode 100644 newlib/libc/sys/linux/include/rpc/pmap_prot.h create mode 100644 newlib/libc/sys/linux/include/rpc/pmap_rmt.h create mode 100644 newlib/libc/sys/linux/include/rpc/raw.h create mode 100644 newlib/libc/sys/linux/include/rpc/rpc.h create mode 100644 newlib/libc/sys/linux/include/rpc/rpc_com.h create mode 100644 newlib/libc/sys/linux/include/rpc/rpc_msg.h create mode 100644 newlib/libc/sys/linux/include/rpc/rpcb_clnt.h create mode 100644 newlib/libc/sys/linux/include/rpc/rpcb_prot.h create mode 100644 newlib/libc/sys/linux/include/rpc/rpcb_prot.x create mode 100644 newlib/libc/sys/linux/include/rpc/rpcent.h create mode 100644 newlib/libc/sys/linux/include/rpc/svc.h create mode 100644 newlib/libc/sys/linux/include/rpc/svc_auth.h create mode 100644 newlib/libc/sys/linux/include/rpc/svc_dg.h create mode 100644 newlib/libc/sys/linux/include/rpc/svc_soc.h create mode 100644 newlib/libc/sys/linux/include/rpc/types.h create mode 100644 newlib/libc/sys/linux/include/rpc/xdr.h create mode 100644 newlib/libc/sys/linux/include/rune.h create mode 100644 newlib/libc/sys/linux/include/runetype.h create mode 100644 newlib/libc/sys/linux/include/semaphore.h create mode 100644 newlib/libc/sys/linux/include/setlocale.h create mode 100644 newlib/libc/sys/linux/include/un-namespace.h create mode 100644 newlib/libc/sys/linux/include/wordexp.h create mode 100644 newlib/libc/sys/linux/intl/Makefile.am create mode 100644 newlib/libc/sys/linux/intl/Makefile.in create mode 100644 newlib/libc/sys/linux/intl/bindtextdom.c create mode 100644 newlib/libc/sys/linux/intl/catgets.c create mode 100644 newlib/libc/sys/linux/intl/catgetsinfo.h create mode 100644 newlib/libc/sys/linux/intl/config.h create mode 100644 newlib/libc/sys/linux/intl/dcgettext.c create mode 100644 newlib/libc/sys/linux/intl/dcigettext.c create mode 100644 newlib/libc/sys/linux/intl/dcngettext.c create mode 100644 newlib/libc/sys/linux/intl/dgettext.c create mode 100644 newlib/libc/sys/linux/intl/dngettext.c create mode 100644 newlib/libc/sys/linux/intl/explodename.c create mode 100644 newlib/libc/sys/linux/intl/finddomain.c create mode 100644 newlib/libc/sys/linux/intl/gettext.c create mode 100644 newlib/libc/sys/linux/intl/gettext.h create mode 100644 newlib/libc/sys/linux/intl/gettextP.h create mode 100644 newlib/libc/sys/linux/intl/hash-string.h create mode 100644 newlib/libc/sys/linux/intl/l10nflist.c create mode 100644 newlib/libc/sys/linux/intl/loadinfo.h create mode 100644 newlib/libc/sys/linux/intl/loadmsgcat.c create mode 100644 newlib/libc/sys/linux/intl/locale.alias create mode 100644 newlib/libc/sys/linux/intl/localealias.c create mode 100644 newlib/libc/sys/linux/intl/ngettext.c create mode 100644 newlib/libc/sys/linux/intl/open_catalog.c create mode 100644 newlib/libc/sys/linux/intl/plural.c create mode 100644 newlib/libc/sys/linux/intl/plural.y create mode 100644 newlib/libc/sys/linux/intl/stpcpy.c create mode 100644 newlib/libc/sys/linux/intl/textdomain.c create mode 100644 newlib/libc/sys/linux/linuxthreads/LICENSE create mode 100644 newlib/libc/sys/linux/linuxthreads/Makefile.am create mode 100644 newlib/libc/sys/linux/linuxthreads/Makefile.in create mode 100644 newlib/libc/sys/linux/linuxthreads/aclocal.m4 create mode 100644 newlib/libc/sys/linux/linuxthreads/attr.c create mode 100644 newlib/libc/sys/linux/linuxthreads/barrier.c create mode 100644 newlib/libc/sys/linux/linuxthreads/bits/initspin.h create mode 100644 newlib/libc/sys/linux/linuxthreads/bits/libc-lock.h create mode 100644 newlib/libc/sys/linux/linuxthreads/bits/libc-tsd.h create mode 100644 newlib/libc/sys/linux/linuxthreads/bits/local_lim.h create mode 100644 newlib/libc/sys/linux/linuxthreads/bits/posix_opt.h create mode 100644 newlib/libc/sys/linux/linuxthreads/bits/pthreadtypes.h create mode 100644 newlib/libc/sys/linux/linuxthreads/bits/sigthread.h create mode 100644 newlib/libc/sys/linux/linuxthreads/bp-sym.h create mode 100644 newlib/libc/sys/linux/linuxthreads/cancel.c create mode 100644 newlib/libc/sys/linux/linuxthreads/condvar.c create mode 100644 newlib/libc/sys/linux/linuxthreads/config.h create mode 100755 newlib/libc/sys/linux/linuxthreads/configure create mode 100644 newlib/libc/sys/linux/linuxthreads/configure.in create mode 100644 newlib/libc/sys/linux/linuxthreads/defs.awk create mode 100644 newlib/libc/sys/linux/linuxthreads/ecmutex.c create mode 100644 newlib/libc/sys/linux/linuxthreads/events.c create mode 100644 newlib/libc/sys/linux/linuxthreads/getcpuclockid.c create mode 100644 newlib/libc/sys/linux/linuxthreads/getreent.c create mode 100644 newlib/libc/sys/linux/linuxthreads/internals.h create mode 100644 newlib/libc/sys/linux/linuxthreads/join.c create mode 100644 newlib/libc/sys/linux/linuxthreads/joinrace.c create mode 100644 newlib/libc/sys/linux/linuxthreads/kernel-features.h create mode 100644 newlib/libc/sys/linux/linuxthreads/libc-internal.h create mode 100644 newlib/libc/sys/linux/linuxthreads/libc-symbols.h create mode 100644 newlib/libc/sys/linux/linuxthreads/linuxthreads.texi create mode 100644 newlib/libc/sys/linux/linuxthreads/lockfile.c create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/Makefile.am create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/Makefile.in create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/aclocal.m4 create mode 100755 newlib/libc/sys/linux/linuxthreads/machine/configure create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/configure.in create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/generic/generic-sysdep.h create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.am create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/aclocal.m4 create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/bp-asm.h create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/clone.S create mode 100755 newlib/libc/sys/linux/linuxthreads/machine/i386/configure create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/configure.in create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.S create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.h create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/pspinlock.c create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/pt-machine.h create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/sigcontextinfo.h create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/stackinfo.h create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/sysdep.S create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/sysdep.h create mode 100644 newlib/libc/sys/linux/linuxthreads/machine/i386/useldt.h create mode 100644 newlib/libc/sys/linux/linuxthreads/manager.c create mode 100644 newlib/libc/sys/linux/linuxthreads/mq_notify.c create mode 100644 newlib/libc/sys/linux/linuxthreads/mutex.c create mode 100644 newlib/libc/sys/linux/linuxthreads/no-tsd.c create mode 100644 newlib/libc/sys/linux/linuxthreads/oldsemaphore.c create mode 100644 newlib/libc/sys/linux/linuxthreads/posix-timer.h create mode 100644 newlib/libc/sys/linux/linuxthreads/prio.c create mode 100644 newlib/libc/sys/linux/linuxthreads/proc_service.h create mode 100644 newlib/libc/sys/linux/linuxthreads/pt-machine.c create mode 100644 newlib/libc/sys/linux/linuxthreads/ptclock_gettime.c create mode 100644 newlib/libc/sys/linux/linuxthreads/ptclock_settime.c create mode 100644 newlib/libc/sys/linux/linuxthreads/ptfork.c create mode 100644 newlib/libc/sys/linux/linuxthreads/pthread.c create mode 100644 newlib/libc/sys/linux/linuxthreads/ptlongjmp.c create mode 100644 newlib/libc/sys/linux/linuxthreads/queue.h create mode 100644 newlib/libc/sys/linux/linuxthreads/reent.c create mode 100644 newlib/libc/sys/linux/linuxthreads/reqsyscalls.c create mode 100644 newlib/libc/sys/linux/linuxthreads/restart.h create mode 100644 newlib/libc/sys/linux/linuxthreads/rwlock.c create mode 100644 newlib/libc/sys/linux/linuxthreads/semaphore.c create mode 100644 newlib/libc/sys/linux/linuxthreads/semaphore.h create mode 100644 newlib/libc/sys/linux/linuxthreads/shlib-compat.h create mode 100644 newlib/libc/sys/linux/linuxthreads/signals.c create mode 100644 newlib/libc/sys/linux/linuxthreads/specific.c create mode 100644 newlib/libc/sys/linux/linuxthreads/spinlock.c create mode 100644 newlib/libc/sys/linux/linuxthreads/spinlock.h create mode 100644 newlib/libc/sys/linux/linuxthreads/sysctl.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_init.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_log.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_symbol_list.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_clear_event.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_delete.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_enable_stats.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_event_addr.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_event_getmsg.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_get_nthreads.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_get_ph.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_get_stats.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_map_id2thr.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_map_lwp2thr.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_new.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_reset_stats.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_set_event.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_setconcurrency.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_thr_iter.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_ta_tsd_iter.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_clear_event.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_dbresume.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_dbsuspend.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_event_enable.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_event_getmsg.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_get_info.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_getfpregs.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_getgregs.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_getxregs.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_getxregsize.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_set_event.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_setfpregs.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_setgregs.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_setprio.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_setsigpending.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_setxregs.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_sigsetmask.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_tsd.c create mode 100644 newlib/libc/sys/linux/linuxthreads/td_thr_validate.c create mode 100644 newlib/libc/sys/linux/linuxthreads/testrtsig.h create mode 100644 newlib/libc/sys/linux/linuxthreads/thread_db.h create mode 100644 newlib/libc/sys/linux/linuxthreads/thread_dbP.h create mode 100644 newlib/libc/sys/linux/linuxthreads/timer_create.c create mode 100644 newlib/libc/sys/linux/linuxthreads/timer_delete.c create mode 100644 newlib/libc/sys/linux/linuxthreads/timer_getoverr.c create mode 100644 newlib/libc/sys/linux/linuxthreads/timer_gettime.c create mode 100644 newlib/libc/sys/linux/linuxthreads/timer_routines.c create mode 100644 newlib/libc/sys/linux/linuxthreads/timer_settime.c create mode 100644 newlib/libc/sys/linux/linuxthreads/tst-cancel.c create mode 100644 newlib/libc/sys/linux/linuxthreads/tst-context.c create mode 100644 newlib/libc/sys/linux/linuxthreads/tststack.c create mode 100644 newlib/libc/sys/linux/linuxthreads/unload.c create mode 100644 newlib/libc/sys/linux/linuxthreads/weaks.c create mode 100644 newlib/libc/sys/linux/linuxthreads/wrapsyscall.c create mode 100644 newlib/libc/sys/linux/machine/i386/dl-machine.h create mode 100644 newlib/libc/sys/linux/net/Makefile.am create mode 100644 newlib/libc/sys/linux/net/Makefile.in create mode 100644 newlib/libc/sys/linux/net/addr2ascii.3 create mode 100644 newlib/libc/sys/linux/net/addr2ascii.c create mode 100644 newlib/libc/sys/linux/net/ascii2addr.c create mode 100644 newlib/libc/sys/linux/net/base64.c create mode 100644 newlib/libc/sys/linux/net/bindresvport.c create mode 100644 newlib/libc/sys/linux/net/byteorder.3 create mode 100644 newlib/libc/sys/linux/net/ether_addr.c create mode 100644 newlib/libc/sys/linux/net/ethers.3 create mode 100644 newlib/libc/sys/linux/net/getaddrinfo.3 create mode 100644 newlib/libc/sys/linux/net/getaddrinfo.c create mode 100644 newlib/libc/sys/linux/net/gethostbydns.c create mode 100644 newlib/libc/sys/linux/net/gethostbyht.c create mode 100644 newlib/libc/sys/linux/net/gethostbyname.3 create mode 100644 newlib/libc/sys/linux/net/gethostbynis.c create mode 100644 newlib/libc/sys/linux/net/gethostnamadr.c create mode 100644 newlib/libc/sys/linux/net/getifaddrs.3 create mode 100644 newlib/libc/sys/linux/net/getifaddrs.c create mode 100644 newlib/libc/sys/linux/net/getipnodebyname.3 create mode 100644 newlib/libc/sys/linux/net/getnameinfo.3 create mode 100644 newlib/libc/sys/linux/net/getnameinfo.c create mode 100644 newlib/libc/sys/linux/net/getnetbydns.c create mode 100644 newlib/libc/sys/linux/net/getnetbyht.c create mode 100644 newlib/libc/sys/linux/net/getnetbynis.c create mode 100644 newlib/libc/sys/linux/net/getnetent.3 create mode 100644 newlib/libc/sys/linux/net/getnetnamadr.c create mode 100644 newlib/libc/sys/linux/net/getproto.c create mode 100644 newlib/libc/sys/linux/net/getprotoent.3 create mode 100644 newlib/libc/sys/linux/net/getprotoent.c create mode 100644 newlib/libc/sys/linux/net/getprotoname.c create mode 100644 newlib/libc/sys/linux/net/getservbyname.c create mode 100644 newlib/libc/sys/linux/net/getservbyport.c create mode 100644 newlib/libc/sys/linux/net/getservent.3 create mode 100644 newlib/libc/sys/linux/net/getservent.c create mode 100644 newlib/libc/sys/linux/net/herror.c create mode 100644 newlib/libc/sys/linux/net/hesiod.3 create mode 100644 newlib/libc/sys/linux/net/hesiod.c create mode 100644 newlib/libc/sys/linux/net/if_indextoname.3 create mode 100644 newlib/libc/sys/linux/net/ifname.c create mode 100644 newlib/libc/sys/linux/net/inet.3 create mode 100644 newlib/libc/sys/linux/net/inet6_option_space.3 create mode 100644 newlib/libc/sys/linux/net/inet6_rthdr_space.3 create mode 100644 newlib/libc/sys/linux/net/inet_addr.c create mode 100644 newlib/libc/sys/linux/net/inet_lnaof.c create mode 100644 newlib/libc/sys/linux/net/inet_makeaddr.c create mode 100644 newlib/libc/sys/linux/net/inet_net.3 create mode 100644 newlib/libc/sys/linux/net/inet_net_ntop.c create mode 100644 newlib/libc/sys/linux/net/inet_net_pton.c create mode 100644 newlib/libc/sys/linux/net/inet_neta.c create mode 100644 newlib/libc/sys/linux/net/inet_netof.c create mode 100644 newlib/libc/sys/linux/net/inet_network.c create mode 100644 newlib/libc/sys/linux/net/inet_ntoa.c create mode 100644 newlib/libc/sys/linux/net/inet_ntop.c create mode 100644 newlib/libc/sys/linux/net/inet_pton.c create mode 100644 newlib/libc/sys/linux/net/innetgr-stub.c create mode 100644 newlib/libc/sys/linux/net/ip6opt.c create mode 100644 newlib/libc/sys/linux/net/iso_addr.3 create mode 100644 newlib/libc/sys/linux/net/iso_addr.c create mode 100644 newlib/libc/sys/linux/net/issetugid-stub.c create mode 100644 newlib/libc/sys/linux/net/linkaddr.3 create mode 100644 newlib/libc/sys/linux/net/linkaddr.c create mode 100644 newlib/libc/sys/linux/net/map_v4v6.c create mode 100644 newlib/libc/sys/linux/net/name6.c create mode 100644 newlib/libc/sys/linux/net/namespace.h create mode 100644 newlib/libc/sys/linux/net/ns.3 create mode 100644 newlib/libc/sys/linux/net/ns_addr.c create mode 100644 newlib/libc/sys/linux/net/ns_name.c create mode 100644 newlib/libc/sys/linux/net/ns_netint.c create mode 100644 newlib/libc/sys/linux/net/ns_ntoa.c create mode 100644 newlib/libc/sys/linux/net/ns_parse.c create mode 100644 newlib/libc/sys/linux/net/ns_print.c create mode 100644 newlib/libc/sys/linux/net/ns_ttl.c create mode 100644 newlib/libc/sys/linux/net/nsap_addr.c create mode 100644 newlib/libc/sys/linux/net/nsdispatch.3 create mode 100644 newlib/libc/sys/linux/net/nsdispatch.c create mode 100644 newlib/libc/sys/linux/net/nslexer.c create mode 100644 newlib/libc/sys/linux/net/nslexer.l create mode 100644 newlib/libc/sys/linux/net/nsparser.c create mode 100644 newlib/libc/sys/linux/net/nsparser.h create mode 100644 newlib/libc/sys/linux/net/nsparser.y create mode 100644 newlib/libc/sys/linux/net/rcmd.3 create mode 100644 newlib/libc/sys/linux/net/rcmd.c create mode 100644 newlib/libc/sys/linux/net/rcmdsh.3 create mode 100644 newlib/libc/sys/linux/net/rcmdsh.c create mode 100644 newlib/libc/sys/linux/net/recv.c create mode 100644 newlib/libc/sys/linux/net/res_comp.c create mode 100644 newlib/libc/sys/linux/net/res_config.h create mode 100644 newlib/libc/sys/linux/net/res_data.c create mode 100644 newlib/libc/sys/linux/net/res_debug.c create mode 100644 newlib/libc/sys/linux/net/res_init.c create mode 100644 newlib/libc/sys/linux/net/res_mkquery.c create mode 100644 newlib/libc/sys/linux/net/res_mkupdate.c create mode 100644 newlib/libc/sys/linux/net/res_query.c create mode 100644 newlib/libc/sys/linux/net/res_send.c create mode 100644 newlib/libc/sys/linux/net/res_update.c create mode 100644 newlib/libc/sys/linux/net/resolver.3 create mode 100644 newlib/libc/sys/linux/net/rthdr.c create mode 100644 newlib/libc/sys/linux/net/send.c create mode 100644 newlib/libc/sys/linux/net/un-namespace.h create mode 100644 newlib/libc/sys/linux/net/vars.c create mode 100644 newlib/libc/sys/linux/sethostid.c create mode 100644 newlib/libc/sys/linux/stdlib/COPYRIGHT create mode 100644 newlib/libc/sys/linux/stdlib/Makefile.am create mode 100644 newlib/libc/sys/linux/stdlib/Makefile.in create mode 100644 newlib/libc/sys/linux/stdlib/cclass.h create mode 100644 newlib/libc/sys/linux/stdlib/cname.h create mode 100644 newlib/libc/sys/linux/stdlib/collate.c create mode 100644 newlib/libc/sys/linux/stdlib/collate.h create mode 100644 newlib/libc/sys/linux/stdlib/collcmp.c create mode 100644 newlib/libc/sys/linux/stdlib/engine.c create mode 100644 newlib/libc/sys/linux/stdlib/fnmatch.3 create mode 100644 newlib/libc/sys/linux/stdlib/fnmatch.c create mode 100644 newlib/libc/sys/linux/stdlib/glob.3 create mode 100644 newlib/libc/sys/linux/stdlib/glob.c create mode 100644 newlib/libc/sys/linux/stdlib/reallocf.c create mode 100644 newlib/libc/sys/linux/stdlib/regcomp.c create mode 100644 newlib/libc/sys/linux/stdlib/regerror.c create mode 100644 newlib/libc/sys/linux/stdlib/regex.3 create mode 100644 newlib/libc/sys/linux/stdlib/regex2.h create mode 100644 newlib/libc/sys/linux/stdlib/regexec.c create mode 100644 newlib/libc/sys/linux/stdlib/regfree.c create mode 100644 newlib/libc/sys/linux/stdlib/utils.h create mode 100644 newlib/libc/sys/linux/stdlib/wordexp.c create mode 100644 newlib/libc/sys/linux/stdlib/wordfree.c create mode 100644 newlib/libc/sys/linux/sys/dlfcn.h create mode 100644 newlib/libc/sys/linux/sys/elfclass.h create mode 100644 newlib/libc/sys/linux/sys/event.h create mode 100644 newlib/libc/sys/linux/sys/ioccom.h create mode 100644 newlib/libc/sys/linux/sys/libc-tsd.h create mode 100644 newlib/libc/sys/linux/sys/link.h create mode 100644 newlib/libc/sys/linux/sys/lock.h create mode 100644 newlib/libc/sys/linux/sys/param.h create mode 100644 newlib/libc/sys/linux/sys/socket.h create mode 100644 newlib/libc/sys/linux/sys/sockio.h diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 03db5e1e0..06689640a 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,571 @@ +2003-05-28 Jeff Johnston + Tom Fitzsimmons + + * configure.in: Add iconvdata support for x86 linux. + * configure: Regenerated. + * libc/sys/linux/Makefile.am: Add EL/IX level 3 network, dynamic + library, iconv, and linuxthreads support. + * libc/sys/linux/configure.in: Ditto. + * libc/sys/linux/Makefile.in: Regenerated. + * libc/sys/linux/configure: Ditto. + * iconvdata/EUC-JP.irreversible: New file. + * iconvdata/Makefile.am: Ditto. + * iconvdata/Makefile.in: Ditto. + * iconvdata/SJIS.irreversible: Ditto. + * iconvdata/aclocal.m4: Ditto. + * iconvdata/configure: Ditto. + * iconvdata/configure.in: Ditto. + * iconvdata/dummy.c: Ditto. + * iconvdata/euc-jp.c: Ditto. + * iconvdata/gconv-modules: Ditto. + * iconvdata/jis0201.c: Ditto. + * iconvdata/jis0201.h: Ditto. + * iconvdata/jis0208.c: Ditto. + * iconvdata/jis0208.h: Ditto. + * iconvdata/jis0212.c: Ditto. + * iconvdata/jis0212.h: Ditto. + * iconvdata/sjis.c: Ditto. + * libc/include/errno.h: Protect definition of error_t. + * libc/sys/linux/gethostid.c: New file. + * libc/sys/linux/sethostid.c: Ditto. + * libc/sys/linux/dl/Makefile.am: Ditto. + * libc/sys/linux/dl/Makefile.in: Ditto. + * libc/sys/linux/dl/abi-tag.h: Ditto. + * libc/sys/linux/dl/atomicity.h: Ditto. + * libc/sys/linux/dl/dl-addr.c: Ditto. + * libc/sys/linux/dl/dl-cache.c: Ditto. + * libc/sys/linux/dl/dl-cache.h: Ditto. + * libc/sys/linux/dl/dl-close.c: Ditto. + * libc/sys/linux/dl/dl-debug.c: Ditto. + * libc/sys/linux/dl/dl-deps.c: Ditto. + * libc/sys/linux/dl/dl-dst.h: Ditto. + * libc/sys/linux/dl/dl-error.c: Ditto. + * libc/sys/linux/dl/dl-fini.c: Ditto. + * libc/sys/linux/dl/dl-init.c: Ditto. + * libc/sys/linux/dl/dl-iteratephdr.c: Ditto. + * libc/sys/linux/dl/dl-libc.c: Ditto. + * libc/sys/linux/dl/dl-librecon.h: Ditto. + * libc/sys/linux/dl/dl-load.c: Ditto. + * libc/sys/linux/dl/dl-lookup.c: Ditto. + * libc/sys/linux/dl/dl-lookupcfg.h: Ditto. + * libc/sys/linux/dl/dl-minimal.c: Ditto. + * libc/sys/linux/dl/dl-misc.c: Ditto. + * libc/sys/linux/dl/dl-object.c: Ditto. + * libc/sys/linux/dl/dl-open.c: Ditto. + * libc/sys/linux/dl/dl-osinfo.h: Ditto. + * libc/sys/linux/dl/dl-profile.c: Ditto. + * libc/sys/linux/dl/dl-profstub.c: Ditto. + * libc/sys/linux/dl/dl-reloc.c: Ditto. + * libc/sys/linux/dl/dl-runtime.c: Ditto. + * libc/sys/linux/dl/dl-support.c: Ditto. + * libc/sys/linux/dl/dl-sym.c: Ditto. + * libc/sys/linux/dl/dl-version.c: Ditto. + * libc/sys/linux/dl/dlfcn.h: Ditto. + * libc/sys/linux/dl/do-lookup.h: Ditto. + * libc/sys/linux/dl/do-rel.h: Ditto. + * libc/sys/linux/dl/dynamic-link.h: Ditto. + * libc/sys/linux/dl/kernel-features.h: Ditto. + * libc/sys/linux/dl/ldsodefs.h: Ditto. + * libc/sys/linux/dl/libintl.h: Ditto. + * libc/sys/linux/dl/trusted-dirs.h: Ditto. + * libc/sys/linux/dl/unsecvars.h: Ditto. + * libc/sys/linux/iconv/Makefile.am: Ditto. + * libc/sys/linux/iconv/Makefile.in: Ditto. + * libc/sys/linux/iconv/categories.def: Ditto. + * libc/sys/linux/iconv/dummy-repertoire.c: Ditto. + * libc/sys/linux/iconv/gconv.c: Ditto. + * libc/sys/linux/iconv/gconv_builtin.c: Ditto. + * libc/sys/linux/iconv/gconv_builtin.h: Ditto. + * libc/sys/linux/iconv/gconv_cache.c: Ditto. + * libc/sys/linux/iconv/gconv_charset.h: Ditto. + * libc/sys/linux/iconv/gconv_close.c: Ditto. + * libc/sys/linux/iconv/gconv_conf.c: Ditto. + * libc/sys/linux/iconv/gconv_db.c: Ditto. + * libc/sys/linux/iconv/gconv_dl.c: Ditto. + * libc/sys/linux/iconv/gconv_int.h: Ditto. + * libc/sys/linux/iconv/gconv_open.c: Ditto. + * libc/sys/linux/iconv/gconv_simple.c: Ditto. + * libc/sys/linux/iconv/gconv_trans.c: Ditto. + * libc/sys/linux/iconv/hash-string.h: Ditto. + * libc/sys/linux/iconv/iconv.c: Ditto. + * libc/sys/linux/iconv/iconv.h: Ditto. + * libc/sys/linux/iconv/iconv_charmap.c: Ditto. + * libc/sys/linux/iconv/iconv_close.c: Ditto. + * libc/sys/linux/iconv/iconv_open.c: Ditto. + * libc/sys/linux/iconv/iconvconfig.c: Ditto. + * libc/sys/linux/iconv/iconvconfig.h: Ditto. + * libc/sys/linux/iconv/loadinfo.h: Ditto. + * libc/sys/linux/iconv/localeinfo.h: Ditto. + * libc/sys/linux/iconv/loop.c: Ditto. + * libc/sys/linux/iconv/skeleton.c: Ditto. + * libc/sys/linux/iconv/strtab.c: Ditto. + * libc/sys/linux/include/dl-hash.h: Ditto. + * libc/sys/linux/include/dlfcn.h: Ditto. + * libc/sys/linux/include/fnmatch.h: Ditto. + * libc/sys/linux/include/gconv.h: Ditto. + * libc/sys/linux/include/glob.h: Ditto. + * libc/sys/linux/include/hesiod.h: Ditto. + * libc/sys/linux/include/ifaddrs.h: Ditto. + * libc/sys/linux/include/libc_private.h: Ditto. + * libc/sys/linux/include/link.h: Ditto. + * libc/sys/linux/include/namespace.h: Ditto. + * libc/sys/linux/include/netconfig.h: Ditto. + * libc/sys/linux/include/netdb.h: Ditto. + * libc/sys/linux/include/nsswitch.h: Ditto. + * libc/sys/linux/include/regex.h: Ditto. + * libc/sys/linux/include/resolv.h: Ditto. + * libc/sys/linux/include/rune.h: Ditto. + * libc/sys/linux/include/runetype.h: Ditto. + * libc/sys/linux/include/semaphore.h: Ditto. + * libc/sys/linux/include/setlocale.h: Ditto. + * libc/sys/linux/include/un-namespace.h: Ditto. + * libc/sys/linux/include/wordexp.h: Ditto. + * libc/sys/linux/include/arpa/ftp.h: Ditto. + * libc/sys/linux/include/arpa/inet.h: Ditto. + * libc/sys/linux/include/arpa/nameser.h: Ditto. + * libc/sys/linux/include/arpa/nameser_compat.h: Ditto. + * libc/sys/linux/include/arpa/telnet.h: Ditto. + * libc/sys/linux/include/arpa/tftp.h: Ditto. + * libc/sys/linux/include/net/bpf.h: Ditto. + * libc/sys/linux/include/net/bpf_compat.h: Ditto. + * libc/sys/linux/include/net/bpfdesc.h: Ditto. + * libc/sys/linux/include/net/bridge.h: Ditto. + * libc/sys/linux/include/net/ethernet.h: Ditto. + * libc/sys/linux/include/net/fddi.h: Ditto. + * libc/sys/linux/include/net/if.h: Ditto. + * libc/sys/linux/include/net/if_arc.h: Ditto. + * libc/sys/linux/include/net/if_arp.h: Ditto. + * libc/sys/linux/include/net/if_atm.h: Ditto. + * libc/sys/linux/include/net/if_dl.h: Ditto. + * libc/sys/linux/include/net/if_gif.h: Ditto. + * libc/sys/linux/include/net/if_ieee80211.h: Ditto. + * libc/sys/linux/include/net/if_llc.h: Ditto. + * libc/sys/linux/include/net/if_media.h: Ditto. + * libc/sys/linux/include/net/if_mib.h: Ditto. + * libc/sys/linux/include/net/if_ppp.h: Ditto. + * libc/sys/linux/include/net/if_pppvar.h: Ditto. + * libc/sys/linux/include/net/if_slvar.h: Ditto. + * libc/sys/linux/include/net/if_sppp.h: Ditto. + * libc/sys/linux/include/net/if_stf.h: Ditto. + * libc/sys/linux/include/net/if_tap.h: Ditto. + * libc/sys/linux/include/net/if_tapvar.h: Ditto. + * libc/sys/linux/include/net/if_tun.h: Ditto. + * libc/sys/linux/include/net/if_tunvar.h: Ditto. + * libc/sys/linux/include/net/if_types.h: Ditto. + * libc/sys/linux/include/net/if_var.h: Ditto. + * libc/sys/linux/include/net/if_vlan_var.h: Ditto. + * libc/sys/linux/include/net/intrq.h: Ditto. + * libc/sys/linux/include/net/iso88025.h: Ditto. + * libc/sys/linux/include/net/net_osdep.h: Ditto. + * libc/sys/linux/include/net/netisr.h: Ditto. + * libc/sys/linux/include/net/pfil.h: Ditto. + * libc/sys/linux/include/net/pfkeyv2.h: Ditto. + * libc/sys/linux/include/net/ppp_comp.h: Ditto. + * libc/sys/linux/include/net/ppp_defs.h: Ditto. + * libc/sys/linux/include/net/radix.h: Ditto. + * libc/sys/linux/include/net/raw_cb.h: Ditto. + * libc/sys/linux/include/net/route.h: Ditto. + * libc/sys/linux/include/net/slcompress.h: Ditto. + * libc/sys/linux/include/net/slip.h: Ditto. + * libc/sys/linux/include/net/zlib.h: Ditto. + * libc/sys/linux/include/netinet/icmp6.h: Ditto. + * libc/sys/linux/include/netinet/icmp_var.h: Ditto. + * libc/sys/linux/include/netinet/if_atm.h: Ditto. + * libc/sys/linux/include/netinet/if_ether.h: Ditto. + * libc/sys/linux/include/netinet/igmp.h: Ditto. + * libc/sys/linux/include/netinet/igmp_var.h: Ditto. + * libc/sys/linux/include/netinet/in.h: Ditto. + * libc/sys/linux/include/netinet/in_gif.h: Ditto. + * libc/sys/linux/include/netinet/in_pcb.h: Ditto. + * libc/sys/linux/include/netinet/in_systm.h: Ditto. + * libc/sys/linux/include/netinet/in_var.h: Ditto. + * libc/sys/linux/include/netinet/ip.h: Ditto. + * libc/sys/linux/include/netinet/ip6.h: Ditto. + * libc/sys/linux/include/netinet/ip_dummynet.h: Ditto. + * libc/sys/linux/include/netinet/ip_ecn.h: Ditto. + * libc/sys/linux/include/netinet/ip_encap.h: Ditto. + * libc/sys/linux/include/netinet/ip_flow.h: Ditto. + * libc/sys/linux/include/netinet/ip_fw.h: Ditto. + * libc/sys/linux/include/netinet/ip_icmp.h: Ditto. + * libc/sys/linux/include/netinet/ip_mroute.h: Ditto. + * libc/sys/linux/include/netinet/ip_var.h: Ditto. + * libc/sys/linux/include/netinet/ipprotosw.h: Ditto. + * libc/sys/linux/include/netinet/tcp.h: Ditto. + * libc/sys/linux/include/netinet/tcp_debug.h: Ditto. + * libc/sys/linux/include/netinet/tcp_fsm.h: Ditto. + * libc/sys/linux/include/netinet/tcp_seq.h: Ditto. + * libc/sys/linux/include/netinet/tcp_timer.h: Ditto. + * libc/sys/linux/include/netinet/tcp_var.h: Ditto. + * libc/sys/linux/include/netinet/tcpip.h: Ditto. + * libc/sys/linux/include/netinet/udp.h: Ditto. + * libc/sys/linux/include/netinet/udp_var.h: Ditto. + * libc/sys/linux/include/netinet6/ah.h: Ditto. + * libc/sys/linux/include/netinet6/ah6.h: Ditto. + * libc/sys/linux/include/netinet6/esp.h: Ditto. + * libc/sys/linux/include/netinet6/esp6.h: Ditto. + * libc/sys/linux/include/netinet6/esp_rijndael.h: Ditto. + * libc/sys/linux/include/netinet6/icmp6.h: Ditto. + * libc/sys/linux/include/netinet6/in6.h: Ditto. + * libc/sys/linux/include/netinet6/in6_gif.h: Ditto. + * libc/sys/linux/include/netinet6/in6_ifattach.h: Ditto. + * libc/sys/linux/include/netinet6/in6_pcb.h: Ditto. + * libc/sys/linux/include/netinet6/in6_prefix.h: Ditto. + * libc/sys/linux/include/netinet6/in6_var.h: Ditto. + * libc/sys/linux/include/netinet6/ip6.h: Ditto. + * libc/sys/linux/include/netinet6/ip6_ecn.h: Ditto. + * libc/sys/linux/include/netinet6/ip6_fw.h: Ditto. + * libc/sys/linux/include/netinet6/ip6_mroute.h: Ditto. + * libc/sys/linux/include/netinet6/ip6_var.h: Ditto. + * libc/sys/linux/include/netinet6/ip6protosw.h: Ditto. + * libc/sys/linux/include/netinet6/ipcomp.h: Ditto. + * libc/sys/linux/include/netinet6/ipcomp6.h: Ditto. + * libc/sys/linux/include/netinet6/ipsec.h: Ditto. + * libc/sys/linux/include/netinet6/ipsec6.h: Ditto. + * libc/sys/linux/include/netinet6/mld6_var.h: Ditto. + * libc/sys/linux/include/netinet6/nd6.h: Ditto. + * libc/sys/linux/include/netinet6/pim6.h: Ditto. + * libc/sys/linux/include/netinet6/pim6_var.h: Ditto. + * libc/sys/linux/include/netinet6/raw_ip6.h: Ditto. + * libc/sys/linux/include/netinet6/scope6_var.h: Ditto. + * libc/sys/linux/include/netinet6/tcp6_var.h: Ditto. + * libc/sys/linux/include/netinet6/udp6_var.h: Ditto. + * libc/sys/linux/include/netns/idp.h: Ditto. + * libc/sys/linux/include/netns/idp_var.h: Ditto. + * libc/sys/linux/include/netns/ns.h: Ditto. + * libc/sys/linux/include/netns/ns_error.h: Ditto. + * libc/sys/linux/include/netns/ns_if.h: Ditto. + * libc/sys/linux/include/netns/ns_pcb.h: Ditto. + * libc/sys/linux/include/netns/sp.h: Ditto. + * libc/sys/linux/include/netns/spidp.h: Ditto. + * libc/sys/linux/include/netns/spp_debug.h: Ditto. + * libc/sys/linux/include/netns/spp_timer.h: Ditto. + * libc/sys/linux/include/netns/spp_var.h: Ditto. + * libc/sys/linux/include/rpc/Makefile: Ditto. + * libc/sys/linux/include/rpc/auth.h: Ditto. + * libc/sys/linux/include/rpc/auth_des.h: Ditto. + * libc/sys/linux/include/rpc/auth_kerb.h: Ditto. + * libc/sys/linux/include/rpc/auth_unix.h: Ditto. + * libc/sys/linux/include/rpc/clnt.h: Ditto. + * libc/sys/linux/include/rpc/clnt_soc.h: Ditto. + * libc/sys/linux/include/rpc/clnt_stat.h: Ditto. + * libc/sys/linux/include/rpc/des.h: Ditto. + * libc/sys/linux/include/rpc/des_crypt.h: Ditto. + * libc/sys/linux/include/rpc/nettype.h: Ditto. + * libc/sys/linux/include/rpc/pmap_clnt.h: Ditto. + * libc/sys/linux/include/rpc/pmap_prot.h: Ditto. + * libc/sys/linux/include/rpc/pmap_rmt.h: Ditto. + * libc/sys/linux/include/rpc/raw.h: Ditto. + * libc/sys/linux/include/rpc/rpc.h: Ditto. + * libc/sys/linux/include/rpc/rpc_com.h: Ditto. + * libc/sys/linux/include/rpc/rpc_msg.h: Ditto. + * libc/sys/linux/include/rpc/rpcb_clnt.h: Ditto. + * libc/sys/linux/include/rpc/rpcb_prot.h: Ditto. + * libc/sys/linux/include/rpc/rpcb_prot.x: Ditto. + * libc/sys/linux/include/rpc/rpcent.h: Ditto. + * libc/sys/linux/include/rpc/svc.h: Ditto. + * libc/sys/linux/include/rpc/svc_auth.h: Ditto. + * libc/sys/linux/include/rpc/svc_dg.h: Ditto. + * libc/sys/linux/include/rpc/svc_soc.h: Ditto. + * libc/sys/linux/include/rpc/types.h: Ditto. + * libc/sys/linux/include/rpc/xdr.h: Ditto. + * libc/sys/linux/intl/Makefile.am: Ditto. + * libc/sys/linux/intl/Makefile.in: Ditto. + * libc/sys/linux/intl/bindtextdom.c: Ditto. + * libc/sys/linux/intl/catgets.c: Ditto. + * libc/sys/linux/intl/catgetsinfo.h: Ditto. + * libc/sys/linux/intl/config.h: Ditto. + * libc/sys/linux/intl/dcgettext.c: Ditto. + * libc/sys/linux/intl/dcigettext.c: Ditto. + * libc/sys/linux/intl/dcngettext.c: Ditto. + * libc/sys/linux/intl/dgettext.c: Ditto. + * libc/sys/linux/intl/dngettext.c: Ditto. + * libc/sys/linux/intl/explodename.c: Ditto. + * libc/sys/linux/intl/finddomain.c: Ditto. + * libc/sys/linux/intl/gettext.c: Ditto. + * libc/sys/linux/intl/gettext.h: Ditto. + * libc/sys/linux/intl/gettextP.h: Ditto. + * libc/sys/linux/intl/hash-string.h: Ditto. + * libc/sys/linux/intl/l10nflist.c: Ditto. + * libc/sys/linux/intl/loadinfo.h: Ditto. + * libc/sys/linux/intl/loadmsgcat.c: Ditto. + * libc/sys/linux/intl/locale.alias: Ditto. + * libc/sys/linux/intl/localealias.c: Ditto. + * libc/sys/linux/intl/ngettext.c: Ditto. + * libc/sys/linux/intl/open_catalog.c: Ditto. + * libc/sys/linux/intl/plural.c: Ditto. + * libc/sys/linux/intl/plural.y: Ditto. + * libc/sys/linux/intl/stpcpy.c: Ditto. + * libc/sys/linux/intl/textdomain.c: Ditto. + * libc/sys/linux/linuxthreads/LICENSE: Ditto. + * libc/sys/linux/linuxthreads/Makefile.am: Ditto. + * libc/sys/linux/linuxthreads/Makefile.in: Ditto. + * libc/sys/linux/linuxthreads/aclocal.m4: Ditto. + * libc/sys/linux/linuxthreads/attr.c: Ditto. + * libc/sys/linux/linuxthreads/barrier.c: Ditto. + * libc/sys/linux/linuxthreads/bp-sym.h: Ditto. + * libc/sys/linux/linuxthreads/cancel.c: Ditto. + * libc/sys/linux/linuxthreads/condvar.c: Ditto. + * libc/sys/linux/linuxthreads/config.h: Ditto. + * libc/sys/linux/linuxthreads/configure: Ditto. + * libc/sys/linux/linuxthreads/configure.in: Ditto. + * libc/sys/linux/linuxthreads/defs.awk: Ditto. + * libc/sys/linux/linuxthreads/ecmutex.c: Ditto. + * libc/sys/linux/linuxthreads/events.c: Ditto. + * libc/sys/linux/linuxthreads/getcpuclockid.c: Ditto. + * libc/sys/linux/linuxthreads/getreent.c: Ditto. + * libc/sys/linux/linuxthreads/internals.h: Ditto. + * libc/sys/linux/linuxthreads/join.c: Ditto. + * libc/sys/linux/linuxthreads/joinrace.c: Ditto. + * libc/sys/linux/linuxthreads/kernel-features.h: Ditto. + * libc/sys/linux/linuxthreads/libc-internal.h: Ditto. + * libc/sys/linux/linuxthreads/libc-symbols.h: Ditto. + * libc/sys/linux/linuxthreads/linuxthreads.texi: Ditto. + * libc/sys/linux/linuxthreads/lockfile.c: Ditto. + * libc/sys/linux/linuxthreads/manager.c: Ditto. + * libc/sys/linux/linuxthreads/mq_notify.c: Ditto. + * libc/sys/linux/linuxthreads/mutex.c: Ditto. + * libc/sys/linux/linuxthreads/no-tsd.c: Ditto. + * libc/sys/linux/linuxthreads/oldsemaphore.c: Ditto. + * libc/sys/linux/linuxthreads/posix-timer.h: Ditto. + * libc/sys/linux/linuxthreads/prio.c: Ditto. + * libc/sys/linux/linuxthreads/proc_service.h: Ditto. + * libc/sys/linux/linuxthreads/pt-machine.c: Ditto. + * libc/sys/linux/linuxthreads/ptclock_gettime.c: Ditto. + * libc/sys/linux/linuxthreads/ptclock_settime.c: Ditto. + * libc/sys/linux/linuxthreads/ptfork.c: Ditto. + * libc/sys/linux/linuxthreads/pthread.c: Ditto. + * libc/sys/linux/linuxthreads/ptlongjmp.c: Ditto. + * libc/sys/linux/linuxthreads/queue.h: Ditto. + * libc/sys/linux/linuxthreads/reent.c: Ditto. + * libc/sys/linux/linuxthreads/reqsyscalls.c: Ditto. + * libc/sys/linux/linuxthreads/restart.h: Ditto. + * libc/sys/linux/linuxthreads/rwlock.c: Ditto. + * libc/sys/linux/linuxthreads/semaphore.c: Ditto. + * libc/sys/linux/linuxthreads/semaphore.h: Ditto. + * libc/sys/linux/linuxthreads/shlib-compat.h: Ditto. + * libc/sys/linux/linuxthreads/signals.c: Ditto. + * libc/sys/linux/linuxthreads/specific.c: Ditto. + * libc/sys/linux/linuxthreads/spinlock.c: Ditto. + * libc/sys/linux/linuxthreads/spinlock.h: Ditto. + * libc/sys/linux/linuxthreads/sysctl.c: Ditto. + * libc/sys/linux/linuxthreads/td_init.c: Ditto. + * libc/sys/linux/linuxthreads/td_log.c: Ditto. + * libc/sys/linux/linuxthreads/td_symbol_list.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_clear_event.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_delete.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_enable_stats.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_event_addr.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_event_getmsg.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_get_nthreads.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_get_ph.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_get_stats.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_map_id2thr.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_map_lwp2thr.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_new.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_reset_stats.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_set_event.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_setconcurrency.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_thr_iter.c: Ditto. + * libc/sys/linux/linuxthreads/td_ta_tsd_iter.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_clear_event.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_dbresume.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_dbsuspend.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_event_enable.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_event_getmsg.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_get_info.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_getfpregs.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_getgregs.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_getxregs.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_getxregsize.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_set_event.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_setfpregs.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_setgregs.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_setprio.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_setsigpending.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_setxregs.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_sigsetmask.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_tsd.c: Ditto. + * libc/sys/linux/linuxthreads/td_thr_validate.c: Ditto. + * libc/sys/linux/linuxthreads/testrtsig.h: Ditto. + * libc/sys/linux/linuxthreads/thread_db.h: Ditto. + * libc/sys/linux/linuxthreads/thread_dbP.h: Ditto. + * libc/sys/linux/linuxthreads/timer_create.c: Ditto. + * libc/sys/linux/linuxthreads/timer_delete.c: Ditto. + * libc/sys/linux/linuxthreads/timer_getoverr.c: Ditto. + * libc/sys/linux/linuxthreads/timer_gettime.c: Ditto. + * libc/sys/linux/linuxthreads/timer_routines.c: Ditto. + * libc/sys/linux/linuxthreads/timer_settime.c: Ditto. + * libc/sys/linux/linuxthreads/tst-cancel.c: Ditto. + * libc/sys/linux/linuxthreads/tst-context.c: Ditto. + * libc/sys/linux/linuxthreads/tststack.c: Ditto. + * libc/sys/linux/linuxthreads/unload.c: Ditto. + * libc/sys/linux/linuxthreads/weaks.c: Ditto. + * libc/sys/linux/linuxthreads/wrapsyscall.c: Ditto. + * libc/sys/linux/linuxthreads/bits/initspin.h: Ditto. + * libc/sys/linux/linuxthreads/bits/libc-lock.h: Ditto. + * libc/sys/linux/linuxthreads/bits/libc-tsd.h: Ditto. + * libc/sys/linux/linuxthreads/bits/local_lim.h: Ditto. + * libc/sys/linux/linuxthreads/bits/posix_opt.h: Ditto. + * libc/sys/linux/linuxthreads/bits/pthreadtypes.h: Ditto. + * libc/sys/linux/linuxthreads/bits/sigthread.h: Ditto. + * libc/sys/linux/linuxthreads/machine/Makefile.am: Ditto. + * libc/sys/linux/linuxthreads/machine/Makefile.in: Ditto. + * libc/sys/linux/linuxthreads/machine/aclocal.m4: Ditto. + * libc/sys/linux/linuxthreads/machine/configure: Ditto. + * libc/sys/linux/linuxthreads/machine/configure.in: Ditto. + * libc/sys/linux/linuxthreads/machine/generic/generic-sysd: Ditto.ep.h + * libc/sys/linux/linuxthreads/machine/i386/Makefile.am: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/Makefile.in: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/aclocal.m4: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/bp-asm.h: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/clone.S: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/configure: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/configure.in: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.S: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.h: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/pspinlock.c: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/pt-machine.h: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/sigcontextinfo.h: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/stackinfo.h: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/sysdep.S: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/sysdep.h: Ditto. + * libc/sys/linux/linuxthreads/machine/i386/useldt.h: Ditto. + * libc/sys/linux/machine/i386/dl-machine.h: Ditto. + * libc/sys/linux/net/Makefile.am: Ditto. + * libc/sys/linux/net/Makefile.in: Ditto. + * libc/sys/linux/net/addr2ascii.3: Ditto. + * libc/sys/linux/net/addr2ascii.c: Ditto. + * libc/sys/linux/net/ascii2addr.c: Ditto. + * libc/sys/linux/net/base64.c: Ditto. + * libc/sys/linux/net/bindresvport.c: Ditto. + * libc/sys/linux/net/byteorder.3: Ditto. + * libc/sys/linux/net/ether_addr.c: Ditto. + * libc/sys/linux/net/ethers.3: Ditto. + * libc/sys/linux/net/getaddrinfo.3: Ditto. + * libc/sys/linux/net/getaddrinfo.c: Ditto. + * libc/sys/linux/net/gethostbydns.c: Ditto. + * libc/sys/linux/net/gethostbyht.c: Ditto. + * libc/sys/linux/net/gethostbyname.3: Ditto. + * libc/sys/linux/net/gethostbynis.c: Ditto. + * libc/sys/linux/net/gethostnamadr.c: Ditto. + * libc/sys/linux/net/getifaddrs.3: Ditto. + * libc/sys/linux/net/getifaddrs.c: Ditto. + * libc/sys/linux/net/getipnodebyname.3: Ditto. + * libc/sys/linux/net/getnameinfo.3: Ditto. + * libc/sys/linux/net/getnameinfo.c: Ditto. + * libc/sys/linux/net/getnetbydns.c: Ditto. + * libc/sys/linux/net/getnetbyht.c: Ditto. + * libc/sys/linux/net/getnetbynis.c: Ditto. + * libc/sys/linux/net/getnetent.3: Ditto. + * libc/sys/linux/net/getnetnamadr.c: Ditto. + * libc/sys/linux/net/getproto.c: Ditto. + * libc/sys/linux/net/getprotoent.3: Ditto. + * libc/sys/linux/net/getprotoent.c: Ditto. + * libc/sys/linux/net/getprotoname.c: Ditto. + * libc/sys/linux/net/getservbyname.c: Ditto. + * libc/sys/linux/net/getservbyport.c: Ditto. + * libc/sys/linux/net/getservent.3: Ditto. + * libc/sys/linux/net/getservent.c: Ditto. + * libc/sys/linux/net/herror.c: Ditto. + * libc/sys/linux/net/hesiod.3: Ditto. + * libc/sys/linux/net/hesiod.c: Ditto. + * libc/sys/linux/net/if_indextoname.3: Ditto. + * libc/sys/linux/net/ifname.c: Ditto. + * libc/sys/linux/net/inet.3: Ditto. + * libc/sys/linux/net/inet6_option_s: Ditto.pace.3 + * libc/sys/linux/net/inet6_rthdr_space.3: Ditto. + * libc/sys/linux/net/inet_addr.c: Ditto. + * libc/sys/linux/net/inet_lnaof.c: Ditto. + * libc/sys/linux/net/inet_makeaddr.c: Ditto. + * libc/sys/linux/net/inet_net.3: Ditto. + * libc/sys/linux/net/inet_net_ntop.c: Ditto. + * libc/sys/linux/net/inet_net_pton.c: Ditto. + * libc/sys/linux/net/inet_neta.c: Ditto. + * libc/sys/linux/net/inet_netof.c: Ditto. + * libc/sys/linux/net/inet_network.c: Ditto. + * libc/sys/linux/net/inet_ntoa.c: Ditto. + * libc/sys/linux/net/inet_ntop.c: Ditto. + * libc/sys/linux/net/inet_pton.c: Ditto. + * libc/sys/linux/net/innetgr-stub.c: Ditto. + * libc/sys/linux/net/ip6opt.c: Ditto. + * libc/sys/linux/net/iso_addr.3: Ditto. + * libc/sys/linux/net/iso_addr.c: Ditto. + * libc/sys/linux/net/issetugid-stub.c: Ditto. + * libc/sys/linux/net/linkaddr.3: Ditto. + * libc/sys/linux/net/linkaddr.c: Ditto. + * libc/sys/linux/net/map_v4v6.c: Ditto. + * libc/sys/linux/net/name6.c: Ditto. + * libc/sys/linux/net/namespace.h: Ditto. + * libc/sys/linux/net/ns.3: Ditto. + * libc/sys/linux/net/ns_addr.c: Ditto. + * libc/sys/linux/net/ns_name.c: Ditto. + * libc/sys/linux/net/ns_netint.c: Ditto. + * libc/sys/linux/net/ns_ntoa.c: Ditto. + * libc/sys/linux/net/ns_parse.c: Ditto. + * libc/sys/linux/net/ns_print.c: Ditto. + * libc/sys/linux/net/ns_ttl.c: Ditto. + * libc/sys/linux/net/nsap_addr.c: Ditto. + * libc/sys/linux/net/nsdispatch.3: Ditto. + * libc/sys/linux/net/nsdispatch.c: Ditto. + * libc/sys/linux/net/nslexer.c: Ditto. + * libc/sys/linux/net/nslexer.l: Ditto. + * libc/sys/linux/net/nsparser.c: Ditto. + * libc/sys/linux/net/nsparser.h: Ditto. + * libc/sys/linux/net/nsparser.y: Ditto. + * libc/sys/linux/net/rcmd.3: Ditto. + * libc/sys/linux/net/rcmd.c: Ditto. + * libc/sys/linux/net/rcmdsh.3: Ditto. + * libc/sys/linux/net/rcmdsh.c: Ditto. + * libc/sys/linux/net/recv.c: Ditto. + * libc/sys/linux/net/res_comp.c: Ditto. + * libc/sys/linux/net/res_config.h: Ditto. + * libc/sys/linux/net/res_data.c: Ditto. + * libc/sys/linux/net/res_debug.c: Ditto. + * libc/sys/linux/net/res_init.c: Ditto. + * libc/sys/linux/net/res_mkquery.c: Ditto. + * libc/sys/linux/net/res_mkupdate.c: Ditto. + * libc/sys/linux/net/res_query.c: Ditto. + * libc/sys/linux/net/res_send.c: Ditto. + * libc/sys/linux/net/res_update.c: Ditto. + * libc/sys/linux/net/resolver.3: Ditto. + * libc/sys/linux/net/rthdr.c: Ditto. + * libc/sys/linux/net/send.c: Ditto. + * libc/sys/linux/net/un-namespace.h: Ditto. + * libc/sys/linux/net/vars.c: Ditto. + * libc/sys/linux/stdlib/COPYRIGHT: Ditto. + * libc/sys/linux/stdlib/Makefile.am: Ditto. + * libc/sys/linux/stdlib/Makefile.in: Ditto. + * libc/sys/linux/stdlib/cclass.h: Ditto. + * libc/sys/linux/stdlib/cname.h: Ditto. + * libc/sys/linux/stdlib/collate.c: Ditto. + * libc/sys/linux/stdlib/collate.h: Ditto. + * libc/sys/linux/stdlib/collcmp.c: Ditto. + * libc/sys/linux/stdlib/engine.c: Ditto. + * libc/sys/linux/stdlib/fnmatch.3: Ditto. + * libc/sys/linux/stdlib/fnmatch.c: Ditto. + * libc/sys/linux/stdlib/glob.3: Ditto. + * libc/sys/linux/stdlib/glob.c: Ditto. + * libc/sys/linux/stdlib/reallocf.c: Ditto. + * libc/sys/linux/stdlib/regcomp.c: Ditto. + * libc/sys/linux/stdlib/regerror.c: Ditto. + * libc/sys/linux/stdlib/regex.3: Ditto. + * libc/sys/linux/stdlib/regex2.h: Ditto. + * libc/sys/linux/stdlib/regexec.c: Ditto. + * libc/sys/linux/stdlib/regfree.c: Ditto. + * libc/sys/linux/stdlib/utils.h: Ditto. + * libc/sys/linux/stdlib/wordexp.c: Ditto. + * libc/sys/linux/stdlib/wordfree.c: Ditto. + * libc/sys/linux/sys/dlfcn.h: Ditto. + * libc/sys/linux/sys/elfclass.h: Ditto. + * libc/sys/linux/sys/event.h: Ditto. + * libc/sys/linux/sys/ioccom.h: Ditto. + * libc/sys/linux/sys/libc-tsd.h: Ditto. + * libc/sys/linux/sys/link.h: Ditto. + * libc/sys/linux/sys/lock.h: Ditto. + * libc/sys/linux/sys/param.h: Ditto. + * libc/sys/linux/sys/socket.h: Ditto. + * libc/sys/linux/sys/sockio.h: Ditto. + 2003-05-28 Dhananjay Deshpande * newlib/libc/machine/h8300/memcpy.S: Use .h8300hn and .h8300sn for diff --git a/newlib/configure b/newlib/configure index 3b4c31eca..62d0b61ce 100755 --- a/newlib/configure +++ b/newlib/configure @@ -3090,6 +3090,12 @@ else fi EXTRA_DIRS= +case $host in + i345686-pc-linux-*) + configdirs="${configdirs} iconvdata" + EXTRA_DIRS=iconvdata + ;; +esac # These get added in the top-level configure.in, except in the case where diff --git a/newlib/configure.in b/newlib/configure.in index 255802798..34dcb8643 100644 --- a/newlib/configure.in +++ b/newlib/configure.in @@ -51,6 +51,12 @@ fi AM_CONDITIONAL(HAVE_DOC, test x$have_doc = xyes) EXTRA_DIRS= +case $host in + i[3456]86-pc-linux-*) + configdirs="${configdirs} iconvdata" + EXTRA_DIRS=iconvdata + ;; +esac AC_SUBST(EXTRA_DIRS) # These get added in the top-level configure.in, except in the case where diff --git a/newlib/iconvdata/EUC-JP.irreversible b/newlib/iconvdata/EUC-JP.irreversible new file mode 100644 index 000000000..1921ac8f6 --- /dev/null +++ b/newlib/iconvdata/EUC-JP.irreversible @@ -0,0 +1,2 @@ +0x5C 0x00A5 +0x7E 0x203E diff --git a/newlib/iconvdata/Makefile.am b/newlib/iconvdata/Makefile.am new file mode 100644 index 000000000..a18477bbd --- /dev/null +++ b/newlib/iconvdata/Makefile.am @@ -0,0 +1,25 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir) -I$(srcdir)/../libc/sys/linux $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +if ELIX_LEVEL_1 +LIB_OBJS = +else +LIB_OBJS = euc-jp.$(oext) jis0201.$(oext) jis0208.$(oext) jis0212.$(oext) +endif + +AM_CFLAGS = -DNDEBUG + +all: Makefile + +pkglib_LTLIBRARIES = EUC-JP.la +EUC_JP_la_SOURCES = dummy.c +EUC_JP_la_LIBADD = $(LIB_OBJS) +EUC_JP_la_DEPENDENCIES = $(LIB_OBJS) +EUC_JP_la_LDFLAGS = -module -no-undefined -Xcompiler -Wl,-rpath-link=.. -Xcompiler -nostdlib -L.. -lc + +install-data-local: install-pkglibLTLIBRARIES $(srcdir)/gconv-modules + $(INSTALL_DATA) $(srcdir)/gconv-modules $(DESTDIR)$(pkglibdir)/gconv-modules + diff --git a/newlib/iconvdata/Makefile.in b/newlib/iconvdata/Makefile.in new file mode 100644 index 000000000..e9e3c27d7 --- /dev/null +++ b/newlib/iconvdata/Makefile.in @@ -0,0 +1,389 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +aext = @aext@ +libm_machine_dir = @libm_machine_dir@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir) -I$(srcdir)/../libc/sys/linux $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) +@ELIX_LEVEL_1_TRUE@LIB_OBJS = +@ELIX_LEVEL_1_FALSE@LIB_OBJS = @ELIX_LEVEL_1_FALSE@euc-jp.$(oext) jis0201.$(oext) jis0208.$(oext) jis0212.$(oext) + +AM_CFLAGS = -DNDEBUG + +pkglib_LTLIBRARIES = EUC-JP.la +EUC_JP_la_SOURCES = dummy.c +EUC_JP_la_LIBADD = $(LIB_OBJS) +EUC_JP_la_DEPENDENCIES = $(LIB_OBJS) +EUC_JP_la_LDFLAGS = -module -no-undefined -Xcompiler -Wl,-rpath-link=.. -Xcompiler -nostdlib -L.. -lc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(pkglib_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +EUC_JP_la_OBJECTS = dummy.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(EUC_JP_la_SOURCES) +OBJECTS = $(EUC_JP_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +mostlyclean-pkglibLTLIBRARIES: + +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + +distclean-pkglibLTLIBRARIES: + +maintainer-clean-pkglibLTLIBRARIES: + +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(pkglibdir) + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + else :; fi; \ + done + +uninstall-pkglibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +EUC-JP.la: $(EUC_JP_la_OBJECTS) $(EUC_JP_la_DEPENDENCIES) + $(LINK) -rpath $(pkglibdir) $(EUC_JP_la_LDFLAGS) $(EUC_JP_la_OBJECTS) $(EUC_JP_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: install-pkglibLTLIBRARIES +install-exec: install-exec-am + +install-data-am: install-data-local +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-pkglibLTLIBRARIES +uninstall: uninstall-am +all-am: Makefile $(LTLIBRARIES) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(pkglibdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-pkglibLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-pkglibLTLIBRARIES clean-compile clean-libtool \ + clean-tags clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-pkglibLTLIBRARIES distclean-compile \ + distclean-libtool distclean-tags distclean-generic \ + clean-am + -rm -f libtool + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-pkglibLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-pkglibLTLIBRARIES distclean-pkglibLTLIBRARIES \ +clean-pkglibLTLIBRARIES maintainer-clean-pkglibLTLIBRARIES \ +uninstall-pkglibLTLIBRARIES install-pkglibLTLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-info-am \ +install-info install-exec-am install-exec install-data-local \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +all: Makefile + +install-data-local: install-pkglibLTLIBRARIES $(srcdir)/gconv-modules + $(INSTALL_DATA) $(srcdir)/gconv-modules $(DESTDIR)$(pkglibdir)/gconv-modules + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/iconvdata/SJIS.irreversible b/newlib/iconvdata/SJIS.irreversible new file mode 100644 index 000000000..c3c28e253 --- /dev/null +++ b/newlib/iconvdata/SJIS.irreversible @@ -0,0 +1,5 @@ +0x5C 0x005C +0x7E 0x007E +0x8191 0xFFE0 +0x8192 0xFFE1 +0x81CA 0xFFE2 diff --git a/newlib/iconvdata/aclocal.m4 b/newlib/iconvdata/aclocal.m4 new file mode 100644 index 000000000..ad4b48ec4 --- /dev/null +++ b/newlib/iconvdata/aclocal.m4 @@ -0,0 +1,1181 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl This provides configure definitions used by all the newlib +dnl configure.in files. + +dnl Basic newlib configury. This calls basic introductory stuff, +dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs +dnl configure.host. The only argument is the relative path to the top +dnl newlib directory. + +AC_DEFUN(NEWLIB_CONFIGURE, +[ +dnl Default to --enable-multilib +AC_ARG_ENABLE(multilib, +[ --enable-multilib build many library versions (default)], +[case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; + esac], [multilib=yes])dnl + +dnl Support --enable-target-optspace +AC_ARG_ENABLE(target-optspace, +[ --enable-target-optspace optimize for space], +[case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;; + esac], [target_optspace=])dnl + +dnl Support --enable-malloc-debugging - currently only supported for Cygwin +AC_ARG_ENABLE(malloc-debugging, +[ --enable-malloc-debugging indicate malloc debugging requested], +[case "${enableval}" in + yes) malloc_debugging=yes ;; + no) malloc_debugging=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;; + esac], [malloc_debugging=])dnl + +dnl Support --enable-newlib-mb +AC_ARG_ENABLE(newlib-mb, +[ --enable-newlib-mb enable multibyte support], +[case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;; + esac], [newlib_mb=])dnl + +dnl Support --enable-newlib-multithread +AC_ARG_ENABLE(newlib-multithread, +[ --enable-newlib-multithread enable support for multiple threads], +[case "${enableval}" in + yes) newlib_multithread=yes ;; + no) newlib_multithread=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; + esac], [newlib_multithread=yes])dnl + +dnl Support --enable-newlib-elix-level +AC_ARG_ENABLE(newlib-elix-level, +[ --enable-newlib-elix-level supply desired elix library level (1-4)], +[case "${enableval}" in + 0) newlib_elix_level=0 ;; + 1) newlib_elix_level=1 ;; + 2) newlib_elix_level=2 ;; + 3) newlib_elix_level=3 ;; + 4) newlib_elix_level=4 ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;; + esac], [newlib_elix_level=0])dnl + +dnl Support --disable-newlib-io-float +AC_ARG_ENABLE(newlib-io-float, +[ --disable-newlib-io-float disable printf/scanf family float support], +[case "${enableval}" in + yes) newlib_io_float=yes ;; + no) newlib_io_float=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; + esac], [newlib_io_float=yes])dnl + + +dnl We may get other options which we don't document: +dnl --with-target-subdir, --with-multisrctop, --with-multisubdir + +test -z "[$]{with_target_subdir}" && with_target_subdir=. + +if test "[$]{srcdir}" = "."; then + if test "[$]{with_target_subdir}" != "."; then + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" + else + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" + fi +else + newlib_basedir="[$]{srcdir}/$1" +fi +AC_SUBST(newlib_basedir) + +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(newlib, 1.11.0) + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +AC_CHECK_TOOL(AS, as) +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) + +AC_PROG_INSTALL + +AM_MAINTAINER_MODE + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + AC_EXEEXT +fi + +. [$]{newlib_basedir}/configure.host + +newlib_cflags="[$]{newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} +AC_SUBST(NEWLIB_CFLAGS) + +LDFLAGS=${ldflags} +AC_SUBST(LDFLAGS) + +AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) +AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) +AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) +AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) +AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) + +AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) + +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we +# use oext, which is set in configure.host based on the target platform. +OBJEXT=${oext} + +AC_SUBST(OBJEXT) +AC_SUBST(oext) +AC_SUBST(aext) + +AC_SUBST(libm_machine_dir) +AC_SUBST(machine_dir) +AC_SUBST(sys_dir) +]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + + +# serial 46 AC_PROG_LIBTOOL +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])])])])])]) + +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +AC_ARG_WITH(pic, + [ --with-pic try to use only PIC/non-PIC objects [default=use both]], + pic_mode="$withval", pic_mode=default) +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + re_direlt=['/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + case $host_cpu in + hppa*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + ia64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + esac + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] + else + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'] + fi + ;; + +newsos6) + [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +[sysv5uw[78]* | sysv4*uw2*)] + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + +# AC_LIBTOOL_CXX - enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) + +AC_DEFUN([_AC_LIBTOOL_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +# AC_LIBTOOL_GCJ - enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) + +AC_DEFUN([_AC_LIBTOOL_GCJ], +[AC_REQUIRE([AC_PROG_LIBTOOL]) +AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +dnl old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + diff --git a/newlib/iconvdata/configure b/newlib/iconvdata/configure new file mode 100755 index 000000000..c0756ff4d --- /dev/null +++ b/newlib/iconvdata/configure @@ -0,0 +1,3291 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-multilib build many library versions (default)" +ac_help="$ac_help + --enable-target-optspace optimize for space" +ac_help="$ac_help + --enable-malloc-debugging indicate malloc debugging requested" +ac_help="$ac_help + --enable-newlib-mb enable multibyte support" +ac_help="$ac_help + --enable-newlib-multithread enable support for multiple threads" +ac_help="$ac_help + --enable-newlib-elix-level supply desired elix library level (1-4)" +ac_help="$ac_help + --disable-newlib-io-float disable printf/scanf family float support" +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --enable-shared[=PKGS] build shared libraries [default=yes]" +ac_help="$ac_help + --enable-static[=PKGS] build static libraries [default=yes]" +ac_help="$ac_help + --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" +ac_help="$ac_help + --disable-libtool-lock avoid locking (might break parallel builds)" +ac_help="$ac_help + --with-pic try to use only PIC/non-PIC objects [default=use both]" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +sitefile= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=jis0201.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi +else + CONFIG_SITE="$sitefile" +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in ../.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ../.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:598: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:651: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:708: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:741: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:774: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + +# Check whether --enable-multilib or --disable-multilib was given. +if test "${enable_multilib+set}" = set; then + enableval="$enable_multilib" + case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;; + esac +else + multilib=yes +fi + +# Check whether --enable-target-optspace or --disable-target-optspace was given. +if test "${enable_target_optspace+set}" = set; then + enableval="$enable_target_optspace" + case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;; + esac +else + target_optspace= +fi + +# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. +if test "${enable_malloc_debugging+set}" = set; then + enableval="$enable_malloc_debugging" + case "${enableval}" in + yes) malloc_debugging=yes ;; + no) malloc_debugging=no ;; + *) { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;; + esac +else + malloc_debugging= +fi + +# Check whether --enable-newlib-mb or --disable-newlib-mb was given. +if test "${enable_newlib_mb+set}" = set; then + enableval="$enable_newlib_mb" + case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;; + esac +else + newlib_mb= +fi + +# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given. +if test "${enable_newlib_multithread+set}" = set; then + enableval="$enable_newlib_multithread" + case "${enableval}" in + yes) newlib_multithread=yes ;; + no) newlib_multithread=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;; + esac +else + newlib_multithread=yes +fi + +# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given. +if test "${enable_newlib_elix_level+set}" = set; then + enableval="$enable_newlib_elix_level" + case "${enableval}" in + 0) newlib_elix_level=0 ;; + 1) newlib_elix_level=1 ;; + 2) newlib_elix_level=2 ;; + 3) newlib_elix_level=3 ;; + 4) newlib_elix_level=4 ;; + *) { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;; + esac +else + newlib_elix_level=0 +fi + +# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given. +if test "${enable_newlib_io_float+set}" = set; then + enableval="$enable_newlib_io_float" + case "${enableval}" in + yes) newlib_io_float=yes ;; + no) newlib_io_float=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;; + esac +else + newlib_io_float=yes +fi + + + +test -z "${with_target_subdir}" && with_target_subdir=. + +if test "${srcdir}" = "."; then + if test "${with_target_subdir}" != "."; then + newlib_basedir="${srcdir}/${with_multisrctop}../.." + else + newlib_basedir="${srcdir}/${with_multisrctop}.." + fi +else + newlib_basedir="${srcdir}/.." +fi + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:933: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:954: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:972: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + + +PACKAGE=newlib + +VERSION=1.11.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:1015: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:1028: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:1041: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:1054: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:1067: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1092: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1122: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1171: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1195: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1226: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1258: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1290: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1322: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1367: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1421: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + + + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1455: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + +fi + +. ${newlib_basedir}/configure.host + +newlib_cflags="${newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} + + +LDFLAGS=${ldflags} + + + + +if test x${newlib_elix_level} = x0; then + ELIX_LEVEL_0_TRUE= + ELIX_LEVEL_0_FALSE='#' +else + ELIX_LEVEL_0_TRUE='#' + ELIX_LEVEL_0_FALSE= +fi + + +if test x${newlib_elix_level} = x1; then + ELIX_LEVEL_1_TRUE= + ELIX_LEVEL_1_FALSE='#' +else + ELIX_LEVEL_1_TRUE='#' + ELIX_LEVEL_1_FALSE= +fi + + +if test x${newlib_elix_level} = x2; then + ELIX_LEVEL_2_TRUE= + ELIX_LEVEL_2_FALSE='#' +else + ELIX_LEVEL_2_TRUE='#' + ELIX_LEVEL_2_FALSE= +fi + + +if test x${newlib_elix_level} = x3; then + ELIX_LEVEL_3_TRUE= + ELIX_LEVEL_3_FALSE='#' +else + ELIX_LEVEL_3_TRUE='#' + ELIX_LEVEL_3_FALSE= +fi + + +if test x${newlib_elix_level} = x4; then + ELIX_LEVEL_4_TRUE= + ELIX_LEVEL_4_FALSE='#' +else + ELIX_LEVEL_4_TRUE='#' + ELIX_LEVEL_4_FALSE= +fi + + + +if test x${use_libtool} = xyes; then + USE_LIBTOOL_TRUE= + USE_LIBTOOL_FALSE='#' +else + USE_LIBTOOL_TRUE='#' + USE_LIBTOOL_FALSE= +fi + +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we +# use oext, which is set in configure.host based on the target platform. +OBJEXT=${oext} + + + + + + + + + + + +if test "${use_libtool}" = "yes"; then + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1641: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1671: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1722: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1754: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1765 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1796: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1801: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1829: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:1872: checking for ld used by GCC" >&5 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:1902: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:1905: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:1940: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi + +echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 +echo "configure:1957: checking for $LD option to reload object files" >&5 +if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_ld_reload_flag='-r' +fi + +echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:1969: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$ac_t""$NM" 1>&6 + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:2007: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 +echo "configure:2028: checking how to recognise dependant libraries" >&5 +if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.012) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + case $host_cpu in + hppa*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + esac + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newsos6) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac + +fi + +echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + +echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +echo "configure:2201: checking for object suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if { (eval echo configure:2207: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_objext" 1>&6 +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 +echo "configure:2231: checking for ${ac_tool_prefix}file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo $ac_n "checking for file""... $ac_c" 1>&6 +echo "configure:2293: checking for file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2364: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2396: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + +# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2431: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_STRIP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2463: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="strip" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + STRIP=":" +fi +fi + + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + +libtool_flags="$libtool_flags --enable-win32-dll" +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + : +fi + +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi + +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 2530 "configure"' > conftest.$ac_ext + if { (eval echo configure:2531: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo configure:2550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +echo "configure:2568: checking whether the C compiler needs -belf" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_needs_belf=no +fi +rm -f conftest* + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +fi + +echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +*-*-cygwin* | *-*-mingw* | *-*-pw32*) + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2618: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_DLLTOOL"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2650: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_DLLTOOL="dlltool" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false" +fi +fi +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + DLLTOOL="false" +fi +fi + + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2685: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_AS"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2717: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + AS="false" +fi +fi + + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2752: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_OBJDUMP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2784: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="objdump" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + OBJDUMP="false" +fi +fi + + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6 +echo "configure:2820: checking if libtool should supply DllMain function" >&5 +if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_need_dllmain=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_need_dllmain=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_need_dllmain" 1>&6 + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6 +echo "configure:2854: checking how to link DLLs" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_dll_switch=-mdll +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_dll_switch=-dll +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6 + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + +esac + + +# Save cache, so that ltconfig can load it +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } + +# Reload cache, that may have been modified by ltconfig +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log + + + + + + +fi + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@newlib_basedir@%$newlib_basedir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@RANLIB@%$RANLIB%g +s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g +s%@EXEEXT@%$EXEEXT%g +s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g +s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g +s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g +s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g +s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g +s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g +s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g +s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g +s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g +s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g +s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g +s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g +s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g +s%@OBJEXT@%$OBJEXT%g +s%@oext@%$oext%g +s%@aext@%$aext%g +s%@libm_machine_dir@%$libm_machine_dir%g +s%@machine_dir@%$machine_dir%g +s%@sys_dir@%$sys_dir%g +s%@LN_S@%$LN_S%g +s%@STRIP@%$STRIP%g +s%@DLLTOOL@%$DLLTOOL%g +s%@OBJDUMP@%$OBJDUMP%g +s%@LIBTOOL@%$LIBTOOL%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/newlib/iconvdata/configure.in b/newlib/iconvdata/configure.in new file mode 100644 index 000000000..7aee56866 --- /dev/null +++ b/newlib/iconvdata/configure.in @@ -0,0 +1,21 @@ +dnl This is the newlib/iconvdata configure.in file. +dnl Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.5) +AC_INIT(jis0201.c) + +dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. +AC_CONFIG_AUX_DIR(../..) + +NEWLIB_CONFIGURE(..) + +dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and +dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first +dnl line of the macro which fail because appropriate LDFLAGS are not set. + +if test "${use_libtool}" = "yes"; then +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL +fi + +AC_OUTPUT(Makefile) diff --git a/newlib/iconvdata/dummy.c b/newlib/iconvdata/dummy.c new file mode 100644 index 000000000..9b13d4b4a --- /dev/null +++ b/newlib/iconvdata/dummy.c @@ -0,0 +1 @@ +/* empty file to force proper Makefile creation */ diff --git a/newlib/iconvdata/euc-jp.c b/newlib/iconvdata/euc-jp.c new file mode 100644 index 000000000..1a638994a --- /dev/null +++ b/newlib/iconvdata/euc-jp.c @@ -0,0 +1,246 @@ +/* Mapping tables for EUC-JP handling. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + +/* Definitions used in the body of the `gconv' function. */ +#define CHARSET_NAME "EUC-JP//" +#define FROM_LOOP from_euc_jp +#define TO_LOOP to_euc_jp +#define DEFINE_INIT 1 +#define DEFINE_FINI 1 +#define MIN_NEEDED_FROM 1 +#define MAX_NEEDED_FROM 3 +#define MIN_NEEDED_TO 4 + + +/* First define the conversion function from EUC-JP to UCS4. */ +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MAX_NEEDED_INPUT MAX_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint32_t ch = *inptr; \ + \ + if (ch < 0x8e || (ch >= 0x90 && ch <= 0x9f)) \ + ++inptr; \ + else if (ch == 0xff) \ + { \ + /* This is illegal. */ \ + if (! ignore_errors_p ()) \ + { \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + ++inptr; \ + ++*irreversible; \ + continue; \ + } \ + else \ + { \ + /* Two or more byte character. First test whether the next \ + character is also available. */ \ + int ch2; \ + \ + if (__builtin_expect (inptr + 1 >= inend, 0)) \ + { \ + /* The second character is not available. Store the \ + intermediate result. */ \ + result = __GCONV_INCOMPLETE_INPUT; \ + break; \ + } \ + \ + ch2 = inptr[1]; \ + \ + /* All second bytes of a multibyte character must be >= 0xa1. */ \ + if (__builtin_expect (ch2 < 0xa1, 0)) \ + { \ + /* This is an illegal character. */ \ + if (! ignore_errors_p ()) \ + { \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + ++inptr; \ + ++*irreversible; \ + continue; \ + } \ + \ + if (ch == 0x8e) \ + { \ + /* This is code set 2: half-width katakana. */ \ + ch = jisx0201_to_ucs4 (ch2); \ + if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \ + { \ + /* Illegal character. */ \ + if (! ignore_errors_p ()) \ + { \ + /* This is an illegal character. */ \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + } \ + \ + inptr += 2; \ + } \ + else \ + { \ + const unsigned char *endp; \ + \ + if (ch == 0x8f) \ + { \ + /* This is code set 3: JIS X 0212-1990. */ \ + endp = inptr + 1; \ + \ + ch = jisx0212_to_ucs4 (&endp, inend - endp, 0x80); \ + } \ + else \ + { \ + /* This is code set 1: JIS X 0208. */ \ + endp = inptr; \ + \ + ch = jisx0208_to_ucs4 (&endp, inend - inptr, 0x80); \ + } \ + \ + if (__builtin_expect (ch, 1) == 0) \ + { \ + /* Not enough input available. */ \ + result = __GCONV_INCOMPLETE_INPUT; \ + break; \ + } \ + if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \ + { \ + /* Illegal character. */ \ + if (! ignore_errors_p ()) \ + { \ + /* This is an illegal character. */ \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + inptr += 2; \ + ++*irreversible; \ + continue; \ + } \ + inptr = endp; \ + } \ + } \ + \ + put32 (outptr, ch); \ + outptr += 4; \ + } +#define LOOP_NEED_FLAGS +#include + + +/* Next, define the other direction. */ +#define MIN_NEEDED_INPUT MIN_NEEDED_TO +#define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM +#define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM +#define LOOPFCT TO_LOOP +#define BODY \ + { \ + uint32_t ch = get32 (inptr); \ + \ + if (ch < 0x8e || (ch >= 0x90 && ch <= 0x9f)) \ + /* It's plain ASCII or C1. */ \ + *outptr++ = ch; \ + else if (ch == 0xa5) \ + /* YEN sign => backslash */ \ + *outptr++ = 0x5c; \ + else if (ch == 0x203e) \ + /* overscore => asciitilde */ \ + *outptr++ = 0x7e; \ + else \ + { \ + /* Try the JIS character sets. */ \ + size_t found; \ + \ + /* See whether we have room for at least two characters. */ \ + if (__builtin_expect (outptr + 1 >= outend, 0)) \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + \ + found = ucs4_to_jisx0201 (ch, outptr + 1); \ + if (found != __UNKNOWN_10646_CHAR) \ + { \ + /* Yes, it's a JIS 0201 character. Store the shift byte. */ \ + *outptr = 0x8e; \ + outptr += 2; \ + } \ + else \ + { \ + /* No JIS 0201 character. */ \ + found = ucs4_to_jisx0208 (ch, outptr, 2); \ + /* Please note that we always have enough room for the output. */ \ + if (found != __UNKNOWN_10646_CHAR) \ + { \ + /* It's a JIS 0208 character, adjust it for EUC-JP. */ \ + *outptr++ += 0x80; \ + *outptr++ += 0x80; \ + } \ + else \ + { \ + /* No JIS 0208 character. */ \ + found = ucs4_to_jisx0212 (ch, outptr + 1, \ + outend - outptr - 1); \ + \ + if (__builtin_expect (found, 1) == 0) \ + { \ + /* We ran out of space. */ \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + else if (__builtin_expect (found, 0) != __UNKNOWN_10646_CHAR) \ + { \ + /* It's a JIS 0212 character, adjust it for EUC-JP. */ \ + *outptr++ = 0x8f; \ + *outptr++ += 0x80; \ + *outptr++ += 0x80; \ + } \ + else \ + { \ + UNICODE_TAG_HANDLER (ch, 4); \ + \ + /* Illegal character. */ \ + STANDARD_ERR_HANDLER (4); \ + } \ + } \ + } \ + } \ + \ + inptr += 4; \ + } +#define LOOP_NEED_FLAGS +#include + + +/* Now define the toplevel functions. */ +#include diff --git a/newlib/iconvdata/gconv-modules b/newlib/iconvdata/gconv-modules new file mode 100644 index 000000000..66bb47377 --- /dev/null +++ b/newlib/iconvdata/gconv-modules @@ -0,0 +1,1511 @@ +# GNU libc iconv configuration. +# Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +# All lines contain the following information: + +# If the lines start with `module' +# fromset: either a name triple or a regular expression triple. +# toset: a name triple or an expression with \N to get regular +# expression matching results. +# filename: filename of the module implementing the transformation. +# If it is not absolute the path is made absolute by prepending +# the directory the configuration file is found in. +# cost: optional cost of the transformation. Default is 1. + +# If the lines start with `alias' +# alias: alias name which is not really recognized. +# name: the real name of the character set + +alias ISO-IR-4// BS_4730// +alias ISO646-GB// BS_4730// +alias GB// BS_4730// +alias UK// BS_4730// +alias CSISO4UNITEDKINGDOM// BS_4730// +module BS_4730// INTERNAL ISO646 2 +module INTERNAL BS_4730// ISO646 2 + +alias ISO-IR-121// CSA_Z243.4-1985-1// +alias ISO646-CA// CSA_Z243.4-1985-1// +alias CSA7-1// CSA_Z243.4-1985-1// +alias CA// CSA_Z243.4-1985-1// +alias CSISO121CANADIAN1// CSA_Z243.4-1985-1// +alias CSA_Z243.419851// CSA_Z243.4-1985-1// +module CSA_Z243.4-1985-1// INTERNAL ISO646 2 +module INTERNAL CSA_Z243.4-1985-1// ISO646 2 + +alias ISO-IR-122// CSA_Z243.4-1985-2// +alias ISO646-CA2// CSA_Z243.4-1985-2// +alias CSA7-2// CSA_Z243.4-1985-2// +alias CSISO122CANADIAN2// CSA_Z243.4-1985-2// +alias CSA_Z243.419852// CSA_Z243.4-1985-2// +module CSA_Z243.4-1985-2// INTERNAL ISO646 2 +module INTERNAL CSA_Z243.4-1985-2// ISO646 2 + +alias ISO-IR-21// DIN_66003// +alias DE// DIN_66003// +alias ISO646-DE// DIN_66003// +alias CSISO21GERMAN// DIN_66003// +module DIN_66003// INTERNAL ISO646 2 +module INTERNAL DIN_66003// ISO646 2 + +alias DS2089// DS_2089// +alias ISO646-DK// DS_2089// +alias DK// DS_2089// +alias CSISO646DANISH// DS_2089// +module DS_2089// INTERNAL ISO646 2 +module INTERNAL DS_2089// ISO646 2 + +alias ISO-IR-17// ES// +alias ISO646-ES// ES// +alias CSISO17SPANISH// ES// +module ES// INTERNAL ISO646 2 +module INTERNAL ES// ISO646 2 + +alias ISO-IR-85// ES2// +alias ISO646-ES2// ES2// +alias CSISO85SPANISH2// ES2// +module ES2// INTERNAL ISO646 2 +module INTERNAL ES2// ISO646 2 + +alias ISO-IR-57// GB_1988-80// +alias CN// GB_1988-80// +alias ISO646-CN// GB_1988-80// +alias CSISO58GB1988// GB_1988-80// +alias GB_198880// GB_1988-80// +module GB_1988-80// INTERNAL ISO646 2 +module INTERNAL GB_1988-80// ISO646 2 + +alias ISO-IR-15// IT// +alias ISO646-IT// IT// +alias CSISO15ITALIAN// IT// +module IT// INTERNAL ISO646 2 +module INTERNAL IT// ISO646 2 + +alias ISO-IR-14// JIS_C6220-1969-RO// +alias JP// JIS_C6220-1969-RO// +alias ISO646-JP// JIS_C6220-1969-RO// +alias CSISO14JISC6220RO// JIS_C6220-1969-RO// +alias JIS_C62201969RO// JIS_C6220-1969-RO// +module JIS_C6220-1969-RO// INTERNAL ISO646 2 +module INTERNAL JIS_C6220-1969-RO// ISO646 2 + +alias ISO-IR-92// JIS_C6229-1984-B// +alias ISO646-JP-OCR-B// JIS_C6229-1984-B// +alias JP-OCR-B// JIS_C6229-1984-B// +alias CSISO92JISC62991984B// JIS_C6229-1984-B// +alias JIS_C62291984B// JIS_C6229-1984-B// +module JIS_C6229-1984-B// INTERNAL ISO646 2 +module INTERNAL JIS_C6229-1984-B// ISO646 2 + +alias ISO-IR-141// JUS_I.B1.002// +alias ISO646-YU// JUS_I.B1.002// +alias JS// JUS_I.B1.002// +alias YU// JUS_I.B1.002// +alias CSISO141JUSIB1002// JUS_I.B1.002// +module JUS_I.B1.002// INTERNAL ISO646 2 +module INTERNAL JUS_I.B1.002// ISO646 2 + +alias ISO646-KR// KSC5636// +alias CSKSC5636// KSC5636// +module KSC5636// INTERNAL ISO646 2 +module INTERNAL KSC5636// ISO646 2 + +alias ISO-IR-86// MSZ_7795.3// +alias ISO646-HU// MSZ_7795.3// +alias HU// MSZ_7795.3// +alias CSISO86HUNGARIAN// MSZ_7795.3// +module MSZ_7795.3// INTERNAL ISO646 2 +module INTERNAL MSZ_7795.3// ISO646 2 + +alias CUBA// NC_NC00-10// +alias NC_NC00-10:81// NC_NC00-10// +alias ISO-IR-151// NC_NC00-10// +alias ISO646-CU// NC_NC00-10// +alias CSISO151CUBA// NC_NC00-10// +alias NC_NC0010// NC_NC00-10// +module NC_NC00-10// INTERNAL ISO646 2 +module INTERNAL NC_NC00-10// ISO646 2 + +alias ISO-IR-69// NF_Z_62-010// +alias ISO646-FR// NF_Z_62-010// +alias FR// NF_Z_62-010// +alias CSISO69FRENCH// NF_Z_62-010// +alias NF_Z_62010// NF_Z_62-010// +module NF_Z_62-010// INTERNAL ISO646 2 +module INTERNAL NF_Z_62-010// ISO646 2 + +alias ISO-IR-25// NF_Z_62-010_1973// +alias ISO646-FR1// NF_Z_62-010_1973// +alias NF_Z_62-010_(1973)// NF_Z_62-010_1973// +alias CSISO25FRENCH// NF_Z_62-010_1973// +alias NF_Z_62010_1973// NF_Z_62-010_1973// +module NF_Z_62-010_1973// INTERNAL ISO646 2 +module INTERNAL NF_Z_62-010_1973// ISO646 2 + +alias ISO-IR-60// NS_4551-1// +alias ISO646-NO// NS_4551-1// +alias NO// NS_4551-1// +alias CSISO60DANISHNORWEGIAN// NS_4551-1// +alias CSISO60NORWEGIAN1// NS_4551-1// +alias NS_45511// NS_4551-1// +module NS_4551-1// INTERNAL ISO646 2 +module INTERNAL NS_4551-1// ISO646 2 + +alias ISO646-NO2// NS_4551-2// +alias ISO-IR-61// NS_4551-2// +alias NO2// NS_4551-2// +alias CSISO61NORWEGIAN2// NS_4551-2// +alias NS_45512// NS_4551-2// +module NS_4551-2// INTERNAL ISO646 2 +module INTERNAL NS_4551-2// ISO646 2 + +alias ISO-IR-16// PT// +alias ISO646-PT// PT// +alias CSISO16PORTUGESE// PT// +module PT// INTERNAL ISO646 2 +module INTERNAL PT// ISO646 2 + +alias ISO-IR-84// PT2// +alias ISO646-PT2// PT2// +alias CSISO84PORTUGUESE2// PT2// +module PT2// INTERNAL ISO646 2 +module INTERNAL PT2// ISO646 2 + +alias ISO-IR-10// SEN_850200_B// +alias FI// SEN_850200_B// +alias ISO646-FI// SEN_850200_B// +alias ISO646-SE// SEN_850200_B// +alias SE// SEN_850200_B// +alias CSISO10SWEDISH// SEN_850200_B// +alias SS636127// SEN_850200_B// +module SEN_850200_B// INTERNAL ISO646 2 +module INTERNAL SEN_850200_B// ISO646 2 + +alias ISO-IR-11// SEN_850200_C// +alias ISO646-SE2// SEN_850200_C// +alias SE2// SEN_850200_C// +alias CSISO11SWEDISHFORNAMES// SEN_850200_C// +module SEN_850200_C// INTERNAL ISO646 2 +module INTERNAL SEN_850200_C// ISO646 2 + +# from to module cost +alias ISO-IR-100// ISO-8859-1// +alias ISO_8859-1:1987// ISO-8859-1// +alias ISO_8859-1// ISO-8859-1// +alias ISO8859-1// ISO-8859-1// +alias ISO88591// ISO-8859-1// +alias LATIN1// ISO-8859-1// +alias L1// ISO-8859-1// +alias IBM819// ISO-8859-1// +alias CP819// ISO-8859-1// +alias CSISOLATIN1// ISO-8859-1// +alias 8859_1// ISO-8859-1// +alias OSF00010001// ISO-8859-1// +module ISO-8859-1// INTERNAL ISO8859-1 1 +module INTERNAL ISO-8859-1// ISO8859-1 1 + +# from to module cost +alias ISO-IR-101// ISO-8859-2// +alias ISO_8859-2:1987// ISO-8859-2// +alias ISO_8859-2// ISO-8859-2// +alias ISO8859-2// ISO-8859-2// +alias ISO88592// ISO-8859-2// +alias LATIN2// ISO-8859-2// +alias L2// ISO-8859-2// +alias CSISOLATIN2// ISO-8859-2// +alias 8859_2// ISO-8859-2// +alias OSF00010002// ISO-8859-2// +alias IBM912// ISO-8859-2// +alias CP912// ISO-8859-2// +module ISO-8859-2// INTERNAL ISO8859-2 1 +module INTERNAL ISO-8859-2// ISO8859-2 1 + +# from to module cost +alias ISO-IR-109// ISO-8859-3// +alias ISO_8859-3:1988// ISO-8859-3// +alias ISO_8859-3// ISO-8859-3// +alias ISO8859-3// ISO-8859-3// +alias ISO88593// ISO-8859-3// +alias LATIN3// ISO-8859-3// +alias L3// ISO-8859-3// +alias CSISOLATIN3// ISO-8859-3// +alias 8859_3// ISO-8859-3// +alias OSF00010003// ISO-8859-3// +module ISO-8859-3// INTERNAL ISO8859-3 1 +module INTERNAL ISO-8859-3// ISO8859-3 1 + +# from to module cost +alias ISO-IR-110// ISO-8859-4// +alias ISO_8859-4:1988// ISO-8859-4// +alias ISO_8859-4// ISO-8859-4// +alias ISO8859-4// ISO-8859-4// +alias ISO88594// ISO-8859-4// +alias LATIN4// ISO-8859-4// +alias L4// ISO-8859-4// +alias CSISOLATIN4// ISO-8859-4// +alias 8859_4// ISO-8859-4// +alias OSF00010004// ISO-8859-4// +module ISO-8859-4// INTERNAL ISO8859-4 1 +module INTERNAL ISO-8859-4// ISO8859-4 1 + +# from to module cost +alias ISO-IR-144// ISO-8859-5// +alias ISO_8859-5:1988// ISO-8859-5// +alias ISO_8859-5// ISO-8859-5// +alias ISO8859-5// ISO-8859-5// +alias ISO88595// ISO-8859-5// +alias CYRILLIC// ISO-8859-5// +alias CSISOLATINCYRILLIC// ISO-8859-5// +alias 8859_5// ISO-8859-5// +alias OSF00010005// ISO-8859-5// +alias IBM915// ISO-8859-5// +alias CP915// ISO-8859-5// +module ISO-8859-5// INTERNAL ISO8859-5 1 +module INTERNAL ISO-8859-5// ISO8859-5 1 + +# from to module cost +alias ISO-IR-127// ISO-8859-6// +alias ISO_8859-6:1987// ISO-8859-6// +alias ISO_8859-6// ISO-8859-6// +alias ISO8859-6// ISO-8859-6// +alias ISO88596// ISO-8859-6// +alias ECMA-114// ISO-8859-6// +alias ASMO-708// ISO-8859-6// +alias ARABIC// ISO-8859-6// +alias CSISOLATINARABIC// ISO-8859-6// +alias 8859_6// ISO-8859-6// +alias OSF00010006// ISO-8859-6// +alias IBM1089// ISO-8859-6// +alias CP1089// ISO-8859-6// +module ISO-8859-6// INTERNAL ISO8859-6 1 +module INTERNAL ISO-8859-6// ISO8859-6 1 + +# from to module cost +alias ISO-IR-126// ISO-8859-7// +alias ISO_8859-7:1987// ISO-8859-7// +alias ISO_8859-7// ISO-8859-7// +alias ISO8859-7// ISO-8859-7// +alias ISO88597// ISO-8859-7// +alias ELOT_928// ISO-8859-7// +alias ECMA-118// ISO-8859-7// +alias GREEK// ISO-8859-7// +alias GREEK8// ISO-8859-7// +alias CSISOLATINGREEK// ISO-8859-7// +alias 8859_7// ISO-8859-7// +alias OSF00010007// ISO-8859-7// +alias IBM813// ISO-8859-7// +alias CP813// ISO-8859-7// +module ISO-8859-7// INTERNAL ISO8859-7 1 +module INTERNAL ISO-8859-7// ISO8859-7 1 + +# from to module cost +alias ISO-IR-138// ISO-8859-8// +alias ISO_8859-8:1988// ISO-8859-8// +alias ISO_8859-8// ISO-8859-8// +alias ISO8859-8// ISO-8859-8// +alias ISO88598// ISO-8859-8// +alias HEBREW// ISO-8859-8// +alias CSISOLATINHEBREW// ISO-8859-8// +alias 8859_8// ISO-8859-8// +alias OSF00010008// ISO-8859-8// +alias IBM916// ISO-8859-8// +alias CP916// ISO-8859-8// +module ISO-8859-8// INTERNAL ISO8859-8 1 +module INTERNAL ISO-8859-8// ISO8859-8 1 + +# from to module cost +alias ISO-IR-148// ISO-8859-9// +alias ISO_8859-9:1989// ISO-8859-9// +alias ISO_8859-9// ISO-8859-9// +alias ISO8859-9// ISO-8859-9// +alias ISO88599// ISO-8859-9// +alias LATIN5// ISO-8859-9// +alias L5// ISO-8859-9// +alias CSISOLATIN5// ISO-8859-9// +alias 8859_9// ISO-8859-9// +alias OSF00010009// ISO-8859-9// +alias IBM920// ISO-8859-9// +alias CP920// ISO-8859-9// +alias TS-5881// ISO-8859-9// +alias ECMA-128// ISO-8859-9// +module ISO-8859-9// INTERNAL ISO8859-9 1 +module INTERNAL ISO-8859-9// ISO8859-9 1 + +# from to module cost +alias ISO-IR-157// ISO-8859-10// +alias ISO_8859-10:1992// ISO-8859-10// +alias ISO_8859-10// ISO-8859-10// +alias ISO8859-10// ISO-8859-10// +alias ISO885910// ISO-8859-10// +alias LATIN6// ISO-8859-10// +alias L6// ISO-8859-10// +alias CSISOLATIN6// ISO-8859-10// +alias OSF0001000A// ISO-8859-10// +module ISO-8859-10// INTERNAL ISO8859-10 1 +module INTERNAL ISO-8859-10// ISO8859-10 1 + +# from to module cost +module ISO-8859-11// INTERNAL ISO8859-11 1 +module INTERNAL ISO-8859-11// ISO8859-11 1 + +# from to module cost +alias ISO8859-13// ISO-8859-13// +alias ISO885913// ISO-8859-13// +alias ISO-IR-179// ISO-8859-13// +alias LATIN7// ISO-8859-13// +alias L7// ISO-8859-13// +alias BALTIC// ISO-8859-13// +module ISO-8859-13// INTERNAL ISO8859-13 1 +module INTERNAL ISO-8859-13// ISO8859-13 1 + +# from to module cost +alias ISO8859-14// ISO-8859-14// +alias ISO885914// ISO-8859-14// +alias ISO-IR-199// ISO-8859-14// +alias LATIN8// ISO-8859-14// +alias L8// ISO-8859-14// +alias ISO_8859-14:1998// ISO-8859-14// +alias ISO_8859-14// ISO-8859-14// +alias ISO-CELTIC// ISO-8859-14// +module ISO-8859-14// INTERNAL ISO8859-14 1 +module INTERNAL ISO-8859-14// ISO8859-14 1 + +# from to module cost +alias ISO8859-15// ISO-8859-15// +alias ISO885915// ISO-8859-15// +alias ISO-IR-203// ISO-8859-15// +alias ISO_8859-15:1998// ISO-8859-15// +module ISO-8859-15// INTERNAL ISO8859-15 1 +module INTERNAL ISO-8859-15// ISO8859-15 1 + +# from to module cost +alias ISO8859-16// ISO-8859-16// +alias ISO885916// ISO-8859-16// +alias ISO-IR-226// ISO-8859-16// +alias LATIN10// ISO-8859-16// +alias L10// ISO-8859-16// +module ISO-8859-16// INTERNAL ISO8859-16 1 +module INTERNAL ISO-8859-16// ISO8859-16 1 + +# from to module cost +alias T.61// T.61-8BIT// +alias ISO-IR-103// T.61-8BIT// +alias CSISO103T618BIT// T.61-8BIT// +alias T.618BIT// T.61-8BIT// +module T.61-8BIT// INTERNAL T.61 1 +module INTERNAL T.61-8BIT// T.61 1 + +# from to module cost +alias ISO-IR-156// ISO_6937// +alias ISO_6937:1992// ISO_6937// +alias ISO6937// ISO_6937// +module ISO_6937// INTERNAL ISO_6937 1 +module INTERNAL ISO_6937// ISO_6937 1 + + +# from to module cost +alias ISO-IR-90// ISO_6937-2// +alias ISO_6937-2:1983// ISO_6937-2// +alias CSISO90// ISO_6937-2// +alias ISO_69372// ISO_6937-2// +module ISO_6937-2// INTERNAL ISO_6937-2 1 +module INTERNAL ISO_6937-2// ISO_6937-2 1 + +# from to module cost +alias SHIFT-JIS// SJIS// +alias SHIFT_JIS// SJIS// +alias CP932// SJIS// +alias MS_KANJI// SJIS// +alias CSSHIFTJIS// SJIS// +module SJIS// INTERNAL SJIS 1 +module INTERNAL SJIS// SJIS 1 + +# from to module cost +alias KOI8// KOI-8// +module KOI-8// INTERNAL KOI-8 1 +module INTERNAL KOI-8// KOI-8 1 + +# from to module cost +alias CSKOI8R// KOI8-R// +alias KOI8R// KOI8-R// +module KOI8-R// INTERNAL KOI8-R 1 +module INTERNAL KOI8-R// KOI8-R 1 + +# from to module cost +alias ISO-IR-19// LATIN-GREEK// +alias CSISO19LATINGREEK// LATIN-GREEK// +alias LATINGREEK// LATIN-GREEK// +module LATIN-GREEK// INTERNAL LATIN-GREEK 1 +module INTERNAL LATIN-GREEK// LATIN-GREEK 1 + +# from to module cost +alias ISO-IR-27// LATIN-GREEK-1// +alias CSISO27LATINGREEK1// LATIN-GREEK-1// +alias LATINGREEK1// LATIN-GREEK-1// +module LATIN-GREEK-1// INTERNAL LATIN-GREEK-1 1 +module INTERNAL LATIN-GREEK-1// LATIN-GREEK-1 1 + +# from to module cost +alias ROMAN8// HP-ROMAN8// +alias R8// HP-ROMAN8// +alias CSHPROMAN8// HP-ROMAN8// +alias OSF10010001// HP-ROMAN8// +alias HPROMAN8// HP-ROMAN8// +module HP-ROMAN8// INTERNAL HP-ROMAN8 1 +module INTERNAL HP-ROMAN8// HP-ROMAN8 1 + +# from to module cost +alias CSEBCDICATDE// EBCDIC-AT-DE// +alias EBCDICATDE// EBCDIC-AT-DE// +module EBCDIC-AT-DE// INTERNAL EBCDIC-AT-DE 1 +module INTERNAL EBCDIC-AT-DE// EBCDIC-AT-DE 1 + +# from to module cost +alias CSEBCDICATDEA// EBCDIC-AT-DE-A// +alias EBCDICATDEA// EBCDIC-AT-DE-A// +module EBCDIC-AT-DE-A// INTERNAL EBCDIC-AT-DE-A 1 +module INTERNAL EBCDIC-AT-DE-A// EBCDIC-AT-DE-A 1 + +# from to module cost +alias CSEBCDICCAFR// EBCDIC-CA-FR// +alias EBCDICCAFR// EBCDIC-CA-FR// +module EBCDIC-CA-FR// INTERNAL EBCDIC-CA-FR 1 +module INTERNAL EBCDIC-CA-FR// EBCDIC-CA-FR 1 + +# from to module cost +alias CSEBCDICDKNO// EBCDIC-DK-NO// +alias EBCDICDKNO// EBCDIC-DK-NO// +module EBCDIC-DK-NO// INTERNAL EBCDIC-DK-NO 1 +module INTERNAL EBCDIC-DK-NO// EBCDIC-DK-NO 1 + +# from to module cost +alias CSEBCDICDKNOA// EBCDIC-DK-NO-A// +alias EBCDICDKNOA// EBCDIC-DK-NO-A// +module EBCDIC-DK-NO-A// INTERNAL EBCDIC-DK-NO-A 1 +module INTERNAL EBCDIC-DK-NO-A// EBCDIC-DK-NO-A 1 + +# from to module cost +alias CSEBCDICES// EBCDIC-ES// +alias EBCDICES// EBCDIC-ES// +module EBCDIC-ES// INTERNAL EBCDIC-ES 1 +module INTERNAL EBCDIC-ES// EBCDIC-ES 1 + +# from to module cost +alias CSEBCDICESA// EBCDIC-ES-A// +alias EBCDICESA// EBCDIC-ES-A// +module EBCDIC-ES-A// INTERNAL EBCDIC-ES-A 1 +module INTERNAL EBCDIC-ES-A// EBCDIC-ES-A 1 + +# from to module cost +alias CSEBCDICESS// EBCDIC-ES-S// +alias EBCDICESS// EBCDIC-ES-S// +module EBCDIC-ES-S// INTERNAL EBCDIC-ES-S 1 +module INTERNAL EBCDIC-ES-S// EBCDIC-ES-S 1 + +# from to module cost +alias CSEBCDICFISE// EBCDIC-FI-SE// +alias EBCDICFISE// EBCDIC-FI-SE// +module EBCDIC-FI-SE// INTERNAL EBCDIC-FI-SE 1 +module INTERNAL EBCDIC-FI-SE// EBCDIC-FI-SE 1 + +# from to module cost +alias CSEBCDICFISEA// EBCDIC-FI-SE-A// +alias EBCDICFISEA// EBCDIC-FI-SE-A// +module EBCDIC-FI-SE-A// INTERNAL EBCDIC-FI-SE-A 1 +module INTERNAL EBCDIC-FI-SE-A// EBCDIC-FI-SE-A 1 + +# from to module cost +alias CSEBCDICFR// EBCDIC-FR// +alias EBCDICFR// EBCDIC-FR// +module EBCDIC-FR// INTERNAL EBCDIC-FR 1 +module INTERNAL EBCDIC-FR// EBCDIC-FR 1 + +# from to module cost +alias EBCDICISFRISS// EBCDIC-IS-FRISS// +module EBCDIC-IS-FRISS// INTERNAL EBCDIC-IS-FRISS 1 +module INTERNAL EBCDIC-IS-FRISS// EBCDIC-IS-FRISS 1 + +# from to module cost +alias CSEBCDICIT// EBCDIC-IT// +alias EBCDICIT// EBCDIC-IT// +module EBCDIC-IT// INTERNAL EBCDIC-IT 1 +module INTERNAL EBCDIC-IT// EBCDIC-IT 1 + +# from to module cost +alias CSEBCDICPT// EBCDIC-PT// +alias EBCDICPT// EBCDIC-PT// +module EBCDIC-PT// INTERNAL EBCDIC-PT 1 +module INTERNAL EBCDIC-PT// EBCDIC-PT 1 + +# from to module cost +alias CSEBCDICUK// EBCDIC-UK// +alias EBCDICUK// EBCDIC-UK// +module EBCDIC-UK// INTERNAL EBCDIC-UK 1 +module INTERNAL EBCDIC-UK// EBCDIC-UK 1 + +# from to module cost +alias CSEBCDICUS// EBCDIC-US// +alias EBCDICUS// EBCDIC-US// +module EBCDIC-US// INTERNAL EBCDIC-US 1 +module INTERNAL EBCDIC-US// EBCDIC-US 1 + +# from to module cost +alias CP037// IBM037// +alias EBCDIC-CP-US// IBM037// +alias EBCDIC-CP-CA// IBM037// +alias EBCDIC-CP-WT// IBM037// +alias EBCDIC-CP-NL// IBM037// +alias CSIBM037// IBM037// +alias OSF10020025// IBM037// +alias CP1070// IBM037// +alias CP282// IBM037// +module IBM037// INTERNAL IBM037 1 +module INTERNAL IBM037// IBM037 1 + +# from to module cost +alias EBCDIC-INT// IBM038// +alias CP038// IBM038// +alias CSIBM038// IBM038// +module IBM038// INTERNAL IBM038 1 +module INTERNAL IBM038// IBM038 1 + +# from to module cost +alias EBCDIC-INT1// IBM256// +module IBM256// INTERNAL IBM256 1 +module INTERNAL IBM256// IBM256 1 + +# from to module cost +alias CP273// IBM273// +alias CSIBM273// IBM273// +alias OSF10020111// IBM273// +module IBM273// INTERNAL IBM273 1 +module INTERNAL IBM273// IBM273 1 + +# from to module cost +alias EBCDIC-BE// IBM274// +alias CP274// IBM274// +alias CSIBM274// IBM274// +module IBM274// INTERNAL IBM274 1 +module INTERNAL IBM274// IBM274 1 + +# from to module cost +alias EBCDIC-BR// IBM275// +alias CP275// IBM275// +alias CSIBM275// IBM275// +module IBM275// INTERNAL IBM275 1 +module INTERNAL IBM275// IBM275 1 + +# from to module cost +alias EBCDIC-CP-DK// IBM277// +alias EBCDIC-CP-NO// IBM277// +alias CSIBM277// IBM277// +alias OSF10020115// IBM277// +module IBM277// INTERNAL IBM277 1 +module INTERNAL IBM277// IBM277 1 + +# from to module cost +alias CP278// IBM278// +alias EBCDIC-CP-FI// IBM278// +alias EBCDIC-CP-SE// IBM278// +alias CSIBM278// IBM278// +alias OSF10020116// IBM278// +module IBM278// INTERNAL IBM278 1 +module INTERNAL IBM278// IBM278 1 + +# from to module cost +alias CP280// IBM280// +alias EBCDIC-CP-IT// IBM280// +alias CSIBM280// IBM280// +alias OSF10020118// IBM280// +module IBM280// INTERNAL IBM280 1 +module INTERNAL IBM280// IBM280 1 + +# from to module cost +alias EBCDIC-JP-E// IBM281// +alias CP281// IBM281// +alias CSIBM281// IBM281// +module IBM281// INTERNAL IBM281 1 +module INTERNAL IBM281// IBM281 1 + +# from to module cost +alias CP284// IBM284// +alias EBCDIC-CP-ES// IBM284// +alias CSIBM284// IBM284// +alias OSF1002011C// IBM284// +alias CP1079// IBM284// +module IBM284// INTERNAL IBM284 1 +module INTERNAL IBM284// IBM284 1 + +# from to module cost +alias CP285// IBM285// +alias EBCDIC-CP-GB// IBM285// +alias CSIBM285// IBM285// +alias OSF1002011D// IBM285// +module IBM285// INTERNAL IBM285 1 +module INTERNAL IBM285// IBM285 1 + +# from to module cost +alias CP290// IBM290// +alias EBCDIC-JP-KANA// IBM290// +alias CSIBM290// IBM290// +alias OSF10020122// IBM290// +module IBM290// INTERNAL IBM290 1 +module INTERNAL IBM290// IBM290 1 + +# from to module cost +alias CP297// IBM297// +alias EBCDIC-CP-FR// IBM297// +alias CSIBM297// IBM297// +alias OSF10020129// IBM297// +alias CP1081// IBM297// +module IBM297// INTERNAL IBM297 1 +module INTERNAL IBM297// IBM297 1 + +# from to module cost +alias CP420// IBM420// +alias EBCDIC-CP-AR1// IBM420// +alias CSIBM420// IBM420// +alias OSF100201A4// IBM420// +module IBM420// INTERNAL IBM420 1 +module INTERNAL IBM420// IBM420 1 + +# from to module cost +alias CP423// IBM423// +alias EBCDIC-CP-GR// IBM423// +alias CSIBM423// IBM423// +module IBM423// INTERNAL IBM423 1 +module INTERNAL IBM423// IBM423 1 + +# from to module cost +alias CP424// IBM424// +alias EBCDIC-CP-HE// IBM424// +alias CSIBM424// IBM424// +alias OSF100201A8// IBM424// +module IBM424// INTERNAL IBM424 1 +module INTERNAL IBM424// IBM424 1 + +# from to module cost +alias CP437// IBM437// +alias 437// IBM437// +alias CSPC8CODEPAGE437// IBM437// +alias OSF100201B5// IBM437// +module IBM437// INTERNAL IBM437 1 +module INTERNAL IBM437// IBM437 1 + +# from to module cost +alias CP500// IBM500// +alias 500// IBM500// +alias 500V1// IBM500// +alias EBCDIC-CP-BE// IBM500// +alias EBCDIC-CP-CH// IBM500// +alias CSIBM500// IBM500// +alias OSF100201F4// IBM500// +alias CP1084// IBM500// +module IBM500// INTERNAL IBM500 1 +module INTERNAL IBM500// IBM500 1 + +# from to module cost +alias CP850// IBM850// +alias 850// IBM850// +alias CSPC850MULTILINGUAL// IBM850// +alias OSF10020352// IBM850// +module IBM850// INTERNAL IBM850 1 +module INTERNAL IBM850// IBM850 1 + +# from to module cost +alias CP851// IBM851// +alias 851// IBM851// +alias CSIBM851// IBM851// +module IBM851// INTERNAL IBM851 1 +module INTERNAL IBM851// IBM851 1 + +# from to module cost +alias CP852// IBM852// +alias 852// IBM852// +alias CSPCP852// IBM852// +alias OSF10020354// IBM852// +module IBM852// INTERNAL IBM852 1 +module INTERNAL IBM852// IBM852 1 + +# from to module cost +alias CP855// IBM855// +alias 855// IBM855// +alias CSIBM855// IBM855// +alias OSF10020357// IBM855// +module IBM855// INTERNAL IBM855 1 +module INTERNAL IBM855// IBM855 1 + +# from to module cost +alias IBM-856// IBM856// +alias CP856// IBM856// +alias 856// IBM856// +alias CSIBM856// IBM856// +module IBM856// INTERNAL IBM856 1 +module INTERNAL IBM856// IBM856 1 + +# from to module cost +alias CP857// IBM857// +alias 857// IBM857// +alias CSIBM857// IBM857// +alias OSF10020359// IBM857// +module IBM857// INTERNAL IBM857 1 +module INTERNAL IBM857// IBM857 1 + +# from to module cost +alias CP860// IBM860// +alias 860// IBM860// +alias CSIBM860// IBM860// +module IBM860// INTERNAL IBM860 1 +module INTERNAL IBM860// IBM860 1 + +# from to module cost +alias CP861// IBM861// +alias 861// IBM861// +alias CPIBM861// IBM861// +alias OSF1002035D// IBM861// +module IBM861// INTERNAL IBM861 1 +module INTERNAL IBM861// IBM861 1 + +# from to module cost +alias CP862// IBM862// +alias 862// IBM862// +alias CSPC862LATINHEBREW// IBM862// +alias OSF1002035E// IBM862// +module IBM862// INTERNAL IBM862 1 +module INTERNAL IBM862// IBM862 1 + +# from to module cost +alias CP863// IBM863// +alias 863// IBM863// +alias CSIBM863// IBM863// +alias OSF1002035F// IBM863// +module IBM863// INTERNAL IBM863 1 +module INTERNAL IBM863// IBM863 1 + +# from to module cost +alias CP864// IBM864// +alias 864// IBM864// +alias CSIBM864// IBM864// +alias OSF10020360// IBM864// +module IBM864// INTERNAL IBM864 1 +module INTERNAL IBM864// IBM864 1 + +# from to module cost +alias CP865// IBM865// +alias 865// IBM865// +alias CSIBM865// IBM865// +module IBM865// INTERNAL IBM865 1 +module INTERNAL IBM865// IBM865 1 + +# from to module cost +alias CP866// IBM866// +alias 866// IBM866// +alias CSIBM866// IBM866// +module IBM866// INTERNAL IBM866 1 +module INTERNAL IBM866// IBM866 1 + +# from to module cost +alias CP868// IBM868// +alias CP-AR// IBM868// +alias CSIBM868// IBM868// +alias OSF10020364// IBM868// +module IBM868// INTERNAL IBM868 1 +module INTERNAL IBM868// IBM868 1 + +# from to module cost +alias CP869// IBM869// +alias 869// IBM869// +alias CP-GR// IBM869// +alias CSIBM869// IBM869// +alias OSF10020365// IBM869// +module IBM869// INTERNAL IBM869 1 +module INTERNAL IBM869// IBM869 1 + +# from to module cost +alias CP870// IBM870// +alias EBCDIC-CP-ROECE// IBM870// +alias EBCDIC-CP-YU// IBM870// +alias CSIBM870// IBM870// +alias OSF10020366// IBM870// +module IBM870// INTERNAL IBM870 1 +module INTERNAL IBM870// IBM870 1 + +# from to module cost +alias CP871// IBM871// +alias EBCDIC-CP-IS// IBM871// +alias CSIBM871// IBM871// +alias OSF10020367// IBM871// +module IBM871// INTERNAL IBM871 1 +module INTERNAL IBM871// IBM871 1 + +# from to module cost +alias CP875// IBM875// +alias EBCDIC-GREEK// IBM875// +alias OSF1002036B// IBM875// +module IBM875// INTERNAL IBM875 1 +module INTERNAL IBM875// IBM875 1 + +# from to module cost +alias CP880// IBM880// +alias EBCDIC-CYRILLIC// IBM880// +alias CSIBM880// IBM880// +alias OSF10020370// IBM880// +module IBM880// INTERNAL IBM880 1 +module INTERNAL IBM880// IBM880 1 + +# from to module cost +alias CP891// IBM891// +alias CSIBM891// IBM891// +alias OSF1002037B// IBM891// +module IBM891// INTERNAL IBM891 1 +module INTERNAL IBM891// IBM891 1 + +# from to module cost +alias CP903// IBM903// +alias CSIBM903// IBM903// +alias OSF10020387// IBM903// +module IBM903// INTERNAL IBM903 1 +module INTERNAL IBM903// IBM903 1 + +# from to module cost +alias CP904// IBM904// +alias 904// IBM904// +alias CSIBM904// IBM904// +alias OSF10020388// IBM904// +module IBM904// INTERNAL IBM904 1 +module INTERNAL IBM904// IBM904 1 + +# from to module cost +alias CP905// IBM905// +alias EBCDIC-CP-TR// IBM905// +alias CSIBM905// IBM905// +module IBM905// INTERNAL IBM905 1 +module INTERNAL IBM905// IBM905 1 + +# from to module cost +alias CP918// IBM918// +alias EBCDIC-CP-AR2// IBM918// +alias CSIBM918// IBM918// +alias OSF10020396// IBM918// +module IBM918// INTERNAL IBM918 1 +module INTERNAL IBM918// IBM918 1 + +# from to module cost +alias IBM-922// IBM922// +alias CP922// IBM922// +alias CSIBM922// IBM922// +module IBM922// INTERNAL IBM922 1 +module INTERNAL IBM922// IBM922 1 + +# from to module cost +alias IBM-930// IBM930// +alias CP930// IBM930// +alias EBCDIC-CP-AR2// IBM930// +alias CSIBM930// IBM930// +module IBM930// INTERNAL IBM930 1 +module INTERNAL IBM930// IBM930 1 + +# from to module cost +alias IBM-932// IBM932// +alias CSIBM932// IBM932// +module IBM932// INTERNAL IBM932 1 +module INTERNAL IBM932// IBM932 1 + +# from to module cost +alias IBM-933// IBM933// +alias CP933// IBM933// +alias EBCDIC-CP-AR2// IBM933// +alias CSIBM933// IBM933// +module IBM933// INTERNAL IBM933 1 +module INTERNAL IBM933// IBM933 1 + +# from to module cost +alias IBM-935// IBM935// +alias CP935// IBM935// +alias EBCDIC-CP-AR2// IBM935// +alias CSIBM935// IBM935// +module IBM935// INTERNAL IBM935 1 +module INTERNAL IBM935// IBM935 1 + +# from to module cost +alias IBM-937// IBM937// +alias CP937// IBM937// +alias EBCDIC-CP-AR2// IBM937// +alias CSIBM937// IBM937// +module IBM937// INTERNAL IBM937 1 +module INTERNAL IBM937// IBM937 1 + +# from to module cost +alias IBM-939// IBM939// +alias CP939// IBM939// +alias EBCDIC-CP-AR2// IBM939// +alias CSIBM939// IBM939// +module IBM939// INTERNAL IBM939 1 +module INTERNAL IBM939// IBM939 1 + +# from to module cost +alias IBM-943// IBM943// +alias CSIBM943// IBM943// +module IBM943// INTERNAL IBM943 1 +module INTERNAL IBM943// IBM943 1 + +# from to module cost +alias CP1004// IBM1004// +alias OS2LATIN1// IBM1004// +module IBM1004// INTERNAL IBM1004 1 +module INTERNAL IBM1004// IBM1004 1 + +# from to module cost +alias CP1026// IBM1026// +alias 1026// IBM1026// +alias CSIBM1026// IBM1026// +alias OSF10020402// IBM1026// +module IBM1026// INTERNAL IBM1026 1 +module INTERNAL IBM1026// IBM1026 1 + +# from to module cost +alias IBM-1046// IBM1046// +alias CP1046// IBM1046// +alias 1046// IBM1046// +module IBM1046// INTERNAL IBM1046 1 +module INTERNAL IBM1046// IBM1046 1 + +# from to module cost +alias CP1047// IBM1047// +alias 1047// IBM1047// +alias OSF10020417// IBM1047// +module IBM1047// INTERNAL IBM1047 1 +module INTERNAL IBM1047// IBM1047 1 + +# from to module cost +alias IBM-1124// IBM1124// +alias CP1124// IBM1124// +alias CSIBM1124// IBM1124// +module IBM1124// INTERNAL IBM1124 1 +module INTERNAL IBM1124// IBM1124 1 + +# from to module cost +alias IBM-1129// IBM1129// +alias CP1129// IBM1129// +alias CSIBM1129// IBM1129// +module IBM1129// INTERNAL IBM1129 1 +module INTERNAL IBM1129// IBM1129 1 + +# from to module cost +alias IBM-1160// IBM1160// +alias CP1160// IBM1160// +alias CSIBM1160// IBM1160// +module IBM1160// INTERNAL IBM1160 1 +module INTERNAL IBM1160// IBM1160 1 + +# from to module cost +alias IBM-1161// IBM1161// +alias CP1161// IBM1161// +alias CSIBM1161// IBM1161// +module IBM1161// INTERNAL IBM1161 1 +module INTERNAL IBM1161// IBM1161 1 + +# from to module cost +alias IBM-1132// IBM1132// +alias CP1132// IBM1132// +alias CSIBM1132// IBM1132// +module IBM1132// INTERNAL IBM1132 1 +module INTERNAL IBM1132// IBM1132 1 + +# from to module cost +alias IBM-1133// IBM1133// +alias CP1133// IBM1133// +alias CSIBM1133// IBM1133// +module IBM1133// INTERNAL IBM1133 1 +module INTERNAL IBM1133// IBM1133 1 + +# from to module cost +alias IBM-1162// IBM1162// +alias CP1162// IBM1162// +alias CSIBM11621162// IBM1162// +module IBM1162// INTERNAL IBM1162 1 +module INTERNAL IBM1162// IBM1162 1 + +# from to module cost +alias IBM-1163// IBM1163// +alias CP1163// IBM1163// +alias CSIBM1163// IBM1163// +module IBM1163// INTERNAL IBM1163 1 +module INTERNAL IBM1163// IBM1163 1 + +# from to module cost +alias IBM-1164// IBM1164// +alias CP1164// IBM1164// +alias CSIBM1164// IBM1164// +module IBM1164// INTERNAL IBM1164 1 +module INTERNAL IBM1164// IBM1164 1 + +# from to module cost +alias EUCKR// EUC-KR// +alias CSEUCKR// EUC-KR// +alias OSF0004000a// EUC-KR// +module EUC-KR// INTERNAL EUC-KR 1 +module INTERNAL EUC-KR// EUC-KR 1 + +# from to module cost +alias MSCP949// UHC// +alias CP949// UHC// +alias OSF100203B5// UHC// +module UHC// INTERNAL UHC 1 +module INTERNAL UHC// UHC 1 + +# from to module cost +alias MSCP1361// JOHAB// +alias CP1361// JOHAB// +module JOHAB// INTERNAL JOHAB 1 +module INTERNAL JOHAB// JOHAB 1 + +# from to module cost +alias BIG-FIVE// BIG5// +alias BIGFIVE// BIG5// +alias BIG-5// BIG5// +alias CN-BIG5// BIG5// +alias CP950// BIG5// +module BIG5// INTERNAL BIG5 1 +module INTERNAL BIG5// BIG5 1 + +# from to module cost +alias BIG5-HKSCS// BIG5HKSCS// +module BIG5HKSCS// INTERNAL BIG5HKSCS 1 +module INTERNAL BIG5HKSCS// BIG5HKSCS 1 + +# from to module cost +alias EUCJP// EUC-JP// +alias CSEUCPKDFMTJAPANESE// EUC-JP// +alias OSF00030010// EUC-JP// +alias UJIS// EUC-JP// +module EUC-JP// INTERNAL EUC-JP 1 +module INTERNAL EUC-JP// EUC-JP 1 + +# from to module cost +alias EUCCN// EUC-CN// +alias GB2312// EUC-CN// +alias csGB2312// EUC-CN// +alias CN-GB// EUC-CN// +module EUC-CN// INTERNAL EUC-CN 1 +module INTERNAL EUC-CN// EUC-CN 1 + +# from to module cost +module EUC-CN// BIG5// GBBIG5 1 +module BIG5// EUC-CN// GBBIG5 1 + +# from to module cost +alias GB13000// GBK// +alias CP936// GBK// +module GBK// INTERNAL GBK 1 +module INTERNAL GBK// GBK 1 + +# from to module cost +module GBK// EUC-CN// GBGBK 1 +module EUC-CN// GBK// GBGBK 1 + +# from to module cost +alias EUCTW// EUC-TW// +alias OSF0005000a// EUC-TW// +module EUC-TW// INTERNAL EUC-TW 1 +module INTERNAL EUC-TW// EUC-TW 1 + +# from to module cost +alias MS-EE// CP1250// +alias WINDOWS-1250// CP1250// +module CP1250// INTERNAL CP1250 1 +module INTERNAL CP1250// CP1250 1 + +# from to module cost +alias MS-CYRL// CP1251// +alias WINDOWS-1251// CP1251// +module CP1251// INTERNAL CP1251 1 +module INTERNAL CP1251// CP1251 1 + +# from to module cost +alias MS-ANSI// CP1252// +alias WINDOWS-1252// CP1252// +module CP1252// INTERNAL CP1252 1 +module INTERNAL CP1252// CP1252 1 + +# from to module cost +alias MS-GREEK// CP1253// +alias WINDOWS-1253// CP1253// +module CP1253// INTERNAL CP1253 1 +module INTERNAL CP1253// CP1253 1 + +# from to module cost +alias MS-TURK// CP1254// +alias WINDOWS-1254// CP1254// +module CP1254// INTERNAL CP1254 1 +module INTERNAL CP1254// CP1254 1 + +# from to module cost +alias MS-HEBR// CP1255// +alias WINDOWS-1255// CP1255// +module CP1255// INTERNAL CP1255 1 +module INTERNAL CP1255// CP1255 1 + +# from to module cost +alias MS-ARAB// CP1256// +alias WINDOWS-1256// CP1256// +module CP1256// INTERNAL CP1256 1 +module INTERNAL CP1256// CP1256 1 + +# from to module cost +alias WINBALTRIM// CP1257// +alias WINDOWS-1257// CP1257// +module CP1257// INTERNAL CP1257 1 +module INTERNAL CP1257// CP1257 1 + +# from to module cost +alias WINDOWS-1258// CP1258// +module CP1258// INTERNAL CP1258 1 +module INTERNAL CP1258// CP1258 1 + +# from to module cost +alias 874// IBM874// +alias CP874// IBM874// +module IBM874// INTERNAL IBM874 1 +module INTERNAL IBM874// IBM874 1 + +# from to module cost +module CP737// INTERNAL CP737 1 +module INTERNAL CP737// CP737 1 + +# from to module cost +alias IBM775// CP775// +alias CSPC775BALTIC// CP775// +module CP775// INTERNAL CP775 1 +module INTERNAL CP775// CP775 1 + +# from to module cost +alias CSISO2022JP// ISO-2022-JP// +alias ISO2022JP// ISO-2022-JP// +module ISO-2022-JP// INTERNAL ISO-2022-JP 1 +module INTERNAL ISO-2022-JP// ISO-2022-JP 1 + +# from to module cost +alias CSISO2022JP2// ISO-2022-JP-2// +alias ISO2022JP2// ISO-2022-JP-2// +module ISO-2022-JP-2// INTERNAL ISO-2022-JP 1 +module INTERNAL ISO-2022-JP-2// ISO-2022-JP 1 + +# from to module cost +alias CSISO2022KR// ISO-2022-KR// +alias ISO2022KR// ISO-2022-KR// +module ISO-2022-KR// INTERNAL ISO-2022-KR 1 +module INTERNAL ISO-2022-KR// ISO-2022-KR 1 + +# from to module cost +alias CSISO2022CN// ISO-2022-CN// +alias ISO2022CN// ISO-2022-CN// +module ISO-2022-CN// INTERNAL ISO-2022-CN 1 +module INTERNAL ISO-2022-CN// ISO-2022-CN 1 + +# from to module cost +alias ISO2022CNEXT// ISO-2022-CN-EXT// +module ISO-2022-CN-EXT// INTERNAL ISO-2022-CN-EXT 1 +module INTERNAL ISO-2022-CN-EXT// ISO-2022-CN-EXT 1 + +# from to module cost +alias MAC// MACINTOSH// +alias CSMACINTOSH// MACINTOSH// +module MACINTOSH// INTERNAL MACINTOSH 1 +module INTERNAL MACINTOSH// MACINTOSH 1 + +# from to module cost +alias ISO-IR-143// IEC_P27-1// +alias CSISO143IECP271// IEC_P27-1// +alias IEC_P271// IEC_P27-1// +module IEC_P27-1// INTERNAL IEC_P27-1 1 +module INTERNAL IEC_P27-1// IEC_P27-1 1 + +# from to module cost +alias ISO_9036// ASMO_449// +alias ARABIC7// ASMO_449// +alias ISO-IR-89// ASMO_449// +alias CSISO89ASMO449// ASMO_449// +module ASMO_449// INTERNAL ASMO_449 1 +module INTERNAL ASMO_449// ASMO_449 1 + +# from to module cost +alias ANSI_X3.110-1983// ANSI_X3.110// +alias ISO-IR-99// ANSI_X3.110// +alias CSA_T500-1983// ANSI_X3.110// +alias CSA_T500// ANSI_X3.110// +alias NAPLPS// ANSI_X3.110// +alias CSISO99NAPLPS// ANSI_X3.110// +module ANSI_X3.110// INTERNAL ANSI_X3.110 1 +module INTERNAL ANSI_X3.110// ANSI_X3.110 1 + +# from to module cost +alias ISO-IR-139// CSN_369103// +alias CSISO139CSN369103// CSN_369103// +module CSN_369103// INTERNAL CSN_369103 1 +module INTERNAL CSN_369103// CSN_369103 1 + +# from to module cost +alias CWI-2// CWI// +alias CP-HU// CWI// +module CWI// INTERNAL CWI 1 +module INTERNAL CWI// CWI 1 + +# from to module cost +alias DEC// DEC-MCS// +alias CSDECMCS// DEC-MCS// +alias DECMCS// DEC-MCS// +module DEC-MCS// INTERNAL DEC-MCS 1 +module INTERNAL DEC-MCS// DEC-MCS 1 + +# from to module cost +alias ISO-IR-111// ECMA-CYRILLIC// +alias CSISO111ECMACYRILLIC// ECMA-CYRILLIC// +alias ECMACYRILLIC// ECMA-CYRILLIC// +module ECMA-CYRILLIC// INTERNAL ECMA-CYRILLIC 1 +module INTERNAL ECMA-CYRILLIC// ECMA-CYRILLIC 1 + +# from to module cost +alias ST_SEV_358-88// GOST_19768-74// +alias GOST_19768// GOST_19768-74// +alias ISO-IR-153// GOST_19768-74// +alias CSISO153GOST1976874// GOST_19768-74// +alias GOST_1976874// GOST_19768-74// +module GOST_19768-74// INTERNAL GOST_19768-74 1 +module INTERNAL GOST_19768-74// GOST_19768-74 1 + +# from to module cost +alias ISO-IR-150// GREEK-CCITT// +alias CSISO150// GREEK-CCITT// +alias CSISO150GREEKCCITT// GREEK-CCITT// +alias GREEKCCITT// GREEK-CCITT// +module GREEK-CCITT// INTERNAL GREEK-CCITT 1 +module INTERNAL GREEK-CCITT// GREEK-CCITT 1 + +# from to module cost +alias ISO-IR-88// GREEK7// +alias CSISO88GREEK7// GREEK7// +module GREEK7// INTERNAL GREEK7 1 +module INTERNAL GREEK7// GREEK7 1 + +# from to module cost +alias ISO-IR-18// GREEK7-OLD// +alias CSISO18GREEK7OLD// GREEK7-OLD// +alias GREEK7OLD// GREEK7-OLD// +module GREEK7-OLD// INTERNAL GREEK7-OLD 1 +module INTERNAL GREEK7-OLD// GREEK7-OLD 1 + +# from to module cost +alias ISO-IR-49// INIS// +alias CSISO49INIS// INIS// +module INIS// INTERNAL INIS 1 +module INTERNAL INIS// INIS 1 + +# from to module cost +alias ISO-IR-50// INIS-8// +alias CSISO50INIS8// INIS-8// +alias INIS8// INIS-8// +module INIS-8// INTERNAL INIS-8 1 +module INTERNAL INIS-8// INIS-8 1 + +# from to module cost +alias ISO-IR-51// INIS-CYRILLIC// +alias CSISO51INISCYRILLIC// INIS-CYRILLIC// +alias INISCYRILLIC// INIS-CYRILLIC// +module INIS-CYRILLIC// INTERNAL INIS-CYRILLIC 1 +module INTERNAL INIS-CYRILLIC// INIS-CYRILLIC 1 + +# from to module cost +alias ISO-IR-98// ISO_2033// +alias ISO_2033-1983// ISO_2033// +alias E13B/ ISO_2033// +alias CSISO2033// ISO_2033// +module ISO_2033// INTERNAL ISO_2033 1 +module INTERNAL ISO_2033// ISO_2033 1 + +# from to module cost +alias ISO-IR-37// ISO_5427// +alias KOI-7// ISO_5427// +alias CSISO5427CYRILLIC// ISO_5427// +module ISO_5427// INTERNAL ISO_5427 1 +module INTERNAL ISO_5427// ISO_5427 1 + +# from to module cost +alias ISO-IR-54// ISO_5427-EXT// +alias ISO_5427:1981// ISO_5427-EXT// +alias CSISO5427CYRILLIC1981// ISO_5427-EXT// +alias ISO_5427EXT// ISO_5427-EXT// +module ISO_5427-EXT// INTERNAL ISO_5427-EXT 1 +module INTERNAL ISO_5427-EXT// ISO_5427-EXT 1 + +# from to module cost +alias ISO-IR-55// ISO_5428// +alias ISO_5428:1980// ISO_5428// +alias CSISO5428GREEK// ISO_5428// +module ISO_5428// INTERNAL ISO_5428 1 +module INTERNAL ISO_5428// ISO_5428 1 + +# from to module cost +alias ISO-IR-155// ISO_10367-BOX// +alias CSISO10367BOX// ISO_10367-BOX// +alias ISO_10367BOX// ISO_10367-BOX// +module ISO_10367-BOX// INTERNAL ISO_10367-BOX 1 +module INTERNAL ISO_10367-BOX// ISO_10367-BOX 1 + +# from to module cost +alias MACIS// MAC-IS// +module MAC-IS// INTERNAL MAC-IS 1 +module INTERNAL MAC-IS// MAC-IS 1 + +# from to module cost +alias MACUK// MAC-UK// +alias MACUKRAINIAN// MAC-UK// +alias MAC-CYRILLIC// MAC-UK// +alias MACCYRILLIC// MAC-UK// +module MAC-UK// INTERNAL MAC-UK 1 +module INTERNAL MAC-UK// MAC-UK 1 + +# from to module cost +alias MS-MAC-CYRILLIC// CP10007// +alias MSMACCYRILLIC// CP10007// +module CP10007// INTERNAL CP10007 1 +module INTERNAL CP10007// CP10007 1 + +# from to module cost +alias ISO-IR-9-1// NATS-DANO// +alias CSNATSDANO// NATS-DANO// +alias NATSDANO// NATS-DANO// +module NATS-DANO// INTERNAL NATS-DANO 1 +module INTERNAL NATS-DANO// NATS-DANO 1 + +# from to module cost +alias ISO-IR-8-1// NATS-SEFI// +alias CSNATSSEFI// NATS-SEFI// +alias NATSSEFI// NATS-SEFI// +module NATS-SEFI// INTERNAL NATS-SEFI 1 +module INTERNAL NATS-SEFI// NATS-SEFI 1 + +# from to module cost +alias WS2// WIN-SAMI-2// +alias WINSAMI2// WIN-SAMI-2// +module WIN-SAMI-2// INTERNAL SAMI-WS2 1 +module INTERNAL WIN-SAMI-2// SAMI-WS2 1 + +# from to module cost +module ISO-IR-197// INTERNAL ISO-IR-197 1 +module INTERNAL ISO-IR-197// ISO-IR-197 1 + +# from to module cost +alias TIS620// TIS-620// +alias TIS620-0// TIS-620// +alias TIS620.2529-1// TIS-620// +alias TIS620.2533-0// TIS-620// +alias ISO-IR-166// TIS-620// +module TIS-620// INTERNAL TIS-620 1 +module INTERNAL TIS-620// TIS-620 1 + +# from to module cost +alias KOI8U// KOI8-U// +module KOI8-U// INTERNAL KOI8-U 1 +module INTERNAL KOI8-U// KOI8-U 1 + +# from to module cost +alias ISIRI3342// ISIRI-3342// +module ISIRI-3342// INTERNAL ISIRI-3342 1 +module INTERNAL ISIRI-3342// ISIRI-3342 1 + +# from to module cost +alias UTF16// UTF-16// +module UTF-16// INTERNAL UTF-16 1 +module INTERNAL UTF-16// UTF-16 1 + +# from to module cost +alias UTF16LE// UTF-16LE// +module UTF-16LE// INTERNAL UTF-16 1 +module INTERNAL UTF-16LE// UTF-16 1 + +# from to module cost +alias UTF16BE// UTF-16BE// +module UTF-16BE// INTERNAL UTF-16 1 +module INTERNAL UTF-16BE// UTF-16 1 + +# from to module cost +alias CSUNICODE// UNICODE// +module UNICODE// INTERNAL UNICODE 1 +module INTERNAL UNICODE// UNICODE 1 + +# from to module cost +alias UTF32// UTF-32// +module UTF-32// INTERNAL UTF-32 1 +module INTERNAL UTF-32// UTF-32 1 + +# from to module cost +alias UTF32LE// UTF-32LE// +module UTF-32LE// INTERNAL UTF-32 1 +module INTERNAL UTF-32LE// UTF-32 1 + +# from to module cost +alias UTF32BE// UTF-32BE// +module UTF-32BE// INTERNAL UTF-32 1 +module INTERNAL UTF-32BE// UTF-32 1 + +# from to module cost +alias UTF7// UTF-7// +module UTF-7// INTERNAL UTF-7 1 +module INTERNAL UTF-7// UTF-7 1 + +# from to module cost +module GB18030// INTERNAL GB18030 1 +module INTERNAL GB18030// GB18030 1 + +# from to module cost +module VISCII// INTERNAL VISCII 1 +module INTERNAL VISCII// VISCII 1 + +# from to module cost +module KOI8-T// INTERNAL KOI8-T 1 +module INTERNAL KOI8-T// KOI8-T 1 + +# from to module cost +module GEORGIAN-PS// INTERNAL GEORGIAN-PS 1 +module INTERNAL GEORGIAN-PS// GEORGIAN-PS 1 + +# from to module cost +module GEORGIAN-ACADEMY// INTERNAL GEORGIAN-ACADEMY 1 +module INTERNAL GEORGIAN-ACADEMY// GEORGIAN-ACADEMY 1 + +# from to module cost +module ISO-IR-209// INTERNAL ISO-IR-209 1 +module INTERNAL ISO-IR-209// ISO-IR-209 1 + +# from to module cost +module MAC-SAMI// INTERNAL MAC-SAMI 1 +module INTERNAL MAC-SAMI// MAC-SAMI 1 + +# from to module cost +module ARMSCII-8// INTERNAL ARMSCII-8 1 +module INTERNAL ARMSCII-8// ARMSCII-8 1 + +# from to module cost +alias TCVN// TCVN5712-1// +alias TCVN-5712// TCVN5712-1// +alias TCVN5712-1:1993// TCVN5712-1// +module TCVN5712-1// INTERNAL TCVN5712-1 1 +module INTERNAL TCVN5712-1// TCVN5712-1 1 diff --git a/newlib/iconvdata/jis0201.c b/newlib/iconvdata/jis0201.c new file mode 100644 index 000000000..a4a23cb35 --- /dev/null +++ b/newlib/iconvdata/jis0201.c @@ -0,0 +1,58 @@ +/* Mapping tables for JIS0201 handling. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +const uint32_t __jisx0201_to_ucs4[256] = +{ + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005a, 0x005b, 0x00a5, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x203e, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xff61, 0xff62, 0xff63, 0xff64, 0xff65, 0xff66, 0xff67, + 0xff68, 0xff69, 0xff6a, 0xff6b, 0xff6c, 0xff6d, 0xff6e, 0xff6f, + 0xff70, 0xff71, 0xff72, 0xff73, 0xff74, 0xff75, 0xff76, 0xff77, + 0xff78, 0xff79, 0xff7a, 0xff7b, 0xff7c, 0xff7d, 0xff7e, 0xff7f, + 0xff80, 0xff81, 0xff82, 0xff83, 0xff84, 0xff85, 0xff86, 0xff87, + 0xff88, 0xff89, 0xff8a, 0xff8b, 0xff8c, 0xff8d, 0xff8e, 0xff8f, + 0xff90, 0xff91, 0xff92, 0xff93, 0xff94, 0xff95, 0xff96, 0xff97, + 0xff98, 0xff99, 0xff9a, 0xff9b, 0xff9c, 0xff9d, 0xff9e, 0xff9f, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; diff --git a/newlib/iconvdata/jis0201.h b/newlib/iconvdata/jis0201.h new file mode 100644 index 000000000..6fae3a288 --- /dev/null +++ b/newlib/iconvdata/jis0201.h @@ -0,0 +1,60 @@ +/* Access functions for JISX0201 conversion. + Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _JIS0201_H +#define _JIS0201_H 1 + +/* Conversion table. */ +extern const uint32_t __jisx0201_to_ucs4[]; + + +static inline uint32_t +jisx0201_to_ucs4 (char ch) +{ + uint32_t val = __jisx0201_to_ucs4[(unsigned char) ch]; + + if (val == 0 && ch != '\0') + val = __UNKNOWN_10646_CHAR; + + return val; +} + + +static inline size_t +ucs4_to_jisx0201 (uint32_t wch, char *s) +{ + char ch; + + if (wch == 0xa5) + ch = '\x5c'; + else if (wch == 0x203e) + ch = '\x7e'; + else if (wch < 0x7e && wch != 0x5c) + ch = wch; + else if (wch >= 0xff61 && wch <= 0xff9f) + ch = wch - 0xfec0; + else + return __UNKNOWN_10646_CHAR; + + s[0] = ch; + return 1; +} + +#endif /* jis0201.h */ diff --git a/newlib/iconvdata/jis0208.c b/newlib/iconvdata/jis0208.c new file mode 100644 index 000000000..1f16ad2f7 --- /dev/null +++ b/newlib/iconvdata/jis0208.c @@ -0,0 +1,5012 @@ +/* Mapping tables for JIS0208 handling. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "jis0208.h" + + +/* We use one big table for the mapping. We know that the first byte + is in range 0x21 to 0xea. The second byte never is in the ranges + 0x00 to 0x20 and 0x7f to 0xff. Compacting the table by excluding + these ranges we get a table with only this gaps: + + at 0x222e 0x2241 0x2250 0x226a 0x2279 0x2321 0x2339 0x235a + len 12 9 12 8 5 15 8 7 + + at 0x237a 0x2473 0x2576 0x2638 0x2658 0x2741 0x2771 0x2840 + len 4 11 8 9 38 16 13 62 + + at 0x4f53 + len 43 + + It's not worth trying to use these gaps. The table can be generated + using + + egrep '^0x' < .../eastasia/jis/jis0208.txt | + perl tab.pl + + with tab.pl containing: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $n=0; + while (<>) { + local($sjis, $jis, $ucs4, %rest) = split; + local($u)=hex($ucs4); + local($s)=hex($jis); + printf ("\n ") if ($n % 4 eq 0); + ++$n; + printf (" [0x%04x] = 0x%04x,", + int(($s - 0x2121) / 256) * 94 + (($s - 0x2121) & 0xff), $u); + } + printf ("\n"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +const uint16_t __jis0208_to_ucs[0x1e80] = +{ + [0x0000] = 0x3000, [0x0001] = 0x3001, [0x0002] = 0x3002, [0x0003] = 0xff0c, + [0x0004] = 0xff0e, [0x0005] = 0x30fb, [0x0006] = 0xff1a, [0x0007] = 0xff1b, + [0x0008] = 0xff1f, [0x0009] = 0xff01, [0x000a] = 0x309b, [0x000b] = 0x309c, + [0x000c] = 0x00b4, [0x000d] = 0xff40, [0x000e] = 0x00a8, [0x000f] = 0xff3e, + [0x0010] = 0xffe3, [0x0011] = 0xff3f, [0x0012] = 0x30fd, [0x0013] = 0x30fe, + [0x0014] = 0x309d, [0x0015] = 0x309e, [0x0016] = 0x3003, [0x0017] = 0x4edd, + [0x0018] = 0x3005, [0x0019] = 0x3006, [0x001a] = 0x3007, [0x001b] = 0x30fc, + [0x001c] = 0x2015, [0x001d] = 0x2010, [0x001e] = 0xff0f, [0x001f] = 0xff3c, + [0x0020] = 0x301c, [0x0021] = 0x2016, [0x0022] = 0xff5c, [0x0023] = 0x2026, + [0x0024] = 0x2025, [0x0025] = 0x2018, [0x0026] = 0x2019, [0x0027] = 0x201c, + [0x0028] = 0x201d, [0x0029] = 0xff08, [0x002a] = 0xff09, [0x002b] = 0x3014, + [0x002c] = 0x3015, [0x002d] = 0xff3b, [0x002e] = 0xff3d, [0x002f] = 0xff5b, + [0x0030] = 0xff5d, [0x0031] = 0x3008, [0x0032] = 0x3009, [0x0033] = 0x300a, + [0x0034] = 0x300b, [0x0035] = 0x300c, [0x0036] = 0x300d, [0x0037] = 0x300e, + [0x0038] = 0x300f, [0x0039] = 0x3010, [0x003a] = 0x3011, [0x003b] = 0xff0b, + [0x003c] = 0x2212, [0x003d] = 0x00b1, [0x003e] = 0x00d7, [0x003f] = 0x00f7, + [0x0040] = 0xff1d, [0x0041] = 0x2260, [0x0042] = 0xff1c, [0x0043] = 0xff1e, + [0x0044] = 0x2266, [0x0045] = 0x2267, [0x0046] = 0x221e, [0x0047] = 0x2234, + [0x0048] = 0x2642, [0x0049] = 0x2640, [0x004a] = 0x00b0, [0x004b] = 0x2032, + [0x004c] = 0x2033, [0x004d] = 0x2103, [0x004e] = 0xffe5, [0x004f] = 0xff04, + [0x0050] = 0x00a2, [0x0051] = 0x00a3, [0x0052] = 0xff05, [0x0053] = 0xff03, + [0x0054] = 0xff06, [0x0055] = 0xff0a, [0x0056] = 0xff20, [0x0057] = 0x00a7, + [0x0058] = 0x2606, [0x0059] = 0x2605, [0x005a] = 0x25cb, [0x005b] = 0x25cf, + [0x005c] = 0x25ce, [0x005d] = 0x25c7, [0x005e] = 0x25c6, [0x005f] = 0x25a1, + [0x0060] = 0x25a0, [0x0061] = 0x25b3, [0x0062] = 0x25b2, [0x0063] = 0x25bd, + [0x0064] = 0x25bc, [0x0065] = 0x203b, [0x0066] = 0x3012, [0x0067] = 0x2192, + [0x0068] = 0x2190, [0x0069] = 0x2191, [0x006a] = 0x2193, [0x006b] = 0x3013, + [0x0077] = 0x2208, [0x0078] = 0x220b, [0x0079] = 0x2286, [0x007a] = 0x2287, + [0x007b] = 0x2282, [0x007c] = 0x2283, [0x007d] = 0x222a, [0x007e] = 0x2229, + [0x0087] = 0x2227, [0x0088] = 0x2228, [0x0089] = 0x00ac, [0x008a] = 0x21d2, + [0x008b] = 0x21d4, [0x008c] = 0x2200, [0x008d] = 0x2203, [0x0099] = 0x2220, + [0x009a] = 0x22a5, [0x009b] = 0x2312, [0x009c] = 0x2202, [0x009d] = 0x2207, + [0x009e] = 0x2261, [0x009f] = 0x2252, [0x00a0] = 0x226a, [0x00a1] = 0x226b, + [0x00a2] = 0x221a, [0x00a3] = 0x223d, [0x00a4] = 0x221d, [0x00a5] = 0x2235, + [0x00a6] = 0x222b, [0x00a7] = 0x222c, [0x00af] = 0x212b, [0x00b0] = 0x2030, + [0x00b1] = 0x266f, [0x00b2] = 0x266d, [0x00b3] = 0x266a, [0x00b4] = 0x2020, + [0x00b5] = 0x2021, [0x00b6] = 0x00b6, [0x00bb] = 0x25ef, [0x00cb] = 0xff10, + [0x00cc] = 0xff11, [0x00cd] = 0xff12, [0x00ce] = 0xff13, [0x00cf] = 0xff14, + [0x00d0] = 0xff15, [0x00d1] = 0xff16, [0x00d2] = 0xff17, [0x00d3] = 0xff18, + [0x00d4] = 0xff19, [0x00dc] = 0xff21, [0x00dd] = 0xff22, [0x00de] = 0xff23, + [0x00df] = 0xff24, [0x00e0] = 0xff25, [0x00e1] = 0xff26, [0x00e2] = 0xff27, + [0x00e3] = 0xff28, [0x00e4] = 0xff29, [0x00e5] = 0xff2a, [0x00e6] = 0xff2b, + [0x00e7] = 0xff2c, [0x00e8] = 0xff2d, [0x00e9] = 0xff2e, [0x00ea] = 0xff2f, + [0x00eb] = 0xff30, [0x00ec] = 0xff31, [0x00ed] = 0xff32, [0x00ee] = 0xff33, + [0x00ef] = 0xff34, [0x00f0] = 0xff35, [0x00f1] = 0xff36, [0x00f2] = 0xff37, + [0x00f3] = 0xff38, [0x00f4] = 0xff39, [0x00f5] = 0xff3a, [0x00fc] = 0xff41, + [0x00fd] = 0xff42, [0x00fe] = 0xff43, [0x00ff] = 0xff44, [0x0100] = 0xff45, + [0x0101] = 0xff46, [0x0102] = 0xff47, [0x0103] = 0xff48, [0x0104] = 0xff49, + [0x0105] = 0xff4a, [0x0106] = 0xff4b, [0x0107] = 0xff4c, [0x0108] = 0xff4d, + [0x0109] = 0xff4e, [0x010a] = 0xff4f, [0x010b] = 0xff50, [0x010c] = 0xff51, + [0x010d] = 0xff52, [0x010e] = 0xff53, [0x010f] = 0xff54, [0x0110] = 0xff55, + [0x0111] = 0xff56, [0x0112] = 0xff57, [0x0113] = 0xff58, [0x0114] = 0xff59, + [0x0115] = 0xff5a, [0x011a] = 0x3041, [0x011b] = 0x3042, [0x011c] = 0x3043, + [0x011d] = 0x3044, [0x011e] = 0x3045, [0x011f] = 0x3046, [0x0120] = 0x3047, + [0x0121] = 0x3048, [0x0122] = 0x3049, [0x0123] = 0x304a, [0x0124] = 0x304b, + [0x0125] = 0x304c, [0x0126] = 0x304d, [0x0127] = 0x304e, [0x0128] = 0x304f, + [0x0129] = 0x3050, [0x012a] = 0x3051, [0x012b] = 0x3052, [0x012c] = 0x3053, + [0x012d] = 0x3054, [0x012e] = 0x3055, [0x012f] = 0x3056, [0x0130] = 0x3057, + [0x0131] = 0x3058, [0x0132] = 0x3059, [0x0133] = 0x305a, [0x0134] = 0x305b, + [0x0135] = 0x305c, [0x0136] = 0x305d, [0x0137] = 0x305e, [0x0138] = 0x305f, + [0x0139] = 0x3060, [0x013a] = 0x3061, [0x013b] = 0x3062, [0x013c] = 0x3063, + [0x013d] = 0x3064, [0x013e] = 0x3065, [0x013f] = 0x3066, [0x0140] = 0x3067, + [0x0141] = 0x3068, [0x0142] = 0x3069, [0x0143] = 0x306a, [0x0144] = 0x306b, + [0x0145] = 0x306c, [0x0146] = 0x306d, [0x0147] = 0x306e, [0x0148] = 0x306f, + [0x0149] = 0x3070, [0x014a] = 0x3071, [0x014b] = 0x3072, [0x014c] = 0x3073, + [0x014d] = 0x3074, [0x014e] = 0x3075, [0x014f] = 0x3076, [0x0150] = 0x3077, + [0x0151] = 0x3078, [0x0152] = 0x3079, [0x0153] = 0x307a, [0x0154] = 0x307b, + [0x0155] = 0x307c, [0x0156] = 0x307d, [0x0157] = 0x307e, [0x0158] = 0x307f, + [0x0159] = 0x3080, [0x015a] = 0x3081, [0x015b] = 0x3082, [0x015c] = 0x3083, + [0x015d] = 0x3084, [0x015e] = 0x3085, [0x015f] = 0x3086, [0x0160] = 0x3087, + [0x0161] = 0x3088, [0x0162] = 0x3089, [0x0163] = 0x308a, [0x0164] = 0x308b, + [0x0165] = 0x308c, [0x0166] = 0x308d, [0x0167] = 0x308e, [0x0168] = 0x308f, + [0x0169] = 0x3090, [0x016a] = 0x3091, [0x016b] = 0x3092, [0x016c] = 0x3093, + [0x0178] = 0x30a1, [0x0179] = 0x30a2, [0x017a] = 0x30a3, [0x017b] = 0x30a4, + [0x017c] = 0x30a5, [0x017d] = 0x30a6, [0x017e] = 0x30a7, [0x017f] = 0x30a8, + [0x0180] = 0x30a9, [0x0181] = 0x30aa, [0x0182] = 0x30ab, [0x0183] = 0x30ac, + [0x0184] = 0x30ad, [0x0185] = 0x30ae, [0x0186] = 0x30af, [0x0187] = 0x30b0, + [0x0188] = 0x30b1, [0x0189] = 0x30b2, [0x018a] = 0x30b3, [0x018b] = 0x30b4, + [0x018c] = 0x30b5, [0x018d] = 0x30b6, [0x018e] = 0x30b7, [0x018f] = 0x30b8, + [0x0190] = 0x30b9, [0x0191] = 0x30ba, [0x0192] = 0x30bb, [0x0193] = 0x30bc, + [0x0194] = 0x30bd, [0x0195] = 0x30be, [0x0196] = 0x30bf, [0x0197] = 0x30c0, + [0x0198] = 0x30c1, [0x0199] = 0x30c2, [0x019a] = 0x30c3, [0x019b] = 0x30c4, + [0x019c] = 0x30c5, [0x019d] = 0x30c6, [0x019e] = 0x30c7, [0x019f] = 0x30c8, + [0x01a0] = 0x30c9, [0x01a1] = 0x30ca, [0x01a2] = 0x30cb, [0x01a3] = 0x30cc, + [0x01a4] = 0x30cd, [0x01a5] = 0x30ce, [0x01a6] = 0x30cf, [0x01a7] = 0x30d0, + [0x01a8] = 0x30d1, [0x01a9] = 0x30d2, [0x01aa] = 0x30d3, [0x01ab] = 0x30d4, + [0x01ac] = 0x30d5, [0x01ad] = 0x30d6, [0x01ae] = 0x30d7, [0x01af] = 0x30d8, + [0x01b0] = 0x30d9, [0x01b1] = 0x30da, [0x01b2] = 0x30db, [0x01b3] = 0x30dc, + [0x01b4] = 0x30dd, [0x01b5] = 0x30de, [0x01b6] = 0x30df, [0x01b7] = 0x30e0, + [0x01b8] = 0x30e1, [0x01b9] = 0x30e2, [0x01ba] = 0x30e3, [0x01bb] = 0x30e4, + [0x01bc] = 0x30e5, [0x01bd] = 0x30e6, [0x01be] = 0x30e7, [0x01bf] = 0x30e8, + [0x01c0] = 0x30e9, [0x01c1] = 0x30ea, [0x01c2] = 0x30eb, [0x01c3] = 0x30ec, + [0x01c4] = 0x30ed, [0x01c5] = 0x30ee, [0x01c6] = 0x30ef, [0x01c7] = 0x30f0, + [0x01c8] = 0x30f1, [0x01c9] = 0x30f2, [0x01ca] = 0x30f3, [0x01cb] = 0x30f4, + [0x01cc] = 0x30f5, [0x01cd] = 0x30f6, [0x01d6] = 0x0391, [0x01d7] = 0x0392, + [0x01d8] = 0x0393, [0x01d9] = 0x0394, [0x01da] = 0x0395, [0x01db] = 0x0396, + [0x01dc] = 0x0397, [0x01dd] = 0x0398, [0x01de] = 0x0399, [0x01df] = 0x039a, + [0x01e0] = 0x039b, [0x01e1] = 0x039c, [0x01e2] = 0x039d, [0x01e3] = 0x039e, + [0x01e4] = 0x039f, [0x01e5] = 0x03a0, [0x01e6] = 0x03a1, [0x01e7] = 0x03a3, + [0x01e8] = 0x03a4, [0x01e9] = 0x03a5, [0x01ea] = 0x03a6, [0x01eb] = 0x03a7, + [0x01ec] = 0x03a8, [0x01ed] = 0x03a9, [0x01f6] = 0x03b1, [0x01f7] = 0x03b2, + [0x01f8] = 0x03b3, [0x01f9] = 0x03b4, [0x01fa] = 0x03b5, [0x01fb] = 0x03b6, + [0x01fc] = 0x03b7, [0x01fd] = 0x03b8, [0x01fe] = 0x03b9, [0x01ff] = 0x03ba, + [0x0200] = 0x03bb, [0x0201] = 0x03bc, [0x0202] = 0x03bd, [0x0203] = 0x03be, + [0x0204] = 0x03bf, [0x0205] = 0x03c0, [0x0206] = 0x03c1, [0x0207] = 0x03c3, + [0x0208] = 0x03c4, [0x0209] = 0x03c5, [0x020a] = 0x03c6, [0x020b] = 0x03c7, + [0x020c] = 0x03c8, [0x020d] = 0x03c9, [0x0234] = 0x0410, [0x0235] = 0x0411, + [0x0236] = 0x0412, [0x0237] = 0x0413, [0x0238] = 0x0414, [0x0239] = 0x0415, + [0x023a] = 0x0401, [0x023b] = 0x0416, [0x023c] = 0x0417, [0x023d] = 0x0418, + [0x023e] = 0x0419, [0x023f] = 0x041a, [0x0240] = 0x041b, [0x0241] = 0x041c, + [0x0242] = 0x041d, [0x0243] = 0x041e, [0x0244] = 0x041f, [0x0245] = 0x0420, + [0x0246] = 0x0421, [0x0247] = 0x0422, [0x0248] = 0x0423, [0x0249] = 0x0424, + [0x024a] = 0x0425, [0x024b] = 0x0426, [0x024c] = 0x0427, [0x024d] = 0x0428, + [0x024e] = 0x0429, [0x024f] = 0x042a, [0x0250] = 0x042b, [0x0251] = 0x042c, + [0x0252] = 0x042d, [0x0253] = 0x042e, [0x0254] = 0x042f, [0x0264] = 0x0430, + [0x0265] = 0x0431, [0x0266] = 0x0432, [0x0267] = 0x0433, [0x0268] = 0x0434, + [0x0269] = 0x0435, [0x026a] = 0x0451, [0x026b] = 0x0436, [0x026c] = 0x0437, + [0x026d] = 0x0438, [0x026e] = 0x0439, [0x026f] = 0x043a, [0x0270] = 0x043b, + [0x0271] = 0x043c, [0x0272] = 0x043d, [0x0273] = 0x043e, [0x0274] = 0x043f, + [0x0275] = 0x0440, [0x0276] = 0x0441, [0x0277] = 0x0442, [0x0278] = 0x0443, + [0x0279] = 0x0444, [0x027a] = 0x0445, [0x027b] = 0x0446, [0x027c] = 0x0447, + [0x027d] = 0x0448, [0x027e] = 0x0449, [0x027f] = 0x044a, [0x0280] = 0x044b, + [0x0281] = 0x044c, [0x0282] = 0x044d, [0x0283] = 0x044e, [0x0284] = 0x044f, + [0x0292] = 0x2500, [0x0293] = 0x2502, [0x0294] = 0x250c, [0x0295] = 0x2510, + [0x0296] = 0x2518, [0x0297] = 0x2514, [0x0298] = 0x251c, [0x0299] = 0x252c, + [0x029a] = 0x2524, [0x029b] = 0x2534, [0x029c] = 0x253c, [0x029d] = 0x2501, + [0x029e] = 0x2503, [0x029f] = 0x250f, [0x02a0] = 0x2513, [0x02a1] = 0x251b, + [0x02a2] = 0x2517, [0x02a3] = 0x2523, [0x02a4] = 0x2533, [0x02a5] = 0x252b, + [0x02a6] = 0x253b, [0x02a7] = 0x254b, [0x02a8] = 0x2520, [0x02a9] = 0x252f, + [0x02aa] = 0x2528, [0x02ab] = 0x2537, [0x02ac] = 0x253f, [0x02ad] = 0x251d, + [0x02ae] = 0x2530, [0x02af] = 0x2525, [0x02b0] = 0x2538, [0x02b1] = 0x2542, + [0x0582] = 0x4e9c, [0x0583] = 0x5516, [0x0584] = 0x5a03, [0x0585] = 0x963f, + [0x0586] = 0x54c0, [0x0587] = 0x611b, [0x0588] = 0x6328, [0x0589] = 0x59f6, + [0x058a] = 0x9022, [0x058b] = 0x8475, [0x058c] = 0x831c, [0x058d] = 0x7a50, + [0x058e] = 0x60aa, [0x058f] = 0x63e1, [0x0590] = 0x6e25, [0x0591] = 0x65ed, + [0x0592] = 0x8466, [0x0593] = 0x82a6, [0x0594] = 0x9bf5, [0x0595] = 0x6893, + [0x0596] = 0x5727, [0x0597] = 0x65a1, [0x0598] = 0x6271, [0x0599] = 0x5b9b, + [0x059a] = 0x59d0, [0x059b] = 0x867b, [0x059c] = 0x98f4, [0x059d] = 0x7d62, + [0x059e] = 0x7dbe, [0x059f] = 0x9b8e, [0x05a0] = 0x6216, [0x05a1] = 0x7c9f, + [0x05a2] = 0x88b7, [0x05a3] = 0x5b89, [0x05a4] = 0x5eb5, [0x05a5] = 0x6309, + [0x05a6] = 0x6697, [0x05a7] = 0x6848, [0x05a8] = 0x95c7, [0x05a9] = 0x978d, + [0x05aa] = 0x674f, [0x05ab] = 0x4ee5, [0x05ac] = 0x4f0a, [0x05ad] = 0x4f4d, + [0x05ae] = 0x4f9d, [0x05af] = 0x5049, [0x05b0] = 0x56f2, [0x05b1] = 0x5937, + [0x05b2] = 0x59d4, [0x05b3] = 0x5a01, [0x05b4] = 0x5c09, [0x05b5] = 0x60df, + [0x05b6] = 0x610f, [0x05b7] = 0x6170, [0x05b8] = 0x6613, [0x05b9] = 0x6905, + [0x05ba] = 0x70ba, [0x05bb] = 0x754f, [0x05bc] = 0x7570, [0x05bd] = 0x79fb, + [0x05be] = 0x7dad, [0x05bf] = 0x7def, [0x05c0] = 0x80c3, [0x05c1] = 0x840e, + [0x05c2] = 0x8863, [0x05c3] = 0x8b02, [0x05c4] = 0x9055, [0x05c5] = 0x907a, + [0x05c6] = 0x533b, [0x05c7] = 0x4e95, [0x05c8] = 0x4ea5, [0x05c9] = 0x57df, + [0x05ca] = 0x80b2, [0x05cb] = 0x90c1, [0x05cc] = 0x78ef, [0x05cd] = 0x4e00, + [0x05ce] = 0x58f1, [0x05cf] = 0x6ea2, [0x05d0] = 0x9038, [0x05d1] = 0x7a32, + [0x05d2] = 0x8328, [0x05d3] = 0x828b, [0x05d4] = 0x9c2f, [0x05d5] = 0x5141, + [0x05d6] = 0x5370, [0x05d7] = 0x54bd, [0x05d8] = 0x54e1, [0x05d9] = 0x56e0, + [0x05da] = 0x59fb, [0x05db] = 0x5f15, [0x05dc] = 0x98f2, [0x05dd] = 0x6deb, + [0x05de] = 0x80e4, [0x05df] = 0x852d, [0x05e0] = 0x9662, [0x05e1] = 0x9670, + [0x05e2] = 0x96a0, [0x05e3] = 0x97fb, [0x05e4] = 0x540b, [0x05e5] = 0x53f3, + [0x05e6] = 0x5b87, [0x05e7] = 0x70cf, [0x05e8] = 0x7fbd, [0x05e9] = 0x8fc2, + [0x05ea] = 0x96e8, [0x05eb] = 0x536f, [0x05ec] = 0x9d5c, [0x05ed] = 0x7aba, + [0x05ee] = 0x4e11, [0x05ef] = 0x7893, [0x05f0] = 0x81fc, [0x05f1] = 0x6e26, + [0x05f2] = 0x5618, [0x05f3] = 0x5504, [0x05f4] = 0x6b1d, [0x05f5] = 0x851a, + [0x05f6] = 0x9c3b, [0x05f7] = 0x59e5, [0x05f8] = 0x53a9, [0x05f9] = 0x6d66, + [0x05fa] = 0x74dc, [0x05fb] = 0x958f, [0x05fc] = 0x5642, [0x05fd] = 0x4e91, + [0x05fe] = 0x904b, [0x05ff] = 0x96f2, [0x0600] = 0x834f, [0x0601] = 0x990c, + [0x0602] = 0x53e1, [0x0603] = 0x55b6, [0x0604] = 0x5b30, [0x0605] = 0x5f71, + [0x0606] = 0x6620, [0x0607] = 0x66f3, [0x0608] = 0x6804, [0x0609] = 0x6c38, + [0x060a] = 0x6cf3, [0x060b] = 0x6d29, [0x060c] = 0x745b, [0x060d] = 0x76c8, + [0x060e] = 0x7a4e, [0x060f] = 0x9834, [0x0610] = 0x82f1, [0x0611] = 0x885b, + [0x0612] = 0x8a60, [0x0613] = 0x92ed, [0x0614] = 0x6db2, [0x0615] = 0x75ab, + [0x0616] = 0x76ca, [0x0617] = 0x99c5, [0x0618] = 0x60a6, [0x0619] = 0x8b01, + [0x061a] = 0x8d8a, [0x061b] = 0x95b2, [0x061c] = 0x698e, [0x061d] = 0x53ad, + [0x061e] = 0x5186, [0x061f] = 0x5712, [0x0620] = 0x5830, [0x0621] = 0x5944, + [0x0622] = 0x5bb4, [0x0623] = 0x5ef6, [0x0624] = 0x6028, [0x0625] = 0x63a9, + [0x0626] = 0x63f4, [0x0627] = 0x6cbf, [0x0628] = 0x6f14, [0x0629] = 0x708e, + [0x062a] = 0x7114, [0x062b] = 0x7159, [0x062c] = 0x71d5, [0x062d] = 0x733f, + [0x062e] = 0x7e01, [0x062f] = 0x8276, [0x0630] = 0x82d1, [0x0631] = 0x8597, + [0x0632] = 0x9060, [0x0633] = 0x925b, [0x0634] = 0x9d1b, [0x0635] = 0x5869, + [0x0636] = 0x65bc, [0x0637] = 0x6c5a, [0x0638] = 0x7525, [0x0639] = 0x51f9, + [0x063a] = 0x592e, [0x063b] = 0x5965, [0x063c] = 0x5f80, [0x063d] = 0x5fdc, + [0x063e] = 0x62bc, [0x063f] = 0x65fa, [0x0640] = 0x6a2a, [0x0641] = 0x6b27, + [0x0642] = 0x6bb4, [0x0643] = 0x738b, [0x0644] = 0x7fc1, [0x0645] = 0x8956, + [0x0646] = 0x9d2c, [0x0647] = 0x9d0e, [0x0648] = 0x9ec4, [0x0649] = 0x5ca1, + [0x064a] = 0x6c96, [0x064b] = 0x837b, [0x064c] = 0x5104, [0x064d] = 0x5c4b, + [0x064e] = 0x61b6, [0x064f] = 0x81c6, [0x0650] = 0x6876, [0x0651] = 0x7261, + [0x0652] = 0x4e59, [0x0653] = 0x4ffa, [0x0654] = 0x5378, [0x0655] = 0x6069, + [0x0656] = 0x6e29, [0x0657] = 0x7a4f, [0x0658] = 0x97f3, [0x0659] = 0x4e0b, + [0x065a] = 0x5316, [0x065b] = 0x4eee, [0x065c] = 0x4f55, [0x065d] = 0x4f3d, + [0x065e] = 0x4fa1, [0x065f] = 0x4f73, [0x0660] = 0x52a0, [0x0661] = 0x53ef, + [0x0662] = 0x5609, [0x0663] = 0x590f, [0x0664] = 0x5ac1, [0x0665] = 0x5bb6, + [0x0666] = 0x5be1, [0x0667] = 0x79d1, [0x0668] = 0x6687, [0x0669] = 0x679c, + [0x066a] = 0x67b6, [0x066b] = 0x6b4c, [0x066c] = 0x6cb3, [0x066d] = 0x706b, + [0x066e] = 0x73c2, [0x066f] = 0x798d, [0x0670] = 0x79be, [0x0671] = 0x7a3c, + [0x0672] = 0x7b87, [0x0673] = 0x82b1, [0x0674] = 0x82db, [0x0675] = 0x8304, + [0x0676] = 0x8377, [0x0677] = 0x83ef, [0x0678] = 0x83d3, [0x0679] = 0x8766, + [0x067a] = 0x8ab2, [0x067b] = 0x5629, [0x067c] = 0x8ca8, [0x067d] = 0x8fe6, + [0x067e] = 0x904e, [0x067f] = 0x971e, [0x0680] = 0x868a, [0x0681] = 0x4fc4, + [0x0682] = 0x5ce8, [0x0683] = 0x6211, [0x0684] = 0x7259, [0x0685] = 0x753b, + [0x0686] = 0x81e5, [0x0687] = 0x82bd, [0x0688] = 0x86fe, [0x0689] = 0x8cc0, + [0x068a] = 0x96c5, [0x068b] = 0x9913, [0x068c] = 0x99d5, [0x068d] = 0x4ecb, + [0x068e] = 0x4f1a, [0x068f] = 0x89e3, [0x0690] = 0x56de, [0x0691] = 0x584a, + [0x0692] = 0x58ca, [0x0693] = 0x5efb, [0x0694] = 0x5feb, [0x0695] = 0x602a, + [0x0696] = 0x6094, [0x0697] = 0x6062, [0x0698] = 0x61d0, [0x0699] = 0x6212, + [0x069a] = 0x62d0, [0x069b] = 0x6539, [0x069c] = 0x9b41, [0x069d] = 0x6666, + [0x069e] = 0x68b0, [0x069f] = 0x6d77, [0x06a0] = 0x7070, [0x06a1] = 0x754c, + [0x06a2] = 0x7686, [0x06a3] = 0x7d75, [0x06a4] = 0x82a5, [0x06a5] = 0x87f9, + [0x06a6] = 0x958b, [0x06a7] = 0x968e, [0x06a8] = 0x8c9d, [0x06a9] = 0x51f1, + [0x06aa] = 0x52be, [0x06ab] = 0x5916, [0x06ac] = 0x54b3, [0x06ad] = 0x5bb3, + [0x06ae] = 0x5d16, [0x06af] = 0x6168, [0x06b0] = 0x6982, [0x06b1] = 0x6daf, + [0x06b2] = 0x788d, [0x06b3] = 0x84cb, [0x06b4] = 0x8857, [0x06b5] = 0x8a72, + [0x06b6] = 0x93a7, [0x06b7] = 0x9ab8, [0x06b8] = 0x6d6c, [0x06b9] = 0x99a8, + [0x06ba] = 0x86d9, [0x06bb] = 0x57a3, [0x06bc] = 0x67ff, [0x06bd] = 0x86ce, + [0x06be] = 0x920e, [0x06bf] = 0x5283, [0x06c0] = 0x5687, [0x06c1] = 0x5404, + [0x06c2] = 0x5ed3, [0x06c3] = 0x62e1, [0x06c4] = 0x64b9, [0x06c5] = 0x683c, + [0x06c6] = 0x6838, [0x06c7] = 0x6bbb, [0x06c8] = 0x7372, [0x06c9] = 0x78ba, + [0x06ca] = 0x7a6b, [0x06cb] = 0x899a, [0x06cc] = 0x89d2, [0x06cd] = 0x8d6b, + [0x06ce] = 0x8f03, [0x06cf] = 0x90ed, [0x06d0] = 0x95a3, [0x06d1] = 0x9694, + [0x06d2] = 0x9769, [0x06d3] = 0x5b66, [0x06d4] = 0x5cb3, [0x06d5] = 0x697d, + [0x06d6] = 0x984d, [0x06d7] = 0x984e, [0x06d8] = 0x639b, [0x06d9] = 0x7b20, + [0x06da] = 0x6a2b, [0x06db] = 0x6a7f, [0x06dc] = 0x68b6, [0x06dd] = 0x9c0d, + [0x06de] = 0x6f5f, [0x06df] = 0x5272, [0x06e0] = 0x559d, [0x06e1] = 0x6070, + [0x06e2] = 0x62ec, [0x06e3] = 0x6d3b, [0x06e4] = 0x6e07, [0x06e5] = 0x6ed1, + [0x06e6] = 0x845b, [0x06e7] = 0x8910, [0x06e8] = 0x8f44, [0x06e9] = 0x4e14, + [0x06ea] = 0x9c39, [0x06eb] = 0x53f6, [0x06ec] = 0x691b, [0x06ed] = 0x6a3a, + [0x06ee] = 0x9784, [0x06ef] = 0x682a, [0x06f0] = 0x515c, [0x06f1] = 0x7ac3, + [0x06f2] = 0x84b2, [0x06f3] = 0x91dc, [0x06f4] = 0x938c, [0x06f5] = 0x565b, + [0x06f6] = 0x9d28, [0x06f7] = 0x6822, [0x06f8] = 0x8305, [0x06f9] = 0x8431, + [0x06fa] = 0x7ca5, [0x06fb] = 0x5208, [0x06fc] = 0x82c5, [0x06fd] = 0x74e6, + [0x06fe] = 0x4e7e, [0x06ff] = 0x4f83, [0x0700] = 0x51a0, [0x0701] = 0x5bd2, + [0x0702] = 0x520a, [0x0703] = 0x52d8, [0x0704] = 0x52e7, [0x0705] = 0x5dfb, + [0x0706] = 0x559a, [0x0707] = 0x582a, [0x0708] = 0x59e6, [0x0709] = 0x5b8c, + [0x070a] = 0x5b98, [0x070b] = 0x5bdb, [0x070c] = 0x5e72, [0x070d] = 0x5e79, + [0x070e] = 0x60a3, [0x070f] = 0x611f, [0x0710] = 0x6163, [0x0711] = 0x61be, + [0x0712] = 0x63db, [0x0713] = 0x6562, [0x0714] = 0x67d1, [0x0715] = 0x6853, + [0x0716] = 0x68fa, [0x0717] = 0x6b3e, [0x0718] = 0x6b53, [0x0719] = 0x6c57, + [0x071a] = 0x6f22, [0x071b] = 0x6f97, [0x071c] = 0x6f45, [0x071d] = 0x74b0, + [0x071e] = 0x7518, [0x071f] = 0x76e3, [0x0720] = 0x770b, [0x0721] = 0x7aff, + [0x0722] = 0x7ba1, [0x0723] = 0x7c21, [0x0724] = 0x7de9, [0x0725] = 0x7f36, + [0x0726] = 0x7ff0, [0x0727] = 0x809d, [0x0728] = 0x8266, [0x0729] = 0x839e, + [0x072a] = 0x89b3, [0x072b] = 0x8acc, [0x072c] = 0x8cab, [0x072d] = 0x9084, + [0x072e] = 0x9451, [0x072f] = 0x9593, [0x0730] = 0x9591, [0x0731] = 0x95a2, + [0x0732] = 0x9665, [0x0733] = 0x97d3, [0x0734] = 0x9928, [0x0735] = 0x8218, + [0x0736] = 0x4e38, [0x0737] = 0x542b, [0x0738] = 0x5cb8, [0x0739] = 0x5dcc, + [0x073a] = 0x73a9, [0x073b] = 0x764c, [0x073c] = 0x773c, [0x073d] = 0x5ca9, + [0x073e] = 0x7feb, [0x073f] = 0x8d0b, [0x0740] = 0x96c1, [0x0741] = 0x9811, + [0x0742] = 0x9854, [0x0743] = 0x9858, [0x0744] = 0x4f01, [0x0745] = 0x4f0e, + [0x0746] = 0x5371, [0x0747] = 0x559c, [0x0748] = 0x5668, [0x0749] = 0x57fa, + [0x074a] = 0x5947, [0x074b] = 0x5b09, [0x074c] = 0x5bc4, [0x074d] = 0x5c90, + [0x074e] = 0x5e0c, [0x074f] = 0x5e7e, [0x0750] = 0x5fcc, [0x0751] = 0x63ee, + [0x0752] = 0x673a, [0x0753] = 0x65d7, [0x0754] = 0x65e2, [0x0755] = 0x671f, + [0x0756] = 0x68cb, [0x0757] = 0x68c4, [0x0758] = 0x6a5f, [0x0759] = 0x5e30, + [0x075a] = 0x6bc5, [0x075b] = 0x6c17, [0x075c] = 0x6c7d, [0x075d] = 0x757f, + [0x075e] = 0x7948, [0x075f] = 0x5b63, [0x0760] = 0x7a00, [0x0761] = 0x7d00, + [0x0762] = 0x5fbd, [0x0763] = 0x898f, [0x0764] = 0x8a18, [0x0765] = 0x8cb4, + [0x0766] = 0x8d77, [0x0767] = 0x8ecc, [0x0768] = 0x8f1d, [0x0769] = 0x98e2, + [0x076a] = 0x9a0e, [0x076b] = 0x9b3c, [0x076c] = 0x4e80, [0x076d] = 0x507d, + [0x076e] = 0x5100, [0x076f] = 0x5993, [0x0770] = 0x5b9c, [0x0771] = 0x622f, + [0x0772] = 0x6280, [0x0773] = 0x64ec, [0x0774] = 0x6b3a, [0x0775] = 0x72a0, + [0x0776] = 0x7591, [0x0777] = 0x7947, [0x0778] = 0x7fa9, [0x0779] = 0x87fb, + [0x077a] = 0x8abc, [0x077b] = 0x8b70, [0x077c] = 0x63ac, [0x077d] = 0x83ca, + [0x077e] = 0x97a0, [0x077f] = 0x5409, [0x0780] = 0x5403, [0x0781] = 0x55ab, + [0x0782] = 0x6854, [0x0783] = 0x6a58, [0x0784] = 0x8a70, [0x0785] = 0x7827, + [0x0786] = 0x6775, [0x0787] = 0x9ecd, [0x0788] = 0x5374, [0x0789] = 0x5ba2, + [0x078a] = 0x811a, [0x078b] = 0x8650, [0x078c] = 0x9006, [0x078d] = 0x4e18, + [0x078e] = 0x4e45, [0x078f] = 0x4ec7, [0x0790] = 0x4f11, [0x0791] = 0x53ca, + [0x0792] = 0x5438, [0x0793] = 0x5bae, [0x0794] = 0x5f13, [0x0795] = 0x6025, + [0x0796] = 0x6551, [0x0797] = 0x673d, [0x0798] = 0x6c42, [0x0799] = 0x6c72, + [0x079a] = 0x6ce3, [0x079b] = 0x7078, [0x079c] = 0x7403, [0x079d] = 0x7a76, + [0x079e] = 0x7aae, [0x079f] = 0x7b08, [0x07a0] = 0x7d1a, [0x07a1] = 0x7cfe, + [0x07a2] = 0x7d66, [0x07a3] = 0x65e7, [0x07a4] = 0x725b, [0x07a5] = 0x53bb, + [0x07a6] = 0x5c45, [0x07a7] = 0x5de8, [0x07a8] = 0x62d2, [0x07a9] = 0x62e0, + [0x07aa] = 0x6319, [0x07ab] = 0x6e20, [0x07ac] = 0x865a, [0x07ad] = 0x8a31, + [0x07ae] = 0x8ddd, [0x07af] = 0x92f8, [0x07b0] = 0x6f01, [0x07b1] = 0x79a6, + [0x07b2] = 0x9b5a, [0x07b3] = 0x4ea8, [0x07b4] = 0x4eab, [0x07b5] = 0x4eac, + [0x07b6] = 0x4f9b, [0x07b7] = 0x4fa0, [0x07b8] = 0x50d1, [0x07b9] = 0x5147, + [0x07ba] = 0x7af6, [0x07bb] = 0x5171, [0x07bc] = 0x51f6, [0x07bd] = 0x5354, + [0x07be] = 0x5321, [0x07bf] = 0x537f, [0x07c0] = 0x53eb, [0x07c1] = 0x55ac, + [0x07c2] = 0x5883, [0x07c3] = 0x5ce1, [0x07c4] = 0x5f37, [0x07c5] = 0x5f4a, + [0x07c6] = 0x602f, [0x07c7] = 0x6050, [0x07c8] = 0x606d, [0x07c9] = 0x631f, + [0x07ca] = 0x6559, [0x07cb] = 0x6a4b, [0x07cc] = 0x6cc1, [0x07cd] = 0x72c2, + [0x07ce] = 0x72ed, [0x07cf] = 0x77ef, [0x07d0] = 0x80f8, [0x07d1] = 0x8105, + [0x07d2] = 0x8208, [0x07d3] = 0x854e, [0x07d4] = 0x90f7, [0x07d5] = 0x93e1, + [0x07d6] = 0x97ff, [0x07d7] = 0x9957, [0x07d8] = 0x9a5a, [0x07d9] = 0x4ef0, + [0x07da] = 0x51dd, [0x07db] = 0x5c2d, [0x07dc] = 0x6681, [0x07dd] = 0x696d, + [0x07de] = 0x5c40, [0x07df] = 0x66f2, [0x07e0] = 0x6975, [0x07e1] = 0x7389, + [0x07e2] = 0x6850, [0x07e3] = 0x7c81, [0x07e4] = 0x50c5, [0x07e5] = 0x52e4, + [0x07e6] = 0x5747, [0x07e7] = 0x5dfe, [0x07e8] = 0x9326, [0x07e9] = 0x65a4, + [0x07ea] = 0x6b23, [0x07eb] = 0x6b3d, [0x07ec] = 0x7434, [0x07ed] = 0x7981, + [0x07ee] = 0x79bd, [0x07ef] = 0x7b4b, [0x07f0] = 0x7dca, [0x07f1] = 0x82b9, + [0x07f2] = 0x83cc, [0x07f3] = 0x887f, [0x07f4] = 0x895f, [0x07f5] = 0x8b39, + [0x07f6] = 0x8fd1, [0x07f7] = 0x91d1, [0x07f8] = 0x541f, [0x07f9] = 0x9280, + [0x07fa] = 0x4e5d, [0x07fb] = 0x5036, [0x07fc] = 0x53e5, [0x07fd] = 0x533a, + [0x07fe] = 0x72d7, [0x07ff] = 0x7396, [0x0800] = 0x77e9, [0x0801] = 0x82e6, + [0x0802] = 0x8eaf, [0x0803] = 0x99c6, [0x0804] = 0x99c8, [0x0805] = 0x99d2, + [0x0806] = 0x5177, [0x0807] = 0x611a, [0x0808] = 0x865e, [0x0809] = 0x55b0, + [0x080a] = 0x7a7a, [0x080b] = 0x5076, [0x080c] = 0x5bd3, [0x080d] = 0x9047, + [0x080e] = 0x9685, [0x080f] = 0x4e32, [0x0810] = 0x6adb, [0x0811] = 0x91e7, + [0x0812] = 0x5c51, [0x0813] = 0x5c48, [0x0814] = 0x6398, [0x0815] = 0x7a9f, + [0x0816] = 0x6c93, [0x0817] = 0x9774, [0x0818] = 0x8f61, [0x0819] = 0x7aaa, + [0x081a] = 0x718a, [0x081b] = 0x9688, [0x081c] = 0x7c82, [0x081d] = 0x6817, + [0x081e] = 0x7e70, [0x081f] = 0x6851, [0x0820] = 0x936c, [0x0821] = 0x52f2, + [0x0822] = 0x541b, [0x0823] = 0x85ab, [0x0824] = 0x8a13, [0x0825] = 0x7fa4, + [0x0826] = 0x8ecd, [0x0827] = 0x90e1, [0x0828] = 0x5366, [0x0829] = 0x8888, + [0x082a] = 0x7941, [0x082b] = 0x4fc2, [0x082c] = 0x50be, [0x082d] = 0x5211, + [0x082e] = 0x5144, [0x082f] = 0x5553, [0x0830] = 0x572d, [0x0831] = 0x73ea, + [0x0832] = 0x578b, [0x0833] = 0x5951, [0x0834] = 0x5f62, [0x0835] = 0x5f84, + [0x0836] = 0x6075, [0x0837] = 0x6176, [0x0838] = 0x6167, [0x0839] = 0x61a9, + [0x083a] = 0x63b2, [0x083b] = 0x643a, [0x083c] = 0x656c, [0x083d] = 0x666f, + [0x083e] = 0x6842, [0x083f] = 0x6e13, [0x0840] = 0x7566, [0x0841] = 0x7a3d, + [0x0842] = 0x7cfb, [0x0843] = 0x7d4c, [0x0844] = 0x7d99, [0x0845] = 0x7e4b, + [0x0846] = 0x7f6b, [0x0847] = 0x830e, [0x0848] = 0x834a, [0x0849] = 0x86cd, + [0x084a] = 0x8a08, [0x084b] = 0x8a63, [0x084c] = 0x8b66, [0x084d] = 0x8efd, + [0x084e] = 0x981a, [0x084f] = 0x9d8f, [0x0850] = 0x82b8, [0x0851] = 0x8fce, + [0x0852] = 0x9be8, [0x0853] = 0x5287, [0x0854] = 0x621f, [0x0855] = 0x6483, + [0x0856] = 0x6fc0, [0x0857] = 0x9699, [0x0858] = 0x6841, [0x0859] = 0x5091, + [0x085a] = 0x6b20, [0x085b] = 0x6c7a, [0x085c] = 0x6f54, [0x085d] = 0x7a74, + [0x085e] = 0x7d50, [0x085f] = 0x8840, [0x0860] = 0x8a23, [0x0861] = 0x6708, + [0x0862] = 0x4ef6, [0x0863] = 0x5039, [0x0864] = 0x5026, [0x0865] = 0x5065, + [0x0866] = 0x517c, [0x0867] = 0x5238, [0x0868] = 0x5263, [0x0869] = 0x55a7, + [0x086a] = 0x570f, [0x086b] = 0x5805, [0x086c] = 0x5acc, [0x086d] = 0x5efa, + [0x086e] = 0x61b2, [0x086f] = 0x61f8, [0x0870] = 0x62f3, [0x0871] = 0x6372, + [0x0872] = 0x691c, [0x0873] = 0x6a29, [0x0874] = 0x727d, [0x0875] = 0x72ac, + [0x0876] = 0x732e, [0x0877] = 0x7814, [0x0878] = 0x786f, [0x0879] = 0x7d79, + [0x087a] = 0x770c, [0x087b] = 0x80a9, [0x087c] = 0x898b, [0x087d] = 0x8b19, + [0x087e] = 0x8ce2, [0x087f] = 0x8ed2, [0x0880] = 0x9063, [0x0881] = 0x9375, + [0x0882] = 0x967a, [0x0883] = 0x9855, [0x0884] = 0x9a13, [0x0885] = 0x9e78, + [0x0886] = 0x5143, [0x0887] = 0x539f, [0x0888] = 0x53b3, [0x0889] = 0x5e7b, + [0x088a] = 0x5f26, [0x088b] = 0x6e1b, [0x088c] = 0x6e90, [0x088d] = 0x7384, + [0x088e] = 0x73fe, [0x088f] = 0x7d43, [0x0890] = 0x8237, [0x0891] = 0x8a00, + [0x0892] = 0x8afa, [0x0893] = 0x9650, [0x0894] = 0x4e4e, [0x0895] = 0x500b, + [0x0896] = 0x53e4, [0x0897] = 0x547c, [0x0898] = 0x56fa, [0x0899] = 0x59d1, + [0x089a] = 0x5b64, [0x089b] = 0x5df1, [0x089c] = 0x5eab, [0x089d] = 0x5f27, + [0x089e] = 0x6238, [0x089f] = 0x6545, [0x08a0] = 0x67af, [0x08a1] = 0x6e56, + [0x08a2] = 0x72d0, [0x08a3] = 0x7cca, [0x08a4] = 0x88b4, [0x08a5] = 0x80a1, + [0x08a6] = 0x80e1, [0x08a7] = 0x83f0, [0x08a8] = 0x864e, [0x08a9] = 0x8a87, + [0x08aa] = 0x8de8, [0x08ab] = 0x9237, [0x08ac] = 0x96c7, [0x08ad] = 0x9867, + [0x08ae] = 0x9f13, [0x08af] = 0x4e94, [0x08b0] = 0x4e92, [0x08b1] = 0x4f0d, + [0x08b2] = 0x5348, [0x08b3] = 0x5449, [0x08b4] = 0x543e, [0x08b5] = 0x5a2f, + [0x08b6] = 0x5f8c, [0x08b7] = 0x5fa1, [0x08b8] = 0x609f, [0x08b9] = 0x68a7, + [0x08ba] = 0x6a8e, [0x08bb] = 0x745a, [0x08bc] = 0x7881, [0x08bd] = 0x8a9e, + [0x08be] = 0x8aa4, [0x08bf] = 0x8b77, [0x08c0] = 0x9190, [0x08c1] = 0x4e5e, + [0x08c2] = 0x9bc9, [0x08c3] = 0x4ea4, [0x08c4] = 0x4f7c, [0x08c5] = 0x4faf, + [0x08c6] = 0x5019, [0x08c7] = 0x5016, [0x08c8] = 0x5149, [0x08c9] = 0x516c, + [0x08ca] = 0x529f, [0x08cb] = 0x52b9, [0x08cc] = 0x52fe, [0x08cd] = 0x539a, + [0x08ce] = 0x53e3, [0x08cf] = 0x5411, [0x08d0] = 0x540e, [0x08d1] = 0x5589, + [0x08d2] = 0x5751, [0x08d3] = 0x57a2, [0x08d4] = 0x597d, [0x08d5] = 0x5b54, + [0x08d6] = 0x5b5d, [0x08d7] = 0x5b8f, [0x08d8] = 0x5de5, [0x08d9] = 0x5de7, + [0x08da] = 0x5df7, [0x08db] = 0x5e78, [0x08dc] = 0x5e83, [0x08dd] = 0x5e9a, + [0x08de] = 0x5eb7, [0x08df] = 0x5f18, [0x08e0] = 0x6052, [0x08e1] = 0x614c, + [0x08e2] = 0x6297, [0x08e3] = 0x62d8, [0x08e4] = 0x63a7, [0x08e5] = 0x653b, + [0x08e6] = 0x6602, [0x08e7] = 0x6643, [0x08e8] = 0x66f4, [0x08e9] = 0x676d, + [0x08ea] = 0x6821, [0x08eb] = 0x6897, [0x08ec] = 0x69cb, [0x08ed] = 0x6c5f, + [0x08ee] = 0x6d2a, [0x08ef] = 0x6d69, [0x08f0] = 0x6e2f, [0x08f1] = 0x6e9d, + [0x08f2] = 0x7532, [0x08f3] = 0x7687, [0x08f4] = 0x786c, [0x08f5] = 0x7a3f, + [0x08f6] = 0x7ce0, [0x08f7] = 0x7d05, [0x08f8] = 0x7d18, [0x08f9] = 0x7d5e, + [0x08fa] = 0x7db1, [0x08fb] = 0x8015, [0x08fc] = 0x8003, [0x08fd] = 0x80af, + [0x08fe] = 0x80b1, [0x08ff] = 0x8154, [0x0900] = 0x818f, [0x0901] = 0x822a, + [0x0902] = 0x8352, [0x0903] = 0x884c, [0x0904] = 0x8861, [0x0905] = 0x8b1b, + [0x0906] = 0x8ca2, [0x0907] = 0x8cfc, [0x0908] = 0x90ca, [0x0909] = 0x9175, + [0x090a] = 0x9271, [0x090b] = 0x783f, [0x090c] = 0x92fc, [0x090d] = 0x95a4, + [0x090e] = 0x964d, [0x090f] = 0x9805, [0x0910] = 0x9999, [0x0911] = 0x9ad8, + [0x0912] = 0x9d3b, [0x0913] = 0x525b, [0x0914] = 0x52ab, [0x0915] = 0x53f7, + [0x0916] = 0x5408, [0x0917] = 0x58d5, [0x0918] = 0x62f7, [0x0919] = 0x6fe0, + [0x091a] = 0x8c6a, [0x091b] = 0x8f5f, [0x091c] = 0x9eb9, [0x091d] = 0x514b, + [0x091e] = 0x523b, [0x091f] = 0x544a, [0x0920] = 0x56fd, [0x0921] = 0x7a40, + [0x0922] = 0x9177, [0x0923] = 0x9d60, [0x0924] = 0x9ed2, [0x0925] = 0x7344, + [0x0926] = 0x6f09, [0x0927] = 0x8170, [0x0928] = 0x7511, [0x0929] = 0x5ffd, + [0x092a] = 0x60da, [0x092b] = 0x9aa8, [0x092c] = 0x72db, [0x092d] = 0x8fbc, + [0x092e] = 0x6b64, [0x092f] = 0x9803, [0x0930] = 0x4eca, [0x0931] = 0x56f0, + [0x0932] = 0x5764, [0x0933] = 0x58be, [0x0934] = 0x5a5a, [0x0935] = 0x6068, + [0x0936] = 0x61c7, [0x0937] = 0x660f, [0x0938] = 0x6606, [0x0939] = 0x6839, + [0x093a] = 0x68b1, [0x093b] = 0x6df7, [0x093c] = 0x75d5, [0x093d] = 0x7d3a, + [0x093e] = 0x826e, [0x093f] = 0x9b42, [0x0940] = 0x4e9b, [0x0941] = 0x4f50, + [0x0942] = 0x53c9, [0x0943] = 0x5506, [0x0944] = 0x5d6f, [0x0945] = 0x5de6, + [0x0946] = 0x5dee, [0x0947] = 0x67fb, [0x0948] = 0x6c99, [0x0949] = 0x7473, + [0x094a] = 0x7802, [0x094b] = 0x8a50, [0x094c] = 0x9396, [0x094d] = 0x88df, + [0x094e] = 0x5750, [0x094f] = 0x5ea7, [0x0950] = 0x632b, [0x0951] = 0x50b5, + [0x0952] = 0x50ac, [0x0953] = 0x518d, [0x0954] = 0x6700, [0x0955] = 0x54c9, + [0x0956] = 0x585e, [0x0957] = 0x59bb, [0x0958] = 0x5bb0, [0x0959] = 0x5f69, + [0x095a] = 0x624d, [0x095b] = 0x63a1, [0x095c] = 0x683d, [0x095d] = 0x6b73, + [0x095e] = 0x6e08, [0x095f] = 0x707d, [0x0960] = 0x91c7, [0x0961] = 0x7280, + [0x0962] = 0x7815, [0x0963] = 0x7826, [0x0964] = 0x796d, [0x0965] = 0x658e, + [0x0966] = 0x7d30, [0x0967] = 0x83dc, [0x0968] = 0x88c1, [0x0969] = 0x8f09, + [0x096a] = 0x969b, [0x096b] = 0x5264, [0x096c] = 0x5728, [0x096d] = 0x6750, + [0x096e] = 0x7f6a, [0x096f] = 0x8ca1, [0x0970] = 0x51b4, [0x0971] = 0x5742, + [0x0972] = 0x962a, [0x0973] = 0x583a, [0x0974] = 0x698a, [0x0975] = 0x80b4, + [0x0976] = 0x54b2, [0x0977] = 0x5d0e, [0x0978] = 0x57fc, [0x0979] = 0x7895, + [0x097a] = 0x9dfa, [0x097b] = 0x4f5c, [0x097c] = 0x524a, [0x097d] = 0x548b, + [0x097e] = 0x643e, [0x097f] = 0x6628, [0x0980] = 0x6714, [0x0981] = 0x67f5, + [0x0982] = 0x7a84, [0x0983] = 0x7b56, [0x0984] = 0x7d22, [0x0985] = 0x932f, + [0x0986] = 0x685c, [0x0987] = 0x9bad, [0x0988] = 0x7b39, [0x0989] = 0x5319, + [0x098a] = 0x518a, [0x098b] = 0x5237, [0x098c] = 0x5bdf, [0x098d] = 0x62f6, + [0x098e] = 0x64ae, [0x098f] = 0x64e6, [0x0990] = 0x672d, [0x0991] = 0x6bba, + [0x0992] = 0x85a9, [0x0993] = 0x96d1, [0x0994] = 0x7690, [0x0995] = 0x9bd6, + [0x0996] = 0x634c, [0x0997] = 0x9306, [0x0998] = 0x9bab, [0x0999] = 0x76bf, + [0x099a] = 0x6652, [0x099b] = 0x4e09, [0x099c] = 0x5098, [0x099d] = 0x53c2, + [0x099e] = 0x5c71, [0x099f] = 0x60e8, [0x09a0] = 0x6492, [0x09a1] = 0x6563, + [0x09a2] = 0x685f, [0x09a3] = 0x71e6, [0x09a4] = 0x73ca, [0x09a5] = 0x7523, + [0x09a6] = 0x7b97, [0x09a7] = 0x7e82, [0x09a8] = 0x8695, [0x09a9] = 0x8b83, + [0x09aa] = 0x8cdb, [0x09ab] = 0x9178, [0x09ac] = 0x9910, [0x09ad] = 0x65ac, + [0x09ae] = 0x66ab, [0x09af] = 0x6b8b, [0x09b0] = 0x4ed5, [0x09b1] = 0x4ed4, + [0x09b2] = 0x4f3a, [0x09b3] = 0x4f7f, [0x09b4] = 0x523a, [0x09b5] = 0x53f8, + [0x09b6] = 0x53f2, [0x09b7] = 0x55e3, [0x09b8] = 0x56db, [0x09b9] = 0x58eb, + [0x09ba] = 0x59cb, [0x09bb] = 0x59c9, [0x09bc] = 0x59ff, [0x09bd] = 0x5b50, + [0x09be] = 0x5c4d, [0x09bf] = 0x5e02, [0x09c0] = 0x5e2b, [0x09c1] = 0x5fd7, + [0x09c2] = 0x601d, [0x09c3] = 0x6307, [0x09c4] = 0x652f, [0x09c5] = 0x5b5c, + [0x09c6] = 0x65af, [0x09c7] = 0x65bd, [0x09c8] = 0x65e8, [0x09c9] = 0x679d, + [0x09ca] = 0x6b62, [0x09cb] = 0x6b7b, [0x09cc] = 0x6c0f, [0x09cd] = 0x7345, + [0x09ce] = 0x7949, [0x09cf] = 0x79c1, [0x09d0] = 0x7cf8, [0x09d1] = 0x7d19, + [0x09d2] = 0x7d2b, [0x09d3] = 0x80a2, [0x09d4] = 0x8102, [0x09d5] = 0x81f3, + [0x09d6] = 0x8996, [0x09d7] = 0x8a5e, [0x09d8] = 0x8a69, [0x09d9] = 0x8a66, + [0x09da] = 0x8a8c, [0x09db] = 0x8aee, [0x09dc] = 0x8cc7, [0x09dd] = 0x8cdc, + [0x09de] = 0x96cc, [0x09df] = 0x98fc, [0x09e0] = 0x6b6f, [0x09e1] = 0x4e8b, + [0x09e2] = 0x4f3c, [0x09e3] = 0x4f8d, [0x09e4] = 0x5150, [0x09e5] = 0x5b57, + [0x09e6] = 0x5bfa, [0x09e7] = 0x6148, [0x09e8] = 0x6301, [0x09e9] = 0x6642, + [0x09ea] = 0x6b21, [0x09eb] = 0x6ecb, [0x09ec] = 0x6cbb, [0x09ed] = 0x723e, + [0x09ee] = 0x74bd, [0x09ef] = 0x75d4, [0x09f0] = 0x78c1, [0x09f1] = 0x793a, + [0x09f2] = 0x800c, [0x09f3] = 0x8033, [0x09f4] = 0x81ea, [0x09f5] = 0x8494, + [0x09f6] = 0x8f9e, [0x09f7] = 0x6c50, [0x09f8] = 0x9e7f, [0x09f9] = 0x5f0f, + [0x09fa] = 0x8b58, [0x09fb] = 0x9d2b, [0x09fc] = 0x7afa, [0x09fd] = 0x8ef8, + [0x09fe] = 0x5b8d, [0x09ff] = 0x96eb, [0x0a00] = 0x4e03, [0x0a01] = 0x53f1, + [0x0a02] = 0x57f7, [0x0a03] = 0x5931, [0x0a04] = 0x5ac9, [0x0a05] = 0x5ba4, + [0x0a06] = 0x6089, [0x0a07] = 0x6e7f, [0x0a08] = 0x6f06, [0x0a09] = 0x75be, + [0x0a0a] = 0x8cea, [0x0a0b] = 0x5b9f, [0x0a0c] = 0x8500, [0x0a0d] = 0x7be0, + [0x0a0e] = 0x5072, [0x0a0f] = 0x67f4, [0x0a10] = 0x829d, [0x0a11] = 0x5c61, + [0x0a12] = 0x854a, [0x0a13] = 0x7e1e, [0x0a14] = 0x820e, [0x0a15] = 0x5199, + [0x0a16] = 0x5c04, [0x0a17] = 0x6368, [0x0a18] = 0x8d66, [0x0a19] = 0x659c, + [0x0a1a] = 0x716e, [0x0a1b] = 0x793e, [0x0a1c] = 0x7d17, [0x0a1d] = 0x8005, + [0x0a1e] = 0x8b1d, [0x0a1f] = 0x8eca, [0x0a20] = 0x906e, [0x0a21] = 0x86c7, + [0x0a22] = 0x90aa, [0x0a23] = 0x501f, [0x0a24] = 0x52fa, [0x0a25] = 0x5c3a, + [0x0a26] = 0x6753, [0x0a27] = 0x707c, [0x0a28] = 0x7235, [0x0a29] = 0x914c, + [0x0a2a] = 0x91c8, [0x0a2b] = 0x932b, [0x0a2c] = 0x82e5, [0x0a2d] = 0x5bc2, + [0x0a2e] = 0x5f31, [0x0a2f] = 0x60f9, [0x0a30] = 0x4e3b, [0x0a31] = 0x53d6, + [0x0a32] = 0x5b88, [0x0a33] = 0x624b, [0x0a34] = 0x6731, [0x0a35] = 0x6b8a, + [0x0a36] = 0x72e9, [0x0a37] = 0x73e0, [0x0a38] = 0x7a2e, [0x0a39] = 0x816b, + [0x0a3a] = 0x8da3, [0x0a3b] = 0x9152, [0x0a3c] = 0x9996, [0x0a3d] = 0x5112, + [0x0a3e] = 0x53d7, [0x0a3f] = 0x546a, [0x0a40] = 0x5bff, [0x0a41] = 0x6388, + [0x0a42] = 0x6a39, [0x0a43] = 0x7dac, [0x0a44] = 0x9700, [0x0a45] = 0x56da, + [0x0a46] = 0x53ce, [0x0a47] = 0x5468, [0x0a48] = 0x5b97, [0x0a49] = 0x5c31, + [0x0a4a] = 0x5dde, [0x0a4b] = 0x4fee, [0x0a4c] = 0x6101, [0x0a4d] = 0x62fe, + [0x0a4e] = 0x6d32, [0x0a4f] = 0x79c0, [0x0a50] = 0x79cb, [0x0a51] = 0x7d42, + [0x0a52] = 0x7e4d, [0x0a53] = 0x7fd2, [0x0a54] = 0x81ed, [0x0a55] = 0x821f, + [0x0a56] = 0x8490, [0x0a57] = 0x8846, [0x0a58] = 0x8972, [0x0a59] = 0x8b90, + [0x0a5a] = 0x8e74, [0x0a5b] = 0x8f2f, [0x0a5c] = 0x9031, [0x0a5d] = 0x914b, + [0x0a5e] = 0x916c, [0x0a5f] = 0x96c6, [0x0a60] = 0x919c, [0x0a61] = 0x4ec0, + [0x0a62] = 0x4f4f, [0x0a63] = 0x5145, [0x0a64] = 0x5341, [0x0a65] = 0x5f93, + [0x0a66] = 0x620e, [0x0a67] = 0x67d4, [0x0a68] = 0x6c41, [0x0a69] = 0x6e0b, + [0x0a6a] = 0x7363, [0x0a6b] = 0x7e26, [0x0a6c] = 0x91cd, [0x0a6d] = 0x9283, + [0x0a6e] = 0x53d4, [0x0a6f] = 0x5919, [0x0a70] = 0x5bbf, [0x0a71] = 0x6dd1, + [0x0a72] = 0x795d, [0x0a73] = 0x7e2e, [0x0a74] = 0x7c9b, [0x0a75] = 0x587e, + [0x0a76] = 0x719f, [0x0a77] = 0x51fa, [0x0a78] = 0x8853, [0x0a79] = 0x8ff0, + [0x0a7a] = 0x4fca, [0x0a7b] = 0x5cfb, [0x0a7c] = 0x6625, [0x0a7d] = 0x77ac, + [0x0a7e] = 0x7ae3, [0x0a7f] = 0x821c, [0x0a80] = 0x99ff, [0x0a81] = 0x51c6, + [0x0a82] = 0x5faa, [0x0a83] = 0x65ec, [0x0a84] = 0x696f, [0x0a85] = 0x6b89, + [0x0a86] = 0x6df3, [0x0a87] = 0x6e96, [0x0a88] = 0x6f64, [0x0a89] = 0x76fe, + [0x0a8a] = 0x7d14, [0x0a8b] = 0x5de1, [0x0a8c] = 0x9075, [0x0a8d] = 0x9187, + [0x0a8e] = 0x9806, [0x0a8f] = 0x51e6, [0x0a90] = 0x521d, [0x0a91] = 0x6240, + [0x0a92] = 0x6691, [0x0a93] = 0x66d9, [0x0a94] = 0x6e1a, [0x0a95] = 0x5eb6, + [0x0a96] = 0x7dd2, [0x0a97] = 0x7f72, [0x0a98] = 0x66f8, [0x0a99] = 0x85af, + [0x0a9a] = 0x85f7, [0x0a9b] = 0x8af8, [0x0a9c] = 0x52a9, [0x0a9d] = 0x53d9, + [0x0a9e] = 0x5973, [0x0a9f] = 0x5e8f, [0x0aa0] = 0x5f90, [0x0aa1] = 0x6055, + [0x0aa2] = 0x92e4, [0x0aa3] = 0x9664, [0x0aa4] = 0x50b7, [0x0aa5] = 0x511f, + [0x0aa6] = 0x52dd, [0x0aa7] = 0x5320, [0x0aa8] = 0x5347, [0x0aa9] = 0x53ec, + [0x0aaa] = 0x54e8, [0x0aab] = 0x5546, [0x0aac] = 0x5531, [0x0aad] = 0x5617, + [0x0aae] = 0x5968, [0x0aaf] = 0x59be, [0x0ab0] = 0x5a3c, [0x0ab1] = 0x5bb5, + [0x0ab2] = 0x5c06, [0x0ab3] = 0x5c0f, [0x0ab4] = 0x5c11, [0x0ab5] = 0x5c1a, + [0x0ab6] = 0x5e84, [0x0ab7] = 0x5e8a, [0x0ab8] = 0x5ee0, [0x0ab9] = 0x5f70, + [0x0aba] = 0x627f, [0x0abb] = 0x6284, [0x0abc] = 0x62db, [0x0abd] = 0x638c, + [0x0abe] = 0x6377, [0x0abf] = 0x6607, [0x0ac0] = 0x660c, [0x0ac1] = 0x662d, + [0x0ac2] = 0x6676, [0x0ac3] = 0x677e, [0x0ac4] = 0x68a2, [0x0ac5] = 0x6a1f, + [0x0ac6] = 0x6a35, [0x0ac7] = 0x6cbc, [0x0ac8] = 0x6d88, [0x0ac9] = 0x6e09, + [0x0aca] = 0x6e58, [0x0acb] = 0x713c, [0x0acc] = 0x7126, [0x0acd] = 0x7167, + [0x0ace] = 0x75c7, [0x0acf] = 0x7701, [0x0ad0] = 0x785d, [0x0ad1] = 0x7901, + [0x0ad2] = 0x7965, [0x0ad3] = 0x79f0, [0x0ad4] = 0x7ae0, [0x0ad5] = 0x7b11, + [0x0ad6] = 0x7ca7, [0x0ad7] = 0x7d39, [0x0ad8] = 0x8096, [0x0ad9] = 0x83d6, + [0x0ada] = 0x848b, [0x0adb] = 0x8549, [0x0adc] = 0x885d, [0x0add] = 0x88f3, + [0x0ade] = 0x8a1f, [0x0adf] = 0x8a3c, [0x0ae0] = 0x8a54, [0x0ae1] = 0x8a73, + [0x0ae2] = 0x8c61, [0x0ae3] = 0x8cde, [0x0ae4] = 0x91a4, [0x0ae5] = 0x9266, + [0x0ae6] = 0x937e, [0x0ae7] = 0x9418, [0x0ae8] = 0x969c, [0x0ae9] = 0x9798, + [0x0aea] = 0x4e0a, [0x0aeb] = 0x4e08, [0x0aec] = 0x4e1e, [0x0aed] = 0x4e57, + [0x0aee] = 0x5197, [0x0aef] = 0x5270, [0x0af0] = 0x57ce, [0x0af1] = 0x5834, + [0x0af2] = 0x58cc, [0x0af3] = 0x5b22, [0x0af4] = 0x5e38, [0x0af5] = 0x60c5, + [0x0af6] = 0x64fe, [0x0af7] = 0x6761, [0x0af8] = 0x6756, [0x0af9] = 0x6d44, + [0x0afa] = 0x72b6, [0x0afb] = 0x7573, [0x0afc] = 0x7a63, [0x0afd] = 0x84b8, + [0x0afe] = 0x8b72, [0x0aff] = 0x91b8, [0x0b00] = 0x9320, [0x0b01] = 0x5631, + [0x0b02] = 0x57f4, [0x0b03] = 0x98fe, [0x0b04] = 0x62ed, [0x0b05] = 0x690d, + [0x0b06] = 0x6b96, [0x0b07] = 0x71ed, [0x0b08] = 0x7e54, [0x0b09] = 0x8077, + [0x0b0a] = 0x8272, [0x0b0b] = 0x89e6, [0x0b0c] = 0x98df, [0x0b0d] = 0x8755, + [0x0b0e] = 0x8fb1, [0x0b0f] = 0x5c3b, [0x0b10] = 0x4f38, [0x0b11] = 0x4fe1, + [0x0b12] = 0x4fb5, [0x0b13] = 0x5507, [0x0b14] = 0x5a20, [0x0b15] = 0x5bdd, + [0x0b16] = 0x5be9, [0x0b17] = 0x5fc3, [0x0b18] = 0x614e, [0x0b19] = 0x632f, + [0x0b1a] = 0x65b0, [0x0b1b] = 0x664b, [0x0b1c] = 0x68ee, [0x0b1d] = 0x699b, + [0x0b1e] = 0x6d78, [0x0b1f] = 0x6df1, [0x0b20] = 0x7533, [0x0b21] = 0x75b9, + [0x0b22] = 0x771f, [0x0b23] = 0x795e, [0x0b24] = 0x79e6, [0x0b25] = 0x7d33, + [0x0b26] = 0x81e3, [0x0b27] = 0x82af, [0x0b28] = 0x85aa, [0x0b29] = 0x89aa, + [0x0b2a] = 0x8a3a, [0x0b2b] = 0x8eab, [0x0b2c] = 0x8f9b, [0x0b2d] = 0x9032, + [0x0b2e] = 0x91dd, [0x0b2f] = 0x9707, [0x0b30] = 0x4eba, [0x0b31] = 0x4ec1, + [0x0b32] = 0x5203, [0x0b33] = 0x5875, [0x0b34] = 0x58ec, [0x0b35] = 0x5c0b, + [0x0b36] = 0x751a, [0x0b37] = 0x5c3d, [0x0b38] = 0x814e, [0x0b39] = 0x8a0a, + [0x0b3a] = 0x8fc5, [0x0b3b] = 0x9663, [0x0b3c] = 0x976d, [0x0b3d] = 0x7b25, + [0x0b3e] = 0x8acf, [0x0b3f] = 0x9808, [0x0b40] = 0x9162, [0x0b41] = 0x56f3, + [0x0b42] = 0x53a8, [0x0b43] = 0x9017, [0x0b44] = 0x5439, [0x0b45] = 0x5782, + [0x0b46] = 0x5e25, [0x0b47] = 0x63a8, [0x0b48] = 0x6c34, [0x0b49] = 0x708a, + [0x0b4a] = 0x7761, [0x0b4b] = 0x7c8b, [0x0b4c] = 0x7fe0, [0x0b4d] = 0x8870, + [0x0b4e] = 0x9042, [0x0b4f] = 0x9154, [0x0b50] = 0x9310, [0x0b51] = 0x9318, + [0x0b52] = 0x968f, [0x0b53] = 0x745e, [0x0b54] = 0x9ac4, [0x0b55] = 0x5d07, + [0x0b56] = 0x5d69, [0x0b57] = 0x6570, [0x0b58] = 0x67a2, [0x0b59] = 0x8da8, + [0x0b5a] = 0x96db, [0x0b5b] = 0x636e, [0x0b5c] = 0x6749, [0x0b5d] = 0x6919, + [0x0b5e] = 0x83c5, [0x0b5f] = 0x9817, [0x0b60] = 0x96c0, [0x0b61] = 0x88fe, + [0x0b62] = 0x6f84, [0x0b63] = 0x647a, [0x0b64] = 0x5bf8, [0x0b65] = 0x4e16, + [0x0b66] = 0x702c, [0x0b67] = 0x755d, [0x0b68] = 0x662f, [0x0b69] = 0x51c4, + [0x0b6a] = 0x5236, [0x0b6b] = 0x52e2, [0x0b6c] = 0x59d3, [0x0b6d] = 0x5f81, + [0x0b6e] = 0x6027, [0x0b6f] = 0x6210, [0x0b70] = 0x653f, [0x0b71] = 0x6574, + [0x0b72] = 0x661f, [0x0b73] = 0x6674, [0x0b74] = 0x68f2, [0x0b75] = 0x6816, + [0x0b76] = 0x6b63, [0x0b77] = 0x6e05, [0x0b78] = 0x7272, [0x0b79] = 0x751f, + [0x0b7a] = 0x76db, [0x0b7b] = 0x7cbe, [0x0b7c] = 0x8056, [0x0b7d] = 0x58f0, + [0x0b7e] = 0x88fd, [0x0b7f] = 0x897f, [0x0b80] = 0x8aa0, [0x0b81] = 0x8a93, + [0x0b82] = 0x8acb, [0x0b83] = 0x901d, [0x0b84] = 0x9192, [0x0b85] = 0x9752, + [0x0b86] = 0x9759, [0x0b87] = 0x6589, [0x0b88] = 0x7a0e, [0x0b89] = 0x8106, + [0x0b8a] = 0x96bb, [0x0b8b] = 0x5e2d, [0x0b8c] = 0x60dc, [0x0b8d] = 0x621a, + [0x0b8e] = 0x65a5, [0x0b8f] = 0x6614, [0x0b90] = 0x6790, [0x0b91] = 0x77f3, + [0x0b92] = 0x7a4d, [0x0b93] = 0x7c4d, [0x0b94] = 0x7e3e, [0x0b95] = 0x810a, + [0x0b96] = 0x8cac, [0x0b97] = 0x8d64, [0x0b98] = 0x8de1, [0x0b99] = 0x8e5f, + [0x0b9a] = 0x78a9, [0x0b9b] = 0x5207, [0x0b9c] = 0x62d9, [0x0b9d] = 0x63a5, + [0x0b9e] = 0x6442, [0x0b9f] = 0x6298, [0x0ba0] = 0x8a2d, [0x0ba1] = 0x7a83, + [0x0ba2] = 0x7bc0, [0x0ba3] = 0x8aac, [0x0ba4] = 0x96ea, [0x0ba5] = 0x7d76, + [0x0ba6] = 0x820c, [0x0ba7] = 0x8749, [0x0ba8] = 0x4ed9, [0x0ba9] = 0x5148, + [0x0baa] = 0x5343, [0x0bab] = 0x5360, [0x0bac] = 0x5ba3, [0x0bad] = 0x5c02, + [0x0bae] = 0x5c16, [0x0baf] = 0x5ddd, [0x0bb0] = 0x6226, [0x0bb1] = 0x6247, + [0x0bb2] = 0x64b0, [0x0bb3] = 0x6813, [0x0bb4] = 0x6834, [0x0bb5] = 0x6cc9, + [0x0bb6] = 0x6d45, [0x0bb7] = 0x6d17, [0x0bb8] = 0x67d3, [0x0bb9] = 0x6f5c, + [0x0bba] = 0x714e, [0x0bbb] = 0x717d, [0x0bbc] = 0x65cb, [0x0bbd] = 0x7a7f, + [0x0bbe] = 0x7bad, [0x0bbf] = 0x7dda, [0x0bc0] = 0x7e4a, [0x0bc1] = 0x7fa8, + [0x0bc2] = 0x817a, [0x0bc3] = 0x821b, [0x0bc4] = 0x8239, [0x0bc5] = 0x85a6, + [0x0bc6] = 0x8a6e, [0x0bc7] = 0x8cce, [0x0bc8] = 0x8df5, [0x0bc9] = 0x9078, + [0x0bca] = 0x9077, [0x0bcb] = 0x92ad, [0x0bcc] = 0x9291, [0x0bcd] = 0x9583, + [0x0bce] = 0x9bae, [0x0bcf] = 0x524d, [0x0bd0] = 0x5584, [0x0bd1] = 0x6f38, + [0x0bd2] = 0x7136, [0x0bd3] = 0x5168, [0x0bd4] = 0x7985, [0x0bd5] = 0x7e55, + [0x0bd6] = 0x81b3, [0x0bd7] = 0x7cce, [0x0bd8] = 0x564c, [0x0bd9] = 0x5851, + [0x0bda] = 0x5ca8, [0x0bdb] = 0x63aa, [0x0bdc] = 0x66fe, [0x0bdd] = 0x66fd, + [0x0bde] = 0x695a, [0x0bdf] = 0x72d9, [0x0be0] = 0x758f, [0x0be1] = 0x758e, + [0x0be2] = 0x790e, [0x0be3] = 0x7956, [0x0be4] = 0x79df, [0x0be5] = 0x7c97, + [0x0be6] = 0x7d20, [0x0be7] = 0x7d44, [0x0be8] = 0x8607, [0x0be9] = 0x8a34, + [0x0bea] = 0x963b, [0x0beb] = 0x9061, [0x0bec] = 0x9f20, [0x0bed] = 0x50e7, + [0x0bee] = 0x5275, [0x0bef] = 0x53cc, [0x0bf0] = 0x53e2, [0x0bf1] = 0x5009, + [0x0bf2] = 0x55aa, [0x0bf3] = 0x58ee, [0x0bf4] = 0x594f, [0x0bf5] = 0x723d, + [0x0bf6] = 0x5b8b, [0x0bf7] = 0x5c64, [0x0bf8] = 0x531d, [0x0bf9] = 0x60e3, + [0x0bfa] = 0x60f3, [0x0bfb] = 0x635c, [0x0bfc] = 0x6383, [0x0bfd] = 0x633f, + [0x0bfe] = 0x63bb, [0x0bff] = 0x64cd, [0x0c00] = 0x65e9, [0x0c01] = 0x66f9, + [0x0c02] = 0x5de3, [0x0c03] = 0x69cd, [0x0c04] = 0x69fd, [0x0c05] = 0x6f15, + [0x0c06] = 0x71e5, [0x0c07] = 0x4e89, [0x0c08] = 0x75e9, [0x0c09] = 0x76f8, + [0x0c0a] = 0x7a93, [0x0c0b] = 0x7cdf, [0x0c0c] = 0x7dcf, [0x0c0d] = 0x7d9c, + [0x0c0e] = 0x8061, [0x0c0f] = 0x8349, [0x0c10] = 0x8358, [0x0c11] = 0x846c, + [0x0c12] = 0x84bc, [0x0c13] = 0x85fb, [0x0c14] = 0x88c5, [0x0c15] = 0x8d70, + [0x0c16] = 0x9001, [0x0c17] = 0x906d, [0x0c18] = 0x9397, [0x0c19] = 0x971c, + [0x0c1a] = 0x9a12, [0x0c1b] = 0x50cf, [0x0c1c] = 0x5897, [0x0c1d] = 0x618e, + [0x0c1e] = 0x81d3, [0x0c1f] = 0x8535, [0x0c20] = 0x8d08, [0x0c21] = 0x9020, + [0x0c22] = 0x4fc3, [0x0c23] = 0x5074, [0x0c24] = 0x5247, [0x0c25] = 0x5373, + [0x0c26] = 0x606f, [0x0c27] = 0x6349, [0x0c28] = 0x675f, [0x0c29] = 0x6e2c, + [0x0c2a] = 0x8db3, [0x0c2b] = 0x901f, [0x0c2c] = 0x4fd7, [0x0c2d] = 0x5c5e, + [0x0c2e] = 0x8cca, [0x0c2f] = 0x65cf, [0x0c30] = 0x7d9a, [0x0c31] = 0x5352, + [0x0c32] = 0x8896, [0x0c33] = 0x5176, [0x0c34] = 0x63c3, [0x0c35] = 0x5b58, + [0x0c36] = 0x5b6b, [0x0c37] = 0x5c0a, [0x0c38] = 0x640d, [0x0c39] = 0x6751, + [0x0c3a] = 0x905c, [0x0c3b] = 0x4ed6, [0x0c3c] = 0x591a, [0x0c3d] = 0x592a, + [0x0c3e] = 0x6c70, [0x0c3f] = 0x8a51, [0x0c40] = 0x553e, [0x0c41] = 0x5815, + [0x0c42] = 0x59a5, [0x0c43] = 0x60f0, [0x0c44] = 0x6253, [0x0c45] = 0x67c1, + [0x0c46] = 0x8235, [0x0c47] = 0x6955, [0x0c48] = 0x9640, [0x0c49] = 0x99c4, + [0x0c4a] = 0x9a28, [0x0c4b] = 0x4f53, [0x0c4c] = 0x5806, [0x0c4d] = 0x5bfe, + [0x0c4e] = 0x8010, [0x0c4f] = 0x5cb1, [0x0c50] = 0x5e2f, [0x0c51] = 0x5f85, + [0x0c52] = 0x6020, [0x0c53] = 0x614b, [0x0c54] = 0x6234, [0x0c55] = 0x66ff, + [0x0c56] = 0x6cf0, [0x0c57] = 0x6ede, [0x0c58] = 0x80ce, [0x0c59] = 0x817f, + [0x0c5a] = 0x82d4, [0x0c5b] = 0x888b, [0x0c5c] = 0x8cb8, [0x0c5d] = 0x9000, + [0x0c5e] = 0x902e, [0x0c5f] = 0x968a, [0x0c60] = 0x9edb, [0x0c61] = 0x9bdb, + [0x0c62] = 0x4ee3, [0x0c63] = 0x53f0, [0x0c64] = 0x5927, [0x0c65] = 0x7b2c, + [0x0c66] = 0x918d, [0x0c67] = 0x984c, [0x0c68] = 0x9df9, [0x0c69] = 0x6edd, + [0x0c6a] = 0x7027, [0x0c6b] = 0x5353, [0x0c6c] = 0x5544, [0x0c6d] = 0x5b85, + [0x0c6e] = 0x6258, [0x0c6f] = 0x629e, [0x0c70] = 0x62d3, [0x0c71] = 0x6ca2, + [0x0c72] = 0x6fef, [0x0c73] = 0x7422, [0x0c74] = 0x8a17, [0x0c75] = 0x9438, + [0x0c76] = 0x6fc1, [0x0c77] = 0x8afe, [0x0c78] = 0x8338, [0x0c79] = 0x51e7, + [0x0c7a] = 0x86f8, [0x0c7b] = 0x53ea, [0x0c7c] = 0x53e9, [0x0c7d] = 0x4f46, + [0x0c7e] = 0x9054, [0x0c7f] = 0x8fb0, [0x0c80] = 0x596a, [0x0c81] = 0x8131, + [0x0c82] = 0x5dfd, [0x0c83] = 0x7aea, [0x0c84] = 0x8fbf, [0x0c85] = 0x68da, + [0x0c86] = 0x8c37, [0x0c87] = 0x72f8, [0x0c88] = 0x9c48, [0x0c89] = 0x6a3d, + [0x0c8a] = 0x8ab0, [0x0c8b] = 0x4e39, [0x0c8c] = 0x5358, [0x0c8d] = 0x5606, + [0x0c8e] = 0x5766, [0x0c8f] = 0x62c5, [0x0c90] = 0x63a2, [0x0c91] = 0x65e6, + [0x0c92] = 0x6b4e, [0x0c93] = 0x6de1, [0x0c94] = 0x6e5b, [0x0c95] = 0x70ad, + [0x0c96] = 0x77ed, [0x0c97] = 0x7aef, [0x0c98] = 0x7baa, [0x0c99] = 0x7dbb, + [0x0c9a] = 0x803d, [0x0c9b] = 0x80c6, [0x0c9c] = 0x86cb, [0x0c9d] = 0x8a95, + [0x0c9e] = 0x935b, [0x0c9f] = 0x56e3, [0x0ca0] = 0x58c7, [0x0ca1] = 0x5f3e, + [0x0ca2] = 0x65ad, [0x0ca3] = 0x6696, [0x0ca4] = 0x6a80, [0x0ca5] = 0x6bb5, + [0x0ca6] = 0x7537, [0x0ca7] = 0x8ac7, [0x0ca8] = 0x5024, [0x0ca9] = 0x77e5, + [0x0caa] = 0x5730, [0x0cab] = 0x5f1b, [0x0cac] = 0x6065, [0x0cad] = 0x667a, + [0x0cae] = 0x6c60, [0x0caf] = 0x75f4, [0x0cb0] = 0x7a1a, [0x0cb1] = 0x7f6e, + [0x0cb2] = 0x81f4, [0x0cb3] = 0x8718, [0x0cb4] = 0x9045, [0x0cb5] = 0x99b3, + [0x0cb6] = 0x7bc9, [0x0cb7] = 0x755c, [0x0cb8] = 0x7af9, [0x0cb9] = 0x7b51, + [0x0cba] = 0x84c4, [0x0cbb] = 0x9010, [0x0cbc] = 0x79e9, [0x0cbd] = 0x7a92, + [0x0cbe] = 0x8336, [0x0cbf] = 0x5ae1, [0x0cc0] = 0x7740, [0x0cc1] = 0x4e2d, + [0x0cc2] = 0x4ef2, [0x0cc3] = 0x5b99, [0x0cc4] = 0x5fe0, [0x0cc5] = 0x62bd, + [0x0cc6] = 0x663c, [0x0cc7] = 0x67f1, [0x0cc8] = 0x6ce8, [0x0cc9] = 0x866b, + [0x0cca] = 0x8877, [0x0ccb] = 0x8a3b, [0x0ccc] = 0x914e, [0x0ccd] = 0x92f3, + [0x0cce] = 0x99d0, [0x0ccf] = 0x6a17, [0x0cd0] = 0x7026, [0x0cd1] = 0x732a, + [0x0cd2] = 0x82e7, [0x0cd3] = 0x8457, [0x0cd4] = 0x8caf, [0x0cd5] = 0x4e01, + [0x0cd6] = 0x5146, [0x0cd7] = 0x51cb, [0x0cd8] = 0x558b, [0x0cd9] = 0x5bf5, + [0x0cda] = 0x5e16, [0x0cdb] = 0x5e33, [0x0cdc] = 0x5e81, [0x0cdd] = 0x5f14, + [0x0cde] = 0x5f35, [0x0cdf] = 0x5f6b, [0x0ce0] = 0x5fb4, [0x0ce1] = 0x61f2, + [0x0ce2] = 0x6311, [0x0ce3] = 0x66a2, [0x0ce4] = 0x671d, [0x0ce5] = 0x6f6e, + [0x0ce6] = 0x7252, [0x0ce7] = 0x753a, [0x0ce8] = 0x773a, [0x0ce9] = 0x8074, + [0x0cea] = 0x8139, [0x0ceb] = 0x8178, [0x0cec] = 0x8776, [0x0ced] = 0x8abf, + [0x0cee] = 0x8adc, [0x0cef] = 0x8d85, [0x0cf0] = 0x8df3, [0x0cf1] = 0x929a, + [0x0cf2] = 0x9577, [0x0cf3] = 0x9802, [0x0cf4] = 0x9ce5, [0x0cf5] = 0x52c5, + [0x0cf6] = 0x6357, [0x0cf7] = 0x76f4, [0x0cf8] = 0x6715, [0x0cf9] = 0x6c88, + [0x0cfa] = 0x73cd, [0x0cfb] = 0x8cc3, [0x0cfc] = 0x93ae, [0x0cfd] = 0x9673, + [0x0cfe] = 0x6d25, [0x0cff] = 0x589c, [0x0d00] = 0x690e, [0x0d01] = 0x69cc, + [0x0d02] = 0x8ffd, [0x0d03] = 0x939a, [0x0d04] = 0x75db, [0x0d05] = 0x901a, + [0x0d06] = 0x585a, [0x0d07] = 0x6802, [0x0d08] = 0x63b4, [0x0d09] = 0x69fb, + [0x0d0a] = 0x4f43, [0x0d0b] = 0x6f2c, [0x0d0c] = 0x67d8, [0x0d0d] = 0x8fbb, + [0x0d0e] = 0x8526, [0x0d0f] = 0x7db4, [0x0d10] = 0x9354, [0x0d11] = 0x693f, + [0x0d12] = 0x6f70, [0x0d13] = 0x576a, [0x0d14] = 0x58f7, [0x0d15] = 0x5b2c, + [0x0d16] = 0x7d2c, [0x0d17] = 0x722a, [0x0d18] = 0x540a, [0x0d19] = 0x91e3, + [0x0d1a] = 0x9db4, [0x0d1b] = 0x4ead, [0x0d1c] = 0x4f4e, [0x0d1d] = 0x505c, + [0x0d1e] = 0x5075, [0x0d1f] = 0x5243, [0x0d20] = 0x8c9e, [0x0d21] = 0x5448, + [0x0d22] = 0x5824, [0x0d23] = 0x5b9a, [0x0d24] = 0x5e1d, [0x0d25] = 0x5e95, + [0x0d26] = 0x5ead, [0x0d27] = 0x5ef7, [0x0d28] = 0x5f1f, [0x0d29] = 0x608c, + [0x0d2a] = 0x62b5, [0x0d2b] = 0x633a, [0x0d2c] = 0x63d0, [0x0d2d] = 0x68af, + [0x0d2e] = 0x6c40, [0x0d2f] = 0x7887, [0x0d30] = 0x798e, [0x0d31] = 0x7a0b, + [0x0d32] = 0x7de0, [0x0d33] = 0x8247, [0x0d34] = 0x8a02, [0x0d35] = 0x8ae6, + [0x0d36] = 0x8e44, [0x0d37] = 0x9013, [0x0d38] = 0x90b8, [0x0d39] = 0x912d, + [0x0d3a] = 0x91d8, [0x0d3b] = 0x9f0e, [0x0d3c] = 0x6ce5, [0x0d3d] = 0x6458, + [0x0d3e] = 0x64e2, [0x0d3f] = 0x6575, [0x0d40] = 0x6ef4, [0x0d41] = 0x7684, + [0x0d42] = 0x7b1b, [0x0d43] = 0x9069, [0x0d44] = 0x93d1, [0x0d45] = 0x6eba, + [0x0d46] = 0x54f2, [0x0d47] = 0x5fb9, [0x0d48] = 0x64a4, [0x0d49] = 0x8f4d, + [0x0d4a] = 0x8fed, [0x0d4b] = 0x9244, [0x0d4c] = 0x5178, [0x0d4d] = 0x586b, + [0x0d4e] = 0x5929, [0x0d4f] = 0x5c55, [0x0d50] = 0x5e97, [0x0d51] = 0x6dfb, + [0x0d52] = 0x7e8f, [0x0d53] = 0x751c, [0x0d54] = 0x8cbc, [0x0d55] = 0x8ee2, + [0x0d56] = 0x985b, [0x0d57] = 0x70b9, [0x0d58] = 0x4f1d, [0x0d59] = 0x6bbf, + [0x0d5a] = 0x6fb1, [0x0d5b] = 0x7530, [0x0d5c] = 0x96fb, [0x0d5d] = 0x514e, + [0x0d5e] = 0x5410, [0x0d5f] = 0x5835, [0x0d60] = 0x5857, [0x0d61] = 0x59ac, + [0x0d62] = 0x5c60, [0x0d63] = 0x5f92, [0x0d64] = 0x6597, [0x0d65] = 0x675c, + [0x0d66] = 0x6e21, [0x0d67] = 0x767b, [0x0d68] = 0x83df, [0x0d69] = 0x8ced, + [0x0d6a] = 0x9014, [0x0d6b] = 0x90fd, [0x0d6c] = 0x934d, [0x0d6d] = 0x7825, + [0x0d6e] = 0x783a, [0x0d6f] = 0x52aa, [0x0d70] = 0x5ea6, [0x0d71] = 0x571f, + [0x0d72] = 0x5974, [0x0d73] = 0x6012, [0x0d74] = 0x5012, [0x0d75] = 0x515a, + [0x0d76] = 0x51ac, [0x0d77] = 0x51cd, [0x0d78] = 0x5200, [0x0d79] = 0x5510, + [0x0d7a] = 0x5854, [0x0d7b] = 0x5858, [0x0d7c] = 0x5957, [0x0d7d] = 0x5b95, + [0x0d7e] = 0x5cf6, [0x0d7f] = 0x5d8b, [0x0d80] = 0x60bc, [0x0d81] = 0x6295, + [0x0d82] = 0x642d, [0x0d83] = 0x6771, [0x0d84] = 0x6843, [0x0d85] = 0x68bc, + [0x0d86] = 0x68df, [0x0d87] = 0x76d7, [0x0d88] = 0x6dd8, [0x0d89] = 0x6e6f, + [0x0d8a] = 0x6d9b, [0x0d8b] = 0x706f, [0x0d8c] = 0x71c8, [0x0d8d] = 0x5f53, + [0x0d8e] = 0x75d8, [0x0d8f] = 0x7977, [0x0d90] = 0x7b49, [0x0d91] = 0x7b54, + [0x0d92] = 0x7b52, [0x0d93] = 0x7cd6, [0x0d94] = 0x7d71, [0x0d95] = 0x5230, + [0x0d96] = 0x8463, [0x0d97] = 0x8569, [0x0d98] = 0x85e4, [0x0d99] = 0x8a0e, + [0x0d9a] = 0x8b04, [0x0d9b] = 0x8c46, [0x0d9c] = 0x8e0f, [0x0d9d] = 0x9003, + [0x0d9e] = 0x900f, [0x0d9f] = 0x9419, [0x0da0] = 0x9676, [0x0da1] = 0x982d, + [0x0da2] = 0x9a30, [0x0da3] = 0x95d8, [0x0da4] = 0x50cd, [0x0da5] = 0x52d5, + [0x0da6] = 0x540c, [0x0da7] = 0x5802, [0x0da8] = 0x5c0e, [0x0da9] = 0x61a7, + [0x0daa] = 0x649e, [0x0dab] = 0x6d1e, [0x0dac] = 0x77b3, [0x0dad] = 0x7ae5, + [0x0dae] = 0x80f4, [0x0daf] = 0x8404, [0x0db0] = 0x9053, [0x0db1] = 0x9285, + [0x0db2] = 0x5ce0, [0x0db3] = 0x9d07, [0x0db4] = 0x533f, [0x0db5] = 0x5f97, + [0x0db6] = 0x5fb3, [0x0db7] = 0x6d9c, [0x0db8] = 0x7279, [0x0db9] = 0x7763, + [0x0dba] = 0x79bf, [0x0dbb] = 0x7be4, [0x0dbc] = 0x6bd2, [0x0dbd] = 0x72ec, + [0x0dbe] = 0x8aad, [0x0dbf] = 0x6803, [0x0dc0] = 0x6a61, [0x0dc1] = 0x51f8, + [0x0dc2] = 0x7a81, [0x0dc3] = 0x6934, [0x0dc4] = 0x5c4a, [0x0dc5] = 0x9cf6, + [0x0dc6] = 0x82eb, [0x0dc7] = 0x5bc5, [0x0dc8] = 0x9149, [0x0dc9] = 0x701e, + [0x0dca] = 0x5678, [0x0dcb] = 0x5c6f, [0x0dcc] = 0x60c7, [0x0dcd] = 0x6566, + [0x0dce] = 0x6c8c, [0x0dcf] = 0x8c5a, [0x0dd0] = 0x9041, [0x0dd1] = 0x9813, + [0x0dd2] = 0x5451, [0x0dd3] = 0x66c7, [0x0dd4] = 0x920d, [0x0dd5] = 0x5948, + [0x0dd6] = 0x90a3, [0x0dd7] = 0x5185, [0x0dd8] = 0x4e4d, [0x0dd9] = 0x51ea, + [0x0dda] = 0x8599, [0x0ddb] = 0x8b0e, [0x0ddc] = 0x7058, [0x0ddd] = 0x637a, + [0x0dde] = 0x934b, [0x0ddf] = 0x6962, [0x0de0] = 0x99b4, [0x0de1] = 0x7e04, + [0x0de2] = 0x7577, [0x0de3] = 0x5357, [0x0de4] = 0x6960, [0x0de5] = 0x8edf, + [0x0de6] = 0x96e3, [0x0de7] = 0x6c5d, [0x0de8] = 0x4e8c, [0x0de9] = 0x5c3c, + [0x0dea] = 0x5f10, [0x0deb] = 0x8fe9, [0x0dec] = 0x5302, [0x0ded] = 0x8cd1, + [0x0dee] = 0x8089, [0x0def] = 0x8679, [0x0df0] = 0x5eff, [0x0df1] = 0x65e5, + [0x0df2] = 0x4e73, [0x0df3] = 0x5165, [0x0df4] = 0x5982, [0x0df5] = 0x5c3f, + [0x0df6] = 0x97ee, [0x0df7] = 0x4efb, [0x0df8] = 0x598a, [0x0df9] = 0x5fcd, + [0x0dfa] = 0x8a8d, [0x0dfb] = 0x6fe1, [0x0dfc] = 0x79b0, [0x0dfd] = 0x7962, + [0x0dfe] = 0x5be7, [0x0dff] = 0x8471, [0x0e00] = 0x732b, [0x0e01] = 0x71b1, + [0x0e02] = 0x5e74, [0x0e03] = 0x5ff5, [0x0e04] = 0x637b, [0x0e05] = 0x649a, + [0x0e06] = 0x71c3, [0x0e07] = 0x7c98, [0x0e08] = 0x4e43, [0x0e09] = 0x5efc, + [0x0e0a] = 0x4e4b, [0x0e0b] = 0x57dc, [0x0e0c] = 0x56a2, [0x0e0d] = 0x60a9, + [0x0e0e] = 0x6fc3, [0x0e0f] = 0x7d0d, [0x0e10] = 0x80fd, [0x0e11] = 0x8133, + [0x0e12] = 0x81bf, [0x0e13] = 0x8fb2, [0x0e14] = 0x8997, [0x0e15] = 0x86a4, + [0x0e16] = 0x5df4, [0x0e17] = 0x628a, [0x0e18] = 0x64ad, [0x0e19] = 0x8987, + [0x0e1a] = 0x6777, [0x0e1b] = 0x6ce2, [0x0e1c] = 0x6d3e, [0x0e1d] = 0x7436, + [0x0e1e] = 0x7834, [0x0e1f] = 0x5a46, [0x0e20] = 0x7f75, [0x0e21] = 0x82ad, + [0x0e22] = 0x99ac, [0x0e23] = 0x4ff3, [0x0e24] = 0x5ec3, [0x0e25] = 0x62dd, + [0x0e26] = 0x6392, [0x0e27] = 0x6557, [0x0e28] = 0x676f, [0x0e29] = 0x76c3, + [0x0e2a] = 0x724c, [0x0e2b] = 0x80cc, [0x0e2c] = 0x80ba, [0x0e2d] = 0x8f29, + [0x0e2e] = 0x914d, [0x0e2f] = 0x500d, [0x0e30] = 0x57f9, [0x0e31] = 0x5a92, + [0x0e32] = 0x6885, [0x0e33] = 0x6973, [0x0e34] = 0x7164, [0x0e35] = 0x72fd, + [0x0e36] = 0x8cb7, [0x0e37] = 0x58f2, [0x0e38] = 0x8ce0, [0x0e39] = 0x966a, + [0x0e3a] = 0x9019, [0x0e3b] = 0x877f, [0x0e3c] = 0x79e4, [0x0e3d] = 0x77e7, + [0x0e3e] = 0x8429, [0x0e3f] = 0x4f2f, [0x0e40] = 0x5265, [0x0e41] = 0x535a, + [0x0e42] = 0x62cd, [0x0e43] = 0x67cf, [0x0e44] = 0x6cca, [0x0e45] = 0x767d, + [0x0e46] = 0x7b94, [0x0e47] = 0x7c95, [0x0e48] = 0x8236, [0x0e49] = 0x8584, + [0x0e4a] = 0x8feb, [0x0e4b] = 0x66dd, [0x0e4c] = 0x6f20, [0x0e4d] = 0x7206, + [0x0e4e] = 0x7e1b, [0x0e4f] = 0x83ab, [0x0e50] = 0x99c1, [0x0e51] = 0x9ea6, + [0x0e52] = 0x51fd, [0x0e53] = 0x7bb1, [0x0e54] = 0x7872, [0x0e55] = 0x7bb8, + [0x0e56] = 0x8087, [0x0e57] = 0x7b48, [0x0e58] = 0x6ae8, [0x0e59] = 0x5e61, + [0x0e5a] = 0x808c, [0x0e5b] = 0x7551, [0x0e5c] = 0x7560, [0x0e5d] = 0x516b, + [0x0e5e] = 0x9262, [0x0e5f] = 0x6e8c, [0x0e60] = 0x767a, [0x0e61] = 0x9197, + [0x0e62] = 0x9aea, [0x0e63] = 0x4f10, [0x0e64] = 0x7f70, [0x0e65] = 0x629c, + [0x0e66] = 0x7b4f, [0x0e67] = 0x95a5, [0x0e68] = 0x9ce9, [0x0e69] = 0x567a, + [0x0e6a] = 0x5859, [0x0e6b] = 0x86e4, [0x0e6c] = 0x96bc, [0x0e6d] = 0x4f34, + [0x0e6e] = 0x5224, [0x0e6f] = 0x534a, [0x0e70] = 0x53cd, [0x0e71] = 0x53db, + [0x0e72] = 0x5e06, [0x0e73] = 0x642c, [0x0e74] = 0x6591, [0x0e75] = 0x677f, + [0x0e76] = 0x6c3e, [0x0e77] = 0x6c4e, [0x0e78] = 0x7248, [0x0e79] = 0x72af, + [0x0e7a] = 0x73ed, [0x0e7b] = 0x7554, [0x0e7c] = 0x7e41, [0x0e7d] = 0x822c, + [0x0e7e] = 0x85e9, [0x0e7f] = 0x8ca9, [0x0e80] = 0x7bc4, [0x0e81] = 0x91c6, + [0x0e82] = 0x7169, [0x0e83] = 0x9812, [0x0e84] = 0x98ef, [0x0e85] = 0x633d, + [0x0e86] = 0x6669, [0x0e87] = 0x756a, [0x0e88] = 0x76e4, [0x0e89] = 0x78d0, + [0x0e8a] = 0x8543, [0x0e8b] = 0x86ee, [0x0e8c] = 0x532a, [0x0e8d] = 0x5351, + [0x0e8e] = 0x5426, [0x0e8f] = 0x5983, [0x0e90] = 0x5e87, [0x0e91] = 0x5f7c, + [0x0e92] = 0x60b2, [0x0e93] = 0x6249, [0x0e94] = 0x6279, [0x0e95] = 0x62ab, + [0x0e96] = 0x6590, [0x0e97] = 0x6bd4, [0x0e98] = 0x6ccc, [0x0e99] = 0x75b2, + [0x0e9a] = 0x76ae, [0x0e9b] = 0x7891, [0x0e9c] = 0x79d8, [0x0e9d] = 0x7dcb, + [0x0e9e] = 0x7f77, [0x0e9f] = 0x80a5, [0x0ea0] = 0x88ab, [0x0ea1] = 0x8ab9, + [0x0ea2] = 0x8cbb, [0x0ea3] = 0x907f, [0x0ea4] = 0x975e, [0x0ea5] = 0x98db, + [0x0ea6] = 0x6a0b, [0x0ea7] = 0x7c38, [0x0ea8] = 0x5099, [0x0ea9] = 0x5c3e, + [0x0eaa] = 0x5fae, [0x0eab] = 0x6787, [0x0eac] = 0x6bd8, [0x0ead] = 0x7435, + [0x0eae] = 0x7709, [0x0eaf] = 0x7f8e, [0x0eb0] = 0x9f3b, [0x0eb1] = 0x67ca, + [0x0eb2] = 0x7a17, [0x0eb3] = 0x5339, [0x0eb4] = 0x758b, [0x0eb5] = 0x9aed, + [0x0eb6] = 0x5f66, [0x0eb7] = 0x819d, [0x0eb8] = 0x83f1, [0x0eb9] = 0x8098, + [0x0eba] = 0x5f3c, [0x0ebb] = 0x5fc5, [0x0ebc] = 0x7562, [0x0ebd] = 0x7b46, + [0x0ebe] = 0x903c, [0x0ebf] = 0x6867, [0x0ec0] = 0x59eb, [0x0ec1] = 0x5a9b, + [0x0ec2] = 0x7d10, [0x0ec3] = 0x767e, [0x0ec4] = 0x8b2c, [0x0ec5] = 0x4ff5, + [0x0ec6] = 0x5f6a, [0x0ec7] = 0x6a19, [0x0ec8] = 0x6c37, [0x0ec9] = 0x6f02, + [0x0eca] = 0x74e2, [0x0ecb] = 0x7968, [0x0ecc] = 0x8868, [0x0ecd] = 0x8a55, + [0x0ece] = 0x8c79, [0x0ecf] = 0x5edf, [0x0ed0] = 0x63cf, [0x0ed1] = 0x75c5, + [0x0ed2] = 0x79d2, [0x0ed3] = 0x82d7, [0x0ed4] = 0x9328, [0x0ed5] = 0x92f2, + [0x0ed6] = 0x849c, [0x0ed7] = 0x86ed, [0x0ed8] = 0x9c2d, [0x0ed9] = 0x54c1, + [0x0eda] = 0x5f6c, [0x0edb] = 0x658c, [0x0edc] = 0x6d5c, [0x0edd] = 0x7015, + [0x0ede] = 0x8ca7, [0x0edf] = 0x8cd3, [0x0ee0] = 0x983b, [0x0ee1] = 0x654f, + [0x0ee2] = 0x74f6, [0x0ee3] = 0x4e0d, [0x0ee4] = 0x4ed8, [0x0ee5] = 0x57e0, + [0x0ee6] = 0x592b, [0x0ee7] = 0x5a66, [0x0ee8] = 0x5bcc, [0x0ee9] = 0x51a8, + [0x0eea] = 0x5e03, [0x0eeb] = 0x5e9c, [0x0eec] = 0x6016, [0x0eed] = 0x6276, + [0x0eee] = 0x6577, [0x0eef] = 0x65a7, [0x0ef0] = 0x666e, [0x0ef1] = 0x6d6e, + [0x0ef2] = 0x7236, [0x0ef3] = 0x7b26, [0x0ef4] = 0x8150, [0x0ef5] = 0x819a, + [0x0ef6] = 0x8299, [0x0ef7] = 0x8b5c, [0x0ef8] = 0x8ca0, [0x0ef9] = 0x8ce6, + [0x0efa] = 0x8d74, [0x0efb] = 0x961c, [0x0efc] = 0x9644, [0x0efd] = 0x4fae, + [0x0efe] = 0x64ab, [0x0eff] = 0x6b66, [0x0f00] = 0x821e, [0x0f01] = 0x8461, + [0x0f02] = 0x856a, [0x0f03] = 0x90e8, [0x0f04] = 0x5c01, [0x0f05] = 0x6953, + [0x0f06] = 0x98a8, [0x0f07] = 0x847a, [0x0f08] = 0x8557, [0x0f09] = 0x4f0f, + [0x0f0a] = 0x526f, [0x0f0b] = 0x5fa9, [0x0f0c] = 0x5e45, [0x0f0d] = 0x670d, + [0x0f0e] = 0x798f, [0x0f0f] = 0x8179, [0x0f10] = 0x8907, [0x0f11] = 0x8986, + [0x0f12] = 0x6df5, [0x0f13] = 0x5f17, [0x0f14] = 0x6255, [0x0f15] = 0x6cb8, + [0x0f16] = 0x4ecf, [0x0f17] = 0x7269, [0x0f18] = 0x9b92, [0x0f19] = 0x5206, + [0x0f1a] = 0x543b, [0x0f1b] = 0x5674, [0x0f1c] = 0x58b3, [0x0f1d] = 0x61a4, + [0x0f1e] = 0x626e, [0x0f1f] = 0x711a, [0x0f20] = 0x596e, [0x0f21] = 0x7c89, + [0x0f22] = 0x7cde, [0x0f23] = 0x7d1b, [0x0f24] = 0x96f0, [0x0f25] = 0x6587, + [0x0f26] = 0x805e, [0x0f27] = 0x4e19, [0x0f28] = 0x4f75, [0x0f29] = 0x5175, + [0x0f2a] = 0x5840, [0x0f2b] = 0x5e63, [0x0f2c] = 0x5e73, [0x0f2d] = 0x5f0a, + [0x0f2e] = 0x67c4, [0x0f2f] = 0x4e26, [0x0f30] = 0x853d, [0x0f31] = 0x9589, + [0x0f32] = 0x965b, [0x0f33] = 0x7c73, [0x0f34] = 0x9801, [0x0f35] = 0x50fb, + [0x0f36] = 0x58c1, [0x0f37] = 0x7656, [0x0f38] = 0x78a7, [0x0f39] = 0x5225, + [0x0f3a] = 0x77a5, [0x0f3b] = 0x8511, [0x0f3c] = 0x7b86, [0x0f3d] = 0x504f, + [0x0f3e] = 0x5909, [0x0f3f] = 0x7247, [0x0f40] = 0x7bc7, [0x0f41] = 0x7de8, + [0x0f42] = 0x8fba, [0x0f43] = 0x8fd4, [0x0f44] = 0x904d, [0x0f45] = 0x4fbf, + [0x0f46] = 0x52c9, [0x0f47] = 0x5a29, [0x0f48] = 0x5f01, [0x0f49] = 0x97ad, + [0x0f4a] = 0x4fdd, [0x0f4b] = 0x8217, [0x0f4c] = 0x92ea, [0x0f4d] = 0x5703, + [0x0f4e] = 0x6355, [0x0f4f] = 0x6b69, [0x0f50] = 0x752b, [0x0f51] = 0x88dc, + [0x0f52] = 0x8f14, [0x0f53] = 0x7a42, [0x0f54] = 0x52df, [0x0f55] = 0x5893, + [0x0f56] = 0x6155, [0x0f57] = 0x620a, [0x0f58] = 0x66ae, [0x0f59] = 0x6bcd, + [0x0f5a] = 0x7c3f, [0x0f5b] = 0x83e9, [0x0f5c] = 0x5023, [0x0f5d] = 0x4ff8, + [0x0f5e] = 0x5305, [0x0f5f] = 0x5446, [0x0f60] = 0x5831, [0x0f61] = 0x5949, + [0x0f62] = 0x5b9d, [0x0f63] = 0x5cf0, [0x0f64] = 0x5cef, [0x0f65] = 0x5d29, + [0x0f66] = 0x5e96, [0x0f67] = 0x62b1, [0x0f68] = 0x6367, [0x0f69] = 0x653e, + [0x0f6a] = 0x65b9, [0x0f6b] = 0x670b, [0x0f6c] = 0x6cd5, [0x0f6d] = 0x6ce1, + [0x0f6e] = 0x70f9, [0x0f6f] = 0x7832, [0x0f70] = 0x7e2b, [0x0f71] = 0x80de, + [0x0f72] = 0x82b3, [0x0f73] = 0x840c, [0x0f74] = 0x84ec, [0x0f75] = 0x8702, + [0x0f76] = 0x8912, [0x0f77] = 0x8a2a, [0x0f78] = 0x8c4a, [0x0f79] = 0x90a6, + [0x0f7a] = 0x92d2, [0x0f7b] = 0x98fd, [0x0f7c] = 0x9cf3, [0x0f7d] = 0x9d6c, + [0x0f7e] = 0x4e4f, [0x0f7f] = 0x4ea1, [0x0f80] = 0x508d, [0x0f81] = 0x5256, + [0x0f82] = 0x574a, [0x0f83] = 0x59a8, [0x0f84] = 0x5e3d, [0x0f85] = 0x5fd8, + [0x0f86] = 0x5fd9, [0x0f87] = 0x623f, [0x0f88] = 0x66b4, [0x0f89] = 0x671b, + [0x0f8a] = 0x67d0, [0x0f8b] = 0x68d2, [0x0f8c] = 0x5192, [0x0f8d] = 0x7d21, + [0x0f8e] = 0x80aa, [0x0f8f] = 0x81a8, [0x0f90] = 0x8b00, [0x0f91] = 0x8c8c, + [0x0f92] = 0x8cbf, [0x0f93] = 0x927e, [0x0f94] = 0x9632, [0x0f95] = 0x5420, + [0x0f96] = 0x982c, [0x0f97] = 0x5317, [0x0f98] = 0x50d5, [0x0f99] = 0x535c, + [0x0f9a] = 0x58a8, [0x0f9b] = 0x64b2, [0x0f9c] = 0x6734, [0x0f9d] = 0x7267, + [0x0f9e] = 0x7766, [0x0f9f] = 0x7a46, [0x0fa0] = 0x91e6, [0x0fa1] = 0x52c3, + [0x0fa2] = 0x6ca1, [0x0fa3] = 0x6b86, [0x0fa4] = 0x5800, [0x0fa5] = 0x5e4c, + [0x0fa6] = 0x5954, [0x0fa7] = 0x672c, [0x0fa8] = 0x7ffb, [0x0fa9] = 0x51e1, + [0x0faa] = 0x76c6, [0x0fab] = 0x6469, [0x0fac] = 0x78e8, [0x0fad] = 0x9b54, + [0x0fae] = 0x9ebb, [0x0faf] = 0x57cb, [0x0fb0] = 0x59b9, [0x0fb1] = 0x6627, + [0x0fb2] = 0x679a, [0x0fb3] = 0x6bce, [0x0fb4] = 0x54e9, [0x0fb5] = 0x69d9, + [0x0fb6] = 0x5e55, [0x0fb7] = 0x819c, [0x0fb8] = 0x6795, [0x0fb9] = 0x9baa, + [0x0fba] = 0x67fe, [0x0fbb] = 0x9c52, [0x0fbc] = 0x685d, [0x0fbd] = 0x4ea6, + [0x0fbe] = 0x4fe3, [0x0fbf] = 0x53c8, [0x0fc0] = 0x62b9, [0x0fc1] = 0x672b, + [0x0fc2] = 0x6cab, [0x0fc3] = 0x8fc4, [0x0fc4] = 0x4fad, [0x0fc5] = 0x7e6d, + [0x0fc6] = 0x9ebf, [0x0fc7] = 0x4e07, [0x0fc8] = 0x6162, [0x0fc9] = 0x6e80, + [0x0fca] = 0x6f2b, [0x0fcb] = 0x8513, [0x0fcc] = 0x5473, [0x0fcd] = 0x672a, + [0x0fce] = 0x9b45, [0x0fcf] = 0x5df3, [0x0fd0] = 0x7b95, [0x0fd1] = 0x5cac, + [0x0fd2] = 0x5bc6, [0x0fd3] = 0x871c, [0x0fd4] = 0x6e4a, [0x0fd5] = 0x84d1, + [0x0fd6] = 0x7a14, [0x0fd7] = 0x8108, [0x0fd8] = 0x5999, [0x0fd9] = 0x7c8d, + [0x0fda] = 0x6c11, [0x0fdb] = 0x7720, [0x0fdc] = 0x52d9, [0x0fdd] = 0x5922, + [0x0fde] = 0x7121, [0x0fdf] = 0x725f, [0x0fe0] = 0x77db, [0x0fe1] = 0x9727, + [0x0fe2] = 0x9d61, [0x0fe3] = 0x690b, [0x0fe4] = 0x5a7f, [0x0fe5] = 0x5a18, + [0x0fe6] = 0x51a5, [0x0fe7] = 0x540d, [0x0fe8] = 0x547d, [0x0fe9] = 0x660e, + [0x0fea] = 0x76df, [0x0feb] = 0x8ff7, [0x0fec] = 0x9298, [0x0fed] = 0x9cf4, + [0x0fee] = 0x59ea, [0x0fef] = 0x725d, [0x0ff0] = 0x6ec5, [0x0ff1] = 0x514d, + [0x0ff2] = 0x68c9, [0x0ff3] = 0x7dbf, [0x0ff4] = 0x7dec, [0x0ff5] = 0x9762, + [0x0ff6] = 0x9eba, [0x0ff7] = 0x6478, [0x0ff8] = 0x6a21, [0x0ff9] = 0x8302, + [0x0ffa] = 0x5984, [0x0ffb] = 0x5b5f, [0x0ffc] = 0x6bdb, [0x0ffd] = 0x731b, + [0x0ffe] = 0x76f2, [0x0fff] = 0x7db2, [0x1000] = 0x8017, [0x1001] = 0x8499, + [0x1002] = 0x5132, [0x1003] = 0x6728, [0x1004] = 0x9ed9, [0x1005] = 0x76ee, + [0x1006] = 0x6762, [0x1007] = 0x52ff, [0x1008] = 0x9905, [0x1009] = 0x5c24, + [0x100a] = 0x623b, [0x100b] = 0x7c7e, [0x100c] = 0x8cb0, [0x100d] = 0x554f, + [0x100e] = 0x60b6, [0x100f] = 0x7d0b, [0x1010] = 0x9580, [0x1011] = 0x5301, + [0x1012] = 0x4e5f, [0x1013] = 0x51b6, [0x1014] = 0x591c, [0x1015] = 0x723a, + [0x1016] = 0x8036, [0x1017] = 0x91ce, [0x1018] = 0x5f25, [0x1019] = 0x77e2, + [0x101a] = 0x5384, [0x101b] = 0x5f79, [0x101c] = 0x7d04, [0x101d] = 0x85ac, + [0x101e] = 0x8a33, [0x101f] = 0x8e8d, [0x1020] = 0x9756, [0x1021] = 0x67f3, + [0x1022] = 0x85ae, [0x1023] = 0x9453, [0x1024] = 0x6109, [0x1025] = 0x6108, + [0x1026] = 0x6cb9, [0x1027] = 0x7652, [0x1028] = 0x8aed, [0x1029] = 0x8f38, + [0x102a] = 0x552f, [0x102b] = 0x4f51, [0x102c] = 0x512a, [0x102d] = 0x52c7, + [0x102e] = 0x53cb, [0x102f] = 0x5ba5, [0x1030] = 0x5e7d, [0x1031] = 0x60a0, + [0x1032] = 0x6182, [0x1033] = 0x63d6, [0x1034] = 0x6709, [0x1035] = 0x67da, + [0x1036] = 0x6e67, [0x1037] = 0x6d8c, [0x1038] = 0x7336, [0x1039] = 0x7337, + [0x103a] = 0x7531, [0x103b] = 0x7950, [0x103c] = 0x88d5, [0x103d] = 0x8a98, + [0x103e] = 0x904a, [0x103f] = 0x9091, [0x1040] = 0x90f5, [0x1041] = 0x96c4, + [0x1042] = 0x878d, [0x1043] = 0x5915, [0x1044] = 0x4e88, [0x1045] = 0x4f59, + [0x1046] = 0x4e0e, [0x1047] = 0x8a89, [0x1048] = 0x8f3f, [0x1049] = 0x9810, + [0x104a] = 0x50ad, [0x104b] = 0x5e7c, [0x104c] = 0x5996, [0x104d] = 0x5bb9, + [0x104e] = 0x5eb8, [0x104f] = 0x63da, [0x1050] = 0x63fa, [0x1051] = 0x64c1, + [0x1052] = 0x66dc, [0x1053] = 0x694a, [0x1054] = 0x69d8, [0x1055] = 0x6d0b, + [0x1056] = 0x6eb6, [0x1057] = 0x7194, [0x1058] = 0x7528, [0x1059] = 0x7aaf, + [0x105a] = 0x7f8a, [0x105b] = 0x8000, [0x105c] = 0x8449, [0x105d] = 0x84c9, + [0x105e] = 0x8981, [0x105f] = 0x8b21, [0x1060] = 0x8e0a, [0x1061] = 0x9065, + [0x1062] = 0x967d, [0x1063] = 0x990a, [0x1064] = 0x617e, [0x1065] = 0x6291, + [0x1066] = 0x6b32, [0x1067] = 0x6c83, [0x1068] = 0x6d74, [0x1069] = 0x7fcc, + [0x106a] = 0x7ffc, [0x106b] = 0x6dc0, [0x106c] = 0x7f85, [0x106d] = 0x87ba, + [0x106e] = 0x88f8, [0x106f] = 0x6765, [0x1070] = 0x83b1, [0x1071] = 0x983c, + [0x1072] = 0x96f7, [0x1073] = 0x6d1b, [0x1074] = 0x7d61, [0x1075] = 0x843d, + [0x1076] = 0x916a, [0x1077] = 0x4e71, [0x1078] = 0x5375, [0x1079] = 0x5d50, + [0x107a] = 0x6b04, [0x107b] = 0x6feb, [0x107c] = 0x85cd, [0x107d] = 0x862d, + [0x107e] = 0x89a7, [0x107f] = 0x5229, [0x1080] = 0x540f, [0x1081] = 0x5c65, + [0x1082] = 0x674e, [0x1083] = 0x68a8, [0x1084] = 0x7406, [0x1085] = 0x7483, + [0x1086] = 0x75e2, [0x1087] = 0x88cf, [0x1088] = 0x88e1, [0x1089] = 0x91cc, + [0x108a] = 0x96e2, [0x108b] = 0x9678, [0x108c] = 0x5f8b, [0x108d] = 0x7387, + [0x108e] = 0x7acb, [0x108f] = 0x844e, [0x1090] = 0x63a0, [0x1091] = 0x7565, + [0x1092] = 0x5289, [0x1093] = 0x6d41, [0x1094] = 0x6e9c, [0x1095] = 0x7409, + [0x1096] = 0x7559, [0x1097] = 0x786b, [0x1098] = 0x7c92, [0x1099] = 0x9686, + [0x109a] = 0x7adc, [0x109b] = 0x9f8d, [0x109c] = 0x4fb6, [0x109d] = 0x616e, + [0x109e] = 0x65c5, [0x109f] = 0x865c, [0x10a0] = 0x4e86, [0x10a1] = 0x4eae, + [0x10a2] = 0x50da, [0x10a3] = 0x4e21, [0x10a4] = 0x51cc, [0x10a5] = 0x5bee, + [0x10a6] = 0x6599, [0x10a7] = 0x6881, [0x10a8] = 0x6dbc, [0x10a9] = 0x731f, + [0x10aa] = 0x7642, [0x10ab] = 0x77ad, [0x10ac] = 0x7a1c, [0x10ad] = 0x7ce7, + [0x10ae] = 0x826f, [0x10af] = 0x8ad2, [0x10b0] = 0x907c, [0x10b1] = 0x91cf, + [0x10b2] = 0x9675, [0x10b3] = 0x9818, [0x10b4] = 0x529b, [0x10b5] = 0x7dd1, + [0x10b6] = 0x502b, [0x10b7] = 0x5398, [0x10b8] = 0x6797, [0x10b9] = 0x6dcb, + [0x10ba] = 0x71d0, [0x10bb] = 0x7433, [0x10bc] = 0x81e8, [0x10bd] = 0x8f2a, + [0x10be] = 0x96a3, [0x10bf] = 0x9c57, [0x10c0] = 0x9e9f, [0x10c1] = 0x7460, + [0x10c2] = 0x5841, [0x10c3] = 0x6d99, [0x10c4] = 0x7d2f, [0x10c5] = 0x985e, + [0x10c6] = 0x4ee4, [0x10c7] = 0x4f36, [0x10c8] = 0x4f8b, [0x10c9] = 0x51b7, + [0x10ca] = 0x52b1, [0x10cb] = 0x5dba, [0x10cc] = 0x601c, [0x10cd] = 0x73b2, + [0x10ce] = 0x793c, [0x10cf] = 0x82d3, [0x10d0] = 0x9234, [0x10d1] = 0x96b7, + [0x10d2] = 0x96f6, [0x10d3] = 0x970a, [0x10d4] = 0x9e97, [0x10d5] = 0x9f62, + [0x10d6] = 0x66a6, [0x10d7] = 0x6b74, [0x10d8] = 0x5217, [0x10d9] = 0x52a3, + [0x10da] = 0x70c8, [0x10db] = 0x88c2, [0x10dc] = 0x5ec9, [0x10dd] = 0x604b, + [0x10de] = 0x6190, [0x10df] = 0x6f23, [0x10e0] = 0x7149, [0x10e1] = 0x7c3e, + [0x10e2] = 0x7df4, [0x10e3] = 0x806f, [0x10e4] = 0x84ee, [0x10e5] = 0x9023, + [0x10e6] = 0x932c, [0x10e7] = 0x5442, [0x10e8] = 0x9b6f, [0x10e9] = 0x6ad3, + [0x10ea] = 0x7089, [0x10eb] = 0x8cc2, [0x10ec] = 0x8def, [0x10ed] = 0x9732, + [0x10ee] = 0x52b4, [0x10ef] = 0x5a41, [0x10f0] = 0x5eca, [0x10f1] = 0x5f04, + [0x10f2] = 0x6717, [0x10f3] = 0x697c, [0x10f4] = 0x6994, [0x10f5] = 0x6d6a, + [0x10f6] = 0x6f0f, [0x10f7] = 0x7262, [0x10f8] = 0x72fc, [0x10f9] = 0x7bed, + [0x10fa] = 0x8001, [0x10fb] = 0x807e, [0x10fc] = 0x874b, [0x10fd] = 0x90ce, + [0x10fe] = 0x516d, [0x10ff] = 0x9e93, [0x1100] = 0x7984, [0x1101] = 0x808b, + [0x1102] = 0x9332, [0x1103] = 0x8ad6, [0x1104] = 0x502d, [0x1105] = 0x548c, + [0x1106] = 0x8a71, [0x1107] = 0x6b6a, [0x1108] = 0x8cc4, [0x1109] = 0x8107, + [0x110a] = 0x60d1, [0x110b] = 0x67a0, [0x110c] = 0x9df2, [0x110d] = 0x4e99, + [0x110e] = 0x4e98, [0x110f] = 0x9c10, [0x1110] = 0x8a6b, [0x1111] = 0x85c1, + [0x1112] = 0x8568, [0x1113] = 0x6900, [0x1114] = 0x6e7e, [0x1115] = 0x7897, + [0x1116] = 0x8155, [0x1142] = 0x5f0c, [0x1143] = 0x4e10, [0x1144] = 0x4e15, + [0x1145] = 0x4e2a, [0x1146] = 0x4e31, [0x1147] = 0x4e36, [0x1148] = 0x4e3c, + [0x1149] = 0x4e3f, [0x114a] = 0x4e42, [0x114b] = 0x4e56, [0x114c] = 0x4e58, + [0x114d] = 0x4e82, [0x114e] = 0x4e85, [0x114f] = 0x8c6b, [0x1150] = 0x4e8a, + [0x1151] = 0x8212, [0x1152] = 0x5f0d, [0x1153] = 0x4e8e, [0x1154] = 0x4e9e, + [0x1155] = 0x4e9f, [0x1156] = 0x4ea0, [0x1157] = 0x4ea2, [0x1158] = 0x4eb0, + [0x1159] = 0x4eb3, [0x115a] = 0x4eb6, [0x115b] = 0x4ece, [0x115c] = 0x4ecd, + [0x115d] = 0x4ec4, [0x115e] = 0x4ec6, [0x115f] = 0x4ec2, [0x1160] = 0x4ed7, + [0x1161] = 0x4ede, [0x1162] = 0x4eed, [0x1163] = 0x4edf, [0x1164] = 0x4ef7, + [0x1165] = 0x4f09, [0x1166] = 0x4f5a, [0x1167] = 0x4f30, [0x1168] = 0x4f5b, + [0x1169] = 0x4f5d, [0x116a] = 0x4f57, [0x116b] = 0x4f47, [0x116c] = 0x4f76, + [0x116d] = 0x4f88, [0x116e] = 0x4f8f, [0x116f] = 0x4f98, [0x1170] = 0x4f7b, + [0x1171] = 0x4f69, [0x1172] = 0x4f70, [0x1173] = 0x4f91, [0x1174] = 0x4f6f, + [0x1175] = 0x4f86, [0x1176] = 0x4f96, [0x1177] = 0x5118, [0x1178] = 0x4fd4, + [0x1179] = 0x4fdf, [0x117a] = 0x4fce, [0x117b] = 0x4fd8, [0x117c] = 0x4fdb, + [0x117d] = 0x4fd1, [0x117e] = 0x4fda, [0x117f] = 0x4fd0, [0x1180] = 0x4fe4, + [0x1181] = 0x4fe5, [0x1182] = 0x501a, [0x1183] = 0x5028, [0x1184] = 0x5014, + [0x1185] = 0x502a, [0x1186] = 0x5025, [0x1187] = 0x5005, [0x1188] = 0x4f1c, + [0x1189] = 0x4ff6, [0x118a] = 0x5021, [0x118b] = 0x5029, [0x118c] = 0x502c, + [0x118d] = 0x4ffe, [0x118e] = 0x4fef, [0x118f] = 0x5011, [0x1190] = 0x5006, + [0x1191] = 0x5043, [0x1192] = 0x5047, [0x1193] = 0x6703, [0x1194] = 0x5055, + [0x1195] = 0x5050, [0x1196] = 0x5048, [0x1197] = 0x505a, [0x1198] = 0x5056, + [0x1199] = 0x506c, [0x119a] = 0x5078, [0x119b] = 0x5080, [0x119c] = 0x509a, + [0x119d] = 0x5085, [0x119e] = 0x50b4, [0x119f] = 0x50b2, [0x11a0] = 0x50c9, + [0x11a1] = 0x50ca, [0x11a2] = 0x50b3, [0x11a3] = 0x50c2, [0x11a4] = 0x50d6, + [0x11a5] = 0x50de, [0x11a6] = 0x50e5, [0x11a7] = 0x50ed, [0x11a8] = 0x50e3, + [0x11a9] = 0x50ee, [0x11aa] = 0x50f9, [0x11ab] = 0x50f5, [0x11ac] = 0x5109, + [0x11ad] = 0x5101, [0x11ae] = 0x5102, [0x11af] = 0x5116, [0x11b0] = 0x5115, + [0x11b1] = 0x5114, [0x11b2] = 0x511a, [0x11b3] = 0x5121, [0x11b4] = 0x513a, + [0x11b5] = 0x5137, [0x11b6] = 0x513c, [0x11b7] = 0x513b, [0x11b8] = 0x513f, + [0x11b9] = 0x5140, [0x11ba] = 0x5152, [0x11bb] = 0x514c, [0x11bc] = 0x5154, + [0x11bd] = 0x5162, [0x11be] = 0x7af8, [0x11bf] = 0x5169, [0x11c0] = 0x516a, + [0x11c1] = 0x516e, [0x11c2] = 0x5180, [0x11c3] = 0x5182, [0x11c4] = 0x56d8, + [0x11c5] = 0x518c, [0x11c6] = 0x5189, [0x11c7] = 0x518f, [0x11c8] = 0x5191, + [0x11c9] = 0x5193, [0x11ca] = 0x5195, [0x11cb] = 0x5196, [0x11cc] = 0x51a4, + [0x11cd] = 0x51a6, [0x11ce] = 0x51a2, [0x11cf] = 0x51a9, [0x11d0] = 0x51aa, + [0x11d1] = 0x51ab, [0x11d2] = 0x51b3, [0x11d3] = 0x51b1, [0x11d4] = 0x51b2, + [0x11d5] = 0x51b0, [0x11d6] = 0x51b5, [0x11d7] = 0x51bd, [0x11d8] = 0x51c5, + [0x11d9] = 0x51c9, [0x11da] = 0x51db, [0x11db] = 0x51e0, [0x11dc] = 0x8655, + [0x11dd] = 0x51e9, [0x11de] = 0x51ed, [0x11df] = 0x51f0, [0x11e0] = 0x51f5, + [0x11e1] = 0x51fe, [0x11e2] = 0x5204, [0x11e3] = 0x520b, [0x11e4] = 0x5214, + [0x11e5] = 0x520e, [0x11e6] = 0x5227, [0x11e7] = 0x522a, [0x11e8] = 0x522e, + [0x11e9] = 0x5233, [0x11ea] = 0x5239, [0x11eb] = 0x524f, [0x11ec] = 0x5244, + [0x11ed] = 0x524b, [0x11ee] = 0x524c, [0x11ef] = 0x525e, [0x11f0] = 0x5254, + [0x11f1] = 0x526a, [0x11f2] = 0x5274, [0x11f3] = 0x5269, [0x11f4] = 0x5273, + [0x11f5] = 0x527f, [0x11f6] = 0x527d, [0x11f7] = 0x528d, [0x11f8] = 0x5294, + [0x11f9] = 0x5292, [0x11fa] = 0x5271, [0x11fb] = 0x5288, [0x11fc] = 0x5291, + [0x11fd] = 0x8fa8, [0x11fe] = 0x8fa7, [0x11ff] = 0x52ac, [0x1200] = 0x52ad, + [0x1201] = 0x52bc, [0x1202] = 0x52b5, [0x1203] = 0x52c1, [0x1204] = 0x52cd, + [0x1205] = 0x52d7, [0x1206] = 0x52de, [0x1207] = 0x52e3, [0x1208] = 0x52e6, + [0x1209] = 0x98ed, [0x120a] = 0x52e0, [0x120b] = 0x52f3, [0x120c] = 0x52f5, + [0x120d] = 0x52f8, [0x120e] = 0x52f9, [0x120f] = 0x5306, [0x1210] = 0x5308, + [0x1211] = 0x7538, [0x1212] = 0x530d, [0x1213] = 0x5310, [0x1214] = 0x530f, + [0x1215] = 0x5315, [0x1216] = 0x531a, [0x1217] = 0x5323, [0x1218] = 0x532f, + [0x1219] = 0x5331, [0x121a] = 0x5333, [0x121b] = 0x5338, [0x121c] = 0x5340, + [0x121d] = 0x5346, [0x121e] = 0x5345, [0x121f] = 0x4e17, [0x1220] = 0x5349, + [0x1221] = 0x534d, [0x1222] = 0x51d6, [0x1223] = 0x535e, [0x1224] = 0x5369, + [0x1225] = 0x536e, [0x1226] = 0x5918, [0x1227] = 0x537b, [0x1228] = 0x5377, + [0x1229] = 0x5382, [0x122a] = 0x5396, [0x122b] = 0x53a0, [0x122c] = 0x53a6, + [0x122d] = 0x53a5, [0x122e] = 0x53ae, [0x122f] = 0x53b0, [0x1230] = 0x53b6, + [0x1231] = 0x53c3, [0x1232] = 0x7c12, [0x1233] = 0x96d9, [0x1234] = 0x53df, + [0x1235] = 0x66fc, [0x1236] = 0x71ee, [0x1237] = 0x53ee, [0x1238] = 0x53e8, + [0x1239] = 0x53ed, [0x123a] = 0x53fa, [0x123b] = 0x5401, [0x123c] = 0x543d, + [0x123d] = 0x5440, [0x123e] = 0x542c, [0x123f] = 0x542d, [0x1240] = 0x543c, + [0x1241] = 0x542e, [0x1242] = 0x5436, [0x1243] = 0x5429, [0x1244] = 0x541d, + [0x1245] = 0x544e, [0x1246] = 0x548f, [0x1247] = 0x5475, [0x1248] = 0x548e, + [0x1249] = 0x545f, [0x124a] = 0x5471, [0x124b] = 0x5477, [0x124c] = 0x5470, + [0x124d] = 0x5492, [0x124e] = 0x547b, [0x124f] = 0x5480, [0x1250] = 0x5476, + [0x1251] = 0x5484, [0x1252] = 0x5490, [0x1253] = 0x5486, [0x1254] = 0x54c7, + [0x1255] = 0x54a2, [0x1256] = 0x54b8, [0x1257] = 0x54a5, [0x1258] = 0x54ac, + [0x1259] = 0x54c4, [0x125a] = 0x54c8, [0x125b] = 0x54a8, [0x125c] = 0x54ab, + [0x125d] = 0x54c2, [0x125e] = 0x54a4, [0x125f] = 0x54be, [0x1260] = 0x54bc, + [0x1261] = 0x54d8, [0x1262] = 0x54e5, [0x1263] = 0x54e6, [0x1264] = 0x550f, + [0x1265] = 0x5514, [0x1266] = 0x54fd, [0x1267] = 0x54ee, [0x1268] = 0x54ed, + [0x1269] = 0x54fa, [0x126a] = 0x54e2, [0x126b] = 0x5539, [0x126c] = 0x5540, + [0x126d] = 0x5563, [0x126e] = 0x554c, [0x126f] = 0x552e, [0x1270] = 0x555c, + [0x1271] = 0x5545, [0x1272] = 0x5556, [0x1273] = 0x5557, [0x1274] = 0x5538, + [0x1275] = 0x5533, [0x1276] = 0x555d, [0x1277] = 0x5599, [0x1278] = 0x5580, + [0x1279] = 0x54af, [0x127a] = 0x558a, [0x127b] = 0x559f, [0x127c] = 0x557b, + [0x127d] = 0x557e, [0x127e] = 0x5598, [0x127f] = 0x559e, [0x1280] = 0x55ae, + [0x1281] = 0x557c, [0x1282] = 0x5583, [0x1283] = 0x55a9, [0x1284] = 0x5587, + [0x1285] = 0x55a8, [0x1286] = 0x55da, [0x1287] = 0x55c5, [0x1288] = 0x55df, + [0x1289] = 0x55c4, [0x128a] = 0x55dc, [0x128b] = 0x55e4, [0x128c] = 0x55d4, + [0x128d] = 0x5614, [0x128e] = 0x55f7, [0x128f] = 0x5616, [0x1290] = 0x55fe, + [0x1291] = 0x55fd, [0x1292] = 0x561b, [0x1293] = 0x55f9, [0x1294] = 0x564e, + [0x1295] = 0x5650, [0x1296] = 0x71df, [0x1297] = 0x5634, [0x1298] = 0x5636, + [0x1299] = 0x5632, [0x129a] = 0x5638, [0x129b] = 0x566b, [0x129c] = 0x5664, + [0x129d] = 0x562f, [0x129e] = 0x566c, [0x129f] = 0x566a, [0x12a0] = 0x5686, + [0x12a1] = 0x5680, [0x12a2] = 0x568a, [0x12a3] = 0x56a0, [0x12a4] = 0x5694, + [0x12a5] = 0x568f, [0x12a6] = 0x56a5, [0x12a7] = 0x56ae, [0x12a8] = 0x56b6, + [0x12a9] = 0x56b4, [0x12aa] = 0x56c2, [0x12ab] = 0x56bc, [0x12ac] = 0x56c1, + [0x12ad] = 0x56c3, [0x12ae] = 0x56c0, [0x12af] = 0x56c8, [0x12b0] = 0x56ce, + [0x12b1] = 0x56d1, [0x12b2] = 0x56d3, [0x12b3] = 0x56d7, [0x12b4] = 0x56ee, + [0x12b5] = 0x56f9, [0x12b6] = 0x5700, [0x12b7] = 0x56ff, [0x12b8] = 0x5704, + [0x12b9] = 0x5709, [0x12ba] = 0x5708, [0x12bb] = 0x570b, [0x12bc] = 0x570d, + [0x12bd] = 0x5713, [0x12be] = 0x5718, [0x12bf] = 0x5716, [0x12c0] = 0x55c7, + [0x12c1] = 0x571c, [0x12c2] = 0x5726, [0x12c3] = 0x5737, [0x12c4] = 0x5738, + [0x12c5] = 0x574e, [0x12c6] = 0x573b, [0x12c7] = 0x5740, [0x12c8] = 0x574f, + [0x12c9] = 0x5769, [0x12ca] = 0x57c0, [0x12cb] = 0x5788, [0x12cc] = 0x5761, + [0x12cd] = 0x577f, [0x12ce] = 0x5789, [0x12cf] = 0x5793, [0x12d0] = 0x57a0, + [0x12d1] = 0x57b3, [0x12d2] = 0x57a4, [0x12d3] = 0x57aa, [0x12d4] = 0x57b0, + [0x12d5] = 0x57c3, [0x12d6] = 0x57c6, [0x12d7] = 0x57d4, [0x12d8] = 0x57d2, + [0x12d9] = 0x57d3, [0x12da] = 0x580a, [0x12db] = 0x57d6, [0x12dc] = 0x57e3, + [0x12dd] = 0x580b, [0x12de] = 0x5819, [0x12df] = 0x581d, [0x12e0] = 0x5872, + [0x12e1] = 0x5821, [0x12e2] = 0x5862, [0x12e3] = 0x584b, [0x12e4] = 0x5870, + [0x12e5] = 0x6bc0, [0x12e6] = 0x5852, [0x12e7] = 0x583d, [0x12e8] = 0x5879, + [0x12e9] = 0x5885, [0x12ea] = 0x58b9, [0x12eb] = 0x589f, [0x12ec] = 0x58ab, + [0x12ed] = 0x58ba, [0x12ee] = 0x58de, [0x12ef] = 0x58bb, [0x12f0] = 0x58b8, + [0x12f1] = 0x58ae, [0x12f2] = 0x58c5, [0x12f3] = 0x58d3, [0x12f4] = 0x58d1, + [0x12f5] = 0x58d7, [0x12f6] = 0x58d9, [0x12f7] = 0x58d8, [0x12f8] = 0x58e5, + [0x12f9] = 0x58dc, [0x12fa] = 0x58e4, [0x12fb] = 0x58df, [0x12fc] = 0x58ef, + [0x12fd] = 0x58fa, [0x12fe] = 0x58f9, [0x12ff] = 0x58fb, [0x1300] = 0x58fc, + [0x1301] = 0x58fd, [0x1302] = 0x5902, [0x1303] = 0x590a, [0x1304] = 0x5910, + [0x1305] = 0x591b, [0x1306] = 0x68a6, [0x1307] = 0x5925, [0x1308] = 0x592c, + [0x1309] = 0x592d, [0x130a] = 0x5932, [0x130b] = 0x5938, [0x130c] = 0x593e, + [0x130d] = 0x7ad2, [0x130e] = 0x5955, [0x130f] = 0x5950, [0x1310] = 0x594e, + [0x1311] = 0x595a, [0x1312] = 0x5958, [0x1313] = 0x5962, [0x1314] = 0x5960, + [0x1315] = 0x5967, [0x1316] = 0x596c, [0x1317] = 0x5969, [0x1318] = 0x5978, + [0x1319] = 0x5981, [0x131a] = 0x599d, [0x131b] = 0x4f5e, [0x131c] = 0x4fab, + [0x131d] = 0x59a3, [0x131e] = 0x59b2, [0x131f] = 0x59c6, [0x1320] = 0x59e8, + [0x1321] = 0x59dc, [0x1322] = 0x598d, [0x1323] = 0x59d9, [0x1324] = 0x59da, + [0x1325] = 0x5a25, [0x1326] = 0x5a1f, [0x1327] = 0x5a11, [0x1328] = 0x5a1c, + [0x1329] = 0x5a09, [0x132a] = 0x5a1a, [0x132b] = 0x5a40, [0x132c] = 0x5a6c, + [0x132d] = 0x5a49, [0x132e] = 0x5a35, [0x132f] = 0x5a36, [0x1330] = 0x5a62, + [0x1331] = 0x5a6a, [0x1332] = 0x5a9a, [0x1333] = 0x5abc, [0x1334] = 0x5abe, + [0x1335] = 0x5acb, [0x1336] = 0x5ac2, [0x1337] = 0x5abd, [0x1338] = 0x5ae3, + [0x1339] = 0x5ad7, [0x133a] = 0x5ae6, [0x133b] = 0x5ae9, [0x133c] = 0x5ad6, + [0x133d] = 0x5afa, [0x133e] = 0x5afb, [0x133f] = 0x5b0c, [0x1340] = 0x5b0b, + [0x1341] = 0x5b16, [0x1342] = 0x5b32, [0x1343] = 0x5ad0, [0x1344] = 0x5b2a, + [0x1345] = 0x5b36, [0x1346] = 0x5b3e, [0x1347] = 0x5b43, [0x1348] = 0x5b45, + [0x1349] = 0x5b40, [0x134a] = 0x5b51, [0x134b] = 0x5b55, [0x134c] = 0x5b5a, + [0x134d] = 0x5b5b, [0x134e] = 0x5b65, [0x134f] = 0x5b69, [0x1350] = 0x5b70, + [0x1351] = 0x5b73, [0x1352] = 0x5b75, [0x1353] = 0x5b78, [0x1354] = 0x6588, + [0x1355] = 0x5b7a, [0x1356] = 0x5b80, [0x1357] = 0x5b83, [0x1358] = 0x5ba6, + [0x1359] = 0x5bb8, [0x135a] = 0x5bc3, [0x135b] = 0x5bc7, [0x135c] = 0x5bc9, + [0x135d] = 0x5bd4, [0x135e] = 0x5bd0, [0x135f] = 0x5be4, [0x1360] = 0x5be6, + [0x1361] = 0x5be2, [0x1362] = 0x5bde, [0x1363] = 0x5be5, [0x1364] = 0x5beb, + [0x1365] = 0x5bf0, [0x1366] = 0x5bf6, [0x1367] = 0x5bf3, [0x1368] = 0x5c05, + [0x1369] = 0x5c07, [0x136a] = 0x5c08, [0x136b] = 0x5c0d, [0x136c] = 0x5c13, + [0x136d] = 0x5c20, [0x136e] = 0x5c22, [0x136f] = 0x5c28, [0x1370] = 0x5c38, + [0x1371] = 0x5c39, [0x1372] = 0x5c41, [0x1373] = 0x5c46, [0x1374] = 0x5c4e, + [0x1375] = 0x5c53, [0x1376] = 0x5c50, [0x1377] = 0x5c4f, [0x1378] = 0x5b71, + [0x1379] = 0x5c6c, [0x137a] = 0x5c6e, [0x137b] = 0x4e62, [0x137c] = 0x5c76, + [0x137d] = 0x5c79, [0x137e] = 0x5c8c, [0x137f] = 0x5c91, [0x1380] = 0x5c94, + [0x1381] = 0x599b, [0x1382] = 0x5cab, [0x1383] = 0x5cbb, [0x1384] = 0x5cb6, + [0x1385] = 0x5cbc, [0x1386] = 0x5cb7, [0x1387] = 0x5cc5, [0x1388] = 0x5cbe, + [0x1389] = 0x5cc7, [0x138a] = 0x5cd9, [0x138b] = 0x5ce9, [0x138c] = 0x5cfd, + [0x138d] = 0x5cfa, [0x138e] = 0x5ced, [0x138f] = 0x5d8c, [0x1390] = 0x5cea, + [0x1391] = 0x5d0b, [0x1392] = 0x5d15, [0x1393] = 0x5d17, [0x1394] = 0x5d5c, + [0x1395] = 0x5d1f, [0x1396] = 0x5d1b, [0x1397] = 0x5d11, [0x1398] = 0x5d14, + [0x1399] = 0x5d22, [0x139a] = 0x5d1a, [0x139b] = 0x5d19, [0x139c] = 0x5d18, + [0x139d] = 0x5d4c, [0x139e] = 0x5d52, [0x139f] = 0x5d4e, [0x13a0] = 0x5d4b, + [0x13a1] = 0x5d6c, [0x13a2] = 0x5d73, [0x13a3] = 0x5d76, [0x13a4] = 0x5d87, + [0x13a5] = 0x5d84, [0x13a6] = 0x5d82, [0x13a7] = 0x5da2, [0x13a8] = 0x5d9d, + [0x13a9] = 0x5dac, [0x13aa] = 0x5dae, [0x13ab] = 0x5dbd, [0x13ac] = 0x5d90, + [0x13ad] = 0x5db7, [0x13ae] = 0x5dbc, [0x13af] = 0x5dc9, [0x13b0] = 0x5dcd, + [0x13b1] = 0x5dd3, [0x13b2] = 0x5dd2, [0x13b3] = 0x5dd6, [0x13b4] = 0x5ddb, + [0x13b5] = 0x5deb, [0x13b6] = 0x5df2, [0x13b7] = 0x5df5, [0x13b8] = 0x5e0b, + [0x13b9] = 0x5e1a, [0x13ba] = 0x5e19, [0x13bb] = 0x5e11, [0x13bc] = 0x5e1b, + [0x13bd] = 0x5e36, [0x13be] = 0x5e37, [0x13bf] = 0x5e44, [0x13c0] = 0x5e43, + [0x13c1] = 0x5e40, [0x13c2] = 0x5e4e, [0x13c3] = 0x5e57, [0x13c4] = 0x5e54, + [0x13c5] = 0x5e5f, [0x13c6] = 0x5e62, [0x13c7] = 0x5e64, [0x13c8] = 0x5e47, + [0x13c9] = 0x5e75, [0x13ca] = 0x5e76, [0x13cb] = 0x5e7a, [0x13cc] = 0x9ebc, + [0x13cd] = 0x5e7f, [0x13ce] = 0x5ea0, [0x13cf] = 0x5ec1, [0x13d0] = 0x5ec2, + [0x13d1] = 0x5ec8, [0x13d2] = 0x5ed0, [0x13d3] = 0x5ecf, [0x13d4] = 0x5ed6, + [0x13d5] = 0x5ee3, [0x13d6] = 0x5edd, [0x13d7] = 0x5eda, [0x13d8] = 0x5edb, + [0x13d9] = 0x5ee2, [0x13da] = 0x5ee1, [0x13db] = 0x5ee8, [0x13dc] = 0x5ee9, + [0x13dd] = 0x5eec, [0x13de] = 0x5ef1, [0x13df] = 0x5ef3, [0x13e0] = 0x5ef0, + [0x13e1] = 0x5ef4, [0x13e2] = 0x5ef8, [0x13e3] = 0x5efe, [0x13e4] = 0x5f03, + [0x13e5] = 0x5f09, [0x13e6] = 0x5f5d, [0x13e7] = 0x5f5c, [0x13e8] = 0x5f0b, + [0x13e9] = 0x5f11, [0x13ea] = 0x5f16, [0x13eb] = 0x5f29, [0x13ec] = 0x5f2d, + [0x13ed] = 0x5f38, [0x13ee] = 0x5f41, [0x13ef] = 0x5f48, [0x13f0] = 0x5f4c, + [0x13f1] = 0x5f4e, [0x13f2] = 0x5f2f, [0x13f3] = 0x5f51, [0x13f4] = 0x5f56, + [0x13f5] = 0x5f57, [0x13f6] = 0x5f59, [0x13f7] = 0x5f61, [0x13f8] = 0x5f6d, + [0x13f9] = 0x5f73, [0x13fa] = 0x5f77, [0x13fb] = 0x5f83, [0x13fc] = 0x5f82, + [0x13fd] = 0x5f7f, [0x13fe] = 0x5f8a, [0x13ff] = 0x5f88, [0x1400] = 0x5f91, + [0x1401] = 0x5f87, [0x1402] = 0x5f9e, [0x1403] = 0x5f99, [0x1404] = 0x5f98, + [0x1405] = 0x5fa0, [0x1406] = 0x5fa8, [0x1407] = 0x5fad, [0x1408] = 0x5fbc, + [0x1409] = 0x5fd6, [0x140a] = 0x5ffb, [0x140b] = 0x5fe4, [0x140c] = 0x5ff8, + [0x140d] = 0x5ff1, [0x140e] = 0x5fdd, [0x140f] = 0x60b3, [0x1410] = 0x5fff, + [0x1411] = 0x6021, [0x1412] = 0x6060, [0x1413] = 0x6019, [0x1414] = 0x6010, + [0x1415] = 0x6029, [0x1416] = 0x600e, [0x1417] = 0x6031, [0x1418] = 0x601b, + [0x1419] = 0x6015, [0x141a] = 0x602b, [0x141b] = 0x6026, [0x141c] = 0x600f, + [0x141d] = 0x603a, [0x141e] = 0x605a, [0x141f] = 0x6041, [0x1420] = 0x606a, + [0x1421] = 0x6077, [0x1422] = 0x605f, [0x1423] = 0x604a, [0x1424] = 0x6046, + [0x1425] = 0x604d, [0x1426] = 0x6063, [0x1427] = 0x6043, [0x1428] = 0x6064, + [0x1429] = 0x6042, [0x142a] = 0x606c, [0x142b] = 0x606b, [0x142c] = 0x6059, + [0x142d] = 0x6081, [0x142e] = 0x608d, [0x142f] = 0x60e7, [0x1430] = 0x6083, + [0x1431] = 0x609a, [0x1432] = 0x6084, [0x1433] = 0x609b, [0x1434] = 0x6096, + [0x1435] = 0x6097, [0x1436] = 0x6092, [0x1437] = 0x60a7, [0x1438] = 0x608b, + [0x1439] = 0x60e1, [0x143a] = 0x60b8, [0x143b] = 0x60e0, [0x143c] = 0x60d3, + [0x143d] = 0x60b4, [0x143e] = 0x5ff0, [0x143f] = 0x60bd, [0x1440] = 0x60c6, + [0x1441] = 0x60b5, [0x1442] = 0x60d8, [0x1443] = 0x614d, [0x1444] = 0x6115, + [0x1445] = 0x6106, [0x1446] = 0x60f6, [0x1447] = 0x60f7, [0x1448] = 0x6100, + [0x1449] = 0x60f4, [0x144a] = 0x60fa, [0x144b] = 0x6103, [0x144c] = 0x6121, + [0x144d] = 0x60fb, [0x144e] = 0x60f1, [0x144f] = 0x610d, [0x1450] = 0x610e, + [0x1451] = 0x6147, [0x1452] = 0x613e, [0x1453] = 0x6128, [0x1454] = 0x6127, + [0x1455] = 0x614a, [0x1456] = 0x613f, [0x1457] = 0x613c, [0x1458] = 0x612c, + [0x1459] = 0x6134, [0x145a] = 0x613d, [0x145b] = 0x6142, [0x145c] = 0x6144, + [0x145d] = 0x6173, [0x145e] = 0x6177, [0x145f] = 0x6158, [0x1460] = 0x6159, + [0x1461] = 0x615a, [0x1462] = 0x616b, [0x1463] = 0x6174, [0x1464] = 0x616f, + [0x1465] = 0x6165, [0x1466] = 0x6171, [0x1467] = 0x615f, [0x1468] = 0x615d, + [0x1469] = 0x6153, [0x146a] = 0x6175, [0x146b] = 0x6199, [0x146c] = 0x6196, + [0x146d] = 0x6187, [0x146e] = 0x61ac, [0x146f] = 0x6194, [0x1470] = 0x619a, + [0x1471] = 0x618a, [0x1472] = 0x6191, [0x1473] = 0x61ab, [0x1474] = 0x61ae, + [0x1475] = 0x61cc, [0x1476] = 0x61ca, [0x1477] = 0x61c9, [0x1478] = 0x61f7, + [0x1479] = 0x61c8, [0x147a] = 0x61c3, [0x147b] = 0x61c6, [0x147c] = 0x61ba, + [0x147d] = 0x61cb, [0x147e] = 0x7f79, [0x147f] = 0x61cd, [0x1480] = 0x61e6, + [0x1481] = 0x61e3, [0x1482] = 0x61f6, [0x1483] = 0x61fa, [0x1484] = 0x61f4, + [0x1485] = 0x61ff, [0x1486] = 0x61fd, [0x1487] = 0x61fc, [0x1488] = 0x61fe, + [0x1489] = 0x6200, [0x148a] = 0x6208, [0x148b] = 0x6209, [0x148c] = 0x620d, + [0x148d] = 0x620c, [0x148e] = 0x6214, [0x148f] = 0x621b, [0x1490] = 0x621e, + [0x1491] = 0x6221, [0x1492] = 0x622a, [0x1493] = 0x622e, [0x1494] = 0x6230, + [0x1495] = 0x6232, [0x1496] = 0x6233, [0x1497] = 0x6241, [0x1498] = 0x624e, + [0x1499] = 0x625e, [0x149a] = 0x6263, [0x149b] = 0x625b, [0x149c] = 0x6260, + [0x149d] = 0x6268, [0x149e] = 0x627c, [0x149f] = 0x6282, [0x14a0] = 0x6289, + [0x14a1] = 0x627e, [0x14a2] = 0x6292, [0x14a3] = 0x6293, [0x14a4] = 0x6296, + [0x14a5] = 0x62d4, [0x14a6] = 0x6283, [0x14a7] = 0x6294, [0x14a8] = 0x62d7, + [0x14a9] = 0x62d1, [0x14aa] = 0x62bb, [0x14ab] = 0x62cf, [0x14ac] = 0x62ff, + [0x14ad] = 0x62c6, [0x14ae] = 0x64d4, [0x14af] = 0x62c8, [0x14b0] = 0x62dc, + [0x14b1] = 0x62cc, [0x14b2] = 0x62ca, [0x14b3] = 0x62c2, [0x14b4] = 0x62c7, + [0x14b5] = 0x629b, [0x14b6] = 0x62c9, [0x14b7] = 0x630c, [0x14b8] = 0x62ee, + [0x14b9] = 0x62f1, [0x14ba] = 0x6327, [0x14bb] = 0x6302, [0x14bc] = 0x6308, + [0x14bd] = 0x62ef, [0x14be] = 0x62f5, [0x14bf] = 0x6350, [0x14c0] = 0x633e, + [0x14c1] = 0x634d, [0x14c2] = 0x641c, [0x14c3] = 0x634f, [0x14c4] = 0x6396, + [0x14c5] = 0x638e, [0x14c6] = 0x6380, [0x14c7] = 0x63ab, [0x14c8] = 0x6376, + [0x14c9] = 0x63a3, [0x14ca] = 0x638f, [0x14cb] = 0x6389, [0x14cc] = 0x639f, + [0x14cd] = 0x63b5, [0x14ce] = 0x636b, [0x14cf] = 0x6369, [0x14d0] = 0x63be, + [0x14d1] = 0x63e9, [0x14d2] = 0x63c0, [0x14d3] = 0x63c6, [0x14d4] = 0x63e3, + [0x14d5] = 0x63c9, [0x14d6] = 0x63d2, [0x14d7] = 0x63f6, [0x14d8] = 0x63c4, + [0x14d9] = 0x6416, [0x14da] = 0x6434, [0x14db] = 0x6406, [0x14dc] = 0x6413, + [0x14dd] = 0x6426, [0x14de] = 0x6436, [0x14df] = 0x651d, [0x14e0] = 0x6417, + [0x14e1] = 0x6428, [0x14e2] = 0x640f, [0x14e3] = 0x6467, [0x14e4] = 0x646f, + [0x14e5] = 0x6476, [0x14e6] = 0x644e, [0x14e7] = 0x652a, [0x14e8] = 0x6495, + [0x14e9] = 0x6493, [0x14ea] = 0x64a5, [0x14eb] = 0x64a9, [0x14ec] = 0x6488, + [0x14ed] = 0x64bc, [0x14ee] = 0x64da, [0x14ef] = 0x64d2, [0x14f0] = 0x64c5, + [0x14f1] = 0x64c7, [0x14f2] = 0x64bb, [0x14f3] = 0x64d8, [0x14f4] = 0x64c2, + [0x14f5] = 0x64f1, [0x14f6] = 0x64e7, [0x14f7] = 0x8209, [0x14f8] = 0x64e0, + [0x14f9] = 0x64e1, [0x14fa] = 0x62ac, [0x14fb] = 0x64e3, [0x14fc] = 0x64ef, + [0x14fd] = 0x652c, [0x14fe] = 0x64f6, [0x14ff] = 0x64f4, [0x1500] = 0x64f2, + [0x1501] = 0x64fa, [0x1502] = 0x6500, [0x1503] = 0x64fd, [0x1504] = 0x6518, + [0x1505] = 0x651c, [0x1506] = 0x6505, [0x1507] = 0x6524, [0x1508] = 0x6523, + [0x1509] = 0x652b, [0x150a] = 0x6534, [0x150b] = 0x6535, [0x150c] = 0x6537, + [0x150d] = 0x6536, [0x150e] = 0x6538, [0x150f] = 0x754b, [0x1510] = 0x6548, + [0x1511] = 0x6556, [0x1512] = 0x6555, [0x1513] = 0x654d, [0x1514] = 0x6558, + [0x1515] = 0x655e, [0x1516] = 0x655d, [0x1517] = 0x6572, [0x1518] = 0x6578, + [0x1519] = 0x6582, [0x151a] = 0x6583, [0x151b] = 0x8b8a, [0x151c] = 0x659b, + [0x151d] = 0x659f, [0x151e] = 0x65ab, [0x151f] = 0x65b7, [0x1520] = 0x65c3, + [0x1521] = 0x65c6, [0x1522] = 0x65c1, [0x1523] = 0x65c4, [0x1524] = 0x65cc, + [0x1525] = 0x65d2, [0x1526] = 0x65db, [0x1527] = 0x65d9, [0x1528] = 0x65e0, + [0x1529] = 0x65e1, [0x152a] = 0x65f1, [0x152b] = 0x6772, [0x152c] = 0x660a, + [0x152d] = 0x6603, [0x152e] = 0x65fb, [0x152f] = 0x6773, [0x1530] = 0x6635, + [0x1531] = 0x6636, [0x1532] = 0x6634, [0x1533] = 0x661c, [0x1534] = 0x664f, + [0x1535] = 0x6644, [0x1536] = 0x6649, [0x1537] = 0x6641, [0x1538] = 0x665e, + [0x1539] = 0x665d, [0x153a] = 0x6664, [0x153b] = 0x6667, [0x153c] = 0x6668, + [0x153d] = 0x665f, [0x153e] = 0x6662, [0x153f] = 0x6670, [0x1540] = 0x6683, + [0x1541] = 0x6688, [0x1542] = 0x668e, [0x1543] = 0x6689, [0x1544] = 0x6684, + [0x1545] = 0x6698, [0x1546] = 0x669d, [0x1547] = 0x66c1, [0x1548] = 0x66b9, + [0x1549] = 0x66c9, [0x154a] = 0x66be, [0x154b] = 0x66bc, [0x154c] = 0x66c4, + [0x154d] = 0x66b8, [0x154e] = 0x66d6, [0x154f] = 0x66da, [0x1550] = 0x66e0, + [0x1551] = 0x663f, [0x1552] = 0x66e6, [0x1553] = 0x66e9, [0x1554] = 0x66f0, + [0x1555] = 0x66f5, [0x1556] = 0x66f7, [0x1557] = 0x670f, [0x1558] = 0x6716, + [0x1559] = 0x671e, [0x155a] = 0x6726, [0x155b] = 0x6727, [0x155c] = 0x9738, + [0x155d] = 0x672e, [0x155e] = 0x673f, [0x155f] = 0x6736, [0x1560] = 0x6741, + [0x1561] = 0x6738, [0x1562] = 0x6737, [0x1563] = 0x6746, [0x1564] = 0x675e, + [0x1565] = 0x6760, [0x1566] = 0x6759, [0x1567] = 0x6763, [0x1568] = 0x6764, + [0x1569] = 0x6789, [0x156a] = 0x6770, [0x156b] = 0x67a9, [0x156c] = 0x677c, + [0x156d] = 0x676a, [0x156e] = 0x678c, [0x156f] = 0x678b, [0x1570] = 0x67a6, + [0x1571] = 0x67a1, [0x1572] = 0x6785, [0x1573] = 0x67b7, [0x1574] = 0x67ef, + [0x1575] = 0x67b4, [0x1576] = 0x67ec, [0x1577] = 0x67b3, [0x1578] = 0x67e9, + [0x1579] = 0x67b8, [0x157a] = 0x67e4, [0x157b] = 0x67de, [0x157c] = 0x67dd, + [0x157d] = 0x67e2, [0x157e] = 0x67ee, [0x157f] = 0x67b9, [0x1580] = 0x67ce, + [0x1581] = 0x67c6, [0x1582] = 0x67e7, [0x1583] = 0x6a9c, [0x1584] = 0x681e, + [0x1585] = 0x6846, [0x1586] = 0x6829, [0x1587] = 0x6840, [0x1588] = 0x684d, + [0x1589] = 0x6832, [0x158a] = 0x684e, [0x158b] = 0x68b3, [0x158c] = 0x682b, + [0x158d] = 0x6859, [0x158e] = 0x6863, [0x158f] = 0x6877, [0x1590] = 0x687f, + [0x1591] = 0x689f, [0x1592] = 0x688f, [0x1593] = 0x68ad, [0x1594] = 0x6894, + [0x1595] = 0x689d, [0x1596] = 0x689b, [0x1597] = 0x6883, [0x1598] = 0x6aae, + [0x1599] = 0x68b9, [0x159a] = 0x6874, [0x159b] = 0x68b5, [0x159c] = 0x68a0, + [0x159d] = 0x68ba, [0x159e] = 0x690f, [0x159f] = 0x688d, [0x15a0] = 0x687e, + [0x15a1] = 0x6901, [0x15a2] = 0x68ca, [0x15a3] = 0x6908, [0x15a4] = 0x68d8, + [0x15a5] = 0x6922, [0x15a6] = 0x6926, [0x15a7] = 0x68e1, [0x15a8] = 0x690c, + [0x15a9] = 0x68cd, [0x15aa] = 0x68d4, [0x15ab] = 0x68e7, [0x15ac] = 0x68d5, + [0x15ad] = 0x6936, [0x15ae] = 0x6912, [0x15af] = 0x6904, [0x15b0] = 0x68d7, + [0x15b1] = 0x68e3, [0x15b2] = 0x6925, [0x15b3] = 0x68f9, [0x15b4] = 0x68e0, + [0x15b5] = 0x68ef, [0x15b6] = 0x6928, [0x15b7] = 0x692a, [0x15b8] = 0x691a, + [0x15b9] = 0x6923, [0x15ba] = 0x6921, [0x15bb] = 0x68c6, [0x15bc] = 0x6979, + [0x15bd] = 0x6977, [0x15be] = 0x695c, [0x15bf] = 0x6978, [0x15c0] = 0x696b, + [0x15c1] = 0x6954, [0x15c2] = 0x697e, [0x15c3] = 0x696e, [0x15c4] = 0x6939, + [0x15c5] = 0x6974, [0x15c6] = 0x693d, [0x15c7] = 0x6959, [0x15c8] = 0x6930, + [0x15c9] = 0x6961, [0x15ca] = 0x695e, [0x15cb] = 0x695d, [0x15cc] = 0x6981, + [0x15cd] = 0x696a, [0x15ce] = 0x69b2, [0x15cf] = 0x69ae, [0x15d0] = 0x69d0, + [0x15d1] = 0x69bf, [0x15d2] = 0x69c1, [0x15d3] = 0x69d3, [0x15d4] = 0x69be, + [0x15d5] = 0x69ce, [0x15d6] = 0x5be8, [0x15d7] = 0x69ca, [0x15d8] = 0x69dd, + [0x15d9] = 0x69bb, [0x15da] = 0x69c3, [0x15db] = 0x69a7, [0x15dc] = 0x6a2e, + [0x15dd] = 0x6991, [0x15de] = 0x69a0, [0x15df] = 0x699c, [0x15e0] = 0x6995, + [0x15e1] = 0x69b4, [0x15e2] = 0x69de, [0x15e3] = 0x69e8, [0x15e4] = 0x6a02, + [0x15e5] = 0x6a1b, [0x15e6] = 0x69ff, [0x15e7] = 0x6b0a, [0x15e8] = 0x69f9, + [0x15e9] = 0x69f2, [0x15ea] = 0x69e7, [0x15eb] = 0x6a05, [0x15ec] = 0x69b1, + [0x15ed] = 0x6a1e, [0x15ee] = 0x69ed, [0x15ef] = 0x6a14, [0x15f0] = 0x69eb, + [0x15f1] = 0x6a0a, [0x15f2] = 0x6a12, [0x15f3] = 0x6ac1, [0x15f4] = 0x6a23, + [0x15f5] = 0x6a13, [0x15f6] = 0x6a44, [0x15f7] = 0x6a0c, [0x15f8] = 0x6a72, + [0x15f9] = 0x6a36, [0x15fa] = 0x6a78, [0x15fb] = 0x6a47, [0x15fc] = 0x6a62, + [0x15fd] = 0x6a59, [0x15fe] = 0x6a66, [0x15ff] = 0x6a48, [0x1600] = 0x6a38, + [0x1601] = 0x6a22, [0x1602] = 0x6a90, [0x1603] = 0x6a8d, [0x1604] = 0x6aa0, + [0x1605] = 0x6a84, [0x1606] = 0x6aa2, [0x1607] = 0x6aa3, [0x1608] = 0x6a97, + [0x1609] = 0x8617, [0x160a] = 0x6abb, [0x160b] = 0x6ac3, [0x160c] = 0x6ac2, + [0x160d] = 0x6ab8, [0x160e] = 0x6ab3, [0x160f] = 0x6aac, [0x1610] = 0x6ade, + [0x1611] = 0x6ad1, [0x1612] = 0x6adf, [0x1613] = 0x6aaa, [0x1614] = 0x6ada, + [0x1615] = 0x6aea, [0x1616] = 0x6afb, [0x1617] = 0x6b05, [0x1618] = 0x8616, + [0x1619] = 0x6afa, [0x161a] = 0x6b12, [0x161b] = 0x6b16, [0x161c] = 0x9b31, + [0x161d] = 0x6b1f, [0x161e] = 0x6b38, [0x161f] = 0x6b37, [0x1620] = 0x76dc, + [0x1621] = 0x6b39, [0x1622] = 0x98ee, [0x1623] = 0x6b47, [0x1624] = 0x6b43, + [0x1625] = 0x6b49, [0x1626] = 0x6b50, [0x1627] = 0x6b59, [0x1628] = 0x6b54, + [0x1629] = 0x6b5b, [0x162a] = 0x6b5f, [0x162b] = 0x6b61, [0x162c] = 0x6b78, + [0x162d] = 0x6b79, [0x162e] = 0x6b7f, [0x162f] = 0x6b80, [0x1630] = 0x6b84, + [0x1631] = 0x6b83, [0x1632] = 0x6b8d, [0x1633] = 0x6b98, [0x1634] = 0x6b95, + [0x1635] = 0x6b9e, [0x1636] = 0x6ba4, [0x1637] = 0x6baa, [0x1638] = 0x6bab, + [0x1639] = 0x6baf, [0x163a] = 0x6bb2, [0x163b] = 0x6bb1, [0x163c] = 0x6bb3, + [0x163d] = 0x6bb7, [0x163e] = 0x6bbc, [0x163f] = 0x6bc6, [0x1640] = 0x6bcb, + [0x1641] = 0x6bd3, [0x1642] = 0x6bdf, [0x1643] = 0x6bec, [0x1644] = 0x6beb, + [0x1645] = 0x6bf3, [0x1646] = 0x6bef, [0x1647] = 0x9ebe, [0x1648] = 0x6c08, + [0x1649] = 0x6c13, [0x164a] = 0x6c14, [0x164b] = 0x6c1b, [0x164c] = 0x6c24, + [0x164d] = 0x6c23, [0x164e] = 0x6c5e, [0x164f] = 0x6c55, [0x1650] = 0x6c62, + [0x1651] = 0x6c6a, [0x1652] = 0x6c82, [0x1653] = 0x6c8d, [0x1654] = 0x6c9a, + [0x1655] = 0x6c81, [0x1656] = 0x6c9b, [0x1657] = 0x6c7e, [0x1658] = 0x6c68, + [0x1659] = 0x6c73, [0x165a] = 0x6c92, [0x165b] = 0x6c90, [0x165c] = 0x6cc4, + [0x165d] = 0x6cf1, [0x165e] = 0x6cd3, [0x165f] = 0x6cbd, [0x1660] = 0x6cd7, + [0x1661] = 0x6cc5, [0x1662] = 0x6cdd, [0x1663] = 0x6cae, [0x1664] = 0x6cb1, + [0x1665] = 0x6cbe, [0x1666] = 0x6cba, [0x1667] = 0x6cdb, [0x1668] = 0x6cef, + [0x1669] = 0x6cd9, [0x166a] = 0x6cea, [0x166b] = 0x6d1f, [0x166c] = 0x884d, + [0x166d] = 0x6d36, [0x166e] = 0x6d2b, [0x166f] = 0x6d3d, [0x1670] = 0x6d38, + [0x1671] = 0x6d19, [0x1672] = 0x6d35, [0x1673] = 0x6d33, [0x1674] = 0x6d12, + [0x1675] = 0x6d0c, [0x1676] = 0x6d63, [0x1677] = 0x6d93, [0x1678] = 0x6d64, + [0x1679] = 0x6d5a, [0x167a] = 0x6d79, [0x167b] = 0x6d59, [0x167c] = 0x6d8e, + [0x167d] = 0x6d95, [0x167e] = 0x6fe4, [0x167f] = 0x6d85, [0x1680] = 0x6df9, + [0x1681] = 0x6e15, [0x1682] = 0x6e0a, [0x1683] = 0x6db5, [0x1684] = 0x6dc7, + [0x1685] = 0x6de6, [0x1686] = 0x6db8, [0x1687] = 0x6dc6, [0x1688] = 0x6dec, + [0x1689] = 0x6dde, [0x168a] = 0x6dcc, [0x168b] = 0x6de8, [0x168c] = 0x6dd2, + [0x168d] = 0x6dc5, [0x168e] = 0x6dfa, [0x168f] = 0x6dd9, [0x1690] = 0x6de4, + [0x1691] = 0x6dd5, [0x1692] = 0x6dea, [0x1693] = 0x6dee, [0x1694] = 0x6e2d, + [0x1695] = 0x6e6e, [0x1696] = 0x6e2e, [0x1697] = 0x6e19, [0x1698] = 0x6e72, + [0x1699] = 0x6e5f, [0x169a] = 0x6e3e, [0x169b] = 0x6e23, [0x169c] = 0x6e6b, + [0x169d] = 0x6e2b, [0x169e] = 0x6e76, [0x169f] = 0x6e4d, [0x16a0] = 0x6e1f, + [0x16a1] = 0x6e43, [0x16a2] = 0x6e3a, [0x16a3] = 0x6e4e, [0x16a4] = 0x6e24, + [0x16a5] = 0x6eff, [0x16a6] = 0x6e1d, [0x16a7] = 0x6e38, [0x16a8] = 0x6e82, + [0x16a9] = 0x6eaa, [0x16aa] = 0x6e98, [0x16ab] = 0x6ec9, [0x16ac] = 0x6eb7, + [0x16ad] = 0x6ed3, [0x16ae] = 0x6ebd, [0x16af] = 0x6eaf, [0x16b0] = 0x6ec4, + [0x16b1] = 0x6eb2, [0x16b2] = 0x6ed4, [0x16b3] = 0x6ed5, [0x16b4] = 0x6e8f, + [0x16b5] = 0x6ea5, [0x16b6] = 0x6ec2, [0x16b7] = 0x6e9f, [0x16b8] = 0x6f41, + [0x16b9] = 0x6f11, [0x16ba] = 0x704c, [0x16bb] = 0x6eec, [0x16bc] = 0x6ef8, + [0x16bd] = 0x6efe, [0x16be] = 0x6f3f, [0x16bf] = 0x6ef2, [0x16c0] = 0x6f31, + [0x16c1] = 0x6eef, [0x16c2] = 0x6f32, [0x16c3] = 0x6ecc, [0x16c4] = 0x6f3e, + [0x16c5] = 0x6f13, [0x16c6] = 0x6ef7, [0x16c7] = 0x6f86, [0x16c8] = 0x6f7a, + [0x16c9] = 0x6f78, [0x16ca] = 0x6f81, [0x16cb] = 0x6f80, [0x16cc] = 0x6f6f, + [0x16cd] = 0x6f5b, [0x16ce] = 0x6ff3, [0x16cf] = 0x6f6d, [0x16d0] = 0x6f82, + [0x16d1] = 0x6f7c, [0x16d2] = 0x6f58, [0x16d3] = 0x6f8e, [0x16d4] = 0x6f91, + [0x16d5] = 0x6fc2, [0x16d6] = 0x6f66, [0x16d7] = 0x6fb3, [0x16d8] = 0x6fa3, + [0x16d9] = 0x6fa1, [0x16da] = 0x6fa4, [0x16db] = 0x6fb9, [0x16dc] = 0x6fc6, + [0x16dd] = 0x6faa, [0x16de] = 0x6fdf, [0x16df] = 0x6fd5, [0x16e0] = 0x6fec, + [0x16e1] = 0x6fd4, [0x16e2] = 0x6fd8, [0x16e3] = 0x6ff1, [0x16e4] = 0x6fee, + [0x16e5] = 0x6fdb, [0x16e6] = 0x7009, [0x16e7] = 0x700b, [0x16e8] = 0x6ffa, + [0x16e9] = 0x7011, [0x16ea] = 0x7001, [0x16eb] = 0x700f, [0x16ec] = 0x6ffe, + [0x16ed] = 0x701b, [0x16ee] = 0x701a, [0x16ef] = 0x6f74, [0x16f0] = 0x701d, + [0x16f1] = 0x7018, [0x16f2] = 0x701f, [0x16f3] = 0x7030, [0x16f4] = 0x703e, + [0x16f5] = 0x7032, [0x16f6] = 0x7051, [0x16f7] = 0x7063, [0x16f8] = 0x7099, + [0x16f9] = 0x7092, [0x16fa] = 0x70af, [0x16fb] = 0x70f1, [0x16fc] = 0x70ac, + [0x16fd] = 0x70b8, [0x16fe] = 0x70b3, [0x16ff] = 0x70ae, [0x1700] = 0x70df, + [0x1701] = 0x70cb, [0x1702] = 0x70dd, [0x1703] = 0x70d9, [0x1704] = 0x7109, + [0x1705] = 0x70fd, [0x1706] = 0x711c, [0x1707] = 0x7119, [0x1708] = 0x7165, + [0x1709] = 0x7155, [0x170a] = 0x7188, [0x170b] = 0x7166, [0x170c] = 0x7162, + [0x170d] = 0x714c, [0x170e] = 0x7156, [0x170f] = 0x716c, [0x1710] = 0x718f, + [0x1711] = 0x71fb, [0x1712] = 0x7184, [0x1713] = 0x7195, [0x1714] = 0x71a8, + [0x1715] = 0x71ac, [0x1716] = 0x71d7, [0x1717] = 0x71b9, [0x1718] = 0x71be, + [0x1719] = 0x71d2, [0x171a] = 0x71c9, [0x171b] = 0x71d4, [0x171c] = 0x71ce, + [0x171d] = 0x71e0, [0x171e] = 0x71ec, [0x171f] = 0x71e7, [0x1720] = 0x71f5, + [0x1721] = 0x71fc, [0x1722] = 0x71f9, [0x1723] = 0x71ff, [0x1724] = 0x720d, + [0x1725] = 0x7210, [0x1726] = 0x721b, [0x1727] = 0x7228, [0x1728] = 0x722d, + [0x1729] = 0x722c, [0x172a] = 0x7230, [0x172b] = 0x7232, [0x172c] = 0x723b, + [0x172d] = 0x723c, [0x172e] = 0x723f, [0x172f] = 0x7240, [0x1730] = 0x7246, + [0x1731] = 0x724b, [0x1732] = 0x7258, [0x1733] = 0x7274, [0x1734] = 0x727e, + [0x1735] = 0x7282, [0x1736] = 0x7281, [0x1737] = 0x7287, [0x1738] = 0x7292, + [0x1739] = 0x7296, [0x173a] = 0x72a2, [0x173b] = 0x72a7, [0x173c] = 0x72b9, + [0x173d] = 0x72b2, [0x173e] = 0x72c3, [0x173f] = 0x72c6, [0x1740] = 0x72c4, + [0x1741] = 0x72ce, [0x1742] = 0x72d2, [0x1743] = 0x72e2, [0x1744] = 0x72e0, + [0x1745] = 0x72e1, [0x1746] = 0x72f9, [0x1747] = 0x72f7, [0x1748] = 0x500f, + [0x1749] = 0x7317, [0x174a] = 0x730a, [0x174b] = 0x731c, [0x174c] = 0x7316, + [0x174d] = 0x731d, [0x174e] = 0x7334, [0x174f] = 0x732f, [0x1750] = 0x7329, + [0x1751] = 0x7325, [0x1752] = 0x733e, [0x1753] = 0x734e, [0x1754] = 0x734f, + [0x1755] = 0x9ed8, [0x1756] = 0x7357, [0x1757] = 0x736a, [0x1758] = 0x7368, + [0x1759] = 0x7370, [0x175a] = 0x7378, [0x175b] = 0x7375, [0x175c] = 0x737b, + [0x175d] = 0x737a, [0x175e] = 0x73c8, [0x175f] = 0x73b3, [0x1760] = 0x73ce, + [0x1761] = 0x73bb, [0x1762] = 0x73c0, [0x1763] = 0x73e5, [0x1764] = 0x73ee, + [0x1765] = 0x73de, [0x1766] = 0x74a2, [0x1767] = 0x7405, [0x1768] = 0x746f, + [0x1769] = 0x7425, [0x176a] = 0x73f8, [0x176b] = 0x7432, [0x176c] = 0x743a, + [0x176d] = 0x7455, [0x176e] = 0x743f, [0x176f] = 0x745f, [0x1770] = 0x7459, + [0x1771] = 0x7441, [0x1772] = 0x745c, [0x1773] = 0x7469, [0x1774] = 0x7470, + [0x1775] = 0x7463, [0x1776] = 0x746a, [0x1777] = 0x7476, [0x1778] = 0x747e, + [0x1779] = 0x748b, [0x177a] = 0x749e, [0x177b] = 0x74a7, [0x177c] = 0x74ca, + [0x177d] = 0x74cf, [0x177e] = 0x74d4, [0x177f] = 0x73f1, [0x1780] = 0x74e0, + [0x1781] = 0x74e3, [0x1782] = 0x74e7, [0x1783] = 0x74e9, [0x1784] = 0x74ee, + [0x1785] = 0x74f2, [0x1786] = 0x74f0, [0x1787] = 0x74f1, [0x1788] = 0x74f8, + [0x1789] = 0x74f7, [0x178a] = 0x7504, [0x178b] = 0x7503, [0x178c] = 0x7505, + [0x178d] = 0x750c, [0x178e] = 0x750e, [0x178f] = 0x750d, [0x1790] = 0x7515, + [0x1791] = 0x7513, [0x1792] = 0x751e, [0x1793] = 0x7526, [0x1794] = 0x752c, + [0x1795] = 0x753c, [0x1796] = 0x7544, [0x1797] = 0x754d, [0x1798] = 0x754a, + [0x1799] = 0x7549, [0x179a] = 0x755b, [0x179b] = 0x7546, [0x179c] = 0x755a, + [0x179d] = 0x7569, [0x179e] = 0x7564, [0x179f] = 0x7567, [0x17a0] = 0x756b, + [0x17a1] = 0x756d, [0x17a2] = 0x7578, [0x17a3] = 0x7576, [0x17a4] = 0x7586, + [0x17a5] = 0x7587, [0x17a6] = 0x7574, [0x17a7] = 0x758a, [0x17a8] = 0x7589, + [0x17a9] = 0x7582, [0x17aa] = 0x7594, [0x17ab] = 0x759a, [0x17ac] = 0x759d, + [0x17ad] = 0x75a5, [0x17ae] = 0x75a3, [0x17af] = 0x75c2, [0x17b0] = 0x75b3, + [0x17b1] = 0x75c3, [0x17b2] = 0x75b5, [0x17b3] = 0x75bd, [0x17b4] = 0x75b8, + [0x17b5] = 0x75bc, [0x17b6] = 0x75b1, [0x17b7] = 0x75cd, [0x17b8] = 0x75ca, + [0x17b9] = 0x75d2, [0x17ba] = 0x75d9, [0x17bb] = 0x75e3, [0x17bc] = 0x75de, + [0x17bd] = 0x75fe, [0x17be] = 0x75ff, [0x17bf] = 0x75fc, [0x17c0] = 0x7601, + [0x17c1] = 0x75f0, [0x17c2] = 0x75fa, [0x17c3] = 0x75f2, [0x17c4] = 0x75f3, + [0x17c5] = 0x760b, [0x17c6] = 0x760d, [0x17c7] = 0x7609, [0x17c8] = 0x761f, + [0x17c9] = 0x7627, [0x17ca] = 0x7620, [0x17cb] = 0x7621, [0x17cc] = 0x7622, + [0x17cd] = 0x7624, [0x17ce] = 0x7634, [0x17cf] = 0x7630, [0x17d0] = 0x763b, + [0x17d1] = 0x7647, [0x17d2] = 0x7648, [0x17d3] = 0x7646, [0x17d4] = 0x765c, + [0x17d5] = 0x7658, [0x17d6] = 0x7661, [0x17d7] = 0x7662, [0x17d8] = 0x7668, + [0x17d9] = 0x7669, [0x17da] = 0x766a, [0x17db] = 0x7667, [0x17dc] = 0x766c, + [0x17dd] = 0x7670, [0x17de] = 0x7672, [0x17df] = 0x7676, [0x17e0] = 0x7678, + [0x17e1] = 0x767c, [0x17e2] = 0x7680, [0x17e3] = 0x7683, [0x17e4] = 0x7688, + [0x17e5] = 0x768b, [0x17e6] = 0x768e, [0x17e7] = 0x7696, [0x17e8] = 0x7693, + [0x17e9] = 0x7699, [0x17ea] = 0x769a, [0x17eb] = 0x76b0, [0x17ec] = 0x76b4, + [0x17ed] = 0x76b8, [0x17ee] = 0x76b9, [0x17ef] = 0x76ba, [0x17f0] = 0x76c2, + [0x17f1] = 0x76cd, [0x17f2] = 0x76d6, [0x17f3] = 0x76d2, [0x17f4] = 0x76de, + [0x17f5] = 0x76e1, [0x17f6] = 0x76e5, [0x17f7] = 0x76e7, [0x17f8] = 0x76ea, + [0x17f9] = 0x862f, [0x17fa] = 0x76fb, [0x17fb] = 0x7708, [0x17fc] = 0x7707, + [0x17fd] = 0x7704, [0x17fe] = 0x7729, [0x17ff] = 0x7724, [0x1800] = 0x771e, + [0x1801] = 0x7725, [0x1802] = 0x7726, [0x1803] = 0x771b, [0x1804] = 0x7737, + [0x1805] = 0x7738, [0x1806] = 0x7747, [0x1807] = 0x775a, [0x1808] = 0x7768, + [0x1809] = 0x776b, [0x180a] = 0x775b, [0x180b] = 0x7765, [0x180c] = 0x777f, + [0x180d] = 0x777e, [0x180e] = 0x7779, [0x180f] = 0x778e, [0x1810] = 0x778b, + [0x1811] = 0x7791, [0x1812] = 0x77a0, [0x1813] = 0x779e, [0x1814] = 0x77b0, + [0x1815] = 0x77b6, [0x1816] = 0x77b9, [0x1817] = 0x77bf, [0x1818] = 0x77bc, + [0x1819] = 0x77bd, [0x181a] = 0x77bb, [0x181b] = 0x77c7, [0x181c] = 0x77cd, + [0x181d] = 0x77d7, [0x181e] = 0x77da, [0x181f] = 0x77dc, [0x1820] = 0x77e3, + [0x1821] = 0x77ee, [0x1822] = 0x77fc, [0x1823] = 0x780c, [0x1824] = 0x7812, + [0x1825] = 0x7926, [0x1826] = 0x7820, [0x1827] = 0x792a, [0x1828] = 0x7845, + [0x1829] = 0x788e, [0x182a] = 0x7874, [0x182b] = 0x7886, [0x182c] = 0x787c, + [0x182d] = 0x789a, [0x182e] = 0x788c, [0x182f] = 0x78a3, [0x1830] = 0x78b5, + [0x1831] = 0x78aa, [0x1832] = 0x78af, [0x1833] = 0x78d1, [0x1834] = 0x78c6, + [0x1835] = 0x78cb, [0x1836] = 0x78d4, [0x1837] = 0x78be, [0x1838] = 0x78bc, + [0x1839] = 0x78c5, [0x183a] = 0x78ca, [0x183b] = 0x78ec, [0x183c] = 0x78e7, + [0x183d] = 0x78da, [0x183e] = 0x78fd, [0x183f] = 0x78f4, [0x1840] = 0x7907, + [0x1841] = 0x7912, [0x1842] = 0x7911, [0x1843] = 0x7919, [0x1844] = 0x792c, + [0x1845] = 0x792b, [0x1846] = 0x7940, [0x1847] = 0x7960, [0x1848] = 0x7957, + [0x1849] = 0x795f, [0x184a] = 0x795a, [0x184b] = 0x7955, [0x184c] = 0x7953, + [0x184d] = 0x797a, [0x184e] = 0x797f, [0x184f] = 0x798a, [0x1850] = 0x799d, + [0x1851] = 0x79a7, [0x1852] = 0x9f4b, [0x1853] = 0x79aa, [0x1854] = 0x79ae, + [0x1855] = 0x79b3, [0x1856] = 0x79b9, [0x1857] = 0x79ba, [0x1858] = 0x79c9, + [0x1859] = 0x79d5, [0x185a] = 0x79e7, [0x185b] = 0x79ec, [0x185c] = 0x79e1, + [0x185d] = 0x79e3, [0x185e] = 0x7a08, [0x185f] = 0x7a0d, [0x1860] = 0x7a18, + [0x1861] = 0x7a19, [0x1862] = 0x7a20, [0x1863] = 0x7a1f, [0x1864] = 0x7980, + [0x1865] = 0x7a31, [0x1866] = 0x7a3b, [0x1867] = 0x7a3e, [0x1868] = 0x7a37, + [0x1869] = 0x7a43, [0x186a] = 0x7a57, [0x186b] = 0x7a49, [0x186c] = 0x7a61, + [0x186d] = 0x7a62, [0x186e] = 0x7a69, [0x186f] = 0x9f9d, [0x1870] = 0x7a70, + [0x1871] = 0x7a79, [0x1872] = 0x7a7d, [0x1873] = 0x7a88, [0x1874] = 0x7a97, + [0x1875] = 0x7a95, [0x1876] = 0x7a98, [0x1877] = 0x7a96, [0x1878] = 0x7aa9, + [0x1879] = 0x7ac8, [0x187a] = 0x7ab0, [0x187b] = 0x7ab6, [0x187c] = 0x7ac5, + [0x187d] = 0x7ac4, [0x187e] = 0x7abf, [0x187f] = 0x9083, [0x1880] = 0x7ac7, + [0x1881] = 0x7aca, [0x1882] = 0x7acd, [0x1883] = 0x7acf, [0x1884] = 0x7ad5, + [0x1885] = 0x7ad3, [0x1886] = 0x7ad9, [0x1887] = 0x7ada, [0x1888] = 0x7add, + [0x1889] = 0x7ae1, [0x188a] = 0x7ae2, [0x188b] = 0x7ae6, [0x188c] = 0x7aed, + [0x188d] = 0x7af0, [0x188e] = 0x7b02, [0x188f] = 0x7b0f, [0x1890] = 0x7b0a, + [0x1891] = 0x7b06, [0x1892] = 0x7b33, [0x1893] = 0x7b18, [0x1894] = 0x7b19, + [0x1895] = 0x7b1e, [0x1896] = 0x7b35, [0x1897] = 0x7b28, [0x1898] = 0x7b36, + [0x1899] = 0x7b50, [0x189a] = 0x7b7a, [0x189b] = 0x7b04, [0x189c] = 0x7b4d, + [0x189d] = 0x7b0b, [0x189e] = 0x7b4c, [0x189f] = 0x7b45, [0x18a0] = 0x7b75, + [0x18a1] = 0x7b65, [0x18a2] = 0x7b74, [0x18a3] = 0x7b67, [0x18a4] = 0x7b70, + [0x18a5] = 0x7b71, [0x18a6] = 0x7b6c, [0x18a7] = 0x7b6e, [0x18a8] = 0x7b9d, + [0x18a9] = 0x7b98, [0x18aa] = 0x7b9f, [0x18ab] = 0x7b8d, [0x18ac] = 0x7b9c, + [0x18ad] = 0x7b9a, [0x18ae] = 0x7b8b, [0x18af] = 0x7b92, [0x18b0] = 0x7b8f, + [0x18b1] = 0x7b5d, [0x18b2] = 0x7b99, [0x18b3] = 0x7bcb, [0x18b4] = 0x7bc1, + [0x18b5] = 0x7bcc, [0x18b6] = 0x7bcf, [0x18b7] = 0x7bb4, [0x18b8] = 0x7bc6, + [0x18b9] = 0x7bdd, [0x18ba] = 0x7be9, [0x18bb] = 0x7c11, [0x18bc] = 0x7c14, + [0x18bd] = 0x7be6, [0x18be] = 0x7be5, [0x18bf] = 0x7c60, [0x18c0] = 0x7c00, + [0x18c1] = 0x7c07, [0x18c2] = 0x7c13, [0x18c3] = 0x7bf3, [0x18c4] = 0x7bf7, + [0x18c5] = 0x7c17, [0x18c6] = 0x7c0d, [0x18c7] = 0x7bf6, [0x18c8] = 0x7c23, + [0x18c9] = 0x7c27, [0x18ca] = 0x7c2a, [0x18cb] = 0x7c1f, [0x18cc] = 0x7c37, + [0x18cd] = 0x7c2b, [0x18ce] = 0x7c3d, [0x18cf] = 0x7c4c, [0x18d0] = 0x7c43, + [0x18d1] = 0x7c54, [0x18d2] = 0x7c4f, [0x18d3] = 0x7c40, [0x18d4] = 0x7c50, + [0x18d5] = 0x7c58, [0x18d6] = 0x7c5f, [0x18d7] = 0x7c64, [0x18d8] = 0x7c56, + [0x18d9] = 0x7c65, [0x18da] = 0x7c6c, [0x18db] = 0x7c75, [0x18dc] = 0x7c83, + [0x18dd] = 0x7c90, [0x18de] = 0x7ca4, [0x18df] = 0x7cad, [0x18e0] = 0x7ca2, + [0x18e1] = 0x7cab, [0x18e2] = 0x7ca1, [0x18e3] = 0x7ca8, [0x18e4] = 0x7cb3, + [0x18e5] = 0x7cb2, [0x18e6] = 0x7cb1, [0x18e7] = 0x7cae, [0x18e8] = 0x7cb9, + [0x18e9] = 0x7cbd, [0x18ea] = 0x7cc0, [0x18eb] = 0x7cc5, [0x18ec] = 0x7cc2, + [0x18ed] = 0x7cd8, [0x18ee] = 0x7cd2, [0x18ef] = 0x7cdc, [0x18f0] = 0x7ce2, + [0x18f1] = 0x9b3b, [0x18f2] = 0x7cef, [0x18f3] = 0x7cf2, [0x18f4] = 0x7cf4, + [0x18f5] = 0x7cf6, [0x18f6] = 0x7cfa, [0x18f7] = 0x7d06, [0x18f8] = 0x7d02, + [0x18f9] = 0x7d1c, [0x18fa] = 0x7d15, [0x18fb] = 0x7d0a, [0x18fc] = 0x7d45, + [0x18fd] = 0x7d4b, [0x18fe] = 0x7d2e, [0x18ff] = 0x7d32, [0x1900] = 0x7d3f, + [0x1901] = 0x7d35, [0x1902] = 0x7d46, [0x1903] = 0x7d73, [0x1904] = 0x7d56, + [0x1905] = 0x7d4e, [0x1906] = 0x7d72, [0x1907] = 0x7d68, [0x1908] = 0x7d6e, + [0x1909] = 0x7d4f, [0x190a] = 0x7d63, [0x190b] = 0x7d93, [0x190c] = 0x7d89, + [0x190d] = 0x7d5b, [0x190e] = 0x7d8f, [0x190f] = 0x7d7d, [0x1910] = 0x7d9b, + [0x1911] = 0x7dba, [0x1912] = 0x7dae, [0x1913] = 0x7da3, [0x1914] = 0x7db5, + [0x1915] = 0x7dc7, [0x1916] = 0x7dbd, [0x1917] = 0x7dab, [0x1918] = 0x7e3d, + [0x1919] = 0x7da2, [0x191a] = 0x7daf, [0x191b] = 0x7ddc, [0x191c] = 0x7db8, + [0x191d] = 0x7d9f, [0x191e] = 0x7db0, [0x191f] = 0x7dd8, [0x1920] = 0x7ddd, + [0x1921] = 0x7de4, [0x1922] = 0x7dde, [0x1923] = 0x7dfb, [0x1924] = 0x7df2, + [0x1925] = 0x7de1, [0x1926] = 0x7e05, [0x1927] = 0x7e0a, [0x1928] = 0x7e23, + [0x1929] = 0x7e21, [0x192a] = 0x7e12, [0x192b] = 0x7e31, [0x192c] = 0x7e1f, + [0x192d] = 0x7e09, [0x192e] = 0x7e0b, [0x192f] = 0x7e22, [0x1930] = 0x7e46, + [0x1931] = 0x7e66, [0x1932] = 0x7e3b, [0x1933] = 0x7e35, [0x1934] = 0x7e39, + [0x1935] = 0x7e43, [0x1936] = 0x7e37, [0x1937] = 0x7e32, [0x1938] = 0x7e3a, + [0x1939] = 0x7e67, [0x193a] = 0x7e5d, [0x193b] = 0x7e56, [0x193c] = 0x7e5e, + [0x193d] = 0x7e59, [0x193e] = 0x7e5a, [0x193f] = 0x7e79, [0x1940] = 0x7e6a, + [0x1941] = 0x7e69, [0x1942] = 0x7e7c, [0x1943] = 0x7e7b, [0x1944] = 0x7e83, + [0x1945] = 0x7dd5, [0x1946] = 0x7e7d, [0x1947] = 0x8fae, [0x1948] = 0x7e7f, + [0x1949] = 0x7e88, [0x194a] = 0x7e89, [0x194b] = 0x7e8c, [0x194c] = 0x7e92, + [0x194d] = 0x7e90, [0x194e] = 0x7e93, [0x194f] = 0x7e94, [0x1950] = 0x7e96, + [0x1951] = 0x7e8e, [0x1952] = 0x7e9b, [0x1953] = 0x7e9c, [0x1954] = 0x7f38, + [0x1955] = 0x7f3a, [0x1956] = 0x7f45, [0x1957] = 0x7f4c, [0x1958] = 0x7f4d, + [0x1959] = 0x7f4e, [0x195a] = 0x7f50, [0x195b] = 0x7f51, [0x195c] = 0x7f55, + [0x195d] = 0x7f54, [0x195e] = 0x7f58, [0x195f] = 0x7f5f, [0x1960] = 0x7f60, + [0x1961] = 0x7f68, [0x1962] = 0x7f69, [0x1963] = 0x7f67, [0x1964] = 0x7f78, + [0x1965] = 0x7f82, [0x1966] = 0x7f86, [0x1967] = 0x7f83, [0x1968] = 0x7f88, + [0x1969] = 0x7f87, [0x196a] = 0x7f8c, [0x196b] = 0x7f94, [0x196c] = 0x7f9e, + [0x196d] = 0x7f9d, [0x196e] = 0x7f9a, [0x196f] = 0x7fa3, [0x1970] = 0x7faf, + [0x1971] = 0x7fb2, [0x1972] = 0x7fb9, [0x1973] = 0x7fae, [0x1974] = 0x7fb6, + [0x1975] = 0x7fb8, [0x1976] = 0x8b71, [0x1977] = 0x7fc5, [0x1978] = 0x7fc6, + [0x1979] = 0x7fca, [0x197a] = 0x7fd5, [0x197b] = 0x7fd4, [0x197c] = 0x7fe1, + [0x197d] = 0x7fe6, [0x197e] = 0x7fe9, [0x197f] = 0x7ff3, [0x1980] = 0x7ff9, + [0x1981] = 0x98dc, [0x1982] = 0x8006, [0x1983] = 0x8004, [0x1984] = 0x800b, + [0x1985] = 0x8012, [0x1986] = 0x8018, [0x1987] = 0x8019, [0x1988] = 0x801c, + [0x1989] = 0x8021, [0x198a] = 0x8028, [0x198b] = 0x803f, [0x198c] = 0x803b, + [0x198d] = 0x804a, [0x198e] = 0x8046, [0x198f] = 0x8052, [0x1990] = 0x8058, + [0x1991] = 0x805a, [0x1992] = 0x805f, [0x1993] = 0x8062, [0x1994] = 0x8068, + [0x1995] = 0x8073, [0x1996] = 0x8072, [0x1997] = 0x8070, [0x1998] = 0x8076, + [0x1999] = 0x8079, [0x199a] = 0x807d, [0x199b] = 0x807f, [0x199c] = 0x8084, + [0x199d] = 0x8086, [0x199e] = 0x8085, [0x199f] = 0x809b, [0x19a0] = 0x8093, + [0x19a1] = 0x809a, [0x19a2] = 0x80ad, [0x19a3] = 0x5190, [0x19a4] = 0x80ac, + [0x19a5] = 0x80db, [0x19a6] = 0x80e5, [0x19a7] = 0x80d9, [0x19a8] = 0x80dd, + [0x19a9] = 0x80c4, [0x19aa] = 0x80da, [0x19ab] = 0x80d6, [0x19ac] = 0x8109, + [0x19ad] = 0x80ef, [0x19ae] = 0x80f1, [0x19af] = 0x811b, [0x19b0] = 0x8129, + [0x19b1] = 0x8123, [0x19b2] = 0x812f, [0x19b3] = 0x814b, [0x19b4] = 0x968b, + [0x19b5] = 0x8146, [0x19b6] = 0x813e, [0x19b7] = 0x8153, [0x19b8] = 0x8151, + [0x19b9] = 0x80fc, [0x19ba] = 0x8171, [0x19bb] = 0x816e, [0x19bc] = 0x8165, + [0x19bd] = 0x8166, [0x19be] = 0x8174, [0x19bf] = 0x8183, [0x19c0] = 0x8188, + [0x19c1] = 0x818a, [0x19c2] = 0x8180, [0x19c3] = 0x8182, [0x19c4] = 0x81a0, + [0x19c5] = 0x8195, [0x19c6] = 0x81a4, [0x19c7] = 0x81a3, [0x19c8] = 0x815f, + [0x19c9] = 0x8193, [0x19ca] = 0x81a9, [0x19cb] = 0x81b0, [0x19cc] = 0x81b5, + [0x19cd] = 0x81be, [0x19ce] = 0x81b8, [0x19cf] = 0x81bd, [0x19d0] = 0x81c0, + [0x19d1] = 0x81c2, [0x19d2] = 0x81ba, [0x19d3] = 0x81c9, [0x19d4] = 0x81cd, + [0x19d5] = 0x81d1, [0x19d6] = 0x81d9, [0x19d7] = 0x81d8, [0x19d8] = 0x81c8, + [0x19d9] = 0x81da, [0x19da] = 0x81df, [0x19db] = 0x81e0, [0x19dc] = 0x81e7, + [0x19dd] = 0x81fa, [0x19de] = 0x81fb, [0x19df] = 0x81fe, [0x19e0] = 0x8201, + [0x19e1] = 0x8202, [0x19e2] = 0x8205, [0x19e3] = 0x8207, [0x19e4] = 0x820a, + [0x19e5] = 0x820d, [0x19e6] = 0x8210, [0x19e7] = 0x8216, [0x19e8] = 0x8229, + [0x19e9] = 0x822b, [0x19ea] = 0x8238, [0x19eb] = 0x8233, [0x19ec] = 0x8240, + [0x19ed] = 0x8259, [0x19ee] = 0x8258, [0x19ef] = 0x825d, [0x19f0] = 0x825a, + [0x19f1] = 0x825f, [0x19f2] = 0x8264, [0x19f3] = 0x8262, [0x19f4] = 0x8268, + [0x19f5] = 0x826a, [0x19f6] = 0x826b, [0x19f7] = 0x822e, [0x19f8] = 0x8271, + [0x19f9] = 0x8277, [0x19fa] = 0x8278, [0x19fb] = 0x827e, [0x19fc] = 0x828d, + [0x19fd] = 0x8292, [0x19fe] = 0x82ab, [0x19ff] = 0x829f, [0x1a00] = 0x82bb, + [0x1a01] = 0x82ac, [0x1a02] = 0x82e1, [0x1a03] = 0x82e3, [0x1a04] = 0x82df, + [0x1a05] = 0x82d2, [0x1a06] = 0x82f4, [0x1a07] = 0x82f3, [0x1a08] = 0x82fa, + [0x1a09] = 0x8393, [0x1a0a] = 0x8303, [0x1a0b] = 0x82fb, [0x1a0c] = 0x82f9, + [0x1a0d] = 0x82de, [0x1a0e] = 0x8306, [0x1a0f] = 0x82dc, [0x1a10] = 0x8309, + [0x1a11] = 0x82d9, [0x1a12] = 0x8335, [0x1a13] = 0x8334, [0x1a14] = 0x8316, + [0x1a15] = 0x8332, [0x1a16] = 0x8331, [0x1a17] = 0x8340, [0x1a18] = 0x8339, + [0x1a19] = 0x8350, [0x1a1a] = 0x8345, [0x1a1b] = 0x832f, [0x1a1c] = 0x832b, + [0x1a1d] = 0x8317, [0x1a1e] = 0x8318, [0x1a1f] = 0x8385, [0x1a20] = 0x839a, + [0x1a21] = 0x83aa, [0x1a22] = 0x839f, [0x1a23] = 0x83a2, [0x1a24] = 0x8396, + [0x1a25] = 0x8323, [0x1a26] = 0x838e, [0x1a27] = 0x8387, [0x1a28] = 0x838a, + [0x1a29] = 0x837c, [0x1a2a] = 0x83b5, [0x1a2b] = 0x8373, [0x1a2c] = 0x8375, + [0x1a2d] = 0x83a0, [0x1a2e] = 0x8389, [0x1a2f] = 0x83a8, [0x1a30] = 0x83f4, + [0x1a31] = 0x8413, [0x1a32] = 0x83eb, [0x1a33] = 0x83ce, [0x1a34] = 0x83fd, + [0x1a35] = 0x8403, [0x1a36] = 0x83d8, [0x1a37] = 0x840b, [0x1a38] = 0x83c1, + [0x1a39] = 0x83f7, [0x1a3a] = 0x8407, [0x1a3b] = 0x83e0, [0x1a3c] = 0x83f2, + [0x1a3d] = 0x840d, [0x1a3e] = 0x8422, [0x1a3f] = 0x8420, [0x1a40] = 0x83bd, + [0x1a41] = 0x8438, [0x1a42] = 0x8506, [0x1a43] = 0x83fb, [0x1a44] = 0x846d, + [0x1a45] = 0x842a, [0x1a46] = 0x843c, [0x1a47] = 0x855a, [0x1a48] = 0x8484, + [0x1a49] = 0x8477, [0x1a4a] = 0x846b, [0x1a4b] = 0x84ad, [0x1a4c] = 0x846e, + [0x1a4d] = 0x8482, [0x1a4e] = 0x8469, [0x1a4f] = 0x8446, [0x1a50] = 0x842c, + [0x1a51] = 0x846f, [0x1a52] = 0x8479, [0x1a53] = 0x8435, [0x1a54] = 0x84ca, + [0x1a55] = 0x8462, [0x1a56] = 0x84b9, [0x1a57] = 0x84bf, [0x1a58] = 0x849f, + [0x1a59] = 0x84d9, [0x1a5a] = 0x84cd, [0x1a5b] = 0x84bb, [0x1a5c] = 0x84da, + [0x1a5d] = 0x84d0, [0x1a5e] = 0x84c1, [0x1a5f] = 0x84c6, [0x1a60] = 0x84d6, + [0x1a61] = 0x84a1, [0x1a62] = 0x8521, [0x1a63] = 0x84ff, [0x1a64] = 0x84f4, + [0x1a65] = 0x8517, [0x1a66] = 0x8518, [0x1a67] = 0x852c, [0x1a68] = 0x851f, + [0x1a69] = 0x8515, [0x1a6a] = 0x8514, [0x1a6b] = 0x84fc, [0x1a6c] = 0x8540, + [0x1a6d] = 0x8563, [0x1a6e] = 0x8558, [0x1a6f] = 0x8548, [0x1a70] = 0x8541, + [0x1a71] = 0x8602, [0x1a72] = 0x854b, [0x1a73] = 0x8555, [0x1a74] = 0x8580, + [0x1a75] = 0x85a4, [0x1a76] = 0x8588, [0x1a77] = 0x8591, [0x1a78] = 0x858a, + [0x1a79] = 0x85a8, [0x1a7a] = 0x856d, [0x1a7b] = 0x8594, [0x1a7c] = 0x859b, + [0x1a7d] = 0x85ea, [0x1a7e] = 0x8587, [0x1a7f] = 0x859c, [0x1a80] = 0x8577, + [0x1a81] = 0x857e, [0x1a82] = 0x8590, [0x1a83] = 0x85c9, [0x1a84] = 0x85ba, + [0x1a85] = 0x85cf, [0x1a86] = 0x85b9, [0x1a87] = 0x85d0, [0x1a88] = 0x85d5, + [0x1a89] = 0x85dd, [0x1a8a] = 0x85e5, [0x1a8b] = 0x85dc, [0x1a8c] = 0x85f9, + [0x1a8d] = 0x860a, [0x1a8e] = 0x8613, [0x1a8f] = 0x860b, [0x1a90] = 0x85fe, + [0x1a91] = 0x85fa, [0x1a92] = 0x8606, [0x1a93] = 0x8622, [0x1a94] = 0x861a, + [0x1a95] = 0x8630, [0x1a96] = 0x863f, [0x1a97] = 0x864d, [0x1a98] = 0x4e55, + [0x1a99] = 0x8654, [0x1a9a] = 0x865f, [0x1a9b] = 0x8667, [0x1a9c] = 0x8671, + [0x1a9d] = 0x8693, [0x1a9e] = 0x86a3, [0x1a9f] = 0x86a9, [0x1aa0] = 0x86aa, + [0x1aa1] = 0x868b, [0x1aa2] = 0x868c, [0x1aa3] = 0x86b6, [0x1aa4] = 0x86af, + [0x1aa5] = 0x86c4, [0x1aa6] = 0x86c6, [0x1aa7] = 0x86b0, [0x1aa8] = 0x86c9, + [0x1aa9] = 0x8823, [0x1aaa] = 0x86ab, [0x1aab] = 0x86d4, [0x1aac] = 0x86de, + [0x1aad] = 0x86e9, [0x1aae] = 0x86ec, [0x1aaf] = 0x86df, [0x1ab0] = 0x86db, + [0x1ab1] = 0x86ef, [0x1ab2] = 0x8712, [0x1ab3] = 0x8706, [0x1ab4] = 0x8708, + [0x1ab5] = 0x8700, [0x1ab6] = 0x8703, [0x1ab7] = 0x86fb, [0x1ab8] = 0x8711, + [0x1ab9] = 0x8709, [0x1aba] = 0x870d, [0x1abb] = 0x86f9, [0x1abc] = 0x870a, + [0x1abd] = 0x8734, [0x1abe] = 0x873f, [0x1abf] = 0x8737, [0x1ac0] = 0x873b, + [0x1ac1] = 0x8725, [0x1ac2] = 0x8729, [0x1ac3] = 0x871a, [0x1ac4] = 0x8760, + [0x1ac5] = 0x875f, [0x1ac6] = 0x8778, [0x1ac7] = 0x874c, [0x1ac8] = 0x874e, + [0x1ac9] = 0x8774, [0x1aca] = 0x8757, [0x1acb] = 0x8768, [0x1acc] = 0x876e, + [0x1acd] = 0x8759, [0x1ace] = 0x8753, [0x1acf] = 0x8763, [0x1ad0] = 0x876a, + [0x1ad1] = 0x8805, [0x1ad2] = 0x87a2, [0x1ad3] = 0x879f, [0x1ad4] = 0x8782, + [0x1ad5] = 0x87af, [0x1ad6] = 0x87cb, [0x1ad7] = 0x87bd, [0x1ad8] = 0x87c0, + [0x1ad9] = 0x87d0, [0x1ada] = 0x96d6, [0x1adb] = 0x87ab, [0x1adc] = 0x87c4, + [0x1add] = 0x87b3, [0x1ade] = 0x87c7, [0x1adf] = 0x87c6, [0x1ae0] = 0x87bb, + [0x1ae1] = 0x87ef, [0x1ae2] = 0x87f2, [0x1ae3] = 0x87e0, [0x1ae4] = 0x880f, + [0x1ae5] = 0x880d, [0x1ae6] = 0x87fe, [0x1ae7] = 0x87f6, [0x1ae8] = 0x87f7, + [0x1ae9] = 0x880e, [0x1aea] = 0x87d2, [0x1aeb] = 0x8811, [0x1aec] = 0x8816, + [0x1aed] = 0x8815, [0x1aee] = 0x8822, [0x1aef] = 0x8821, [0x1af0] = 0x8831, + [0x1af1] = 0x8836, [0x1af2] = 0x8839, [0x1af3] = 0x8827, [0x1af4] = 0x883b, + [0x1af5] = 0x8844, [0x1af6] = 0x8842, [0x1af7] = 0x8852, [0x1af8] = 0x8859, + [0x1af9] = 0x885e, [0x1afa] = 0x8862, [0x1afb] = 0x886b, [0x1afc] = 0x8881, + [0x1afd] = 0x887e, [0x1afe] = 0x889e, [0x1aff] = 0x8875, [0x1b00] = 0x887d, + [0x1b01] = 0x88b5, [0x1b02] = 0x8872, [0x1b03] = 0x8882, [0x1b04] = 0x8897, + [0x1b05] = 0x8892, [0x1b06] = 0x88ae, [0x1b07] = 0x8899, [0x1b08] = 0x88a2, + [0x1b09] = 0x888d, [0x1b0a] = 0x88a4, [0x1b0b] = 0x88b0, [0x1b0c] = 0x88bf, + [0x1b0d] = 0x88b1, [0x1b0e] = 0x88c3, [0x1b0f] = 0x88c4, [0x1b10] = 0x88d4, + [0x1b11] = 0x88d8, [0x1b12] = 0x88d9, [0x1b13] = 0x88dd, [0x1b14] = 0x88f9, + [0x1b15] = 0x8902, [0x1b16] = 0x88fc, [0x1b17] = 0x88f4, [0x1b18] = 0x88e8, + [0x1b19] = 0x88f2, [0x1b1a] = 0x8904, [0x1b1b] = 0x890c, [0x1b1c] = 0x890a, + [0x1b1d] = 0x8913, [0x1b1e] = 0x8943, [0x1b1f] = 0x891e, [0x1b20] = 0x8925, + [0x1b21] = 0x892a, [0x1b22] = 0x892b, [0x1b23] = 0x8941, [0x1b24] = 0x8944, + [0x1b25] = 0x893b, [0x1b26] = 0x8936, [0x1b27] = 0x8938, [0x1b28] = 0x894c, + [0x1b29] = 0x891d, [0x1b2a] = 0x8960, [0x1b2b] = 0x895e, [0x1b2c] = 0x8966, + [0x1b2d] = 0x8964, [0x1b2e] = 0x896d, [0x1b2f] = 0x896a, [0x1b30] = 0x896f, + [0x1b31] = 0x8974, [0x1b32] = 0x8977, [0x1b33] = 0x897e, [0x1b34] = 0x8983, + [0x1b35] = 0x8988, [0x1b36] = 0x898a, [0x1b37] = 0x8993, [0x1b38] = 0x8998, + [0x1b39] = 0x89a1, [0x1b3a] = 0x89a9, [0x1b3b] = 0x89a6, [0x1b3c] = 0x89ac, + [0x1b3d] = 0x89af, [0x1b3e] = 0x89b2, [0x1b3f] = 0x89ba, [0x1b40] = 0x89bd, + [0x1b41] = 0x89bf, [0x1b42] = 0x89c0, [0x1b43] = 0x89da, [0x1b44] = 0x89dc, + [0x1b45] = 0x89dd, [0x1b46] = 0x89e7, [0x1b47] = 0x89f4, [0x1b48] = 0x89f8, + [0x1b49] = 0x8a03, [0x1b4a] = 0x8a16, [0x1b4b] = 0x8a10, [0x1b4c] = 0x8a0c, + [0x1b4d] = 0x8a1b, [0x1b4e] = 0x8a1d, [0x1b4f] = 0x8a25, [0x1b50] = 0x8a36, + [0x1b51] = 0x8a41, [0x1b52] = 0x8a5b, [0x1b53] = 0x8a52, [0x1b54] = 0x8a46, + [0x1b55] = 0x8a48, [0x1b56] = 0x8a7c, [0x1b57] = 0x8a6d, [0x1b58] = 0x8a6c, + [0x1b59] = 0x8a62, [0x1b5a] = 0x8a85, [0x1b5b] = 0x8a82, [0x1b5c] = 0x8a84, + [0x1b5d] = 0x8aa8, [0x1b5e] = 0x8aa1, [0x1b5f] = 0x8a91, [0x1b60] = 0x8aa5, + [0x1b61] = 0x8aa6, [0x1b62] = 0x8a9a, [0x1b63] = 0x8aa3, [0x1b64] = 0x8ac4, + [0x1b65] = 0x8acd, [0x1b66] = 0x8ac2, [0x1b67] = 0x8ada, [0x1b68] = 0x8aeb, + [0x1b69] = 0x8af3, [0x1b6a] = 0x8ae7, [0x1b6b] = 0x8ae4, [0x1b6c] = 0x8af1, + [0x1b6d] = 0x8b14, [0x1b6e] = 0x8ae0, [0x1b6f] = 0x8ae2, [0x1b70] = 0x8af7, + [0x1b71] = 0x8ade, [0x1b72] = 0x8adb, [0x1b73] = 0x8b0c, [0x1b74] = 0x8b07, + [0x1b75] = 0x8b1a, [0x1b76] = 0x8ae1, [0x1b77] = 0x8b16, [0x1b78] = 0x8b10, + [0x1b79] = 0x8b17, [0x1b7a] = 0x8b20, [0x1b7b] = 0x8b33, [0x1b7c] = 0x97ab, + [0x1b7d] = 0x8b26, [0x1b7e] = 0x8b2b, [0x1b7f] = 0x8b3e, [0x1b80] = 0x8b28, + [0x1b81] = 0x8b41, [0x1b82] = 0x8b4c, [0x1b83] = 0x8b4f, [0x1b84] = 0x8b4e, + [0x1b85] = 0x8b49, [0x1b86] = 0x8b56, [0x1b87] = 0x8b5b, [0x1b88] = 0x8b5a, + [0x1b89] = 0x8b6b, [0x1b8a] = 0x8b5f, [0x1b8b] = 0x8b6c, [0x1b8c] = 0x8b6f, + [0x1b8d] = 0x8b74, [0x1b8e] = 0x8b7d, [0x1b8f] = 0x8b80, [0x1b90] = 0x8b8c, + [0x1b91] = 0x8b8e, [0x1b92] = 0x8b92, [0x1b93] = 0x8b93, [0x1b94] = 0x8b96, + [0x1b95] = 0x8b99, [0x1b96] = 0x8b9a, [0x1b97] = 0x8c3a, [0x1b98] = 0x8c41, + [0x1b99] = 0x8c3f, [0x1b9a] = 0x8c48, [0x1b9b] = 0x8c4c, [0x1b9c] = 0x8c4e, + [0x1b9d] = 0x8c50, [0x1b9e] = 0x8c55, [0x1b9f] = 0x8c62, [0x1ba0] = 0x8c6c, + [0x1ba1] = 0x8c78, [0x1ba2] = 0x8c7a, [0x1ba3] = 0x8c82, [0x1ba4] = 0x8c89, + [0x1ba5] = 0x8c85, [0x1ba6] = 0x8c8a, [0x1ba7] = 0x8c8d, [0x1ba8] = 0x8c8e, + [0x1ba9] = 0x8c94, [0x1baa] = 0x8c7c, [0x1bab] = 0x8c98, [0x1bac] = 0x621d, + [0x1bad] = 0x8cad, [0x1bae] = 0x8caa, [0x1baf] = 0x8cbd, [0x1bb0] = 0x8cb2, + [0x1bb1] = 0x8cb3, [0x1bb2] = 0x8cae, [0x1bb3] = 0x8cb6, [0x1bb4] = 0x8cc8, + [0x1bb5] = 0x8cc1, [0x1bb6] = 0x8ce4, [0x1bb7] = 0x8ce3, [0x1bb8] = 0x8cda, + [0x1bb9] = 0x8cfd, [0x1bba] = 0x8cfa, [0x1bbb] = 0x8cfb, [0x1bbc] = 0x8d04, + [0x1bbd] = 0x8d05, [0x1bbe] = 0x8d0a, [0x1bbf] = 0x8d07, [0x1bc0] = 0x8d0f, + [0x1bc1] = 0x8d0d, [0x1bc2] = 0x8d10, [0x1bc3] = 0x9f4e, [0x1bc4] = 0x8d13, + [0x1bc5] = 0x8ccd, [0x1bc6] = 0x8d14, [0x1bc7] = 0x8d16, [0x1bc8] = 0x8d67, + [0x1bc9] = 0x8d6d, [0x1bca] = 0x8d71, [0x1bcb] = 0x8d73, [0x1bcc] = 0x8d81, + [0x1bcd] = 0x8d99, [0x1bce] = 0x8dc2, [0x1bcf] = 0x8dbe, [0x1bd0] = 0x8dba, + [0x1bd1] = 0x8dcf, [0x1bd2] = 0x8dda, [0x1bd3] = 0x8dd6, [0x1bd4] = 0x8dcc, + [0x1bd5] = 0x8ddb, [0x1bd6] = 0x8dcb, [0x1bd7] = 0x8dea, [0x1bd8] = 0x8deb, + [0x1bd9] = 0x8ddf, [0x1bda] = 0x8de3, [0x1bdb] = 0x8dfc, [0x1bdc] = 0x8e08, + [0x1bdd] = 0x8e09, [0x1bde] = 0x8dff, [0x1bdf] = 0x8e1d, [0x1be0] = 0x8e1e, + [0x1be1] = 0x8e10, [0x1be2] = 0x8e1f, [0x1be3] = 0x8e42, [0x1be4] = 0x8e35, + [0x1be5] = 0x8e30, [0x1be6] = 0x8e34, [0x1be7] = 0x8e4a, [0x1be8] = 0x8e47, + [0x1be9] = 0x8e49, [0x1bea] = 0x8e4c, [0x1beb] = 0x8e50, [0x1bec] = 0x8e48, + [0x1bed] = 0x8e59, [0x1bee] = 0x8e64, [0x1bef] = 0x8e60, [0x1bf0] = 0x8e2a, + [0x1bf1] = 0x8e63, [0x1bf2] = 0x8e55, [0x1bf3] = 0x8e76, [0x1bf4] = 0x8e72, + [0x1bf5] = 0x8e7c, [0x1bf6] = 0x8e81, [0x1bf7] = 0x8e87, [0x1bf8] = 0x8e85, + [0x1bf9] = 0x8e84, [0x1bfa] = 0x8e8b, [0x1bfb] = 0x8e8a, [0x1bfc] = 0x8e93, + [0x1bfd] = 0x8e91, [0x1bfe] = 0x8e94, [0x1bff] = 0x8e99, [0x1c00] = 0x8eaa, + [0x1c01] = 0x8ea1, [0x1c02] = 0x8eac, [0x1c03] = 0x8eb0, [0x1c04] = 0x8ec6, + [0x1c05] = 0x8eb1, [0x1c06] = 0x8ebe, [0x1c07] = 0x8ec5, [0x1c08] = 0x8ec8, + [0x1c09] = 0x8ecb, [0x1c0a] = 0x8edb, [0x1c0b] = 0x8ee3, [0x1c0c] = 0x8efc, + [0x1c0d] = 0x8efb, [0x1c0e] = 0x8eeb, [0x1c0f] = 0x8efe, [0x1c10] = 0x8f0a, + [0x1c11] = 0x8f05, [0x1c12] = 0x8f15, [0x1c13] = 0x8f12, [0x1c14] = 0x8f19, + [0x1c15] = 0x8f13, [0x1c16] = 0x8f1c, [0x1c17] = 0x8f1f, [0x1c18] = 0x8f1b, + [0x1c19] = 0x8f0c, [0x1c1a] = 0x8f26, [0x1c1b] = 0x8f33, [0x1c1c] = 0x8f3b, + [0x1c1d] = 0x8f39, [0x1c1e] = 0x8f45, [0x1c1f] = 0x8f42, [0x1c20] = 0x8f3e, + [0x1c21] = 0x8f4c, [0x1c22] = 0x8f49, [0x1c23] = 0x8f46, [0x1c24] = 0x8f4e, + [0x1c25] = 0x8f57, [0x1c26] = 0x8f5c, [0x1c27] = 0x8f62, [0x1c28] = 0x8f63, + [0x1c29] = 0x8f64, [0x1c2a] = 0x8f9c, [0x1c2b] = 0x8f9f, [0x1c2c] = 0x8fa3, + [0x1c2d] = 0x8fad, [0x1c2e] = 0x8faf, [0x1c2f] = 0x8fb7, [0x1c30] = 0x8fda, + [0x1c31] = 0x8fe5, [0x1c32] = 0x8fe2, [0x1c33] = 0x8fea, [0x1c34] = 0x8fef, + [0x1c35] = 0x9087, [0x1c36] = 0x8ff4, [0x1c37] = 0x9005, [0x1c38] = 0x8ff9, + [0x1c39] = 0x8ffa, [0x1c3a] = 0x9011, [0x1c3b] = 0x9015, [0x1c3c] = 0x9021, + [0x1c3d] = 0x900d, [0x1c3e] = 0x901e, [0x1c3f] = 0x9016, [0x1c40] = 0x900b, + [0x1c41] = 0x9027, [0x1c42] = 0x9036, [0x1c43] = 0x9035, [0x1c44] = 0x9039, + [0x1c45] = 0x8ff8, [0x1c46] = 0x904f, [0x1c47] = 0x9050, [0x1c48] = 0x9051, + [0x1c49] = 0x9052, [0x1c4a] = 0x900e, [0x1c4b] = 0x9049, [0x1c4c] = 0x903e, + [0x1c4d] = 0x9056, [0x1c4e] = 0x9058, [0x1c4f] = 0x905e, [0x1c50] = 0x9068, + [0x1c51] = 0x906f, [0x1c52] = 0x9076, [0x1c53] = 0x96a8, [0x1c54] = 0x9072, + [0x1c55] = 0x9082, [0x1c56] = 0x907d, [0x1c57] = 0x9081, [0x1c58] = 0x9080, + [0x1c59] = 0x908a, [0x1c5a] = 0x9089, [0x1c5b] = 0x908f, [0x1c5c] = 0x90a8, + [0x1c5d] = 0x90af, [0x1c5e] = 0x90b1, [0x1c5f] = 0x90b5, [0x1c60] = 0x90e2, + [0x1c61] = 0x90e4, [0x1c62] = 0x6248, [0x1c63] = 0x90db, [0x1c64] = 0x9102, + [0x1c65] = 0x9112, [0x1c66] = 0x9119, [0x1c67] = 0x9132, [0x1c68] = 0x9130, + [0x1c69] = 0x914a, [0x1c6a] = 0x9156, [0x1c6b] = 0x9158, [0x1c6c] = 0x9163, + [0x1c6d] = 0x9165, [0x1c6e] = 0x9169, [0x1c6f] = 0x9173, [0x1c70] = 0x9172, + [0x1c71] = 0x918b, [0x1c72] = 0x9189, [0x1c73] = 0x9182, [0x1c74] = 0x91a2, + [0x1c75] = 0x91ab, [0x1c76] = 0x91af, [0x1c77] = 0x91aa, [0x1c78] = 0x91b5, + [0x1c79] = 0x91b4, [0x1c7a] = 0x91ba, [0x1c7b] = 0x91c0, [0x1c7c] = 0x91c1, + [0x1c7d] = 0x91c9, [0x1c7e] = 0x91cb, [0x1c7f] = 0x91d0, [0x1c80] = 0x91d6, + [0x1c81] = 0x91df, [0x1c82] = 0x91e1, [0x1c83] = 0x91db, [0x1c84] = 0x91fc, + [0x1c85] = 0x91f5, [0x1c86] = 0x91f6, [0x1c87] = 0x921e, [0x1c88] = 0x91ff, + [0x1c89] = 0x9214, [0x1c8a] = 0x922c, [0x1c8b] = 0x9215, [0x1c8c] = 0x9211, + [0x1c8d] = 0x925e, [0x1c8e] = 0x9257, [0x1c8f] = 0x9245, [0x1c90] = 0x9249, + [0x1c91] = 0x9264, [0x1c92] = 0x9248, [0x1c93] = 0x9295, [0x1c94] = 0x923f, + [0x1c95] = 0x924b, [0x1c96] = 0x9250, [0x1c97] = 0x929c, [0x1c98] = 0x9296, + [0x1c99] = 0x9293, [0x1c9a] = 0x929b, [0x1c9b] = 0x925a, [0x1c9c] = 0x92cf, + [0x1c9d] = 0x92b9, [0x1c9e] = 0x92b7, [0x1c9f] = 0x92e9, [0x1ca0] = 0x930f, + [0x1ca1] = 0x92fa, [0x1ca2] = 0x9344, [0x1ca3] = 0x932e, [0x1ca4] = 0x9319, + [0x1ca5] = 0x9322, [0x1ca6] = 0x931a, [0x1ca7] = 0x9323, [0x1ca8] = 0x933a, + [0x1ca9] = 0x9335, [0x1caa] = 0x933b, [0x1cab] = 0x935c, [0x1cac] = 0x9360, + [0x1cad] = 0x937c, [0x1cae] = 0x936e, [0x1caf] = 0x9356, [0x1cb0] = 0x93b0, + [0x1cb1] = 0x93ac, [0x1cb2] = 0x93ad, [0x1cb3] = 0x9394, [0x1cb4] = 0x93b9, + [0x1cb5] = 0x93d6, [0x1cb6] = 0x93d7, [0x1cb7] = 0x93e8, [0x1cb8] = 0x93e5, + [0x1cb9] = 0x93d8, [0x1cba] = 0x93c3, [0x1cbb] = 0x93dd, [0x1cbc] = 0x93d0, + [0x1cbd] = 0x93c8, [0x1cbe] = 0x93e4, [0x1cbf] = 0x941a, [0x1cc0] = 0x9414, + [0x1cc1] = 0x9413, [0x1cc2] = 0x9403, [0x1cc3] = 0x9407, [0x1cc4] = 0x9410, + [0x1cc5] = 0x9436, [0x1cc6] = 0x942b, [0x1cc7] = 0x9435, [0x1cc8] = 0x9421, + [0x1cc9] = 0x943a, [0x1cca] = 0x9441, [0x1ccb] = 0x9452, [0x1ccc] = 0x9444, + [0x1ccd] = 0x945b, [0x1cce] = 0x9460, [0x1ccf] = 0x9462, [0x1cd0] = 0x945e, + [0x1cd1] = 0x946a, [0x1cd2] = 0x9229, [0x1cd3] = 0x9470, [0x1cd4] = 0x9475, + [0x1cd5] = 0x9477, [0x1cd6] = 0x947d, [0x1cd7] = 0x945a, [0x1cd8] = 0x947c, + [0x1cd9] = 0x947e, [0x1cda] = 0x9481, [0x1cdb] = 0x947f, [0x1cdc] = 0x9582, + [0x1cdd] = 0x9587, [0x1cde] = 0x958a, [0x1cdf] = 0x9594, [0x1ce0] = 0x9596, + [0x1ce1] = 0x9598, [0x1ce2] = 0x9599, [0x1ce3] = 0x95a0, [0x1ce4] = 0x95a8, + [0x1ce5] = 0x95a7, [0x1ce6] = 0x95ad, [0x1ce7] = 0x95bc, [0x1ce8] = 0x95bb, + [0x1ce9] = 0x95b9, [0x1cea] = 0x95be, [0x1ceb] = 0x95ca, [0x1cec] = 0x6ff6, + [0x1ced] = 0x95c3, [0x1cee] = 0x95cd, [0x1cef] = 0x95cc, [0x1cf0] = 0x95d5, + [0x1cf1] = 0x95d4, [0x1cf2] = 0x95d6, [0x1cf3] = 0x95dc, [0x1cf4] = 0x95e1, + [0x1cf5] = 0x95e5, [0x1cf6] = 0x95e2, [0x1cf7] = 0x9621, [0x1cf8] = 0x9628, + [0x1cf9] = 0x962e, [0x1cfa] = 0x962f, [0x1cfb] = 0x9642, [0x1cfc] = 0x964c, + [0x1cfd] = 0x964f, [0x1cfe] = 0x964b, [0x1cff] = 0x9677, [0x1d00] = 0x965c, + [0x1d01] = 0x965e, [0x1d02] = 0x965d, [0x1d03] = 0x965f, [0x1d04] = 0x9666, + [0x1d05] = 0x9672, [0x1d06] = 0x966c, [0x1d07] = 0x968d, [0x1d08] = 0x9698, + [0x1d09] = 0x9695, [0x1d0a] = 0x9697, [0x1d0b] = 0x96aa, [0x1d0c] = 0x96a7, + [0x1d0d] = 0x96b1, [0x1d0e] = 0x96b2, [0x1d0f] = 0x96b0, [0x1d10] = 0x96b4, + [0x1d11] = 0x96b6, [0x1d12] = 0x96b8, [0x1d13] = 0x96b9, [0x1d14] = 0x96ce, + [0x1d15] = 0x96cb, [0x1d16] = 0x96c9, [0x1d17] = 0x96cd, [0x1d18] = 0x894d, + [0x1d19] = 0x96dc, [0x1d1a] = 0x970d, [0x1d1b] = 0x96d5, [0x1d1c] = 0x96f9, + [0x1d1d] = 0x9704, [0x1d1e] = 0x9706, [0x1d1f] = 0x9708, [0x1d20] = 0x9713, + [0x1d21] = 0x970e, [0x1d22] = 0x9711, [0x1d23] = 0x970f, [0x1d24] = 0x9716, + [0x1d25] = 0x9719, [0x1d26] = 0x9724, [0x1d27] = 0x972a, [0x1d28] = 0x9730, + [0x1d29] = 0x9739, [0x1d2a] = 0x973d, [0x1d2b] = 0x973e, [0x1d2c] = 0x9744, + [0x1d2d] = 0x9746, [0x1d2e] = 0x9748, [0x1d2f] = 0x9742, [0x1d30] = 0x9749, + [0x1d31] = 0x975c, [0x1d32] = 0x9760, [0x1d33] = 0x9764, [0x1d34] = 0x9766, + [0x1d35] = 0x9768, [0x1d36] = 0x52d2, [0x1d37] = 0x976b, [0x1d38] = 0x9771, + [0x1d39] = 0x9779, [0x1d3a] = 0x9785, [0x1d3b] = 0x977c, [0x1d3c] = 0x9781, + [0x1d3d] = 0x977a, [0x1d3e] = 0x9786, [0x1d3f] = 0x978b, [0x1d40] = 0x978f, + [0x1d41] = 0x9790, [0x1d42] = 0x979c, [0x1d43] = 0x97a8, [0x1d44] = 0x97a6, + [0x1d45] = 0x97a3, [0x1d46] = 0x97b3, [0x1d47] = 0x97b4, [0x1d48] = 0x97c3, + [0x1d49] = 0x97c6, [0x1d4a] = 0x97c8, [0x1d4b] = 0x97cb, [0x1d4c] = 0x97dc, + [0x1d4d] = 0x97ed, [0x1d4e] = 0x9f4f, [0x1d4f] = 0x97f2, [0x1d50] = 0x7adf, + [0x1d51] = 0x97f6, [0x1d52] = 0x97f5, [0x1d53] = 0x980f, [0x1d54] = 0x980c, + [0x1d55] = 0x9838, [0x1d56] = 0x9824, [0x1d57] = 0x9821, [0x1d58] = 0x9837, + [0x1d59] = 0x983d, [0x1d5a] = 0x9846, [0x1d5b] = 0x984f, [0x1d5c] = 0x984b, + [0x1d5d] = 0x986b, [0x1d5e] = 0x986f, [0x1d5f] = 0x9870, [0x1d60] = 0x9871, + [0x1d61] = 0x9874, [0x1d62] = 0x9873, [0x1d63] = 0x98aa, [0x1d64] = 0x98af, + [0x1d65] = 0x98b1, [0x1d66] = 0x98b6, [0x1d67] = 0x98c4, [0x1d68] = 0x98c3, + [0x1d69] = 0x98c6, [0x1d6a] = 0x98e9, [0x1d6b] = 0x98eb, [0x1d6c] = 0x9903, + [0x1d6d] = 0x9909, [0x1d6e] = 0x9912, [0x1d6f] = 0x9914, [0x1d70] = 0x9918, + [0x1d71] = 0x9921, [0x1d72] = 0x991d, [0x1d73] = 0x991e, [0x1d74] = 0x9924, + [0x1d75] = 0x9920, [0x1d76] = 0x992c, [0x1d77] = 0x992e, [0x1d78] = 0x993d, + [0x1d79] = 0x993e, [0x1d7a] = 0x9942, [0x1d7b] = 0x9949, [0x1d7c] = 0x9945, + [0x1d7d] = 0x9950, [0x1d7e] = 0x994b, [0x1d7f] = 0x9951, [0x1d80] = 0x9952, + [0x1d81] = 0x994c, [0x1d82] = 0x9955, [0x1d83] = 0x9997, [0x1d84] = 0x9998, + [0x1d85] = 0x99a5, [0x1d86] = 0x99ad, [0x1d87] = 0x99ae, [0x1d88] = 0x99bc, + [0x1d89] = 0x99df, [0x1d8a] = 0x99db, [0x1d8b] = 0x99dd, [0x1d8c] = 0x99d8, + [0x1d8d] = 0x99d1, [0x1d8e] = 0x99ed, [0x1d8f] = 0x99ee, [0x1d90] = 0x99f1, + [0x1d91] = 0x99f2, [0x1d92] = 0x99fb, [0x1d93] = 0x99f8, [0x1d94] = 0x9a01, + [0x1d95] = 0x9a0f, [0x1d96] = 0x9a05, [0x1d97] = 0x99e2, [0x1d98] = 0x9a19, + [0x1d99] = 0x9a2b, [0x1d9a] = 0x9a37, [0x1d9b] = 0x9a45, [0x1d9c] = 0x9a42, + [0x1d9d] = 0x9a40, [0x1d9e] = 0x9a43, [0x1d9f] = 0x9a3e, [0x1da0] = 0x9a55, + [0x1da1] = 0x9a4d, [0x1da2] = 0x9a5b, [0x1da3] = 0x9a57, [0x1da4] = 0x9a5f, + [0x1da5] = 0x9a62, [0x1da6] = 0x9a65, [0x1da7] = 0x9a64, [0x1da8] = 0x9a69, + [0x1da9] = 0x9a6b, [0x1daa] = 0x9a6a, [0x1dab] = 0x9aad, [0x1dac] = 0x9ab0, + [0x1dad] = 0x9abc, [0x1dae] = 0x9ac0, [0x1daf] = 0x9acf, [0x1db0] = 0x9ad1, + [0x1db1] = 0x9ad3, [0x1db2] = 0x9ad4, [0x1db3] = 0x9ade, [0x1db4] = 0x9adf, + [0x1db5] = 0x9ae2, [0x1db6] = 0x9ae3, [0x1db7] = 0x9ae6, [0x1db8] = 0x9aef, + [0x1db9] = 0x9aeb, [0x1dba] = 0x9aee, [0x1dbb] = 0x9af4, [0x1dbc] = 0x9af1, + [0x1dbd] = 0x9af7, [0x1dbe] = 0x9afb, [0x1dbf] = 0x9b06, [0x1dc0] = 0x9b18, + [0x1dc1] = 0x9b1a, [0x1dc2] = 0x9b1f, [0x1dc3] = 0x9b22, [0x1dc4] = 0x9b23, + [0x1dc5] = 0x9b25, [0x1dc6] = 0x9b27, [0x1dc7] = 0x9b28, [0x1dc8] = 0x9b29, + [0x1dc9] = 0x9b2a, [0x1dca] = 0x9b2e, [0x1dcb] = 0x9b2f, [0x1dcc] = 0x9b32, + [0x1dcd] = 0x9b44, [0x1dce] = 0x9b43, [0x1dcf] = 0x9b4f, [0x1dd0] = 0x9b4d, + [0x1dd1] = 0x9b4e, [0x1dd2] = 0x9b51, [0x1dd3] = 0x9b58, [0x1dd4] = 0x9b74, + [0x1dd5] = 0x9b93, [0x1dd6] = 0x9b83, [0x1dd7] = 0x9b91, [0x1dd8] = 0x9b96, + [0x1dd9] = 0x9b97, [0x1dda] = 0x9b9f, [0x1ddb] = 0x9ba0, [0x1ddc] = 0x9ba8, + [0x1ddd] = 0x9bb4, [0x1dde] = 0x9bc0, [0x1ddf] = 0x9bca, [0x1de0] = 0x9bb9, + [0x1de1] = 0x9bc6, [0x1de2] = 0x9bcf, [0x1de3] = 0x9bd1, [0x1de4] = 0x9bd2, + [0x1de5] = 0x9be3, [0x1de6] = 0x9be2, [0x1de7] = 0x9be4, [0x1de8] = 0x9bd4, + [0x1de9] = 0x9be1, [0x1dea] = 0x9c3a, [0x1deb] = 0x9bf2, [0x1dec] = 0x9bf1, + [0x1ded] = 0x9bf0, [0x1dee] = 0x9c15, [0x1def] = 0x9c14, [0x1df0] = 0x9c09, + [0x1df1] = 0x9c13, [0x1df2] = 0x9c0c, [0x1df3] = 0x9c06, [0x1df4] = 0x9c08, + [0x1df5] = 0x9c12, [0x1df6] = 0x9c0a, [0x1df7] = 0x9c04, [0x1df8] = 0x9c2e, + [0x1df9] = 0x9c1b, [0x1dfa] = 0x9c25, [0x1dfb] = 0x9c24, [0x1dfc] = 0x9c21, + [0x1dfd] = 0x9c30, [0x1dfe] = 0x9c47, [0x1dff] = 0x9c32, [0x1e00] = 0x9c46, + [0x1e01] = 0x9c3e, [0x1e02] = 0x9c5a, [0x1e03] = 0x9c60, [0x1e04] = 0x9c67, + [0x1e05] = 0x9c76, [0x1e06] = 0x9c78, [0x1e07] = 0x9ce7, [0x1e08] = 0x9cec, + [0x1e09] = 0x9cf0, [0x1e0a] = 0x9d09, [0x1e0b] = 0x9d08, [0x1e0c] = 0x9ceb, + [0x1e0d] = 0x9d03, [0x1e0e] = 0x9d06, [0x1e0f] = 0x9d2a, [0x1e10] = 0x9d26, + [0x1e11] = 0x9daf, [0x1e12] = 0x9d23, [0x1e13] = 0x9d1f, [0x1e14] = 0x9d44, + [0x1e15] = 0x9d15, [0x1e16] = 0x9d12, [0x1e17] = 0x9d41, [0x1e18] = 0x9d3f, + [0x1e19] = 0x9d3e, [0x1e1a] = 0x9d46, [0x1e1b] = 0x9d48, [0x1e1c] = 0x9d5d, + [0x1e1d] = 0x9d5e, [0x1e1e] = 0x9d64, [0x1e1f] = 0x9d51, [0x1e20] = 0x9d50, + [0x1e21] = 0x9d59, [0x1e22] = 0x9d72, [0x1e23] = 0x9d89, [0x1e24] = 0x9d87, + [0x1e25] = 0x9dab, [0x1e26] = 0x9d6f, [0x1e27] = 0x9d7a, [0x1e28] = 0x9d9a, + [0x1e29] = 0x9da4, [0x1e2a] = 0x9da9, [0x1e2b] = 0x9db2, [0x1e2c] = 0x9dc4, + [0x1e2d] = 0x9dc1, [0x1e2e] = 0x9dbb, [0x1e2f] = 0x9db8, [0x1e30] = 0x9dba, + [0x1e31] = 0x9dc6, [0x1e32] = 0x9dcf, [0x1e33] = 0x9dc2, [0x1e34] = 0x9dd9, + [0x1e35] = 0x9dd3, [0x1e36] = 0x9df8, [0x1e37] = 0x9de6, [0x1e38] = 0x9ded, + [0x1e39] = 0x9def, [0x1e3a] = 0x9dfd, [0x1e3b] = 0x9e1a, [0x1e3c] = 0x9e1b, + [0x1e3d] = 0x9e1e, [0x1e3e] = 0x9e75, [0x1e3f] = 0x9e79, [0x1e40] = 0x9e7d, + [0x1e41] = 0x9e81, [0x1e42] = 0x9e88, [0x1e43] = 0x9e8b, [0x1e44] = 0x9e8c, + [0x1e45] = 0x9e92, [0x1e46] = 0x9e95, [0x1e47] = 0x9e91, [0x1e48] = 0x9e9d, + [0x1e49] = 0x9ea5, [0x1e4a] = 0x9ea9, [0x1e4b] = 0x9eb8, [0x1e4c] = 0x9eaa, + [0x1e4d] = 0x9ead, [0x1e4e] = 0x9761, [0x1e4f] = 0x9ecc, [0x1e50] = 0x9ece, + [0x1e51] = 0x9ecf, [0x1e52] = 0x9ed0, [0x1e53] = 0x9ed4, [0x1e54] = 0x9edc, + [0x1e55] = 0x9ede, [0x1e56] = 0x9edd, [0x1e57] = 0x9ee0, [0x1e58] = 0x9ee5, + [0x1e59] = 0x9ee8, [0x1e5a] = 0x9eef, [0x1e5b] = 0x9ef4, [0x1e5c] = 0x9ef6, + [0x1e5d] = 0x9ef7, [0x1e5e] = 0x9ef9, [0x1e5f] = 0x9efb, [0x1e60] = 0x9efc, + [0x1e61] = 0x9efd, [0x1e62] = 0x9f07, [0x1e63] = 0x9f08, [0x1e64] = 0x76b7, + [0x1e65] = 0x9f15, [0x1e66] = 0x9f21, [0x1e67] = 0x9f2c, [0x1e68] = 0x9f3e, + [0x1e69] = 0x9f4a, [0x1e6a] = 0x9f52, [0x1e6b] = 0x9f54, [0x1e6c] = 0x9f63, + [0x1e6d] = 0x9f5f, [0x1e6e] = 0x9f60, [0x1e6f] = 0x9f61, [0x1e70] = 0x9f66, + [0x1e71] = 0x9f67, [0x1e72] = 0x9f6c, [0x1e73] = 0x9f6a, [0x1e74] = 0x9f77, + [0x1e75] = 0x9f72, [0x1e76] = 0x9f76, [0x1e77] = 0x9f95, [0x1e78] = 0x9f9c, + [0x1e79] = 0x9fa0, [0x1e7a] = 0x582f, [0x1e7b] = 0x69c7, [0x1e7c] = 0x9059, + [0x1e7d] = 0x7464, [0x1e7e] = 0x51dc, [0x1e7f] = 0x7199 +}; + + +const char __jisx0208_from_ucs4_lat1[256][2] = +{ + [0x005C] = "\x21\x40", [0x00A2] = "\x21\x71", [0x00A3] = "\x21\x72", + [0x00A7] = "\x21\x78", [0x00A8] = "\x21\x2f", [0x00AC] = "\x22\x4c", + [0x00B0] = "\x21\x6B", [0x00B1] = "\x21\x5e", [0x00B4] = "\x21\x2d", + [0x00B6] = "\x22\x79", [0x00D7] = "\x21\x5f", [0x00F7] = "\x21\x60" +}; + + +/* The following table can be generated using + + egrep '^0x' < .../eastasia/jis/jis0208.txt | + awk '{ print $3, $2}' | egrep '^0x0[34]' | sort -u | perl tab.pl + + where tab.pl contains: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $n=0; + while (<>) { + local($ucs4, $jis, %rest) = split; + local($u)=hex($ucs4); + local($s)=hex($jis); + printf ("\n ") if ($n % 3 eq 0); + ++$n; + printf (" [0x%02x] = \"\\x%02x\\x%02x\",", + int(($u - 0x391) / 256) * 94 + (($u - 0x391) & 0xff), + int($s/256), $s % 256); + } + printf ("\n"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +const char __jisx0208_from_ucs4_greek[0xc1][2] = +{ + [0x00] = "\x26\x21", [0x01] = "\x26\x22", [0x02] = "\x26\x23", + [0x03] = "\x26\x24", [0x04] = "\x26\x25", [0x05] = "\x26\x26", + [0x06] = "\x26\x27", [0x07] = "\x26\x28", [0x08] = "\x26\x29", + [0x09] = "\x26\x2a", [0x0a] = "\x26\x2b", [0x0b] = "\x26\x2c", + [0x0c] = "\x26\x2d", [0x0d] = "\x26\x2e", [0x0e] = "\x26\x2f", + [0x0f] = "\x26\x30", [0x10] = "\x26\x31", [0x12] = "\x26\x32", + [0x13] = "\x26\x33", [0x14] = "\x26\x34", [0x15] = "\x26\x35", + [0x16] = "\x26\x36", [0x17] = "\x26\x37", [0x18] = "\x26\x38", + [0x20] = "\x26\x41", [0x21] = "\x26\x42", [0x22] = "\x26\x43", + [0x23] = "\x26\x44", [0x24] = "\x26\x45", [0x25] = "\x26\x46", + [0x26] = "\x26\x47", [0x27] = "\x26\x48", [0x28] = "\x26\x49", + [0x29] = "\x26\x4a", [0x2a] = "\x26\x4b", [0x2b] = "\x26\x4c", + [0x2c] = "\x26\x4d", [0x2d] = "\x26\x4e", [0x2e] = "\x26\x4f", + [0x2f] = "\x26\x50", [0x30] = "\x26\x51", [0x32] = "\x26\x52", + [0x33] = "\x26\x53", [0x34] = "\x26\x54", [0x35] = "\x26\x55", + [0x36] = "\x26\x56", [0x37] = "\x26\x57", [0x38] = "\x26\x58", + [0x70] = "\x27\x27", [0x7f] = "\x27\x21", [0x80] = "\x27\x22", + [0x81] = "\x27\x23", [0x82] = "\x27\x24", [0x83] = "\x27\x25", + [0x84] = "\x27\x26", [0x85] = "\x27\x28", [0x86] = "\x27\x29", + [0x87] = "\x27\x2a", [0x88] = "\x27\x2b", [0x89] = "\x27\x2c", + [0x8a] = "\x27\x2d", [0x8b] = "\x27\x2e", [0x8c] = "\x27\x2f", + [0x8d] = "\x27\x30", [0x8e] = "\x27\x31", [0x8f] = "\x27\x32", + [0x90] = "\x27\x33", [0x91] = "\x27\x34", [0x92] = "\x27\x35", + [0x93] = "\x27\x36", [0x94] = "\x27\x37", [0x95] = "\x27\x38", + [0x96] = "\x27\x39", [0x97] = "\x27\x3a", [0x98] = "\x27\x3b", + [0x99] = "\x27\x3c", [0x9a] = "\x27\x3d", [0x9b] = "\x27\x3e", + [0x9c] = "\x27\x3f", [0x9d] = "\x27\x40", [0x9e] = "\x27\x41", + [0x9f] = "\x27\x51", [0xa0] = "\x27\x52", [0xa1] = "\x27\x53", + [0xa2] = "\x27\x54", [0xa3] = "\x27\x55", [0xa4] = "\x27\x56", + [0xa5] = "\x27\x58", [0xa6] = "\x27\x59", [0xa7] = "\x27\x5a", + [0xa8] = "\x27\x5b", [0xa9] = "\x27\x5c", [0xaa] = "\x27\x5d", + [0xab] = "\x27\x5e", [0xac] = "\x27\x5f", [0xad] = "\x27\x60", + [0xae] = "\x27\x61", [0xaf] = "\x27\x62", [0xb0] = "\x27\x63", + [0xb1] = "\x27\x64", [0xb2] = "\x27\x65", [0xb3] = "\x27\x66", + [0xb4] = "\x27\x67", [0xb5] = "\x27\x68", [0xb6] = "\x27\x69", + [0xb7] = "\x27\x6a", [0xb8] = "\x27\x6b", [0xb9] = "\x27\x6c", + [0xba] = "\x27\x6d", [0xbb] = "\x27\x6e", [0xbc] = "\x27\x6f", + [0xbd] = "\x27\x70", [0xbe] = "\x27\x71", [0xc0] = "\x27\x57" +}; + + +/* The mapping of all the other UCS values is quite difficult since they + are distributed from 0x2010 upto to 0xffe5. There are many gaps with + unpredictable place and size. Therefore we use a table which maps + ranges to idexes in a table. This table ca be generated with: + + egrep '^0x' < .../eastasia/jis/jis0208.txt | awk '{ print $3, $2}' | + egrep '^0x[^01]' | sort -u | perl tab.pl + + where tab.pl is + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $first=$last=$idx=0; + while (<>) { + local($ucs,$jis,%rest) = split; + local($u)=hex($ucs); + if ($u - $last > 6) { + if ($last != 0) { + printf (" { start: %#06x, end: %#06x, idx: %5d },\n", + $first, $last, $idx); + $idx += $last - $first + 1; + } + $first=$u; + } + $last=$u; + } + printf (" { start: %#06x, end: %#06x, idx: %5d }\n", + $first, $last, $idx); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +const struct jisx0208_ucs_idx __jisx0208_from_ucs_idx[] = +{ + { start: 0x2010, end: 0x2026, idx: 0 }, + { start: 0x2030, end: 0x2033, idx: 23 }, + { start: 0x203b, end: 0x203b, idx: 27 }, + { start: 0x2103, end: 0x2103, idx: 28 }, + { start: 0x212b, end: 0x212b, idx: 29 }, + { start: 0x2190, end: 0x2193, idx: 30 }, + { start: 0x21d2, end: 0x21d4, idx: 34 }, + { start: 0x2200, end: 0x220b, idx: 37 }, + { start: 0x2212, end: 0x2212, idx: 49 }, + { start: 0x221a, end: 0x2220, idx: 50 }, + { start: 0x2227, end: 0x222c, idx: 57 }, + { start: 0x2234, end: 0x2235, idx: 63 }, + { start: 0x223d, end: 0x223d, idx: 65 }, + { start: 0x2252, end: 0x2252, idx: 66 }, + { start: 0x2260, end: 0x226b, idx: 67 }, + { start: 0x2282, end: 0x2287, idx: 79 }, + { start: 0x22a5, end: 0x22a5, idx: 85 }, + { start: 0x2312, end: 0x2312, idx: 86 }, + { start: 0x2500, end: 0x2503, idx: 87 }, + { start: 0x250c, end: 0x2542, idx: 91 }, + { start: 0x254b, end: 0x254b, idx: 146 }, + { start: 0x25a0, end: 0x25a1, idx: 147 }, + { start: 0x25b2, end: 0x25b3, idx: 149 }, + { start: 0x25bc, end: 0x25bd, idx: 151 }, + { start: 0x25c6, end: 0x25cf, idx: 153 }, + { start: 0x25ef, end: 0x25ef, idx: 163 }, + { start: 0x2605, end: 0x2606, idx: 164 }, + { start: 0x2640, end: 0x2642, idx: 166 }, + { start: 0x266a, end: 0x266f, idx: 169 }, + { start: 0x3000, end: 0x3015, idx: 175 }, + { start: 0x301c, end: 0x301c, idx: 197 }, + { start: 0x3041, end: 0x3093, idx: 198 }, + { start: 0x309b, end: 0x30fe, idx: 281 }, + { start: 0x4e00, end: 0x4e62, idx: 381 }, + { start: 0x4e71, end: 0x4e73, idx: 480 }, + { start: 0x4e7e, end: 0x4ee5, idx: 483 }, + { start: 0x4eed, end: 0x4f01, idx: 587 }, + { start: 0x4f09, end: 0x4f11, idx: 608 }, + { start: 0x4f1a, end: 0x4f1d, idx: 617 }, + { start: 0x4f2f, end: 0x4f5e, idx: 621 }, + { start: 0x4f69, end: 0x4fa1, idx: 669 }, + { start: 0x4fab, end: 0x4fb6, idx: 726 }, + { start: 0x4fbf, end: 0x4fe5, idx: 738 }, + { start: 0x4fee, end: 0x4ffe, idx: 777 }, + { start: 0x5005, end: 0x502d, idx: 794 }, + { start: 0x5036, end: 0x5039, idx: 835 }, + { start: 0x5043, end: 0x505c, idx: 839 }, + { start: 0x5065, end: 0x5065, idx: 865 }, + { start: 0x506c, end: 0x5085, idx: 866 }, + { start: 0x508d, end: 0x5091, idx: 892 }, + { start: 0x5098, end: 0x509a, idx: 897 }, + { start: 0x50ac, end: 0x50b7, idx: 900 }, + { start: 0x50be, end: 0x50ee, idx: 912 }, + { start: 0x50f5, end: 0x5109, idx: 961 }, + { start: 0x5112, end: 0x5121, idx: 982 }, + { start: 0x512a, end: 0x512a, idx: 998 }, + { start: 0x5132, end: 0x5199, idx: 999 }, + { start: 0x51a0, end: 0x51bd, idx: 1103 }, + { start: 0x51c4, end: 0x51cd, idx: 1133 }, + { start: 0x51d6, end: 0x521d, idx: 1143 }, + { start: 0x5224, end: 0x523b, idx: 1215 }, + { start: 0x5243, end: 0x5275, idx: 1239 }, + { start: 0x527d, end: 0x5294, idx: 1290 }, + { start: 0x529b, end: 0x52e7, idx: 1314 }, + { start: 0x52f2, end: 0x5323, idx: 1391 }, + { start: 0x532a, end: 0x5384, idx: 1441 }, + { start: 0x5396, end: 0x53bb, idx: 1532 }, + { start: 0x53c2, end: 0x53fa, idx: 1570 }, + { start: 0x5401, end: 0x5411, idx: 1627 }, + { start: 0x541b, end: 0x542e, idx: 1644 }, + { start: 0x5436, end: 0x5451, idx: 1664 }, + { start: 0x545f, end: 0x545f, idx: 1692 }, + { start: 0x5468, end: 0x5492, idx: 1693 }, + { start: 0x54a2, end: 0x54c9, idx: 1736 }, + { start: 0x54d8, end: 0x54d8, idx: 1776 }, + { start: 0x54e1, end: 0x54f2, idx: 1777 }, + { start: 0x54fa, end: 0x54fd, idx: 1795 }, + { start: 0x5504, end: 0x5507, idx: 1799 }, + { start: 0x550f, end: 0x5516, idx: 1803 }, + { start: 0x552e, end: 0x5563, idx: 1811 }, + { start: 0x557b, end: 0x558b, idx: 1865 }, + { start: 0x5598, end: 0x559f, idx: 1882 }, + { start: 0x55a7, end: 0x55b6, idx: 1890 }, + { start: 0x55c4, end: 0x55c7, idx: 1906 }, + { start: 0x55d4, end: 0x55e4, idx: 1910 }, + { start: 0x55f7, end: 0x55fe, idx: 1927 }, + { start: 0x5606, end: 0x5609, idx: 1935 }, + { start: 0x5614, end: 0x561b, idx: 1939 }, + { start: 0x5629, end: 0x5638, idx: 1947 }, + { start: 0x5642, end: 0x5642, idx: 1963 }, + { start: 0x564c, end: 0x5650, idx: 1964 }, + { start: 0x565b, end: 0x565b, idx: 1969 }, + { start: 0x5664, end: 0x566c, idx: 1970 }, + { start: 0x5674, end: 0x5694, idx: 1979 }, + { start: 0x56a0, end: 0x56a5, idx: 2012 }, + { start: 0x56ae, end: 0x56e3, idx: 2018 }, + { start: 0x56ee, end: 0x571f, idx: 2072 }, + { start: 0x5726, end: 0x5730, idx: 2122 }, + { start: 0x5737, end: 0x5751, idx: 2133 }, + { start: 0x5761, end: 0x576a, idx: 2160 }, + { start: 0x577f, end: 0x578b, idx: 2170 }, + { start: 0x5793, end: 0x5793, idx: 2183 }, + { start: 0x57a0, end: 0x57b3, idx: 2184 }, + { start: 0x57c0, end: 0x57e3, idx: 2204 }, + { start: 0x57f4, end: 0x580b, idx: 2240 }, + { start: 0x5815, end: 0x5841, idx: 2264 }, + { start: 0x584a, end: 0x5862, idx: 2309 }, + { start: 0x5869, end: 0x5885, idx: 2334 }, + { start: 0x5893, end: 0x589f, idx: 2363 }, + { start: 0x58a8, end: 0x5902, idx: 2376 }, + { start: 0x5909, end: 0x59b2, idx: 2467 }, + { start: 0x59b9, end: 0x59be, idx: 2637 }, + { start: 0x59c6, end: 0x59dc, idx: 2643 }, + { start: 0x59e5, end: 0x59eb, idx: 2666 }, + { start: 0x59f6, end: 0x5a09, idx: 2673 }, + { start: 0x5a11, end: 0x5a11, idx: 2693 }, + { start: 0x5a18, end: 0x5a49, idx: 2694 }, + { start: 0x5a5a, end: 0x5a5a, idx: 2744 }, + { start: 0x5a62, end: 0x5a6c, idx: 2745 }, + { start: 0x5a7f, end: 0x5a7f, idx: 2756 }, + { start: 0x5a92, end: 0x5a92, idx: 2757 }, + { start: 0x5a9a, end: 0x5a9b, idx: 2758 }, + { start: 0x5abc, end: 0x5ac2, idx: 2760 }, + { start: 0x5ac9, end: 0x5ad7, idx: 2767 }, + { start: 0x5ae1, end: 0x5ae9, idx: 2782 }, + { start: 0x5afa, end: 0x5afb, idx: 2791 }, + { start: 0x5b09, end: 0x5b0c, idx: 2793 }, + { start: 0x5b16, end: 0x5b16, idx: 2797 }, + { start: 0x5b22, end: 0x5b22, idx: 2798 }, + { start: 0x5b2a, end: 0x5b36, idx: 2799 }, + { start: 0x5b3e, end: 0x5b45, idx: 2812 }, + { start: 0x5b50, end: 0x5ba6, idx: 2820 }, + { start: 0x5bae, end: 0x5bd4, idx: 2907 }, + { start: 0x5bdb, end: 0x5c31, idx: 2946 }, + { start: 0x5c38, end: 0x5c55, idx: 3033 }, + { start: 0x5c5e, end: 0x5c65, idx: 3063 }, + { start: 0x5c6c, end: 0x5c79, idx: 3071 }, + { start: 0x5c8c, end: 0x5c94, idx: 3085 }, + { start: 0x5ca1, end: 0x5ca1, idx: 3094 }, + { start: 0x5ca8, end: 0x5cbe, idx: 3095 }, + { start: 0x5cc5, end: 0x5cc7, idx: 3118 }, + { start: 0x5cd9, end: 0x5cd9, idx: 3121 }, + { start: 0x5ce0, end: 0x5ce1, idx: 3122 }, + { start: 0x5ce8, end: 0x5cfd, idx: 3124 }, + { start: 0x5d07, end: 0x5d22, idx: 3146 }, + { start: 0x5d29, end: 0x5d29, idx: 3174 }, + { start: 0x5d4b, end: 0x5d52, idx: 3175 }, + { start: 0x5d5c, end: 0x5d5c, idx: 3183 }, + { start: 0x5d69, end: 0x5d76, idx: 3184 }, + { start: 0x5d82, end: 0x5d90, idx: 3198 }, + { start: 0x5d9d, end: 0x5da2, idx: 3213 }, + { start: 0x5dac, end: 0x5dae, idx: 3219 }, + { start: 0x5db7, end: 0x5dbd, idx: 3222 }, + { start: 0x5dc9, end: 0x5e1d, idx: 3229 }, + { start: 0x5e25, end: 0x5e57, idx: 3314 }, + { start: 0x5e5f, end: 0x5e64, idx: 3365 }, + { start: 0x5e72, end: 0x5ead, idx: 3371 }, + { start: 0x5eb5, end: 0x5eb8, idx: 3431 }, + { start: 0x5ec1, end: 0x5f41, idx: 3435 }, + { start: 0x5f48, end: 0x5fa1, idx: 3564 }, + { start: 0x5fa8, end: 0x5fc5, idx: 3654 }, + { start: 0x5fcc, end: 0x5fcd, idx: 3684 }, + { start: 0x5fd6, end: 0x5fe4, idx: 3686 }, + { start: 0x5feb, end: 0x5fff, idx: 3701 }, + { start: 0x600e, end: 0x6031, idx: 3722 }, + { start: 0x603a, end: 0x603a, idx: 3758 }, + { start: 0x6041, end: 0x6077, idx: 3759 }, + { start: 0x6081, end: 0x60aa, idx: 3814 }, + { start: 0x60b2, end: 0x60bd, idx: 3856 }, + { start: 0x60c5, end: 0x60c7, idx: 3868 }, + { start: 0x60d1, end: 0x60e8, idx: 3871 }, + { start: 0x60f0, end: 0x612c, idx: 3895 }, + { start: 0x6134, end: 0x6134, idx: 3956 }, + { start: 0x613c, end: 0x6177, idx: 3957 }, + { start: 0x617e, end: 0x619a, idx: 4017 }, + { start: 0x61a4, end: 0x61d0, idx: 4046 }, + { start: 0x61e3, end: 0x61e6, idx: 4091 }, + { start: 0x61f2, end: 0x6200, idx: 4095 }, + { start: 0x6208, end: 0x628a, idx: 4110 }, + { start: 0x6291, end: 0x629e, idx: 4241 }, + { start: 0x62ab, end: 0x62e1, idx: 4255 }, + { start: 0x62ec, end: 0x62f7, idx: 4310 }, + { start: 0x62fe, end: 0x6311, idx: 4322 }, + { start: 0x6319, end: 0x631f, idx: 4342 }, + { start: 0x6327, end: 0x632f, idx: 4349 }, + { start: 0x633a, end: 0x633f, idx: 4358 }, + { start: 0x6349, end: 0x635c, idx: 4364 }, + { start: 0x6367, end: 0x63fa, idx: 4384 }, + { start: 0x6406, end: 0x6406, idx: 4532 }, + { start: 0x640d, end: 0x641c, idx: 4533 }, + { start: 0x6426, end: 0x642d, idx: 4549 }, + { start: 0x6434, end: 0x6442, idx: 4557 }, + { start: 0x644e, end: 0x644e, idx: 4572 }, + { start: 0x6458, end: 0x6458, idx: 4573 }, + { start: 0x6467, end: 0x646f, idx: 4574 }, + { start: 0x6476, end: 0x647a, idx: 4583 }, + { start: 0x6483, end: 0x6488, idx: 4588 }, + { start: 0x6492, end: 0x64b2, idx: 4594 }, + { start: 0x64b9, end: 0x6505, idx: 4627 }, + { start: 0x6518, end: 0x6578, idx: 4704 }, + { start: 0x6582, end: 0x65b0, idx: 4801 }, + { start: 0x65b7, end: 0x65f1, idx: 4848 }, + { start: 0x65fa, end: 0x65fb, idx: 4907 }, + { start: 0x6602, end: 0x6614, idx: 4909 }, + { start: 0x661c, end: 0x6652, idx: 4928 }, + { start: 0x665d, end: 0x667a, idx: 4983 }, + { start: 0x6681, end: 0x66c9, idx: 5013 }, + { start: 0x66d6, end: 0x66e9, idx: 5086 }, + { start: 0x66f0, end: 0x671f, idx: 5106 }, + { start: 0x6726, end: 0x67b9, idx: 5154 }, + { start: 0x67c1, end: 0x6804, idx: 5302 }, + { start: 0x6813, end: 0x6817, idx: 5370 }, + { start: 0x681e, end: 0x6822, idx: 5375 }, + { start: 0x6829, end: 0x682b, idx: 5380 }, + { start: 0x6832, end: 0x6867, idx: 5383 }, + { start: 0x6874, end: 0x6877, idx: 5437 }, + { start: 0x687e, end: 0x6885, idx: 5441 }, + { start: 0x688d, end: 0x68bc, idx: 5449 }, + { start: 0x68c4, end: 0x68e7, idx: 5497 }, + { start: 0x68ee, end: 0x68f2, idx: 5533 }, + { start: 0x68f9, end: 0x6912, idx: 5538 }, + { start: 0x6919, end: 0x693f, idx: 5564 }, + { start: 0x694a, end: 0x694a, idx: 5603 }, + { start: 0x6953, end: 0x6962, idx: 5604 }, + { start: 0x696a, end: 0x6982, idx: 5620 }, + { start: 0x698a, end: 0x69a0, idx: 5645 }, + { start: 0x69a7, end: 0x69a7, idx: 5668 }, + { start: 0x69ae, end: 0x69b4, idx: 5669 }, + { start: 0x69bb, end: 0x69de, idx: 5676 }, + { start: 0x69e7, end: 0x69f2, idx: 5712 }, + { start: 0x69f9, end: 0x6a2e, idx: 5724 }, + { start: 0x6a35, end: 0x6a3d, idx: 5778 }, + { start: 0x6a44, end: 0x6a4b, idx: 5787 }, + { start: 0x6a58, end: 0x6a66, idx: 5795 }, + { start: 0x6a72, end: 0x6a78, idx: 5810 }, + { start: 0x6a7f, end: 0x6a84, idx: 5817 }, + { start: 0x6a8d, end: 0x6a90, idx: 5823 }, + { start: 0x6a97, end: 0x6aa3, idx: 5827 }, + { start: 0x6aaa, end: 0x6ac3, idx: 5840 }, + { start: 0x6ad1, end: 0x6ad3, idx: 5866 }, + { start: 0x6ada, end: 0x6adf, idx: 5869 }, + { start: 0x6ae8, end: 0x6aea, idx: 5875 }, + { start: 0x6afa, end: 0x6afb, idx: 5878 }, + { start: 0x6b04, end: 0x6b0a, idx: 5880 }, + { start: 0x6b12, end: 0x6b16, idx: 5887 }, + { start: 0x6b1d, end: 0x6b27, idx: 5892 }, + { start: 0x6b32, end: 0x6b8d, idx: 5903 }, + { start: 0x6b95, end: 0x6bdf, idx: 5995 }, + { start: 0x6beb, end: 0x6bf3, idx: 6070 }, + { start: 0x6c08, end: 0x6c08, idx: 6079 }, + { start: 0x6c0f, end: 0x6c1b, idx: 6080 }, + { start: 0x6c23, end: 0x6c24, idx: 6093 }, + { start: 0x6c34, end: 0x6c42, idx: 6095 }, + { start: 0x6c4e, end: 0x6c73, idx: 6110 }, + { start: 0x6c7a, end: 0x6ca2, idx: 6148 }, + { start: 0x6cab, end: 0x6ccc, idx: 6189 }, + { start: 0x6cd3, end: 0x6cf3, idx: 6223 }, + { start: 0x6d0b, end: 0x6d2b, idx: 6256 }, + { start: 0x6d32, end: 0x6d45, idx: 6289 }, + { start: 0x6d59, end: 0x6d5c, idx: 6309 }, + { start: 0x6d63, end: 0x6d79, idx: 6313 }, + { start: 0x6d85, end: 0x6d9c, idx: 6336 }, + { start: 0x6daf, end: 0x6dfb, idx: 6360 }, + { start: 0x6e05, end: 0x6e0b, idx: 6437 }, + { start: 0x6e13, end: 0x6e2f, idx: 6444 }, + { start: 0x6e38, end: 0x6e43, idx: 6473 }, + { start: 0x6e4a, end: 0x6e4e, idx: 6485 }, + { start: 0x6e56, end: 0x6e5f, idx: 6490 }, + { start: 0x6e67, end: 0x6e76, idx: 6500 }, + { start: 0x6e7e, end: 0x6e82, idx: 6516 }, + { start: 0x6e8c, end: 0x6ed5, idx: 6521 }, + { start: 0x6edd, end: 0x6ede, idx: 6595 }, + { start: 0x6eec, end: 0x6f15, idx: 6597 }, + { start: 0x6f20, end: 0x6f23, idx: 6639 }, + { start: 0x6f2b, end: 0x6f45, idx: 6643 }, + { start: 0x6f54, end: 0x6f66, idx: 6670 }, + { start: 0x6f6d, end: 0x6f86, idx: 6689 }, + { start: 0x6f8e, end: 0x6f97, idx: 6715 }, + { start: 0x6fa1, end: 0x6faa, idx: 6725 }, + { start: 0x6fb1, end: 0x6fb9, idx: 6735 }, + { start: 0x6fc0, end: 0x6fc6, idx: 6744 }, + { start: 0x6fd4, end: 0x6fe4, idx: 6751 }, + { start: 0x6feb, end: 0x7001, idx: 6768 }, + { start: 0x7009, end: 0x701f, idx: 6791 }, + { start: 0x7026, end: 0x7032, idx: 6814 }, + { start: 0x703e, end: 0x703e, idx: 6827 }, + { start: 0x704c, end: 0x7051, idx: 6828 }, + { start: 0x7058, end: 0x7058, idx: 6834 }, + { start: 0x7063, end: 0x7063, idx: 6835 }, + { start: 0x706b, end: 0x7070, idx: 6836 }, + { start: 0x7078, end: 0x707d, idx: 6842 }, + { start: 0x7089, end: 0x7092, idx: 6848 }, + { start: 0x7099, end: 0x7099, idx: 6858 }, + { start: 0x70ac, end: 0x70ba, idx: 6859 }, + { start: 0x70c8, end: 0x70cf, idx: 6874 }, + { start: 0x70d9, end: 0x70df, idx: 6882 }, + { start: 0x70f1, end: 0x70f1, idx: 6889 }, + { start: 0x70f9, end: 0x70fd, idx: 6890 }, + { start: 0x7109, end: 0x7109, idx: 6895 }, + { start: 0x7114, end: 0x7126, idx: 6896 }, + { start: 0x7136, end: 0x713c, idx: 6915 }, + { start: 0x7149, end: 0x714e, idx: 6922 }, + { start: 0x7155, end: 0x7159, idx: 6928 }, + { start: 0x7162, end: 0x716e, idx: 6933 }, + { start: 0x717d, end: 0x717d, idx: 6946 }, + { start: 0x7184, end: 0x719f, idx: 6947 }, + { start: 0x71a8, end: 0x71b1, idx: 6975 }, + { start: 0x71b9, end: 0x71d7, idx: 6985 }, + { start: 0x71df, end: 0x71ee, idx: 7016 }, + { start: 0x71f5, end: 0x71ff, idx: 7032 }, + { start: 0x7206, end: 0x7206, idx: 7043 }, + { start: 0x720d, end: 0x7210, idx: 7044 }, + { start: 0x721b, end: 0x721b, idx: 7048 }, + { start: 0x7228, end: 0x7269, idx: 7049 }, + { start: 0x7272, end: 0x7287, idx: 7115 }, + { start: 0x7292, end: 0x7296, idx: 7137 }, + { start: 0x72a0, end: 0x72b9, idx: 7142 }, + { start: 0x72c2, end: 0x72c6, idx: 7168 }, + { start: 0x72ce, end: 0x72e2, idx: 7173 }, + { start: 0x72e9, end: 0x72ed, idx: 7194 }, + { start: 0x72f7, end: 0x72fd, idx: 7199 }, + { start: 0x730a, end: 0x730a, idx: 7206 }, + { start: 0x7316, end: 0x7337, idx: 7207 }, + { start: 0x733e, end: 0x7345, idx: 7241 }, + { start: 0x734e, end: 0x734f, idx: 7249 }, + { start: 0x7357, end: 0x7357, idx: 7251 }, + { start: 0x7363, end: 0x737b, idx: 7252 }, + { start: 0x7384, end: 0x738b, idx: 7277 }, + { start: 0x7396, end: 0x7396, idx: 7285 }, + { start: 0x73a9, end: 0x73a9, idx: 7286 }, + { start: 0x73b2, end: 0x73b3, idx: 7287 }, + { start: 0x73bb, end: 0x73ce, idx: 7289 }, + { start: 0x73de, end: 0x73f1, idx: 7309 }, + { start: 0x73f8, end: 0x7409, idx: 7329 }, + { start: 0x7422, end: 0x7425, idx: 7347 }, + { start: 0x7432, end: 0x7441, idx: 7351 }, + { start: 0x7455, end: 0x7476, idx: 7367 }, + { start: 0x747e, end: 0x7483, idx: 7401 }, + { start: 0x748b, end: 0x748b, idx: 7407 }, + { start: 0x749e, end: 0x74a7, idx: 7408 }, + { start: 0x74b0, end: 0x74b0, idx: 7418 }, + { start: 0x74bd, end: 0x74bd, idx: 7419 }, + { start: 0x74ca, end: 0x74d4, idx: 7420 }, + { start: 0x74dc, end: 0x74f8, idx: 7431 }, + { start: 0x7503, end: 0x7505, idx: 7460 }, + { start: 0x750c, end: 0x753c, idx: 7463 }, + { start: 0x7544, end: 0x7578, idx: 7512 }, + { start: 0x757f, end: 0x75e9, idx: 7565 }, + { start: 0x75f0, end: 0x7601, idx: 7672 }, + { start: 0x7609, end: 0x760d, idx: 7690 }, + { start: 0x761f, end: 0x7627, idx: 7695 }, + { start: 0x7630, end: 0x7634, idx: 7704 }, + { start: 0x763b, end: 0x763b, idx: 7709 }, + { start: 0x7642, end: 0x769a, idx: 7710 }, + { start: 0x76ae, end: 0x770c, idx: 7799 }, + { start: 0x771b, end: 0x7729, idx: 7894 }, + { start: 0x7737, end: 0x7740, idx: 7909 }, + { start: 0x7747, end: 0x7747, idx: 7919 }, + { start: 0x775a, end: 0x776b, idx: 7920 }, + { start: 0x7779, end: 0x777f, idx: 7938 }, + { start: 0x778b, end: 0x7791, idx: 7945 }, + { start: 0x779e, end: 0x77a5, idx: 7952 }, + { start: 0x77ac, end: 0x77bf, idx: 7960 }, + { start: 0x77c7, end: 0x77cd, idx: 7980 }, + { start: 0x77d7, end: 0x77f3, idx: 7987 }, + { start: 0x77fc, end: 0x7802, idx: 8016 }, + { start: 0x780c, end: 0x7815, idx: 8023 }, + { start: 0x7820, end: 0x7827, idx: 8033 }, + { start: 0x7832, end: 0x7845, idx: 8041 }, + { start: 0x785d, end: 0x785d, idx: 8061 }, + { start: 0x786b, end: 0x7874, idx: 8062 }, + { start: 0x787c, end: 0x789a, idx: 8072 }, + { start: 0x78a3, end: 0x78da, idx: 8103 }, + { start: 0x78e7, end: 0x78f4, idx: 8159 }, + { start: 0x78fd, end: 0x7907, idx: 8173 }, + { start: 0x790e, end: 0x7912, idx: 8184 }, + { start: 0x7919, end: 0x7919, idx: 8189 }, + { start: 0x7926, end: 0x792c, idx: 8190 }, + { start: 0x793a, end: 0x7949, idx: 8197 }, + { start: 0x7950, end: 0x796d, idx: 8213 }, + { start: 0x7977, end: 0x798f, idx: 8243 }, + { start: 0x799d, end: 0x799d, idx: 8268 }, + { start: 0x79a6, end: 0x79c1, idx: 8269 }, + { start: 0x79c9, end: 0x79d8, idx: 8297 }, + { start: 0x79df, end: 0x79f0, idx: 8313 }, + { start: 0x79fb, end: 0x7a00, idx: 8331 }, + { start: 0x7a08, end: 0x7a20, idx: 8337 }, + { start: 0x7a2e, end: 0x7a50, idx: 8362 }, + { start: 0x7a57, end: 0x7a57, idx: 8397 }, + { start: 0x7a61, end: 0x7a88, idx: 8398 }, + { start: 0x7a92, end: 0x7a98, idx: 8438 }, + { start: 0x7a9f, end: 0x7a9f, idx: 8445 }, + { start: 0x7aa9, end: 0x7b11, idx: 8446 }, + { start: 0x7b18, end: 0x7b2c, idx: 8551 }, + { start: 0x7b33, end: 0x7b39, idx: 8572 }, + { start: 0x7b45, end: 0x7b56, idx: 8579 }, + { start: 0x7b5d, end: 0x7b5d, idx: 8597 }, + { start: 0x7b65, end: 0x7b7a, idx: 8598 }, + { start: 0x7b86, end: 0x7ba1, idx: 8620 }, + { start: 0x7baa, end: 0x7bb8, idx: 8648 }, + { start: 0x7bc0, end: 0x7bcf, idx: 8663 }, + { start: 0x7bdd, end: 0x7bf7, idx: 8679 }, + { start: 0x7c00, end: 0x7c00, idx: 8706 }, + { start: 0x7c07, end: 0x7c17, idx: 8707 }, + { start: 0x7c1f, end: 0x7c2b, idx: 8724 }, + { start: 0x7c37, end: 0x7c43, idx: 8737 }, + { start: 0x7c4c, end: 0x7c58, idx: 8750 }, + { start: 0x7c5f, end: 0x7c65, idx: 8763 }, + { start: 0x7c6c, end: 0x7c6c, idx: 8770 }, + { start: 0x7c73, end: 0x7c75, idx: 8771 }, + { start: 0x7c7e, end: 0x7ce7, idx: 8774 }, + { start: 0x7cef, end: 0x7d22, idx: 8880 }, + { start: 0x7d2b, end: 0x7d7d, idx: 8932 }, + { start: 0x7d89, end: 0x7da3, idx: 9015 }, + { start: 0x7dab, end: 0x7dbf, idx: 9042 }, + { start: 0x7dc7, end: 0x7df4, idx: 9063 }, + { start: 0x7dfb, end: 0x7e0b, idx: 9109 }, + { start: 0x7e12, end: 0x7e12, idx: 9126 }, + { start: 0x7e1b, end: 0x7e4d, idx: 9127 }, + { start: 0x7e54, end: 0x7e5e, idx: 9178 }, + { start: 0x7e66, end: 0x7e70, idx: 9189 }, + { start: 0x7e79, end: 0x7e9c, idx: 9200 }, + { start: 0x7f36, end: 0x7f3a, idx: 9236 }, + { start: 0x7f45, end: 0x7f45, idx: 9241 }, + { start: 0x7f4c, end: 0x7f58, idx: 9242 }, + { start: 0x7f5f, end: 0x7f60, idx: 9255 }, + { start: 0x7f67, end: 0x7f79, idx: 9257 }, + { start: 0x7f82, end: 0x7fd5, idx: 9276 }, + { start: 0x7fe0, end: 0x8021, idx: 9360 }, + { start: 0x8028, end: 0x8028, idx: 9426 }, + { start: 0x8033, end: 0x803f, idx: 9427 }, + { start: 0x8046, end: 0x804a, idx: 9440 }, + { start: 0x8052, end: 0x8068, idx: 9445 }, + { start: 0x806f, end: 0x808c, idx: 9468 }, + { start: 0x8093, end: 0x80ba, idx: 9498 }, + { start: 0x80c3, end: 0x80ce, idx: 9538 }, + { start: 0x80d6, end: 0x80e5, idx: 9550 }, + { start: 0x80ef, end: 0x810a, idx: 9566 }, + { start: 0x811a, end: 0x811b, idx: 9594 }, + { start: 0x8123, end: 0x813e, idx: 9596 }, + { start: 0x8146, end: 0x8155, idx: 9624 }, + { start: 0x815f, end: 0x81a9, idx: 9640 }, + { start: 0x81b0, end: 0x821f, idx: 9715 }, + { start: 0x8229, end: 0x8239, idx: 9827 }, + { start: 0x8240, end: 0x8240, idx: 9844 }, + { start: 0x8247, end: 0x8247, idx: 9845 }, + { start: 0x8258, end: 0x827e, idx: 9846 }, + { start: 0x828b, end: 0x8292, idx: 9885 }, + { start: 0x8299, end: 0x82bd, idx: 9893 }, + { start: 0x82c5, end: 0x82c5, idx: 9930 }, + { start: 0x82d1, end: 0x82fb, idx: 9931 }, + { start: 0x8302, end: 0x830e, idx: 9974 }, + { start: 0x8316, end: 0x831c, idx: 9987 }, + { start: 0x8323, end: 0x8339, idx: 9994 }, + { start: 0x8340, end: 0x8358, idx: 10017 }, + { start: 0x8373, end: 0x837c, idx: 10042 }, + { start: 0x8385, end: 0x83b5, idx: 10052 }, + { start: 0x83bd, end: 0x83e0, idx: 10101 }, + { start: 0x83e9, end: 0x8413, idx: 10137 }, + { start: 0x8420, end: 0x8422, idx: 10180 }, + { start: 0x8429, end: 0x843d, idx: 10183 }, + { start: 0x8446, end: 0x844e, idx: 10204 }, + { start: 0x8457, end: 0x847a, idx: 10213 }, + { start: 0x8482, end: 0x8484, idx: 10249 }, + { start: 0x848b, end: 0x84a1, idx: 10252 }, + { start: 0x84ad, end: 0x84da, idx: 10275 }, + { start: 0x84ec, end: 0x84f4, idx: 10321 }, + { start: 0x84fc, end: 0x8506, idx: 10330 }, + { start: 0x8511, end: 0x852d, idx: 10341 }, + { start: 0x8535, end: 0x8535, idx: 10370 }, + { start: 0x853d, end: 0x854e, idx: 10371 }, + { start: 0x8555, end: 0x855a, idx: 10389 }, + { start: 0x8563, end: 0x856d, idx: 10395 }, + { start: 0x8577, end: 0x8577, idx: 10406 }, + { start: 0x857e, end: 0x859c, idx: 10407 }, + { start: 0x85a4, end: 0x85af, idx: 10438 }, + { start: 0x85b9, end: 0x85ba, idx: 10450 }, + { start: 0x85c1, end: 0x85c1, idx: 10452 }, + { start: 0x85c9, end: 0x85d5, idx: 10453 }, + { start: 0x85dc, end: 0x85dd, idx: 10466 }, + { start: 0x85e4, end: 0x85ea, idx: 10468 }, + { start: 0x85f7, end: 0x860b, idx: 10475 }, + { start: 0x8613, end: 0x861a, idx: 10496 }, + { start: 0x8622, end: 0x8622, idx: 10504 }, + { start: 0x862d, end: 0x8630, idx: 10505 }, + { start: 0x863f, end: 0x863f, idx: 10509 }, + { start: 0x864d, end: 0x865f, idx: 10510 }, + { start: 0x8667, end: 0x8671, idx: 10529 }, + { start: 0x8679, end: 0x867b, idx: 10540 }, + { start: 0x868a, end: 0x868c, idx: 10543 }, + { start: 0x8693, end: 0x8695, idx: 10546 }, + { start: 0x86a3, end: 0x86b6, idx: 10549 }, + { start: 0x86c4, end: 0x86ef, idx: 10569 }, + { start: 0x86f8, end: 0x871c, idx: 10613 }, + { start: 0x8725, end: 0x8729, idx: 10650 }, + { start: 0x8734, end: 0x873f, idx: 10655 }, + { start: 0x8749, end: 0x8778, idx: 10667 }, + { start: 0x877f, end: 0x8782, idx: 10715 }, + { start: 0x878d, end: 0x878d, idx: 10719 }, + { start: 0x879f, end: 0x87a2, idx: 10720 }, + { start: 0x87ab, end: 0x87b3, idx: 10724 }, + { start: 0x87ba, end: 0x87d2, idx: 10733 }, + { start: 0x87e0, end: 0x87e0, idx: 10758 }, + { start: 0x87ef, end: 0x87fe, idx: 10759 }, + { start: 0x8805, end: 0x8805, idx: 10775 }, + { start: 0x880d, end: 0x8816, idx: 10776 }, + { start: 0x8821, end: 0x8827, idx: 10786 }, + { start: 0x8831, end: 0x88a4, idx: 10793 }, + { start: 0x88ab, end: 0x88b7, idx: 10909 }, + { start: 0x88bf, end: 0x88c5, idx: 10922 }, + { start: 0x88cf, end: 0x88e1, idx: 10929 }, + { start: 0x88e8, end: 0x88e8, idx: 10948 }, + { start: 0x88f2, end: 0x8913, idx: 10949 }, + { start: 0x891d, end: 0x891e, idx: 10983 }, + { start: 0x8925, end: 0x892b, idx: 10985 }, + { start: 0x8936, end: 0x8944, idx: 10992 }, + { start: 0x894c, end: 0x894d, idx: 11007 }, + { start: 0x8956, end: 0x8956, idx: 11009 }, + { start: 0x895e, end: 0x8977, idx: 11010 }, + { start: 0x897e, end: 0x899a, idx: 11036 }, + { start: 0x89a1, end: 0x89b3, idx: 11065 }, + { start: 0x89ba, end: 0x89c0, idx: 11084 }, + { start: 0x89d2, end: 0x89d2, idx: 11091 }, + { start: 0x89da, end: 0x89e7, idx: 11092 }, + { start: 0x89f4, end: 0x89f8, idx: 11106 }, + { start: 0x8a00, end: 0x8a48, idx: 11111 }, + { start: 0x8a50, end: 0x8a73, idx: 11184 }, + { start: 0x8a7c, end: 0x8ab2, idx: 11220 }, + { start: 0x8ab9, end: 0x8b2c, idx: 11275 }, + { start: 0x8b33, end: 0x8b41, idx: 11391 }, + { start: 0x8b49, end: 0x8b4f, idx: 11406 }, + { start: 0x8b56, end: 0x8b5f, idx: 11413 }, + { start: 0x8b66, end: 0x8b83, idx: 11423 }, + { start: 0x8b8a, end: 0x8b9a, idx: 11453 }, + { start: 0x8c37, end: 0x8c5a, idx: 11470 }, + { start: 0x8c61, end: 0x8c62, idx: 11506 }, + { start: 0x8c6a, end: 0x8c6c, idx: 11508 }, + { start: 0x8c78, end: 0x8cd3, idx: 11511 }, + { start: 0x8cda, end: 0x8ced, idx: 11603 }, + { start: 0x8cfa, end: 0x8cfd, idx: 11623 }, + { start: 0x8d04, end: 0x8d16, idx: 11627 }, + { start: 0x8d64, end: 0x8d77, idx: 11646 }, + { start: 0x8d81, end: 0x8d8a, idx: 11666 }, + { start: 0x8d99, end: 0x8d99, idx: 11676 }, + { start: 0x8da3, end: 0x8da8, idx: 11677 }, + { start: 0x8db3, end: 0x8db3, idx: 11683 }, + { start: 0x8dba, end: 0x8dc2, idx: 11684 }, + { start: 0x8dcb, end: 0x8dcf, idx: 11693 }, + { start: 0x8dd6, end: 0x8df5, idx: 11698 }, + { start: 0x8dfc, end: 0x8dff, idx: 11730 }, + { start: 0x8e08, end: 0x8e10, idx: 11734 }, + { start: 0x8e1d, end: 0x8e1f, idx: 11743 }, + { start: 0x8e2a, end: 0x8e35, idx: 11746 }, + { start: 0x8e42, end: 0x8e64, idx: 11758 }, + { start: 0x8e72, end: 0x8e99, idx: 11793 }, + { start: 0x8ea1, end: 0x8ea1, idx: 11833 }, + { start: 0x8eaa, end: 0x8eb1, idx: 11834 }, + { start: 0x8ebe, end: 0x8ebe, idx: 11842 }, + { start: 0x8ec5, end: 0x8ed2, idx: 11843 }, + { start: 0x8edb, end: 0x8ee3, idx: 11857 }, + { start: 0x8eeb, end: 0x8eeb, idx: 11866 }, + { start: 0x8ef8, end: 0x8f1f, idx: 11867 }, + { start: 0x8f26, end: 0x8f4e, idx: 11907 }, + { start: 0x8f57, end: 0x8f64, idx: 11948 }, + { start: 0x8f9b, end: 0x8fc5, idx: 11962 }, + { start: 0x8fce, end: 0x8fda, idx: 12005 }, + { start: 0x8fe2, end: 0x9027, idx: 12018 }, + { start: 0x902e, end: 0x9091, idx: 12088 }, + { start: 0x90a3, end: 0x90b8, idx: 12188 }, + { start: 0x90c1, end: 0x90c1, idx: 12210 }, + { start: 0x90ca, end: 0x90ce, idx: 12211 }, + { start: 0x90db, end: 0x90ed, idx: 12216 }, + { start: 0x90f5, end: 0x9102, idx: 12235 }, + { start: 0x9112, end: 0x9112, idx: 12249 }, + { start: 0x9119, end: 0x9119, idx: 12250 }, + { start: 0x912d, end: 0x9132, idx: 12251 }, + { start: 0x9149, end: 0x9158, idx: 12257 }, + { start: 0x9162, end: 0x9178, idx: 12273 }, + { start: 0x9182, end: 0x91e7, idx: 12296 }, + { start: 0x91f5, end: 0x91ff, idx: 12398 }, + { start: 0x920d, end: 0x9215, idx: 12409 }, + { start: 0x921e, end: 0x921e, idx: 12418 }, + { start: 0x9229, end: 0x922c, idx: 12419 }, + { start: 0x9234, end: 0x9237, idx: 12423 }, + { start: 0x923f, end: 0x9250, idx: 12427 }, + { start: 0x9257, end: 0x9266, idx: 12445 }, + { start: 0x9271, end: 0x9271, idx: 12461 }, + { start: 0x927e, end: 0x9285, idx: 12462 }, + { start: 0x9291, end: 0x929c, idx: 12470 }, + { start: 0x92ad, end: 0x92ad, idx: 12482 }, + { start: 0x92b7, end: 0x92b9, idx: 12483 }, + { start: 0x92cf, end: 0x92d2, idx: 12486 }, + { start: 0x92e4, end: 0x92fc, idx: 12490 }, + { start: 0x9306, end: 0x9306, idx: 12515 }, + { start: 0x930f, end: 0x9310, idx: 12516 }, + { start: 0x9318, end: 0x933b, idx: 12518 }, + { start: 0x9344, end: 0x9344, idx: 12554 }, + { start: 0x934b, end: 0x934d, idx: 12555 }, + { start: 0x9354, end: 0x9360, idx: 12558 }, + { start: 0x936c, end: 0x936e, idx: 12571 }, + { start: 0x9375, end: 0x9375, idx: 12574 }, + { start: 0x937c, end: 0x937e, idx: 12575 }, + { start: 0x938c, end: 0x938c, idx: 12578 }, + { start: 0x9394, end: 0x939a, idx: 12579 }, + { start: 0x93a7, end: 0x93b0, idx: 12586 }, + { start: 0x93b9, end: 0x93b9, idx: 12596 }, + { start: 0x93c3, end: 0x93c8, idx: 12597 }, + { start: 0x93d0, end: 0x93e8, idx: 12603 }, + { start: 0x9403, end: 0x9407, idx: 12628 }, + { start: 0x9410, end: 0x941a, idx: 12633 }, + { start: 0x9421, end: 0x9421, idx: 12644 }, + { start: 0x942b, end: 0x942b, idx: 12645 }, + { start: 0x9435, end: 0x943a, idx: 12646 }, + { start: 0x9441, end: 0x9444, idx: 12652 }, + { start: 0x9451, end: 0x9453, idx: 12656 }, + { start: 0x945a, end: 0x9462, idx: 12659 }, + { start: 0x946a, end: 0x9481, idx: 12668 }, + { start: 0x9577, end: 0x9577, idx: 12692 }, + { start: 0x9580, end: 0x9599, idx: 12693 }, + { start: 0x95a0, end: 0x95b2, idx: 12719 }, + { start: 0x95b9, end: 0x95cd, idx: 12738 }, + { start: 0x95d4, end: 0x95e5, idx: 12759 }, + { start: 0x961c, end: 0x9621, idx: 12777 }, + { start: 0x9628, end: 0x9632, idx: 12783 }, + { start: 0x963b, end: 0x9644, idx: 12794 }, + { start: 0x964b, end: 0x9650, idx: 12804 }, + { start: 0x965b, end: 0x967d, idx: 12810 }, + { start: 0x9685, end: 0x9749, idx: 12845 }, + { start: 0x9752, end: 0x9790, idx: 13042 }, + { start: 0x9798, end: 0x97b4, idx: 13105 }, + { start: 0x97c3, end: 0x97cb, idx: 13134 }, + { start: 0x97d3, end: 0x97d3, idx: 13143 }, + { start: 0x97dc, end: 0x97dc, idx: 13144 }, + { start: 0x97ed, end: 0x981a, idx: 13145 }, + { start: 0x9821, end: 0x9824, idx: 13191 }, + { start: 0x982c, end: 0x982d, idx: 13195 }, + { start: 0x9834, end: 0x983d, idx: 13197 }, + { start: 0x9846, end: 0x985e, idx: 13207 }, + { start: 0x9867, end: 0x9874, idx: 13232 }, + { start: 0x98a8, end: 0x98b6, idx: 13246 }, + { start: 0x98c3, end: 0x98c6, idx: 13261 }, + { start: 0x98db, end: 0x98e2, idx: 13265 }, + { start: 0x98e9, end: 0x98f4, idx: 13273 }, + { start: 0x98fc, end: 0x992e, idx: 13285 }, + { start: 0x993d, end: 0x9957, idx: 13336 }, + { start: 0x9996, end: 0x9999, idx: 13363 }, + { start: 0x99a5, end: 0x99b4, idx: 13367 }, + { start: 0x99bc, end: 0x99c8, idx: 13383 }, + { start: 0x99d0, end: 0x99e2, idx: 13396 }, + { start: 0x99ed, end: 0x9a05, idx: 13415 }, + { start: 0x9a0e, end: 0x9a19, idx: 13440 }, + { start: 0x9a28, end: 0x9a30, idx: 13452 }, + { start: 0x9a37, end: 0x9a37, idx: 13461 }, + { start: 0x9a3e, end: 0x9a45, idx: 13462 }, + { start: 0x9a4d, end: 0x9a4d, idx: 13470 }, + { start: 0x9a55, end: 0x9a6b, idx: 13471 }, + { start: 0x9aa8, end: 0x9ab0, idx: 13494 }, + { start: 0x9ab8, end: 0x9ac4, idx: 13503 }, + { start: 0x9acf, end: 0x9afb, idx: 13516 }, + { start: 0x9b06, end: 0x9b06, idx: 13561 }, + { start: 0x9b18, end: 0x9b32, idx: 13562 }, + { start: 0x9b3b, end: 0x9b45, idx: 13589 }, + { start: 0x9b4d, end: 0x9b5a, idx: 13600 }, + { start: 0x9b6f, end: 0x9b74, idx: 13614 }, + { start: 0x9b83, end: 0x9b83, idx: 13620 }, + { start: 0x9b8e, end: 0x9b97, idx: 13621 }, + { start: 0x9b9f, end: 0x9ba0, idx: 13631 }, + { start: 0x9ba8, end: 0x9bb9, idx: 13633 }, + { start: 0x9bc0, end: 0x9be8, idx: 13651 }, + { start: 0x9bf0, end: 0x9bf5, idx: 13692 }, + { start: 0x9c04, end: 0x9c25, idx: 13698 }, + { start: 0x9c2d, end: 0x9c32, idx: 13732 }, + { start: 0x9c39, end: 0x9c3e, idx: 13738 }, + { start: 0x9c46, end: 0x9c48, idx: 13744 }, + { start: 0x9c52, end: 0x9c60, idx: 13747 }, + { start: 0x9c67, end: 0x9c67, idx: 13762 }, + { start: 0x9c76, end: 0x9c78, idx: 13763 }, + { start: 0x9ce5, end: 0x9cf6, idx: 13766 }, + { start: 0x9d03, end: 0x9d2c, idx: 13784 }, + { start: 0x9d3b, end: 0x9d48, idx: 13826 }, + { start: 0x9d50, end: 0x9d51, idx: 13840 }, + { start: 0x9d59, end: 0x9d64, idx: 13842 }, + { start: 0x9d6c, end: 0x9d72, idx: 13854 }, + { start: 0x9d7a, end: 0x9d7a, idx: 13861 }, + { start: 0x9d87, end: 0x9d8f, idx: 13862 }, + { start: 0x9d9a, end: 0x9d9a, idx: 13871 }, + { start: 0x9da4, end: 0x9dc6, idx: 13872 }, + { start: 0x9dcf, end: 0x9dd9, idx: 13907 }, + { start: 0x9de6, end: 0x9de6, idx: 13918 }, + { start: 0x9ded, end: 0x9dfd, idx: 13919 }, + { start: 0x9e1a, end: 0x9e1e, idx: 13936 }, + { start: 0x9e75, end: 0x9e81, idx: 13941 }, + { start: 0x9e88, end: 0x9ead, idx: 13954 }, + { start: 0x9eb8, end: 0x9ec4, idx: 13992 }, + { start: 0x9ecc, end: 0x9ee8, idx: 14005 }, + { start: 0x9eef, end: 0x9efd, idx: 14034 }, + { start: 0x9f07, end: 0x9f15, idx: 14049 }, + { start: 0x9f20, end: 0x9f21, idx: 14064 }, + { start: 0x9f2c, end: 0x9f2c, idx: 14066 }, + { start: 0x9f3b, end: 0x9f3e, idx: 14067 }, + { start: 0x9f4a, end: 0x9f54, idx: 14071 }, + { start: 0x9f5f, end: 0x9f77, idx: 14082 }, + { start: 0x9f8d, end: 0x9f8d, idx: 14107 }, + { start: 0x9f95, end: 0x9f95, idx: 14108 }, + { start: 0x9f9c, end: 0x9fa0, idx: 14109 }, + { start: 0xff01, end: 0xff5d, idx: 14114 }, + { start: 0xffe3, end: 0xffe5, idx: 14207 }, + { start: 0xffff, end: 0xffff, idx: 0 } +}; + + +/* The following table is indexed using the previous tables. It is + therefore indexed using UCS with leaving large gaps out. It can + be computed with + + egrep '^0x' < .../eastasia/jis/jis0208.txt | awk '{ print $3, $2}' | + egrep '^0x[^01]' | sort -u | perl tag.pl + + where tab.pl is + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $n=$first=$last=$idx=0; + + sub fmt { + printf ("\n ") if (($n % 6) == 0); + ++$n; + my($val) = pop(@_); + printf (" \"\\x%02x\\x%02x\",", int($val / 256), $val % 256); + } + + while (<>) { + local($ucs,$jis,%rest) = split; + local($u)=hex($ucs); + local($j)=hex($jis); + if ($u - $last > 6) { + if ($last != 0) { + $idx += $last - $first + 1; + } + $first=$u; + } else { + for ($m = $last + 1; $m < $u; ++$m) { + fmt (0); + } + } + fmt ($j); + $last=$u; + } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +const char __jisx0208_from_ucs_tab[14210][2] = +{ + "\x21\x3e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x21\x3d", + "\x21\x42", "\x00\x00", "\x21\x46", "\x21\x47", "\x00\x00", "\x00\x00", + "\x21\x48", "\x21\x49", "\x00\x00", "\x00\x00", "\x22\x77", "\x22\x78", + "\x00\x00", "\x00\x00", "\x00\x00", "\x21\x45", "\x21\x44", "\x22\x73", + "\x00\x00", "\x21\x6c", "\x21\x6d", "\x22\x28", "\x21\x6e", "\x22\x72", + "\x22\x2b", "\x22\x2c", "\x22\x2a", "\x22\x2d", "\x22\x4d", "\x00\x00", + "\x22\x4e", "\x22\x4f", "\x00\x00", "\x22\x5f", "\x22\x50", "\x00\x00", + "\x00\x00", "\x00\x00", "\x22\x60", "\x22\x3a", "\x00\x00", "\x00\x00", + "\x22\x3b", "\x21\x5d", "\x22\x65", "\x00\x00", "\x00\x00", "\x22\x67", + "\x21\x67", "\x00\x00", "\x22\x5c", "\x22\x4a", "\x22\x4b", "\x22\x41", + "\x22\x40", "\x22\x69", "\x22\x6a", "\x21\x68", "\x22\x68", "\x22\x66", + "\x22\x62", "\x21\x62", "\x22\x61", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x21\x65", "\x21\x66", "\x00\x00", "\x00\x00", "\x22\x63", + "\x22\x64", "\x22\x3e", "\x22\x3f", "\x00\x00", "\x00\x00", "\x22\x3c", + "\x22\x3d", "\x22\x5d", "\x22\x5e", "\x28\x21", "\x28\x2c", "\x28\x22", + "\x28\x2d", "\x28\x23", "\x00\x00", "\x00\x00", "\x28\x2e", "\x28\x24", + "\x00\x00", "\x00\x00", "\x28\x2f", "\x28\x26", "\x00\x00", "\x00\x00", + "\x28\x31", "\x28\x25", "\x00\x00", "\x00\x00", "\x28\x30", "\x28\x27", + "\x28\x3c", "\x00\x00", "\x00\x00", "\x28\x37", "\x00\x00", "\x00\x00", + "\x28\x32", "\x28\x29", "\x28\x3e", "\x00\x00", "\x00\x00", "\x28\x39", + "\x00\x00", "\x00\x00", "\x28\x34", "\x28\x28", "\x00\x00", "\x00\x00", + "\x28\x38", "\x28\x3d", "\x00\x00", "\x00\x00", "\x28\x33", "\x28\x2a", + "\x00\x00", "\x00\x00", "\x28\x3a", "\x28\x3f", "\x00\x00", "\x00\x00", + "\x28\x35", "\x28\x2b", "\x00\x00", "\x00\x00", "\x28\x3b", "\x00\x00", + "\x00\x00", "\x28\x40", "\x28\x36", "\x22\x23", "\x22\x22", "\x22\x25", + "\x22\x24", "\x22\x27", "\x22\x26", "\x22\x21", "\x21\x7e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x21\x7b", "\x00\x00", "\x00\x00", "\x21\x7d", + "\x21\x7c", "\x22\x7e", "\x21\x7a", "\x21\x79", "\x21\x6a", "\x00\x00", + "\x21\x69", "\x22\x76", "\x00\x00", "\x00\x00", "\x22\x75", "\x00\x00", + "\x22\x74", "\x21\x21", "\x21\x22", "\x21\x23", "\x21\x37", "\x00\x00", + "\x21\x39", "\x21\x3a", "\x21\x3b", "\x21\x52", "\x21\x53", "\x21\x54", + "\x21\x55", "\x21\x56", "\x21\x57", "\x21\x58", "\x21\x59", "\x21\x5a", + "\x21\x5b", "\x22\x29", "\x22\x2e", "\x21\x4c", "\x21\x4d", "\x21\x41", + "\x24\x21", "\x24\x22", "\x24\x23", "\x24\x24", "\x24\x25", "\x24\x26", + "\x24\x27", "\x24\x28", "\x24\x29", "\x24\x2a", "\x24\x2b", "\x24\x2c", + "\x24\x2d", "\x24\x2e", "\x24\x2f", "\x24\x30", "\x24\x31", "\x24\x32", + "\x24\x33", "\x24\x34", "\x24\x35", "\x24\x36", "\x24\x37", "\x24\x38", + "\x24\x39", "\x24\x3a", "\x24\x3b", "\x24\x3c", "\x24\x3d", "\x24\x3e", + "\x24\x3f", "\x24\x40", "\x24\x41", "\x24\x42", "\x24\x43", "\x24\x44", + "\x24\x45", "\x24\x46", "\x24\x47", "\x24\x48", "\x24\x49", "\x24\x4a", + "\x24\x4b", "\x24\x4c", "\x24\x4d", "\x24\x4e", "\x24\x4f", "\x24\x50", + "\x24\x51", "\x24\x52", "\x24\x53", "\x24\x54", "\x24\x55", "\x24\x56", + "\x24\x57", "\x24\x58", "\x24\x59", "\x24\x5a", "\x24\x5b", "\x24\x5c", + "\x24\x5d", "\x24\x5e", "\x24\x5f", "\x24\x60", "\x24\x61", "\x24\x62", + "\x24\x63", "\x24\x64", "\x24\x65", "\x24\x66", "\x24\x67", "\x24\x68", + "\x24\x69", "\x24\x6a", "\x24\x6b", "\x24\x6c", "\x24\x6d", "\x24\x6e", + "\x24\x6f", "\x24\x70", "\x24\x71", "\x24\x72", "\x24\x73", "\x21\x2b", + "\x21\x2c", "\x21\x35", "\x21\x36", "\x00\x00", "\x00\x00", "\x25\x21", + "\x25\x22", "\x25\x23", "\x25\x24", "\x25\x25", "\x25\x26", "\x25\x27", + "\x25\x28", "\x25\x29", "\x25\x2a", "\x25\x2b", "\x25\x2c", "\x25\x2d", + "\x25\x2e", "\x25\x2f", "\x25\x30", "\x25\x31", "\x25\x32", "\x25\x33", + "\x25\x34", "\x25\x35", "\x25\x36", "\x25\x37", "\x25\x38", "\x25\x39", + "\x25\x3a", "\x25\x3b", "\x25\x3c", "\x25\x3d", "\x25\x3e", "\x25\x3f", + "\x25\x40", "\x25\x41", "\x25\x42", "\x25\x43", "\x25\x44", "\x25\x45", + "\x25\x46", "\x25\x47", "\x25\x48", "\x25\x49", "\x25\x4a", "\x25\x4b", + "\x25\x4c", "\x25\x4d", "\x25\x4e", "\x25\x4f", "\x25\x50", "\x25\x51", + "\x25\x52", "\x25\x53", "\x25\x54", "\x25\x55", "\x25\x56", "\x25\x57", + "\x25\x58", "\x25\x59", "\x25\x5a", "\x25\x5b", "\x25\x5c", "\x25\x5d", + "\x25\x5e", "\x25\x5f", "\x25\x60", "\x25\x61", "\x25\x62", "\x25\x63", + "\x25\x64", "\x25\x65", "\x25\x66", "\x25\x67", "\x25\x68", "\x25\x69", + "\x25\x6a", "\x25\x6b", "\x25\x6c", "\x25\x6d", "\x25\x6e", "\x25\x6f", + "\x25\x70", "\x25\x71", "\x25\x72", "\x25\x73", "\x25\x74", "\x25\x75", + "\x25\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x21\x26", + "\x21\x3c", "\x21\x33", "\x21\x34", "\x30\x6c", "\x43\x7a", "\x00\x00", + "\x3c\x37", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x7c", "\x3e\x66", + "\x3b\x30", "\x3e\x65", "\x32\x3c", "\x00\x00", "\x49\x54", "\x4d\x3f", + "\x00\x00", "\x50\x22", "\x31\x2f", "\x00\x00", "\x00\x00", "\x33\x6e", + "\x50\x23", "\x40\x24", "\x52\x42", "\x35\x56", "\x4a\x3a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x67", "\x00\x00", "\x00\x00", + "\x4e\x3e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x42", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x24", "\x00\x00", "\x00\x00", + "\x43\x66", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x25", "\x36\x7a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x26", "\x00\x00", "\x34\x5d", + "\x43\x30", "\x00\x00", "\x3c\x67", "\x50\x27", "\x00\x00", "\x00\x00", + "\x50\x28", "\x00\x00", "\x00\x00", "\x50\x29", "\x47\x35", "\x00\x00", + "\x35\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x37", "\x00\x00", "\x46\x63", "\x38\x43", "\x4b\x33", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x49", "\x50\x2a", + "\x3e\x68", "\x50\x2b", "\x32\x35", "\x00\x00", "\x00\x00", "\x00\x00", + "\x36\x65", "\x38\x70", "\x4c\x69", "\x00\x00", "\x00\x00", "\x56\x26", + "\x4d\x70", "\x00\x00", "\x46\x7d", "\x34\x25", "\x00\x00", "\x35\x35", + "\x00\x00", "\x50\x2c", "\x00\x00", "\x00\x00", "\x50\x2d", "\x4e\x3b", + "\x00\x00", "\x4d\x3d", "\x41\x68", "\x50\x2f", "\x3b\x76", "\x46\x73", + "\x00\x00", "\x50\x32", "\x00\x00", "\x00\x00", "\x31\x3e", "\x38\x5f", + "\x00\x00", "\x38\x5e", "\x30\x66", "\x00\x00", "\x00\x00", "\x4f\x4b", + "\x4f\x4a", "\x00\x00", "\x3a\x33", "\x30\x21", "\x00\x00", "\x50\x33", + "\x50\x34", "\x50\x35", "\x4b\x34", "\x50\x36", "\x00\x00", "\x38\x72", + "\x30\x67", "\x4b\x72", "\x00\x00", "\x35\x7c", "\x00\x00", "\x00\x00", + "\x35\x7d", "\x35\x7e", "\x44\x62", "\x4e\x3c", "\x00\x00", "\x50\x37", + "\x00\x00", "\x00\x00", "\x50\x38", "\x00\x00", "\x00\x00", "\x50\x39", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x4d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x3a", "\x3f\x4e", "\x50\x3e", + "\x00\x00", "\x50\x3c", "\x00\x00", "\x50\x3d", "\x35\x58", "\x00\x00", + "\x00\x00", "\x3a\x23", "\x32\x70", "\x00\x00", "\x50\x3b", "\x50\x3a", + "\x4a\x29", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x46", + "\x3b\x45", "\x42\x3e", "\x50\x3f", "\x49\x55", "\x40\x67", "\x00\x00", + "\x00\x00", "\x00\x00", "\x21\x38", "\x50\x40", "\x50\x42", "\x00\x00", + "\x00\x00", "\x00\x00", "\x42\x65", "\x4e\x61", "\x30\x4a", "\x50\x41", + "\x32\x3e", "\x00\x00", "\x36\x44", "\x00\x00", "\x43\x67", "\x00\x00", + "\x00\x00", "\x00\x00", "\x37\x6f", "\x50\x43", "\x00\x00", "\x00\x00", + "\x00\x00", "\x47\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x34\x6b", "\x50\x44", "\x30\x4b", "\x00\x00", "\x00\x00", + "\x38\x60", "\x34\x6c", "\x49\x7a", "\x48\x32", "\x35\x59", "\x32\x71", + "\x00\x00", "\x50\x67", "\x45\x41", "\x47\x6c", "\x50\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x48\x3c", "\x00\x00", "\x4e\x62", "\x00\x00", + "\x3f\x2d", "\x00\x00", "\x3b\x47", "\x00\x00", "\x3b\x77", "\x32\x40", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x51", + "\x00\x00", "\x00\x00", "\x43\x22", "\x50\x4a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x4c", "\x44\x63", "\x3d\x3b", + "\x3a\x34", "\x4d\x24", "\x00\x00", "\x42\x4e", "\x00\x00", "\x32\x3f", + "\x00\x00", "\x50\x49", "\x00\x00", "\x4d\x3e", "\x50\x45", "\x50\x47", + "\x3a\x6e", "\x50\x48", "\x55\x24", "\x50\x50", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x53", "\x50\x51", "\x00\x00", + "\x00\x00", "\x32\x42", "\x00\x00", "\x4a\x3b", "\x50\x4b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x4f", "\x38\x73", "\x00\x00", + "\x00\x00", "\x3b\x48", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x26", + "\x00\x00", "\x00\x00", "\x50\x54", "\x00\x00", "\x50\x4c", "\x00\x00", + "\x00\x00", "\x4e\x63", "\x00\x00", "\x3b\x78", "\x00\x00", "\x50\x4d", + "\x00\x00", "\x50\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x50\x55", "\x00\x00", "\x50\x4e", "\x00\x00", "\x00\x00", "\x36\x21", + "\x00\x00", "\x30\x4d", "\x00\x00", "\x00\x00", "\x36\x22", "\x32\x41", + "\x55\x25", "\x00\x00", "\x4b\x79", "\x49\x6e", "\x38\x74", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x2f", "\x4e\x37", + "\x4a\x58", "\x00\x00", "\x00\x00", "\x37\x38", "\x42\x25", "\x32\x64", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x53", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x59", "\x00\x00", "\x50\x5e", + "\x50\x5c", "\x00\x00", "\x00\x00", "\x50\x57", "\x00\x00", "\x00\x00", + "\x42\x2f", "\x50\x5a", "\x00\x00", "\x50\x5d", "\x50\x5b", "\x00\x00", + "\x4a\x5d", "\x00\x00", "\x50\x58", "\x00\x00", "\x3f\x2e", "\x00\x00", + "\x4b\x73", "\x50\x5f", "\x50\x60", "\x3d\x24", "\x50\x6d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x47\x50", "\x00\x00", "\x49\x36", "\x50\x68", + "\x00\x00", "\x4a\x70", "\x00\x00", "\x32\x36", "\x00\x00", "\x00\x00", + "\x00\x00", "\x50\x6c", "\x50\x66", "\x50\x6f", "\x00\x00", "\x00\x00", + "\x41\x52", "\x00\x00", "\x38\x44", "\x00\x00", "\x47\x5c", "\x00\x00", + "\x60\x47", "\x00\x00", "\x50\x6e", "\x45\x5d", "\x00\x00", "\x50\x63", + "\x00\x00", "\x38\x76", "\x00\x00", "\x00\x00", "\x38\x75", "\x50\x61", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x5a", "\x00\x00", + "\x50\x69", "\x00\x00", "\x4a\x6f", "\x43\x4d", "\x50\x65", "\x37\x71", + "\x00\x00", "\x50\x62", "\x50\x6a", "\x50\x64", "\x4e\x51", "\x50\x6b", + "\x4f\x41", "\x36\x66", "\x00\x00", "\x00\x00", "\x37\x70", "\x50\x70", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x71", "\x50\x75", "\x30\x4e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x50", + "\x50\x74", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x73", + "\x50\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x76", "\x00\x00", + "\x44\x64", "\x37\x72", "\x50\x78", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3c\x45", "\x00\x00", "\x42\x26", "\x44\x65", + "\x36\x76", "\x00\x00", "\x50\x79", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x36", "\x00\x00", "\x00\x00", "\x50\x7a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x7c", "\x4b\x35", "\x00\x00", + "\x00\x00", "\x00\x00", "\x37\x66", "\x3b\x31", "\x48\x77", "\x50\x7b", + "\x3a\x45", "\x4d\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x50\x7e", "\x51\x23", "\x50\x7d", "\x3a\x44", "\x00\x00", "\x3d\x7d", + "\x37\x39", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x24", "\x00\x00", + "\x00\x00", "\x36\x4f", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x21", + "\x51\x22", "\x00\x00", "\x00\x00", "\x46\x2f", "\x00\x00", "\x41\x7c", + "\x00\x00", "\x36\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x4d", + "\x51\x25", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x3d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x51\x26", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x51\x29", "\x00\x00", "\x51\x27", "\x00\x00", "\x41\x4e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x28", + "\x51\x2a", "\x51\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x2b", + "\x00\x00", "\x4a\x48", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x35\x37", "\x51\x2e", "\x51\x2f", "\x00\x00", "\x32\x2f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x2d", "\x3c\x74", "\x00\x00", + "\x51\x32", "\x51\x31", "\x51\x30", "\x00\x00", "\x50\x56", "\x00\x00", + "\x51\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x7e", + "\x00\x00", "\x51\x34", "\x4d\x25", "\x4c\x59", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x51\x36", "\x00\x00", "\x00\x00", "\x51\x35", + "\x51\x38", "\x51\x37", "\x00\x00", "\x00\x00", "\x51\x39", "\x51\x3a", + "\x30\x74", "\x00\x00", "\x38\x35", "\x37\x3b", "\x3d\x3c", "\x43\x7b", + "\x36\x24", "\x40\x68", "\x38\x77", "\x00\x00", "\x39\x6e", "\x51\x3c", + "\x4c\x48", "\x45\x46", "\x00\x00", "\x3b\x79", "\x00\x00", "\x51\x3b", + "\x00\x00", "\x51\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x45\x5e", "\x00\x00", "\x33\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x3e", "\x00\x00", "\x00\x00", + "\x46\x7e", "\x00\x00", "\x00\x00", "\x41\x34", "\x51\x40", "\x51\x41", + "\x48\x2c", "\x38\x78", "\x4f\x3b", "\x51\x42", "\x00\x00", "\x00\x00", + "\x36\x26", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x3c", "\x42\x36", + "\x36\x71", "\x45\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x73", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x43", "\x00\x00", "\x51\x44", + "\x00\x00", "\x00\x00", "\x46\x62", "\x31\x5f", "\x00\x00", "\x00\x00", + "\x51\x47", "\x3a\x7d", "\x00\x00", "\x51\x46", "\x3a\x46", "\x00\x00", + "\x51\x48", "\x66\x6e", "\x51\x49", "\x4b\x41", "\x51\x4a", "\x00\x00", + "\x51\x4b", "\x51\x4c", "\x3e\x69", "\x00\x00", "\x3c\x4c", "\x34\x27", + "\x00\x00", "\x51\x4f", "\x00\x00", "\x51\x4d", "\x4c\x3d", "\x51\x4e", + "\x00\x00", "\x49\x5a", "\x51\x50", "\x51\x51", "\x51\x52", "\x45\x5f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x56", "\x51\x54", "\x51\x55", + "\x51\x53", "\x3a\x63", "\x51\x57", "\x4c\x6a", "\x4e\x64", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x58", "\x40\x28", + "\x51\x59", "\x3d\x5a", "\x00\x00", "\x00\x00", "\x51\x5a", "\x00\x00", + "\x43\x7c", "\x4e\x3f", "\x45\x60", "\x52\x45", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x51\x5b", "\x74\x25", "\x36\x45", "\x00\x00", + "\x00\x00", "\x51\x5c", "\x4b\x5e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3d\x68", "\x42\x7c", "\x00\x00", "\x51\x5e", "\x46\x64", + "\x00\x00", "\x00\x00", "\x51\x5f", "\x00\x00", "\x00\x00", "\x51\x60", + "\x33\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x61", "\x36\x27", + "\x00\x00", "\x46\x4c", "\x31\x7a", "\x3d\x50", "\x00\x00", "\x00\x00", + "\x48\x21", "\x51\x62", "\x00\x00", "\x45\x61", "\x00\x00", "\x00\x00", + "\x3f\x4f", "\x51\x63", "\x00\x00", "\x4a\x2c", "\x40\x5a", "\x34\x22", + "\x00\x00", "\x34\x29", "\x51\x64", "\x00\x00", "\x00\x00", "\x51\x66", + "\x00\x00", "\x00\x00", "\x37\x3a", "\x00\x00", "\x00\x00", "\x51\x65", + "\x00\x00", "\x00\x00", "\x4e\x73", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x69", "\x48\x3d", "\x4a\x4c", "\x00\x00", + "\x51\x67", "\x00\x00", "\x4d\x78", "\x51\x68", "\x00\x00", "\x00\x00", + "\x00\x00", "\x51\x69", "\x00\x00", "\x45\x7e", "\x00\x00", "\x00\x00", + "\x51\x6a", "\x00\x00", "\x00\x00", "\x40\x29", "\x3a\x7e", "\x37\x74", + "\x51\x6b", "\x3b\x49", "\x39\x6f", "\x44\x66", "\x51\x6d", "\x00\x00", + "\x00\x00", "\x42\x27", "\x00\x00", "\x00\x00", "\x3a\x6f", "\x51\x6e", + "\x51\x6f", "\x41\x30", "\x00\x00", "\x51\x6c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x51\x71", "\x00\x00", "\x4b\x36", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x64", "\x00\x00", "\x00\x00", + "\x51\x70", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x75", + "\x3a\x5e", "\x47\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x74", + "\x51\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x7b", + "\x3e\x6a", "\x51\x7b", "\x33\x64", "\x51\x75", "\x51\x73", "\x41\x4f", + "\x51\x77", "\x00\x00", "\x51\x76", "\x00\x00", "\x00\x00", "\x00\x00", + "\x33\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x60", "\x51\x7c", + "\x4e\x2d", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x78", "\x00\x00", + "\x00\x00", "\x00\x00", "\x51\x7d", "\x51\x7a", "\x00\x00", "\x51\x79", + "\x4e\x4f", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x79", "\x32\x43", + "\x00\x00", "\x00\x00", "\x4e\x74", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x75", "\x45\x58", "\x39\x65", "\x52\x22", + "\x52\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x65", "\x00\x00", + "\x00\x00", "\x4f\x2b", "\x52\x25", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x7a", "\x00\x00", "\x00\x00", "\x52\x24", "\x00\x00", "\x33\x2f", + "\x00\x00", "\x00\x00", "\x52\x26", "\x00\x00", "\x4b\x56", "\x00\x00", + "\x44\x3c", "\x00\x00", "\x4d\x26", "\x00\x00", "\x4a\x59", "\x00\x00", + "\x00\x00", "\x00\x00", "\x52\x27", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x70\x55", "\x00\x00", "\x00\x00", "\x46\x30", "\x00\x00", + "\x52\x28", "\x34\x2a", "\x4c\x33", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3e\x21", "\x52\x29", "\x4a\x67", "\x52\x2d", "\x00\x00", "\x40\x2a", + "\x52\x2a", "\x36\x50", "\x00\x00", "\x52\x2b", "\x34\x2b", "\x37\x2e", + "\x52\x2e", "\x00\x00", "\x52\x2f", "\x00\x00", "\x00\x00", "\x52\x30", + "\x52\x31", "\x3c\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x7b", + "\x4c\x5e", "\x00\x00", "\x4c\x68", "\x46\x77", "\x00\x00", "\x00\x00", + "\x4a\x71", "\x52\x32", "\x00\x00", "\x52\x33", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x52\x35", "\x00\x00", "\x52\x37", "\x52\x36", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x38", "\x32\x3d", + "\x4b\x4c", "\x00\x00", "\x3a\x7c", "\x52\x39", "\x00\x00", "\x00\x00", + "\x41\x59", "\x00\x00", "\x00\x00", "\x3e\x22", "\x36\x29", "\x00\x00", + "\x52\x3a", "\x48\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x52\x3b", "\x00\x00", "\x52\x3c", "\x00\x00", "\x52\x3d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x3e", "\x49\x24", "\x36\x68", + "\x30\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x3f", "\x52\x3f", + "\x3d\x3d", "\x00\x00", "\x40\x69", "\x00\x00", "\x52\x41", "\x52\x40", + "\x3e\x23", "\x38\x61", "\x52\x43", "\x48\x3e", "\x00\x00", "\x00\x00", + "\x52\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x5c", "\x42\x34", + "\x42\x6e", "\x36\x28", "\x00\x00", "\x00\x00", "\x46\x6e", "\x43\x31", + "\x00\x00", "\x47\x6e", "\x00\x00", "\x4b\x4e", "\x00\x00", "\x52\x46", + "\x00\x00", "\x40\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x37\x35", "\x00\x00", "\x00\x00", "\x52\x47", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x48", "\x31\x2c", "\x30\x75", + "\x34\x6d", "\x00\x00", "\x42\x28", "\x35\x51", "\x4d\x71", "\x00\x00", + "\x52\x4b", "\x32\x37", "\x00\x00", "\x00\x00", "\x52\x4a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x36\x2a", "\x00\x00", "\x00\x00", "\x52\x4c", + "\x00\x00", "\x4c\x71", "\x52\x4d", "\x00\x00", "\x4e\x52", "\x00\x00", + "\x38\x7c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x36", + "\x52\x4e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x50", + "\x52\x4f", "\x00\x00", "\x3f\x5f", "\x31\x39", "\x00\x00", "\x00\x00", + "\x00\x00", "\x31\x5e", "\x52\x51", "\x00\x00", "\x52\x52", "\x00\x00", + "\x00\x00", "\x38\x37", "\x00\x00", "\x00\x00", "\x52\x53", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x6e", "\x3b\x32", "\x52\x54", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x74", "\x3a\x35", + "\x35\x5a", "\x4d\x27", "\x41\x50", "\x48\x3f", "\x3c\x7d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x47", "\x00\x00", + "\x3c\x68", "\x3c\x75", "\x00\x00", "\x3d\x76", "\x00\x00", "\x48\x40", + "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x57", "\x00\x00", "\x31\x43", + "\x41\x51", "\x38\x7d", "\x38\x45", "\x36\x67", "\x00\x00", "\x00\x00", + "\x52\x5b", "\x43\x21", "\x42\x7e", "\x36\x2b", "\x3e\x24", "\x52\x5c", + "\x52\x5a", "\x32\x44", "\x42\x66", "\x3c\x38", "\x3b\x4b", "\x31\x26", + "\x00\x00", "\x00\x00", "\x33\x70", "\x39\x66", "\x3b\x4a", "\x00\x00", + "\x52\x5d", "\x52\x5e", "\x00\x00", "\x35\x49", "\x33\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x39\x67", "\x35\x48", "\x44\x5f", "\x31\x25", + "\x46\x31", "\x4c\x3e", "\x39\x21", "\x4d\x79", "\x45\x47", "\x38\x7e", + "\x37\x2f", "\x00\x00", "\x52\x67", "\x00\x00", "\x36\x63", "\x4b\x4a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x5d", + "\x00\x00", "\x00\x00", "\x52\x66", "\x00\x00", "\x34\x5e", "\x52\x61", + "\x52\x62", "\x52\x64", "\x52\x65", "\x00\x00", "\x35\x5b", "\x3f\x61", + "\x00\x00", "\x4a\x2d", "\x52\x63", "\x52\x5f", "\x38\x63", "\x00\x00", + "\x52\x60", "\x00\x00", "\x4f\x24", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x72", "\x00\x00", "\x44\x68", "\x38\x62", "\x39\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x52\x68", "\x00\x00", "\x00\x00", "\x46\x5d", + "\x52\x6c", "\x3c\x7e", "\x00\x00", "\x3c\x76", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x6f", "\x52\x6d", "\x00\x00", + "\x4c\x23", "\x00\x00", "\x52\x6a", "\x52\x73", "\x52\x6e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x52\x71", "\x38\x46", "\x4c\x3f", "\x00\x00", + "\x00\x00", "\x52\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x74", + "\x00\x00", "\x52\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3a\x70", "\x4f\x42", "\x00\x00", "\x52\x6b", "\x52\x69", "\x52\x75", + "\x00\x00", "\x52\x70", "\x52\x78", "\x00\x00", "\x53\x23", "\x52\x7a", + "\x00\x00", "\x00\x00", "\x52\x7e", "\x00\x00", "\x00\x00", "\x53\x21", + "\x52\x7b", "\x00\x00", "\x00\x00", "\x53\x3e", "\x00\x00", "\x00\x00", + "\x3a\x69", "\x33\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x52\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x25", "\x30\x76", + "\x53\x24", "\x00\x00", "\x30\x25", "\x49\x4a", "\x53\x22", "\x00\x00", + "\x52\x7c", "\x00\x00", "\x00\x00", "\x52\x77", "\x52\x7d", "\x3a\x48", + "\x53\x26", "\x30\x77", "\x53\x2f", "\x00\x00", "\x00\x00", "\x53\x27", + "\x53\x28", "\x00\x00", "\x3e\x25", "\x4b\x69", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x2d", "\x53\x2c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x45\x2f", "\x53\x2e", "\x00\x00", "\x00\x00", "\x53\x2b", "\x31\x34", + "\x00\x00", "\x3a\x36", "\x3f\x30", "\x53\x29", "\x45\x62", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x2a", "\x00\x00", "\x30\x22", "\x53\x34", + "\x4d\x23", "\x00\x00", "\x3e\x27", "\x00\x00", "\x53\x3a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x39", "\x53\x30", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x43", "\x00\x00", "\x53\x31", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x6f", "\x53\x36", "\x3e\x26", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x33", + "\x00\x00", "\x00\x00", "\x4c\x64", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x3c", "\x00\x00", "\x00\x00", "\x53\x37", "\x53\x38", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x35", "\x53\x3b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x32", "\x53\x41", + "\x53\x46", "\x00\x00", "\x53\x42", "\x00\x00", "\x53\x3d", "\x00\x00", + "\x00\x00", "\x53\x47", "\x41\x31", "\x00\x00", "\x00\x00", "\x53\x49", + "\x00\x00", "\x39\x22", "\x53\x3f", "\x43\x7d", "\x53\x43", "\x53\x3c", + "\x34\x2d", "\x00\x00", "\x34\x6e", "\x33\x65", "\x53\x44", "\x53\x40", + "\x37\x76", "\x53\x4a", "\x53\x48", "\x41\x53", "\x35\x4a", "\x36\x2c", + "\x00\x00", "\x53\x45", "\x00\x00", "\x36\x74", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x44", "\x53\x4e", "\x53\x4c", + "\x00\x00", "\x54\x27", "\x53\x51", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x4b", "\x00\x00", "\x53\x4f", "\x00\x00", + "\x00\x00", "\x53\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x4c", + "\x53\x50", "\x53\x53", "\x00\x00", "\x53\x58", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x56", "\x53\x55", "\x43\x32", "\x00\x00", "\x00\x00", + "\x32\x45", "\x53\x52", "\x00\x00", "\x53\x54", "\x3e\x28", "\x31\x33", + "\x00\x00", "\x00\x00", "\x53\x57", "\x32\x5e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x62", "\x00\x00", "\x3e\x7c", + "\x53\x5e", "\x00\x00", "\x53\x5c", "\x00\x00", "\x53\x5d", "\x00\x00", + "\x53\x5f", "\x31\x3d", "\x41\x39", "\x00\x00", "\x53\x59", "\x00\x00", + "\x53\x5a", "\x33\x7a", "\x53\x61", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x6f", "\x00\x00", "\x53\x64", "\x53\x60", "\x53\x63", "\x4a\x2e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x55", "\x00\x00", "\x48\x38", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x66", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x65", + "\x33\x45", "\x00\x00", "\x00\x00", "\x53\x67", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x6a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x69", "\x53\x68", "\x00\x00", "\x47\x39", "\x00\x00", + "\x00\x00", "\x53\x6b", "\x53\x6c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x6e", "\x00\x00", "\x53\x6d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x73", "\x53\x71", "\x53\x6f", "\x53\x72", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x74", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x75", "\x00\x00", + "\x00\x00", "\x53\x76", "\x00\x00", "\x53\x77", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x78", "\x51\x45", "\x00\x00", "\x3c\x7c", "\x3b\x4d", + "\x00\x00", "\x00\x00", "\x32\x73", "\x00\x00", "\x30\x78", "\x00\x00", + "\x00\x00", "\x43\x44", "\x53\x79", "\x00\x00", "\x3a\x24", "\x00\x00", + "\x30\x4f", "\x3f\x5e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x7a", "\x38\x47", "\x00\x00", "\x00\x00", "\x39\x71", + "\x00\x00", "\x53\x7c", "\x53\x7b", "\x00\x00", "\x00\x00", "\x4a\x60", + "\x53\x7d", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x21", "\x53\x7e", + "\x00\x00", "\x54\x22", "\x00\x00", "\x54\x23", "\x00\x00", "\x37\x77", + "\x00\x00", "\x00\x00", "\x31\x60", "\x54\x24", "\x00\x00", "\x00\x00", + "\x54\x26", "\x00\x00", "\x54\x25", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x28", "\x00\x00", "\x00\x00", "\x45\x5a", "\x54\x29", "\x30\x35", + "\x3a\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x3d", + "\x00\x00", "\x00\x00", "\x43\x4f", "\x54\x2a", "\x54\x2b", "\x00\x00", + "\x00\x00", "\x54\x2d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x2e", "\x00\x00", "\x3a\x64", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x36\x51", "\x00\x00", "\x00\x00", "\x4b\x37", "\x00\x00", + "\x00\x00", "\x00\x00", "\x54\x2c", "\x54\x2f", "\x3a\x41", "\x39\x23", + "\x54\x33", "\x00\x00", "\x00\x00", "\x3a\x25", "\x00\x00", "\x43\x33", + "\x00\x00", "\x00\x00", "\x54\x30", "\x44\x5a", "\x54\x34", "\x00\x00", + "\x00\x00", "\x3f\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x54\x32", "\x54\x35", "\x00\x00", "\x37\x3f", "\x54\x36", + "\x54\x37", "\x00\x00", "\x39\x24", "\x33\x40", "\x54\x39", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x3a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x3b", "\x00\x00", + "\x00\x00", "\x54\x38", "\x54\x31", "\x00\x00", "\x00\x00", "\x54\x3c", + "\x00\x00", "\x00\x00", "\x54\x3d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x64", "\x00\x00", "\x00\x00", "\x3e\x6b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x54\x3f", "\x54\x40", "\x54\x3e", "\x00\x00", + "\x54\x42", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x38", "\x00\x00", "\x00\x00", "\x30\x68", "\x49\x56", "\x00\x00", + "\x00\x00", "\x54\x43", "\x3e\x7d", "\x00\x00", "\x00\x00", "\x3c\x39", + "\x00\x00", "\x47\x5d", "\x34\x70", "\x00\x00", "\x3a\x6b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4b\x59", "\x00\x00", "\x46\x32", "\x00\x00", + "\x00\x00", "\x37\x78", "\x42\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x41", "\x54\x44", "\x42\x44", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x45", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x54\x48", "\x00\x00", "\x00\x00", "\x44\x69", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x2e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x74\x21", "\x31\x61", + "\x4a\x73", "\x00\x00", "\x00\x00", "\x3e\x6c", "\x45\x48", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x66", "\x00\x00", "\x00\x00", + "\x54\x4e", "\x00\x00", "\x00\x00", "\x4a\x3d", "\x4e\x5d", "\x32\x74", + "\x54\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x41\x3a", "\x54\x4d", "\x00\x00", "\x45\x63", "\x00\x00", "\x00\x00", + "\x45\x49", "\x45\x64", "\x48\x39", "\x44\x4d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3a\x49", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x49", + "\x31\x76", "\x00\x00", "\x45\x36", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x54\x4b", "\x00\x00", "\x54\x47", "\x00\x00", "\x00\x00", + "\x3f\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x4f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x4e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x36\x2d", "\x00\x00", "\x54\x50", "\x4a\x68", + "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x7d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x44\x46", "\x00\x00", "\x00\x00", "\x54\x52", + "\x4b\x4f", "\x00\x00", "\x00\x00", "\x54\x53", "\x00\x00", "\x00\x00", + "\x54\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x2f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x57", "\x54\x51", + "\x54\x54", "\x54\x56", "\x00\x00", "\x00\x00", "\x3a\x26", "\x00\x00", + "\x00\x00", "\x4a\x49", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x59", + "\x00\x00", "\x43\x45", "\x00\x00", "\x00\x00", "\x32\x75", "\x00\x00", + "\x3e\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x5b", + "\x00\x00", "\x54\x5a", "\x00\x00", "\x39\x68", "\x00\x00", "\x54\x5c", + "\x54\x5e", "\x54\x5d", "\x00\x00", "\x00\x00", "\x54\x60", "\x00\x00", + "\x54\x55", "\x54\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x61", "\x54\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3b\x4e", "\x3f\x51", "\x00\x00", "\x41\x54", "\x54\x63", + "\x40\x3c", "\x30\x6d", "\x47\x64", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x44\x5b", "\x00\x00", "\x54\x65", "\x54\x64", "\x54\x66", + "\x54\x67", "\x54\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x69", "\x4a\x51", "\x54\x6a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x32\x46", "\x54\x6b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4d\x3c", "\x33\x30", "\x00\x00", "\x52\x49", "\x3d\x48", + "\x42\x3f", "\x54\x6c", "\x4c\x6b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4c\x34", "\x00\x00", "\x00\x00", "\x54\x6e", + "\x00\x00", "\x42\x67", "\x00\x00", "\x45\x37", "\x42\x40", "\x49\x57", + "\x54\x6f", "\x54\x70", "\x31\x7b", "\x00\x00", "\x00\x00", "\x3c\x3a", + "\x54\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x50", + "\x54\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x73", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x31\x62", "\x00\x00", "\x00\x00", "\x34\x71", "\x46\x60", "\x4a\x74", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x77", "\x41\x55", + "\x54\x76", "\x37\x40", "\x00\x00", "\x00\x00", "\x4b\x5b", "\x54\x75", + "\x00\x00", "\x45\x65", "\x54\x79", "\x00\x00", "\x54\x78", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x7b", "\x00\x00", + "\x54\x7a", "\x00\x00", "\x00\x00", "\x31\x7c", "\x00\x00", "\x54\x7c", + "\x3e\x29", "\x54\x7e", "\x43\x25", "\x00\x00", "\x54\x7d", "\x00\x00", + "\x4a\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x77", + "\x45\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x21", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x25", "\x00\x00", "\x00\x00", + "\x00\x00", "\x55\x22", "\x47\x21", "\x48\x5e", "\x4c\x51", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x25", "\x00\x00", + "\x00\x00", "\x55\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x38", "\x00\x00", "\x00\x00", "\x4d\x45", "\x00\x00", + "\x00\x00", "\x4c\x2f", "\x00\x00", "\x56\x2c", "\x00\x00", "\x55\x23", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x26", + "\x00\x00", "\x42\x45", "\x00\x00", "\x00\x00", "\x4b\x38", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x55\x27", "\x4b\x65", "\x00\x00", "\x3a\x4a", + "\x00\x00", "\x00\x00", "\x3e\x2a", "\x55\x28", "\x00\x00", "\x00\x00", + "\x3b\x50", "\x00\x00", "\x3b\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x30\x39", "\x38\x48", "\x00\x00", "\x40\x2b", "\x30\x51", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x2c", "\x55\x2d", + "\x00\x00", "\x55\x2a", "\x31\x38", "\x34\x2f", "\x00\x00", "\x55\x29", + "\x00\x00", "\x4c\x45", "\x49\x31", "\x30\x28", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x30\x79", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3b\x51", "\x00\x00", "\x30\x52", "\x00\x00", "\x30\x23", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x32", "\x55\x30", + "\x4c\x3c", "\x00\x00", "\x55\x33", "\x00\x00", "\x55\x31", "\x00\x00", + "\x00\x00", "\x55\x2f", "\x3f\x31", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x55\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x64", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x37", + "\x55\x38", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3e\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x34", "\x4f\x2c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x4c", "\x00\x00", + "\x00\x00", "\x55\x36", "\x3a\x27", "\x55\x39", "\x00\x00", "\x00\x00", + "\x00\x00", "\x49\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x3a", + "\x00\x00", "\x55\x35", "\x4c\x3b", "\x47\x5e", "\x55\x3b", "\x49\x32", + "\x55\x3c", "\x55\x40", "\x55\x3d", "\x00\x00", "\x00\x00", "\x32\x47", + "\x55\x3f", "\x3c\x3b", "\x00\x00", "\x55\x3e", "\x37\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x55\x4c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x55\x45", "\x55\x42", "\x43\x64", "\x00\x00", + "\x55\x41", "\x00\x00", "\x00\x00", "\x55\x43", "\x00\x00", "\x00\x00", + "\x55\x44", "\x55\x46", "\x55\x47", "\x34\x72", "\x00\x00", "\x55\x49", + "\x55\x48", "\x55\x4a", "\x3e\x6e", "\x55\x4d", "\x00\x00", "\x44\x5c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x45", "\x00\x00", "\x55\x4b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x4e", "\x55\x4f", "\x00\x00", + "\x55\x52", "\x00\x00", "\x00\x00", "\x55\x50", "\x00\x00", "\x55\x51", + "\x3b\x52", "\x55\x53", "\x00\x00", "\x00\x00", "\x39\x26", "\x55\x54", + "\x00\x00", "\x3b\x7a", "\x42\x38", "\x00\x00", "\x55\x55", "\x55\x56", + "\x3b\x5a", "\x39\x27", "\x00\x00", "\x4c\x52", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x28", "\x38\x49", "\x55\x57", "\x33\x58", "\x00\x00", + "\x00\x00", "\x55\x58", "\x00\x00", "\x42\x39", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x55\x59", "\x56\x23", "\x00\x00", "\x55\x5a", + "\x00\x00", "\x55\x5b", "\x00\x00", "\x00\x00", "\x55\x5c", "\x00\x00", + "\x55\x5e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x55\x5f", "\x00\x00", "\x00\x00", "\x55\x60", "\x00\x00", "\x42\x70", + "\x00\x00", "\x31\x27", "\x3c\x69", "\x30\x42", "\x00\x00", "\x41\x57", + "\x34\x30", "\x3c\x35", "\x00\x00", "\x39\x28", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x66", "\x00\x00", "\x3d\x21", + "\x34\x31", "\x43\x68", "\x44\x6a", "\x30\x38", "\x35\x39", "\x4a\x75", + "\x00\x00", "\x3c\x42", "\x00\x00", "\x00\x00", "\x35\x52", "\x40\x6b", + "\x3c\x3c", "\x4d\x28", "\x55\x61", "\x35\x5c", "\x00\x00", "\x3a\x4b", + "\x00\x00", "\x00\x00", "\x33\x32", "\x31\x63", "\x3e\x2c", "\x32\x48", + "\x00\x00", "\x55\x62", "\x4d\x46", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x49", "\x00\x00", "\x00\x00", "\x3c\x64", + "\x55\x63", "\x34\x73", "\x46\x52", "\x4c\x29", "\x55\x64", "\x00\x00", + "\x55\x65", "\x00\x00", "\x00\x00", "\x49\x59", "\x00\x00", "\x00\x00", + "\x00\x00", "\x55\x67", "\x00\x00", "\x34\x28", "\x36\x77", "\x55\x66", + "\x34\x32", "\x00\x00", "\x3f\x32", "\x55\x6b", "\x3b\x21", "\x00\x00", + "\x32\x49", "\x55\x6a", "\x00\x00", "\x55\x68", "\x55\x6c", "\x55\x69", + "\x47\x2b", "\x5c\x4d", "\x3f\x33", "\x00\x00", "\x55\x6d", "\x00\x00", + "\x00\x00", "\x4e\x40", "\x00\x00", "\x55\x6e", "\x00\x00", "\x00\x00", + "\x55\x70", "\x00\x00", "\x43\x7e", "\x55\x6f", "\x00\x00", "\x40\x23", + "\x00\x00", "\x3b\x7b", "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x50", + "\x3c\x77", "\x00\x00", "\x49\x75", "\x40\x6c", "\x00\x00", "\x3c\x4d", + "\x55\x71", "\x3e\x2d", "\x55\x72", "\x55\x73", "\x30\x53", "\x42\x3a", + "\x3f\x52", "\x00\x00", "\x55\x74", "\x46\x33", "\x3e\x2e", "\x00\x00", + "\x3e\x2f", "\x00\x00", "\x55\x75", "\x00\x00", "\x00\x00", "\x40\x6d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x30", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x76", "\x00\x00", "\x55\x77", + "\x00\x00", "\x4c\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x78", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x22", "\x55\x79", "\x55\x7a", "\x3c\x5c", + "\x3f\x2c", "\x46\x74", "\x3f\x54", "\x48\x78", "\x47\x22", "\x36\x49", + "\x55\x7b", "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x6f", "\x55\x7c", + "\x00\x00", "\x36\x7e", "\x00\x00", "\x46\x4f", "\x32\x30", "\x00\x00", + "\x3b\x53", "\x55\x7d", "\x56\x22", "\x56\x21", "\x36\x7d", "\x00\x00", + "\x55\x7e", "\x00\x00", "\x45\x38", "\x42\x30", "\x00\x00", "\x45\x4b", + "\x3c\x48", "\x00\x00", "\x00\x00", "\x41\x58", "\x4d\x7a", "\x56\x24", + "\x00\x00", "\x56\x25", "\x46\x56", "\x00\x00", "\x3b\x33", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x27", "\x00\x00", "\x00\x00", + "\x56\x28", "\x56\x29", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x74", + "\x56\x2a", "\x00\x00", "\x00\x00", "\x56\x2b", "\x32\x2c", "\x41\x3b", + "\x34\x64", "\x00\x00", "\x56\x2d", "\x4c\x28", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x42\x52", "\x00\x00", "\x33\x59", "\x00\x00", + "\x00\x00", "\x56\x2f", "\x56\x31", "\x34\x5f", "\x00\x00", "\x00\x00", + "\x56\x2e", "\x56\x30", "\x00\x00", "\x56\x33", "\x56\x32", "\x00\x00", + "\x56\x34", "\x56\x35", "\x46\x3d", "\x36\x2e", "\x32\x65", "\x56\x36", + "\x56\x3b", "\x00\x00", "\x00\x00", "\x56\x39", "\x00\x00", "\x4a\x77", + "\x4a\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x45\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x38", "\x3d\x54", + "\x00\x00", "\x56\x37", "\x3f\x72", "\x00\x00", "\x00\x00", "\x00\x00", + "\x56\x3c", "\x00\x00", "\x00\x00", "\x3a\x6a", "\x00\x00", "\x00\x00", + "\x56\x42", "\x00\x00", "\x00\x00", "\x56\x43", "\x56\x3d", "\x33\x33", + "\x56\x3e", "\x56\x47", "\x56\x46", "\x56\x45", "\x56\x41", "\x00\x00", + "\x00\x00", "\x00\x00", "\x56\x40", "\x00\x00", "\x00\x00", "\x56\x44", + "\x4a\x78", "\x56\x4b", "\x56\x48", "\x00\x00", "\x56\x4a", "\x00\x00", + "\x4d\x72", "\x00\x00", "\x56\x49", "\x56\x3f", "\x3f\x73", "\x00\x00", + "\x00\x00", "\x56\x4c", "\x00\x00", "\x00\x00", "\x3a\x37", "\x00\x00", + "\x00\x00", "\x00\x00", "\x56\x4d", "\x00\x00", "\x00\x00", "\x56\x4e", + "\x56\x51", "\x00\x00", "\x56\x50", "\x00\x00", "\x00\x00", "\x56\x4f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x68", "\x56\x3a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x56\x57", "\x56\x53", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x56\x52", "\x56\x54", "\x00\x00", "\x56\x55", + "\x56\x58", "\x00\x00", "\x00\x00", "\x4e\x66", "\x00\x00", "\x56\x59", + "\x56\x56", "\x56\x5a", "\x00\x00", "\x00\x00", "\x34\x60", "\x56\x5b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x5d", "\x56\x5c", + "\x00\x00", "\x00\x00", "\x56\x5e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x5f", "\x00\x00", "\x40\x6e", "\x3d\x23", "\x00\x00", + "\x00\x00", "\x3d\x64", "\x00\x00", "\x41\x63", "\x00\x00", "\x39\x29", + "\x3a\x38", "\x39\x2a", "\x35\x70", "\x00\x00", "\x00\x00", "\x56\x60", + "\x00\x00", "\x00\x00", "\x3a\x39", "\x00\x00", "\x00\x00", "\x38\x4a", + "\x56\x61", "\x4c\x26", "\x47\x43", "\x56\x62", "\x00\x00", "\x39\x2b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x2c", "\x00\x00", "\x43\x27", + "\x36\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x54", "\x49\x5b", + "\x00\x00", "\x00\x00", "\x48\x41", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x63", "\x34\x75", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x66", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x21", "\x00\x00", "\x00\x00", "\x56\x65", "\x56\x64", "\x56\x67", + "\x00\x00", "\x44\x6b", "\x3f\x63", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3b\x55", "\x00\x00", "\x40\x4a", "\x00\x00", + "\x42\x53", "\x35\x22", "\x00\x00", "\x00\x00", "\x44\x22", "\x00\x00", + "\x00\x00", "\x56\x68", "\x56\x69", "\x3e\x6f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4b\x39", "\x00\x00", "\x00\x00", "\x56\x6c", + "\x00\x00", "\x00\x00", "\x56\x6b", "\x56\x6a", "\x49\x7d", "\x00\x00", + "\x56\x73", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x5a", + "\x00\x00", "\x56\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x6f", "\x4b\x6b", "\x00\x00", "\x56\x6e", "\x56\x70", + "\x00\x00", "\x48\x28", "\x56\x71", "\x4a\x3e", "\x56\x72", "\x34\x33", + "\x4a\x3f", "\x47\x2f", "\x56\x74", "\x56\x75", "\x00\x00", "\x39\x2c", + "\x34\x34", "\x56\x76", "\x38\x38", "\x4d\x44", "\x4d\x29", "\x34\x76", + "\x56\x78", "\x00\x00", "\x44\x23", "\x00\x00", "\x39\x2d", "\x3e\x31", + "\x00\x00", "\x00\x00", "\x48\x5f", "\x00\x00", "\x00\x00", "\x3e\x32", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x78", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x6c", "\x4a\x79", + "\x45\x39", "\x00\x00", "\x00\x00", "\x39\x2e", "\x00\x00", "\x49\x5c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x79", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x59", "\x3a\x42", "\x00\x00", + "\x00\x00", "\x00\x00", "\x38\x4b", "\x00\x00", "\x44\x6d", "\x30\x43", + "\x3d\x6e", "\x39\x2f", "\x4d\x47", "\x56\x7a", "\x56\x7b", "\x47\x51", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x7c", "\x4e\x77", + "\x4f\x2d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x7e", + "\x56\x7d", "\x00\x00", "\x00\x00", "\x33\x47", "\x00\x00", "\x00\x00", + "\x57\x21", "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x24", "\x57\x25", + "\x00\x00", "\x57\x23", "\x00\x00", "\x49\x40", "\x3e\x33", "\x57\x27", + "\x57\x26", "\x57\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x57\x28", "\x57\x29", "\x00\x00", "\x00\x00", "\x57\x2a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x57\x2d", "\x57\x2b", "\x00\x00", "\x57\x2c", + "\x57\x2e", "\x00\x00", "\x31\x64", "\x44\x6e", "\x57\x2f", "\x00\x00", + "\x37\x7a", "\x32\x76", "\x47\x36", "\x00\x00", "\x57\x30", "\x46\x7b", + "\x00\x00", "\x4a\x5b", "\x00\x00", "\x57\x31", "\x4f\x2e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x32", "\x4a\x40", "\x57\x35", + "\x50\x21", "\x50\x31", "\x00\x00", "\x3c\x30", "\x46\x75", "\x57\x36", + "\x00\x00", "\x35\x5d", "\x44\x24", "\x30\x7a", "\x57\x37", "\x4a\x26", + "\x39\x30", "\x00\x00", "\x00\x00", "\x43\x50", "\x00\x00", "\x00\x00", + "\x00\x00", "\x44\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4c\x6f", "\x38\x39", "\x38\x4c", "\x00\x00", "\x57\x38", + "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x39", "\x00\x00", "\x57\x3f", + "\x00\x00", "\x3c\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x25", + "\x00\x00", "\x36\x2f", "\x57\x3a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x2b", "\x00\x00", "\x43\x46", "\x00\x00", "\x00\x00", "\x57\x3b", + "\x57\x3c", "\x00\x00", "\x36\x30", "\x00\x00", "\x57\x3d", "\x00\x00", + "\x57\x3e", "\x00\x00", "\x00\x00", "\x57\x40", "\x00\x00", "\x45\x76", + "\x00\x00", "\x00\x00", "\x57\x41", "\x57\x42", "\x00\x00", "\x57\x43", + "\x00\x00", "\x00\x00", "\x57\x34", "\x57\x33", "\x00\x00", "\x00\x00", + "\x00\x00", "\x57\x44", "\x37\x41", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x27", "\x00\x00", "\x00\x00", "\x3a\x4c", "\x49\x37", "\x44\x26", + "\x49\x4b", "\x57\x45", "\x00\x00", "\x00\x00", "\x3e\x34", "\x31\x46", + "\x00\x00", "\x57\x46", "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x47", + "\x00\x00", "\x4c\x72", "\x00\x00", "\x00\x00", "\x48\x60", "\x00\x00", + "\x00\x00", "\x57\x4a", "\x31\x7d", "\x40\x2c", "\x57\x49", "\x57\x48", + "\x37\x42", "\x42\x54", "\x00\x00", "\x57\x4e", "\x57\x4c", "\x00\x00", + "\x57\x4b", "\x4e\x27", "\x38\x65", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x79", "\x57\x4d", "\x45\x4c", "\x3d\x3e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x46\x40", "\x57\x51", "\x57\x50", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x57\x4f", "\x00\x00", "\x57\x52", "\x38\x66", + "\x57\x53", "\x49\x7c", "\x3d\x5b", "\x00\x00", "\x00\x00", "\x57\x54", + "\x48\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x41", + "\x44\x27", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x30", + "\x00\x00", "\x00\x00", "\x57\x55", "\x35\x2b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x34", "\x00\x00", "\x49\x2c", + "\x34\x77", "\x47\x26", "\x57\x56", "\x3b\x56", "\x4b\x3a", "\x4b\x3b", + "\x00\x00", "\x00\x00", "\x31\x7e", "\x57\x5b", "\x00\x00", "\x00\x00", + "\x43\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x58", "\x32\x77", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x2d", "\x57\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x30", "\x00\x00", "\x00\x00", + "\x57\x59", "\x00\x00", "\x00\x00", "\x57\x57", "\x00\x00", "\x39\x7a", + "\x00\x00", "\x57\x5d", "\x57\x63", "\x57\x69", "\x57\x61", "\x00\x00", + "\x45\x5c", "\x00\x00", "\x00\x00", "\x57\x66", "\x49\x5d", "\x00\x00", + "\x00\x00", "\x57\x60", "\x00\x00", "\x57\x65", "\x4e\x67", "\x3b\x57", + "\x00\x00", "\x00\x00", "\x42\x55", "\x57\x5e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x5e", "\x57\x68", "\x40\x2d", "\x31\x65", "\x57\x62", + "\x32\x78", "\x57\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x31", + "\x00\x00", "\x57\x64", "\x57\x6a", "\x57\x6c", "\x57\x76", "\x57\x74", + "\x00\x00", "\x00\x00", "\x57\x71", "\x00\x00", "\x00\x00", "\x00\x00", + "\x57\x70", "\x4e\x78", "\x00\x00", "\x57\x72", "\x00\x00", "\x00\x00", + "\x36\x32", "\x00\x00", "\x39\x31", "\x00\x00", "\x00\x00", "\x3d\x7a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x79", "\x57\x6b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x6f", "\x57\x5f", "\x00\x00", + "\x32\x7a", "\x57\x73", "\x57\x75", "\x43\x51", "\x00\x00", "\x00\x00", + "\x3a\x28", "\x32\x38", "\x57\x6d", "\x57\x78", "\x57\x77", "\x36\x33", + "\x00\x00", "\x42\x29", "\x33\x66", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x37\x43", "\x00\x00", "\x57\x6e", "\x57\x7a", "\x00\x00", + "\x57\x7d", "\x58\x21", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3c\x3d", "\x00\x00", "\x58\x27", "\x44\x70", "\x57\x7b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x25", "\x00\x00", "\x32\x79", + "\x00\x00", "\x58\x23", "\x58\x24", "\x00\x00", "\x00\x00", "\x57\x7e", + "\x58\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x67", "\x4d\x2a", + "\x00\x00", "\x00\x00", "\x34\x35", "\x00\x00", "\x00\x00", "\x31\x59", + "\x58\x26", "\x00\x00", "\x47\x3a", "\x30\x2d", "\x48\x61", "\x57\x5c", + "\x58\x2c", "\x58\x30", "\x4c\x65", "\x00\x00", "\x58\x29", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x69", "\x58\x2e", "\x3e\x70", "\x58\x2f", + "\x46\x57", "\x4f\x47", "\x00\x00", "\x58\x2b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x58\x31", "\x00\x00", "\x39\x7b", "\x00\x00", + "\x40\x4b", "\x00\x00", "\x00\x00", "\x30\x54", "\x58\x2a", "\x58\x28", + "\x00\x00", "\x41\x5a", "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x7c", + "\x3b\x34", "\x42\x46", "\x58\x3d", "\x00\x00", "\x41\x5b", "\x58\x38", + "\x00\x00", "\x58\x35", "\x58\x36", "\x00\x00", "\x3c\x66", "\x58\x39", + "\x58\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x37", + "\x3d\x25", "\x00\x00", "\x58\x3a", "\x00\x00", "\x00\x00", "\x58\x34", + "\x00\x00", "\x4c\x7c", "\x4c\x7b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x58\x3e", "\x58\x3f", "\x30\x55", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x58\x33", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x36\x72", "\x30\x26", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x36", "\x00\x00", "\x58\x3b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x58\x43", "\x58\x42", "\x00\x00", "\x00\x00", + "\x00\x00", "\x58\x47", "\x58\x48", "\x58\x46", "\x58\x49", "\x58\x41", + "\x58\x45", "\x00\x00", "\x00\x00", "\x58\x4a", "\x00\x00", "\x58\x4b", + "\x00\x00", "\x00\x00", "\x58\x40", "\x3b\x7c", "\x00\x00", "\x58\x44", + "\x42\x56", "\x39\x32", "\x58\x32", "\x3f\x35", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x58\x58", "\x00\x00", "\x4a\x69", "\x00\x00", + "\x00\x00", "\x58\x4e", "\x58\x4f", "\x58\x50", "\x00\x00", "\x00\x00", + "\x58\x57", "\x00\x00", "\x58\x56", "\x00\x00", "\x00\x00", "\x4b\x7d", + "\x34\x37", "\x00\x00", "\x58\x54", "\x00\x00", "\x37\x45", "\x33\x34", + "\x00\x00", "\x00\x00", "\x58\x51", "\x00\x00", "\x00\x00", "\x4e\x38", + "\x58\x53", "\x30\x56", "\x58\x55", "\x00\x00", "\x58\x4c", "\x58\x52", + "\x58\x59", "\x37\x44", "\x58\x4d", "\x4d\x5d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4d\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x58\x5c", "\x00\x00", "\x00\x00", "\x58\x60", "\x00\x00", "\x00\x00", + "\x00\x00", "\x41\x7e", "\x00\x00", "\x4e\x79", "\x58\x61", "\x00\x00", + "\x00\x00", "\x58\x5e", "\x00\x00", "\x58\x5b", "\x00\x00", "\x00\x00", + "\x58\x5a", "\x58\x5f", "\x4a\x30", "\x00\x00", "\x00\x00", "\x46\x34", + "\x00\x00", "\x37\x46", "\x00\x00", "\x58\x62", "\x58\x5d", "\x00\x00", + "\x58\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x7b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x32\x31", "\x00\x00", "\x00\x00", "\x00\x00", + "\x58\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x38", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x69", "\x00\x00", "\x00\x00", + "\x58\x6a", "\x3a\x29", "\x58\x68", "\x58\x66", "\x58\x65", "\x58\x6c", + "\x58\x64", "\x58\x6e", "\x00\x00", "\x00\x00", "\x32\x7b", "\x58\x70", + "\x00\x00", "\x00\x00", "\x58\x6f", "\x44\x28", "\x00\x00", "\x58\x73", + "\x00\x00", "\x58\x71", "\x58\x67", "\x37\x7c", "\x00\x00", "\x58\x72", + "\x00\x00", "\x58\x76", "\x58\x75", "\x58\x77", "\x58\x74", "\x58\x78", + "\x58\x79", "\x58\x7a", "\x4a\x6a", "\x00\x00", "\x58\x7c", "\x58\x7b", + "\x3d\x3f", "\x00\x00", "\x40\x2e", "\x32\x66", "\x32\x7c", "\x00\x00", + "\x58\x7d", "\x00\x00", "\x30\x3f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x40\x4c", "\x58\x7e", "\x00\x00", "\x6c\x43", "\x59\x21", "\x37\x61", + "\x00\x00", "\x59\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x40\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x23", "\x00\x00", + "\x00\x00", "\x00\x00", "\x59\x24", "\x35\x3a", "\x59\x25", "\x00\x00", + "\x59\x26", "\x59\x27", "\x42\x57", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x4d", "\x00\x00", "\x00\x00", "\x4c\x61", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x3c", "\x3d\x6a", "\x59\x28", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x70", "\x6e\x3d", "\x48\x62", + "\x00\x00", "\x3c\x6a", "\x00\x00", "\x3a\x4d", "\x59\x29", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x47", "\x00\x00", "\x4a\x27", + "\x00\x00", "\x00\x00", "\x42\x71", "\x00\x00", "\x00\x00", "\x59\x2c", + "\x00\x00", "\x00\x00", "\x59\x2a", "\x00\x00", "\x59\x2d", "\x00\x00", + "\x00\x00", "\x59\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x59\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x31", "\x00\x00", "\x00\x00", "\x30\x37", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x49\x5e", "\x00\x00", "\x00\x00", "\x48\x63", + "\x00\x00", "\x00\x00", "\x59\x2f", "\x00\x00", "\x59\x32", "\x3e\x35", + "\x35\x3b", "\x00\x00", "\x59\x30", "\x59\x37", "\x3e\x36", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x31", "\x47\x44", "\x4d\x5e", + "\x59\x33", "\x59\x34", "\x59\x38", "\x45\x6a", "\x59\x35", "\x39\x33", + "\x40\x5e", "\x00\x00", "\x00\x00", "\x59\x46", "\x48\x34", "\x00\x00", + "\x42\x72", "\x48\x64", "\x5a\x2d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x7a", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x71", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x75", "\x00\x00", "\x59\x3b", + "\x32\x21", "\x43\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x59\x44", "\x00\x00", "\x00\x00", "\x43\x34", "\x59\x3e", "\x59\x45", + "\x59\x40", "\x59\x47", "\x59\x43", "\x00\x00", "\x59\x42", "\x47\x6f", + "\x00\x00", "\x59\x3c", "\x32\x7d", "\x59\x3a", "\x35\x71", "\x42\x73", + "\x59\x36", "\x00\x00", "\x00\x00", "\x59\x39", "\x39\x34", "\x40\x5b", + "\x00\x00", "\x3e\x37", "\x59\x41", "\x47\x52", "\x00\x00", "\x00\x00", + "\x35\x72", "\x33\x48", "\x33\x67", "\x3f\x21", "\x59\x49", "\x59\x4e", + "\x00\x00", "\x59\x4a", "\x00\x00", "\x37\x7d", "\x00\x00", "\x59\x4f", + "\x3b\x22", "\x39\x69", "\x3d\x26", "\x59\x3d", "\x00\x00", "\x3b\x7d", + "\x59\x4c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x58", + "\x59\x4d", "\x30\x44", "\x00\x00", "\x00\x00", "\x59\x48", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x29", "\x35\x73", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x34", "\x59\x4b", + "\x30\x27", "\x00\x00", "\x00\x00", "\x3a\x43", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3f\x36", "\x44\x72", "\x00\x00", "\x00\x00", "\x48\x54", + "\x59\x51", "\x41\x5e", "\x42\x2a", "\x00\x00", "\x00\x00", "\x3b\x2b", + "\x59\x52", "\x00\x00", "\x59\x54", "\x59\x50", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4a\x61", "\x00\x00", "\x44\x3d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x5c", "\x4a\x7b", "\x3c\x4e", + "\x59\x60", "\x00\x00", "\x59\x5f", "\x00\x00", "\x00\x00", "\x3f\x78", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x59\x59", "\x3e\x39", "\x00\x00", "\x00\x00", "\x46\x68", + "\x47\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x57", + "\x00\x00", "\x00\x00", "\x41\x5d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3c\x78", "\x59\x5c", "\x00\x00", "\x00\x00", "\x3e\x38", + "\x00\x00", "\x59\x56", "\x59\x5b", "\x00\x00", "\x00\x00", "\x47\x53", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x55", "\x00\x00", "\x37\x21", + "\x00\x00", "\x00\x00", "\x33\x5d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x59\x5d", "\x4e\x2b", "\x3a\x4e", "\x43\x35", "\x59\x5a", "\x00\x00", + "\x40\x5c", "\x00\x00", "\x39\x35", "\x3f\x64", "\x31\x66", "\x41\x3c", + "\x59\x58", "\x35\x45", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x37\x47", "\x00\x00", "\x44\x4f", "\x59\x5e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x5f", "\x00\x00", + "\x00\x00", "\x59\x61", "\x00\x00", "\x59\x63", "\x00\x00", "\x00\x00", + "\x42\x37", "\x59\x69", "\x00\x00", "\x59\x64", "\x00\x00", "\x00\x00", + "\x59\x66", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x41", "\x44\x73", "\x00\x00", "\x59\x67", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4d\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x48", + "\x34\x39", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x30\x2e", "\x00\x00", "\x59\x65", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x59\x62", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x34\x78", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x31\x67", "\x00\x00", "\x59\x68", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4d\x49", "\x59\x6c", "\x42\x3b", "\x00\x00", "\x59\x73", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x6d", "\x00\x00", "\x00\x00", + "\x59\x6a", "\x59\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x59\x53", "\x59\x6e", "\x00\x00", "\x59\x72", "\x00\x00", "\x00\x00", + "\x00\x00", "\x48\x42", "\x45\x6b", "\x59\x6b", "\x00\x00", "\x59\x6f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x48", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3a\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x5d", + "\x59\x77", "\x45\x26", "\x59\x74", "\x00\x00", "\x4b\x60", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x75", "\x59\x76", + "\x00\x00", "\x4c\x4e", "\x00\x00", "\x40\x22", "\x37\x62", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x7d", "\x3b\x35", "\x59\x7a", + "\x00\x00", "\x59\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x32", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x35", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x31", "\x59\x7b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x7c", "\x00\x00", "\x49\x6f", + "\x00\x00", "\x47\x45", "\x3b\x23", "\x00\x00", "\x40\x71", "\x00\x00", + "\x4b\x50", "\x33\x49", "\x00\x00", "\x5a\x25", "\x59\x7e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x4a", "\x5a\x27", "\x00\x00", + "\x00\x00", "\x5a\x23", "\x00\x00", "\x5a\x24", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x60", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5a\x22", "\x00\x00", "\x59\x3f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5a\x26", "\x00\x00", "\x5a\x21", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x2b", "\x5a\x2c", + "\x45\x27", "\x5a\x2e", "\x00\x00", "\x00\x00", "\x3b\x24", "\x5a\x29", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x3c", "\x00\x00", + "\x00\x00", "\x5a\x2f", "\x00\x00", "\x5a\x28", "\x5a\x33", "\x00\x00", + "\x5a\x32", "\x00\x00", "\x5a\x31", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5a\x34", "\x00\x00", "\x00\x00", "\x5a\x36", "\x3e\x71", "\x00\x00", + "\x5a\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x39", + "\x5a\x37", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x38", "\x59\x70", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x3b", + "\x5a\x3a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x59\x78", "\x5a\x3c", "\x5a\x30", "\x00\x00", "\x00\x00", "\x3b\x59", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x3d", "\x5a\x3e", + "\x5a\x40", "\x5a\x3f", "\x5a\x41", "\x32\x7e", "\x00\x00", "\x39\x36", + "\x00\x00", "\x00\x00", "\x4a\x7c", "\x40\x2f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x4e", "\x00\x00", "\x00\x00", + "\x5a\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x46", + "\x00\x00", "\x49\x52", "\x00\x00", "\x35\x5f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5a\x45", "\x5a\x44", "\x47\x54", "\x5a\x47", "\x36\x35", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x49", "\x5a\x48", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x3a", "\x3b\x36", "\x00\x00", "\x00\x00", + "\x46\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x49", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x74", "\x00\x00", + "\x5a\x4a", "\x00\x00", "\x40\x30", "\x45\x28", "\x00\x00", "\x49\x5f", + "\x5a\x4b", "\x5a\x4c", "\x5a\x4d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x38", "\x55\x5d", "\x40\x46", "\x00\x00", "\x00\x00", "\x49\x4c", + "\x00\x00", "\x3a\x58", "\x00\x00", "\x48\x65", "\x48\x43", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x4d", "\x00\x00", + "\x4e\x41", "\x00\x00", "\x5a\x4f", "\x3c\x50", "\x00\x00", "\x00\x00", + "\x5a\x50", "\x00\x00", "\x30\x36", "\x00\x00", "\x00\x00", "\x36\x54", + "\x40\x4d", "\x00\x00", "\x49\x60", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5a\x51", "\x3b\x42", "\x43\x47", "\x00\x00", "\x3b\x5b", "\x3f\x37", + "\x5a\x52", "\x00\x00", "\x4a\x7d", "\x00\x00", "\x00\x00", "\x31\x77", + "\x3b\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x55", "\x00\x00", + "\x5a\x53", "\x5a\x56", "\x4e\x39", "\x5a\x54", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x40\x7b", "\x5a\x57", "\x00\x00", "\x00\x00", + "\x42\x32", "\x00\x00", "\x00\x00", "\x5a\x58", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x7a", "\x00\x00", "\x5a\x5a", "\x00\x00", + "\x5a\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x5b", + "\x5a\x5c", "\x34\x7b", "\x00\x00", "\x00\x00", "\x46\x7c", "\x43\x36", + "\x35\x6c", "\x3b\x5d", "\x41\x61", "\x00\x00", "\x00\x00", "\x3d\x5c", + "\x30\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x5d", "\x32\x22", + "\x5a\x61", "\x39\x37", "\x5a\x60", "\x00\x00", "\x00\x00", "\x3a\x2b", + "\x3e\x3a", "\x00\x00", "\x00\x00", "\x5a\x5f", "\x00\x00", "\x3e\x3b", + "\x00\x00", "\x4c\x40", "\x3a\x2a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x30\x57", "\x40\x4e", "\x5a\x66", "\x00\x00", "\x00\x00", "\x40\x31", + "\x31\x47", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x55", + "\x00\x00", "\x4b\x66", "\x3a\x72", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3e\x3c", "\x00\x00", "\x40\x27", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5a\x65", "\x5a\x63", "\x5a\x64", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x6b", "\x00\x00", + "\x00\x00", "\x5b\x26", "\x00\x00", "\x5a\x6a", "\x3b\x7e", "\x39\x38", + "\x5a\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x69", + "\x00\x00", "\x3f\x38", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x67", + "\x00\x00", "\x00\x00", "\x3b\x2f", "\x5a\x6c", "\x5a\x6b", "\x5a\x70", + "\x00\x00", "\x00\x00", "\x5a\x71", "\x00\x00", "\x5a\x6d", "\x00\x00", + "\x33\x22", "\x5a\x6e", "\x5a\x6f", "\x48\x55", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x49\x61", "\x37\x4a", "\x5a\x72", "\x00\x00", + "\x00\x00", "\x00\x00", "\x40\x32", "\x00\x00", "\x3e\x3d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x43\x52", "\x36\x47", "\x00\x00", "\x5a\x73", + "\x5a\x77", "\x00\x00", "\x00\x00", "\x32\x4b", "\x5a\x74", "\x5a\x76", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x75", "\x00\x00", + "\x00\x00", "\x3d\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x43\x48", "\x30\x45", "\x5a\x78", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5a\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x2a", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x71", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x43", "\x00\x00", "\x00\x00", + "\x4a\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4b\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x22", "\x5a\x7b", + "\x00\x00", "\x00\x00", "\x5a\x7e", "\x00\x00", "\x5a\x7d", "\x00\x00", + "\x00\x00", "\x5a\x7a", "\x00\x00", "\x00\x00", "\x5b\x21", "\x00\x00", + "\x00\x00", "\x46\x5e", "\x00\x00", "\x5a\x7c", "\x5b\x23", "\x00\x00", + "\x00\x00", "\x3d\x6c", "\x5b\x24", "\x00\x00", "\x4d\x4b", "\x47\x78", + "\x00\x00", "\x00\x00", "\x5b\x25", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x27", "\x00\x00", "\x00\x00", "\x5b\x28", + "\x5b\x29", "\x00\x00", "\x36\x4a", "\x31\x48", "\x39\x39", "\x5b\x2a", + "\x00\x00", "\x5b\x2b", "\x3d\x71", "\x41\x62", "\x00\x00", "\x00\x00", + "\x52\x58", "\x41\x3e", "\x41\x3d", "\x42\x58", "\x3a\x47", "\x00\x00", + "\x00\x00", "\x50\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x6e", "\x4d\x2d", "\x00\x00", "\x4a\x7e", "\x00\x00", "\x49\x7e", + "\x00\x00", "\x5b\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3a\x73", "\x44\x3f", "\x5b\x2d", "\x4f\x2f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x3e", "\x00\x00", "\x44\x2b", "\x5b\x2e", "\x34\x7c", + "\x5b\x2f", "\x5b\x30", "\x4c\x5a", "\x00\x00", "\x4c\x24", "\x4b\x76", + "\x4b\x5c", "\x3b\x25", "\x5b\x32", "\x00\x00", "\x00\x00", "\x3c\x6b", + "\x00\x00", "\x00\x00", "\x4b\x51", "\x00\x00", "\x5b\x34", "\x5b\x37", + "\x5b\x36", "\x00\x00", "\x34\x79", "\x00\x00", "\x00\x00", "\x35\x60", + "\x00\x00", "\x5b\x33", "\x00\x00", "\x5b\x35", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x38", "\x00\x00", "\x00\x00", "\x3f\x79", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x7b", "\x30\x49", + "\x3a\x60", "\x42\x3c", "\x00\x00", "\x3c\x5d", "\x00\x00", "\x00\x00", + "\x3e\x73", "\x00\x00", "\x00\x00", "\x5b\x3b", "\x00\x00", "\x00\x00", + "\x45\x4e", "\x00\x00", "\x5b\x39", "\x42\x2b", "\x5b\x3a", "\x3e\x72", + "\x4c\x5d", "\x5b\x3c", "\x5b\x3d", "\x4d\x68", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x42", "\x00\x00", "\x00\x00", "\x39\x3a", + "\x00\x00", "\x47\x55", "\x5b\x3f", "\x45\x6c", "\x5a\x5e", "\x5a\x62", + "\x00\x00", "\x35\x4f", "\x00\x00", "\x47\x47", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x41", "\x00\x00", "\x3e\x3e", "\x48\x44", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x47", + "\x00\x00", "\x48\x7a", "\x00\x00", "\x5b\x3e", "\x00\x00", "\x5b\x44", + "\x5b\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x4f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x6d", "\x00\x00", "\x4e\x53", + "\x00\x00", "\x00\x00", "\x4b\x67", "\x00\x00", "\x32\x4c", "\x3b\x5e", + "\x00\x00", "\x00\x00", "\x4f\x48", "\x5b\x46", "\x3f\x75", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x45", "\x00\x00", "\x00\x00", "\x5b\x40", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x4f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x4c", "\x5b\x4a", "\x00\x00", + "\x32\x4d", "\x5b\x48", "\x5b\x4e", "\x5b\x54", "\x42\x48", "\x00\x00", + "\x00\x00", "\x4a\x41", "\x00\x00", "\x5b\x56", "\x00\x00", "\x00\x00", + "\x00\x00", "\x49\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x55", + "\x47\x70", "\x4b\x3f", "\x34\x3b", "\x00\x00", "\x40\x77", "\x3d\x40", + "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x53", "\x00\x00", "\x4d\x2e", + "\x00\x00", "\x00\x00", "\x5b\x51", "\x5b\x50", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5b\x52", "\x00\x00", "\x5b\x4f", "\x00\x00", "\x00\x00", + "\x5b\x57", "\x00\x00", "\x5b\x4d", "\x00\x00", "\x00\x00", "\x5b\x4b", + "\x00\x00", "\x5b\x53", "\x5b\x49", "\x00\x00", "\x43\x6c", "\x00\x00", + "\x4c\x78", "\x3c\x46", "\x3a\x74", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3a\x3a", "\x00\x00", "\x00\x00", "\x4b\x6f", + "\x33\x41", "\x00\x00", "\x00\x00", "\x44\x4e", "\x46\x4a", "\x31\x49", + "\x40\x72", "\x00\x00", "\x00\x00", "\x40\x34", "\x37\x2a", "\x5b\x59", + "\x00\x00", "\x00\x00", "\x39\x3b", "\x33\x7c", "\x5b\x5b", "\x33\x74", + "\x5b\x61", "\x5b\x5e", "\x00\x00", "\x40\x73", "\x00\x00", "\x00\x00", + "\x00\x00", "\x33\x4b", "\x3a\x2c", "\x00\x00", "\x00\x00", "\x33\x4a", + "\x3a\x4f", "\x00\x00", "\x00\x00", "\x5b\x5c", "\x37\x65", "\x37\x4b", + "\x45\x6d", "\x00\x00", "\x00\x00", "\x5b\x5a", "\x00\x00", "\x30\x46", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x5d", "\x5b\x5f", + "\x00\x00", "\x36\x4d", "\x37\x2c", "\x00\x00", "\x34\x3c", "\x35\x4b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x62", "\x00\x00", + "\x00\x00", "\x3a\x79", "\x4b\x71", "\x00\x00", "\x3b\x37", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x63", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x30", "\x5b\x6f", "\x00\x00", "\x32\x33", "\x5b\x64", "\x5b\x75", + "\x5b\x65", "\x00\x00", "\x4e\x42", "\x00\x00", "\x5b\x6c", "\x00\x00", + "\x47\x5f", "\x5b\x74", "\x00\x00", "\x5b\x67", "\x00\x00", "\x00\x00", + "\x00\x00", "\x30\x34", "\x5b\x69", "\x00\x00", "\x00\x00", "\x39\x3c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x6b", "\x00\x00", "\x5b\x6a", + "\x00\x00", "\x5b\x66", "\x5b\x71", "\x00\x00", "\x3e\x3f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x54\x6d", "\x38\x68", "\x4d\x7c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x68", "\x00\x00", "\x44\x74", + "\x33\x23", "\x3a\x2d", "\x00\x00", "\x5b\x60", "\x00\x00", "\x5b\x70", + "\x33\x61", "\x00\x00", "\x00\x00", "\x5b\x6e", "\x5b\x72", "\x00\x00", + "\x45\x6e", "\x34\x7e", "\x00\x00", "\x5c\x32", "\x00\x00", "\x00\x00", + "\x4c\x49", "\x5b\x77", "\x34\x7d", "\x00\x00", "\x5b\x7e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x40", "\x00\x00", "\x5c\x21", + "\x5c\x23", "\x00\x00", "\x5c\x27", "\x5b\x79", "\x00\x00", "\x43\x2a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x6f", "\x5c\x2b", + "\x5b\x7c", "\x00\x00", "\x5c\x28", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5c\x22", "\x3f\x39", "\x5c\x2c", "\x00\x00", "\x00\x00", "\x40\x33", + "\x5c\x2a", "\x34\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4f\x50", "\x5b\x76", "\x00\x00", "\x00\x00", "\x5c\x26", + "\x30\x58", "\x00\x00", "\x00\x00", "\x5b\x78", "\x00\x00", "\x00\x00", + "\x4c\x3a", "\x5b\x7d", "\x3f\x22", "\x44\x47", "\x5b\x73", "\x00\x00", + "\x00\x00", "\x5c\x25", "\x3f\x7a", "\x5c\x2f", "\x33\x71", "\x38\x21", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x31", "\x5b\x7a", + "\x5c\x30", "\x00\x00", "\x5c\x29", "\x5b\x7b", "\x00\x00", "\x5c\x2d", + "\x00\x00", "\x5c\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5c\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x4e", + "\x00\x00", "\x5c\x24", "\x00\x00", "\x00\x00", "\x5c\x3b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5c\x3d", "\x00\x00", "\x44\x58", "\x4d\x4c", + "\x49\x76", "\x5c\x38", "\x42\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5c\x3e", "\x41\x3f", "\x00\x00", "\x5c\x35", "\x5c\x42", "\x5c\x41", + "\x00\x00", "\x46\x6f", "\x5c\x40", "\x46\x6a", "\x5c\x44", "\x5c\x37", + "\x00\x00", "\x36\x48", "\x5c\x3a", "\x3d\x5d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x47\x60", "\x5c\x3c", "\x36\x4b", "\x00\x00", "\x5c\x34", + "\x5c\x36", "\x5c\x33", "\x00\x00", "\x00\x00", "\x4f\x30", "\x33\x5a", + "\x5c\x39", "\x00\x00", "\x00\x00", "\x5c\x43", "\x33\x35", "\x3a\x67", + "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x5d", "\x00\x00", "\x00\x00", + "\x5c\x54", "\x00\x00", "\x00\x00", "\x4f\x31", "\x5c\x57", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x3a", "\x5c\x56", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x55", "\x5c\x52", "\x5c\x46", + "\x00\x00", "\x00\x00", "\x5c\x63", "\x5c\x45", "\x00\x00", "\x5c\x58", + "\x5c\x50", "\x00\x00", "\x00\x00", "\x5c\x4b", "\x5c\x48", "\x00\x00", + "\x5c\x49", "\x00\x00", "\x5c\x51", "\x00\x00", "\x00\x00", "\x00\x00", + "\x74\x22", "\x00\x00", "\x00\x00", "\x5c\x4e", "\x39\x3d", "\x44\x48", + "\x41\x64", "\x5c\x4c", "\x00\x00", "\x5c\x47", "\x00\x00", "\x00\x00", + "\x5c\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x4d", + "\x4b\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x4f", "\x5c\x59", + "\x5c\x61", "\x5c\x5a", "\x00\x00", "\x00\x00", "\x5c\x67", "\x00\x00", + "\x5c\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x60", + "\x5c\x5f", "\x00\x00", "\x44\x50", "\x00\x00", "\x41\x65", "\x00\x00", + "\x5c\x5d", "\x00\x00", "\x00\x00", "\x5c\x5b", "\x00\x00", "\x00\x00", + "\x5c\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x68", + "\x48\x75", "\x5c\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5c\x69", "\x5c\x6c", "\x5c\x66", "\x00\x00", "\x00\x00", + "\x43\x74", "\x00\x00", "\x49\x38", "\x00\x00", "\x5c\x5c", "\x00\x00", + "\x00\x00", "\x5c\x64", "\x3e\x40", "\x00\x00", "\x4c\x4f", "\x5c\x78", + "\x5c\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x22", "\x32\x23", "\x33\x5f", "\x00\x00", "\x00\x00", "\x5c\x53", + "\x3e\x41", "\x5c\x70", "\x00\x00", "\x5c\x77", "\x3c\x79", "\x33\x72", + "\x00\x00", "\x00\x00", "\x43\x2e", "\x5c\x6d", "\x00\x00", "\x00\x00", + "\x5c\x72", "\x5c\x76", "\x00\x00", "\x00\x00", "\x36\x36", "\x35\x4c", + "\x5c\x74", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x35\x21", "\x00\x00", "\x46\x4b", "\x5c\x73", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5c\x75", "\x5c\x6f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5c\x71", "\x33\x60", "\x43\x49", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5c\x7c", "\x5c\x7a", "\x38\x69", "\x00\x00", + "\x5c\x79", "\x5d\x21", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5b\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x7b", "\x00\x00", + "\x5c\x7d", "\x5c\x7e", "\x5d\x2c", "\x00\x00", "\x5d\x28", "\x00\x00", + "\x5b\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x27", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x26", "\x00\x00", + "\x00\x00", "\x5d\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5c\x6a", "\x5d\x25", "\x5d\x24", "\x5d\x2a", "\x00\x00", + "\x4f\x26", "\x5d\x2d", "\x36\x7b", "\x00\x00", "\x00\x00", "\x5d\x29", + "\x5d\x2b", "\x48\x27", "\x00\x00", "\x5d\x2e", "\x5d\x32", "\x5d\x2f", + "\x4d\x73", "\x5d\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5c\x5e", "\x5d\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x34", + "\x31\x35", "\x00\x00", "\x5d\x36", "\x37\x67", "\x3c\x21", "\x00\x00", + "\x36\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x24", "\x4d\x5f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x38", "\x5d\x37", + "\x5d\x3a", "\x35\x3d", "\x00\x00", "\x00\x00", "\x36\x56", "\x34\x3e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x3d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5d\x3c", "\x00\x00", "\x5d\x3e", "\x00\x00", + "\x00\x00", "\x32\x4e", "\x00\x00", "\x43\x37", "\x00\x00", "\x5d\x3f", + "\x00\x00", "\x00\x00", "\x34\x3f", "\x5d\x41", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5d\x40", "\x00\x00", "\x5d\x42", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5d\x43", "\x00\x00", "\x5d\x44", "\x3b\x5f", + "\x40\x35", "\x3a\x21", "\x00\x00", "\x49\x70", "\x00\x00", "\x00\x00", + "\x4a\x62", "\x4f\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3b\x75", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x50", "\x4e\x72", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x45", "\x5d\x46", "\x00\x00", + "\x3b\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x47", "\x5d\x48", + "\x00\x00", "\x00\x00", "\x5d\x4a", "\x5d\x49", "\x00\x00", "\x4b\x58", + "\x00\x00", "\x00\x00", "\x3d\x5e", "\x3c\x6c", "\x3b\x44", "\x00\x00", + "\x5d\x4b", "\x5d\x4d", "\x3f\x23", "\x00\x00", "\x5d\x4c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x4e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x4f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x50", "\x5d\x51", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x52", "\x00\x00", "\x5d\x54", + "\x5d\x53", "\x5d\x55", "\x32\x25", "\x43\x4a", "\x00\x00", "\x5d\x56", + "\x00\x00", "\x00\x00", "\x3b\x26", "\x33\x4c", "\x5d\x57", "\x00\x00", + "\x00\x00", "\x45\x42", "\x54\x4c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x23", "\x5d\x58", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5d\x59", "\x00\x00", "\x4a\x6c", "\x4b\x68", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x47", "\x5d\x5a", "\x48\x66", "\x00\x00", + "\x00\x00", "\x00\x00", "\x48\x7b", "\x00\x00", "\x00\x00", "\x4c\x53", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x5b", "\x5d\x5d", "\x5d\x5c", + "\x00\x00", "\x00\x00", "\x5d\x5f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5d\x5e", "\x5d\x61", "\x3b\x61", "\x00\x00", "\x4c\x31", "\x00\x00", + "\x5d\x62", "\x5d\x63", "\x00\x00", "\x00\x00", "\x35\x24", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5d\x64", "\x5d\x66", "\x5d\x65", "\x3f\x65", + "\x00\x00", "\x00\x00", "\x49\x39", "\x31\x4a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x45", "\x00\x00", "\x44\x75", + "\x3d\x41", "\x35\x61", "\x48\x46", "\x00\x00", "\x3c\x2e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x68", "\x00\x00", "\x34\x40", + "\x00\x00", "\x00\x00", "\x31\x78", "\x00\x00", "\x00\x00", "\x46\x72", + "\x5d\x67", "\x39\x3e", "\x43\x53", "\x00\x00", "\x5d\x69", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x71", "\x00\x00", + "\x5d\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x42\x41", "\x00\x00", "\x35\x62", "\x5d\x72", "\x37\x68", "\x00\x00", + "\x00\x00", "\x35\x25", "\x5d\x70", "\x00\x00", "\x00\x00", "\x5d\x6e", + "\x5d\x6b", "\x4d\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x59", "\x5d\x6c", + "\x00\x00", "\x00\x00", "\x5d\x74", "\x00\x00", "\x5d\x73", "\x37\x23", + "\x00\x00", "\x00\x00", "\x32\x2d", "\x00\x00", "\x00\x00", "\x3a\x3b", + "\x5d\x6d", "\x5d\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x57", "\x42\x74", "\x4b\x77", "\x00\x00", "\x00\x00", + "\x5d\x7c", "\x00\x00", "\x00\x00", "\x5d\x7d", "\x00\x00", "\x32\x4f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x28", "\x4c\x7d", + "\x5e\x21", "\x3c\x23", "\x3e\x42", "\x5d\x78", "\x5d\x7e", "\x31\x68", + "\x00\x00", "\x36\x37", "\x00\x00", "\x00\x00", "\x5d\x75", "\x5d\x7a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x74", "\x47\x71", "\x00\x00", + "\x48\x67", "\x5d\x77", "\x00\x00", "\x4b\x21", "\x00\x00", "\x5d\x79", + "\x00\x00", "\x5e\x24", "\x00\x00", "\x5e\x22", "\x00\x00", "\x5d\x7b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x22", "\x47\x48", "\x35\x63", + "\x00\x00", "\x45\x25", "\x00\x00", "\x00\x00", "\x43\x6d", "\x00\x00", + "\x5e\x25", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x23", + "\x42\x59", "\x5d\x76", "\x00\x00", "\x31\x4b", "\x4d\x4e", "\x5e\x30", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x2f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x76", "\x00\x00", + "\x5e\x2c", "\x00\x00", "\x4d\x6c", "\x00\x00", "\x00\x00", "\x46\x36", + "\x5e\x26", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x45", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x4c", "\x39\x3f", + "\x5e\x29", "\x3d\x27", "\x5e\x2e", "\x00\x00", "\x5e\x2d", "\x5e\x28", + "\x00\x00", "\x5e\x2b", "\x00\x00", "\x00\x00", "\x33\x68", "\x00\x00", + "\x5e\x2a", "\x47\x49", "\x00\x00", "\x00\x00", "\x4e\x2e", "\x00\x00", + "\x00\x00", "\x3e\x74", "\x40\x75", "\x5e\x36", "\x5e\x34", "\x00\x00", + "\x49\x4d", "\x5e\x31", "\x5e\x33", "\x00\x00", "\x31\x3a", "\x00\x00", + "\x00\x00", "\x39\x40", "\x4f\x32", "\x00\x00", "\x33\x3d", "\x00\x00", + "\x49\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4d\x61", "\x00\x00", "\x00\x00", "\x33\x24", "\x3f\x3b", "\x5e\x35", + "\x5e\x3a", "\x00\x00", "\x00\x00", "\x3e\x43", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4d\x30", "\x00\x00", "\x5e\x37", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5e\x32", "\x00\x00", "\x5e\x38", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x5e", "\x00\x00", "\x45\x73", "\x46\x42", + "\x33\x36", "\x00\x00", "\x00\x00", "\x31\x55", "\x00\x00", "\x00\x00", + "\x5e\x3e", "\x00\x00", "\x00\x00", "\x5e\x41", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4e\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x64", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x48", "\x5e\x42", + "\x5e\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x54", "\x5e\x45", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x4a", "\x5e\x47", + "\x00\x00", "\x00\x00", "\x5e\x4c", "\x00\x00", "\x00\x00", "\x45\x71", + "\x5e\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x44", + "\x00\x00", "\x00\x00", "\x43\x38", "\x00\x00", "\x00\x00", "\x5e\x4b", + "\x00\x00", "\x5e\x40", "\x00\x00", "\x5e\x46", "\x00\x00", "\x5e\x4d", + "\x30\x7c", "\x5e\x43", "\x00\x00", "\x5e\x4e", "\x00\x00", "\x00\x00", + "\x3f\x3c", "\x00\x00", "\x3d\x5f", "\x00\x00", "\x4a\x25", "\x00\x00", + "\x3a\x2e", "\x00\x00", "\x5e\x3b", "\x5e\x49", "\x45\x3a", "\x40\x36", + "\x00\x00", "\x33\x69", "\x3a\x51", "\x3e\x44", "\x5e\x3d", "\x3d\x42", + "\x37\x4c", "\x00\x00", "\x5e\x3c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5e\x52", "\x3d\x6d", "\x38\x3a", "\x00\x00", "\x5e\x61", "\x00\x00", + "\x5e\x5b", "\x35\x74", "\x45\x4f", "\x00\x00", "\x5e\x56", "\x5e\x5f", + "\x30\x2f", "\x31\x32", "\x00\x00", "\x00\x00", "\x32\x39", "\x00\x00", + "\x5e\x58", "\x42\x2c", "\x5e\x4f", "\x5e\x51", "\x39\x41", "\x5e\x62", + "\x00\x00", "\x5e\x5d", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x55", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x5c", "\x4c\x2b", + "\x00\x00", "\x00\x00", "\x5e\x5a", "\x5e\x5e", "\x38\x50", "\x00\x00", + "\x3e\x45", "\x00\x00", "\x00\x00", "\x43\x39", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x54", "\x4d\x2f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5e\x57", "\x00\x00", "\x00\x00", "\x5e\x50", "\x45\x72", "\x00\x00", + "\x00\x00", "\x5e\x53", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x59", + "\x4f\x51", "\x3c\x3e", "\x4b\x7e", "\x00\x00", "\x5e\x63", "\x48\x2e", + "\x00\x00", "\x00\x00", "\x5e\x6f", "\x38\x3b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x60", "\x00\x00", "\x5e\x65", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x2f", "\x39\x42", "\x00\x00", + "\x5e\x72", "\x00\x00", "\x00\x00", "\x30\x6e", "\x00\x00", "\x00\x00", + "\x5e\x70", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x64", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x6a", "\x00\x00", + "\x00\x00", "\x5e\x6c", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x4f", + "\x5e\x67", "\x00\x00", "\x00\x00", "\x45\x2e", "\x00\x00", "\x00\x00", + "\x5e\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x71", + "\x00\x00", "\x5e\x6b", "\x4c\x47", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5e\x66", "\x00\x00", "\x3c\x22", "\x5e\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x33\x6a", "\x00\x00", "\x5e\x68", "\x5e\x6d", + "\x5e\x6e", "\x42\x6c", "\x42\x5a", "\x5e\x76", "\x00\x00", "\x00\x00", + "\x5e\x7c", "\x00\x00", "\x00\x00", "\x5e\x7a", "\x00\x00", "\x45\x29", + "\x00\x00", "\x00\x00", "\x5f\x23", "\x5e\x77", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x78", "\x5e\x60", "\x00\x00", + "\x35\x79", "\x49\x3a", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x3f", + "\x00\x00", "\x00\x00", "\x39\x77", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4f\x33", "\x00\x00", "\x5e\x74", "\x00\x00", + "\x5f\x22", "\x31\x69", "\x41\x66", "\x47\x79", "\x00\x00", "\x34\x41", + "\x4e\x7a", "\x4c\x21", "\x44\x52", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x7b", "\x5e\x7d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x41\x32", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x21", "\x5e\x79", "\x00\x00", "\x5e\x73", + "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x43", "\x37\x69", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x2f", "\x00\x00", "\x00\x00", "\x5f\x2a", + "\x40\x78", "\x00\x00", "\x00\x00", "\x33\x63", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x61", "\x00\x00", "\x5f\x33", "\x5f\x2c", + "\x44\x2c", "\x5f\x29", "\x44\x59", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x4c", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x26", "\x00\x00", + "\x5f\x25", "\x00\x00", "\x5f\x2e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x28", "\x5f\x27", "\x5f\x2d", "\x00\x00", "\x40\x21", "\x00\x00", + "\x5f\x24", "\x5f\x30", "\x00\x00", "\x00\x00", "\x5f\x31", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x42", "\x5f\x36", + "\x00\x00", "\x5f\x35", "\x5f\x37", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x3a", "\x45\x43", "\x00\x00", "\x5f\x34", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x38", + "\x37\x63", "\x42\x79", "\x5f\x32", "\x47\x3b", "\x00\x00", "\x00\x00", + "\x5f\x39", "\x5f\x3e", "\x5f\x3c", "\x00\x00", "\x00\x00", "\x5f\x3f", + "\x00\x00", "\x00\x00", "\x5f\x42", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x3b", "\x39\x6a", "\x47\x28", "\x00\x00", "\x00\x00", "\x5e\x39", + "\x4d\x74", "\x5f\x3d", "\x00\x00", "\x5f\x41", "\x42\x75", "\x00\x00", + "\x5f\x40", "\x00\x00", "\x5f\x2b", "\x00\x00", "\x00\x00", "\x6f\x69", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x45", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x49", "\x00\x00", "\x00\x00", "\x5f\x47", "\x5f\x43", + "\x00\x00", "\x5f\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x48", + "\x00\x00", "\x5f\x46", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x4e", + "\x00\x00", "\x00\x00", "\x5f\x4e", "\x00\x00", "\x5f\x4b", "\x5f\x4a", + "\x00\x00", "\x5f\x4d", "\x46\x54", "\x5f\x4f", "\x43\x75", "\x42\x6d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x25", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x50", "\x00\x00", "\x5f\x52", "\x5f\x51", + "\x5e\x75", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x53", + "\x46\x67", "\x5f\x54", "\x32\x50", "\x00\x00", "\x00\x00", "\x00\x00", + "\x45\x74", "\x33\x25", "\x35\x64", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3c\x5e", "\x3a\x52", "\x4f\x27", "\x3f\x66", "\x00\x00", "\x00\x00", + "\x00\x00", "\x31\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x56", + "\x5f\x55", "\x5f\x59", "\x43\x3a", "\x5f\x5c", "\x5f\x57", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x5b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x5a", "\x45\x40", "\x30\x59", "\x4e\x75", "\x00\x00", + "\x00\x00", "\x5f\x5e", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x28", + "\x5f\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x5f", "\x00\x00", + "\x5f\x5d", "\x5f\x58", "\x4b\x23", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x62", "\x5f\x61", "\x31\x6b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x64", "\x4a\x32", "\x00\x00", "\x5f\x63", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x35", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x47", "\x41\x33", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x46", "\x4e\x7b", "\x00\x00", + "\x00\x00", "\x5f\x6a", "\x00\x00", "\x40\x79", "\x5f\x66", "\x5f\x6b", + "\x00\x00", "\x00\x00", "\x31\x6c", "\x5f\x69", "\x00\x00", "\x47\x61", + "\x5f\x65", "\x5f\x68", "\x3e\x48", "\x00\x00", "\x48\x51", "\x00\x00", + "\x00\x00", "\x5f\x6c", "\x00\x00", "\x3c\x51", "\x40\x7a", "\x5f\x6f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x67", "\x00\x00", "\x37\x27", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x6d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x50", "\x5f\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x74\x26", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x4f", "\x5f\x71", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x2e", "\x5f\x74", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x75", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x33", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x75", "\x5f\x77", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x79", "\x00\x00", + "\x4e\x55", "\x00\x00", "\x5f\x76", "\x00\x00", "\x5f\x78", "\x31\x6d", + "\x00\x00", "\x5f\x73", "\x53\x5b", "\x5f\x7a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x41\x67", "\x3b\x38", "\x5f\x7c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x7b", "\x3f\x24", "\x52\x59", + "\x5f\x7d", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x21", "\x00\x00", + "\x5f\x6e", "\x5f\x7e", "\x00\x00", "\x00\x00", "\x60\x22", "\x47\x7a", + "\x60\x23", "\x00\x00", "\x00\x00", "\x60\x24", "\x60\x25", "\x60\x26", + "\x00\x00", "\x44\x5e", "\x00\x00", "\x60\x28", "\x60\x27", "\x00\x00", + "\x00\x00", "\x60\x29", "\x00\x00", "\x60\x2a", "\x00\x00", "\x00\x00", + "\x3c\x5f", "\x49\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x6c", + "\x60\x2b", "\x60\x2c", "\x41\x56", "\x3c\x24", "\x60\x2d", "\x60\x2e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x2f", + "\x4a\x52", "\x48\x47", "\x00\x00", "\x00\x00", "\x60\x30", "\x47\x57", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x2d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x31", + "\x32\x67", "\x00\x00", "\x35\x6d", "\x00\x00", "\x4c\x46", "\x00\x00", + "\x4c\x36", "\x00\x00", "\x32\x34", "\x4f\x34", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4b\x52", "\x00\x00", "\x4a\x2a", "\x40\x37", + "\x00\x00", "\x60\x32", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x46\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x23", "\x60\x33", + "\x00\x00", "\x3a\x54", "\x60\x35", "\x60\x34", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x60\x36", "\x60\x37", "\x00\x00", "\x00\x00", + "\x00\x00", "\x60\x38", "\x35\x3e", "\x00\x00", "\x60\x39", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x3a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x38\x24", "\x00\x00", "\x00\x00", "\x48\x48", + "\x00\x00", "\x00\x00", "\x60\x3c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3e\x75", "\x00\x00", "\x00\x00", "\x60\x3b", "\x36\x38", "\x60\x3d", + "\x60\x3f", "\x00\x00", "\x60\x3e", "\x60\x40", "\x00\x00", "\x38\x51", + "\x00\x00", "\x60\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x36\x69", "\x00\x00", "\x41\x40", "\x00\x00", "\x39\x7d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x43", "\x60\x44", "\x60\x42", + "\x3c\x6d", "\x00\x00", "\x00\x00", "\x46\x48", "\x36\x39", "\x60\x46", + "\x43\x2c", "\x60\x45", "\x00\x00", "\x00\x00", "\x4f\x35", "\x47\x62", + "\x60\x49", "\x60\x4b", "\x60\x48", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x54", "\x60\x4a", "\x60\x4c", "\x00\x00", "\x4e\x44", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x50", "\x00\x00", + "\x00\x00", "\x00\x00", "\x60\x4f", "\x43\x76", "\x47\x2d", "\x00\x00", + "\x00\x00", "\x38\x25", "\x60\x4e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x60\x4d", "\x00\x00", "\x4d\x31", "\x4d\x32", "\x60\x51", + "\x31\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x76", + "\x3b\x62", "\x60\x52", "\x60\x53", "\x60\x55", "\x3d\x43", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x57", "\x00\x00", "\x60\x56", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x58", + "\x00\x00", "\x33\x4d", "\x00\x00", "\x00\x00", "\x60\x5a", "\x00\x00", + "\x00\x00", "\x60\x59", "\x00\x00", "\x60\x5c", "\x60\x5b", "\x38\x3c", + "\x00\x00", "\x00\x00", "\x4e\x28", "\x00\x00", "\x36\x4c", "\x00\x00", + "\x32\x26", "\x36\x6a", "\x34\x61", "\x4e\x68", "\x60\x5e", "\x60\x60", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x61", "\x00\x00", + "\x32\x51", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x60\x5d", "\x00\x00", "\x3b\x39", "\x00\x00", "\x00\x00", "\x44\x41", + "\x60\x5f", "\x60\x64", "\x00\x00", "\x3c\x6e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x60\x62", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x37\x3e", "\x00\x00", "\x00\x00", "\x48\x49", "\x60\x63", + "\x00\x00", "\x00\x00", "\x60\x7e", "\x60\x69", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x3d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x35\x65", "\x00\x00", "\x60\x66", "\x4d\x7d", + "\x00\x00", "\x00\x00", "\x4e\x30", "\x42\x76", "\x00\x00", "\x00\x00", + "\x60\x68", "\x60\x6a", "\x4e\x56", "\x36\x57", "\x48\x7c", "\x47\x4a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x6b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x60\x6d", "\x00\x00", "\x60\x70", "\x60\x6c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x6f", "\x38\x6a", "\x31\x4d", + "\x60\x71", "\x00\x00", "\x3f\x70", "\x60\x6e", "\x4e\x5c", "\x00\x00", + "\x00\x00", "\x60\x74", "\x74\x24", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x60\x72", "\x60\x75", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x60\x67", "\x60\x73", "\x00\x00", "\x00\x00", "\x3a\x3c", + "\x00\x00", "\x00\x00", "\x60\x76", "\x60\x77", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4d\x7e", "\x60\x78", "\x60\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x60\x65", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x60\x7a", "\x34\x44", "\x3c\x25", "\x60\x7b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x7c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x60\x7d", "\x31\x3b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x21", "\x00\x00", "\x49\x3b", "\x61\x22", "\x00\x00", + "\x00\x00", "\x34\x24", "\x61\x23", "\x00\x00", "\x61\x24", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x25", "\x00\x00", "\x61\x27", + "\x61\x28", "\x61\x26", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x53", + "\x61\x2a", "\x61\x29", "\x61\x2c", "\x61\x2b", "\x61\x2d", "\x61\x2e", + "\x61\x30", "\x61\x2f", "\x00\x00", "\x00\x00", "\x39\x79", "\x00\x00", + "\x61\x32", "\x00\x00", "\x61\x31", "\x00\x00", "\x00\x00", "\x34\x45", + "\x00\x00", "\x3f\x53", "\x00\x00", "\x45\x3c", "\x00\x00", "\x61\x33", + "\x40\x38", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x3a", "\x00\x00", + "\x31\x79", "\x61\x34", "\x00\x00", "\x4d\x51", "\x00\x00", "\x00\x00", + "\x4a\x63", "\x61\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x44", + "\x4d\x33", "\x39\x43", "\x3f\x3d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x43\x4b", "\x52\x34", "\x00\x00", "\x44\x2e", "\x32\x68", "\x61\x36", + "\x61\x37", "\x00\x00", "\x61\x3c", "\x00\x00", "\x00\x00", "\x61\x3a", + "\x61\x39", "\x5a\x42", "\x33\x26", "\x61\x38", "\x00\x00", "\x30\x5a", + "\x00\x00", "\x48\x2a", "\x00\x00", "\x00\x00", "\x48\x4a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x31", "\x61\x3d", "\x61\x3b", + "\x43\x5c", "\x40\x26", "\x00\x00", "\x00\x00", "\x48\x2b", "\x00\x00", + "\x49\x2d", "\x00\x00", "\x61\x3f", "\x4e\x2c", "\x37\x4d", "\x61\x40", + "\x00\x00", "\x61\x3e", "\x48\x56", "\x61\x41", "\x00\x00", "\x61\x42", + "\x00\x00", "\x00\x00", "\x30\x5b", "\x00\x00", "\x00\x00", "\x3e\x76", + "\x61\x47", "\x00\x00", "\x61\x44", "\x46\x6d", "\x61\x43", "\x35\x26", + "\x00\x00", "\x00\x00", "\x61\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x61\x45", "\x61\x46", "\x00\x00", "\x61\x49", "\x61\x48", "\x49\x25", + "\x00\x00", "\x00\x00", "\x41\x42", "\x41\x41", "\x00\x00", "\x35\x3f", + "\x00\x00", "\x00\x00", "\x61\x4b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x61\x4c", "\x00\x00", "\x00\x00", "\x61\x4d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x4f", + "\x00\x00", "\x61\x4e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x31\x56", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x57", "\x48\x68", "\x61\x51", "\x00\x00", "\x61\x53", + "\x00\x00", "\x00\x00", "\x61\x55", "\x3f\x3e", "\x00\x00", "\x00\x00", + "\x61\x56", "\x61\x54", "\x3c\x40", "\x00\x00", "\x00\x00", "\x00\x00", + "\x61\x50", "\x61\x52", "\x00\x00", "\x49\x42", "\x00\x00", "\x3e\x49", + "\x00\x00", "\x00\x00", "\x61\x59", "\x00\x00", "\x00\x00", "\x61\x58", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x5a", "\x00\x00", + "\x3c\x26", "\x3a\x2f", "\x00\x00", "\x00\x00", "\x45\x77", "\x61\x5b", + "\x00\x00", "\x44\x4b", "\x00\x00", "\x00\x00", "\x61\x5d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x21", "\x61\x5c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x69", "\x61\x62", "\x00\x00", + "\x61\x64", "\x61\x65", "\x43\x54", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x61\x63", "\x00\x00", "\x61\x60", "\x00\x00", + "\x61\x5e", "\x61\x5f", "\x00\x00", "\x61\x61", "\x61\x68", "\x00\x00", + "\x61\x66", "\x00\x00", "\x61\x67", "\x61\x69", "\x61\x6b", "\x61\x6c", + "\x61\x6d", "\x00\x00", "\x61\x6e", "\x00\x00", "\x00\x00", "\x61\x6a", + "\x61\x70", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x6f", "\x61\x71", + "\x4e\x45", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x74", "\x61\x72", + "\x61\x73", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x62", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x7e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4a\x4a", "\x00\x00", "\x61\x76", "\x00\x00", + "\x00\x00", "\x00\x00", "\x61\x75", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x77", "\x61\x78", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x7c", "\x61\x79", "\x61\x7a", "\x61\x7b", "\x00\x00", + "\x61\x7d", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x7e", "\x00\x00", + "\x62\x21", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x22", "\x00\x00", + "\x62\x23", "\x00\x00", "\x48\x2f", "\x45\x50", "\x62\x24", "\x47\x72", + "\x49\x34", "\x00\x00", "\x62\x25", "\x00\x00", "\x00\x00", "\x62\x26", + "\x45\x2a", "\x00\x00", "\x33\x27", "\x39\x44", "\x62\x27", "\x00\x00", + "\x00\x00", "\x62\x28", "\x00\x00", "\x00\x00", "\x62\x29", "\x00\x00", + "\x3b\x29", "\x00\x00", "\x00\x00", "\x62\x2b", "\x00\x00", "\x00\x00", + "\x62\x2a", "\x00\x00", "\x00\x00", "\x62\x2c", "\x62\x2d", "\x48\x69", + "\x00\x00", "\x62\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x2f", + "\x00\x00", "\x00\x00", "\x73\x69", "\x62\x30", "\x62\x31", "\x62\x32", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x2e", "\x00\x00", + "\x00\x00", "\x62\x33", "\x47\x56", "\x00\x00", "\x00\x00", "\x4b\x5f", + "\x00\x00", "\x31\x4e", "\x00\x00", "\x31\x57", "\x00\x00", "\x00\x00", + "\x62\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x36", + "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x35", "\x45\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x40\x39", "\x5d\x39", "\x00\x00", "\x62\x37", + "\x4c\x41", "\x00\x00", "\x62\x38", "\x00\x00", "\x34\x46", "\x48\x57", + "\x62\x39", "\x00\x00", "\x62\x3a", "\x00\x00", "\x00\x00", "\x62\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x5c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4c\x55", "\x00\x00", "\x44\x3e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x41\x6a", "\x00\x00", "\x00\x00", "\x62\x3d", "\x00\x00", + "\x00\x00", "\x3d\x62", "\x00\x00", "\x00\x00", "\x3e\x4a", "\x00\x00", + "\x00\x00", "\x62\x40", "\x00\x00", "\x00\x00", "\x62\x3f", "\x62\x3e", + "\x48\x7d", "\x00\x00", "\x34\x47", "\x38\x29", "\x62\x46", "\x00\x00", + "\x00\x00", "\x62\x43", "\x3f\x3f", "\x4c\x32", "\x00\x00", "\x00\x00", + "\x00\x00", "\x62\x42", "\x62\x44", "\x62\x45", "\x00\x00", "\x00\x00", + "\x62\x41", "\x62\x47", "\x62\x48", "\x00\x00", "\x44\x2f", "\x00\x00", + "\x34\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x65", "\x62\x49", + "\x62\x4a", "\x62\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3f\x67", "\x00\x00", "\x46\x44", "\x00\x00", "\x62\x4e", + "\x4b\x53", "\x00\x00", "\x62\x4b", "\x00\x00", "\x00\x00", "\x62\x4c", + "\x62\x51", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x50", + "\x62\x4f", "\x62\x53", "\x00\x00", "\x00\x00", "\x62\x52", "\x00\x00", + "\x00\x00", "\x62\x54", "\x62\x56", "\x00\x00", "\x62\x55", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x4d", "\x3d\x56", "\x4e\x46", + "\x00\x00", "\x00\x00", "\x62\x57", "\x00\x00", "\x00\x00", "\x46\x37", + "\x00\x00", "\x00\x00", "\x62\x58", "\x00\x00", "\x00\x00", "\x62\x59", + "\x00\x00", "\x62\x5d", "\x62\x5b", "\x62\x5c", "\x00\x00", "\x62\x5a", + "\x62\x5e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x62\x5f", "\x62\x60", "\x00\x00", "\x00\x00", "\x62\x61", "\x4c\x37", + "\x62\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x70", "\x62\x63", "\x00\x00", "\x43\x4e", "\x00\x00", "\x47\x6a", + "\x00\x00", "\x36\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x3b", + "\x62\x64", "\x36\x3a", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x50", + "\x62\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3a\x3d", "\x62\x66", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x62\x67", "\x00\x00", "\x38\x26", "\x3a\x55", "\x62\x69", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x56", "\x3a\x56", + "\x35\x4e", "\x4b\x24", "\x00\x00", "\x47\x4b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x57", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x39\x5c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x62\x6b", "\x3e\x4b", "\x4e\x32", "\x39\x45", + "\x00\x00", "\x00\x00", "\x38\x27", "\x00\x00", "\x00\x00", "\x48\x23", + "\x00\x00", "\x62\x6d", "\x62\x6f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x38\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x62\x6e", "\x44\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x62\x71", "\x33\x37", "\x62\x6c", "\x00\x00", "\x00\x00", "\x48\x6a", + "\x00\x00", "\x31\x30", "\x00\x00", "\x3a\x6c", "\x00\x00", "\x4f\x52", + "\x00\x00", "\x00\x00", "\x62\x70", "\x62\x72", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x4b", "\x00\x00", "\x40\x59", "\x62\x74", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x73", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x33\x4e", "\x00\x00", "\x62\x7b", "\x00\x00", + "\x62\x7a", "\x00\x00", "\x00\x00", "\x3c\x27", "\x00\x00", "\x00\x00", + "\x00\x00", "\x62\x7c", "\x62\x77", "\x00\x00", "\x00\x00", "\x00\x00", + "\x62\x7d", "\x62\x78", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x48\x58", "\x62\x76", "\x00\x00", "\x00\x00", "\x62\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x22", "\x63\x21", + "\x4b\x61", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x7e", "\x00\x00", + "\x00\x00", "\x30\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x63\x24", "\x63\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x4c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x25", + "\x41\x43", "\x00\x00", "\x00\x00", "\x63\x27", "\x63\x26", "\x63\x28", + "\x62\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x6a", "\x63\x2a", + "\x63\x29", "\x3c\x28", "\x00\x00", "\x4e\x69", "\x00\x00", "\x3c\x52", + "\x00\x00", "\x63\x2b", "\x37\x37", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x35\x40", "\x35\x27", "\x3b\x63", "\x4d\x34", + "\x00\x00", "\x00\x00", "\x63\x31", "\x00\x00", "\x63\x30", "\x41\x44", + "\x63\x2d", "\x00\x00", "\x00\x00", "\x63\x2f", "\x00\x00", "\x00\x00", + "\x3d\x4b", "\x3f\x40", "\x63\x2e", "\x63\x2c", "\x00\x00", "\x47\x2a", + "\x00\x00", "\x00\x00", "\x3e\x4d", "\x00\x00", "\x00\x00", "\x49\x3c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x57", "\x45\x78", + "\x00\x00", "\x00\x00", "\x63\x32", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x63\x33", "\x63\x49", "\x36\x58", "\x00\x00", "\x00\x00", + "\x4f\x3d", "\x41\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x63\x34", "\x00\x00", "\x00\x00", "\x32\x52", "\x44\x77", "\x4a\x21", + "\x63\x35", "\x35\x7a", "\x63\x36", "\x00\x00", "\x00\x00", "\x63\x38", + "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x39", "\x00\x00", "\x47\x29", + "\x00\x00", "\x00\x00", "\x63\x3a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x63\x3b", "\x63\x3c", "\x00\x00", "\x00\x00", + "\x36\x59", "\x32\x53", "\x46\x45", "\x3d\x28", "\x3b\x64", "\x63\x3d", + "\x00\x00", "\x3d\x29", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x32\x4a", "\x49\x43", "\x00\x00", "\x00\x00", "\x63\x3e", + "\x00\x00", "\x00\x00", "\x48\x6b", "\x41\x45", "\x00\x00", "\x63\x41", + "\x00\x00", "\x63\x42", "\x47\x69", "\x00\x00", "\x3f\x41", "\x63\x3f", + "\x00\x00", "\x43\x61", "\x00\x00", "\x00\x00", "\x63\x40", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x4e", "\x30\x5c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x35\x29", "\x63\x43", "\x00\x00", "\x00\x00", + "\x44\x78", "\x00\x00", "\x63\x44", "\x40\x47", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x2d", "\x00\x00", "\x00\x00", + "\x49\x23", "\x63\x45", "\x63\x46", "\x43\x55", "\x00\x00", "\x4e\x47", + "\x00\x00", "\x00\x00", "\x63\x48", "\x63\x47", "\x3c\x6f", "\x00\x00", + "\x00\x00", "\x63\x4a", "\x30\x70", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x63\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x4b", + "\x32\x54", "\x37\x4e", "\x63\x4c", "\x39\x46", "\x39\x72", "\x00\x00", + "\x4a\x66", "\x63\x4e", "\x00\x00", "\x00\x00", "\x4b\x54", "\x00\x00", + "\x00\x00", "\x63\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x51", + "\x31\x4f", "\x32\x3a", "\x30\x2c", "\x63\x4f", "\x63\x51", "\x63\x52", + "\x3e\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x63\x53", "\x00\x00", "\x33\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x63\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x6a", + "\x00\x00", "\x35\x66", "\x00\x00", "\x00\x00", "\x63\x56", "\x36\x75", + "\x00\x00", "\x00\x00", "\x63\x57", "\x00\x00", "\x40\x7c", "\x00\x00", + "\x46\x4d", "\x00\x00", "\x40\x60", "\x3a\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x63\x58", "\x43\x62", "\x41\x6b", "\x00\x00", "\x63\x5a", + "\x63\x5c", "\x63\x59", "\x63\x5b", "\x37\x22", "\x63\x5d", "\x37\x26", + "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x67", "\x4d\x52", "\x63\x5f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x60", + "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x2e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x63\x63", "\x00\x00", "\x00\x00", "\x00\x00", + "\x33\x76", "\x63\x62", "\x63\x61", "\x00\x00", "\x63\x65", "\x63\x5e", + "\x00\x00", "\x63\x66", "\x4e\x29", "\x00\x00", "\x63\x67", "\x00\x00", + "\x63\x68", "\x00\x00", "\x00\x00", "\x54\x74", "\x63\x6a", "\x00\x00", + "\x63\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x6b", "\x63\x6c", + "\x00\x00", "\x4e\x35", "\x63\x6d", "\x00\x00", "\x70\x6f", "\x3e\x4f", + "\x63\x6e", "\x63\x6f", "\x3d\x57", "\x00\x00", "\x46\x38", "\x63\x70", + "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x28", "\x00\x00", "\x00\x00", + "\x63\x71", "\x00\x00", "\x43\x3c", "\x63\x72", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x25", "\x00\x00", "\x51\x3f", + "\x43\x5d", "\x3c\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x48", "\x00\x00", "\x00\x00", "\x63\x73", "\x00\x00", "\x64\x22", + "\x00\x00", "\x63\x76", "\x00\x00", "\x35\x68", "\x00\x00", "\x63\x75", + "\x64\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x74", "\x00\x00", + "\x3e\x50", "\x63\x78", "\x63\x79", "\x00\x00", "\x45\x2b", "\x00\x00", + "\x00\x00", "\x63\x7a", "\x00\x00", "\x33\x5e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x5a", "\x49\x64", "\x00\x00", "\x63\x7c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x68", "\x63\x77", "\x00\x00", + "\x63\x7b", "\x63\x7d", "\x00\x00", "\x00\x00", "\x3a\x7b", "\x64\x26", + "\x49\x2e", "\x00\x00", "\x48\x26", "\x45\x79", "\x00\x00", "\x36\x5a", + "\x64\x25", "\x64\x23", "\x00\x00", "\x48\x35", "\x63\x7e", "\x43\x5e", + "\x45\x7b", "\x00\x00", "\x45\x7a", "\x00\x00", "\x3a\x76", "\x64\x38", + "\x64\x28", "\x00\x00", "\x64\x2a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x64\x2d", "\x00\x00", "\x64\x2e", "\x00\x00", "\x64\x2b", + "\x64\x2c", "\x00\x00", "\x00\x00", "\x64\x29", "\x64\x27", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x21", "\x4a\x4f", "\x32\x55", + "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x35", "\x00\x00", "\x64\x32", + "\x00\x00", "\x64\x37", "\x00\x00", "\x00\x00", "\x64\x36", "\x00\x00", + "\x47\x73", "\x4c\x27", "\x00\x00", "\x3b\x3b", "\x64\x30", "\x64\x39", + "\x64\x34", "\x00\x00", "\x64\x33", "\x64\x2f", "\x00\x00", "\x64\x31", + "\x00\x00", "\x34\x49", "\x43\x3d", "\x00\x00", "\x00\x00", "\x40\x7d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x22", "\x00\x00", "\x00\x00", + "\x64\x3e", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x24", "\x40\x61", + "\x64\x3b", "\x00\x00", "\x00\x00", "\x48\x4f", "\x00\x00", "\x64\x3f", + "\x4a\x53", "\x00\x00", "\x43\x5b", "\x00\x00", "\x64\x3a", "\x64\x3c", + "\x00\x00", "\x00\x00", "\x64\x3d", "\x64\x40", "\x00\x00", "\x00\x00", + "\x3c\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x46", "\x64\x45", + "\x64\x44", "\x00\x00", "\x00\x00", "\x64\x41", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4f\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x64\x4a", "\x00\x00", "\x00\x00", "\x64\x4e", "\x64\x4b", + "\x64\x47", "\x64\x48", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x64\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x42", + "\x52\x55", "\x64\x49", "\x64\x43", "\x00\x00", "\x00\x00", "\x64\x4c", + "\x64\x52", "\x00\x00", "\x34\x4a", "\x00\x00", "\x64\x4f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x64\x50", "\x00\x00", "\x00\x00", "\x64\x51", + "\x64\x54", "\x64\x53", "\x48\x76", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x64\x55", "\x4e\x7c", "\x4a\x6d", "\x64\x5a", "\x00\x00", + "\x00\x00", "\x64\x57", "\x64\x56", "\x40\x52", "\x00\x00", "\x64\x59", + "\x64\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x58", "\x00\x00", + "\x64\x5f", "\x00\x00", "\x64\x5c", "\x64\x5d", "\x64\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x64\x5e", "\x64\x60", "\x64\x61", "\x4a\x46", + "\x00\x00", "\x64\x62", "\x4c\x62", "\x00\x00", "\x00\x00", "\x36\x4e", + "\x37\x29", "\x64\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x34", "\x00\x00", "\x3f\x68", "\x00\x00", "\x4c\x30", + "\x00\x00", "\x00\x00", "\x64\x64", "\x00\x00", "\x4e\x33", "\x00\x00", + "\x00\x00", "\x47\x74", "\x00\x00", "\x41\x46", "\x47\x34", "\x00\x00", + "\x00\x00", "\x3d\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x40", + "\x00\x00", "\x64\x69", "\x64\x67", "\x00\x00", "\x64\x65", "\x34\x21", + "\x00\x00", "\x3e\x51", "\x64\x6a", "\x00\x00", "\x00\x00", "\x64\x68", + "\x00\x00", "\x64\x66", "\x64\x6e", "\x00\x00", "\x00\x00", "\x64\x6d", + "\x64\x6c", "\x64\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x64\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x70", + "\x40\x3a", "\x00\x00", "\x64\x71", "\x00\x00", "\x64\x73", "\x00\x00", + "\x00\x00", "\x64\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x38", "\x00\x00", + "\x00\x00", "\x00\x00", "\x64\x75", "\x00\x00", "\x00\x00", "\x00\x00", + "\x45\x7c", "\x00\x00", "\x64\x74", "\x00\x00", "\x00\x00", "\x00\x00", + "\x64\x76", "\x00\x00", "\x4a\x35", "\x41\x6c", "\x39\x47", "\x00\x00", + "\x64\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x48", + "\x64\x79", "\x00\x00", "\x00\x00", "\x64\x7a", "\x00\x00", "\x64\x7b", + "\x00\x00", "\x64\x7c", "\x00\x00", "\x3b\x65", "\x00\x00", "\x64\x7d", + "\x37\x4f", "\x00\x00", "\x00\x00", "\x35\x6a", "\x00\x00", "\x35\x2a", + "\x00\x00", "\x65\x21", "\x00\x00", "\x4c\x73", "\x39\x48", "\x64\x7e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x24", "\x4c\x66", "\x00\x00", + "\x47\x3c", "\x00\x00", "\x00\x00", "\x49\x33", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3d\x63", "\x65\x23", "\x00\x00", "\x3c\x53", "\x39\x49", + "\x3b\x66", "\x35\x69", "\x4a\x36", "\x65\x22", "\x00\x00", "\x00\x00", + "\x00\x00", "\x41\x47", "\x4b\x42", "\x3a\x77", "\x3b\x67", "\x44\x5d", + "\x00\x00", "\x65\x27", "\x4e\x5f", "\x3a\x59", "\x00\x00", "\x65\x28", + "\x3f\x42", "\x00\x00", "\x65\x2a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3e\x52", "\x3a\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x65\x29", "\x00\x00", "\x00\x00", "\x3d\x2a", "\x38\x3e", "\x41\x48", + "\x65\x25", "\x65\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x65\x26", "\x37\x50", "\x00\x00", "\x65\x2e", "\x65\x32", "\x37\x6b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x2d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x36", "\x00\x00", + "\x00\x00", "\x39\x4a", "\x00\x00", "\x00\x00", "\x4d\x6d", "\x30\x3c", + "\x65\x33", "\x00\x00", "\x00\x00", "\x35\x6b", "\x00\x00", "\x65\x30", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x31", + "\x00\x00", "\x00\x00", "\x45\x7d", "\x65\x2f", "\x65\x2c", "\x00\x00", + "\x33\x28", "\x40\x64", "\x00\x00", "\x00\x00", "\x38\x28", "\x00\x00", + "\x00\x00", "\x00\x00", "\x65\x38", "\x65\x35", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x37", "\x00\x00", "\x00\x00", + "\x00\x00", "\x65\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x37\x51", "\x42\x33", "\x65\x39", "\x41\x6e", "\x00\x00", + "\x00\x00", "\x65\x46", "\x00\x00", "\x00\x00", "\x65\x42", "\x65\x3c", + "\x65\x40", "\x3c\x7a", "\x30\x5d", "\x65\x3b", "\x65\x43", "\x65\x47", + "\x39\x4b", "\x4c\x56", "\x00\x00", "\x44\x56", "\x65\x3d", "\x00\x00", + "\x00\x00", "\x65\x45", "\x00\x00", "\x65\x3a", "\x43\x3e", "\x00\x00", + "\x65\x3f", "\x30\x3d", "\x4c\x4a", "\x65\x3e", "\x00\x00", "\x00\x00", + "\x36\x5b", "\x48\x6c", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x6d", + "\x00\x00", "\x4e\x50", "\x3d\x6f", "\x00\x00", "\x00\x00", "\x65\x6e", + "\x00\x00", "\x00\x00", "\x65\x48", "\x00\x00", "\x40\x7e", "\x00\x00", + "\x65\x44", "\x65\x49", "\x65\x4b", "\x00\x00", "\x44\x79", "\x65\x4e", + "\x00\x00", "\x00\x00", "\x65\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x54", "\x34\x4b", "\x00\x00", "\x00\x00", "\x4c\x4b", "\x00\x00", + "\x00\x00", "\x30\x5e", "\x00\x00", "\x00\x00", "\x65\x4d", "\x00\x00", + "\x4e\x7d", "\x65\x4c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x31\x6f", "\x00\x00", "\x00\x00", "\x46\x6c", "\x65\x4f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x56", "\x65\x50", "\x65\x57", + "\x65\x53", "\x47\x7b", "\x00\x00", "\x00\x00", "\x3c\x4a", "\x65\x55", + "\x00\x00", "\x65\x52", "\x65\x58", "\x65\x51", "\x00\x00", "\x00\x00", + "\x3d\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x25", + "\x00\x00", "\x00\x00", "\x3d\x4c", "\x00\x00", "\x00\x00", "\x65\x54", + "\x65\x60", "\x00\x00", "\x00\x00", "\x65\x5c", "\x00\x00", "\x65\x5f", + "\x00\x00", "\x65\x5d", "\x65\x61", "\x65\x5b", "\x00\x00", "\x65\x41", + "\x40\x53", "\x00\x00", "\x00\x00", "\x48\x4b", "\x00\x00", "\x65\x5e", + "\x00\x00", "\x00\x00", "\x65\x59", "\x00\x00", "\x00\x00", "\x00\x00", + "\x41\x21", "\x37\x52", "\x00\x00", "\x3d\x2b", "\x3f\x25", "\x41\x36", + "\x65\x64", "\x00\x00", "\x00\x00", "\x65\x66", "\x65\x67", "\x00\x00", + "\x00\x00", "\x65\x63", "\x65\x65", "\x65\x5a", "\x65\x62", "\x00\x00", + "\x65\x6a", "\x65\x69", "\x00\x00", "\x00\x00", "\x4b\x7a", "\x00\x00", + "\x00\x00", "\x37\x2b", "\x65\x68", "\x00\x00", "\x65\x6c", "\x65\x6b", + "\x65\x6f", "\x00\x00", "\x65\x71", "\x00\x00", "\x00\x00", "\x3b\x3c", + "\x65\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x72", + "\x65\x73", "\x00\x00", "\x00\x00", "\x65\x74", "\x00\x00", "\x65\x7a", + "\x45\x3b", "\x65\x76", "\x00\x00", "\x65\x75", "\x65\x77", "\x65\x78", + "\x00\x00", "\x65\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x65\x7b", "\x65\x7c", "\x34\x4c", "\x00\x00", "\x65\x7d", "\x00\x00", + "\x65\x7e", "\x66\x21", "\x66\x22", "\x66\x23", "\x66\x24", "\x00\x00", + "\x66\x25", "\x66\x26", "\x00\x00", "\x00\x00", "\x66\x28", "\x66\x27", + "\x00\x00", "\x00\x00", "\x66\x29", "\x66\x2a", "\x66\x2b", "\x66\x2e", + "\x66\x2c", "\x66\x2d", "\x3a\x61", "\x37\x53", "\x00\x00", "\x00\x00", + "\x43\x56", "\x00\x00", "\x48\x33", "\x00\x00", "\x3d\x70", "\x00\x00", + "\x00\x00", "\x47\x4d", "\x00\x00", "\x48\x6d", "\x66\x2f", "\x58\x6d", + "\x66\x30", "\x66\x32", "\x00\x00", "\x4d\x65", "\x66\x31", "\x66\x34", + "\x66\x33", "\x00\x00", "\x4d\x53", "\x00\x00", "\x66\x35", "\x00\x00", + "\x48\x7e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x39", "\x00\x00", "\x00\x00", "\x66\x38", "\x66\x37", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x3a", "\x37\x32", "\x00\x00", + "\x00\x00", "\x00\x00", "\x41\x22", "\x35\x41", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x3e", "\x66\x3b", "\x00\x00", "\x00\x00", + "\x66\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x3f", "\x00\x00", + "\x66\x40", "\x66\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x29", + "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x27", "\x00\x00", "\x00\x00", + "\x00\x00", "\x66\x42", "\x66\x43", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x44", "\x00\x00", "\x4d\x62", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x2c", "\x00\x00", "\x66\x46", "\x66\x45", + "\x3f\x69", "\x66\x47", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x48", "\x00\x00", "\x00\x00", "\x66\x49", "\x00\x00", "\x34\x65", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x4d", "\x00\x00", + "\x00\x00", "\x66\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x66\x4b", "\x00\x00", "\x4b\x5d", "\x4d\x63", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4d\x54", "\x4f\x37", "\x00\x00", "\x39\x4d", + "\x66\x4e", "\x3c\x54", "\x66\x4d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x66\x4f", "\x3c\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x42\x51", "\x00\x00", "\x66\x50", "\x00\x00", "\x00\x00", "\x39\x4c", + "\x00\x00", "\x4c\x57", "\x66\x51", "\x66\x52", "\x00\x00", "\x00\x00", + "\x66\x53", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x54", + "\x66\x55", "\x3c\x2a", "\x00\x00", "\x00\x00", "\x4c\x6d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x57", "\x00\x00", "\x43\x3f", + "\x00\x00", "\x66\x56", "\x66\x59", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x58", "\x66\x5a", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x3b", + "\x00\x00", "\x66\x5b", "\x00\x00", "\x66\x5c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x39", "\x66\x5d", "\x00\x00", "\x41\x6f", "\x66\x5e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x5f", + "\x4e\x7e", "\x66\x62", "\x00\x00", "\x66\x61", "\x66\x60", "\x44\x30", + "\x00\x00", "\x66\x63", "\x3f\x26", "\x00\x00", "\x66\x64", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x65", "\x4f\x38", "\x66\x66", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x67", "\x66\x69", "\x66\x68", + "\x48\x25", "\x00\x00", "\x46\x79", "\x00\x00", "\x4f\x3e", "\x48\x29", + "\x66\x6b", "\x00\x00", "\x00\x00", "\x3e\x53", "\x00\x00", "\x49\x2a", + "\x00\x00", "\x66\x6c", "\x66\x6a", "\x00\x00", "\x34\x4e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x38\x54", "\x3b\x68", "\x00\x00", "\x00\x00", + "\x48\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x2a", "\x4b\x43", + "\x00\x00", "\x66\x6f", "\x66\x6d", "\x00\x00", "\x39\x4e", "\x00\x00", + "\x39\x4f", "\x30\x69", "\x00\x00", "\x3a\x68", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x59", "\x30\x5f", "\x66\x74", + "\x00\x00", "\x43\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x47\x58", "\x00\x00", "\x42\x5b", "\x66\x76", "\x00\x00", + "\x00\x00", "\x66\x72", "\x66\x75", "\x66\x70", "\x00\x00", "\x66\x73", + "\x4b\x26", "\x00\x00", "\x00\x00", "\x38\x55", "\x00\x00", "\x00\x00", + "\x30\x7d", "\x66\x71", "\x66\x78", "\x00\x00", "\x66\x79", "\x00\x00", + "\x00\x00", "\x46\x39", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x26", "\x47\x3d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x69", "\x00\x00", "\x00\x00", + "\x36\x3c", "\x40\x48", "\x4f\x46", "\x4c\x2e", "\x66\x77", "\x40\x54", + "\x35\x53", "\x66\x7a", "\x66\x7c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x7b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x7d", "\x00\x00", "\x43\x26", "\x00\x00", + "\x47\x3e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x23", + "\x67\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x7e", + "\x00\x00", "\x00\x00", "\x3f\x55", "\x00\x00", "\x49\x65", "\x67\x25", + "\x00\x00", "\x67\x24", "\x39\x50", "\x4f\x53", "\x67\x35", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x29", "\x67\x2a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x70", "\x00\x00", + "\x00\x00", "\x67\x28", "\x00\x00", "\x39\x78", "\x67\x27", "\x00\x00", + "\x00\x00", "\x67\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x32", + "\x4a\x22", "\x41\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x42\x5c", "\x67\x2f", "\x00\x00", "\x67\x30", "\x67\x2c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x2d", "\x00\x00", "\x67\x2e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x51", "\x00\x00", + "\x00\x00", "\x00\x00", "\x67\x36", "\x00\x00", "\x67\x32", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x66", "\x00\x00", "\x4b\x6c", + "\x49\x28", "\x00\x00", "\x00\x00", "\x67\x31", "\x00\x00", "\x00\x00", + "\x67\x34", "\x67\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x44", + "\x67\x37", "\x67\x38", "\x00\x00", "\x00\x00", "\x41\x37", "\x00\x00", + "\x67\x39", "\x00\x00", "\x00\x00", "\x67\x3b", "\x00\x00", "\x67\x3f", + "\x00\x00", "\x00\x00", "\x67\x3c", "\x67\x3a", "\x47\x3f", "\x67\x3d", + "\x00\x00", "\x67\x3e", "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x32", + "\x00\x00", "\x67\x45", "\x67\x40", "\x00\x00", "\x00\x00", "\x00\x00", + "\x67\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x42", "\x00\x00", + "\x42\x21", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x44", + "\x67\x43", "\x67\x46", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x67\x47", "\x67\x48", "\x00\x00", "\x00\x00", "\x3f\x43", "\x00\x00", + "\x32\x69", "\x00\x00", "\x67\x49", "\x4e\x57", "\x00\x00", "\x3c\x2b", + "\x00\x00", "\x00\x00", "\x3d\x2d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3b\x6a", "\x43\x57", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x4a", "\x67\x4b", "\x31\x31", + "\x00\x00", "\x67\x4c", "\x00\x00", "\x00\x00", "\x67\x4d", "\x67\x4e", + "\x00\x00", "\x00\x00", "\x67\x4f", "\x00\x00", "\x67\x50", "\x36\x3d", + "\x5a\x2a", "\x67\x51", "\x00\x00", "\x40\x65", "\x67\x52", "\x3c\x4b", + "\x00\x00", "\x67\x53", "\x00\x00", "\x50\x30", "\x00\x00", "\x00\x00", + "\x00\x00", "\x67\x54", "\x4a\x5e", "\x34\x5c", "\x00\x00", "\x00\x00", + "\x41\x24", "\x3d\x58", "\x00\x00", "\x49\x71", "\x3d\x2e", "\x67\x55", + "\x39\x52", "\x67\x56", "\x48\x4c", "\x00\x00", "\x67\x64", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x58", "\x00\x00", "\x42\x49", + "\x47\x75", "\x38\x3f", "\x67\x57", "\x41\x25", "\x67\x59", "\x44\x7a", + "\x67\x5b", "\x67\x5a", "\x67\x5d", "\x00\x00", "\x00\x00", "\x67\x5c", + "\x00\x00", "\x67\x5e", "\x00\x00", "\x00\x00", "\x67\x60", "\x00\x00", + "\x67\x5f", "\x00\x00", "\x34\x4f", "\x00\x00", "\x67\x61", "\x00\x00", + "\x67\x62", "\x67\x63", "\x00\x00", "\x00\x00", "\x3a\x31", "\x4e\x49", + "\x00\x00", "\x67\x65", "\x3f\x27", "\x00\x00", "\x00\x00", "\x00\x00", + "\x31\x70", "\x67\x66", "\x67\x67", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x67\x68", "\x30\x72", "\x00\x00", "\x67\x69", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x6a", "\x49\x67", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x47", "\x00\x00", "\x67\x6c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x29", + "\x30\x32", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x6b", + "\x67\x6e", "\x47\x4e", "\x00\x00", "\x3f\x44", "\x00\x00", "\x32\x56", + "\x00\x00", "\x4b\x27", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x5d", "\x36\x5c", "\x00\x00", "\x67\x6d", "\x00\x00", "\x32\x6a", + "\x34\x23", "\x31\x71", "\x67\x72", "\x4e\x6a", "\x42\x5d", "\x00\x00", + "\x00\x00", "\x49\x44", "\x00\x00", "\x67\x7e", "\x00\x00", "\x32\x57", + "\x67\x7c", "\x00\x00", "\x67\x7a", "\x67\x71", "\x00\x00", "\x67\x6f", + "\x00\x00", "\x67\x70", "\x00\x00", "\x3c\x63", "\x36\x6c", "\x43\x77", + "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x51", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x51", "\x00\x00", "\x67\x74", + "\x67\x73", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x79", + "\x67\x75", "\x67\x78", "\x4c\x50", "\x67\x77", "\x32\x58", "\x33\x7d", + "\x67\x7b", "\x00\x00", "\x00\x00", "\x67\x7d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x37\x54", "\x68\x23", "\x68\x2c", "\x68\x2d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x2b", "\x68\x34", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x71", "\x00\x00", "\x00\x00", + "\x68\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x2a", "\x00\x00", + "\x68\x25", "\x68\x24", "\x00\x00", "\x68\x22", "\x68\x21", "\x43\x63", + "\x00\x00", "\x42\x7b", "\x68\x27", "\x68\x26", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x41\x70", "\x37\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x31\x41", "\x68\x28", "\x00\x00", "\x39\x53", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x71", "\x68\x3a", "\x00\x00", + "\x68\x3b", "\x00\x00", "\x32\x59", "\x00\x00", "\x00\x00", "\x00\x00", + "\x32\x2e", "\x68\x38", "\x68\x2e", "\x00\x00", "\x68\x36", "\x00\x00", + "\x68\x3d", "\x68\x37", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x35", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x76", "\x00\x00", + "\x00\x00", "\x68\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x2f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x50", "\x68\x31", "\x68\x3c", + "\x00\x00", "\x68\x32", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x68\x3e", "\x00\x00", "\x68\x30", "\x47\x7c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x69", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x39", "\x68\x4f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x68\x47", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x7b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x46", "\x00\x00", + "\x36\x5d", "\x00\x00", "\x68\x42", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x32\x5b", "\x00\x00", "\x00\x00", "\x3e\x54", "\x00\x00", + "\x68\x45", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x5a", "\x00\x00", + "\x00\x00", "\x45\x51", "\x68\x4a", "\x4a\x6e", "\x00\x00", "\x68\x41", + "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x5a", "\x38\x56", "\x49\x29", + "\x68\x4b", "\x00\x00", "\x68\x3f", "\x00\x00", "\x00\x00", "\x68\x48", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x52", "\x00\x00", "\x68\x43", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x44", + "\x46\x3a", "\x00\x00", "\x00\x00", "\x68\x49", "\x00\x00", "\x00\x00", + "\x00\x00", "\x68\x46", "\x4b\x28", "\x68\x4c", "\x30\x60", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x40", "\x68\x4e", "\x00\x00", + "\x68\x4d", "\x47\x6b", "\x68\x54", "\x00\x00", "\x68\x5f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x68\x62", "\x00\x00", "\x00\x00", "\x68\x50", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x55", "\x4d\x6e", "\x68\x5e", "\x00\x00", + "\x00\x00", "\x4d\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x2a", "\x43\x78", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x6b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x72", + "\x68\x64", "\x46\x21", "\x00\x00", "\x00\x00", "\x30\x31", "\x00\x00", + "\x00\x00", "\x68\x5d", "\x00\x00", "\x68\x59", "\x41\x72", "\x68\x53", + "\x68\x5b", "\x68\x60", "\x00\x00", "\x47\x2c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x30\x2a", "\x00\x00", "\x68\x58", "\x00\x00", "\x68\x61", + "\x49\x78", "\x68\x5c", "\x00\x00", "\x68\x57", "\x3e\x55", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x2f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3c\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x58", "\x00\x00", "\x00\x00", "\x49\x47", "\x00\x00", "\x00\x00", + "\x68\x67", "\x00\x00", "\x68\x70", "\x68\x5a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x33\x77", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x78", "\x68\x65", "\x00\x00", "\x68\x6a", + "\x41\x73", "\x00\x00", "\x00\x00", "\x68\x66", "\x00\x00", "\x68\x6d", + "\x00\x00", "\x00\x00", "\x43\x5f", "\x00\x00", "\x68\x6e", "\x00\x00", + "\x00\x00", "\x4d\x56", "\x68\x63", "\x33\x38", "\x00\x00", "\x68\x69", + "\x00\x00", "\x00\x00", "\x68\x6c", "\x4c\x2c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x6f", "\x00\x00", "\x00\x00", "\x68\x68", + "\x68\x6b", "\x4b\x29", "\x00\x00", "\x4f\x21", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x73", "\x68\x7a", "\x00\x00", + "\x00\x00", "\x68\x72", "\x3c\x43", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x51", "\x4a\x4e", "\x00\x00", "\x4c\x22", + "\x68\x79", "\x68\x78", "\x00\x00", "\x68\x74", "\x68\x75", "\x00\x00", + "\x31\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x77", + "\x00\x00", "\x68\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x68\x76", "\x30\x7e", "\x42\x22", "\x4a\x43", "\x00\x00", "\x00\x00", + "\x68\x7b", "\x69\x21", "\x00\x00", "\x48\x59", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x7e", "\x3e\x56", "\x3c\x49", "\x69\x23", + "\x00\x00", "\x00\x00", "\x36\x3e", "\x69\x24", "\x00\x00", "\x49\x79", + "\x68\x7d", "\x00\x00", "\x68\x56", "\x68\x7c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4f\x4f", "\x46\x22", "\x49\x73", "\x00\x00", + "\x00\x00", "\x69\x2b", "\x69\x31", "\x69\x32", "\x00\x00", "\x69\x25", + "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x76", "\x00\x00", "\x00\x00", + "\x69\x2f", "\x69\x27", "\x00\x00", "\x69\x29", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x33", "\x69\x28", "\x00\x00", + "\x00\x00", "\x69\x2c", "\x00\x00", "\x00\x00", "\x31\x72", "\x00\x00", + "\x46\x65", "\x00\x00", "\x69\x2d", "\x69\x30", "\x69\x26", "\x00\x00", + "\x41\x26", "\x00\x00", "\x69\x2a", "\x3b\x27", "\x3f\x45", "\x37\x30", + "\x4c\x74", "\x00\x00", "\x4c\x79", "\x3d\x72", "\x69\x37", "\x69\x35", + "\x4f\x4e", "\x69\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x75", + "\x00\x00", "\x69\x36", "\x69\x38", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x69\x39", "\x69\x3c", "\x69\x3a", "\x46\x23", "\x69\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x4d", "\x69\x2e", "\x3d\x73", + "\x00\x00", "\x69\x3d", "\x69\x42", "\x41\x74", "\x00\x00", "\x00\x00", + "\x69\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x22", "\x00\x00", + "\x00\x00", "\x00\x00", "\x69\x43", "\x41\x49", "\x00\x00", "\x00\x00", + "\x69\x3e", "\x69\x40", "\x69\x3f", "\x00\x00", "\x00\x00", "\x5d\x31", + "\x5d\x22", "\x00\x00", "\x00\x00", "\x69\x45", "\x69\x44", "\x4d\x76", + "\x00\x00", "\x62\x3c", "\x69\x46", "\x69\x47", "\x69\x48", "\x38\x57", + "\x00\x00", "\x35\x54", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x4a", + "\x51\x5d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x75", + "\x00\x00", "\x4e\x3a", "\x00\x00", "\x36\x73", "\x69\x4b", "\x69\x4c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x6e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x4d", "\x46\x7a", "\x00\x00", + "\x30\x3a", "\x32\x63", "\x69\x52", "\x69\x53", "\x69\x4e", "\x00\x00", + "\x3b\x3d", "\x69\x4f", "\x47\x42", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x69\x50", "\x69\x51", "\x69\x5b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x69\x55", "\x69\x58", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x69\x54", "\x69\x56", "\x00\x00", "\x69\x57", + "\x3c\x58", "\x00\x00", "\x69\x59", "\x00\x00", "\x43\x41", "\x00\x00", + "\x37\x56", "\x33\x42", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x69\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x33\x3f", "\x00\x00", "\x69\x61", "\x00\x00", "\x00\x00", "\x69\x5d", + "\x69\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x3a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x5e", "\x00\x00", + "\x00\x00", "\x69\x5f", "\x49\x48", "\x48\x5a", "\x69\x62", "\x42\x7d", + "\x69\x6c", "\x00\x00", "\x69\x68", "\x00\x00", "\x00\x00", "\x32\x6b", + "\x00\x00", "\x69\x66", "\x00\x00", "\x4b\x2a", "\x69\x67", "\x00\x00", + "\x00\x00", "\x69\x64", "\x00\x00", "\x69\x65", "\x69\x6a", "\x69\x6d", + "\x00\x00", "\x00\x00", "\x69\x6b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x69\x69", "\x69\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x43\x58", "\x00\x00", "\x69\x74", "\x00\x00", "\x4c\x2a", + "\x69\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x73", "\x69\x6e", + "\x00\x00", "\x00\x00", "\x69\x70", "\x00\x00", "\x00\x00", "\x00\x00", + "\x69\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x6f", "\x40\x66", + "\x00\x00", "\x4f\x39", "\x69\x78", "\x00\x00", "\x69\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x21", "\x00\x00", "\x3f\x2a", + "\x00\x00", "\x69\x7b", "\x00\x00", "\x69\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x76", "\x69\x75", "\x00\x00", + "\x00\x00", "\x6a\x22", "\x00\x00", "\x00\x00", "\x32\x5c", "\x00\x00", + "\x69\x7c", "\x00\x00", "\x6a\x23", "\x00\x00", "\x00\x00", "\x00\x00", + "\x69\x7d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x69\x7a", "\x00\x00", "\x44\x33", "\x00\x00", "\x69\x77", "\x47\x68", + "\x00\x00", "\x00\x00", "\x6a\x27", "\x4d\x3b", "\x6a\x26", "\x00\x00", + "\x00\x00", "\x6a\x25", "\x6a\x2e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6a\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x30", "\x4d\x66", + "\x6a\x33", "\x00\x00", "\x6a\x2a", "\x00\x00", "\x00\x00", "\x6a\x2b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x2f", "\x00\x00", "\x6a\x32", + "\x6a\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x29", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x2c", "\x00\x00", "\x6a\x3d", + "\x6a\x36", "\x6a\x34", "\x00\x00", "\x00\x00", "\x6a\x35", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6a\x3a", "\x6a\x3b", "\x00\x00", "\x33\x2a", + "\x00\x00", "\x35\x42", "\x00\x00", "\x00\x00", "\x6a\x39", "\x6a\x24", + "\x6a\x38", "\x6a\x3c", "\x6a\x37", "\x00\x00", "\x6a\x3e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6a\x40", "\x6a\x3f", "\x6a\x42", "\x6a\x41", + "\x69\x5a", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x46", "\x6a\x43", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x44", "\x00\x00", + "\x00\x00", "\x6a\x45", "\x00\x00", "\x6a\x47", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x37\x6c", "\x00\x00", "\x6a\x49", "\x00\x00", + "\x6a\x48", "\x00\x00", "\x3d\x30", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x39\x54", "\x5e\x27", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6a\x4a", "\x3d\x51", "\x00\x00", "\x00\x00", + "\x00\x00", "\x33\x39", "\x00\x00", "\x6a\x4b", "\x00\x00", "\x31\x52", + "\x00\x00", "\x3e\x57", "\x6a\x4c", "\x00\x00", "\x00\x00", "\x39\x55", + "\x6a\x4d", "\x30\x61", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x3d", "\x00\x00", "\x00\x00", "\x6a\x4e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x6a", "\x00\x00", "\x6a\x55", "\x00\x00", + "\x00\x00", "\x6a\x52", "\x00\x00", "\x43\x6f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x53", "\x6a\x50", "\x36\x5e", + "\x00\x00", "\x6a\x4f", "\x6a\x56", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x37\x36", "\x00\x00", "\x00\x00", "\x42\x5e", + "\x00\x00", "\x6a\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6a\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x35", "\x6a\x57", + "\x00\x00", "\x6a\x5a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6a\x51", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x5b", "\x00\x00", + "\x6a\x5d", "\x48\x6f", "\x00\x00", "\x00\x00", "\x6a\x59", "\x00\x00", + "\x6a\x5e", "\x6a\x60", "\x00\x00", "\x00\x00", "\x38\x53", "\x6a\x54", + "\x00\x00", "\x30\x41", "\x6a\x5f", "\x00\x00", "\x3a\x5b", "\x4e\x76", + "\x6a\x61", "\x6a\x62", "\x41\x75", "\x4e\x22", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6a\x63", "\x4d\x35", "\x00\x00", "\x00\x00", + "\x6a\x64", "\x6a\x65", "\x00\x00", "\x00\x00", "\x4a\x64", "\x6a\x66", + "\x00\x00", "\x3a\x40", "\x00\x00", "\x4e\x23", "\x6a\x6b", "\x6a\x6c", + "\x3e\x58", "\x6a\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x67", + "\x6a\x67", "\x00\x00", "\x00\x00", "\x6a\x69", "\x40\x3d", "\x3f\x7e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x68", "\x00\x00", "\x6a\x6d", + "\x00\x00", "\x00\x00", "\x4a\x23", "\x00\x00", "\x00\x00", "\x6a\x6f", + "\x00\x00", "\x6a\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x6c", + "\x00\x00", "\x4b\x2b", "\x6a\x70", "\x6a\x7c", "\x6a\x72", "\x6a\x73", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x74", "\x6a\x75", + "\x6a\x79", "\x00\x00", "\x6a\x7a", "\x00\x00", "\x00\x00", "\x6a\x78", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x76", + "\x00\x00", "\x6a\x71", "\x6a\x77", "\x6a\x7b", "\x70\x37", "\x32\x28", + "\x6a\x7e", "\x36\x5f", "\x6a\x7d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x22", "\x00\x00", "\x6b\x21", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x24", "\x00\x00", "\x00\x00", "\x6b\x23", "\x00\x00", "\x6b\x25", + "\x00\x00", "\x00\x00", "\x3d\x31", "\x00\x00", "\x6b\x26", "\x00\x00", + "\x00\x00", "\x6b\x27", "\x6b\x28", "\x40\x3e", "\x00\x00", "\x4d\x57", + "\x00\x00", "\x6b\x29", "\x00\x00", "\x00\x00", "\x4a\x24", "\x47\x46", + "\x6b\x2a", "\x00\x00", "\x6b\x2b", "\x38\x2b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x2c", + "\x00\x00", "\x00\x00", "\x3b\x6b", "\x47\x41", "\x6b\x2d", "\x00\x00", + "\x33\x50", "\x6b\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x30", "\x4d\x77", "\x00\x00", "\x6b\x2f", "\x3f\x46", "\x00\x00", + "\x6b\x31", "\x00\x00", "\x00\x00", "\x6b\x32", "\x00\x00", "\x00\x00", + "\x6b\x33", "\x34\x51", "\x6b\x34", "\x00\x00", "\x00\x00", "\x6b\x35", + "\x00\x00", "\x6b\x36", "\x6b\x37", "\x33\x51", "\x6b\x38", "\x00\x00", + "\x6b\x39", "\x6b\x3a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x32\x72", "\x00\x00", "\x00\x00", "\x3f\x28", "\x6b\x3b", + "\x6b\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x3d", "\x38\x40", + "\x00\x00", "\x44\x7b", "\x6b\x3e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x37\x57", "\x00\x00", "\x3f\x56", "\x00\x00", "\x6b\x41", + "\x00\x00", "\x46\x24", "\x00\x00", "\x6b\x40", "\x00\x00", "\x00\x00", + "\x37\x31", "\x00\x00", "\x00\x00", "\x6b\x3f", "\x42\x77", "\x35\x2d", + "\x00\x00", "\x00\x00", "\x6b\x42", "\x00\x00", "\x6b\x43", "\x00\x00", + "\x3e\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x6d", "\x00\x00", + "\x6b\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x2c", + "\x00\x00", "\x00\x00", "\x40\x5f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x35\x76", "\x00\x00", "\x4c\x75", "\x41\x4a", "\x00\x00", "\x6b\x45", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x47", "\x43\x70", "\x3e\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x49", "\x00\x00", "\x6b\x4a", + "\x3a\x3e", "\x42\x42", "\x6b\x48", "\x00\x00", "\x3e\x5b", "\x49\x3e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x47", + "\x00\x00", "\x00\x00", "\x3b\x6c", "\x00\x00", "\x31\x53", "\x00\x00", + "\x6b\x4e", "\x37\x58", "\x00\x00", "\x00\x00", "\x3b\x6e", "\x00\x00", + "\x00\x00", "\x3b\x6d", "\x00\x00", "\x4f\x4d", "\x6b\x4d", "\x6b\x4c", + "\x41\x27", "\x00\x00", "\x35\x4d", "\x4f\x43", "\x33\x3a", "\x3e\x5c", + "\x6b\x4b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x50", "\x00\x00", "\x6b\x51", "\x6b\x4f", "\x00\x00", "\x38\x58", + "\x00\x00", "\x4d\x40", "\x00\x00", "\x00\x00", "\x3b\x6f", "\x47\x27", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x54", "\x00\x00", "\x40\x40", + "\x00\x00", "\x43\x42", "\x00\x00", "\x00\x00", "\x4d\x36", "\x00\x00", + "\x6b\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x6c", "\x00\x00", + "\x40\x3f", "\x6b\x53", "\x00\x00", "\x6b\x58", "\x38\x6d", "\x6b\x55", + "\x6b\x56", "\x00\x00", "\x6b\x52", "\x00\x00", "\x00\x00", "\x00\x00", + "\x40\x62", "\x46\x49", "\x00\x00", "\x00\x00", "\x43\x2f", "\x00\x00", + "\x32\x5d", "\x48\x70", "\x00\x00", "\x00\x00", "\x35\x43", "\x00\x00", + "\x00\x00", "\x44\x34", "\x00\x00", "\x00\x00", "\x6b\x5b", "\x00\x00", + "\x6b\x59", "\x00\x00", "\x00\x00", "\x43\x4c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x40\x41", "\x34\x52", "\x6b\x5a", "\x00\x00", "\x3f\x5b", + "\x00\x00", "\x00\x00", "\x4e\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4f\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x5c", "\x6b\x67", + "\x44\x35", "\x00\x00", "\x6b\x66", "\x00\x00", "\x6b\x63", "\x6b\x6b", + "\x6b\x64", "\x00\x00", "\x6b\x60", "\x00\x00", "\x44\x7c", "\x6b\x5f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x5d", "\x00\x00", "\x4d\x21", + "\x3b\x70", "\x00\x00", "\x00\x00", "\x6b\x61", "\x00\x00", "\x6b\x5e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x65", "\x3d\x74", "\x00\x00", + "\x38\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x7a", "\x00\x00", + "\x4b\x45", "\x31\x5a", "\x30\x62", "\x00\x00", "\x46\x25", "\x00\x00", + "\x00\x00", "\x6b\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x68", "\x00\x00", "\x46\x66", "\x00\x00", "\x6b\x6d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6b\x62", "\x00\x00", "\x6b\x6c", "\x6b\x6e", + "\x00\x00", "\x38\x2c", "\x6b\x6a", "\x39\x56", "\x00\x00", "\x3c\x55", + "\x00\x00", "\x00\x00", "\x6b\x6f", "\x4d\x58", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6b\x72", "\x00\x00", "\x6b\x75", "\x00\x00", + "\x00\x00", "\x6b\x73", "\x49\x35", "\x6b\x70", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x60", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6b\x74", "\x00\x00", "\x00\x00", "\x6b\x76", + "\x6b\x7a", "\x00\x00", "\x00\x00", "\x6b\x77", "\x00\x00", "\x6b\x79", + "\x6b\x78", "\x6b\x7b", "\x00\x00", "\x3c\x31", "\x00\x00", "\x6b\x7d", + "\x6b\x7c", "\x49\x68", "\x00\x00", "\x00\x00", "\x6c\x21", "\x37\x59", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x7e", "\x6c\x22", + "\x00\x00", "\x00\x00", "\x6c\x23", "\x35\x44", "\x66\x41", "\x3e\x79", + "\x00\x00", "\x6c\x24", "\x00\x00", "\x00\x00", "\x38\x6e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x25", "\x00\x00", + "\x00\x00", "\x6c\x26", "\x00\x00", "\x00\x00", "\x3b\x3e", "\x5a\x4e", + "\x00\x00", "\x6c\x27", "\x00\x00", "\x6c\x28", "\x00\x00", "\x3d\x32", + "\x00\x00", "\x6c\x29", "\x6c\x2a", "\x00\x00", "\x00\x00", "\x6c\x2b", + "\x00\x00", "\x00\x00", "\x6c\x2c", "\x6c\x2d", "\x43\x2b", "\x00\x00", + "\x00\x00", "\x6c\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6c\x30", "\x00\x00", "\x6c\x2f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x46\x26", "\x00\x00", "\x6c\x31", "\x00\x00", "\x4b\x2d", + "\x00\x00", "\x6c\x32", "\x00\x00", "\x6c\x33", "\x00\x00", "\x6c\x34", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x35", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x5a", "\x3e\x5d", "\x6c\x36", + "\x39\x6b", "\x50\x2e", "\x6c\x37", "\x6c\x38", "\x49\x3f", "\x6c\x39", + "\x00\x00", "\x6c\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6c\x3a", "\x00\x00", "\x00\x00", "\x6c\x3c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6c\x3b", "\x6c\x3d", "\x00\x00", "\x4b\x46", + "\x6c\x3e", "\x6c\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6c\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x42", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x2d", "\x44\x67", + "\x00\x00", "\x49\x69", "\x3a\x62", "\x39\x57", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x49\x4f", "\x32\x5f", "\x48\x4e", "\x6c\x45", + "\x34\x53", "\x40\x55", "\x6c\x44", "\x6c\x49", "\x43\x79", "\x4c\x63", + "\x00\x00", "\x6c\x47", "\x6c\x48", "\x35\x2e", "\x00\x00", "\x6c\x4a", + "\x47\x63", "\x42\x5f", "\x00\x00", "\x00\x00", "\x48\x71", "\x45\x3d", + "\x6c\x46", "\x00\x00", "\x4b\x47", "\x32\x6c", "\x6c\x4c", "\x4f\x28", + "\x44\x42", "\x4f\x45", "\x00\x00", "\x00\x00", "\x3b\x71", "\x6c\x4b", + "\x00\x00", "\x42\x31", "\x00\x00", "\x00\x00", "\x6c\x5c", "\x41\x28", + "\x00\x00", "\x00\x00", "\x46\x78", "\x00\x00", "\x49\x50", "\x6c\x4f", + "\x3b\x3f", "\x3b\x72", "\x00\x00", "\x3e\x5e", "\x00\x00", "\x47\x65", + "\x00\x00", "\x38\x2d", "\x6c\x4e", "\x6c\x4d", "\x00\x00", "\x49\x6a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x41", "\x00\x00", "\x00\x00", + "\x45\x52", "\x6c\x51", "\x6c\x52", "\x39\x58", "\x6c\x50", "\x6c\x53", + "\x6c\x54", "\x00\x00", "\x6c\x56", "\x42\x23", "\x00\x00", "\x6c\x55", + "\x34\x66", "\x00\x00", "\x6c\x58", "\x00\x00", "\x6c\x57", "\x6c\x59", + "\x00\x00", "\x00\x00", "\x6c\x5b", "\x6c\x5d", "\x00\x00", "\x6c\x5e", + "\x40\x56", "\x00\x00", "\x3c\x4f", "\x6c\x5f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x33\x52", "\x00\x00", "\x6c\x60", "\x00\x00", "\x00\x00", + "\x41\x76", "\x6c\x61", "\x00\x00", "\x6c\x62", "\x49\x6b", "\x00\x00", + "\x00\x00", "\x35\x2f", "\x6c\x63", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x5b", + "\x6c\x64", "\x3c\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3f\x76", "\x42\x2d", "\x6c\x67", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6c\x66", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x65", "\x6c\x6d", + "\x6c\x6b", "\x00\x00", "\x00\x00", "\x6c\x68", "\x6c\x6a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6c\x69", "\x6c\x6c", "\x00\x00", "\x35\x77", + "\x00\x00", "\x6c\x70", "\x00\x00", "\x40\x57", "\x00\x00", "\x6c\x71", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x59", "\x00\x00", + "\x6c\x6e", "\x6c\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x29", + "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x37", "\x00\x00", "\x41\x29", + "\x6c\x72", "\x00\x00", "\x00\x00", "\x6c\x75", "\x6c\x73", "\x6c\x74", + "\x4d\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x27", + "\x6c\x78", "\x6c\x76", "\x6c\x77", "\x6c\x79", "\x6d\x29", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x7c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6c\x7d", "\x6c\x7b", "\x6c\x7a", "\x00\x00", + "\x44\x7d", "\x00\x00", "\x00\x00", "\x6d\x21", "\x6d\x25", "\x6d\x22", + "\x6c\x7e", "\x00\x00", "\x6d\x23", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6d\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x2b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x26", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x58", "\x6d\x28", "\x00\x00", + "\x00\x00", "\x6d\x2a", "\x6d\x27", "\x6d\x2d", "\x00\x00", "\x3d\x33", + "\x00\x00", "\x6d\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6d\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6d\x2f", "\x00\x00", "\x00\x00", "\x6d\x32", "\x6d\x31", "\x00\x00", + "\x6d\x30", "\x00\x00", "\x00\x00", "\x6d\x34", "\x6d\x33", "\x00\x00", + "\x4c\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x36", "\x00\x00", + "\x6d\x35", "\x6d\x37", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6d\x38", "\x6d\x3a", "\x6d\x39", "\x3f\x48", "\x6d\x3b", "\x00\x00", + "\x00\x00", "\x36\x6d", "\x6d\x3c", "\x6d\x3e", "\x6d\x3f", "\x6d\x40", + "\x6d\x3d", "\x00\x00", "\x6d\x41", "\x00\x00", "\x3c\x56", "\x6d\x42", + "\x35\x30", "\x37\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x2e", "\x6d\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x70", + "\x00\x00", "\x00\x00", "\x45\x3e", "\x6d\x44", "\x6d\x47", "\x3c\x34", + "\x00\x00", "\x00\x00", "\x6d\x46", "\x6d\x45", "\x37\x5a", "\x6d\x48", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x53", "\x00\x00", + "\x6d\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x5c", "\x6d\x49", + "\x00\x00", "\x6d\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6d\x4c", "\x6d\x4e", "\x4a\x65", "\x6d\x4b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6d\x4d", "\x00\x00", "\x6d\x51", "\x6d\x4f", + "\x35\x31", "\x00\x00", "\x6d\x50", "\x6d\x53", "\x00\x00", "\x00\x00", + "\x47\x5a", "\x4e\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x54", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x22", "\x6d\x56", "\x00\x00", + "\x6d\x55", "\x00\x00", "\x00\x00", "\x6d\x59", "\x4d\x41", "\x00\x00", + "\x00\x00", "\x6d\x58", "\x00\x00", "\x33\x6d", "\x6d\x57", "\x6d\x5c", + "\x00\x00", "\x00\x00", "\x6d\x5b", "\x00\x00", "\x00\x00", "\x6d\x5a", + "\x45\x32", "\x6d\x5d", "\x6d\x5e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6d\x5f", "\x00\x00", "\x00\x00", "\x39\x6c", "\x00\x00", + "\x37\x25", "\x6d\x60", "\x6d\x61", "\x6d\x62", "\x3f\x49", "\x6d\x63", + "\x00\x00", "\x3c\x2d", "\x6d\x64", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6d\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x21", "\x51\x7e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x66", "\x65\x70", + "\x6d\x67", "\x43\x24", "\x3f\x2b", "\x47\x40", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6d\x68", "\x00\x00", "\x00\x00", "\x4a\x55", + "\x44\x54", "\x39\x7e", "\x00\x00", "\x00\x00", "\x43\x29", "\x00\x00", + "\x00\x00", "\x31\x2a", "\x00\x00", "\x4b\x78", "\x3f\x57", "\x37\x5e", + "\x00\x00", "\x00\x00", "\x36\x61", "\x00\x00", "\x00\x00", "\x4a\x56", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x69", + "\x6d\x6b", "\x00\x00", "\x00\x00", "\x6d\x6a", "\x32\x60", "\x00\x00", + "\x00\x00", "\x46\x76", "\x6d\x6c", "\x47\x77", "\x00\x00", "\x45\x33", + "\x00\x00", "\x6d\x6d", "\x3d\x52", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6d\x6f", "\x00\x00", "\x00\x00", "\x4c\x42", "\x6d\x7e", "\x6d\x71", + "\x6d\x72", "\x00\x00", "\x00\x00", "\x44\x49", "\x00\x00", "\x00\x00", + "\x42\x60", "\x41\x77", "\x00\x00", "\x46\x28", "\x00\x00", "\x6d\x70", + "\x35\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x79", + "\x00\x00", "\x6d\x76", "\x6e\x25", "\x46\x29", "\x43\x60", "\x6d\x73", + "\x00\x00", "\x44\x7e", "\x45\x53", "\x6d\x74", "\x6d\x78", "\x3f\x60", + "\x00\x00", "\x47\x67", "\x44\x4c", "\x00\x00", "\x00\x00", "\x40\x42", + "\x6d\x77", "\x42\x2e", "\x42\x24", "\x6d\x75", "\x30\x29", "\x4f\x22", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x7a", "\x42\x61", "\x00\x00", + "\x00\x00", "\x3d\x35", "\x3f\x4a", "\x00\x00", "\x00\x00", "\x6d\x7c", + "\x6d\x7b", "\x00\x00", "\x30\x6f", "\x6d\x7d", "\x00\x00", "\x00\x00", + "\x49\x2f", "\x00\x00", "\x6e\x27", "\x00\x00", "\x00\x00", "\x46\x5b", + "\x3f\x6b", "\x00\x00", "\x00\x00", "\x43\x59", "\x00\x00", "\x36\x78", + "\x00\x00", "\x6e\x26", "\x4d\x37", "\x31\x3f", "\x00\x00", "\x4a\x57", + "\x32\x61", "\x6e\x21", "\x6e\x22", "\x6e\x23", "\x6e\x24", "\x46\x3b", + "\x43\x23", "\x30\x63", "\x6e\x28", "\x00\x00", "\x6e\x29", "\x74\x23", + "\x00\x00", "\x00\x00", "\x42\x3d", "\x00\x00", "\x6e\x2a", "\x00\x00", + "\x31\x73", "\x41\x4c", "\x00\x00", "\x38\x2f", "\x00\x00", "\x4d\x5a", + "\x00\x00", "\x00\x00", "\x6e\x2b", "\x45\x2c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x41\x78", "\x3c\x57", "\x6e\x2c", "\x00\x00", "\x00\x00", + "\x6e\x2f", "\x00\x00", "\x00\x00", "\x3d\x65", "\x6e\x2d", "\x41\x2b", + "\x41\x2a", "\x00\x00", "\x30\x64", "\x00\x00", "\x4e\x4b", "\x6e\x31", + "\x00\x00", "\x48\x72", "\x6e\x33", "\x6e\x32", "\x6e\x30", "\x63\x64", + "\x34\x54", "\x00\x00", "\x00\x00", "\x6d\x6e", "\x00\x00", "\x6e\x35", + "\x6e\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6e\x36", + "\x00\x00", "\x4d\x38", "\x46\x61", "\x00\x00", "\x00\x00", "\x4b\x2e", + "\x00\x00", "\x6e\x37", "\x00\x00", "\x3c\x59", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6e\x38", "\x00\x00", "\x6e\x39", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6e\x3a", "\x00\x00", "\x00\x00", "\x45\x21", + "\x30\x6a", "\x39\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x3a", + "\x6e\x3e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x34", "\x6e\x3b", "\x00\x00", "\x6e\x3c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x49\x74", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x33\x54", "\x4d\x39", "\x00\x00", "\x36\x3f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x54", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6e\x3f", "\x6e\x40", "\x6e\x41", "\x45\x22", + "\x00\x00", "\x00\x00", "\x6e\x43", "\x00\x00", "\x6e\x42", "\x46\x53", + "\x6e\x44", "\x3d\x36", "\x3c\x60", "\x47\x5b", "\x43\x71", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3c\x72", "\x00\x00", "\x3f\x6c", "\x00\x00", + "\x6e\x45", "\x00\x00", "\x6e\x46", "\x3f\x5d", "\x6e\x47", "\x00\x00", + "\x6e\x48", "\x00\x00", "\x00\x00", "\x00\x00", "\x6e\x49", "\x4d\x6f", + "\x00\x00", "\x3d\x37", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6e\x4b", "\x6e\x4a", "\x00\x00", "\x39\x5a", "\x00\x00", + "\x39\x73", "\x3b\x40", "\x6e\x4e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3d\x66", "\x00\x00", "\x6e\x4d", "\x00\x00", "\x6e\x4c", + "\x00\x00", "\x42\x69", "\x00\x00", "\x00\x00", "\x38\x6f", "\x00\x00", + "\x40\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x30", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x39", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6e\x4f", "\x00\x00", + "\x3e\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6e\x52", "\x6e\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x6e\x51", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6e\x54", "\x6e\x53", + "\x00\x00", "\x00\x00", "\x3e\x7a", "\x00\x00", "\x6e\x55", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6e\x56", "\x6e\x57", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x50", "\x3a\x53", + "\x3c\x61", "\x6e\x58", "\x00\x00", "\x6e\x59", "\x4e\x24", "\x3d\x45", + "\x4c\x6e", "\x4e\x4c", "\x6e\x5a", "\x36\x62", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6e\x5b", "\x00\x00", "\x45\x23", "\x00\x00", + "\x00\x00", "\x6e\x5e", "\x33\x78", "\x3f\x4b", "\x00\x00", "\x6e\x5c", + "\x00\x00", "\x6e\x5d", "\x00\x00", "\x44\x60", "\x00\x00", "\x00\x00", + "\x4b\x55", "\x36\x7c", "\x6e\x60", "\x6e\x61", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6e\x5f", "\x00\x00", "\x00\x00", + "\x6e\x63", "\x46\x5f", "\x33\x43", "\x00\x00", "\x00\x00", "\x6e\x67", + "\x00\x00", "\x00\x00", "\x6e\x64", "\x6e\x66", "\x6e\x62", "\x6f\x4f", + "\x00\x00", "\x00\x00", "\x6e\x65", "\x4e\x6b", "\x00\x00", "\x00\x00", + "\x38\x5a", "\x6e\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x45\x34", "\x6e\x6a", "\x00\x00", "\x00\x00", "\x6e\x6d", "\x6e\x6b", + "\x00\x00", "\x6e\x70", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6e\x71", "\x6e\x69", "\x00\x00", "\x00\x00", "\x6e\x76", "\x31\x74", + "\x00\x00", "\x00\x00", "\x6e\x68", "\x00\x00", "\x00\x00", "\x00\x00", + "\x48\x2d", "\x00\x00", "\x6e\x6c", "\x00\x00", "\x3e\x60", "\x39\x5b", + "\x4b\x48", "\x00\x00", "\x36\x64", "\x00\x00", "\x00\x00", "\x3d\x46", + "\x00\x00", "\x46\x3c", "\x41\x2d", "\x00\x00", "\x6e\x74", "\x00\x00", + "\x6e\x6e", "\x6e\x73", "\x00\x00", "\x4c\x43", "\x00\x00", "\x44\x38", + "\x6e\x75", "\x6e\x72", "\x41\x2c", "\x6e\x79", "\x00\x00", "\x6e\x78", + "\x6e\x77", "\x00\x00", "\x00\x00", "\x4b\x2f", "\x3d\x7b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6e\x7a", "\x4a\x5f", "\x00\x00", + "\x00\x00", "\x31\x54", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x46", "\x43\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x35\x78", "\x00\x00", "\x6e\x7c", "\x00\x00", "\x39\x5d", "\x3b\x2c", + "\x6e\x7b", "\x3f\x6d", "\x3f\x6e", "\x6f\x21", "\x6f\x23", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x7b", "\x00\x00", + "\x6f\x22", "\x6f\x24", "\x00\x00", "\x00\x00", "\x36\x53", "\x00\x00", + "\x49\x45", "\x00\x00", "\x00\x00", "\x3c\x62", "\x4f\x23", "\x00\x00", + "\x6e\x7e", "\x3a\x78", "\x00\x00", "\x00\x00", "\x4f\x3f", "\x00\x00", + "\x00\x00", "\x6f\x26", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6f\x25", "\x6f\x27", "\x6e\x7d", "\x46\x69", "\x00\x00", "\x45\x55", + "\x44\x57", "\x00\x00", "\x6f\x2c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x43\x43", "\x6f\x28", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6f\x29", "\x37\x2d", "\x00\x00", "\x6f\x2b", "\x38\x30", "\x6f\x2a", + "\x00\x00", "\x3e\x61", "\x33\x79", "\x6f\x30", "\x00\x00", "\x3a\x3f", + "\x41\x79", "\x00\x00", "\x00\x00", "\x44\x4a", "\x33\x3b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6f\x2e", "\x6f\x2f", "\x44\x43", + "\x00\x00", "\x6f\x2d", "\x6f\x31", "\x6f\x37", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6f\x3a", "\x6f\x39", "\x45\x2d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6f\x32", "\x6f\x33", "\x6f\x36", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6f\x38", "\x00\x00", + "\x00\x00", "\x00\x00", "\x36\x40", "\x00\x00", "\x00\x00", "\x6f\x3b", + "\x6f\x35", "\x00\x00", "\x00\x00", "\x6f\x34", "\x6f\x3f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6f\x40", "\x6f\x41", "\x00\x00", "\x00\x00", + "\x6f\x3e", "\x6f\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x62", + "\x46\x2a", "\x6f\x3c", "\x6f\x45", "\x6f\x43", "\x6f\x44", "\x6f\x42", + "\x00\x00", "\x42\x78", "\x00\x00", "\x6f\x46", "\x6f\x47", "\x00\x00", + "\x00\x00", "\x6f\x49", "\x34\x55", "\x6f\x48", "\x4c\x7a", "\x6f\x54", + "\x6f\x4a", "\x00\x00", "\x00\x00", "\x6f\x4d", "\x00\x00", "\x6f\x4b", + "\x00\x00", "\x6f\x4c", "\x6f\x4e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6f\x50", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6f\x51", "\x00\x00", "\x6f\x52", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6f\x55", "\x6f\x53", "\x6f\x56", "\x6f\x58", + "\x00\x00", "\x6f\x57", "\x44\x39", "\x4c\x67", "\x00\x00", "\x6f\x59", + "\x41\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x6f\x5a", "\x00\x00", + "\x4a\x44", "\x6f\x5b", "\x33\x2b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x31\x3c", "\x00\x00", "\x34\x57", "\x00\x00", "\x34\x56", "\x6f\x5c", + "\x00\x00", "\x6f\x5d", "\x00\x00", "\x6f\x5e", "\x6f\x5f", "\x6f\x60", + "\x00\x00", "\x34\x58", "\x33\x55", "\x39\x5e", "\x48\x36", "\x00\x00", + "\x6f\x62", "\x6f\x61", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6f\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x5c", + "\x6f\x66", "\x00\x00", "\x6f\x65", "\x6f\x64", "\x00\x00", "\x6f\x67", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6f\x6a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x30\x47", "\x00\x00", "\x00\x00", "\x6f\x68", + "\x00\x00", "\x6f\x6c", "\x6f\x6b", "\x6f\x6e", "\x6f\x6d", "\x6f\x6f", + "\x00\x00", "\x46\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x6f\x70", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6f\x71", "\x6f\x73", + "\x00\x00", "\x00\x00", "\x6f\x72", "\x49\x6c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6f\x74", "\x6f\x75", "\x00\x00", "\x3a\x65", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6f\x76", "\x6f\x77", "\x00\x00", + "\x00\x00", "\x4b\x49", "\x41\x4b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x30\x24", "\x42\x4b", "\x00\x00", "\x6f\x78", "\x00\x00", "\x49\x6d", + "\x6f\x7b", "\x6f\x79", "\x39\x5f", "\x00\x00", "\x6f\x7a", "\x38\x42", + "\x4a\x45", "\x6f\x7d", "\x70\x21", "\x6f\x7e", "\x70\x22", "\x00\x00", + "\x00\x00", "\x31\x21", "\x3f\x58", "\x3d\x7c", "\x34\x59", "\x70\x23", + "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x66", "\x00\x00", "\x70\x25", + "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x22", "\x00\x00", "\x70\x24", + "\x44\x44", "\x00\x00", "\x4e\x4d", "\x46\x2b", "\x6f\x7c", "\x4e\x26", + "\x00\x00", "\x38\x31", "\x00\x00", "\x00\x00", "\x4d\x5b", "\x36\x79", + "\x4e\x34", "\x00\x00", "\x37\x28", "\x00\x00", "\x42\x62", "\x67\x21", + "\x00\x00", "\x70\x26", "\x33\x2c", "\x3f\x6f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x33\x56", "\x70\x28", "\x00\x00", "\x70\x29", + "\x70\x27", "\x37\x64", "\x00\x00", "\x3a\x5d", "\x3e\x63", "\x00\x00", + "\x00\x00", "\x00\x00", "\x31\x23", "\x00\x00", "\x00\x00", "\x4e\x59", + "\x00\x00", "\x00\x00", "\x00\x00", "\x70\x2b", "\x6e\x2e", "\x00\x00", + "\x70\x2a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x70\x2e", "\x70\x2c", "\x70\x2d", "\x00\x00", "\x70\x2f", "\x00\x00", + "\x70\x30", "\x4e\x6c", "\x70\x31", "\x70\x32", "\x00\x00", "\x40\x49", + "\x48\x3b", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x7d", "\x34\x67", + "\x00\x00", "\x00\x00", "\x4d\x3a", "\x32\x6d", "\x3d\x38", "\x38\x5b", + "\x00\x00", "\x70\x35", "\x00\x00", "\x70\x34", "\x3b\x73", "\x70\x36", + "\x70\x33", "\x00\x00", "\x00\x00", "\x3b\x28", "\x00\x00", "\x00\x00", + "\x00\x00", "\x70\x3a", "\x6a\x2d", "\x00\x00", "\x00\x00", "\x52\x56", + "\x00\x00", "\x3f\x77", "\x70\x38", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x25", "\x46\x71", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x31\x2b", "\x00\x00", "\x40\x63", "\x3c\x36", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x37", "\x00\x00", + "\x31\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x6d", "\x4d\x6b", + "\x00\x00", "\x70\x3b", "\x00\x00", "\x45\x45", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3c\x7b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x70\x3c", "\x00\x00", "\x70\x3d", "\x3f\x4c", "\x70\x3e", "\x00\x00", + "\x4e\x6e", "\x00\x00", "\x00\x00", "\x70\x39", "\x70\x40", "\x70\x42", + "\x00\x00", "\x70\x41", "\x00\x00", "\x70\x3f", "\x00\x00", "\x00\x00", + "\x70\x43", "\x00\x00", "\x00\x00", "\x70\x44", "\x00\x00", "\x00\x00", + "\x41\x7a", "\x00\x00", "\x32\x62", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x70\x45", "\x00\x00", "\x00\x00", "\x4c\x38", + "\x00\x00", "\x00\x00", "\x70\x46", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x70\x47", "\x00\x00", "\x4f\x2a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x31", "\x70\x48", + "\x00\x00", "\x00\x00", "\x00\x00", "\x70\x49", "\x70\x4a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x70\x4e", "\x00\x00", "\x70\x4b", "\x00\x00", + "\x70\x4c", "\x00\x00", "\x70\x4d", "\x70\x4f", "\x40\x44", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4c\x77", "\x00\x00", "\x00\x00", "\x40\x45", + "\x00\x00", "\x00\x00", "\x70\x50", "\x00\x00", "\x48\x73", "\x00\x00", + "\x70\x51", "\x73\x53", "\x4c\x4c", "\x00\x00", "\x70\x52", "\x00\x00", + "\x70\x53", "\x00\x00", "\x70\x54", "\x33\x57", "\x00\x00", "\x70\x56", + "\x00\x00", "\x3f\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x70\x57", + "\x00\x00", "\x00\x00", "\x37\x24", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x70\x58", "\x70\x5c", "\x00\x00", "\x70\x5a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x70\x5b", "\x00\x00", "\x00\x00", + "\x33\x73", "\x70\x59", "\x70\x5d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x70\x5e", "\x00\x00", "\x30\x48", "\x00\x00", "\x70\x5f", + "\x70\x60", "\x3e\x64", "\x00\x00", "\x00\x00", "\x00\x00", "\x70\x61", + "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x47", "\x00\x00", "\x00\x00", + "\x70\x64", "\x00\x00", "\x00\x00", "\x70\x63", "\x00\x00", "\x70\x62", + "\x00\x00", "\x00\x00", "\x6b\x71", "\x00\x00", "\x4a\x5c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x70\x65", "\x70\x66", + "\x70\x67", "\x00\x00", "\x00\x00", "\x70\x68", "\x00\x00", "\x70\x69", + "\x00\x00", "\x00\x00", "\x70\x6a", "\x34\x5a", "\x70\x6b", "\x70\x6c", + "\x47\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x70\x6e", "\x32\x3b", + "\x00\x00", "\x70\x71", "\x70\x70", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x31\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x41", + "\x00\x00", "\x4a\x47", "\x44\x3a", "\x3a\x22", "\x00\x00", "\x39\x60", + "\x3d\x67", "\x00\x00", "\x3f\x5c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x70\x73", "\x00\x00", "\x00\x00", "\x70\x72", "\x4d\x42", "\x34\x68", + "\x48\x52", "\x46\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x7c", + "\x4e\x4e", "\x00\x00", "\x37\x5b", "\x70\x76", "\x00\x00", "\x00\x00", + "\x70\x75", "\x4b\x4b", "\x46\x2c", "\x31\x50", "\x00\x00", "\x00\x00", + "\x70\x77", "\x70\x74", "\x00\x00", "\x00\x00", "\x49\x51", "\x4d\x6a", + "\x70\x78", "\x70\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x70\x7b", "\x42\x6a", "\x33\x5b", "\x33\x5c", "\x70\x7a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x69", "\x38\x32", "\x00\x00", + "\x00\x00", "\x34\x6a", "\x00\x00", "\x00\x00", "\x45\x3f", "\x00\x00", + "\x00\x00", "\x4e\x60", "\x38\x5c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x70\x7c", "\x00\x00", "\x00\x00", "\x00\x00", "\x70\x7d", "\x70\x7e", + "\x71\x21", "\x00\x00", "\x71\x23", "\x71\x22", "\x49\x77", "\x00\x00", + "\x71\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x25", + "\x00\x00", "\x71\x26", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x71\x27", "\x71\x29", "\x71\x28", "\x00\x00", "\x71\x2a", "\x48\x74", + "\x66\x4c", "\x00\x00", "\x00\x00", "\x3f\x29", "\x00\x00", "\x00\x00", + "\x35\x32", "\x71\x2b", "\x00\x00", "\x71\x2c", "\x00\x00", "\x52\x2c", + "\x5d\x3b", "\x48\x53", "\x00\x00", "\x00\x00", "\x30\x7b", "\x00\x00", + "\x30\x3b", "\x3b\x74", "\x4b\x30", "\x3e\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x71\x2d", "\x00\x00", "\x4c\x5f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x71\x2e", "\x4d\x5c", "\x00\x00", "\x31\x42", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x41", "\x00\x00", "\x71\x2f", + "\x32\x6e", "\x71\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x31", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x33", "\x71\x34", + "\x00\x00", "\x71\x36", "\x71\x32", "\x00\x00", "\x00\x00", "\x71\x35", + "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x5b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x71\x37", "\x00\x00", "\x71\x38", "\x71\x39", "\x71\x3a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x3b", "\x00\x00", "\x00\x00", + "\x71\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x3c", "\x00\x00", + "\x71\x3f", "\x71\x42", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x3e", + "\x71\x40", "\x71\x41", "\x00\x00", "\x00\x00", "\x71\x43", "\x00\x00", + "\x36\x42", "\x3c\x73", "\x71\x44", "\x71\x45", "\x39\x61", "\x71\x46", + "\x00\x00", "\x00\x00", "\x33\x3e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x4f", "\x71\x47", "\x71\x48", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x43\x5a", "\x46\x6b", "\x71\x49", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x47\x7d", "\x00\x00", "\x00\x00", "\x42\x4c", + "\x31\x58", "\x36\x6e", "\x00\x00", "\x36\x6f", "\x43\x73", "\x71\x4e", + "\x36\x70", "\x00\x00", "\x00\x00", "\x32\x6f", "\x00\x00", "\x00\x00", + "\x71\x4d", "\x00\x00", "\x00\x00", "\x71\x4b", "\x00\x00", "\x71\x4c", + "\x00\x00", "\x71\x4a", "\x00\x00", "\x00\x00", "\x71\x58", "\x71\x4f", + "\x71\x50", "\x00\x00", "\x00\x00", "\x71\x51", "\x71\x52", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x54", "\x00\x00", + "\x00\x00", "\x71\x53", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x59", + "\x00\x00", "\x71\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x57", + "\x35\x33", "\x71\x56", "\x00\x00", "\x00\x00", "\x41\x7b", "\x38\x33", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x59", + "\x42\x4d", "\x00\x00", "\x00\x00", "\x71\x5a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x2d", "\x71\x5b", "\x71\x60", "\x00\x00", + "\x71\x5e", "\x00\x00", "\x71\x5d", "\x71\x5f", "\x00\x00", "\x71\x5c", + "\x71\x62", "\x71\x61", "\x00\x00", "\x71\x64", "\x00\x00", "\x00\x00", + "\x36\x43", "\x71\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x65", + "\x00\x00", "\x00\x00", "\x71\x66", "\x00\x00", "\x71\x68", "\x71\x67", + "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x69", "\x71\x6b", "\x71\x6a", + "\x39\x7c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x6c", + "\x00\x00", "\x00\x00", "\x71\x6d", "\x33\x3c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x71\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x71\x6f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x71", "\x71\x70", "\x00\x00", + "\x71\x71", "\x00\x00", "\x71\x72", "\x71\x73", "\x00\x00", "\x00\x00", + "\x00\x00", "\x39\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x71\x74", "\x71\x75", "\x00\x00", "\x00\x00", "\x71\x76", + "\x71\x77", "\x00\x00", "\x00\x00", "\x71\x78", "\x00\x00", "\x00\x00", + "\x00\x00", "\x48\x31", "\x71\x7a", "\x00\x00", "\x49\x26", "\x71\x7b", + "\x71\x79", "\x00\x00", "\x71\x7d", "\x00\x00", "\x00\x00", "\x71\x7c", + "\x00\x00", "\x00\x00", "\x71\x7e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x72\x21", "\x72\x22", "\x72\x23", "\x00\x00", "\x72\x24", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x25", "\x00\x00", "\x00\x00", + "\x72\x26", "\x72\x27", "\x00\x00", "\x72\x28", "\x00\x00", "\x72\x29", + "\x72\x2a", "\x72\x2b", "\x72\x2c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x72\x2d", "\x72\x2e", "\x00\x00", "\x5d\x35", "\x72\x2f", "\x64\x78", + "\x35\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x21", + "\x3a\x32", "\x72\x31", "\x72\x30", "\x4c\x25", "\x72\x33", "\x72\x34", + "\x72\x32", "\x00\x00", "\x72\x35", "\x00\x00", "\x00\x00", "\x4b\x62", + "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x36", "\x00\x00", "\x35\x7b", + "\x4f\x25", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x37", + "\x72\x39", "\x30\x3e", "\x00\x00", "\x00\x00", "\x72\x3a", "\x4a\x2b", + "\x72\x38", "\x00\x00", "\x00\x00", "\x72\x3b", "\x72\x3c", "\x72\x3d", + "\x72\x3e", "\x72\x3f", "\x00\x00", "\x4b\x6e", "\x3b\x2d", "\x00\x00", + "\x3a\x7a", "\x41\x2f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x72\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x72\x43", "\x72\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x72\x44", "\x00\x00", "\x00\x00", "\x38\x71", "\x72\x42", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x45", "\x00\x00", + "\x72\x46", "\x72\x47", "\x00\x00", "\x72\x4b", "\x00\x00", "\x3b\x2a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x64", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x4c", "\x72\x49", + "\x72\x48", "\x72\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x5f", + "\x72\x50", "\x72\x4f", "\x72\x4e", "\x00\x00", "\x00\x00", "\x30\x33", + "\x72\x5a", "\x00\x00", "\x72\x56", "\x00\x00", "\x72\x57", "\x72\x53", + "\x72\x59", "\x00\x00", "\x72\x55", "\x33\x62", "\x00\x00", "\x00\x00", + "\x4f\x4c", "\x00\x00", "\x72\x58", "\x72\x54", "\x72\x52", "\x72\x51", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x5c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x5f", + "\x00\x00", "\x00\x00", "\x72\x5e", "\x72\x5d", "\x49\x49", "\x72\x5b", + "\x30\x73", "\x72\x60", "\x00\x00", "\x72\x62", "\x33\x6f", "\x72\x4d", + "\x31\x37", "\x00\x00", "\x00\x00", "\x72\x64", "\x72\x63", "\x72\x61", + "\x43\x2d", "\x4b\x70", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x5a", "\x00\x00", "\x00\x00", "\x72\x65", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x66", "\x72\x67", "\x72\x68", + "\x00\x00", "\x72\x69", "\x44\x3b", "\x00\x00", "\x72\x6a", "\x00\x00", + "\x48\x37", "\x00\x00", "\x72\x6f", "\x72\x6b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x72\x6c", "\x00\x00", "\x00\x00", "\x4b\x31", "\x4c\x44", + "\x00\x00", "\x46\x50", "\x72\x70", "\x00\x00", "\x00\x00", "\x72\x71", + "\x46\x3e", "\x72\x6e", "\x72\x6d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x32\x2a", "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x79", + "\x00\x00", "\x00\x00", "\x72\x78", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x31\x75", "\x00\x00", "\x00\x00", "\x00\x00", + "\x72\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x75", "\x00\x00", + "\x00\x00", "\x72\x73", "\x00\x00", "\x33\x7b", "\x00\x00", "\x72\x72", + "\x3c\x32", "\x32\x29", "\x39\x63", "\x00\x00", "\x00\x00", "\x72\x7c", + "\x72\x7b", "\x00\x00", "\x72\x7a", "\x00\x00", "\x00\x00", "\x72\x77", + "\x00\x00", "\x72\x7d", "\x00\x00", "\x72\x7e", "\x73\x25", "\x73\x24", + "\x73\x26", "\x00\x00", "\x00\x00", "\x31\x2d", "\x73\x21", "\x73\x22", + "\x00\x00", "\x39\x74", "\x4c\x39", "\x00\x00", "\x00\x00", "\x73\x23", + "\x4b\x32", "\x00\x00", "\x00\x00", "\x73\x2b", "\x00\x00", "\x00\x00", + "\x73\x27", "\x73\x2c", "\x73\x29", "\x00\x00", "\x73\x28", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x5c", "\x73\x2d", + "\x73\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x2f", + "\x00\x00", "\x73\x2a", "\x00\x00", "\x00\x00", "\x00\x00", "\x72\x74", + "\x00\x00", "\x00\x00", "\x73\x30", "\x00\x00", "\x44\x61", "\x00\x00", + "\x00\x00", "\x00\x00", "\x73\x34", "\x00\x00", "\x73\x35", "\x73\x33", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x32", + "\x73\x38", "\x00\x00", "\x73\x31", "\x00\x00", "\x73\x36", "\x73\x37", + "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x3a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x39", "\x73\x3c", "\x73\x3d", + "\x00\x00", "\x73\x3e", "\x00\x00", "\x00\x00", "\x4f\x49", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x3b", "\x42\x6b", + "\x3a\x6d", "\x00\x00", "\x00\x00", "\x73\x3f", "\x73\x40", "\x73\x41", + "\x00\x00", "\x00\x00", "\x73\x42", "\x73\x43", "\x00\x00", "\x00\x00", + "\x38\x34", "\x73\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x45", + "\x00\x00", "\x3c\x2f", "\x00\x00", "\x73\x46", "\x73\x47", "\x00\x00", + "\x00\x00", "\x73\x48", "\x73\x49", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x73\x4c", "\x73\x4a", "\x4f\x3c", "\x00\x00", "\x73\x4b", + "\x00\x00", "\x4e\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x73\x4d", "\x00\x00", "\x4e\x5b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x4e", "\x47\x7e", "\x00\x00", + "\x00\x00", "\x73\x4f", "\x73\x51", "\x00\x00", "\x00\x00", "\x73\x52", + "\x73\x50", "\x39\x6d", "\x4c\x4d", "\x4b\x63", "\x56\x77", "\x00\x00", + "\x5d\x60", "\x4b\x7b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x32\x2b", "\x73\x54", "\x35\x50", "\x73\x55", "\x73\x56", "\x73\x57", + "\x00\x00", "\x39\x75", "\x00\x00", "\x73\x58", "\x00\x00", "\x00\x00", + "\x00\x00", "\x60\x54", "\x4c\x5b", "\x00\x00", "\x42\x63", "\x73\x59", + "\x73\x5b", "\x73\x5a", "\x00\x00", "\x73\x5c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x73\x5d", "\x00\x00", "\x00\x00", "\x73\x5e", + "\x73\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x60", + "\x00\x00", "\x73\x61", "\x73\x62", "\x00\x00", "\x73\x63", "\x00\x00", + "\x73\x64", "\x73\x65", "\x73\x66", "\x73\x67", "\x73\x68", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x24", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x5d", "\x00\x00", "\x73\x6a", + "\x41\x4d", "\x73\x6b", "\x73\x6c", "\x49\x21", "\x00\x00", "\x00\x00", + "\x73\x6d", "\x73\x6e", "\x63\x37", "\x00\x00", "\x00\x00", "\x6c\x5a", + "\x70\x6d", "\x00\x00", "\x00\x00", "\x73\x6f", "\x00\x00", "\x73\x70", + "\x73\x72", "\x73\x73", "\x73\x74", "\x4e\x70", "\x73\x71", "\x00\x00", + "\x00\x00", "\x73\x75", "\x73\x76", "\x00\x00", "\x00\x00", "\x73\x78", + "\x00\x00", "\x73\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x73\x7a", "\x00\x00", "\x00\x00", "\x00\x00", "\x73\x7b", + "\x73\x79", "\x4e\x36", "\x73\x7c", "\x73\x7d", "\x63\x54", "\x00\x00", + "\x00\x00", "\x73\x7e", "\x21\x2a", "\x00\x00", "\x21\x74", "\x21\x70", + "\x21\x73", "\x21\x75", "\x00\x00", "\x21\x4a", "\x21\x4b", "\x21\x76", + "\x21\x5c", "\x21\x24", "\x00\x00", "\x21\x25", "\x21\x3f", "\x23\x30", + "\x23\x31", "\x23\x32", "\x23\x33", "\x23\x34", "\x23\x35", "\x23\x36", + "\x23\x37", "\x23\x38", "\x23\x39", "\x21\x27", "\x21\x28", "\x21\x63", + "\x21\x61", "\x21\x64", "\x21\x29", "\x21\x77", "\x23\x41", "\x23\x42", + "\x23\x43", "\x23\x44", "\x23\x45", "\x23\x46", "\x23\x47", "\x23\x48", + "\x23\x49", "\x23\x4a", "\x23\x4b", "\x23\x4c", "\x23\x4d", "\x23\x4e", + "\x23\x4f", "\x23\x50", "\x23\x51", "\x23\x52", "\x23\x53", "\x23\x54", + "\x23\x55", "\x23\x56", "\x23\x57", "\x23\x58", "\x23\x59", "\x23\x5a", + "\x21\x4e", "\x21\x40", "\x21\x4f", "\x21\x30", "\x21\x32", "\x21\x2e", + "\x23\x61", "\x23\x62", "\x23\x63", "\x23\x64", "\x23\x65", "\x23\x66", + "\x23\x67", "\x23\x68", "\x23\x69", "\x23\x6a", "\x23\x6b", "\x23\x6c", + "\x23\x6d", "\x23\x6e", "\x23\x6f", "\x23\x70", "\x23\x71", "\x23\x72", + "\x23\x73", "\x23\x74", "\x23\x75", "\x23\x76", "\x23\x77", "\x23\x78", + "\x23\x79", "\x23\x7a", "\x21\x50", "\x21\x43", "\x21\x51", "\x21\x31", + "\x00\x00", "\x21\x6f" +}; diff --git a/newlib/iconvdata/jis0208.h b/newlib/iconvdata/jis0208.h new file mode 100644 index 000000000..ef6b891eb --- /dev/null +++ b/newlib/iconvdata/jis0208.h @@ -0,0 +1,108 @@ +/* Access functions for JISX0208 conversion. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _JIS0208_H +#define _JIS0208_H 1 + +#include +#include + +/* Conversion table. */ +extern const uint16_t __jis0208_to_ucs[]; + +extern const char __jisx0208_from_ucs4_lat1[256][2]; +extern const char __jisx0208_from_ucs4_greek[0xc1][2]; +extern const struct jisx0208_ucs_idx __jisx0208_from_ucs_idx[]; +extern const char __jisx0208_from_ucs_tab[][2]; + + +/* Struct for table with indeces in UCS mapping table. */ +struct jisx0208_ucs_idx +{ + uint16_t start; + uint16_t end; + uint16_t idx; +}; + + +static inline uint32_t +jisx0208_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset) +{ + unsigned char ch = *(*s); + unsigned char ch2; + int idx; + + if (ch < offset || (ch - offset) <= 0x20) + return __UNKNOWN_10646_CHAR; + + if (avail < 2) + return 0; + + ch2 = (*s)[1]; + if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f) + return __UNKNOWN_10646_CHAR; + + idx = (ch - 0x21 - offset) * 94 + (ch2 - 0x21 - offset); + if (idx >= 0x1e80) + return __UNKNOWN_10646_CHAR; + + (*s) += 2; + + return __jis0208_to_ucs[idx] ?: ((*s) -= 2, __UNKNOWN_10646_CHAR); +} + + +static inline size_t +ucs4_to_jisx0208 (uint32_t wch, char *s, size_t avail) +{ + unsigned int ch = (unsigned int) wch; + const char *cp; + + if (avail < 2) + return 0; + + if (ch < 0x100) + cp = __jisx0208_from_ucs4_lat1[ch]; + else if (ch >= 0x391 && ch <= 0x451) + cp = __jisx0208_from_ucs4_greek[ch - 0x391]; + else + { + const struct jisx0208_ucs_idx *rp = __jisx0208_from_ucs_idx; + + if (ch >= 0xffff) + return __UNKNOWN_10646_CHAR; + while (ch > rp->end) + ++rp; + if (ch >= rp->start) + cp = __jisx0208_from_ucs_tab[rp->idx + ch - rp->start]; + else + return __UNKNOWN_10646_CHAR; + } + + if (cp[0] == '\0') + return __UNKNOWN_10646_CHAR; + + s[0] = cp[0]; + s[1] = cp[1]; + + return 2; +} + +#endif /* jis0208.h */ diff --git a/newlib/iconvdata/jis0212.c b/newlib/iconvdata/jis0212.c new file mode 100644 index 000000000..8ad1c9062 --- /dev/null +++ b/newlib/iconvdata/jis0212.c @@ -0,0 +1,3940 @@ +/* Mapping tables for JIS0212 handling. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include + +/* The defined JIS 0201 positions contains large gaps. It's better to + avoid using one large table with such big gaps. Instead we match each + char in a table resulting in an index to a table with the UCS. The + following command can be used to generate the table: + + egrep '^0x[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]' \ + .../eastasia/jis/jis0212.txt | perl tab.pl + + where tab.pl is + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $first=$last=$idx=0; + while (<>) { + local($jis,$ucs,%rest) = split; + local($u)=hex($ucs); + local($j)=hex($jis); + local($k) = int(($j - 0x2121) / 256) * 94 + (($j - 0x2121) % 256); + if ($k - $last > 6) { + if ($last != 0) { + printf (" { start: %#06x, end: %#06x, idx: %5d },\n", + $first, $last, $idx); + $idx += $last - $first + 1; + } + $first=$k; + } + $last=$k; + } + printf (" { start: %#06x, end: %#06x, idx: %5d }\n", + $first, $last, $idx); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +const struct jisx0212_idx __jisx0212_to_ucs_idx[] = +{ + { start: 0x006c, end: 0x0076, idx: 0 }, + { start: 0x007f, end: 0x0081, idx: 11 }, + { start: 0x00a8, end: 0x00ae, idx: 14 }, + { start: 0x0216, end: 0x0231, idx: 21 }, + { start: 0x0255, end: 0x0261, idx: 49 }, + { start: 0x0285, end: 0x0291, idx: 62 }, + { start: 0x02f0, end: 0x02ff, idx: 75 }, + { start: 0x0310, end: 0x031f, idx: 91 }, + { start: 0x034e, end: 0x03a4, idx: 107 }, + { start: 0x03ac, end: 0x0402, idx: 194 }, + { start: 0x0582, end: 0x1c2a, idx: 281 }, + { start: 0xffff, end: 0xffff, idx: 0 }, +}; + + +/* The table which the UCS values indexed by the table above can be + generated using the following code: + + egrep '^0x[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]' \ + .../eastasia/jis/jis0212.txt | perl tab.pl + + where tab.pl is: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $first=$last=$idx=0; + + sub fmt { + printf ("\n ") if (($n % 8) == 0); + ++$n; + my($val) = pop(@_); + printf (" %#06x,", $val); + } + + while (<>) { + local($jis,$ucs,%rest) = split; + local($u)=hex($ucs); + local($j)=hex($jis); + local($k) = int(($j - 0x2121) / 256) * 94 + (($j - 0x2121) % 256); + if ($k - $last > 6) { + if ($last != 0) { + $idx += $last - $first + 1; + } + $first=$k; + } else { + for ($m = $last + 1; $m < $k; ++$m) { + fmt (0); + } + } + fmt ($u); + $last=$k; + } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +const uint16_t __jisx0212_to_ucs[] = +{ + 0x02d8, 0x02c7, 0x00b8, 0x02d9, 0x02dd, 0x00af, 0x02db, 0x02da, + 0xff5e, 0x0384, 0x0385, 0x00a1, 0x00a6, 0x00bf, 0x00ba, 0x00aa, + 0x00a9, 0x00ae, 0x2122, 0x00a4, 0x2116, 0x0386, 0x0388, 0x0389, + 0x038a, 0x03aa, 000000, 0x038c, 000000, 0x038e, 0x03ab, 000000, + 0x038f, 000000, 000000, 000000, 000000, 0x03ac, 0x03ad, 0x03ae, + 0x03af, 0x03ca, 0x0390, 0x03cc, 0x03c2, 0x03cd, 0x03cb, 0x03b0, + 0x03ce, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, + 0x0409, 0x040a, 0x040b, 0x040c, 0x040e, 0x040f, 0x0452, 0x0453, + 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, + 0x045c, 0x045e, 0x045f, 0x00c6, 0x0110, 000000, 0x0126, 000000, + 0x0132, 000000, 0x0141, 0x013f, 000000, 0x014a, 0x00d8, 0x0152, + 000000, 0x0166, 0x00de, 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, + 0x0133, 0x0138, 0x0142, 0x0140, 0x0149, 0x014b, 0x00f8, 0x0153, + 0x00df, 0x0167, 0x00fe, 0x00c1, 0x00c0, 0x00c4, 0x00c2, 0x0102, + 0x01cd, 0x0100, 0x0104, 0x00c5, 0x00c3, 0x0106, 0x0108, 0x010c, + 0x00c7, 0x010a, 0x010e, 0x00c9, 0x00c8, 0x00cb, 0x00ca, 0x011a, + 0x0116, 0x0112, 0x0118, 000000, 0x011c, 0x011e, 0x0122, 0x0120, + 0x0124, 0x00cd, 0x00cc, 0x00cf, 0x00ce, 0x01cf, 0x0130, 0x012a, + 0x012e, 0x0128, 0x0134, 0x0136, 0x0139, 0x013d, 0x013b, 0x0143, + 0x0147, 0x0145, 0x00d1, 0x00d3, 0x00d2, 0x00d6, 0x00d4, 0x01d1, + 0x0150, 0x014c, 0x00d5, 0x0154, 0x0158, 0x0156, 0x015a, 0x015c, + 0x0160, 0x015e, 0x0164, 0x0162, 0x00da, 0x00d9, 0x00dc, 0x00db, + 0x016c, 0x01d3, 0x0170, 0x016a, 0x0172, 0x016e, 0x0168, 0x01d7, + 0x01db, 0x01d9, 0x01d5, 0x0174, 0x00dd, 0x0178, 0x0176, 0x0179, + 0x017d, 0x017b, 0x00e1, 0x00e0, 0x00e4, 0x00e2, 0x0103, 0x01ce, + 0x0101, 0x0105, 0x00e5, 0x00e3, 0x0107, 0x0109, 0x010d, 0x00e7, + 0x010b, 0x010f, 0x00e9, 0x00e8, 0x00eb, 0x00ea, 0x011b, 0x0117, + 0x0113, 0x0119, 0x01f5, 0x011d, 0x011f, 000000, 0x0121, 0x0125, + 0x00ed, 0x00ec, 0x00ef, 0x00ee, 0x01d0, 000000, 0x012b, 0x012f, + 0x0129, 0x0135, 0x0137, 0x013a, 0x013e, 0x013c, 0x0144, 0x0148, + 0x0146, 0x00f1, 0x00f3, 0x00f2, 0x00f6, 0x00f4, 0x01d2, 0x0151, + 0x014d, 0x00f5, 0x0155, 0x0159, 0x0157, 0x015b, 0x015d, 0x0161, + 0x015f, 0x0165, 0x0163, 0x00fa, 0x00f9, 0x00fc, 0x00fb, 0x016d, + 0x01d4, 0x0171, 0x016b, 0x0173, 0x016f, 0x0169, 0x01d8, 0x01dc, + 0x01da, 0x01d6, 0x0175, 0x00fd, 0x00ff, 0x0177, 0x017a, 0x017e, + 0x017c, 0x4e02, 0x4e04, 0x4e05, 0x4e0c, 0x4e12, 0x4e1f, 0x4e23, + 0x4e24, 0x4e28, 0x4e2b, 0x4e2e, 0x4e2f, 0x4e30, 0x4e35, 0x4e40, + 0x4e41, 0x4e44, 0x4e47, 0x4e51, 0x4e5a, 0x4e5c, 0x4e63, 0x4e68, + 0x4e69, 0x4e74, 0x4e75, 0x4e79, 0x4e7f, 0x4e8d, 0x4e96, 0x4e97, + 0x4e9d, 0x4eaf, 0x4eb9, 0x4ec3, 0x4ed0, 0x4eda, 0x4edb, 0x4ee0, + 0x4ee1, 0x4ee2, 0x4ee8, 0x4eef, 0x4ef1, 0x4ef3, 0x4ef5, 0x4efd, + 0x4efe, 0x4eff, 0x4f00, 0x4f02, 0x4f03, 0x4f08, 0x4f0b, 0x4f0c, + 0x4f12, 0x4f15, 0x4f16, 0x4f17, 0x4f19, 0x4f2e, 0x4f31, 0x4f60, + 0x4f33, 0x4f35, 0x4f37, 0x4f39, 0x4f3b, 0x4f3e, 0x4f40, 0x4f42, + 0x4f48, 0x4f49, 0x4f4b, 0x4f4c, 0x4f52, 0x4f54, 0x4f56, 0x4f58, + 0x4f5f, 0x4f63, 0x4f6a, 0x4f6c, 0x4f6e, 0x4f71, 0x4f77, 0x4f78, + 0x4f79, 0x4f7a, 0x4f7d, 0x4f7e, 0x4f81, 0x4f82, 0x4f84, 0x4f85, + 0x4f89, 0x4f8a, 0x4f8c, 0x4f8e, 0x4f90, 0x4f92, 0x4f93, 0x4f94, + 0x4f97, 0x4f99, 0x4f9a, 0x4f9e, 0x4f9f, 0x4fb2, 0x4fb7, 0x4fb9, + 0x4fbb, 0x4fbc, 0x4fbd, 0x4fbe, 0x4fc0, 0x4fc1, 0x4fc5, 0x4fc6, + 0x4fc8, 0x4fc9, 0x4fcb, 0x4fcc, 0x4fcd, 0x4fcf, 0x4fd2, 0x4fdc, + 0x4fe0, 0x4fe2, 0x4ff0, 0x4ff2, 0x4ffc, 0x4ffd, 0x4fff, 0x5000, + 0x5001, 0x5004, 0x5007, 0x500a, 0x500c, 0x500e, 0x5010, 0x5013, + 0x5017, 0x5018, 0x501b, 0x501c, 0x501d, 0x501e, 0x5022, 0x5027, + 0x502e, 0x5030, 0x5032, 0x5033, 0x5035, 0x5040, 0x5041, 0x5042, + 0x5045, 0x5046, 0x504a, 0x504c, 0x504e, 0x5051, 0x5052, 0x5053, + 0x5057, 0x5059, 0x505f, 0x5060, 0x5062, 0x5063, 0x5066, 0x5067, + 0x506a, 0x506d, 0x5070, 0x5071, 0x503b, 0x5081, 0x5083, 0x5084, + 0x5086, 0x508a, 0x508e, 0x508f, 0x5090, 0x5092, 0x5093, 0x5094, + 0x5096, 0x509b, 0x509c, 0x509e, 0x509f, 0x50a0, 0x50a1, 0x50a2, + 0x50aa, 0x50af, 0x50b0, 0x50b9, 0x50ba, 0x50bd, 0x50c0, 0x50c3, + 0x50c4, 0x50c7, 0x50cc, 0x50ce, 0x50d0, 0x50d3, 0x50d4, 0x50d8, + 0x50dc, 0x50dd, 0x50df, 0x50e2, 0x50e4, 0x50e6, 0x50e8, 0x50e9, + 0x50ef, 0x50f1, 0x50f6, 0x50fa, 0x50fe, 0x5103, 0x5106, 0x5107, + 0x5108, 0x510b, 0x510c, 0x510d, 0x510e, 0x50f2, 0x5110, 0x5117, + 0x5119, 0x511b, 0x511c, 0x511d, 0x511e, 0x5123, 0x5127, 0x5128, + 0x512c, 0x512d, 0x512f, 0x5131, 0x5133, 0x5134, 0x5135, 0x5138, + 0x5139, 0x5142, 0x514a, 0x514f, 0x5153, 0x5155, 0x5157, 0x5158, + 0x515f, 0x5164, 0x5166, 0x517e, 0x5183, 0x5184, 0x518b, 0x518e, + 0x5198, 0x519d, 0x51a1, 0x51a3, 0x51ad, 0x51b8, 0x51ba, 0x51bc, + 0x51be, 0x51bf, 0x51c2, 0x51c8, 0x51cf, 0x51d1, 0x51d2, 0x51d3, + 0x51d5, 0x51d8, 0x51de, 0x51e2, 0x51e5, 0x51ee, 0x51f2, 0x51f3, + 0x51f4, 0x51f7, 0x5201, 0x5202, 0x5205, 0x5212, 0x5213, 0x5215, + 0x5216, 0x5218, 0x5222, 0x5228, 0x5231, 0x5232, 0x5235, 0x523c, + 0x5245, 0x5249, 0x5255, 0x5257, 0x5258, 0x525a, 0x525c, 0x525f, + 0x5260, 0x5261, 0x5266, 0x526e, 0x5277, 0x5278, 0x5279, 0x5280, + 0x5282, 0x5285, 0x528a, 0x528c, 0x5293, 0x5295, 0x5296, 0x5297, + 0x5298, 0x529a, 0x529c, 0x52a4, 0x52a5, 0x52a6, 0x52a7, 0x52af, + 0x52b0, 0x52b6, 0x52b7, 0x52b8, 0x52ba, 0x52bb, 0x52bd, 0x52c0, + 0x52c4, 0x52c6, 0x52c8, 0x52cc, 0x52cf, 0x52d1, 0x52d4, 0x52d6, + 0x52db, 0x52dc, 0x52e1, 0x52e5, 0x52e8, 0x52e9, 0x52ea, 0x52ec, + 0x52f0, 0x52f1, 0x52f4, 0x52f6, 0x52f7, 0x5300, 0x5303, 0x530a, + 0x530b, 0x530c, 0x5311, 0x5313, 0x5318, 0x531b, 0x531c, 0x531e, + 0x531f, 0x5325, 0x5327, 0x5328, 0x5329, 0x532b, 0x532c, 0x532d, + 0x5330, 0x5332, 0x5335, 0x533c, 0x533d, 0x533e, 0x5342, 0x534c, + 0x534b, 0x5359, 0x535b, 0x5361, 0x5363, 0x5365, 0x536c, 0x536d, + 0x5372, 0x5379, 0x537e, 0x5383, 0x5387, 0x5388, 0x538e, 0x5393, + 0x5394, 0x5399, 0x539d, 0x53a1, 0x53a4, 0x53aa, 0x53ab, 0x53af, + 0x53b2, 0x53b4, 0x53b5, 0x53b7, 0x53b8, 0x53ba, 0x53bd, 0x53c0, + 0x53c5, 0x53cf, 0x53d2, 0x53d3, 0x53d5, 0x53da, 0x53dd, 0x53de, + 0x53e0, 0x53e6, 0x53e7, 0x53f5, 0x5402, 0x5413, 0x541a, 0x5421, + 0x5427, 0x5428, 0x542a, 0x542f, 0x5431, 0x5434, 0x5435, 0x5443, + 0x5444, 0x5447, 0x544d, 0x544f, 0x545e, 0x5462, 0x5464, 0x5466, + 0x5467, 0x5469, 0x546b, 0x546d, 0x546e, 0x5474, 0x547f, 0x5481, + 0x5483, 0x5485, 0x5488, 0x5489, 0x548d, 0x5491, 0x5495, 0x5496, + 0x549c, 0x549f, 0x54a1, 0x54a6, 0x54a7, 0x54a9, 0x54aa, 0x54ad, + 0x54ae, 0x54b1, 0x54b7, 0x54b9, 0x54ba, 0x54bb, 0x54bf, 0x54c6, + 0x54ca, 0x54cd, 0x54ce, 0x54e0, 0x54ea, 0x54ec, 0x54ef, 0x54f6, + 0x54fc, 0x54fe, 0x54ff, 0x5500, 0x5501, 0x5505, 0x5508, 0x5509, + 0x550c, 0x550d, 0x550e, 0x5515, 0x552a, 0x552b, 0x5532, 0x5535, + 0x5536, 0x553b, 0x553c, 0x553d, 0x5541, 0x5547, 0x5549, 0x554a, + 0x554d, 0x5550, 0x5551, 0x5558, 0x555a, 0x555b, 0x555e, 0x5560, + 0x5561, 0x5564, 0x5566, 0x557f, 0x5581, 0x5582, 0x5586, 0x5588, + 0x558e, 0x558f, 0x5591, 0x5592, 0x5593, 0x5594, 0x5597, 0x55a3, + 0x55a4, 0x55ad, 0x55b2, 0x55bf, 0x55c1, 0x55c3, 0x55c6, 0x55c9, + 0x55cb, 0x55cc, 0x55ce, 0x55d1, 0x55d2, 0x55d3, 0x55d7, 0x55d8, + 0x55db, 0x55de, 0x55e2, 0x55e9, 0x55f6, 0x55ff, 0x5605, 0x5608, + 0x560a, 0x560d, 0x560e, 0x560f, 0x5610, 0x5611, 0x5612, 0x5619, + 0x562c, 0x5630, 0x5633, 0x5635, 0x5637, 0x5639, 0x563b, 0x563c, + 0x563d, 0x563f, 0x5640, 0x5641, 0x5643, 0x5644, 0x5646, 0x5649, + 0x564b, 0x564d, 0x564f, 0x5654, 0x565e, 0x5660, 0x5661, 0x5662, + 0x5663, 0x5666, 0x5669, 0x566d, 0x566f, 0x5671, 0x5672, 0x5675, + 0x5684, 0x5685, 0x5688, 0x568b, 0x568c, 0x5695, 0x5699, 0x569a, + 0x569d, 0x569e, 0x569f, 0x56a6, 0x56a7, 0x56a8, 0x56a9, 0x56ab, + 0x56ac, 0x56ad, 0x56b1, 0x56b3, 0x56b7, 0x56be, 0x56c5, 0x56c9, + 0x56ca, 0x56cb, 0x56cf, 0x56d0, 0x56cc, 0x56cd, 0x56d9, 0x56dc, + 0x56dd, 0x56df, 0x56e1, 0x56e4, 0x56e5, 0x56e6, 0x56e7, 0x56e8, + 0x56f1, 0x56eb, 0x56ed, 0x56f6, 0x56f7, 0x5701, 0x5702, 0x5707, + 0x570a, 0x570c, 0x5711, 0x5715, 0x571a, 0x571b, 0x571d, 0x5720, + 0x5722, 0x5723, 0x5724, 0x5725, 0x5729, 0x572a, 0x572c, 0x572e, + 0x572f, 0x5733, 0x5734, 0x573d, 0x573e, 0x573f, 0x5745, 0x5746, + 0x574c, 0x574d, 0x5752, 0x5762, 0x5765, 0x5767, 0x5768, 0x576b, + 0x576d, 0x576e, 0x576f, 0x5770, 0x5771, 0x5773, 0x5774, 0x5775, + 0x5777, 0x5779, 0x577a, 0x577b, 0x577c, 0x577e, 0x5781, 0x5783, + 0x578c, 0x5794, 0x5797, 0x5799, 0x579a, 0x579c, 0x579d, 0x579e, + 0x579f, 0x57a1, 0x5795, 0x57a7, 0x57a8, 0x57a9, 0x57ac, 0x57b8, + 0x57bd, 0x57c7, 0x57c8, 0x57cc, 0x57cf, 0x57d5, 0x57dd, 0x57de, + 0x57e4, 0x57e6, 0x57e7, 0x57e9, 0x57ed, 0x57f0, 0x57f5, 0x57f6, + 0x57f8, 0x57fd, 0x57fe, 0x57ff, 0x5803, 0x5804, 0x5808, 0x5809, + 0x57e1, 0x580c, 0x580d, 0x581b, 0x581e, 0x581f, 0x5820, 0x5826, + 0x5827, 0x582d, 0x5832, 0x5839, 0x583f, 0x5849, 0x584c, 0x584d, + 0x584f, 0x5850, 0x5855, 0x585f, 0x5861, 0x5864, 0x5867, 0x5868, + 0x5878, 0x587c, 0x587f, 0x5880, 0x5881, 0x5887, 0x5888, 0x5889, + 0x588a, 0x588c, 0x588d, 0x588f, 0x5890, 0x5894, 0x5896, 0x589d, + 0x58a0, 0x58a1, 0x58a2, 0x58a6, 0x58a9, 0x58b1, 0x58b2, 0x58c4, + 0x58bc, 0x58c2, 0x58c8, 0x58cd, 0x58ce, 0x58d0, 0x58d2, 0x58d4, + 0x58d6, 0x58da, 0x58dd, 0x58e1, 0x58e2, 0x58e9, 0x58f3, 0x5905, + 0x5906, 0x590b, 0x590c, 0x5912, 0x5913, 0x5914, 0x8641, 0x591d, + 0x5921, 0x5923, 0x5924, 0x5928, 0x592f, 0x5930, 0x5933, 0x5935, + 0x5936, 0x593f, 0x5943, 0x5946, 0x5952, 0x5953, 0x5959, 0x595b, + 0x595d, 0x595e, 0x595f, 0x5961, 0x5963, 0x596b, 0x596d, 0x596f, + 0x5972, 0x5975, 0x5976, 0x5979, 0x597b, 0x597c, 0x598b, 0x598c, + 0x598e, 0x5992, 0x5995, 0x5997, 0x599f, 0x59a4, 0x59a7, 0x59ad, + 0x59ae, 0x59af, 0x59b0, 0x59b3, 0x59b7, 0x59ba, 0x59bc, 0x59c1, + 0x59c3, 0x59c4, 0x59c8, 0x59ca, 0x59cd, 0x59d2, 0x59dd, 0x59de, + 0x59df, 0x59e3, 0x59e4, 0x59e7, 0x59ee, 0x59ef, 0x59f1, 0x59f2, + 0x59f4, 0x59f7, 0x5a00, 0x5a04, 0x5a0c, 0x5a0d, 0x5a0e, 0x5a12, + 0x5a13, 0x5a1e, 0x5a23, 0x5a24, 0x5a27, 0x5a28, 0x5a2a, 0x5a2d, + 0x5a30, 0x5a44, 0x5a45, 0x5a47, 0x5a48, 0x5a4c, 0x5a50, 0x5a55, + 0x5a5e, 0x5a63, 0x5a65, 0x5a67, 0x5a6d, 0x5a77, 0x5a7a, 0x5a7b, + 0x5a7e, 0x5a8b, 0x5a90, 0x5a93, 0x5a96, 0x5a99, 0x5a9c, 0x5a9e, + 0x5a9f, 0x5aa0, 0x5aa2, 0x5aa7, 0x5aac, 0x5ab1, 0x5ab2, 0x5ab3, + 0x5ab5, 0x5ab8, 0x5aba, 0x5abb, 0x5abf, 0x5ac4, 0x5ac6, 0x5ac8, + 0x5acf, 0x5ada, 0x5adc, 0x5ae0, 0x5ae5, 0x5aea, 0x5aee, 0x5af5, + 0x5af6, 0x5afd, 0x5b00, 0x5b01, 0x5b08, 0x5b17, 0x5b34, 0x5b19, + 0x5b1b, 0x5b1d, 0x5b21, 0x5b25, 0x5b2d, 0x5b38, 0x5b41, 0x5b4b, + 0x5b4c, 0x5b52, 0x5b56, 0x5b5e, 0x5b68, 0x5b6e, 0x5b6f, 0x5b7c, + 0x5b7d, 0x5b7e, 0x5b7f, 0x5b81, 0x5b84, 0x5b86, 0x5b8a, 0x5b8e, + 0x5b90, 0x5b91, 0x5b93, 0x5b94, 0x5b96, 0x5ba8, 0x5ba9, 0x5bac, + 0x5bad, 0x5baf, 0x5bb1, 0x5bb2, 0x5bb7, 0x5bba, 0x5bbc, 0x5bc0, + 0x5bc1, 0x5bcd, 0x5bcf, 0x5bd6, 0x5bd7, 0x5bd8, 0x5bd9, 0x5bda, + 0x5be0, 0x5bef, 0x5bf1, 0x5bf4, 0x5bfd, 0x5c0c, 0x5c17, 0x5c1e, + 0x5c1f, 0x5c23, 0x5c26, 0x5c29, 0x5c2b, 0x5c2c, 0x5c2e, 0x5c30, + 0x5c32, 0x5c35, 0x5c36, 0x5c59, 0x5c5a, 0x5c5c, 0x5c62, 0x5c63, + 0x5c67, 0x5c68, 0x5c69, 0x5c6d, 0x5c70, 0x5c74, 0x5c75, 0x5c7a, + 0x5c7b, 0x5c7c, 0x5c7d, 0x5c87, 0x5c88, 0x5c8a, 0x5c8f, 0x5c92, + 0x5c9d, 0x5c9f, 0x5ca0, 0x5ca2, 0x5ca3, 0x5ca6, 0x5caa, 0x5cb2, + 0x5cb4, 0x5cb5, 0x5cba, 0x5cc9, 0x5ccb, 0x5cd2, 0x5cdd, 0x5cd7, + 0x5cee, 0x5cf1, 0x5cf2, 0x5cf4, 0x5d01, 0x5d06, 0x5d0d, 0x5d12, + 0x5d2b, 0x5d23, 0x5d24, 0x5d26, 0x5d27, 0x5d31, 0x5d34, 0x5d39, + 0x5d3d, 0x5d3f, 0x5d42, 0x5d43, 0x5d46, 0x5d48, 0x5d55, 0x5d51, + 0x5d59, 0x5d4a, 0x5d5f, 0x5d60, 0x5d61, 0x5d62, 0x5d64, 0x5d6a, + 0x5d6d, 0x5d70, 0x5d79, 0x5d7a, 0x5d7e, 0x5d7f, 0x5d81, 0x5d83, + 0x5d88, 0x5d8a, 0x5d92, 0x5d93, 0x5d94, 0x5d95, 0x5d99, 0x5d9b, + 0x5d9f, 0x5da0, 0x5da7, 0x5dab, 0x5db0, 0x5db4, 0x5db8, 0x5db9, + 0x5dc3, 0x5dc7, 0x5dcb, 0x5dd0, 0x5dce, 0x5dd8, 0x5dd9, 0x5de0, + 0x5de4, 0x5de9, 0x5df8, 0x5df9, 0x5e00, 0x5e07, 0x5e0d, 0x5e12, + 0x5e14, 0x5e15, 0x5e18, 0x5e1f, 0x5e20, 0x5e2e, 0x5e28, 0x5e32, + 0x5e35, 0x5e3e, 0x5e4b, 0x5e50, 0x5e49, 0x5e51, 0x5e56, 0x5e58, + 0x5e5b, 0x5e5c, 0x5e5e, 0x5e68, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, + 0x5e6e, 0x5e70, 0x5e80, 0x5e8b, 0x5e8e, 0x5ea2, 0x5ea4, 0x5ea5, + 0x5ea8, 0x5eaa, 0x5eac, 0x5eb1, 0x5eb3, 0x5ebd, 0x5ebe, 0x5ebf, + 0x5ec6, 0x5ecc, 0x5ecb, 0x5ece, 0x5ed1, 0x5ed2, 0x5ed4, 0x5ed5, + 0x5edc, 0x5ede, 0x5ee5, 0x5eeb, 0x5f02, 0x5f06, 0x5f07, 0x5f08, + 0x5f0e, 0x5f19, 0x5f1c, 0x5f1d, 0x5f21, 0x5f22, 0x5f23, 0x5f24, + 0x5f28, 0x5f2b, 0x5f2c, 0x5f2e, 0x5f30, 0x5f34, 0x5f36, 0x5f3b, + 0x5f3d, 0x5f3f, 0x5f40, 0x5f44, 0x5f45, 0x5f47, 0x5f4d, 0x5f50, + 0x5f54, 0x5f58, 0x5f5b, 0x5f60, 0x5f63, 0x5f64, 0x5f67, 0x5f6f, + 0x5f72, 0x5f74, 0x5f75, 0x5f78, 0x5f7a, 0x5f7d, 0x5f7e, 0x5f89, + 0x5f8d, 0x5f8f, 0x5f96, 0x5f9c, 0x5f9d, 0x5fa2, 0x5fa7, 0x5fab, + 0x5fa4, 0x5fac, 0x5faf, 0x5fb0, 0x5fb1, 0x5fb8, 0x5fc4, 0x5fc7, + 0x5fc8, 0x5fc9, 0x5fcb, 0x5fd0, 0x5fd1, 0x5fd2, 0x5fd3, 0x5fd4, + 0x5fde, 0x5fe1, 0x5fe2, 0x5fe8, 0x5fe9, 0x5fea, 0x5fec, 0x5fed, + 0x5fee, 0x5fef, 0x5ff2, 0x5ff3, 0x5ff6, 0x5ffa, 0x5ffc, 0x6007, + 0x600a, 0x600d, 0x6013, 0x6014, 0x6017, 0x6018, 0x601a, 0x601f, + 0x6024, 0x602d, 0x6033, 0x6035, 0x6040, 0x6047, 0x6048, 0x6049, + 0x604c, 0x6051, 0x6054, 0x6056, 0x6057, 0x605d, 0x6061, 0x6067, + 0x6071, 0x607e, 0x607f, 0x6082, 0x6086, 0x6088, 0x608a, 0x608e, + 0x6091, 0x6093, 0x6095, 0x6098, 0x609d, 0x609e, 0x60a2, 0x60a4, + 0x60a5, 0x60a8, 0x60b0, 0x60b1, 0x60b7, 0x60bb, 0x60be, 0x60c2, + 0x60c4, 0x60c8, 0x60c9, 0x60ca, 0x60cb, 0x60ce, 0x60cf, 0x60d4, + 0x60d5, 0x60d9, 0x60db, 0x60dd, 0x60de, 0x60e2, 0x60e5, 0x60f2, + 0x60f5, 0x60f8, 0x60fc, 0x60fd, 0x6102, 0x6107, 0x610a, 0x610c, + 0x6110, 0x6111, 0x6112, 0x6113, 0x6114, 0x6116, 0x6117, 0x6119, + 0x611c, 0x611e, 0x6122, 0x612a, 0x612b, 0x6130, 0x6131, 0x6135, + 0x6136, 0x6137, 0x6139, 0x6141, 0x6145, 0x6146, 0x6149, 0x615e, + 0x6160, 0x616c, 0x6172, 0x6178, 0x617b, 0x617c, 0x617f, 0x6180, + 0x6181, 0x6183, 0x6184, 0x618b, 0x618d, 0x6192, 0x6193, 0x6197, + 0x6198, 0x619c, 0x619d, 0x619f, 0x61a0, 0x61a5, 0x61a8, 0x61aa, + 0x61ad, 0x61b8, 0x61b9, 0x61bc, 0x61c0, 0x61c1, 0x61c2, 0x61ce, + 0x61cf, 0x61d5, 0x61dc, 0x61dd, 0x61de, 0x61df, 0x61e1, 0x61e2, + 0x61e7, 0x61e9, 0x61e5, 0x61ec, 0x61ed, 0x61ef, 0x6201, 0x6203, + 0x6204, 0x6207, 0x6213, 0x6215, 0x621c, 0x6220, 0x6222, 0x6223, + 0x6227, 0x6229, 0x622b, 0x6239, 0x623d, 0x6242, 0x6243, 0x6244, + 0x6246, 0x624c, 0x6250, 0x6251, 0x6252, 0x6254, 0x6256, 0x625a, + 0x625c, 0x6264, 0x626d, 0x626f, 0x6273, 0x627a, 0x627d, 0x628d, + 0x628e, 0x628f, 0x6290, 0x62a6, 0x62a8, 0x62b3, 0x62b6, 0x62b7, + 0x62ba, 0x62be, 0x62bf, 0x62c4, 0x62ce, 0x62d5, 0x62d6, 0x62da, + 0x62ea, 0x62f2, 0x62f4, 0x62fc, 0x62fd, 0x6303, 0x6304, 0x630a, + 0x630b, 0x630d, 0x6310, 0x6313, 0x6316, 0x6318, 0x6329, 0x632a, + 0x632d, 0x6335, 0x6336, 0x6339, 0x633c, 0x6341, 0x6342, 0x6343, + 0x6344, 0x6346, 0x634a, 0x634b, 0x634e, 0x6352, 0x6353, 0x6354, + 0x6358, 0x635b, 0x6365, 0x6366, 0x636c, 0x636d, 0x6371, 0x6374, + 0x6375, 0x6378, 0x637c, 0x637d, 0x637f, 0x6382, 0x6384, 0x6387, + 0x638a, 0x6390, 0x6394, 0x6395, 0x6399, 0x639a, 0x639e, 0x63a4, + 0x63a6, 0x63ad, 0x63ae, 0x63af, 0x63bd, 0x63c1, 0x63c5, 0x63c8, + 0x63ce, 0x63d1, 0x63d3, 0x63d4, 0x63d5, 0x63dc, 0x63e0, 0x63e5, + 0x63ea, 0x63ec, 0x63f2, 0x63f3, 0x63f5, 0x63f8, 0x63f9, 0x6409, + 0x640a, 0x6410, 0x6412, 0x6414, 0x6418, 0x641e, 0x6420, 0x6422, + 0x6424, 0x6425, 0x6429, 0x642a, 0x642f, 0x6430, 0x6435, 0x643d, + 0x643f, 0x644b, 0x644f, 0x6451, 0x6452, 0x6453, 0x6454, 0x645a, + 0x645b, 0x645c, 0x645d, 0x645f, 0x6460, 0x6461, 0x6463, 0x646d, + 0x6473, 0x6474, 0x647b, 0x647d, 0x6485, 0x6487, 0x648f, 0x6490, + 0x6491, 0x6498, 0x6499, 0x649b, 0x649d, 0x649f, 0x64a1, 0x64a3, + 0x64a6, 0x64a8, 0x64ac, 0x64b3, 0x64bd, 0x64be, 0x64bf, 0x64c4, + 0x64c9, 0x64ca, 0x64cb, 0x64cc, 0x64ce, 0x64d0, 0x64d1, 0x64d5, + 0x64d7, 0x64e4, 0x64e5, 0x64e9, 0x64ea, 0x64ed, 0x64f0, 0x64f5, + 0x64f7, 0x64fb, 0x64ff, 0x6501, 0x6504, 0x6508, 0x6509, 0x650a, + 0x650f, 0x6513, 0x6514, 0x6516, 0x6519, 0x651b, 0x651e, 0x651f, + 0x6522, 0x6526, 0x6529, 0x652e, 0x6531, 0x653a, 0x653c, 0x653d, + 0x6543, 0x6547, 0x6549, 0x6550, 0x6552, 0x6554, 0x655f, 0x6560, + 0x6567, 0x656b, 0x657a, 0x657d, 0x6581, 0x6585, 0x658a, 0x6592, + 0x6595, 0x6598, 0x659d, 0x65a0, 0x65a3, 0x65a6, 0x65ae, 0x65b2, + 0x65b3, 0x65b4, 0x65bf, 0x65c2, 0x65c8, 0x65c9, 0x65ce, 0x65d0, + 0x65d4, 0x65d6, 0x65d8, 0x65df, 0x65f0, 0x65f2, 0x65f4, 0x65f5, + 0x65f9, 0x65fe, 0x65ff, 0x6600, 0x6604, 0x6608, 0x6609, 0x660d, + 0x6611, 0x6612, 0x6615, 0x6616, 0x661d, 0x661e, 0x6621, 0x6622, + 0x6623, 0x6624, 0x6626, 0x6629, 0x662a, 0x662b, 0x662c, 0x662e, + 0x6630, 0x6631, 0x6633, 0x6639, 0x6637, 0x6640, 0x6645, 0x6646, + 0x664a, 0x664c, 0x6651, 0x664e, 0x6657, 0x6658, 0x6659, 0x665b, + 0x665c, 0x6660, 0x6661, 0x66fb, 0x666a, 0x666b, 0x666c, 0x667e, + 0x6673, 0x6675, 0x667f, 0x6677, 0x6678, 0x6679, 0x667b, 0x6680, + 0x667c, 0x668b, 0x668c, 0x668d, 0x6690, 0x6692, 0x6699, 0x669a, + 0x669b, 0x669c, 0x669f, 0x66a0, 0x66a4, 0x66ad, 0x66b1, 0x66b2, + 0x66b5, 0x66bb, 0x66bf, 0x66c0, 0x66c2, 0x66c3, 0x66c8, 0x66cc, + 0x66ce, 0x66cf, 0x66d4, 0x66db, 0x66df, 0x66e8, 0x66eb, 0x66ec, + 0x66ee, 0x66fa, 0x6705, 0x6707, 0x670e, 0x6713, 0x6719, 0x671c, + 0x6720, 0x6722, 0x6733, 0x673e, 0x6745, 0x6747, 0x6748, 0x674c, + 0x6754, 0x6755, 0x675d, 0x6766, 0x676c, 0x676e, 0x6774, 0x6776, + 0x677b, 0x6781, 0x6784, 0x678e, 0x678f, 0x6791, 0x6793, 0x6796, + 0x6798, 0x6799, 0x679b, 0x67b0, 0x67b1, 0x67b2, 0x67b5, 0x67bb, + 0x67bc, 0x67bd, 0x67f9, 0x67c0, 0x67c2, 0x67c3, 0x67c5, 0x67c8, + 0x67c9, 0x67d2, 0x67d7, 0x67d9, 0x67dc, 0x67e1, 0x67e6, 0x67f0, + 0x67f2, 0x67f6, 0x67f7, 0x6852, 0x6814, 0x6819, 0x681d, 0x681f, + 0x6828, 0x6827, 0x682c, 0x682d, 0x682f, 0x6830, 0x6831, 0x6833, + 0x683b, 0x683f, 0x6844, 0x6845, 0x684a, 0x684c, 0x6855, 0x6857, + 0x6858, 0x685b, 0x686b, 0x686e, 0x686f, 0x6870, 0x6871, 0x6872, + 0x6875, 0x6879, 0x687a, 0x687b, 0x687c, 0x6882, 0x6884, 0x6886, + 0x6888, 0x6896, 0x6898, 0x689a, 0x689c, 0x68a1, 0x68a3, 0x68a5, + 0x68a9, 0x68aa, 0x68ae, 0x68b2, 0x68bb, 0x68c5, 0x68c8, 0x68cc, + 0x68cf, 0x68d0, 0x68d1, 0x68d3, 0x68d6, 0x68d9, 0x68dc, 0x68dd, + 0x68e5, 0x68e8, 0x68ea, 0x68eb, 0x68ec, 0x68ed, 0x68f0, 0x68f1, + 0x68f5, 0x68f6, 0x68fb, 0x68fc, 0x68fd, 0x6906, 0x6909, 0x690a, + 0x6910, 0x6911, 0x6913, 0x6916, 0x6917, 0x6931, 0x6933, 0x6935, + 0x6938, 0x693b, 0x6942, 0x6945, 0x6949, 0x694e, 0x6957, 0x695b, + 0x6963, 0x6964, 0x6965, 0x6966, 0x6968, 0x6969, 0x696c, 0x6970, + 0x6971, 0x6972, 0x697a, 0x697b, 0x697f, 0x6980, 0x698d, 0x6992, + 0x6996, 0x6998, 0x69a1, 0x69a5, 0x69a6, 0x69a8, 0x69ab, 0x69ad, + 0x69af, 0x69b7, 0x69b8, 0x69ba, 0x69bc, 0x69c5, 0x69c8, 0x69d1, + 0x69d6, 0x69d7, 0x69e2, 0x69e5, 0x69ee, 0x69ef, 0x69f1, 0x69f3, + 0x69f5, 0x69fe, 0x6a00, 0x6a01, 0x6a03, 0x6a0f, 0x6a11, 0x6a15, + 0x6a1a, 0x6a1d, 0x6a20, 0x6a24, 0x6a28, 0x6a30, 0x6a32, 0x6a34, + 0x6a37, 0x6a3b, 0x6a3e, 0x6a3f, 0x6a45, 0x6a46, 0x6a49, 0x6a4a, + 0x6a4e, 0x6a50, 0x6a51, 0x6a52, 0x6a55, 0x6a56, 0x6a5b, 0x6a64, + 0x6a67, 0x6a6a, 0x6a71, 0x6a73, 0x6a7e, 0x6a81, 0x6a83, 0x6a86, + 0x6a87, 0x6a89, 0x6a8b, 0x6a91, 0x6a9b, 0x6a9d, 0x6a9e, 0x6a9f, + 0x6aa5, 0x6aab, 0x6aaf, 0x6ab0, 0x6ab1, 0x6ab4, 0x6abd, 0x6abe, + 0x6abf, 0x6ac6, 0x6ac9, 0x6ac8, 0x6acc, 0x6ad0, 0x6ad4, 0x6ad5, + 0x6ad6, 0x6adc, 0x6add, 0x6ae4, 0x6ae7, 0x6aec, 0x6af0, 0x6af1, + 0x6af2, 0x6afc, 0x6afd, 0x6b02, 0x6b03, 0x6b06, 0x6b07, 0x6b09, + 0x6b0f, 0x6b10, 0x6b11, 0x6b17, 0x6b1b, 0x6b1e, 0x6b24, 0x6b28, + 0x6b2b, 0x6b2c, 0x6b2f, 0x6b35, 0x6b36, 0x6b3b, 0x6b3f, 0x6b46, + 0x6b4a, 0x6b4d, 0x6b52, 0x6b56, 0x6b58, 0x6b5d, 0x6b60, 0x6b67, + 0x6b6b, 0x6b6e, 0x6b70, 0x6b75, 0x6b7d, 0x6b7e, 0x6b82, 0x6b85, + 0x6b97, 0x6b9b, 0x6b9f, 0x6ba0, 0x6ba2, 0x6ba3, 0x6ba8, 0x6ba9, + 0x6bac, 0x6bad, 0x6bae, 0x6bb0, 0x6bb8, 0x6bb9, 0x6bbd, 0x6bbe, + 0x6bc3, 0x6bc4, 0x6bc9, 0x6bcc, 0x6bd6, 0x6bda, 0x6be1, 0x6be3, + 0x6be6, 0x6be7, 0x6bee, 0x6bf1, 0x6bf7, 0x6bf9, 0x6bff, 0x6c02, + 0x6c04, 0x6c05, 0x6c09, 0x6c0d, 0x6c0e, 0x6c10, 0x6c12, 0x6c19, + 0x6c1f, 0x6c26, 0x6c27, 0x6c28, 0x6c2c, 0x6c2e, 0x6c33, 0x6c35, + 0x6c36, 0x6c3a, 0x6c3b, 0x6c3f, 0x6c4a, 0x6c4b, 0x6c4d, 0x6c4f, + 0x6c52, 0x6c54, 0x6c59, 0x6c5b, 0x6c5c, 0x6c6b, 0x6c6d, 0x6c6f, + 0x6c74, 0x6c76, 0x6c78, 0x6c79, 0x6c7b, 0x6c85, 0x6c86, 0x6c87, + 0x6c89, 0x6c94, 0x6c95, 0x6c97, 0x6c98, 0x6c9c, 0x6c9f, 0x6cb0, + 0x6cb2, 0x6cb4, 0x6cc2, 0x6cc6, 0x6ccd, 0x6ccf, 0x6cd0, 0x6cd1, + 0x6cd2, 0x6cd4, 0x6cd6, 0x6cda, 0x6cdc, 0x6ce0, 0x6ce7, 0x6ce9, + 0x6ceb, 0x6cec, 0x6cee, 0x6cf2, 0x6cf4, 0x6d04, 0x6d07, 0x6d0a, + 0x6d0e, 0x6d0f, 0x6d11, 0x6d13, 0x6d1a, 0x6d26, 0x6d27, 0x6d28, + 0x6c67, 0x6d2e, 0x6d2f, 0x6d31, 0x6d39, 0x6d3c, 0x6d3f, 0x6d57, + 0x6d5e, 0x6d5f, 0x6d61, 0x6d65, 0x6d67, 0x6d6f, 0x6d70, 0x6d7c, + 0x6d82, 0x6d87, 0x6d91, 0x6d92, 0x6d94, 0x6d96, 0x6d97, 0x6d98, + 0x6daa, 0x6dac, 0x6db4, 0x6db7, 0x6db9, 0x6dbd, 0x6dbf, 0x6dc4, + 0x6dc8, 0x6dca, 0x6dce, 0x6dcf, 0x6dd6, 0x6ddb, 0x6ddd, 0x6ddf, + 0x6de0, 0x6de2, 0x6de5, 0x6de9, 0x6def, 0x6df0, 0x6df4, 0x6df6, + 0x6dfc, 0x6e00, 0x6e04, 0x6e1e, 0x6e22, 0x6e27, 0x6e32, 0x6e36, + 0x6e39, 0x6e3b, 0x6e3c, 0x6e44, 0x6e45, 0x6e48, 0x6e49, 0x6e4b, + 0x6e4f, 0x6e51, 0x6e52, 0x6e53, 0x6e54, 0x6e57, 0x6e5c, 0x6e5d, + 0x6e5e, 0x6e62, 0x6e63, 0x6e68, 0x6e73, 0x6e7b, 0x6e7d, 0x6e8d, + 0x6e93, 0x6e99, 0x6ea0, 0x6ea7, 0x6ead, 0x6eae, 0x6eb1, 0x6eb3, + 0x6ebb, 0x6ebf, 0x6ec0, 0x6ec1, 0x6ec3, 0x6ec7, 0x6ec8, 0x6eca, + 0x6ecd, 0x6ece, 0x6ecf, 0x6eeb, 0x6eed, 0x6eee, 0x6ef9, 0x6efb, + 0x6efd, 0x6f04, 0x6f08, 0x6f0a, 0x6f0c, 0x6f0d, 0x6f16, 0x6f18, + 0x6f1a, 0x6f1b, 0x6f26, 0x6f29, 0x6f2a, 0x6f2f, 0x6f30, 0x6f33, + 0x6f36, 0x6f3b, 0x6f3c, 0x6f2d, 0x6f4f, 0x6f51, 0x6f52, 0x6f53, + 0x6f57, 0x6f59, 0x6f5a, 0x6f5d, 0x6f5e, 0x6f61, 0x6f62, 0x6f68, + 0x6f6c, 0x6f7d, 0x6f7e, 0x6f83, 0x6f87, 0x6f88, 0x6f8b, 0x6f8c, + 0x6f8d, 0x6f90, 0x6f92, 0x6f93, 0x6f94, 0x6f96, 0x6f9a, 0x6f9f, + 0x6fa0, 0x6fa5, 0x6fa6, 0x6fa7, 0x6fa8, 0x6fae, 0x6faf, 0x6fb0, + 0x6fb5, 0x6fb6, 0x6fbc, 0x6fc5, 0x6fc7, 0x6fc8, 0x6fca, 0x6fda, + 0x6fde, 0x6fe8, 0x6fe9, 0x6ff0, 0x6ff5, 0x6ff9, 0x6ffc, 0x6ffd, + 0x7000, 0x7005, 0x7006, 0x7007, 0x700d, 0x7017, 0x7020, 0x7023, + 0x702f, 0x7034, 0x7037, 0x7039, 0x703c, 0x7043, 0x7044, 0x7048, + 0x7049, 0x704a, 0x704b, 0x7054, 0x7055, 0x705d, 0x705e, 0x704e, + 0x7064, 0x7065, 0x706c, 0x706e, 0x7075, 0x7076, 0x707e, 0x7081, + 0x7085, 0x7086, 0x7094, 0x7095, 0x7096, 0x7097, 0x7098, 0x709b, + 0x70a4, 0x70ab, 0x70b0, 0x70b1, 0x70b4, 0x70b7, 0x70ca, 0x70d1, + 0x70d3, 0x70d4, 0x70d5, 0x70d6, 0x70d8, 0x70dc, 0x70e4, 0x70fa, + 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x710b, 0x710c, 0x710f, + 0x711e, 0x7120, 0x712b, 0x712d, 0x712f, 0x7130, 0x7131, 0x7138, + 0x7141, 0x7145, 0x7146, 0x7147, 0x714a, 0x714b, 0x7150, 0x7152, + 0x7157, 0x715a, 0x715c, 0x715e, 0x7160, 0x7168, 0x7179, 0x7180, + 0x7185, 0x7187, 0x718c, 0x7192, 0x719a, 0x719b, 0x71a0, 0x71a2, + 0x71af, 0x71b0, 0x71b2, 0x71b3, 0x71ba, 0x71bf, 0x71c0, 0x71c1, + 0x71c4, 0x71cb, 0x71cc, 0x71d3, 0x71d6, 0x71d9, 0x71da, 0x71dc, + 0x71f8, 0x71fe, 0x7200, 0x7207, 0x7208, 0x7209, 0x7213, 0x7217, + 0x721a, 0x721d, 0x721f, 0x7224, 0x722b, 0x722f, 0x7234, 0x7238, + 0x7239, 0x7241, 0x7242, 0x7243, 0x7245, 0x724e, 0x724f, 0x7250, + 0x7253, 0x7255, 0x7256, 0x725a, 0x725c, 0x725e, 0x7260, 0x7263, + 0x7268, 0x726b, 0x726e, 0x726f, 0x7271, 0x7277, 0x7278, 0x727b, + 0x727c, 0x727f, 0x7284, 0x7289, 0x728d, 0x728e, 0x7293, 0x729b, + 0x72a8, 0x72ad, 0x72ae, 0x72b1, 0x72b4, 0x72be, 0x72c1, 0x72c7, + 0x72c9, 0x72cc, 0x72d5, 0x72d6, 0x72d8, 0x72df, 0x72e5, 0x72f3, + 0x72f4, 0x72fa, 0x72fb, 0x72fe, 0x7302, 0x7304, 0x7305, 0x7307, + 0x730b, 0x730d, 0x7312, 0x7313, 0x7318, 0x7319, 0x731e, 0x7322, + 0x7324, 0x7327, 0x7328, 0x732c, 0x7331, 0x7332, 0x7335, 0x733a, + 0x733b, 0x733d, 0x7343, 0x734d, 0x7350, 0x7352, 0x7356, 0x7358, + 0x735d, 0x735e, 0x735f, 0x7360, 0x7366, 0x7367, 0x7369, 0x736b, + 0x736c, 0x736e, 0x736f, 0x7371, 0x7377, 0x7379, 0x737c, 0x7380, + 0x7381, 0x7383, 0x7385, 0x7386, 0x738e, 0x7390, 0x7393, 0x7395, + 0x7397, 0x7398, 0x739c, 0x739e, 0x739f, 0x73a0, 0x73a2, 0x73a5, + 0x73a6, 0x73aa, 0x73ab, 0x73ad, 0x73b5, 0x73b7, 0x73b9, 0x73bc, + 0x73bd, 0x73bf, 0x73c5, 0x73c6, 0x73c9, 0x73cb, 0x73cc, 0x73cf, + 0x73d2, 0x73d3, 0x73d6, 0x73d9, 0x73dd, 0x73e1, 0x73e3, 0x73e6, + 0x73e7, 0x73e9, 0x73f4, 0x73f5, 0x73f7, 0x73f9, 0x73fa, 0x73fb, + 0x73fd, 0x73ff, 0x7400, 0x7401, 0x7404, 0x7407, 0x740a, 0x7411, + 0x741a, 0x741b, 0x7424, 0x7426, 0x7428, 0x7429, 0x742a, 0x742b, + 0x742c, 0x742d, 0x742e, 0x742f, 0x7430, 0x7431, 0x7439, 0x7440, + 0x7443, 0x7444, 0x7446, 0x7447, 0x744b, 0x744d, 0x7451, 0x7452, + 0x7457, 0x745d, 0x7462, 0x7466, 0x7467, 0x7468, 0x746b, 0x746d, + 0x746e, 0x7471, 0x7472, 0x7480, 0x7481, 0x7485, 0x7486, 0x7487, + 0x7489, 0x748f, 0x7490, 0x7491, 0x7492, 0x7498, 0x7499, 0x749a, + 0x749c, 0x749f, 0x74a0, 0x74a1, 0x74a3, 0x74a6, 0x74a8, 0x74a9, + 0x74aa, 0x74ab, 0x74ae, 0x74af, 0x74b1, 0x74b2, 0x74b5, 0x74b9, + 0x74bb, 0x74bf, 0x74c8, 0x74c9, 0x74cc, 0x74d0, 0x74d3, 0x74d8, + 0x74da, 0x74db, 0x74de, 0x74df, 0x74e4, 0x74e8, 0x74ea, 0x74eb, + 0x74ef, 0x74f4, 0x74fa, 0x74fb, 0x74fc, 0x74ff, 0x7506, 0x7512, + 0x7516, 0x7517, 0x7520, 0x7521, 0x7524, 0x7527, 0x7529, 0x752a, + 0x752f, 0x7536, 0x7539, 0x753d, 0x753e, 0x753f, 0x7540, 0x7543, + 0x7547, 0x7548, 0x754e, 0x7550, 0x7552, 0x7557, 0x755e, 0x755f, + 0x7561, 0x756f, 0x7571, 0x7579, 0x757a, 0x757b, 0x757c, 0x757d, + 0x757e, 0x7581, 0x7585, 0x7590, 0x7592, 0x7593, 0x7595, 0x7599, + 0x759c, 0x75a2, 0x75a4, 0x75b4, 0x75ba, 0x75bf, 0x75c0, 0x75c1, + 0x75c4, 0x75c6, 0x75cc, 0x75ce, 0x75cf, 0x75d7, 0x75dc, 0x75df, + 0x75e0, 0x75e1, 0x75e4, 0x75e7, 0x75ec, 0x75ee, 0x75ef, 0x75f1, + 0x75f9, 0x7600, 0x7602, 0x7603, 0x7604, 0x7607, 0x7608, 0x760a, + 0x760c, 0x760f, 0x7612, 0x7613, 0x7615, 0x7616, 0x7619, 0x761b, + 0x761c, 0x761d, 0x761e, 0x7623, 0x7625, 0x7626, 0x7629, 0x762d, + 0x7632, 0x7633, 0x7635, 0x7638, 0x7639, 0x763a, 0x763c, 0x764a, + 0x7640, 0x7641, 0x7643, 0x7644, 0x7645, 0x7649, 0x764b, 0x7655, + 0x7659, 0x765f, 0x7664, 0x7665, 0x766d, 0x766e, 0x766f, 0x7671, + 0x7674, 0x7681, 0x7685, 0x768c, 0x768d, 0x7695, 0x769b, 0x769c, + 0x769d, 0x769f, 0x76a0, 0x76a2, 0x76a3, 0x76a4, 0x76a5, 0x76a6, + 0x76a7, 0x76a8, 0x76aa, 0x76ad, 0x76bd, 0x76c1, 0x76c5, 0x76c9, + 0x76cb, 0x76cc, 0x76ce, 0x76d4, 0x76d9, 0x76e0, 0x76e6, 0x76e8, + 0x76ec, 0x76f0, 0x76f1, 0x76f6, 0x76f9, 0x76fc, 0x7700, 0x7706, + 0x770a, 0x770e, 0x7712, 0x7714, 0x7715, 0x7717, 0x7719, 0x771a, + 0x771c, 0x7722, 0x7728, 0x772d, 0x772e, 0x772f, 0x7734, 0x7735, + 0x7736, 0x7739, 0x773d, 0x773e, 0x7742, 0x7745, 0x7746, 0x774a, + 0x774d, 0x774e, 0x774f, 0x7752, 0x7756, 0x7757, 0x775c, 0x775e, + 0x775f, 0x7760, 0x7762, 0x7764, 0x7767, 0x776a, 0x776c, 0x7770, + 0x7772, 0x7773, 0x7774, 0x777a, 0x777d, 0x7780, 0x7784, 0x778c, + 0x778d, 0x7794, 0x7795, 0x7796, 0x779a, 0x779f, 0x77a2, 0x77a7, + 0x77aa, 0x77ae, 0x77af, 0x77b1, 0x77b5, 0x77be, 0x77c3, 0x77c9, + 0x77d1, 0x77d2, 0x77d5, 0x77d9, 0x77de, 0x77df, 0x77e0, 0x77e4, + 0x77e6, 0x77ea, 0x77ec, 0x77f0, 0x77f1, 0x77f4, 0x77f8, 0x77fb, + 0x7805, 0x7806, 0x7809, 0x780d, 0x780e, 0x7811, 0x781d, 0x7821, + 0x7822, 0x7823, 0x782d, 0x782e, 0x7830, 0x7835, 0x7837, 0x7843, + 0x7844, 0x7847, 0x7848, 0x784c, 0x784e, 0x7852, 0x785c, 0x785e, + 0x7860, 0x7861, 0x7863, 0x7864, 0x7868, 0x786a, 0x786e, 0x787a, + 0x787e, 0x788a, 0x788f, 0x7894, 0x7898, 0x78a1, 0x789d, 0x789e, + 0x789f, 0x78a4, 0x78a8, 0x78ac, 0x78ad, 0x78b0, 0x78b1, 0x78b2, + 0x78b3, 0x78bb, 0x78bd, 0x78bf, 0x78c7, 0x78c8, 0x78c9, 0x78cc, + 0x78ce, 0x78d2, 0x78d3, 0x78d5, 0x78d6, 0x78e4, 0x78db, 0x78df, + 0x78e0, 0x78e1, 0x78e6, 0x78ea, 0x78f2, 0x78f3, 0x7900, 0x78f6, + 0x78f7, 0x78fa, 0x78fb, 0x78ff, 0x7906, 0x790c, 0x7910, 0x791a, + 0x791c, 0x791e, 0x791f, 0x7920, 0x7925, 0x7927, 0x7929, 0x792d, + 0x7931, 0x7934, 0x7935, 0x793b, 0x793d, 0x793f, 0x7944, 0x7945, + 0x7946, 0x794a, 0x794b, 0x794f, 0x7951, 0x7954, 0x7958, 0x795b, + 0x795c, 0x7967, 0x7969, 0x796b, 0x7972, 0x7979, 0x797b, 0x797c, + 0x797e, 0x798b, 0x798c, 0x7991, 0x7993, 0x7994, 0x7995, 0x7996, + 0x7998, 0x799b, 0x799c, 0x79a1, 0x79a8, 0x79a9, 0x79ab, 0x79af, + 0x79b1, 0x79b4, 0x79b8, 0x79bb, 0x79c2, 0x79c4, 0x79c7, 0x79c8, + 0x79ca, 0x79cf, 0x79d4, 0x79d6, 0x79da, 0x79dd, 0x79de, 0x79e0, + 0x79e2, 0x79e5, 0x79ea, 0x79eb, 0x79ed, 0x79f1, 0x79f8, 0x79fc, + 0x7a02, 0x7a03, 0x7a07, 0x7a09, 0x7a0a, 0x7a0c, 0x7a11, 0x7a15, + 0x7a1b, 0x7a1e, 0x7a21, 0x7a27, 0x7a2b, 0x7a2d, 0x7a2f, 0x7a30, + 0x7a34, 0x7a35, 0x7a38, 0x7a39, 0x7a3a, 0x7a44, 0x7a45, 0x7a47, + 0x7a48, 0x7a4c, 0x7a55, 0x7a56, 0x7a59, 0x7a5c, 0x7a5d, 0x7a5f, + 0x7a60, 0x7a65, 0x7a67, 0x7a6a, 0x7a6d, 0x7a75, 0x7a78, 0x7a7e, + 0x7a80, 0x7a82, 0x7a85, 0x7a86, 0x7a8a, 0x7a8b, 0x7a90, 0x7a91, + 0x7a94, 0x7a9e, 0x7aa0, 0x7aa3, 0x7aac, 0x7ab3, 0x7ab5, 0x7ab9, + 0x7abb, 0x7abc, 0x7ac6, 0x7ac9, 0x7acc, 0x7ace, 0x7ad1, 0x7adb, + 0x7ae8, 0x7ae9, 0x7aeb, 0x7aec, 0x7af1, 0x7af4, 0x7afb, 0x7afd, + 0x7afe, 0x7b07, 0x7b14, 0x7b1f, 0x7b23, 0x7b27, 0x7b29, 0x7b2a, + 0x7b2b, 0x7b2d, 0x7b2e, 0x7b2f, 0x7b30, 0x7b31, 0x7b34, 0x7b3d, + 0x7b3f, 0x7b40, 0x7b41, 0x7b47, 0x7b4e, 0x7b55, 0x7b60, 0x7b64, + 0x7b66, 0x7b69, 0x7b6a, 0x7b6d, 0x7b6f, 0x7b72, 0x7b73, 0x7b77, + 0x7b84, 0x7b89, 0x7b8e, 0x7b90, 0x7b91, 0x7b96, 0x7b9b, 0x7b9e, + 0x7ba0, 0x7ba5, 0x7bac, 0x7baf, 0x7bb0, 0x7bb2, 0x7bb5, 0x7bb6, + 0x7bba, 0x7bbb, 0x7bbc, 0x7bbd, 0x7bc2, 0x7bc5, 0x7bc8, 0x7bca, + 0x7bd4, 0x7bd6, 0x7bd7, 0x7bd9, 0x7bda, 0x7bdb, 0x7be8, 0x7bea, + 0x7bf2, 0x7bf4, 0x7bf5, 0x7bf8, 0x7bf9, 0x7bfa, 0x7bfc, 0x7bfe, + 0x7c01, 0x7c02, 0x7c03, 0x7c04, 0x7c06, 0x7c09, 0x7c0b, 0x7c0c, + 0x7c0e, 0x7c0f, 0x7c19, 0x7c1b, 0x7c20, 0x7c25, 0x7c26, 0x7c28, + 0x7c2c, 0x7c31, 0x7c33, 0x7c34, 0x7c36, 0x7c39, 0x7c3a, 0x7c46, + 0x7c4a, 0x7c55, 0x7c51, 0x7c52, 0x7c53, 0x7c59, 0x7c5a, 0x7c5b, + 0x7c5c, 0x7c5d, 0x7c5e, 0x7c61, 0x7c63, 0x7c67, 0x7c69, 0x7c6d, + 0x7c6e, 0x7c70, 0x7c72, 0x7c79, 0x7c7c, 0x7c7d, 0x7c86, 0x7c87, + 0x7c8f, 0x7c94, 0x7c9e, 0x7ca0, 0x7ca6, 0x7cb0, 0x7cb6, 0x7cb7, + 0x7cba, 0x7cbb, 0x7cbc, 0x7cbf, 0x7cc4, 0x7cc7, 0x7cc8, 0x7cc9, + 0x7ccd, 0x7ccf, 0x7cd3, 0x7cd4, 0x7cd5, 0x7cd7, 0x7cd9, 0x7cda, + 0x7cdd, 0x7ce6, 0x7ce9, 0x7ceb, 0x7cf5, 0x7d03, 0x7d07, 0x7d08, + 0x7d09, 0x7d0f, 0x7d11, 0x7d12, 0x7d13, 0x7d16, 0x7d1d, 0x7d1e, + 0x7d23, 0x7d26, 0x7d2a, 0x7d2d, 0x7d31, 0x7d3c, 0x7d3d, 0x7d3e, + 0x7d40, 0x7d41, 0x7d47, 0x7d48, 0x7d4d, 0x7d51, 0x7d53, 0x7d57, + 0x7d59, 0x7d5a, 0x7d5c, 0x7d5d, 0x7d65, 0x7d67, 0x7d6a, 0x7d70, + 0x7d78, 0x7d7a, 0x7d7b, 0x7d7f, 0x7d81, 0x7d82, 0x7d83, 0x7d85, + 0x7d86, 0x7d88, 0x7d8b, 0x7d8c, 0x7d8d, 0x7d91, 0x7d96, 0x7d97, + 0x7d9d, 0x7d9e, 0x7da6, 0x7da7, 0x7daa, 0x7db3, 0x7db6, 0x7db7, + 0x7db9, 0x7dc2, 0x7dc3, 0x7dc4, 0x7dc5, 0x7dc6, 0x7dcc, 0x7dcd, + 0x7dce, 0x7dd7, 0x7dd9, 0x7e00, 0x7de2, 0x7de5, 0x7de6, 0x7dea, + 0x7deb, 0x7ded, 0x7df1, 0x7df5, 0x7df6, 0x7df9, 0x7dfa, 0x7e08, + 0x7e10, 0x7e11, 0x7e15, 0x7e17, 0x7e1c, 0x7e1d, 0x7e20, 0x7e27, + 0x7e28, 0x7e2c, 0x7e2d, 0x7e2f, 0x7e33, 0x7e36, 0x7e3f, 0x7e44, + 0x7e45, 0x7e47, 0x7e4e, 0x7e50, 0x7e52, 0x7e58, 0x7e5f, 0x7e61, + 0x7e62, 0x7e65, 0x7e6b, 0x7e6e, 0x7e6f, 0x7e73, 0x7e78, 0x7e7e, + 0x7e81, 0x7e86, 0x7e87, 0x7e8a, 0x7e8d, 0x7e91, 0x7e95, 0x7e98, + 0x7e9a, 0x7e9d, 0x7e9e, 0x7f3c, 0x7f3b, 0x7f3d, 0x7f3e, 0x7f3f, + 0x7f43, 0x7f44, 0x7f47, 0x7f4f, 0x7f52, 0x7f53, 0x7f5b, 0x7f5c, + 0x7f5d, 0x7f61, 0x7f63, 0x7f64, 0x7f65, 0x7f66, 0x7f6d, 0x7f71, + 0x7f7d, 0x7f7e, 0x7f7f, 0x7f80, 0x7f8b, 0x7f8d, 0x7f8f, 0x7f90, + 0x7f91, 0x7f96, 0x7f97, 0x7f9c, 0x7fa1, 0x7fa2, 0x7fa6, 0x7faa, + 0x7fad, 0x7fb4, 0x7fbc, 0x7fbf, 0x7fc0, 0x7fc3, 0x7fc8, 0x7fce, + 0x7fcf, 0x7fdb, 0x7fdf, 0x7fe3, 0x7fe5, 0x7fe8, 0x7fec, 0x7fee, + 0x7fef, 0x7ff2, 0x7ffa, 0x7ffd, 0x7ffe, 0x7fff, 0x8007, 0x8008, + 0x800a, 0x800d, 0x800e, 0x800f, 0x8011, 0x8013, 0x8014, 0x8016, + 0x801d, 0x801e, 0x801f, 0x8020, 0x8024, 0x8026, 0x802c, 0x802e, + 0x8030, 0x8034, 0x8035, 0x8037, 0x8039, 0x803a, 0x803c, 0x803e, + 0x8040, 0x8044, 0x8060, 0x8064, 0x8066, 0x806d, 0x8071, 0x8075, + 0x8081, 0x8088, 0x808e, 0x809c, 0x809e, 0x80a6, 0x80a7, 0x80ab, + 0x80b8, 0x80b9, 0x80c8, 0x80cd, 0x80cf, 0x80d2, 0x80d4, 0x80d5, + 0x80d7, 0x80d8, 0x80e0, 0x80ed, 0x80ee, 0x80f0, 0x80f2, 0x80f3, + 0x80f6, 0x80f9, 0x80fa, 0x80fe, 0x8103, 0x810b, 0x8116, 0x8117, + 0x8118, 0x811c, 0x811e, 0x8120, 0x8124, 0x8127, 0x812c, 0x8130, + 0x8135, 0x813a, 0x813c, 0x8145, 0x8147, 0x814a, 0x814c, 0x8152, + 0x8157, 0x8160, 0x8161, 0x8167, 0x8168, 0x8169, 0x816d, 0x816f, + 0x8177, 0x8181, 0x8190, 0x8184, 0x8185, 0x8186, 0x818b, 0x818e, + 0x8196, 0x8198, 0x819b, 0x819e, 0x81a2, 0x81ae, 0x81b2, 0x81b4, + 0x81bb, 0x81cb, 0x81c3, 0x81c5, 0x81ca, 0x81ce, 0x81cf, 0x81d5, + 0x81d7, 0x81db, 0x81dd, 0x81de, 0x81e1, 0x81e4, 0x81eb, 0x81ec, + 0x81f0, 0x81f1, 0x81f2, 0x81f5, 0x81f6, 0x81f8, 0x81f9, 0x81fd, + 0x81ff, 0x8200, 0x8203, 0x820f, 0x8213, 0x8214, 0x8219, 0x821a, + 0x821d, 0x8221, 0x8222, 0x8228, 0x8232, 0x8234, 0x823a, 0x8243, + 0x8244, 0x8245, 0x8246, 0x824b, 0x824e, 0x824f, 0x8251, 0x8256, + 0x825c, 0x8260, 0x8263, 0x8267, 0x826d, 0x8274, 0x827b, 0x827d, + 0x827f, 0x8280, 0x8281, 0x8283, 0x8284, 0x8287, 0x8289, 0x828a, + 0x828e, 0x8291, 0x8294, 0x8296, 0x8298, 0x829a, 0x829b, 0x82a0, + 0x82a1, 0x82a3, 0x82a4, 0x82a7, 0x82a8, 0x82a9, 0x82aa, 0x82ae, + 0x82b0, 0x82b2, 0x82b4, 0x82b7, 0x82ba, 0x82bc, 0x82be, 0x82bf, + 0x82c6, 0x82d0, 0x82d5, 0x82da, 0x82e0, 0x82e2, 0x82e4, 0x82e8, + 0x82ea, 0x82ed, 0x82ef, 0x82f6, 0x82f7, 0x82fd, 0x82fe, 0x8300, + 0x8301, 0x8307, 0x8308, 0x830a, 0x830b, 0x8354, 0x831b, 0x831d, + 0x831e, 0x831f, 0x8321, 0x8322, 0x832c, 0x832d, 0x832e, 0x8330, + 0x8333, 0x8337, 0x833a, 0x833c, 0x833d, 0x8342, 0x8343, 0x8344, + 0x8347, 0x834d, 0x834e, 0x8351, 0x8355, 0x8356, 0x8357, 0x8370, + 0x8378, 0x837d, 0x837f, 0x8380, 0x8382, 0x8384, 0x8386, 0x838d, + 0x8392, 0x8394, 0x8395, 0x8398, 0x8399, 0x839b, 0x839c, 0x839d, + 0x83a6, 0x83a7, 0x83a9, 0x83ac, 0x83be, 0x83bf, 0x83c0, 0x83c7, + 0x83c9, 0x83cf, 0x83d0, 0x83d1, 0x83d4, 0x83dd, 0x8353, 0x83e8, + 0x83ea, 0x83f6, 0x83f8, 0x83f9, 0x83fc, 0x8401, 0x8406, 0x840a, + 0x840f, 0x8411, 0x8415, 0x8419, 0x83ad, 0x842f, 0x8439, 0x8445, + 0x8447, 0x8448, 0x844a, 0x844d, 0x844f, 0x8451, 0x8452, 0x8456, + 0x8458, 0x8459, 0x845a, 0x845c, 0x8460, 0x8464, 0x8465, 0x8467, + 0x846a, 0x8470, 0x8473, 0x8474, 0x8476, 0x8478, 0x847c, 0x847d, + 0x8481, 0x8485, 0x8492, 0x8493, 0x8495, 0x849e, 0x84a6, 0x84a8, + 0x84a9, 0x84aa, 0x84af, 0x84b1, 0x84b4, 0x84ba, 0x84bd, 0x84be, + 0x84c0, 0x84c2, 0x84c7, 0x84c8, 0x84cc, 0x84cf, 0x84d3, 0x84dc, + 0x84e7, 0x84ea, 0x84ef, 0x84f0, 0x84f1, 0x84f2, 0x84f7, 0x8532, + 0x84fa, 0x84fb, 0x84fd, 0x8502, 0x8503, 0x8507, 0x850c, 0x850e, + 0x8510, 0x851c, 0x851e, 0x8522, 0x8523, 0x8524, 0x8525, 0x8527, + 0x852a, 0x852b, 0x852f, 0x8533, 0x8534, 0x8536, 0x853f, 0x8546, + 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8556, 0x8559, 0x855c, + 0x855d, 0x855e, 0x855f, 0x8560, 0x8561, 0x8562, 0x8564, 0x856b, + 0x856f, 0x8579, 0x857a, 0x857b, 0x857d, 0x857f, 0x8581, 0x8585, + 0x8586, 0x8589, 0x858b, 0x858c, 0x858f, 0x8593, 0x8598, 0x859d, + 0x859f, 0x85a0, 0x85a2, 0x85a5, 0x85a7, 0x85b4, 0x85b6, 0x85b7, + 0x85b8, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c2, 0x85c7, 0x85ca, + 0x85cb, 0x85ce, 0x85ad, 0x85d8, 0x85da, 0x85df, 0x85e0, 0x85e6, + 0x85e8, 0x85ed, 0x85f3, 0x85f6, 0x85fc, 0x85ff, 0x8600, 0x8604, + 0x8605, 0x860d, 0x860e, 0x8610, 0x8611, 0x8612, 0x8618, 0x8619, + 0x861b, 0x861e, 0x8621, 0x8627, 0x8629, 0x8636, 0x8638, 0x863a, + 0x863c, 0x863d, 0x8640, 0x8642, 0x8646, 0x8652, 0x8653, 0x8656, + 0x8657, 0x8658, 0x8659, 0x865d, 0x8660, 0x8661, 0x8662, 0x8663, + 0x8664, 0x8669, 0x866c, 0x866f, 0x8675, 0x8676, 0x8677, 0x867a, + 0x868d, 0x8691, 0x8696, 0x8698, 0x869a, 0x869c, 0x86a1, 0x86a6, + 0x86a7, 0x86a8, 0x86ad, 0x86b1, 0x86b3, 0x86b4, 0x86b5, 0x86b7, + 0x86b8, 0x86b9, 0x86bf, 0x86c0, 0x86c1, 0x86c3, 0x86c5, 0x86d1, + 0x86d2, 0x86d5, 0x86d7, 0x86da, 0x86dc, 0x86e0, 0x86e3, 0x86e5, + 0x86e7, 0x8688, 0x86fa, 0x86fc, 0x86fd, 0x8704, 0x8705, 0x8707, + 0x870b, 0x870e, 0x870f, 0x8710, 0x8713, 0x8714, 0x8719, 0x871e, + 0x871f, 0x8721, 0x8723, 0x8728, 0x872e, 0x872f, 0x8731, 0x8732, + 0x8739, 0x873a, 0x873c, 0x873d, 0x873e, 0x8740, 0x8743, 0x8745, + 0x874d, 0x8758, 0x875d, 0x8761, 0x8764, 0x8765, 0x876f, 0x8771, + 0x8772, 0x877b, 0x8783, 0x8784, 0x8785, 0x8786, 0x8787, 0x8788, + 0x8789, 0x878b, 0x878c, 0x8790, 0x8793, 0x8795, 0x8797, 0x8798, + 0x8799, 0x879e, 0x87a0, 0x87a3, 0x87a7, 0x87ac, 0x87ad, 0x87ae, + 0x87b1, 0x87b5, 0x87be, 0x87bf, 0x87c1, 0x87c8, 0x87c9, 0x87ca, + 0x87ce, 0x87d5, 0x87d6, 0x87d9, 0x87da, 0x87dc, 0x87df, 0x87e2, + 0x87e3, 0x87e4, 0x87ea, 0x87eb, 0x87ed, 0x87f1, 0x87f3, 0x87f8, + 0x87fa, 0x87ff, 0x8801, 0x8803, 0x8806, 0x8809, 0x880a, 0x880b, + 0x8810, 0x8819, 0x8812, 0x8813, 0x8814, 0x8818, 0x881a, 0x881b, + 0x881c, 0x881e, 0x881f, 0x8828, 0x882d, 0x882e, 0x8830, 0x8832, + 0x8835, 0x883a, 0x883c, 0x8841, 0x8843, 0x8845, 0x8848, 0x8849, + 0x884a, 0x884b, 0x884e, 0x8851, 0x8855, 0x8856, 0x8858, 0x885a, + 0x885c, 0x885f, 0x8860, 0x8864, 0x8869, 0x8871, 0x8879, 0x887b, + 0x8880, 0x8898, 0x889a, 0x889b, 0x889c, 0x889f, 0x88a0, 0x88a8, + 0x88aa, 0x88ba, 0x88bd, 0x88be, 0x88c0, 0x88ca, 0x88cb, 0x88cc, + 0x88cd, 0x88ce, 0x88d1, 0x88d2, 0x88d3, 0x88db, 0x88de, 0x88e7, + 0x88ef, 0x88f0, 0x88f1, 0x88f5, 0x88f7, 0x8901, 0x8906, 0x890d, + 0x890e, 0x890f, 0x8915, 0x8916, 0x8918, 0x8919, 0x891a, 0x891c, + 0x8920, 0x8926, 0x8927, 0x8928, 0x8930, 0x8931, 0x8932, 0x8935, + 0x8939, 0x893a, 0x893e, 0x8940, 0x8942, 0x8945, 0x8946, 0x8949, + 0x894f, 0x8952, 0x8957, 0x895a, 0x895b, 0x895c, 0x8961, 0x8962, + 0x8963, 0x896b, 0x896e, 0x8970, 0x8973, 0x8975, 0x897a, 0x897b, + 0x897c, 0x897d, 0x8989, 0x898d, 0x8990, 0x8994, 0x8995, 0x899b, + 0x899c, 0x899f, 0x89a0, 0x89a5, 0x89b0, 0x89b4, 0x89b5, 0x89b6, + 0x89b7, 0x89bc, 0x89d4, 0x89d5, 0x89d6, 0x89d7, 0x89d8, 0x89e5, + 0x89e9, 0x89eb, 0x89ed, 0x89f1, 0x89f3, 0x89f6, 0x89f9, 0x89fd, + 0x89ff, 0x8a04, 0x8a05, 0x8a07, 0x8a0f, 0x8a11, 0x8a12, 0x8a14, + 0x8a15, 0x8a1e, 0x8a20, 0x8a22, 0x8a24, 0x8a26, 0x8a2b, 0x8a2c, + 0x8a2f, 0x8a35, 0x8a37, 0x8a3d, 0x8a3e, 0x8a40, 0x8a43, 0x8a45, + 0x8a47, 0x8a49, 0x8a4d, 0x8a4e, 0x8a53, 0x8a56, 0x8a57, 0x8a58, + 0x8a5c, 0x8a5d, 0x8a61, 0x8a65, 0x8a67, 0x8a75, 0x8a76, 0x8a77, + 0x8a79, 0x8a7a, 0x8a7b, 0x8a7e, 0x8a7f, 0x8a80, 0x8a83, 0x8a86, + 0x8a8b, 0x8a8f, 0x8a90, 0x8a92, 0x8a96, 0x8a97, 0x8a99, 0x8a9f, + 0x8aa7, 0x8aa9, 0x8aae, 0x8aaf, 0x8ab3, 0x8ab6, 0x8ab7, 0x8abb, + 0x8abe, 0x8ac3, 0x8ac6, 0x8ac8, 0x8ac9, 0x8aca, 0x8ad1, 0x8ad3, + 0x8ad4, 0x8ad5, 0x8ad7, 0x8add, 0x8adf, 0x8aec, 0x8af0, 0x8af4, + 0x8af5, 0x8af6, 0x8afc, 0x8aff, 0x8b05, 0x8b06, 0x8b0b, 0x8b11, + 0x8b1c, 0x8b1e, 0x8b1f, 0x8b0a, 0x8b2d, 0x8b30, 0x8b37, 0x8b3c, + 0x8b42, 0x8b43, 0x8b44, 0x8b45, 0x8b46, 0x8b48, 0x8b52, 0x8b53, + 0x8b54, 0x8b59, 0x8b4d, 0x8b5e, 0x8b63, 0x8b6d, 0x8b76, 0x8b78, + 0x8b79, 0x8b7c, 0x8b7e, 0x8b81, 0x8b84, 0x8b85, 0x8b8b, 0x8b8d, + 0x8b8f, 0x8b94, 0x8b95, 0x8b9c, 0x8b9e, 0x8b9f, 0x8c38, 0x8c39, + 0x8c3d, 0x8c3e, 0x8c45, 0x8c47, 0x8c49, 0x8c4b, 0x8c4f, 0x8c51, + 0x8c53, 0x8c54, 0x8c57, 0x8c58, 0x8c5b, 0x8c5d, 0x8c59, 0x8c63, + 0x8c64, 0x8c66, 0x8c68, 0x8c69, 0x8c6d, 0x8c73, 0x8c75, 0x8c76, + 0x8c7b, 0x8c7e, 0x8c86, 0x8c87, 0x8c8b, 0x8c90, 0x8c92, 0x8c93, + 0x8c99, 0x8c9b, 0x8c9c, 0x8ca4, 0x8cb9, 0x8cba, 0x8cc5, 0x8cc6, + 0x8cc9, 0x8ccb, 0x8ccf, 0x8cd6, 0x8cd5, 0x8cd9, 0x8cdd, 0x8ce1, + 0x8ce8, 0x8cec, 0x8cef, 0x8cf0, 0x8cf2, 0x8cf5, 0x8cf7, 0x8cf8, + 0x8cfe, 0x8cff, 0x8d01, 0x8d03, 0x8d09, 0x8d12, 0x8d17, 0x8d1b, + 0x8d65, 0x8d69, 0x8d6c, 0x8d6e, 0x8d7f, 0x8d82, 0x8d84, 0x8d88, + 0x8d8d, 0x8d90, 0x8d91, 0x8d95, 0x8d9e, 0x8d9f, 0x8da0, 0x8da6, + 0x8dab, 0x8dac, 0x8daf, 0x8db2, 0x8db5, 0x8db7, 0x8db9, 0x8dbb, + 0x8dc0, 0x8dc5, 0x8dc6, 0x8dc7, 0x8dc8, 0x8dca, 0x8dce, 0x8dd1, + 0x8dd4, 0x8dd5, 0x8dd7, 0x8dd9, 0x8de4, 0x8de5, 0x8de7, 0x8dec, + 0x8df0, 0x8dbc, 0x8df1, 0x8df2, 0x8df4, 0x8dfd, 0x8e01, 0x8e04, + 0x8e05, 0x8e06, 0x8e0b, 0x8e11, 0x8e14, 0x8e16, 0x8e20, 0x8e21, + 0x8e22, 0x8e23, 0x8e26, 0x8e27, 0x8e31, 0x8e33, 0x8e36, 0x8e37, + 0x8e38, 0x8e39, 0x8e3d, 0x8e40, 0x8e41, 0x8e4b, 0x8e4d, 0x8e4e, + 0x8e4f, 0x8e54, 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e61, 0x8e62, + 0x8e69, 0x8e6c, 0x8e6d, 0x8e6f, 0x8e70, 0x8e71, 0x8e79, 0x8e7a, + 0x8e7b, 0x8e82, 0x8e83, 0x8e89, 0x8e90, 0x8e92, 0x8e95, 0x8e9a, + 0x8e9b, 0x8e9d, 0x8e9e, 0x8ea2, 0x8ea7, 0x8ea9, 0x8ead, 0x8eae, + 0x8eb3, 0x8eb5, 0x8eba, 0x8ebb, 0x8ec0, 0x8ec1, 0x8ec3, 0x8ec4, + 0x8ec7, 0x8ecf, 0x8ed1, 0x8ed4, 0x8edc, 0x8ee8, 0x8eee, 0x8ef0, + 0x8ef1, 0x8ef7, 0x8ef9, 0x8efa, 0x8eed, 0x8f00, 0x8f02, 0x8f07, + 0x8f08, 0x8f0f, 0x8f10, 0x8f16, 0x8f17, 0x8f18, 0x8f1e, 0x8f20, + 0x8f21, 0x8f23, 0x8f25, 0x8f27, 0x8f28, 0x8f2c, 0x8f2d, 0x8f2e, + 0x8f34, 0x8f35, 0x8f36, 0x8f37, 0x8f3a, 0x8f40, 0x8f41, 0x8f43, + 0x8f47, 0x8f4f, 0x8f51, 0x8f52, 0x8f53, 0x8f54, 0x8f55, 0x8f58, + 0x8f5d, 0x8f5e, 0x8f65, 0x8f9d, 0x8fa0, 0x8fa1, 0x8fa4, 0x8fa5, + 0x8fa6, 0x8fb5, 0x8fb6, 0x8fb8, 0x8fbe, 0x8fc0, 0x8fc1, 0x8fc6, + 0x8fca, 0x8fcb, 0x8fcd, 0x8fd0, 0x8fd2, 0x8fd3, 0x8fd5, 0x8fe0, + 0x8fe3, 0x8fe4, 0x8fe8, 0x8fee, 0x8ff1, 0x8ff5, 0x8ff6, 0x8ffb, + 0x8ffe, 0x9002, 0x9004, 0x9008, 0x900c, 0x9018, 0x901b, 0x9028, + 0x9029, 0x902f, 0x902a, 0x902c, 0x902d, 0x9033, 0x9034, 0x9037, + 0x903f, 0x9043, 0x9044, 0x904c, 0x905b, 0x905d, 0x9062, 0x9066, + 0x9067, 0x906c, 0x9070, 0x9074, 0x9079, 0x9085, 0x9088, 0x908b, + 0x908c, 0x908e, 0x9090, 0x9095, 0x9097, 0x9098, 0x9099, 0x909b, + 0x90a0, 0x90a1, 0x90a2, 0x90a5, 0x90b0, 0x90b2, 0x90b3, 0x90b4, + 0x90b6, 0x90bd, 0x90cc, 0x90be, 0x90c3, 0x90c4, 0x90c5, 0x90c7, + 0x90c8, 0x90d5, 0x90d7, 0x90d8, 0x90d9, 0x90dc, 0x90dd, 0x90df, + 0x90e5, 0x90d2, 0x90f6, 0x90eb, 0x90ef, 0x90f0, 0x90f4, 0x90fe, + 0x90ff, 0x9100, 0x9104, 0x9105, 0x9106, 0x9108, 0x910d, 0x9110, + 0x9114, 0x9116, 0x9117, 0x9118, 0x911a, 0x911c, 0x911e, 0x9120, + 0x9125, 0x9122, 0x9123, 0x9127, 0x9129, 0x912e, 0x912f, 0x9131, + 0x9134, 0x9136, 0x9137, 0x9139, 0x913a, 0x913c, 0x913d, 0x9143, + 0x9147, 0x9148, 0x914f, 0x9153, 0x9157, 0x9159, 0x915a, 0x915b, + 0x9161, 0x9164, 0x9167, 0x916d, 0x9174, 0x9179, 0x917a, 0x917b, + 0x9181, 0x9183, 0x9185, 0x9186, 0x918a, 0x918e, 0x9191, 0x9193, + 0x9194, 0x9195, 0x9198, 0x919e, 0x91a1, 0x91a6, 0x91a8, 0x91ac, + 0x91ad, 0x91ae, 0x91b0, 0x91b1, 0x91b2, 0x91b3, 0x91b6, 0x91bb, + 0x91bc, 0x91bd, 0x91bf, 0x91c2, 0x91c3, 0x91c5, 0x91d3, 0x91d4, + 0x91d7, 0x91d9, 0x91da, 0x91de, 0x91e4, 0x91e5, 0x91e9, 0x91ea, + 0x91ec, 0x91ed, 0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f7, 0x91f9, + 0x91fb, 0x91fd, 0x9200, 0x9201, 0x9204, 0x9205, 0x9206, 0x9207, + 0x9209, 0x920a, 0x920c, 0x9210, 0x9212, 0x9213, 0x9216, 0x9218, + 0x921c, 0x921d, 0x9223, 0x9224, 0x9225, 0x9226, 0x9228, 0x922e, + 0x922f, 0x9230, 0x9233, 0x9235, 0x9236, 0x9238, 0x9239, 0x923a, + 0x923c, 0x923e, 0x9240, 0x9242, 0x9243, 0x9246, 0x9247, 0x924a, + 0x924d, 0x924e, 0x924f, 0x9251, 0x9258, 0x9259, 0x925c, 0x925d, + 0x9260, 0x9261, 0x9265, 0x9267, 0x9268, 0x9269, 0x926e, 0x926f, + 0x9270, 0x9275, 0x9276, 0x9277, 0x9278, 0x9279, 0x927b, 0x927c, + 0x927d, 0x927f, 0x9288, 0x9289, 0x928a, 0x928d, 0x928e, 0x9292, + 0x9297, 0x9299, 0x929f, 0x92a0, 0x92a4, 0x92a5, 0x92a7, 0x92a8, + 0x92ab, 0x92af, 0x92b2, 0x92b6, 0x92b8, 0x92ba, 0x92bb, 0x92bc, + 0x92bd, 0x92bf, 0x92c0, 0x92c1, 0x92c2, 0x92c3, 0x92c5, 0x92c6, + 0x92c7, 0x92c8, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92d0, 0x92d3, + 0x92d5, 0x92d7, 0x92d8, 0x92d9, 0x92dc, 0x92dd, 0x92df, 0x92e0, + 0x92e1, 0x92e3, 0x92e5, 0x92e7, 0x92e8, 0x92ec, 0x92ee, 0x92f0, + 0x92f9, 0x92fb, 0x92ff, 0x9300, 0x9302, 0x9308, 0x930d, 0x9311, + 0x9314, 0x9315, 0x931c, 0x931d, 0x931e, 0x931f, 0x9321, 0x9324, + 0x9325, 0x9327, 0x9329, 0x932a, 0x9333, 0x9334, 0x9336, 0x9337, + 0x9347, 0x9348, 0x9349, 0x9350, 0x9351, 0x9352, 0x9355, 0x9357, + 0x9358, 0x935a, 0x935e, 0x9364, 0x9365, 0x9367, 0x9369, 0x936a, + 0x936d, 0x936f, 0x9370, 0x9371, 0x9373, 0x9374, 0x9376, 0x937a, + 0x937d, 0x937f, 0x9380, 0x9381, 0x9382, 0x9388, 0x938a, 0x938b, + 0x938d, 0x938f, 0x9392, 0x9395, 0x9398, 0x939b, 0x939e, 0x93a1, + 0x93a3, 0x93a4, 0x93a6, 0x93a8, 0x93ab, 0x93b4, 0x93b5, 0x93b6, + 0x93ba, 0x93a9, 0x93c1, 0x93c4, 0x93c5, 0x93c6, 0x93c7, 0x93c9, + 0x93ca, 0x93cb, 0x93cc, 0x93cd, 0x93d3, 0x93d9, 0x93dc, 0x93de, + 0x93df, 0x93e2, 0x93e6, 0x93e7, 0x93f9, 0x93f7, 0x93f8, 0x93fa, + 0x93fb, 0x93fd, 0x9401, 0x9402, 0x9404, 0x9408, 0x9409, 0x940d, + 0x940e, 0x940f, 0x9415, 0x9416, 0x9417, 0x941f, 0x942e, 0x942f, + 0x9431, 0x9432, 0x9433, 0x9434, 0x943b, 0x943f, 0x943d, 0x9443, + 0x9445, 0x9448, 0x944a, 0x944c, 0x9455, 0x9459, 0x945c, 0x945f, + 0x9461, 0x9463, 0x9468, 0x946b, 0x946d, 0x946e, 0x946f, 0x9471, + 0x9472, 0x9484, 0x9483, 0x9578, 0x9579, 0x957e, 0x9584, 0x9588, + 0x958c, 0x958d, 0x958e, 0x959d, 0x959e, 0x959f, 0x95a1, 0x95a6, + 0x95a9, 0x95ab, 0x95ac, 0x95b4, 0x95b6, 0x95ba, 0x95bd, 0x95bf, + 0x95c6, 0x95c8, 0x95c9, 0x95cb, 0x95d0, 0x95d1, 0x95d2, 0x95d3, + 0x95d9, 0x95da, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e4, 0x95e6, + 0x961d, 0x961e, 0x9622, 0x9624, 0x9625, 0x9626, 0x962c, 0x9631, + 0x9633, 0x9637, 0x9638, 0x9639, 0x963a, 0x963c, 0x963d, 0x9641, + 0x9652, 0x9654, 0x9656, 0x9657, 0x9658, 0x9661, 0x966e, 0x9674, + 0x967b, 0x967c, 0x967e, 0x967f, 0x9681, 0x9682, 0x9683, 0x9684, + 0x9689, 0x9691, 0x9696, 0x969a, 0x969d, 0x969f, 0x96a4, 0x96a5, + 0x96a6, 0x96a9, 0x96ae, 0x96af, 0x96b3, 0x96ba, 0x96ca, 0x96d2, + 0x5db2, 0x96d8, 0x96da, 0x96dd, 0x96de, 0x96df, 0x96e9, 0x96ef, + 0x96f1, 0x96fa, 0x9702, 0x9703, 0x9705, 0x9709, 0x971a, 0x971b, + 0x971d, 0x9721, 0x9722, 0x9723, 0x9728, 0x9731, 0x9733, 0x9741, + 0x9743, 0x974a, 0x974e, 0x974f, 0x9755, 0x9757, 0x9758, 0x975a, + 0x975b, 0x9763, 0x9767, 0x976a, 0x976e, 0x9773, 0x9776, 0x9777, + 0x9778, 0x977b, 0x977d, 0x977f, 0x9780, 0x9789, 0x9795, 0x9796, + 0x9797, 0x9799, 0x979a, 0x979e, 0x979f, 0x97a2, 0x97ac, 0x97ae, + 0x97b1, 0x97b2, 0x97b5, 0x97b6, 0x97b8, 0x97b9, 0x97ba, 0x97bc, + 0x97be, 0x97bf, 0x97c1, 0x97c4, 0x97c5, 0x97c7, 0x97c9, 0x97ca, + 0x97cc, 0x97cd, 0x97ce, 0x97d0, 0x97d1, 0x97d4, 0x97d7, 0x97d8, + 0x97d9, 0x97dd, 0x97de, 0x97e0, 0x97db, 0x97e1, 0x97e4, 0x97ef, + 0x97f1, 0x97f4, 0x97f7, 0x97f8, 0x97fa, 0x9807, 0x980a, 0x9819, + 0x980d, 0x980e, 0x9814, 0x9816, 0x981c, 0x981e, 0x9820, 0x9823, + 0x9826, 0x982b, 0x982e, 0x982f, 0x9830, 0x9832, 0x9833, 0x9835, + 0x9825, 0x983e, 0x9844, 0x9847, 0x984a, 0x9851, 0x9852, 0x9853, + 0x9856, 0x9857, 0x9859, 0x985a, 0x9862, 0x9863, 0x9865, 0x9866, + 0x986a, 0x986c, 0x98ab, 0x98ad, 0x98ae, 0x98b0, 0x98b4, 0x98b7, + 0x98b8, 0x98ba, 0x98bb, 0x98bf, 0x98c2, 0x98c5, 0x98c8, 0x98cc, + 0x98e1, 0x98e3, 0x98e5, 0x98e6, 0x98e7, 0x98ea, 0x98f3, 0x98f6, + 0x9902, 0x9907, 0x9908, 0x9911, 0x9915, 0x9916, 0x9917, 0x991a, + 0x991b, 0x991c, 0x991f, 0x9922, 0x9926, 0x9927, 0x992b, 0x9931, + 0x9932, 0x9933, 0x9934, 0x9935, 0x9939, 0x993a, 0x993b, 0x993c, + 0x9940, 0x9941, 0x9946, 0x9947, 0x9948, 0x994d, 0x994e, 0x9954, + 0x9958, 0x9959, 0x995b, 0x995c, 0x995e, 0x995f, 0x9960, 0x999b, + 0x999d, 0x999f, 0x99a6, 0x99b0, 0x99b1, 0x99b2, 0x99b5, 0x99b9, + 0x99ba, 0x99bd, 0x99bf, 0x99c3, 0x99c9, 0x99d3, 0x99d4, 0x99d9, + 0x99da, 0x99dc, 0x99de, 0x99e7, 0x99ea, 0x99eb, 0x99ec, 0x99f0, + 0x99f4, 0x99f5, 0x99f9, 0x99fd, 0x99fe, 0x9a02, 0x9a03, 0x9a04, + 0x9a0b, 0x9a0c, 0x9a10, 0x9a11, 0x9a16, 0x9a1e, 0x9a20, 0x9a22, + 0x9a23, 0x9a24, 0x9a27, 0x9a2d, 0x9a2e, 0x9a33, 0x9a35, 0x9a36, + 0x9a38, 0x9a47, 0x9a41, 0x9a44, 0x9a4a, 0x9a4b, 0x9a4c, 0x9a4e, + 0x9a51, 0x9a54, 0x9a56, 0x9a5d, 0x9aaa, 0x9aac, 0x9aae, 0x9aaf, + 0x9ab2, 0x9ab4, 0x9ab5, 0x9ab6, 0x9ab9, 0x9abb, 0x9abe, 0x9abf, + 0x9ac1, 0x9ac3, 0x9ac6, 0x9ac8, 0x9ace, 0x9ad0, 0x9ad2, 0x9ad5, + 0x9ad6, 0x9ad7, 0x9adb, 0x9adc, 0x9ae0, 0x9ae4, 0x9ae5, 0x9ae7, + 0x9ae9, 0x9aec, 0x9af2, 0x9af3, 0x9af5, 0x9af9, 0x9afa, 0x9afd, + 0x9aff, 0x9b00, 0x9b01, 0x9b02, 0x9b03, 0x9b04, 0x9b05, 0x9b08, + 0x9b09, 0x9b0b, 0x9b0c, 0x9b0d, 0x9b0e, 0x9b10, 0x9b12, 0x9b16, + 0x9b19, 0x9b1b, 0x9b1c, 0x9b20, 0x9b26, 0x9b2b, 0x9b2d, 0x9b33, + 0x9b34, 0x9b35, 0x9b37, 0x9b39, 0x9b3a, 0x9b3d, 0x9b48, 0x9b4b, + 0x9b4c, 0x9b55, 0x9b56, 0x9b57, 0x9b5b, 0x9b5e, 0x9b61, 0x9b63, + 0x9b65, 0x9b66, 0x9b68, 0x9b6a, 0x9b6b, 0x9b6c, 0x9b6d, 0x9b6e, + 0x9b73, 0x9b75, 0x9b77, 0x9b78, 0x9b79, 0x9b7f, 0x9b80, 0x9b84, + 0x9b85, 0x9b86, 0x9b87, 0x9b89, 0x9b8a, 0x9b8b, 0x9b8d, 0x9b8f, + 0x9b90, 0x9b94, 0x9b9a, 0x9b9d, 0x9b9e, 0x9ba6, 0x9ba7, 0x9ba9, + 0x9bac, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb7, 0x9bb8, 0x9bbb, 0x9bbc, + 0x9bbe, 0x9bbf, 0x9bc1, 0x9bc7, 0x9bc8, 0x9bce, 0x9bd0, 0x9bd7, + 0x9bd8, 0x9bdd, 0x9bdf, 0x9be5, 0x9be7, 0x9bea, 0x9beb, 0x9bef, + 0x9bf3, 0x9bf7, 0x9bf8, 0x9bf9, 0x9bfa, 0x9bfd, 0x9bff, 0x9c00, + 0x9c02, 0x9c0b, 0x9c0f, 0x9c11, 0x9c16, 0x9c18, 0x9c19, 0x9c1a, + 0x9c1c, 0x9c1e, 0x9c22, 0x9c23, 0x9c26, 0x9c27, 0x9c28, 0x9c29, + 0x9c2a, 0x9c31, 0x9c35, 0x9c36, 0x9c37, 0x9c3d, 0x9c41, 0x9c43, + 0x9c44, 0x9c45, 0x9c49, 0x9c4a, 0x9c4e, 0x9c4f, 0x9c50, 0x9c53, + 0x9c54, 0x9c56, 0x9c58, 0x9c5b, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c63, + 0x9c69, 0x9c6a, 0x9c5c, 0x9c6b, 0x9c68, 0x9c6e, 0x9c70, 0x9c72, + 0x9c75, 0x9c77, 0x9c7b, 0x9ce6, 0x9cf2, 0x9cf7, 0x9cf9, 0x9d0b, + 0x9d02, 0x9d11, 0x9d17, 0x9d18, 0x9d1c, 0x9d1d, 0x9d1e, 0x9d2f, + 0x9d30, 0x9d32, 0x9d33, 0x9d34, 0x9d3a, 0x9d3c, 0x9d45, 0x9d3d, + 0x9d42, 0x9d43, 0x9d47, 0x9d4a, 0x9d53, 0x9d54, 0x9d5f, 0x9d63, + 0x9d62, 0x9d65, 0x9d69, 0x9d6a, 0x9d6b, 0x9d70, 0x9d76, 0x9d77, + 0x9d7b, 0x9d7c, 0x9d7e, 0x9d83, 0x9d84, 0x9d86, 0x9d8a, 0x9d8d, + 0x9d8e, 0x9d92, 0x9d93, 0x9d95, 0x9d96, 0x9d97, 0x9d98, 0x9da1, + 0x9daa, 0x9dac, 0x9dae, 0x9db1, 0x9db5, 0x9db9, 0x9dbc, 0x9dbf, + 0x9dc3, 0x9dc7, 0x9dc9, 0x9dca, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, + 0x9dda, 0x9dde, 0x9ddf, 0x9de0, 0x9de5, 0x9de7, 0x9de9, 0x9deb, + 0x9dee, 0x9df0, 0x9df3, 0x9df4, 0x9dfe, 0x9e0a, 0x9e02, 0x9e07, + 0x9e0e, 0x9e10, 0x9e11, 0x9e12, 0x9e15, 0x9e16, 0x9e19, 0x9e1c, + 0x9e1d, 0x9e7a, 0x9e7b, 0x9e7c, 0x9e80, 0x9e82, 0x9e83, 0x9e84, + 0x9e85, 0x9e87, 0x9e8e, 0x9e8f, 0x9e96, 0x9e98, 0x9e9b, 0x9e9e, + 0x9ea4, 0x9ea8, 0x9eac, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb3, 0x9eb4, + 0x9eb5, 0x9ec6, 0x9ec8, 0x9ecb, 0x9ed5, 0x9edf, 0x9ee4, 0x9ee7, + 0x9eec, 0x9eed, 0x9eee, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef5, 0x9ef8, + 0x9eff, 0x9f02, 0x9f03, 0x9f09, 0x9f0f, 0x9f10, 0x9f11, 0x9f12, + 0x9f14, 0x9f16, 0x9f17, 0x9f19, 0x9f1a, 0x9f1b, 0x9f1f, 0x9f22, + 0x9f26, 0x9f2a, 0x9f2b, 0x9f2f, 0x9f31, 0x9f32, 0x9f34, 0x9f37, + 0x9f39, 0x9f3a, 0x9f3c, 0x9f3d, 0x9f3f, 0x9f41, 0x9f43, 0x9f44, + 0x9f45, 0x9f46, 0x9f47, 0x9f53, 0x9f55, 0x9f56, 0x9f57, 0x9f58, + 0x9f5a, 0x9f5d, 0x9f5e, 0x9f68, 0x9f69, 0x9f6d, 0x9f6e, 0x9f6f, + 0x9f70, 0x9f71, 0x9f73, 0x9f75, 0x9f7a, 0x9f7d, 0x9f8f, 0x9f90, + 0x9f91, 0x9f92, 0x9f94, 0x9f96, 0x9f97, 0x9f9e, 0x9fa1, 0x9fa2, + 0x9fa3, 0x9fa5 +}; + + +/* The UCS char covered by JIS X0212 are sparsely distributed. So we + use again a two-step mapping table. The index table can be computed + using + + egrep '^0x[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]' \ + ../eastasia/jis/jis0212.txt | awk '{ print $2, $1 }' | sort -u | + perl tab.pl + + where tab.pl is + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $first=$last=$idx=0; + while (<>) { + local($ucs,$jis,%rest) = split; + local($u)=hex($ucs); + local($j)=hex($jis); + if ($u - $last > 6) { + if ($last != 0) { + printf (" { start: %#06x, end: %#06x, idx: %5d },\n", + $first, $last, $idx); + $idx += $last - $first + 1; + } + $first=$u; + } + $last=$u; + } + printf (" { start: %#06x, end: %#06x, idx: %5d }, \n", + $first, $last, $idx); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +const struct jisx0212_idx __jisx0212_from_ucs_idx[] = +{ + { start: 0x007e, end: 0x007e, idx: 0 }, + { start: 0x00a1, end: 0x00af, idx: 1 }, + { start: 0x00b8, end: 0x017e, idx: 16 }, + { start: 0x01cd, end: 0x01dc, idx: 215 }, + { start: 0x01f5, end: 0x01f5, idx: 231 }, + { start: 0x02c7, end: 0x02c7, idx: 232 }, + { start: 0x02d8, end: 0x02dd, idx: 233 }, + { start: 0x0384, end: 0x0390, idx: 239 }, + { start: 0x03aa, end: 0x03b0, idx: 252 }, + { start: 0x03c2, end: 0x03c2, idx: 259 }, + { start: 0x03ca, end: 0x03ce, idx: 260 }, + { start: 0x0402, end: 0x040f, idx: 265 }, + { start: 0x0452, end: 0x045f, idx: 279 }, + { start: 0x2116, end: 0x2116, idx: 293 }, + { start: 0x2122, end: 0x2122, idx: 294 }, + { start: 0x4e02, end: 0x4e05, idx: 295 }, + { start: 0x4e0c, end: 0x4e12, idx: 299 }, + { start: 0x4e1f, end: 0x4e35, idx: 306 }, + { start: 0x4e40, end: 0x4e47, idx: 329 }, + { start: 0x4e51, end: 0x4e51, idx: 337 }, + { start: 0x4e5a, end: 0x4e5c, idx: 338 }, + { start: 0x4e63, end: 0x4e69, idx: 341 }, + { start: 0x4e74, end: 0x4e7f, idx: 348 }, + { start: 0x4e8d, end: 0x4e8d, idx: 360 }, + { start: 0x4e96, end: 0x4e9d, idx: 361 }, + { start: 0x4eaf, end: 0x4eaf, idx: 369 }, + { start: 0x4eb9, end: 0x4eb9, idx: 370 }, + { start: 0x4ec3, end: 0x4ec3, idx: 371 }, + { start: 0x4ed0, end: 0x4ed0, idx: 372 }, + { start: 0x4eda, end: 0x4ee8, idx: 373 }, + { start: 0x4eef, end: 0x4ef5, idx: 388 }, + { start: 0x4efd, end: 0x4f19, idx: 395 }, + { start: 0x4f2e, end: 0x4f58, idx: 424 }, + { start: 0x4f5f, end: 0x4f63, idx: 467 }, + { start: 0x4f6a, end: 0x4f9f, idx: 472 }, + { start: 0x4fb2, end: 0x4fd2, idx: 526 }, + { start: 0x4fdc, end: 0x4fe2, idx: 559 }, + { start: 0x4ff0, end: 0x4ff2, idx: 566 }, + { start: 0x4ffc, end: 0x5027, idx: 569 }, + { start: 0x502e, end: 0x5071, idx: 613 }, + { start: 0x5081, end: 0x50a2, idx: 681 }, + { start: 0x50aa, end: 0x50b0, idx: 715 }, + { start: 0x50b9, end: 0x5110, idx: 722 }, + { start: 0x5117, end: 0x5139, idx: 810 }, + { start: 0x5142, end: 0x5142, idx: 845 }, + { start: 0x514a, end: 0x5158, idx: 846 }, + { start: 0x515f, end: 0x5166, idx: 861 }, + { start: 0x517e, end: 0x5184, idx: 869 }, + { start: 0x518b, end: 0x518e, idx: 876 }, + { start: 0x5198, end: 0x51a3, idx: 880 }, + { start: 0x51ad, end: 0x51ad, idx: 892 }, + { start: 0x51b8, end: 0x51c8, idx: 893 }, + { start: 0x51cf, end: 0x51e5, idx: 910 }, + { start: 0x51ee, end: 0x51f7, idx: 933 }, + { start: 0x5201, end: 0x5205, idx: 943 }, + { start: 0x5212, end: 0x5218, idx: 948 }, + { start: 0x5222, end: 0x5228, idx: 955 }, + { start: 0x5231, end: 0x5235, idx: 962 }, + { start: 0x523c, end: 0x523c, idx: 967 }, + { start: 0x5245, end: 0x5249, idx: 968 }, + { start: 0x5255, end: 0x5266, idx: 973 }, + { start: 0x526e, end: 0x526e, idx: 991 }, + { start: 0x5277, end: 0x5279, idx: 992 }, + { start: 0x5280, end: 0x528c, idx: 995 }, + { start: 0x5293, end: 0x529c, idx: 1008 }, + { start: 0x52a4, end: 0x52a7, idx: 1018 }, + { start: 0x52af, end: 0x52f7, idx: 1022 }, + { start: 0x5300, end: 0x5303, idx: 1095 }, + { start: 0x530a, end: 0x5335, idx: 1099 }, + { start: 0x533c, end: 0x5342, idx: 1143 }, + { start: 0x534b, end: 0x534c, idx: 1150 }, + { start: 0x5359, end: 0x5365, idx: 1152 }, + { start: 0x536c, end: 0x5372, idx: 1165 }, + { start: 0x5379, end: 0x53c5, idx: 1172 }, + { start: 0x53cf, end: 0x53e7, idx: 1249 }, + { start: 0x53f5, end: 0x53f5, idx: 1274 }, + { start: 0x5402, end: 0x5402, idx: 1275 }, + { start: 0x5413, end: 0x5413, idx: 1276 }, + { start: 0x541a, end: 0x541a, idx: 1277 }, + { start: 0x5421, end: 0x5435, idx: 1278 }, + { start: 0x5443, end: 0x544f, idx: 1299 }, + { start: 0x545e, end: 0x5474, idx: 1312 }, + { start: 0x547f, end: 0x54bf, idx: 1335 }, + { start: 0x54c6, end: 0x54ce, idx: 1400 }, + { start: 0x54e0, end: 0x54e0, idx: 1409 }, + { start: 0x54ea, end: 0x54ef, idx: 1410 }, + { start: 0x54f6, end: 0x550e, idx: 1416 }, + { start: 0x5515, end: 0x5515, idx: 1441 }, + { start: 0x552a, end: 0x552b, idx: 1442 }, + { start: 0x5532, end: 0x5551, idx: 1444 }, + { start: 0x5558, end: 0x5566, idx: 1476 }, + { start: 0x557f, end: 0x5597, idx: 1491 }, + { start: 0x55a3, end: 0x55a4, idx: 1516 }, + { start: 0x55ad, end: 0x55b2, idx: 1518 }, + { start: 0x55bf, end: 0x55e2, idx: 1524 }, + { start: 0x55e9, end: 0x55e9, idx: 1560 }, + { start: 0x55f6, end: 0x55f6, idx: 1561 }, + { start: 0x55ff, end: 0x5612, idx: 1562 }, + { start: 0x5619, end: 0x5619, idx: 1582 }, + { start: 0x562c, end: 0x5654, idx: 1583 }, + { start: 0x565e, end: 0x5675, idx: 1624 }, + { start: 0x5684, end: 0x568c, idx: 1648 }, + { start: 0x5695, end: 0x569f, idx: 1657 }, + { start: 0x56a6, end: 0x56b7, idx: 1668 }, + { start: 0x56be, end: 0x56be, idx: 1686 }, + { start: 0x56c5, end: 0x56d0, idx: 1687 }, + { start: 0x56d9, end: 0x56f7, idx: 1699 }, + { start: 0x5701, end: 0x5734, idx: 1730 }, + { start: 0x573d, end: 0x5752, idx: 1782 }, + { start: 0x5762, end: 0x5783, idx: 1804 }, + { start: 0x578c, end: 0x578c, idx: 1838 }, + { start: 0x5794, end: 0x57ac, idx: 1839 }, + { start: 0x57b8, end: 0x57bd, idx: 1864 }, + { start: 0x57c7, end: 0x57d5, idx: 1870 }, + { start: 0x57dd, end: 0x580d, idx: 1885 }, + { start: 0x581b, end: 0x5832, idx: 1934 }, + { start: 0x5839, end: 0x583f, idx: 1958 }, + { start: 0x5849, end: 0x5855, idx: 1965 }, + { start: 0x585f, end: 0x5868, idx: 1978 }, + { start: 0x5878, end: 0x5896, idx: 1988 }, + { start: 0x589d, end: 0x58a9, idx: 2019 }, + { start: 0x58b1, end: 0x58b2, idx: 2032 }, + { start: 0x58bc, end: 0x58e2, idx: 2034 }, + { start: 0x58e9, end: 0x58e9, idx: 2073 }, + { start: 0x58f3, end: 0x58f3, idx: 2074 }, + { start: 0x5905, end: 0x5914, idx: 2075 }, + { start: 0x591d, end: 0x5928, idx: 2091 }, + { start: 0x592f, end: 0x5936, idx: 2103 }, + { start: 0x593f, end: 0x5946, idx: 2111 }, + { start: 0x5952, end: 0x5963, idx: 2119 }, + { start: 0x596b, end: 0x597c, idx: 2137 }, + { start: 0x598b, end: 0x5997, idx: 2155 }, + { start: 0x599f, end: 0x59d2, idx: 2168 }, + { start: 0x59dd, end: 0x59e7, idx: 2220 }, + { start: 0x59ee, end: 0x59f7, idx: 2231 }, + { start: 0x5a00, end: 0x5a04, idx: 2241 }, + { start: 0x5a0c, end: 0x5a13, idx: 2246 }, + { start: 0x5a1e, end: 0x5a30, idx: 2254 }, + { start: 0x5a44, end: 0x5a55, idx: 2273 }, + { start: 0x5a5e, end: 0x5a6d, idx: 2291 }, + { start: 0x5a77, end: 0x5a7e, idx: 2307 }, + { start: 0x5a8b, end: 0x5ac8, idx: 2315 }, + { start: 0x5acf, end: 0x5acf, idx: 2377 }, + { start: 0x5ada, end: 0x5aee, idx: 2378 }, + { start: 0x5af5, end: 0x5af6, idx: 2399 }, + { start: 0x5afd, end: 0x5b01, idx: 2401 }, + { start: 0x5b08, end: 0x5b08, idx: 2406 }, + { start: 0x5b17, end: 0x5b25, idx: 2407 }, + { start: 0x5b2d, end: 0x5b2d, idx: 2422 }, + { start: 0x5b34, end: 0x5b38, idx: 2423 }, + { start: 0x5b41, end: 0x5b41, idx: 2428 }, + { start: 0x5b4b, end: 0x5b56, idx: 2429 }, + { start: 0x5b5e, end: 0x5b5e, idx: 2441 }, + { start: 0x5b68, end: 0x5b6f, idx: 2442 }, + { start: 0x5b7c, end: 0x5b96, idx: 2450 }, + { start: 0x5ba8, end: 0x5bc1, idx: 2477 }, + { start: 0x5bcd, end: 0x5bcf, idx: 2503 }, + { start: 0x5bd6, end: 0x5be0, idx: 2506 }, + { start: 0x5bef, end: 0x5bf4, idx: 2517 }, + { start: 0x5bfd, end: 0x5bfd, idx: 2523 }, + { start: 0x5c0c, end: 0x5c0c, idx: 2524 }, + { start: 0x5c17, end: 0x5c17, idx: 2525 }, + { start: 0x5c1e, end: 0x5c36, idx: 2526 }, + { start: 0x5c59, end: 0x5c7d, idx: 2551 }, + { start: 0x5c87, end: 0x5c92, idx: 2588 }, + { start: 0x5c9d, end: 0x5caa, idx: 2600 }, + { start: 0x5cb2, end: 0x5cba, idx: 2614 }, + { start: 0x5cc9, end: 0x5ccb, idx: 2623 }, + { start: 0x5cd2, end: 0x5cdd, idx: 2626 }, + { start: 0x5cee, end: 0x5cf4, idx: 2638 }, + { start: 0x5d01, end: 0x5d06, idx: 2645 }, + { start: 0x5d0d, end: 0x5d12, idx: 2651 }, + { start: 0x5d23, end: 0x5d4a, idx: 2657 }, + { start: 0x5d51, end: 0x5d70, idx: 2697 }, + { start: 0x5d79, end: 0x5d8a, idx: 2729 }, + { start: 0x5d92, end: 0x5da0, idx: 2747 }, + { start: 0x5da7, end: 0x5db9, idx: 2762 }, + { start: 0x5dc3, end: 0x5dd0, idx: 2781 }, + { start: 0x5dd8, end: 0x5dd9, idx: 2795 }, + { start: 0x5de0, end: 0x5de9, idx: 2797 }, + { start: 0x5df8, end: 0x5df9, idx: 2807 }, + { start: 0x5e00, end: 0x5e00, idx: 2809 }, + { start: 0x5e07, end: 0x5e18, idx: 2810 }, + { start: 0x5e1f, end: 0x5e20, idx: 2828 }, + { start: 0x5e28, end: 0x5e35, idx: 2830 }, + { start: 0x5e3e, end: 0x5e3e, idx: 2844 }, + { start: 0x5e49, end: 0x5e5e, idx: 2845 }, + { start: 0x5e68, end: 0x5e70, idx: 2867 }, + { start: 0x5e80, end: 0x5e80, idx: 2876 }, + { start: 0x5e8b, end: 0x5e8e, idx: 2877 }, + { start: 0x5ea2, end: 0x5eb3, idx: 2881 }, + { start: 0x5ebd, end: 0x5ebf, idx: 2899 }, + { start: 0x5ec6, end: 0x5ed5, idx: 2902 }, + { start: 0x5edc, end: 0x5ede, idx: 2918 }, + { start: 0x5ee5, end: 0x5eeb, idx: 2921 }, + { start: 0x5f02, end: 0x5f0e, idx: 2928 }, + { start: 0x5f19, end: 0x5f67, idx: 2941 }, + { start: 0x5f6f, end: 0x5f7e, idx: 3020 }, + { start: 0x5f89, end: 0x5f8f, idx: 3036 }, + { start: 0x5f96, end: 0x5fb1, idx: 3043 }, + { start: 0x5fb8, end: 0x5fb8, idx: 3071 }, + { start: 0x5fc4, end: 0x5fd4, idx: 3072 }, + { start: 0x5fde, end: 0x5ffc, idx: 3089 }, + { start: 0x6007, end: 0x6024, idx: 3120 }, + { start: 0x602d, end: 0x6035, idx: 3150 }, + { start: 0x6040, end: 0x6040, idx: 3159 }, + { start: 0x6047, end: 0x6067, idx: 3160 }, + { start: 0x6071, end: 0x6071, idx: 3193 }, + { start: 0x607e, end: 0x60a8, idx: 3194 }, + { start: 0x60b0, end: 0x60e5, idx: 3237 }, + { start: 0x60f2, end: 0x6122, idx: 3291 }, + { start: 0x612a, end: 0x6139, idx: 3340 }, + { start: 0x6141, end: 0x6149, idx: 3356 }, + { start: 0x615e, end: 0x6160, idx: 3365 }, + { start: 0x616c, end: 0x6184, idx: 3368 }, + { start: 0x618b, end: 0x61ad, idx: 3393 }, + { start: 0x61b8, end: 0x61c2, idx: 3428 }, + { start: 0x61ce, end: 0x61d5, idx: 3439 }, + { start: 0x61dc, end: 0x61ef, idx: 3447 }, + { start: 0x6201, end: 0x6207, idx: 3467 }, + { start: 0x6213, end: 0x6215, idx: 3474 }, + { start: 0x621c, end: 0x622b, idx: 3477 }, + { start: 0x6239, end: 0x625c, idx: 3493 }, + { start: 0x6264, end: 0x6264, idx: 3529 }, + { start: 0x626d, end: 0x6273, idx: 3530 }, + { start: 0x627a, end: 0x627d, idx: 3537 }, + { start: 0x628d, end: 0x6290, idx: 3541 }, + { start: 0x62a6, end: 0x62a8, idx: 3545 }, + { start: 0x62b3, end: 0x62c4, idx: 3548 }, + { start: 0x62ce, end: 0x62ce, idx: 3566 }, + { start: 0x62d5, end: 0x62da, idx: 3567 }, + { start: 0x62ea, end: 0x62ea, idx: 3573 }, + { start: 0x62f2, end: 0x62f4, idx: 3574 }, + { start: 0x62fc, end: 0x6318, idx: 3577 }, + { start: 0x6329, end: 0x632d, idx: 3606 }, + { start: 0x6335, end: 0x635b, idx: 3611 }, + { start: 0x6365, end: 0x63a6, idx: 3650 }, + { start: 0x63ad, end: 0x63af, idx: 3716 }, + { start: 0x63bd, end: 0x63d5, idx: 3719 }, + { start: 0x63dc, end: 0x63f9, idx: 3744 }, + { start: 0x6409, end: 0x6435, idx: 3774 }, + { start: 0x643d, end: 0x643f, idx: 3819 }, + { start: 0x644b, end: 0x6463, idx: 3822 }, + { start: 0x646d, end: 0x6474, idx: 3847 }, + { start: 0x647b, end: 0x647d, idx: 3855 }, + { start: 0x6485, end: 0x6487, idx: 3858 }, + { start: 0x648f, end: 0x6491, idx: 3861 }, + { start: 0x6498, end: 0x64ac, idx: 3864 }, + { start: 0x64b3, end: 0x64b3, idx: 3885 }, + { start: 0x64bd, end: 0x64d7, idx: 3886 }, + { start: 0x64e4, end: 0x6531, idx: 3913 }, + { start: 0x653a, end: 0x6549, idx: 3991 }, + { start: 0x6550, end: 0x6554, idx: 4007 }, + { start: 0x655f, end: 0x6560, idx: 4012 }, + { start: 0x6567, end: 0x656b, idx: 4014 }, + { start: 0x657a, end: 0x658a, idx: 4019 }, + { start: 0x6592, end: 0x65a6, idx: 4036 }, + { start: 0x65ae, end: 0x65b4, idx: 4057 }, + { start: 0x65bf, end: 0x65d8, idx: 4064 }, + { start: 0x65df, end: 0x65df, idx: 4090 }, + { start: 0x65f0, end: 0x6616, idx: 4091 }, + { start: 0x661d, end: 0x6639, idx: 4130 }, + { start: 0x6640, end: 0x6661, idx: 4159 }, + { start: 0x666a, end: 0x666c, idx: 4193 }, + { start: 0x6673, end: 0x6680, idx: 4196 }, + { start: 0x668b, end: 0x6692, idx: 4210 }, + { start: 0x6699, end: 0x66a4, idx: 4218 }, + { start: 0x66ad, end: 0x66d4, idx: 4230 }, + { start: 0x66db, end: 0x66df, idx: 4270 }, + { start: 0x66e8, end: 0x66ee, idx: 4275 }, + { start: 0x66fa, end: 0x66fb, idx: 4282 }, + { start: 0x6705, end: 0x6707, idx: 4284 }, + { start: 0x670e, end: 0x6722, idx: 4287 }, + { start: 0x6733, end: 0x6733, idx: 4308 }, + { start: 0x673e, end: 0x673e, idx: 4309 }, + { start: 0x6745, end: 0x674c, idx: 4310 }, + { start: 0x6754, end: 0x6755, idx: 4318 }, + { start: 0x675d, end: 0x675d, idx: 4320 }, + { start: 0x6766, end: 0x6784, idx: 4321 }, + { start: 0x678e, end: 0x679b, idx: 4352 }, + { start: 0x67b0, end: 0x67c9, idx: 4366 }, + { start: 0x67d2, end: 0x67e6, idx: 4392 }, + { start: 0x67f0, end: 0x67f9, idx: 4413 }, + { start: 0x6814, end: 0x681f, idx: 4423 }, + { start: 0x6827, end: 0x6833, idx: 4435 }, + { start: 0x683b, end: 0x685b, idx: 4448 }, + { start: 0x686b, end: 0x6888, idx: 4481 }, + { start: 0x6896, end: 0x68b2, idx: 4511 }, + { start: 0x68bb, end: 0x68bb, idx: 4540 }, + { start: 0x68c5, end: 0x68dd, idx: 4541 }, + { start: 0x68e5, end: 0x68fd, idx: 4566 }, + { start: 0x6906, end: 0x6917, idx: 4591 }, + { start: 0x6931, end: 0x693b, idx: 4609 }, + { start: 0x6942, end: 0x694e, idx: 4620 }, + { start: 0x6957, end: 0x695b, idx: 4633 }, + { start: 0x6963, end: 0x6972, idx: 4638 }, + { start: 0x697a, end: 0x6980, idx: 4654 }, + { start: 0x698d, end: 0x6998, idx: 4661 }, + { start: 0x69a1, end: 0x69af, idx: 4673 }, + { start: 0x69b7, end: 0x69bc, idx: 4688 }, + { start: 0x69c5, end: 0x69c8, idx: 4694 }, + { start: 0x69d1, end: 0x69d7, idx: 4698 }, + { start: 0x69e2, end: 0x69e5, idx: 4705 }, + { start: 0x69ee, end: 0x69f5, idx: 4709 }, + { start: 0x69fe, end: 0x6a03, idx: 4717 }, + { start: 0x6a0f, end: 0x6a28, idx: 4723 }, + { start: 0x6a30, end: 0x6a5b, idx: 4749 }, + { start: 0x6a64, end: 0x6a6a, idx: 4793 }, + { start: 0x6a71, end: 0x6a73, idx: 4800 }, + { start: 0x6a7e, end: 0x6a91, idx: 4803 }, + { start: 0x6a9b, end: 0x6ab4, idx: 4823 }, + { start: 0x6abd, end: 0x6abf, idx: 4849 }, + { start: 0x6ac6, end: 0x6add, idx: 4852 }, + { start: 0x6ae4, end: 0x6af2, idx: 4876 }, + { start: 0x6afc, end: 0x6b3f, idx: 4891 }, + { start: 0x6b46, end: 0x6b60, idx: 4959 }, + { start: 0x6b67, end: 0x6b75, idx: 4986 }, + { start: 0x6b7d, end: 0x6b85, idx: 5001 }, + { start: 0x6b97, end: 0x6bb0, idx: 5010 }, + { start: 0x6bb8, end: 0x6bcc, idx: 5036 }, + { start: 0x6bd6, end: 0x6bda, idx: 5057 }, + { start: 0x6be1, end: 0x6be7, idx: 5062 }, + { start: 0x6bee, end: 0x6c12, idx: 5069 }, + { start: 0x6c19, end: 0x6c1f, idx: 5106 }, + { start: 0x6c26, end: 0x6c3f, idx: 5113 }, + { start: 0x6c4a, end: 0x6c5c, idx: 5139 }, + { start: 0x6c67, end: 0x6c7b, idx: 5158 }, + { start: 0x6c85, end: 0x6c89, idx: 5179 }, + { start: 0x6c94, end: 0x6c9f, idx: 5184 }, + { start: 0x6cb0, end: 0x6cb4, idx: 5196 }, + { start: 0x6cc2, end: 0x6cc6, idx: 5201 }, + { start: 0x6ccd, end: 0x6ce0, idx: 5206 }, + { start: 0x6ce7, end: 0x6cf4, idx: 5226 }, + { start: 0x6d04, end: 0x6d13, idx: 5240 }, + { start: 0x6d1a, end: 0x6d1a, idx: 5256 }, + { start: 0x6d26, end: 0x6d31, idx: 5257 }, + { start: 0x6d39, end: 0x6d3f, idx: 5269 }, + { start: 0x6d57, end: 0x6d57, idx: 5276 }, + { start: 0x6d5e, end: 0x6d67, idx: 5277 }, + { start: 0x6d6f, end: 0x6d70, idx: 5287 }, + { start: 0x6d7c, end: 0x6d87, idx: 5289 }, + { start: 0x6d91, end: 0x6d98, idx: 5301 }, + { start: 0x6daa, end: 0x6dac, idx: 5309 }, + { start: 0x6db4, end: 0x6dcf, idx: 5312 }, + { start: 0x6dd6, end: 0x6e04, idx: 5340 }, + { start: 0x6e1e, end: 0x6e27, idx: 5387 }, + { start: 0x6e32, end: 0x6e3c, idx: 5397 }, + { start: 0x6e44, end: 0x6e68, idx: 5408 }, + { start: 0x6e73, end: 0x6e73, idx: 5445 }, + { start: 0x6e7b, end: 0x6e7d, idx: 5446 }, + { start: 0x6e8d, end: 0x6e99, idx: 5449 }, + { start: 0x6ea0, end: 0x6ea0, idx: 5462 }, + { start: 0x6ea7, end: 0x6eb3, idx: 5463 }, + { start: 0x6ebb, end: 0x6ecf, idx: 5476 }, + { start: 0x6eeb, end: 0x6eee, idx: 5497 }, + { start: 0x6ef9, end: 0x6efd, idx: 5501 }, + { start: 0x6f04, end: 0x6f0d, idx: 5506 }, + { start: 0x6f16, end: 0x6f1b, idx: 5516 }, + { start: 0x6f26, end: 0x6f3c, idx: 5522 }, + { start: 0x6f4f, end: 0x6f6c, idx: 5545 }, + { start: 0x6f7d, end: 0x6fbc, idx: 5575 }, + { start: 0x6fc5, end: 0x6fca, idx: 5639 }, + { start: 0x6fda, end: 0x6fde, idx: 5645 }, + { start: 0x6fe8, end: 0x6fe9, idx: 5650 }, + { start: 0x6ff0, end: 0x700d, idx: 5652 }, + { start: 0x7017, end: 0x7017, idx: 5682 }, + { start: 0x7020, end: 0x7023, idx: 5683 }, + { start: 0x702f, end: 0x703c, idx: 5687 }, + { start: 0x7043, end: 0x7055, idx: 5701 }, + { start: 0x705d, end: 0x7065, idx: 5720 }, + { start: 0x706c, end: 0x706e, idx: 5729 }, + { start: 0x7075, end: 0x7076, idx: 5732 }, + { start: 0x707e, end: 0x7086, idx: 5734 }, + { start: 0x7094, end: 0x709b, idx: 5743 }, + { start: 0x70a4, end: 0x70a4, idx: 5751 }, + { start: 0x70ab, end: 0x70b7, idx: 5752 }, + { start: 0x70ca, end: 0x70ca, idx: 5765 }, + { start: 0x70d1, end: 0x70dc, idx: 5766 }, + { start: 0x70e4, end: 0x70e4, idx: 5778 }, + { start: 0x70fa, end: 0x70fa, idx: 5779 }, + { start: 0x7103, end: 0x710f, idx: 5780 }, + { start: 0x711e, end: 0x7120, idx: 5793 }, + { start: 0x712b, end: 0x7131, idx: 5796 }, + { start: 0x7138, end: 0x7138, idx: 5803 }, + { start: 0x7141, end: 0x7160, idx: 5804 }, + { start: 0x7168, end: 0x7168, idx: 5836 }, + { start: 0x7179, end: 0x7179, idx: 5837 }, + { start: 0x7180, end: 0x7192, idx: 5838 }, + { start: 0x719a, end: 0x71a2, idx: 5857 }, + { start: 0x71af, end: 0x71b3, idx: 5866 }, + { start: 0x71ba, end: 0x71c4, idx: 5871 }, + { start: 0x71cb, end: 0x71cc, idx: 5882 }, + { start: 0x71d3, end: 0x71dc, idx: 5884 }, + { start: 0x71f8, end: 0x7200, idx: 5894 }, + { start: 0x7207, end: 0x7209, idx: 5903 }, + { start: 0x7213, end: 0x7224, idx: 5906 }, + { start: 0x722b, end: 0x7239, idx: 5924 }, + { start: 0x7241, end: 0x7245, idx: 5939 }, + { start: 0x724e, end: 0x7293, idx: 5944 }, + { start: 0x729b, end: 0x729b, idx: 6014 }, + { start: 0x72a8, end: 0x72b4, idx: 6015 }, + { start: 0x72be, end: 0x72cc, idx: 6028 }, + { start: 0x72d5, end: 0x72d8, idx: 6043 }, + { start: 0x72df, end: 0x72e5, idx: 6047 }, + { start: 0x72f3, end: 0x7343, idx: 6054 }, + { start: 0x734d, end: 0x7386, idx: 6135 }, + { start: 0x738e, end: 0x73ad, idx: 6193 }, + { start: 0x73b5, end: 0x73e9, idx: 6225 }, + { start: 0x73f4, end: 0x740a, idx: 6278 }, + { start: 0x7411, end: 0x7411, idx: 6301 }, + { start: 0x741a, end: 0x741b, idx: 6302 }, + { start: 0x7424, end: 0x7431, idx: 6304 }, + { start: 0x7439, end: 0x7439, idx: 6318 }, + { start: 0x7440, end: 0x7472, idx: 6319 }, + { start: 0x7480, end: 0x74bf, idx: 6370 }, + { start: 0x74c8, end: 0x74ff, idx: 6434 }, + { start: 0x7506, end: 0x7506, idx: 6490 }, + { start: 0x7512, end: 0x7517, idx: 6491 }, + { start: 0x7520, end: 0x752f, idx: 6497 }, + { start: 0x7536, end: 0x7557, idx: 6513 }, + { start: 0x755e, end: 0x7561, idx: 6547 }, + { start: 0x756f, end: 0x7571, idx: 6551 }, + { start: 0x7579, end: 0x7585, idx: 6554 }, + { start: 0x7590, end: 0x75a4, idx: 6567 }, + { start: 0x75b4, end: 0x75cf, idx: 6588 }, + { start: 0x75d7, end: 0x75f1, idx: 6616 }, + { start: 0x75f9, end: 0x75f9, idx: 6643 }, + { start: 0x7600, end: 0x764b, idx: 6644 }, + { start: 0x7655, end: 0x7665, idx: 6720 }, + { start: 0x766d, end: 0x7674, idx: 6737 }, + { start: 0x7681, end: 0x7685, idx: 6745 }, + { start: 0x768c, end: 0x768d, idx: 6750 }, + { start: 0x7695, end: 0x76ad, idx: 6752 }, + { start: 0x76bd, end: 0x76d9, idx: 6777 }, + { start: 0x76e0, end: 0x7784, idx: 6806 }, + { start: 0x778c, end: 0x778d, idx: 6971 }, + { start: 0x7794, end: 0x77b5, idx: 6973 }, + { start: 0x77be, end: 0x77c9, idx: 7007 }, + { start: 0x77d1, end: 0x77fb, idx: 7019 }, + { start: 0x7805, end: 0x7811, idx: 7062 }, + { start: 0x781d, end: 0x7823, idx: 7075 }, + { start: 0x782d, end: 0x7837, idx: 7082 }, + { start: 0x7843, end: 0x7852, idx: 7093 }, + { start: 0x785c, end: 0x786e, idx: 7109 }, + { start: 0x787a, end: 0x787e, idx: 7128 }, + { start: 0x788a, end: 0x78b3, idx: 7133 }, + { start: 0x78bb, end: 0x78bf, idx: 7175 }, + { start: 0x78c7, end: 0x78ea, idx: 7180 }, + { start: 0x78f2, end: 0x7910, idx: 7216 }, + { start: 0x791a, end: 0x795c, idx: 7247 }, + { start: 0x7967, end: 0x796b, idx: 7314 }, + { start: 0x7972, end: 0x7972, idx: 7319 }, + { start: 0x7979, end: 0x797e, idx: 7320 }, + { start: 0x798b, end: 0x79a1, idx: 7326 }, + { start: 0x79a8, end: 0x79bb, idx: 7349 }, + { start: 0x79c2, end: 0x79f1, idx: 7369 }, + { start: 0x79f8, end: 0x7a3a, idx: 7417 }, + { start: 0x7a44, end: 0x7a4c, idx: 7484 }, + { start: 0x7a55, end: 0x7a6d, idx: 7493 }, + { start: 0x7a75, end: 0x7a94, idx: 7518 }, + { start: 0x7a9e, end: 0x7aa3, idx: 7550 }, + { start: 0x7aac, end: 0x7aac, idx: 7556 }, + { start: 0x7ab3, end: 0x7abc, idx: 7557 }, + { start: 0x7ac6, end: 0x7ad1, idx: 7567 }, + { start: 0x7adb, end: 0x7adb, idx: 7579 }, + { start: 0x7ae8, end: 0x7af4, idx: 7580 }, + { start: 0x7afb, end: 0x7afe, idx: 7593 }, + { start: 0x7b07, end: 0x7b07, idx: 7597 }, + { start: 0x7b14, end: 0x7b14, idx: 7598 }, + { start: 0x7b1f, end: 0x7b34, idx: 7599 }, + { start: 0x7b3d, end: 0x7b47, idx: 7621 }, + { start: 0x7b4e, end: 0x7b4e, idx: 7632 }, + { start: 0x7b55, end: 0x7b55, idx: 7633 }, + { start: 0x7b60, end: 0x7b77, idx: 7634 }, + { start: 0x7b84, end: 0x7ba5, idx: 7658 }, + { start: 0x7bac, end: 0x7bca, idx: 7692 }, + { start: 0x7bd4, end: 0x7bdb, idx: 7723 }, + { start: 0x7be8, end: 0x7bea, idx: 7731 }, + { start: 0x7bf2, end: 0x7c0f, idx: 7734 }, + { start: 0x7c19, end: 0x7c3a, idx: 7764 }, + { start: 0x7c46, end: 0x7c4a, idx: 7798 }, + { start: 0x7c51, end: 0x7c72, idx: 7803 }, + { start: 0x7c79, end: 0x7c7d, idx: 7837 }, + { start: 0x7c86, end: 0x7c87, idx: 7842 }, + { start: 0x7c8f, end: 0x7c94, idx: 7844 }, + { start: 0x7c9e, end: 0x7ca6, idx: 7850 }, + { start: 0x7cb0, end: 0x7cdd, idx: 7859 }, + { start: 0x7ce6, end: 0x7ceb, idx: 7905 }, + { start: 0x7cf5, end: 0x7cf5, idx: 7911 }, + { start: 0x7d03, end: 0x7d16, idx: 7912 }, + { start: 0x7d1d, end: 0x7d31, idx: 7932 }, + { start: 0x7d3c, end: 0x7d5d, idx: 7953 }, + { start: 0x7d65, end: 0x7d70, idx: 7987 }, + { start: 0x7d78, end: 0x7d9e, idx: 7999 }, + { start: 0x7da6, end: 0x7daa, idx: 8038 }, + { start: 0x7db3, end: 0x7db9, idx: 8043 }, + { start: 0x7dc2, end: 0x7dce, idx: 8050 }, + { start: 0x7dd7, end: 0x7dd9, idx: 8063 }, + { start: 0x7de2, end: 0x7e00, idx: 8066 }, + { start: 0x7e08, end: 0x7e08, idx: 8097 }, + { start: 0x7e10, end: 0x7e20, idx: 8098 }, + { start: 0x7e27, end: 0x7e36, idx: 8115 }, + { start: 0x7e3f, end: 0x7e47, idx: 8131 }, + { start: 0x7e4e, end: 0x7e58, idx: 8140 }, + { start: 0x7e5f, end: 0x7e9e, idx: 8151 }, + { start: 0x7f3b, end: 0x7f47, idx: 8215 }, + { start: 0x7f4f, end: 0x7f53, idx: 8228 }, + { start: 0x7f5b, end: 0x7f66, idx: 8233 }, + { start: 0x7f6d, end: 0x7f71, idx: 8245 }, + { start: 0x7f7d, end: 0x7f80, idx: 8250 }, + { start: 0x7f8b, end: 0x7fad, idx: 8254 }, + { start: 0x7fb4, end: 0x7fb4, idx: 8289 }, + { start: 0x7fbc, end: 0x7fcf, idx: 8290 }, + { start: 0x7fdb, end: 0x7ff2, idx: 8310 }, + { start: 0x7ffa, end: 0x7fff, idx: 8334 }, + { start: 0x8007, end: 0x8016, idx: 8340 }, + { start: 0x801d, end: 0x8044, idx: 8356 }, + { start: 0x8060, end: 0x8066, idx: 8396 }, + { start: 0x806d, end: 0x8075, idx: 8403 }, + { start: 0x8081, end: 0x8081, idx: 8412 }, + { start: 0x8088, end: 0x808e, idx: 8413 }, + { start: 0x809c, end: 0x809e, idx: 8420 }, + { start: 0x80a6, end: 0x80ab, idx: 8423 }, + { start: 0x80b8, end: 0x80b9, idx: 8429 }, + { start: 0x80c8, end: 0x80d8, idx: 8431 }, + { start: 0x80e0, end: 0x80e0, idx: 8448 }, + { start: 0x80ed, end: 0x8103, idx: 8449 }, + { start: 0x810b, end: 0x810b, idx: 8472 }, + { start: 0x8116, end: 0x813c, idx: 8473 }, + { start: 0x8145, end: 0x8157, idx: 8512 }, + { start: 0x8160, end: 0x816f, idx: 8531 }, + { start: 0x8177, end: 0x8177, idx: 8547 }, + { start: 0x8181, end: 0x81a2, idx: 8548 }, + { start: 0x81ae, end: 0x81b4, idx: 8582 }, + { start: 0x81bb, end: 0x81bb, idx: 8589 }, + { start: 0x81c3, end: 0x81e4, idx: 8590 }, + { start: 0x81eb, end: 0x8203, idx: 8624 }, + { start: 0x820f, end: 0x8228, idx: 8649 }, + { start: 0x8232, end: 0x823a, idx: 8675 }, + { start: 0x8243, end: 0x826d, idx: 8684 }, + { start: 0x8274, end: 0x8274, idx: 8727 }, + { start: 0x827b, end: 0x82bf, idx: 8728 }, + { start: 0x82c6, end: 0x82c6, idx: 8797 }, + { start: 0x82d0, end: 0x82ef, idx: 8798 }, + { start: 0x82f6, end: 0x830b, idx: 8830 }, + { start: 0x831b, end: 0x8322, idx: 8852 }, + { start: 0x832c, end: 0x8357, idx: 8860 }, + { start: 0x8370, end: 0x8370, idx: 8904 }, + { start: 0x8378, end: 0x8386, idx: 8905 }, + { start: 0x838d, end: 0x839d, idx: 8920 }, + { start: 0x83a6, end: 0x83ad, idx: 8937 }, + { start: 0x83be, end: 0x83c0, idx: 8945 }, + { start: 0x83c7, end: 0x83d4, idx: 8948 }, + { start: 0x83dd, end: 0x83dd, idx: 8962 }, + { start: 0x83e8, end: 0x83ea, idx: 8963 }, + { start: 0x83f6, end: 0x8419, idx: 8966 }, + { start: 0x842f, end: 0x842f, idx: 9002 }, + { start: 0x8439, end: 0x8439, idx: 9003 }, + { start: 0x8445, end: 0x8485, idx: 9004 }, + { start: 0x8492, end: 0x8495, idx: 9069 }, + { start: 0x849e, end: 0x849e, idx: 9073 }, + { start: 0x84a6, end: 0x84d3, idx: 9074 }, + { start: 0x84dc, end: 0x84dc, idx: 9120 }, + { start: 0x84e7, end: 0x8510, idx: 9121 }, + { start: 0x851c, end: 0x8536, idx: 9163 }, + { start: 0x853f, end: 0x853f, idx: 9190 }, + { start: 0x8546, end: 0x8546, idx: 9191 }, + { start: 0x854f, end: 0x8564, idx: 9192 }, + { start: 0x856b, end: 0x856f, idx: 9214 }, + { start: 0x8579, end: 0x85ad, idx: 9219 }, + { start: 0x85b4, end: 0x85ce, idx: 9272 }, + { start: 0x85d8, end: 0x8605, idx: 9299 }, + { start: 0x860d, end: 0x8629, idx: 9345 }, + { start: 0x8636, end: 0x8646, idx: 9374 }, + { start: 0x8652, end: 0x867a, idx: 9391 }, + { start: 0x8688, end: 0x86c5, idx: 9432 }, + { start: 0x86d1, end: 0x86e7, idx: 9494 }, + { start: 0x86fa, end: 0x86fd, idx: 9517 }, + { start: 0x8704, end: 0x8732, idx: 9521 }, + { start: 0x8739, end: 0x8745, idx: 9568 }, + { start: 0x874d, end: 0x874d, idx: 9581 }, + { start: 0x8758, end: 0x8765, idx: 9582 }, + { start: 0x876f, end: 0x8772, idx: 9596 }, + { start: 0x877b, end: 0x877b, idx: 9600 }, + { start: 0x8783, end: 0x87b5, idx: 9601 }, + { start: 0x87be, end: 0x87c1, idx: 9652 }, + { start: 0x87c8, end: 0x87ce, idx: 9656 }, + { start: 0x87d5, end: 0x881f, idx: 9663 }, + { start: 0x8828, end: 0x8869, idx: 9738 }, + { start: 0x8871, end: 0x8871, idx: 9804 }, + { start: 0x8879, end: 0x8880, idx: 9805 }, + { start: 0x8898, end: 0x88a0, idx: 9813 }, + { start: 0x88a8, end: 0x88aa, idx: 9822 }, + { start: 0x88ba, end: 0x88c0, idx: 9825 }, + { start: 0x88ca, end: 0x88d3, idx: 9832 }, + { start: 0x88db, end: 0x88de, idx: 9842 }, + { start: 0x88e7, end: 0x88e7, idx: 9846 }, + { start: 0x88ef, end: 0x88f7, idx: 9847 }, + { start: 0x8901, end: 0x8906, idx: 9856 }, + { start: 0x890d, end: 0x8928, idx: 9862 }, + { start: 0x8930, end: 0x8963, idx: 9890 }, + { start: 0x896b, end: 0x897d, idx: 9942 }, + { start: 0x8989, end: 0x89a5, idx: 9961 }, + { start: 0x89b0, end: 0x89bc, idx: 9990 }, + { start: 0x89d4, end: 0x89d8, idx: 10003 }, + { start: 0x89e5, end: 0x8a07, idx: 10008 }, + { start: 0x8a0f, end: 0x8a15, idx: 10043 }, + { start: 0x8a1e, end: 0x8a67, idx: 10050 }, + { start: 0x8a75, end: 0x8a9f, idx: 10124 }, + { start: 0x8aa7, end: 0x8aca, idx: 10167 }, + { start: 0x8ad1, end: 0x8adf, idx: 10203 }, + { start: 0x8aec, end: 0x8b11, idx: 10218 }, + { start: 0x8b1c, end: 0x8b1f, idx: 10256 }, + { start: 0x8b2d, end: 0x8b30, idx: 10260 }, + { start: 0x8b37, end: 0x8b63, idx: 10264 }, + { start: 0x8b6d, end: 0x8b6d, idx: 10309 }, + { start: 0x8b76, end: 0x8b95, idx: 10310 }, + { start: 0x8b9c, end: 0x8b9f, idx: 10342 }, + { start: 0x8c38, end: 0x8c3e, idx: 10346 }, + { start: 0x8c45, end: 0x8c7e, idx: 10353 }, + { start: 0x8c86, end: 0x8c9c, idx: 10411 }, + { start: 0x8ca4, end: 0x8ca4, idx: 10434 }, + { start: 0x8cb9, end: 0x8cba, idx: 10435 }, + { start: 0x8cc5, end: 0x8ce1, idx: 10437 }, + { start: 0x8ce8, end: 0x8d09, idx: 10466 }, + { start: 0x8d12, end: 0x8d1b, idx: 10500 }, + { start: 0x8d65, end: 0x8d6e, idx: 10510 }, + { start: 0x8d7f, end: 0x8d95, idx: 10520 }, + { start: 0x8d9e, end: 0x8dd9, idx: 10543 }, + { start: 0x8de4, end: 0x8df4, idx: 10603 }, + { start: 0x8dfd, end: 0x8e16, idx: 10620 }, + { start: 0x8e20, end: 0x8e27, idx: 10646 }, + { start: 0x8e31, end: 0x8e41, idx: 10654 }, + { start: 0x8e4b, end: 0x8e54, idx: 10671 }, + { start: 0x8e5b, end: 0x8e62, idx: 10681 }, + { start: 0x8e69, end: 0x8e71, idx: 10689 }, + { start: 0x8e79, end: 0x8e7b, idx: 10698 }, + { start: 0x8e82, end: 0x8e89, idx: 10701 }, + { start: 0x8e90, end: 0x8ec7, idx: 10709 }, + { start: 0x8ecf, end: 0x8ed4, idx: 10765 }, + { start: 0x8edc, end: 0x8edc, idx: 10771 }, + { start: 0x8ee8, end: 0x8f08, idx: 10772 }, + { start: 0x8f0f, end: 0x8f47, idx: 10805 }, + { start: 0x8f4f, end: 0x8f5e, idx: 10862 }, + { start: 0x8f65, end: 0x8f65, idx: 10878 }, + { start: 0x8f9d, end: 0x8fa6, idx: 10879 }, + { start: 0x8fb5, end: 0x8fd5, idx: 10889 }, + { start: 0x8fe0, end: 0x900c, idx: 10922 }, + { start: 0x9018, end: 0x901b, idx: 10967 }, + { start: 0x9028, end: 0x9037, idx: 10971 }, + { start: 0x903f, end: 0x9044, idx: 10987 }, + { start: 0x904c, end: 0x904c, idx: 10993 }, + { start: 0x905b, end: 0x9079, idx: 10994 }, + { start: 0x9085, end: 0x90a5, idx: 11025 }, + { start: 0x90b0, end: 0x90b6, idx: 11058 }, + { start: 0x90bd, end: 0x90f6, idx: 11065 }, + { start: 0x90fe, end: 0x9148, idx: 11123 }, + { start: 0x914f, end: 0x916d, idx: 11198 }, + { start: 0x9174, end: 0x91c5, idx: 11229 }, + { start: 0x91d3, end: 0x9251, idx: 11311 }, + { start: 0x9258, end: 0x927f, idx: 11438 }, + { start: 0x9288, end: 0x92f0, idx: 11478 }, + { start: 0x92f9, end: 0x9315, idx: 11583 }, + { start: 0x931c, end: 0x932a, idx: 11612 }, + { start: 0x9333, end: 0x9337, idx: 11627 }, + { start: 0x9347, end: 0x9349, idx: 11632 }, + { start: 0x9350, end: 0x93ab, idx: 11635 }, + { start: 0x93b4, end: 0x93ba, idx: 11727 }, + { start: 0x93c1, end: 0x93e7, idx: 11734 }, + { start: 0x93f7, end: 0x9417, idx: 11773 }, + { start: 0x941f, end: 0x941f, idx: 11806 }, + { start: 0x942e, end: 0x9434, idx: 11807 }, + { start: 0x943b, end: 0x944c, idx: 11814 }, + { start: 0x9455, end: 0x9472, idx: 11832 }, + { start: 0x9483, end: 0x9484, idx: 11862 }, + { start: 0x9578, end: 0x958e, idx: 11864 }, + { start: 0x959d, end: 0x95ac, idx: 11887 }, + { start: 0x95b4, end: 0x95bf, idx: 11903 }, + { start: 0x95c6, end: 0x95e6, idx: 11915 }, + { start: 0x961d, end: 0x9641, idx: 11948 }, + { start: 0x9652, end: 0x9658, idx: 11985 }, + { start: 0x9661, end: 0x9661, idx: 11992 }, + { start: 0x966e, end: 0x9674, idx: 11993 }, + { start: 0x967b, end: 0x9689, idx: 12000 }, + { start: 0x9691, end: 0x96b3, idx: 12015 }, + { start: 0x96ba, end: 0x96ba, idx: 12050 }, + { start: 0x96ca, end: 0x96ca, idx: 12051 }, + { start: 0x96d2, end: 0x96df, idx: 12052 }, + { start: 0x96e9, end: 0x96f1, idx: 12066 }, + { start: 0x96fa, end: 0x96fa, idx: 12075 }, + { start: 0x9702, end: 0x9709, idx: 12076 }, + { start: 0x971a, end: 0x9728, idx: 12084 }, + { start: 0x9731, end: 0x9733, idx: 12099 }, + { start: 0x9741, end: 0x9743, idx: 12102 }, + { start: 0x974a, end: 0x975b, idx: 12105 }, + { start: 0x9763, end: 0x9780, idx: 12123 }, + { start: 0x9789, end: 0x9789, idx: 12153 }, + { start: 0x9795, end: 0x97a2, idx: 12154 }, + { start: 0x97ac, end: 0x97e4, idx: 12168 }, + { start: 0x97ef, end: 0x97fa, idx: 12225 }, + { start: 0x9807, end: 0x9835, idx: 12237 }, + { start: 0x983e, end: 0x984a, idx: 12284 }, + { start: 0x9851, end: 0x985a, idx: 12297 }, + { start: 0x9862, end: 0x986c, idx: 12307 }, + { start: 0x98ab, end: 0x98cc, idx: 12318 }, + { start: 0x98e1, end: 0x98ea, idx: 12352 }, + { start: 0x98f3, end: 0x98f6, idx: 12362 }, + { start: 0x9902, end: 0x9908, idx: 12366 }, + { start: 0x9911, end: 0x9960, idx: 12373 }, + { start: 0x999b, end: 0x999f, idx: 12453 }, + { start: 0x99a6, end: 0x99a6, idx: 12458 }, + { start: 0x99b0, end: 0x99c9, idx: 12459 }, + { start: 0x99d3, end: 0x99de, idx: 12485 }, + { start: 0x99e7, end: 0x9a04, idx: 12497 }, + { start: 0x9a0b, end: 0x9a16, idx: 12527 }, + { start: 0x9a1e, end: 0x9a38, idx: 12539 }, + { start: 0x9a41, end: 0x9a56, idx: 12566 }, + { start: 0x9a5d, end: 0x9a5d, idx: 12588 }, + { start: 0x9aaa, end: 0x9b3d, idx: 12589 }, + { start: 0x9b48, end: 0x9b4c, idx: 12737 }, + { start: 0x9b55, end: 0x9b9e, idx: 12742 }, + { start: 0x9ba6, end: 0x9bd0, idx: 12816 }, + { start: 0x9bd7, end: 0x9c02, idx: 12859 }, + { start: 0x9c0b, end: 0x9c2a, idx: 12903 }, + { start: 0x9c31, end: 0x9c7b, idx: 12935 }, + { start: 0x9ce6, end: 0x9ce6, idx: 13010 }, + { start: 0x9cf2, end: 0x9cf9, idx: 13011 }, + { start: 0x9d02, end: 0x9d02, idx: 13019 }, + { start: 0x9d0b, end: 0x9d1e, idx: 13020 }, + { start: 0x9d2f, end: 0x9d4a, idx: 13040 }, + { start: 0x9d53, end: 0x9d54, idx: 13068 }, + { start: 0x9d5f, end: 0x9d98, idx: 13070 }, + { start: 0x9da1, end: 0x9da1, idx: 13128 }, + { start: 0x9daa, end: 0x9dca, idx: 13129 }, + { start: 0x9dd4, end: 0x9df4, idx: 13162 }, + { start: 0x9dfe, end: 0x9e1d, idx: 13195 }, + { start: 0x9e7a, end: 0x9e87, idx: 13227 }, + { start: 0x9e8e, end: 0x9e8f, idx: 13241 }, + { start: 0x9e96, end: 0x9eb5, idx: 13243 }, + { start: 0x9ec6, end: 0x9ecb, idx: 13275 }, + { start: 0x9ed5, end: 0x9ed5, idx: 13281 }, + { start: 0x9edf, end: 0x9ef8, idx: 13282 }, + { start: 0x9eff, end: 0x9f47, idx: 13308 }, + { start: 0x9f53, end: 0x9f5e, idx: 13381 }, + { start: 0x9f68, end: 0x9f7d, idx: 13393 }, + { start: 0x9f8f, end: 0x9f97, idx: 13415 }, + { start: 0x9f9e, end: 0x9fa5, idx: 13424 }, + { start: 0xff5e, end: 0xff5e, idx: 13432 }, + { start: 0xffff, end: 0xffff, idx: 0 } +}; + +/* The values corresponding to the table can be computed using + + egrep '^0x[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]' \ + .../eastasia/jis/jis0212.txt | awk '{ print $2, $1 }' | + sort -u | perl tab.pl + + where tab.pl contains: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $first=$last=$idx=0; + + sub fmt { + printf ("\n ") if (($n % 6) == 0); + ++$n; + my($val) = pop(@_); + printf (" \"\\x%02x\\x%02x\",", + $val < 256 ? $val : int($val / 256), + $val < 256 ? 0 : $val % 256); + } + + while (<>) { + local($ucs,$jis,%rest) = split; + local($u)=hex($ucs); + local($j)=hex($jis); + if ($u - $last > 6) { + if ($last != 0) { + $idx += $last - $first + 1; + } + $first=$u; + } else { + for ($m = $last + 1; $m < $u; ++$m) { + fmt (0); + } + } + fmt ($j); + $last=$u; + } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +const char __jisx0212_from_ucs[][2] = +{ + "\x22\x37", "\x22\x42", "\x00\x00", "\x00\x00", "\x22\x70", "\x00\x00", + "\x22\x43", "\x00\x00", "\x00\x00", "\x22\x6d", "\x22\x6c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x22\x6e", "\x22\x34", "\x22\x31", "\x00\x00", + "\x22\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x22\x44", + "\x2a\x22", "\x2a\x21", "\x2a\x24", "\x2a\x2a", "\x2a\x23", "\x2a\x29", + "\x29\x21", "\x2a\x2e", "\x2a\x32", "\x2a\x31", "\x2a\x34", "\x2a\x33", + "\x2a\x40", "\x2a\x3f", "\x2a\x42", "\x2a\x41", "\x00\x00", "\x2a\x50", + "\x2a\x52", "\x2a\x51", "\x2a\x54", "\x2a\x58", "\x2a\x53", "\x00\x00", + "\x29\x2c", "\x2a\x63", "\x2a\x62", "\x2a\x65", "\x2a\x64", "\x2a\x72", + "\x29\x30", "\x29\x4e", "\x2b\x22", "\x2b\x21", "\x2b\x24", "\x2b\x2a", + "\x2b\x23", "\x2b\x29", "\x29\x41", "\x2b\x2e", "\x2b\x32", "\x2b\x31", + "\x2b\x34", "\x2b\x33", "\x2b\x40", "\x2b\x3f", "\x2b\x42", "\x2b\x41", + "\x29\x43", "\x2b\x50", "\x2b\x52", "\x2b\x51", "\x2b\x54", "\x2b\x58", + "\x2b\x53", "\x00\x00", "\x29\x4c", "\x2b\x63", "\x2b\x62", "\x2b\x65", + "\x2b\x64", "\x2b\x72", "\x29\x50", "\x2b\x73", "\x2a\x27", "\x2b\x27", + "\x2a\x25", "\x2b\x25", "\x2a\x28", "\x2b\x28", "\x2a\x2b", "\x2b\x2b", + "\x2a\x2c", "\x2b\x2c", "\x2a\x2f", "\x2b\x2f", "\x2a\x2d", "\x2b\x2d", + "\x2a\x30", "\x2b\x30", "\x29\x22", "\x29\x42", "\x2a\x37", "\x2b\x37", + "\x00\x00", "\x00\x00", "\x2a\x36", "\x2b\x36", "\x2a\x38", "\x2b\x38", + "\x2a\x35", "\x2b\x35", "\x2a\x3a", "\x2b\x3a", "\x2a\x3b", "\x2b\x3b", + "\x2a\x3d", "\x2b\x3d", "\x2a\x3c", "\x00\x00", "\x2a\x3e", "\x2b\x3e", + "\x29\x24", "\x29\x44", "\x2a\x47", "\x2b\x47", "\x2a\x45", "\x2b\x45", + "\x00\x00", "\x00\x00", "\x2a\x46", "\x2b\x46", "\x2a\x44", "\x29\x45", + "\x29\x26", "\x29\x46", "\x2a\x48", "\x2b\x48", "\x2a\x49", "\x2b\x49", + "\x29\x47", "\x2a\x4a", "\x2b\x4a", "\x2a\x4c", "\x2b\x4c", "\x2a\x4b", + "\x2b\x4b", "\x29\x29", "\x29\x49", "\x29\x28", "\x29\x48", "\x2a\x4d", + "\x2b\x4d", "\x2a\x4f", "\x2b\x4f", "\x2a\x4e", "\x2b\x4e", "\x29\x4a", + "\x29\x2b", "\x29\x4b", "\x2a\x57", "\x2b\x57", "\x00\x00", "\x00\x00", + "\x2a\x56", "\x2b\x56", "\x29\x2d", "\x29\x4d", "\x2a\x59", "\x2b\x59", + "\x2a\x5b", "\x2b\x5b", "\x2a\x5a", "\x2b\x5a", "\x2a\x5c", "\x2b\x5c", + "\x2a\x5d", "\x2b\x5d", "\x2a\x5f", "\x2b\x5f", "\x2a\x5e", "\x2b\x5e", + "\x2a\x61", "\x2b\x61", "\x2a\x60", "\x2b\x60", "\x29\x2f", "\x29\x4f", + "\x2a\x6c", "\x2b\x6c", "\x2a\x69", "\x2b\x69", "\x2a\x66", "\x2b\x66", + "\x2a\x6b", "\x2b\x6b", "\x2a\x68", "\x2b\x68", "\x2a\x6a", "\x2b\x6a", + "\x2a\x71", "\x2b\x71", "\x2a\x74", "\x2b\x74", "\x2a\x73", "\x2a\x75", + "\x2b\x75", "\x2a\x77", "\x2b\x77", "\x2a\x76", "\x2b\x76", "\x2a\x26", + "\x2b\x26", "\x2a\x43", "\x2b\x43", "\x2a\x55", "\x2b\x55", "\x2a\x67", + "\x2b\x67", "\x2a\x70", "\x2b\x70", "\x2a\x6d", "\x2b\x6d", "\x2a\x6f", + "\x2b\x6f", "\x2a\x6e", "\x2b\x6e", "\x2b\x39", "\x22\x30", "\x22\x2f", + "\x22\x32", "\x22\x36", "\x22\x35", "\x00\x00", "\x22\x33", "\x22\x38", + "\x22\x39", "\x26\x61", "\x00\x00", "\x26\x62", "\x26\x63", "\x26\x64", + "\x00\x00", "\x26\x67", "\x00\x00", "\x26\x69", "\x26\x6c", "\x26\x76", + "\x26\x65", "\x26\x6a", "\x26\x71", "\x26\x72", "\x26\x73", "\x26\x74", + "\x26\x7b", "\x26\x78", "\x26\x75", "\x26\x7a", "\x26\x77", "\x26\x79", + "\x26\x7c", "\x27\x42", "\x27\x43", "\x27\x44", "\x27\x45", "\x27\x46", + "\x27\x47", "\x27\x48", "\x27\x49", "\x27\x4a", "\x27\x4b", "\x27\x4c", + "\x00\x00", "\x27\x4d", "\x27\x4e", "\x27\x72", "\x27\x73", "\x27\x74", + "\x27\x75", "\x27\x76", "\x27\x77", "\x27\x78", "\x27\x79", "\x27\x7a", + "\x27\x7b", "\x27\x7c", "\x00\x00", "\x27\x7d", "\x27\x7e", "\x22\x71", + "\x22\x6f", "\x30\x21", "\x00\x00", "\x30\x22", "\x30\x23", "\x30\x24", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x25", + "\x30\x26", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x27", "\x30\x28", + "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x29", "\x00\x00", "\x00\x00", + "\x30\x2a", "\x00\x00", "\x00\x00", "\x30\x2b", "\x30\x2c", "\x30\x2d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x2e", "\x30\x2f", + "\x30\x30", "\x00\x00", "\x00\x00", "\x30\x31", "\x00\x00", "\x00\x00", + "\x30\x32", "\x30\x33", "\x30\x34", "\x00\x00", "\x30\x35", "\x30\x36", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x37", "\x30\x38", + "\x30\x39", "\x30\x3a", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x3c", + "\x30\x3d", "\x30\x3e", "\x30\x3f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x30\x40", "\x30\x41", "\x30\x42", "\x30\x43", + "\x30\x44", "\x30\x45", "\x30\x46", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x30\x47", "\x30\x48", "\x30\x49", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x4a", "\x30\x4b", "\x00\x00", + "\x30\x4c", "\x00\x00", "\x30\x4d", "\x00\x00", "\x30\x4e", "\x30\x4f", + "\x30\x50", "\x30\x51", "\x30\x52", "\x00\x00", "\x30\x53", "\x30\x54", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x55", "\x00\x00", + "\x00\x00", "\x30\x56", "\x30\x57", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x30\x58", "\x00\x00", "\x00\x00", "\x30\x59", + "\x30\x5a", "\x30\x5b", "\x00\x00", "\x30\x5c", "\x30\x5d", "\x00\x00", + "\x00\x00", "\x30\x5e", "\x00\x00", "\x30\x60", "\x00\x00", "\x30\x61", + "\x00\x00", "\x30\x62", "\x00\x00", "\x30\x63", "\x00\x00", "\x30\x64", + "\x00\x00", "\x00\x00", "\x30\x65", "\x00\x00", "\x30\x66", "\x00\x00", + "\x30\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x30\x68", "\x30\x69", "\x00\x00", "\x30\x6a", "\x30\x6b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x6c", "\x00\x00", + "\x30\x6d", "\x00\x00", "\x30\x6e", "\x00\x00", "\x30\x6f", "\x30\x70", + "\x30\x5f", "\x00\x00", "\x00\x00", "\x30\x71", "\x30\x72", "\x00\x00", + "\x30\x73", "\x00\x00", "\x30\x74", "\x00\x00", "\x00\x00", "\x30\x75", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x30\x76", + "\x30\x77", "\x30\x78", "\x30\x79", "\x00\x00", "\x00\x00", "\x30\x7a", + "\x30\x7b", "\x00\x00", "\x00\x00", "\x30\x7c", "\x30\x7d", "\x00\x00", + "\x30\x7e", "\x31\x21", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x22", + "\x31\x23", "\x00\x00", "\x31\x24", "\x00\x00", "\x31\x25", "\x00\x00", + "\x31\x26", "\x00\x00", "\x31\x27", "\x31\x28", "\x31\x29", "\x00\x00", + "\x00\x00", "\x31\x2a", "\x00\x00", "\x31\x2b", "\x31\x2c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x31\x2d", "\x31\x2e", "\x31\x2f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x30", "\x00\x00", "\x31\x31", + "\x00\x00", "\x31\x32", "\x31\x33", "\x31\x34", "\x31\x35", "\x00\x00", + "\x31\x36", "\x31\x37", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x38", + "\x31\x39", "\x00\x00", "\x31\x3a", "\x31\x3b", "\x00\x00", "\x31\x3c", + "\x31\x3d", "\x31\x3e", "\x00\x00", "\x31\x3f", "\x00\x00", "\x00\x00", + "\x31\x40", "\x31\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x42", + "\x00\x00", "\x31\x43", "\x31\x44", "\x00\x00", "\x31\x45", "\x31\x46", + "\x31\x47", "\x00\x00", "\x31\x48", "\x31\x49", "\x31\x4a", "\x00\x00", + "\x00\x00", "\x31\x4b", "\x00\x00", "\x00\x00", "\x31\x4c", "\x00\x00", + "\x00\x00", "\x31\x4d", "\x00\x00", "\x31\x4e", "\x00\x00", "\x31\x4f", + "\x00\x00", "\x31\x50", "\x00\x00", "\x00\x00", "\x31\x51", "\x00\x00", + "\x00\x00", "\x00\x00", "\x31\x52", "\x31\x53", "\x00\x00", "\x00\x00", + "\x31\x54", "\x31\x55", "\x31\x56", "\x31\x57", "\x00\x00", "\x00\x00", + "\x00\x00", "\x31\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x31\x59", "\x31\x5a", "\x00\x00", "\x31\x5b", "\x00\x00", "\x31\x5c", + "\x31\x5d", "\x00\x00", "\x31\x5e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x31\x76", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x31\x5f", "\x31\x60", "\x31\x61", "\x00\x00", "\x00\x00", + "\x31\x62", "\x31\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x64", + "\x00\x00", "\x31\x65", "\x00\x00", "\x31\x66", "\x00\x00", "\x00\x00", + "\x31\x67", "\x31\x68", "\x31\x69", "\x00\x00", "\x00\x00", "\x00\x00", + "\x31\x6a", "\x00\x00", "\x31\x6b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x31\x6c", "\x31\x6d", "\x00\x00", "\x31\x6e", + "\x31\x6f", "\x00\x00", "\x00\x00", "\x31\x70", "\x31\x71", "\x00\x00", + "\x00\x00", "\x31\x72", "\x00\x00", "\x00\x00", "\x31\x73", "\x00\x00", + "\x00\x00", "\x31\x74", "\x31\x75", "\x31\x77", "\x00\x00", "\x31\x78", + "\x31\x79", "\x00\x00", "\x31\x7a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x31\x7b", "\x00\x00", "\x00\x00", "\x00\x00", "\x31\x7c", "\x31\x7d", + "\x31\x7e", "\x00\x00", "\x32\x21", "\x32\x22", "\x32\x23", "\x00\x00", + "\x32\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x25", + "\x32\x26", "\x00\x00", "\x32\x27", "\x32\x28", "\x32\x29", "\x32\x2a", + "\x32\x2b", "\x32\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x32\x2d", "\x32\x2e", "\x32\x2f", "\x32\x30", "\x00\x00", "\x00\x00", + "\x32\x31", "\x00\x00", "\x00\x00", "\x32\x32", "\x00\x00", "\x00\x00", + "\x32\x33", "\x32\x34", "\x00\x00", "\x00\x00", "\x32\x35", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x36", "\x00\x00", "\x32\x37", + "\x00\x00", "\x32\x38", "\x00\x00", "\x00\x00", "\x32\x39", "\x32\x3a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x3b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x32\x3c", "\x32\x3d", "\x00\x00", "\x32\x3e", "\x00\x00", + "\x00\x00", "\x32\x3f", "\x00\x00", "\x32\x40", "\x00\x00", "\x32\x41", + "\x00\x00", "\x32\x42", "\x32\x43", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x32\x44", "\x00\x00", "\x32\x45", "\x32\x51", + "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x46", "\x00\x00", "\x00\x00", + "\x00\x00", "\x32\x47", "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x48", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x49", "\x00\x00", + "\x00\x00", "\x32\x4a", "\x32\x4b", "\x32\x4c", "\x00\x00", "\x00\x00", + "\x32\x4d", "\x32\x4e", "\x32\x4f", "\x32\x50", "\x00\x00", "\x32\x52", + "\x32\x53", "\x00\x00", "\x32\x54", "\x00\x00", "\x32\x55", "\x32\x56", + "\x32\x57", "\x32\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x32\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x5a", "\x32\x5b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x5c", "\x32\x5d", "\x00\x00", + "\x32\x5e", "\x00\x00", "\x32\x5f", "\x00\x00", "\x32\x60", "\x32\x61", + "\x32\x62", "\x00\x00", "\x00\x00", "\x32\x63", "\x32\x64", "\x32\x65", + "\x32\x66", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x67", + "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x68", "\x00\x00", "\x32\x69", + "\x00\x00", "\x32\x6a", "\x32\x6b", "\x32\x6c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x32\x6d", "\x00\x00", "\x32\x6e", "\x32\x6f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x70", "\x32\x71", + "\x32\x72", "\x00\x00", "\x00\x00", "\x32\x73", "\x32\x74", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x32\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x32\x76", "\x00\x00", "\x32\x77", "\x32\x78", "\x32\x79", + "\x00\x00", "\x32\x7a", "\x00\x00", "\x32\x7b", "\x00\x00", "\x32\x7c", + "\x32\x7d", "\x00\x00", "\x00\x00", "\x32\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x21", "\x33\x22", "\x00\x00", + "\x33\x23", "\x33\x24", "\x33\x25", "\x00\x00", "\x33\x26", "\x00\x00", + "\x00\x00", "\x33\x27", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x33\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x29", + "\x00\x00", "\x00\x00", "\x33\x2a", "\x33\x2b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x33\x2c", "\x33\x2d", "\x33\x2e", "\x00\x00", "\x00\x00", + "\x33\x2f", "\x33\x30", "\x33\x31", "\x00\x00", "\x00\x00", "\x33\x32", + "\x33\x33", "\x33\x34", "\x00\x00", "\x33\x35", "\x33\x36", "\x00\x00", + "\x33\x37", "\x33\x38", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x33\x39", "\x33\x3a", "\x33\x3b", "\x00\x00", "\x00\x00", + "\x33\x3c", "\x33\x3d", "\x33\x3e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x33\x3f", "\x33\x40", "\x00\x00", "\x33\x41", "\x33\x42", "\x00\x00", + "\x33\x43", "\x00\x00", "\x33\x44", "\x00\x00", "\x00\x00", "\x33\x45", + "\x33\x46", "\x33\x47", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x33\x48", "\x33\x49", "\x33\x4a", "\x33\x4b", "\x33\x4c", "\x33\x4d", + "\x00\x00", "\x33\x4e", "\x00\x00", "\x00\x00", "\x33\x4f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x50", "\x00\x00", "\x33\x51", + "\x33\x52", "\x00\x00", "\x33\x53", "\x33\x54", "\x33\x55", "\x33\x56", + "\x00\x00", "\x33\x57", "\x00\x00", "\x33\x58", "\x33\x59", "\x33\x5a", + "\x33\x5b", "\x33\x5c", "\x33\x5d", "\x33\x5e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x5f", "\x33\x60", "\x33\x61", + "\x00\x00", "\x33\x62", "\x33\x63", "\x00\x00", "\x33\x64", "\x00\x00", + "\x00\x00", "\x33\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x66", + "\x00\x00", "\x33\x67", "\x00\x00", "\x33\x68", "\x00\x00", "\x00\x00", + "\x00\x00", "\x33\x69", "\x00\x00", "\x00\x00", "\x33\x6a", "\x00\x00", + "\x33\x6b", "\x00\x00", "\x00\x00", "\x33\x6c", "\x00\x00", "\x33\x6d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x6e", "\x33\x6f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x33\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x33\x71", "\x00\x00", "\x00\x00", "\x33\x72", + "\x33\x73", "\x33\x74", "\x00\x00", "\x33\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x33\x76", "\x33\x77", "\x00\x00", "\x00\x00", "\x33\x78", + "\x00\x00", "\x33\x79", "\x33\x7a", "\x33\x7b", "\x00\x00", "\x00\x00", + "\x33\x7c", "\x33\x7d", "\x33\x7e", "\x34\x21", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x22", "\x00\x00", "\x34\x23", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x24", "\x00\x00", "\x00\x00", + "\x34\x25", "\x34\x26", "\x00\x00", "\x34\x27", "\x34\x28", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x29", "\x00\x00", + "\x34\x2a", "\x34\x2b", "\x34\x2c", "\x00\x00", "\x34\x2d", "\x34\x2e", + "\x34\x2f", "\x00\x00", "\x00\x00", "\x34\x30", "\x00\x00", "\x34\x31", + "\x00\x00", "\x00\x00", "\x34\x32", "\x34\x33", "\x34\x34", "\x34\x35", + "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x36", "\x34\x38", "\x34\x37", + "\x34\x39", "\x00\x00", "\x34\x3a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x3b", "\x00\x00", "\x34\x3c", "\x00\x00", + "\x34\x3d", "\x34\x3e", "\x34\x3f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x34\x40", "\x34\x41", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x34\x42", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x44", "\x34\x45", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x46", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x47", "\x34\x48", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x49", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x4b", "\x00\x00", "\x00\x00", "\x34\x4c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x34\x4d", "\x34\x4e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x4f", "\x00\x00", "\x00\x00", "\x34\x50", + "\x00\x00", "\x34\x51", "\x34\x52", "\x00\x00", "\x34\x53", "\x34\x54", + "\x00\x00", "\x34\x55", "\x00\x00", "\x00\x00", "\x34\x56", "\x00\x00", + "\x00\x00", "\x34\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x58", "\x34\x59", "\x00\x00", "\x00\x00", "\x34\x5a", "\x34\x5b", + "\x00\x00", "\x34\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x5d", "\x00\x00", "\x00\x00", "\x34\x5e", "\x34\x5f", "\x00\x00", + "\x34\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x61", "\x34\x62", "\x34\x63", "\x34\x64", "\x34\x65", "\x34\x66", + "\x34\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x34\x68", "\x34\x69", "\x00\x00", "\x34\x6a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x6b", "\x00\x00", "\x34\x6c", "\x00\x00", + "\x00\x00", "\x34\x6d", "\x34\x6e", "\x34\x6f", "\x34\x70", "\x00\x00", + "\x00\x00", "\x34\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x34\x72", "\x00\x00", "\x34\x73", "\x34\x74", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x75", "\x00\x00", "\x34\x76", "\x00\x00", + "\x34\x77", "\x34\x78", "\x00\x00", "\x34\x79", "\x00\x00", "\x34\x7a", + "\x00\x00", "\x34\x7b", "\x34\x7c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x34\x7d", "\x34\x7e", "\x00\x00", "\x35\x21", + "\x00\x00", "\x35\x22", "\x00\x00", "\x35\x23", "\x00\x00", "\x00\x00", + "\x35\x24", "\x35\x25", "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x26", + "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x27", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x28", "\x35\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x35\x2a", "\x00\x00", "\x00\x00", "\x35\x2b", + "\x00\x00", "\x35\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x35\x2d", "\x35\x2e", "\x00\x00", "\x35\x2f", "\x35\x30", "\x00\x00", + "\x00\x00", "\x35\x31", "\x35\x32", "\x00\x00", "\x00\x00", "\x35\x33", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x34", + "\x00\x00", "\x35\x35", "\x35\x36", "\x35\x37", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x38", "\x35\x39", "\x00\x00", "\x00\x00", "\x00\x00", + "\x35\x3a", "\x00\x00", "\x00\x00", "\x35\x3b", "\x35\x3c", "\x35\x3d", + "\x35\x3e", "\x00\x00", "\x35\x3f", "\x00\x00", "\x00\x00", "\x35\x40", + "\x35\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x35\x42", "\x00\x00", "\x35\x43", "\x35\x44", "\x35\x45", "\x35\x46", + "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x47", "\x00\x00", "\x00\x00", + "\x35\x48", "\x35\x49", "\x00\x00", "\x00\x00", "\x35\x4a", "\x35\x4b", + "\x35\x4c", "\x35\x4d", "\x35\x4e", "\x35\x4f", "\x35\x50", "\x00\x00", + "\x00\x00", "\x35\x51", "\x35\x52", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x53", "\x35\x54", "\x35\x55", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x56", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x35\x57", "\x00\x00", "\x35\x58", "\x35\x59", "\x00\x00", + "\x00\x00", "\x35\x5a", "\x00\x00", "\x00\x00", "\x35\x5b", "\x35\x5c", + "\x35\x5d", "\x00\x00", "\x35\x5e", "\x35\x5f", "\x00\x00", "\x00\x00", + "\x35\x60", "\x00\x00", "\x35\x61", "\x35\x62", "\x00\x00", "\x00\x00", + "\x35\x63", "\x00\x00", "\x35\x64", "\x35\x65", "\x00\x00", "\x35\x66", + "\x35\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x68", "\x00\x00", + "\x35\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x35\x6a", "\x35\x6b", "\x00\x00", "\x35\x6c", "\x35\x6d", "\x35\x6e", + "\x35\x6f", "\x00\x00", "\x00\x00", "\x35\x70", "\x35\x71", "\x35\x72", + "\x35\x73", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x35\x74", + "\x35\x75", "\x00\x00", "\x35\x76", "\x00\x00", "\x35\x77", "\x00\x00", + "\x00\x00", "\x35\x78", "\x00\x00", "\x00\x00", "\x35\x79", "\x00\x00", + "\x35\x7a", "\x35\x7b", "\x00\x00", "\x35\x7c", "\x00\x00", "\x00\x00", + "\x35\x7d", "\x35\x7e", "\x36\x21", "\x00\x00", "\x00\x00", "\x00\x00", + "\x36\x22", "\x36\x23", "\x00\x00", "\x00\x00", "\x36\x24", "\x00\x00", + "\x00\x00", "\x36\x25", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x26", + "\x36\x27", "\x36\x28", "\x36\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x36\x2a", "\x00\x00", "\x00\x00", "\x36\x2b", + "\x00\x00", "\x36\x2c", "\x00\x00", "\x00\x00", "\x36\x2d", "\x36\x2e", + "\x36\x2f", "\x36\x30", "\x36\x31", "\x36\x32", "\x36\x33", "\x36\x34", + "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x35", "\x00\x00", "\x00\x00", + "\x36\x36", "\x00\x00", "\x36\x37", "\x00\x00", "\x36\x38", "\x00\x00", + "\x36\x39", "\x00\x00", "\x36\x3a", "\x36\x3b", "\x36\x3c", "\x00\x00", + "\x36\x3d", "\x36\x3e", "\x36\x3f", "\x00\x00", "\x36\x40", "\x36\x41", + "\x00\x00", "\x36\x42", "\x00\x00", "\x00\x00", "\x36\x43", "\x00\x00", + "\x36\x44", "\x00\x00", "\x36\x45", "\x00\x00", "\x36\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x47", "\x36\x48", "\x00\x00", + "\x36\x49", "\x36\x4a", "\x36\x4b", "\x36\x4c", "\x00\x00", "\x00\x00", + "\x36\x4d", "\x00\x00", "\x00\x00", "\x36\x4e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x36\x4f", "\x00\x00", "\x36\x50", "\x00\x00", "\x36\x51", + "\x36\x52", "\x00\x00", "\x00\x00", "\x36\x53", "\x36\x54", "\x36\x55", + "\x00\x00", "\x00\x00", "\x36\x56", "\x00\x00", "\x00\x00", "\x36\x57", + "\x36\x58", "\x36\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x5a", + "\x36\x5b", "\x00\x00", "\x00\x00", "\x36\x5c", "\x36\x5d", "\x36\x5e", + "\x36\x5f", "\x36\x60", "\x36\x61", "\x36\x62", "\x00\x00", "\x36\x63", + "\x36\x64", "\x36\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x66", + "\x00\x00", "\x36\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x68", + "\x36\x69", "\x36\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x36\x6b", + "\x36\x6c", "\x36\x6d", "\x36\x70", "\x36\x71", "\x00\x00", "\x36\x6e", + "\x36\x6f", "\x36\x72", "\x00\x00", "\x00\x00", "\x36\x73", "\x36\x74", + "\x00\x00", "\x36\x75", "\x00\x00", "\x36\x76", "\x00\x00", "\x00\x00", + "\x36\x77", "\x36\x78", "\x36\x79", "\x36\x7a", "\x36\x7b", "\x00\x00", + "\x00\x00", "\x36\x7d", "\x00\x00", "\x36\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x36\x7c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x21", "\x37\x22", "\x37\x23", "\x37\x24", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x37\x25", "\x00\x00", "\x00\x00", "\x37\x26", + "\x00\x00", "\x37\x27", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x29", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x2a", "\x37\x2b", "\x00\x00", + "\x37\x2c", "\x00\x00", "\x00\x00", "\x37\x2d", "\x00\x00", "\x37\x2e", + "\x37\x2f", "\x37\x30", "\x37\x31", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x32", "\x37\x33", "\x00\x00", "\x37\x34", "\x00\x00", "\x37\x35", + "\x37\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x37", "\x37\x38", + "\x37\x39", "\x37\x3a", "\x37\x3b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x37\x3c", "\x37\x3d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x3e", "\x37\x3f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x40", "\x37\x41", "\x00\x00", + "\x00\x00", "\x37\x42", "\x00\x00", "\x37\x43", "\x37\x44", "\x00\x00", + "\x00\x00", "\x37\x45", "\x00\x00", "\x37\x46", "\x37\x47", "\x37\x48", + "\x37\x49", "\x37\x4a", "\x00\x00", "\x37\x4b", "\x37\x4c", "\x37\x4d", + "\x00\x00", "\x37\x4e", "\x00\x00", "\x37\x4f", "\x37\x50", "\x37\x51", + "\x37\x52", "\x00\x00", "\x37\x53", "\x00\x00", "\x00\x00", "\x37\x54", + "\x00\x00", "\x37\x55", "\x37\x56", "\x37\x57", "\x37\x60", "\x00\x00", + "\x37\x58", "\x00\x00", "\x37\x59", "\x37\x5a", "\x00\x00", "\x37\x5b", + "\x37\x5c", "\x37\x5d", "\x37\x5e", "\x00\x00", "\x37\x5f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x61", "\x37\x62", + "\x37\x63", "\x00\x00", "\x00\x00", "\x37\x64", "\x37\x65", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x66", "\x37\x67", "\x37\x68", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x69", "\x00\x00", "\x00\x00", + "\x37\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x37\x6b", "\x37\x6c", "\x37\x6d", "\x00\x00", "\x00\x00", "\x37\x7e", + "\x00\x00", "\x00\x00", "\x37\x6e", "\x00\x00", "\x37\x6f", "\x37\x70", + "\x00\x00", "\x37\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x72", + "\x00\x00", "\x00\x00", "\x37\x73", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x37\x74", "\x37\x75", "\x00\x00", "\x37\x76", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x77", "\x37\x78", "\x37\x79", + "\x00\x00", "\x00\x00", "\x00\x00", "\x37\x7a", "\x37\x7b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x37\x7c", "\x37\x7d", "\x00\x00", "\x00\x00", + "\x38\x21", "\x38\x22", "\x38\x23", "\x00\x00", "\x00\x00", "\x38\x24", + "\x38\x25", "\x38\x26", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x38\x27", "\x38\x28", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x38\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x38\x2a", "\x38\x2b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x38\x2c", "\x38\x2d", "\x00\x00", "\x00\x00", + "\x38\x2e", "\x38\x2f", "\x00\x00", "\x38\x30", "\x38\x31", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x32", "\x38\x33", "\x00\x00", + "\x38\x34", "\x00\x00", "\x00\x00", "\x38\x35", "\x00\x00", "\x00\x00", + "\x38\x36", "\x38\x37", "\x38\x38", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x39", "\x00\x00", "\x00\x00", "\x38\x3a", "\x38\x3b", "\x38\x3c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x3d", + "\x38\x3e", "\x38\x3f", "\x38\x40", "\x00\x00", "\x38\x41", "\x38\x42", + "\x00\x00", "\x38\x43", "\x38\x44", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x45", "\x00\x00", "\x38\x46", "\x38\x47", "\x00\x00", "\x00\x00", + "\x38\x48", "\x38\x49", "\x38\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x4b", "\x00\x00", "\x00\x00", "\x38\x4c", "\x38\x4d", "\x38\x4e", + "\x38\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x51", "\x00\x00", "\x38\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x53", + "\x38\x54", "\x00\x00", "\x38\x55", "\x00\x00", "\x38\x56", "\x00\x00", + "\x38\x57", "\x00\x00", "\x38\x58", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x59", "\x00\x00", "\x00\x00", "\x38\x5a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x38\x5b", "\x38\x5c", "\x38\x5d", "\x38\x5e", "\x38\x5f", + "\x38\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x61", + "\x38\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x38\x63", "\x38\x64", "\x38\x65", "\x38\x67", "\x00\x00", "\x00\x00", + "\x00\x00", "\x38\x68", "\x00\x00", "\x38\x69", "\x38\x6a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x38\x6b", "\x38\x6c", "\x38\x6d", "\x00\x00", + "\x00\x00", "\x38\x6e", "\x00\x00", "\x38\x6f", "\x38\x70", "\x38\x71", + "\x00\x00", "\x00\x00", "\x00\x00", "\x38\x72", "\x00\x00", "\x00\x00", + "\x38\x73", "\x38\x74", "\x38\x75", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x38\x76", "\x00\x00", "\x38\x77", "\x00\x00", + "\x38\x78", "\x38\x79", "\x38\x7a", "\x00\x00", "\x38\x7b", "\x00\x00", + "\x38\x7c", "\x38\x7d", "\x00\x00", "\x38\x7e", "\x00\x00", "\x39\x21", + "\x00\x00", "\x00\x00", "\x39\x22", "\x00\x00", "\x00\x00", "\x39\x23", + "\x39\x24", "\x00\x00", "\x00\x00", "\x39\x25", "\x00\x00", "\x39\x26", + "\x39\x27", "\x39\x28", "\x39\x29", "\x00\x00", "\x39\x2a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x39\x2b", "\x00\x00", "\x00\x00", "\x39\x2c", + "\x00\x00", "\x39\x2d", "\x39\x2e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x39\x2f", "\x00\x00", "\x00\x00", "\x39\x30", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x31", "\x39\x32", + "\x39\x33", "\x39\x34", "\x00\x00", "\x00\x00", "\x39\x35", "\x00\x00", + "\x00\x00", "\x00\x00", "\x39\x36", "\x00\x00", "\x00\x00", "\x39\x37", + "\x00\x00", "\x39\x38", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x39\x39", "\x00\x00", "\x39\x3a", "\x39\x3b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x39\x3c", "\x00\x00", "\x39\x3d", "\x00\x00", "\x00\x00", + "\x39\x3e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x3f", + "\x39\x40", "\x39\x41", "\x39\x42", "\x00\x00", "\x00\x00", "\x00\x00", + "\x39\x43", "\x39\x44", "\x00\x00", "\x00\x00", "\x39\x45", "\x39\x46", + "\x39\x47", "\x00\x00", "\x39\x48", "\x39\x49", "\x00\x00", "\x39\x4a", + "\x00\x00", "\x00\x00", "\x39\x4b", "\x39\x4c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x39\x4d", "\x39\x4e", "\x39\x4f", "\x39\x50", "\x00\x00", + "\x00\x00", "\x00\x00", "\x39\x51", "\x39\x52", "\x39\x53", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x54", "\x39\x55", "\x00\x00", + "\x00\x00", "\x39\x56", "\x39\x57", "\x00\x00", "\x39\x58", "\x00\x00", + "\x00\x00", "\x39\x59", "\x00\x00", "\x00\x00", "\x39\x5a", "\x39\x5b", + "\x39\x5c", "\x00\x00", "\x39\x5d", "\x39\x5e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x39\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x60", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x61", "\x39\x62", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x63", "\x00\x00", + "\x39\x64", "\x00\x00", "\x39\x65", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x39\x66", "\x39\x67", "\x00\x00", "\x00\x00", + "\x39\x68", "\x39\x69", "\x00\x00", "\x00\x00", "\x39\x6a", "\x39\x6b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x6c", "\x00\x00", + "\x00\x00", "\x39\x6d", "\x00\x00", "\x00\x00", "\x39\x6e", "\x00\x00", + "\x00\x00", "\x39\x6f", "\x00\x00", "\x00\x00", "\x39\x70", "\x00\x00", + "\x39\x71", "\x39\x72", "\x39\x73", "\x00\x00", "\x39\x74", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x39\x76", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x39\x77", "\x39\x78", "\x39\x79", "\x00\x00", "\x39\x7a", + "\x00\x00", "\x00\x00", "\x39\x7b", "\x00\x00", "\x39\x7c", "\x39\x7d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x39\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3a\x21", "\x00\x00", "\x3a\x22", "\x00\x00", + "\x3a\x23", "\x3a\x24", "\x3a\x25", "\x00\x00", "\x3a\x26", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3a\x27", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3a\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3a\x29", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x2a", "\x3a\x2b", + "\x3a\x2c", "\x3a\x2d", "\x00\x00", "\x00\x00", "\x3a\x2e", "\x3a\x2f", + "\x3a\x30", "\x3a\x31", "\x00\x00", "\x3a\x33", "\x00\x00", "\x3a\x34", + "\x00\x00", "\x3a\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x36", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x37", "\x3a\x38", "\x3a\x32", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x39", "\x3a\x3a", "\x3a\x3b", + "\x3a\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3a\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x3e", "\x3a\x3f", + "\x3a\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3a\x41", "\x3a\x42", "\x3a\x43", "\x3a\x44", "\x3a\x45", "\x3a\x46", + "\x00\x00", "\x3a\x47", "\x00\x00", "\x00\x00", "\x3a\x48", "\x00\x00", + "\x3a\x49", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x4a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3a\x4b", "\x00\x00", "\x3a\x4c", "\x3a\x4d", + "\x00\x00", "\x3a\x4e", "\x3a\x4f", "\x00\x00", "\x3a\x50", "\x3a\x51", + "\x3a\x52", "\x00\x00", "\x00\x00", "\x3a\x53", "\x3a\x54", "\x00\x00", + "\x3a\x55", "\x00\x00", "\x3a\x56", "\x3a\x57", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3a\x58", "\x00\x00", "\x00\x00", "\x3a\x59", + "\x00\x00", "\x3a\x5a", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x5b", + "\x3a\x5c", "\x3a\x5d", "\x00\x00", "\x3a\x5e", "\x3a\x5f", "\x3a\x60", + "\x3a\x61", "\x3a\x62", "\x3a\x63", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3a\x64", "\x3a\x65", "\x00\x00", "\x3a\x66", + "\x00\x00", "\x00\x00", "\x3a\x67", "\x3a\x68", "\x3a\x69", "\x3a\x6a", + "\x3a\x6b", "\x3a\x6c", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x6d", + "\x00\x00", "\x00\x00", "\x3a\x6e", "\x00\x00", "\x00\x00", "\x3a\x6f", + "\x00\x00", "\x3a\x70", "\x3a\x71", "\x00\x00", "\x3a\x72", "\x00\x00", + "\x3a\x73", "\x00\x00", "\x3a\x74", "\x00\x00", "\x00\x00", "\x3a\x75", + "\x3a\x76", "\x3a\x77", "\x3a\x78", "\x00\x00", "\x3a\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x7a", "\x3a\x7b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3a\x7c", "\x3a\x7d", "\x3a\x7e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x21", "\x00\x00", "\x00\x00", + "\x3b\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x23", "\x3b\x24", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x25", "\x3b\x26", + "\x3b\x27", "\x3b\x28", "\x3b\x29", "\x3b\x2a", "\x00\x00", "\x3b\x2b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x2c", "\x00\x00", + "\x00\x00", "\x3b\x2d", "\x3b\x2e", "\x00\x00", "\x3b\x2f", "\x3b\x30", + "\x00\x00", "\x3b\x31", "\x3b\x32", "\x00\x00", "\x00\x00", "\x3b\x33", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x34", "\x3b\x35", "\x00\x00", + "\x3b\x36", "\x3b\x37", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3b\x38", "\x3b\x39", "\x00\x00", "\x3b\x3a", "\x3b\x3b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x3d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x3c", "\x3b\x3e", "\x00\x00", + "\x00\x00", "\x3b\x3f", "\x3b\x40", "\x00\x00", "\x3b\x41", "\x3b\x42", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x43", "\x3b\x44", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x45", "\x3b\x47", + "\x3b\x48", "\x00\x00", "\x3b\x49", "\x3b\x4a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3b\x46", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3b\x4b", "\x00\x00", "\x00\x00", "\x3b\x4c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x4d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3b\x4e", "\x00\x00", "\x3b\x4f", "\x00\x00", "\x00\x00", + "\x3b\x50", "\x3b\x51", "\x00\x00", "\x00\x00", "\x3b\x52", "\x00\x00", + "\x3b\x53", "\x00\x00", "\x3b\x57", "\x3b\x55", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3b\x54", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x56", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x58", + "\x3b\x59", "\x3b\x5a", "\x3b\x5b", "\x00\x00", "\x3b\x5c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x5d", "\x00\x00", + "\x00\x00", "\x3b\x5e", "\x00\x00", "\x00\x00", "\x3b\x5f", "\x3b\x60", + "\x3b\x61", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x62", "\x3b\x63", + "\x00\x00", "\x3b\x64", "\x00\x00", "\x3b\x65", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3b\x66", "\x00\x00", "\x3b\x67", "\x3b\x68", + "\x3b\x69", "\x3b\x6a", "\x3b\x6b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3b\x6c", "\x00\x00", "\x3b\x6d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3b\x6e", "\x3b\x6f", "\x3b\x70", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3b\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x72", + "\x00\x00", "\x66\x74", "\x00\x00", "\x3b\x73", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3b\x74", "\x3b\x75", "\x3b\x76", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3b\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x78", + "\x00\x00", "\x00\x00", "\x3b\x7a", "\x00\x00", "\x3b\x79", "\x3b\x7b", + "\x3b\x7c", "\x3b\x7d", "\x00\x00", "\x00\x00", "\x00\x00", "\x3b\x7e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x21", "\x3c\x22", + "\x3c\x23", "\x3c\x24", "\x3c\x25", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3c\x26", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3c\x27", "\x00\x00", "\x3c\x28", "\x3c\x29", "\x00\x00", + "\x00\x00", "\x3c\x2a", "\x3c\x2b", "\x3c\x2c", "\x3c\x2e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x2d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3c\x2f", "\x00\x00", "\x00\x00", "\x3c\x30", + "\x3c\x31", "\x3c\x34", "\x00\x00", "\x3c\x32", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3c\x33", "\x3c\x35", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3c\x36", "\x00\x00", "\x3c\x37", "\x00\x00", + "\x00\x00", "\x3c\x38", "\x3c\x39", "\x00\x00", "\x3c\x3a", "\x3c\x3b", + "\x00\x00", "\x3c\x3c", "\x3c\x3d", "\x3c\x3e", "\x3c\x3f", "\x3c\x40", + "\x00\x00", "\x3c\x41", "\x3c\x42", "\x3c\x43", "\x00\x00", "\x00\x00", + "\x3c\x44", "\x3c\x45", "\x00\x00", "\x3c\x46", "\x3c\x47", "\x00\x00", + "\x00\x00", "\x3c\x48", "\x00\x00", "\x3c\x49", "\x00\x00", "\x3c\x4a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x4b", "\x00\x00", + "\x3c\x4c", "\x3c\x4d", "\x3c\x4e", "\x3c\x4f", "\x3c\x50", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x52", "\x3c\x51", "\x00\x00", + "\x3c\x53", "\x00\x00", "\x00\x00", "\x3c\x54", "\x3c\x55", "\x00\x00", + "\x3c\x56", "\x3c\x57", "\x3c\x58", "\x00\x00", "\x3c\x59", "\x3c\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x5b", + "\x3c\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x5d", "\x3c\x5e", + "\x3c\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3c\x60", "\x3c\x61", "\x00\x00", "\x00\x00", "\x3c\x62", "\x3c\x63", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x64", "\x3c\x65", "\x3c\x66", + "\x3c\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x68", "\x00\x00", + "\x00\x00", "\x3c\x69", "\x3c\x6a", "\x00\x00", "\x3c\x6b", "\x00\x00", + "\x3c\x6c", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x6d", "\x00\x00", + "\x3c\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x6f", + "\x00\x00", "\x3c\x70", "\x00\x00", "\x3c\x71", "\x3c\x72", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3c\x73", "\x3c\x74", "\x00\x00", "\x3c\x75", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x76", + "\x00\x00", "\x00\x00", "\x3c\x77", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3c\x78", "\x00\x00", "\x00\x00", "\x00\x00", "\x3c\x79", "\x00\x00", + "\x00\x00", "\x3c\x7a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3c\x7b", "\x00\x00", "\x00\x00", "\x3c\x7c", "\x3c\x7d", "\x00\x00", + "\x00\x00", "\x3c\x7e", "\x3d\x21", "\x00\x00", "\x00\x00", "\x3d\x22", + "\x00\x00", "\x3d\x23", "\x3d\x24", "\x00\x00", "\x00\x00", "\x3d\x25", + "\x00\x00", "\x3d\x26", "\x00\x00", "\x00\x00", "\x3d\x27", "\x3d\x28", + "\x3d\x29", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x2a", "\x00\x00", + "\x3d\x2b", "\x3d\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3d\x2d", "\x3d\x2e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3d\x2f", "\x00\x00", "\x3d\x32", "\x00\x00", "\x00\x00", + "\x3d\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x31", "\x3d\x33", + "\x00\x00", "\x00\x00", "\x3d\x34", "\x3d\x35", "\x3d\x36", "\x3d\x37", + "\x3d\x38", "\x00\x00", "\x00\x00", "\x3d\x39", "\x3d\x3a", "\x3d\x3b", + "\x00\x00", "\x3d\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x3d", "\x3d\x3e", "\x3d\x3f", "\x3d\x40", "\x3d\x41", "\x3d\x42", + "\x00\x00", "\x00\x00", "\x3d\x43", "\x3d\x44", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x45", "\x3d\x46", "\x3d\x47", + "\x00\x00", "\x3d\x48", "\x3d\x49", "\x3d\x4a", "\x3d\x4b", "\x00\x00", + "\x00\x00", "\x3d\x4c", "\x3d\x4d", "\x00\x00", "\x00\x00", "\x3d\x4e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x4f", "\x00\x00", "\x3d\x50", + "\x3d\x51", "\x00\x00", "\x00\x00", "\x3d\x52", "\x00\x00", "\x00\x00", + "\x3d\x53", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x54", "\x3d\x55", "\x00\x00", "\x00\x00", "\x3d\x56", "\x3d\x57", + "\x00\x00", "\x3d\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x5a", + "\x3d\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x5c", "\x00\x00", "\x3d\x5d", "\x3d\x5e", "\x3d\x5f", "\x3d\x60", + "\x3d\x61", "\x00\x00", "\x00\x00", "\x3d\x62", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x63", "\x00\x00", "\x00\x00", "\x3d\x64", + "\x00\x00", "\x3d\x65", "\x3d\x66", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x67", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x69", "\x3d\x6a", "\x3d\x6b", "\x3d\x6c", "\x00\x00", "\x00\x00", + "\x3d\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x6e", "\x00\x00", + "\x3d\x6f", "\x00\x00", "\x3d\x70", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3d\x71", "\x00\x00", "\x00\x00", "\x3d\x72", "\x00\x00", "\x3d\x73", + "\x00\x00", "\x3d\x74", "\x00\x00", "\x00\x00", "\x3d\x75", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x76", "\x3d\x77", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3d\x78", "\x00\x00", "\x3d\x79", "\x3d\x7a", + "\x00\x00", "\x00\x00", "\x3d\x7b", "\x3d\x7c", "\x3d\x7d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3d\x7e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x21", "\x00\x00", "\x00\x00", "\x3e\x22", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x23", "\x00\x00", "\x3e\x24", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x25", "\x3e\x26", "\x3e\x27", + "\x3e\x28", "\x00\x00", "\x00\x00", "\x3e\x29", "\x3e\x2a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x2b", "\x3e\x2c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x2d", "\x00\x00", "\x3e\x2e", "\x00\x00", + "\x3e\x2f", "\x3e\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x31", + "\x00\x00", "\x00\x00", "\x3e\x32", "\x3e\x33", "\x00\x00", "\x00\x00", + "\x3e\x34", "\x00\x00", "\x00\x00", "\x3e\x35", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3e\x36", "\x3e\x37", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3e\x38", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3e\x39", "\x00\x00", "\x00\x00", "\x3e\x3a", "\x00\x00", "\x3e\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x3c", "\x3e\x3d", "\x3e\x3e", + "\x3e\x3f", "\x3e\x40", "\x00\x00", "\x3e\x41", "\x3e\x42", "\x00\x00", + "\x3e\x43", "\x00\x00", "\x00\x00", "\x3e\x44", "\x00\x00", "\x3e\x45", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x46", "\x3e\x47", "\x3e\x48", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x49", "\x3e\x4a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x4b", "\x3e\x4c", "\x3e\x4d", + "\x00\x00", "\x3e\x4e", "\x3e\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3e\x50", "\x3e\x51", "\x00\x00", "\x00\x00", "\x3e\x52", "\x3e\x53", + "\x00\x00", "\x3e\x54", "\x3e\x55", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x56", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x57", "\x00\x00", "\x00\x00", "\x3e\x58", + "\x3e\x59", "\x00\x00", "\x00\x00", "\x3e\x5a", "\x3e\x5b", "\x3e\x5c", + "\x00\x00", "\x3e\x5d", "\x3e\x5e", "\x3e\x5f", "\x00\x00", "\x3e\x60", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x61", "\x3e\x62", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x63", "\x3e\x64", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x65", "\x3e\x66", "\x00\x00", "\x3e\x67", + "\x3e\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x69", + "\x00\x00", "\x00\x00", "\x3e\x6a", "\x00\x00", "\x3e\x6b", "\x00\x00", + "\x00\x00", "\x3e\x6c", "\x3e\x6d", "\x3e\x6e", "\x00\x00", "\x00\x00", + "\x3e\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x3e\x70", "\x3e\x71", + "\x3e\x72", "\x3e\x73", "\x3e\x74", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3e\x75", "\x3e\x76", "\x3e\x77", "\x3e\x78", + "\x3e\x79", "\x00\x00", "\x3e\x7a", "\x3e\x7b", "\x00\x00", "\x00\x00", + "\x3e\x7e", "\x00\x00", "\x3e\x7c", "\x00\x00", "\x3e\x7d", "\x00\x00", + "\x00\x00", "\x3f\x21", "\x3f\x22", "\x00\x00", "\x3f\x23", "\x3f\x24", + "\x00\x00", "\x3f\x25", "\x3f\x26", "\x00\x00", "\x00\x00", "\x3f\x27", + "\x3f\x28", "\x00\x00", "\x3f\x29", "\x3f\x2a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3f\x2b", "\x00\x00", "\x3f\x2c", "\x3f\x2d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x2e", "\x00\x00", "\x3f\x2f", "\x00\x00", + "\x3f\x30", "\x3f\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x32", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x33", "\x3f\x34", + "\x3f\x35", "\x00\x00", "\x3f\x36", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x37", "\x00\x00", "\x00\x00", "\x00\x00", + "\x3f\x38", "\x3f\x39", "\x3f\x3a", "\x00\x00", "\x3f\x3b", "\x00\x00", + "\x3f\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x3d", "\x00\x00", + "\x3f\x3e", "\x3f\x3f", "\x3f\x40", "\x00\x00", "\x3f\x41", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x42", "\x3f\x43", "\x00\x00", "\x00\x00", + "\x3f\x44", "\x3f\x45", "\x3f\x46", "\x3f\x47", "\x3f\x48", "\x3f\x49", + "\x00\x00", "\x3f\x4a", "\x3f\x4b", "\x00\x00", "\x00\x00", "\x3f\x4c", + "\x3f\x4d", "\x00\x00", "\x00\x00", "\x3f\x4e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3f\x4f", "\x3f\x50", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x3f\x51", "\x3f\x52", "\x3f\x53", "\x3f\x54", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x55", "\x3f\x56", "\x3f\x57", "\x00\x00", + "\x3f\x58", "\x3f\x59", "\x3f\x5a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x5b", "\x3f\x5c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x5d", "\x3f\x5e", "\x00\x00", + "\x3f\x5f", "\x00\x00", "\x00\x00", "\x3f\x60", "\x00\x00", "\x00\x00", + "\x3f\x61", "\x00\x00", "\x00\x00", "\x3f\x62", "\x00\x00", "\x3f\x63", + "\x3f\x64", "\x3f\x65", "\x00\x00", "\x00\x00", "\x3f\x66", "\x3f\x67", + "\x3f\x68", "\x00\x00", "\x00\x00", "\x3f\x69", "\x00\x00", "\x00\x00", + "\x3f\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x6b", + "\x3f\x6c", "\x3f\x6d", "\x3f\x6e", "\x00\x00", "\x3f\x6f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x70", "\x3f\x71", "\x00\x00", "\x00\x00", + "\x3f\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x73", "\x3f\x74", + "\x3f\x75", "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x76", "\x00\x00", + "\x00\x00", "\x3f\x77", "\x3f\x78", "\x3f\x79", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x3f\x7a", "\x3f\x7b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x3f\x7c", "\x00\x00", "\x00\x00", "\x3f\x7d", + "\x3f\x7e", "\x00\x00", "\x00\x00", "\x40\x21", "\x00\x00", "\x00\x00", + "\x00\x00", "\x40\x22", "\x40\x23", "\x00\x00", "\x40\x24", "\x00\x00", + "\x00\x00", "\x40\x25", "\x00\x00", "\x40\x26", "\x00\x00", "\x00\x00", + "\x40\x27", "\x00\x00", "\x00\x00", "\x40\x28", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x29", "\x00\x00", "\x00\x00", + "\x00\x00", "\x40\x2a", "\x40\x2b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x40\x2c", "\x40\x2d", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x2e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x2f", + "\x00\x00", "\x40\x30", "\x40\x31", "\x40\x32", "\x40\x33", "\x40\x34", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x35", "\x00\x00", "\x00\x00", + "\x00\x00", "\x40\x36", "\x00\x00", "\x00\x00", "\x40\x37", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x38", "\x00\x00", + "\x00\x00", "\x40\x39", "\x00\x00", "\x40\x3a", "\x40\x3b", "\x40\x3c", + "\x40\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x3e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x3f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x40\x40", "\x00\x00", "\x40\x41", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x42", "\x40\x43", + "\x00\x00", "\x40\x44", "\x00\x00", "\x00\x00", "\x40\x45", "\x40\x46", + "\x40\x47", "\x40\x48", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x40\x49", "\x00\x00", "\x40\x4a", "\x00\x00", "\x40\x4b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x4c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x4d", "\x00\x00", "\x40\x4e", + "\x00\x00", "\x40\x4f", "\x00\x00", "\x40\x50", "\x40\x51", "\x00\x00", + "\x00\x00", "\x00\x00", "\x40\x52", "\x40\x53", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x40\x54", "\x40\x55", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x40\x56", "\x40\x57", "\x00\x00", "\x40\x58", + "\x40\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x5a", "\x00\x00", + "\x40\x5b", "\x40\x5c", "\x40\x5d", "\x40\x5e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x40\x5f", "\x40\x60", "\x40\x61", + "\x40\x62", "\x00\x00", "\x40\x63", "\x40\x64", "\x40\x65", "\x00\x00", + "\x40\x66", "\x40\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x40\x68", "\x40\x69", "\x40\x6a", "\x00\x00", "\x40\x6b", + "\x40\x6c", "\x00\x00", "\x40\x6d", "\x40\x6e", "\x40\x6f", "\x40\x70", + "\x40\x71", "\x40\x72", "\x00\x00", "\x40\x73", "\x00\x00", "\x40\x74", + "\x00\x00", "\x40\x75", "\x00\x00", "\x40\x76", "\x00\x00", "\x40\x77", + "\x00\x00", "\x00\x00", "\x40\x78", "\x00\x00", "\x40\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x40\x7a", "\x40\x7b", "\x40\x7c", "\x40\x7d", + "\x40\x7e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x21", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x22", "\x41\x23", + "\x41\x24", "\x41\x25", "\x00\x00", "\x41\x26", "\x00\x00", "\x41\x27", + "\x41\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x29", "\x00\x00", + "\x41\x2a", "\x41\x2b", "\x41\x2c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x41\x2d", "\x41\x2e", "\x00\x00", "\x00\x00", "\x41\x2f", "\x00\x00", + "\x00\x00", "\x41\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x41\x31", "\x00\x00", "\x41\x32", "\x00\x00", "\x00\x00", "\x00\x00", + "\x41\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x34", "\x00\x00", + "\x41\x35", "\x00\x00", "\x00\x00", "\x41\x36", "\x00\x00", "\x00\x00", + "\x00\x00", "\x41\x37", "\x41\x38", "\x41\x39", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x41\x3a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x41\x3b", "\x41\x3c", "\x00\x00", "\x41\x3d", "\x00\x00", "\x00\x00", + "\x41\x3e", "\x00\x00", "\x41\x3f", "\x00\x00", "\x00\x00", "\x41\x40", + "\x41\x41", "\x00\x00", "\x00\x00", "\x41\x42", "\x00\x00", "\x00\x00", + "\x00\x00", "\x41\x43", "\x00\x00", "\x00\x00", "\x41\x44", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x45", "\x00\x00", "\x00\x00", + "\x41\x46", "\x41\x47", "\x00\x00", "\x41\x48", "\x41\x49", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x4a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x41\x4b", "\x00\x00", "\x41\x4c", "\x41\x4d", + "\x00\x00", "\x41\x4e", "\x00\x00", "\x41\x4f", "\x41\x50", "\x41\x51", + "\x41\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x53", "\x41\x54", + "\x00\x00", "\x00\x00", "\x41\x55", "\x00\x00", "\x00\x00", "\x00\x00", + "\x41\x56", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x57", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x58", "\x41\x59", "\x00\x00", + "\x00\x00", "\x41\x5a", "\x00\x00", "\x00\x00", "\x41\x5b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x5c", "\x00\x00", "\x00\x00", + "\x41\x5d", "\x00\x00", "\x00\x00", "\x41\x5e", "\x00\x00", "\x00\x00", + "\x41\x5f", "\x41\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x61", + "\x41\x62", "\x41\x63", "\x41\x64", "\x00\x00", "\x00\x00", "\x41\x65", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x66", + "\x41\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x68", + "\x00\x00", "\x41\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x6a", + "\x00\x00", "\x41\x6b", "\x00\x00", "\x41\x6c", "\x41\x6d", "\x41\x6e", + "\x00\x00", "\x41\x6f", "\x00\x00", "\x41\x70", "\x41\x71", "\x00\x00", + "\x00\x00", "\x00\x00", "\x41\x72", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x41\x73", "\x41\x74", "\x41\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x41\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x77", + "\x41\x78", "\x00\x00", "\x00\x00", "\x00\x00", "\x41\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x41\x7a", "\x41\x7b", "\x00\x00", "\x00\x00", + "\x41\x7c", "\x41\x7d", "\x41\x7e", "\x42\x21", "\x00\x00", "\x00\x00", + "\x42\x22", "\x42\x23", "\x42\x24", "\x42\x25", "\x00\x00", "\x42\x26", + "\x00\x00", "\x00\x00", "\x42\x27", "\x42\x28", "\x42\x29", "\x42\x2a", + "\x00\x00", "\x42\x2b", "\x00\x00", "\x42\x2c", "\x42\x2d", "\x00\x00", + "\x42\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x30", "\x00\x00", + "\x42\x2f", "\x42\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x42\x32", "\x42\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x34", + "\x00\x00", "\x42\x35", "\x00\x00", "\x42\x37", "\x00\x00", "\x00\x00", + "\x42\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x42\x38", "\x42\x39", "\x42\x3a", "\x00\x00", "\x42\x3b", "\x42\x3c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x3d", "\x42\x3e", "\x42\x40", + "\x42\x41", "\x42\x42", "\x42\x44", "\x00\x00", "\x42\x45", "\x00\x00", + "\x42\x47", "\x42\x48", "\x42\x49", "\x00\x00", "\x42\x4a", "\x42\x4c", + "\x00\x00", "\x42\x43", "\x42\x46", "\x42\x4b", "\x42\x4d", "\x42\x4e", + "\x42\x4f", "\x00\x00", "\x00\x00", "\x42\x50", "\x00\x00", "\x42\x51", + "\x42\x52", "\x42\x53", "\x42\x54", "\x42\x55", "\x00\x00", "\x00\x00", + "\x42\x56", "\x42\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x58", + "\x42\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x5a", "\x42\x5b", + "\x00\x00", "\x00\x00", "\x42\x5c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x42\x5d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x42\x5e", "\x42\x5f", "\x00\x00", "\x42\x60", "\x42\x61", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x62", "\x00\x00", "\x00\x00", + "\x00\x00", "\x42\x63", "\x00\x00", "\x42\x64", "\x42\x65", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x66", "\x42\x67", "\x00\x00", + "\x00\x00", "\x00\x00", "\x42\x68", "\x42\x69", "\x00\x00", "\x00\x00", + "\x42\x6a", "\x42\x6b", "\x00\x00", "\x42\x6c", "\x42\x6d", "\x42\x3f", + "\x42\x6e", "\x00\x00", "\x42\x6f", "\x42\x70", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x42\x71", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x42\x72", "\x00\x00", "\x00\x00", "\x42\x73", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x74", "\x00\x00", "\x42\x75", + "\x42\x76", "\x42\x77", "\x42\x78", "\x00\x00", "\x42\x79", "\x42\x7a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x42\x7b", "\x42\x7c", "\x42\x7d", + "\x42\x7e", "\x43\x21", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x43\x22", "\x00\x00", "\x43\x23", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x24", "\x00\x00", "\x43\x25", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x26", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x27", "\x00\x00", + "\x00\x00", "\x43\x28", "\x43\x29", "\x43\x2a", "\x00\x00", "\x43\x2b", + "\x00\x00", "\x43\x2c", "\x00\x00", "\x00\x00", "\x43\x2d", "\x00\x00", + "\x43\x2e", "\x43\x2f", "\x00\x00", "\x43\x30", "\x43\x31", "\x43\x32", + "\x43\x33", "\x00\x00", "\x00\x00", "\x43\x34", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x35", "\x43\x36", "\x43\x37", + "\x00\x00", "\x00\x00", "\x43\x39", "\x00\x00", "\x43\x3a", "\x43\x3b", + "\x00\x00", "\x43\x3c", "\x00\x00", "\x00\x00", "\x43\x3d", "\x43\x3e", + "\x43\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x40", + "\x00\x00", "\x43\x41", "\x00\x00", "\x00\x00", "\x43\x42", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x43", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x43\x44", "\x43\x45", "\x00\x00", "\x43\x46", + "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x47", "\x43\x48", "\x00\x00", + "\x43\x38", "\x43\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x43\x4b", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x4c", "\x00\x00", + "\x43\x4d", "\x43\x4f", "\x43\x4e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x43\x50", "\x43\x51", "\x00\x00", "\x43\x52", "\x43\x53", "\x43\x54", + "\x00\x00", "\x43\x55", "\x43\x56", "\x00\x00", "\x00\x00", "\x00\x00", + "\x43\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x58", + "\x43\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x5a", + "\x00\x00", "\x43\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x43\x49", "\x00\x00", "\x00\x00", "\x43\x5c", "\x00\x00", + "\x43\x5d", "\x43\x5e", "\x00\x00", "\x00\x00", "\x43\x5f", "\x43\x60", + "\x00\x00", "\x00\x00", "\x43\x61", "\x43\x62", "\x43\x63", "\x43\x64", + "\x43\x65", "\x00\x00", "\x00\x00", "\x43\x66", "\x00\x00", "\x00\x00", + "\x00\x00", "\x43\x67", "\x43\x68", "\x43\x69", "\x43\x6a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x6b", "\x00\x00", + "\x43\x6c", "\x00\x00", "\x43\x6d", "\x00\x00", "\x43\x6e", "\x43\x6f", + "\x00\x00", "\x43\x70", "\x00\x00", "\x43\x71", "\x00\x00", "\x43\x72", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x73", "\x00\x00", + "\x43\x74", "\x00\x00", "\x43\x75", "\x00\x00", "\x00\x00", "\x00\x00", + "\x43\x76", "\x43\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x78", + "\x00\x00", "\x00\x00", "\x00\x00", "\x43\x79", "\x43\x7a", "\x43\x7b", + "\x00\x00", "\x00\x00", "\x43\x7c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x43\x7d", "\x00\x00", "\x00\x00", "\x43\x7e", "\x44\x21", "\x44\x22", + "\x00\x00", "\x44\x23", "\x00\x00", "\x00\x00", "\x44\x24", "\x00\x00", + "\x00\x00", "\x44\x25", "\x00\x00", "\x00\x00", "\x44\x26", "\x44\x27", + "\x44\x28", "\x00\x00", "\x00\x00", "\x44\x29", "\x00\x00", "\x44\x2a", + "\x44\x2b", "\x44\x2c", "\x44\x2d", "\x00\x00", "\x00\x00", "\x44\x2e", + "\x44\x2f", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x30", "\x44\x31", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x32", "\x44\x33", + "\x44\x34", "\x44\x35", "\x00\x00", "\x00\x00", "\x44\x36", "\x44\x37", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x38", + "\x44\x39", "\x00\x00", "\x44\x3a", "\x00\x00", "\x00\x00", "\x44\x3b", + "\x44\x3c", "\x44\x3d", "\x00\x00", "\x44\x3e", "\x00\x00", "\x44\x3f", + "\x00\x00", "\x00\x00", "\x44\x40", "\x00\x00", "\x00\x00", "\x44\x41", + "\x44\x42", "\x00\x00", "\x00\x00", "\x44\x43", "\x00\x00", "\x00\x00", + "\x00\x00", "\x44\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x45", "\x44\x46", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x47", + "\x44\x48", "\x44\x49", "\x44\x4a", "\x44\x4b", "\x00\x00", "\x44\x4c", + "\x44\x4d", "\x00\x00", "\x00\x00", "\x44\x4e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x44\x4f", "\x44\x50", "\x44\x51", "\x44\x52", "\x44\x53", + "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x54", "\x44\x55", "\x44\x56", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x57", "\x00\x00", + "\x00\x00", "\x00\x00", "\x44\x58", "\x00\x00", "\x44\x59", "\x44\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x5b", "\x44\x5c", "\x00\x00", + "\x44\x5d", "\x00\x00", "\x00\x00", "\x44\x5e", "\x00\x00", "\x44\x5f", + "\x00\x00", "\x44\x60", "\x44\x61", "\x44\x62", "\x00\x00", "\x44\x63", + "\x00\x00", "\x44\x64", "\x44\x65", "\x00\x00", "\x00\x00", "\x44\x66", + "\x44\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x68", + "\x44\x69", "\x44\x6a", "\x00\x00", "\x00\x00", "\x44\x6b", "\x44\x6c", + "\x44\x6d", "\x00\x00", "\x44\x6e", "\x00\x00", "\x44\x6f", "\x00\x00", + "\x44\x70", "\x44\x71", "\x00\x00", "\x44\x72", "\x44\x73", "\x00\x00", + "\x44\x74", "\x44\x75", "\x00\x00", "\x44\x76", "\x00\x00", "\x00\x00", + "\x00\x00", "\x44\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x44\x78", "\x00\x00", "\x00\x00", "\x44\x79", "\x00\x00", "\x00\x00", + "\x44\x7a", "\x00\x00", "\x00\x00", "\x00\x00", "\x44\x7b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x44\x7c", "\x44\x7d", "\x00\x00", "\x44\x7e", + "\x00\x00", "\x45\x21", "\x00\x00", "\x00\x00", "\x45\x22", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x23", "\x00\x00", "\x00\x00", "\x45\x24", + "\x45\x25", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x45\x26", "\x45\x27", "\x00\x00", "\x00\x00", "\x45\x28", "\x45\x29", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x2a", "\x00\x00", "\x45\x2b", + "\x45\x2c", "\x45\x2d", "\x00\x00", "\x00\x00", "\x45\x2e", "\x45\x2f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x30", "\x45\x31", + "\x00\x00", "\x00\x00", "\x45\x32", "\x00\x00", "\x00\x00", "\x45\x33", + "\x45\x34", "\x00\x00", "\x45\x35", "\x45\x36", "\x00\x00", "\x00\x00", + "\x45\x37", "\x00\x00", "\x45\x38", "\x00\x00", "\x00\x00", "\x45\x39", + "\x45\x3a", "\x00\x00", "\x45\x3b", "\x00\x00", "\x45\x3c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x3d", "\x45\x3e", + "\x00\x00", "\x45\x3f", "\x45\x40", "\x45\x41", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x42", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x43", "\x00\x00", "\x00\x00", + "\x00\x00", "\x45\x44", "\x45\x45", "\x45\x46", "\x00\x00", "\x00\x00", + "\x45\x47", "\x45\x48", "\x45\x49", "\x45\x4a", "\x45\x4b", "\x00\x00", + "\x45\x4d", "\x45\x4c", "\x00\x00", "\x00\x00", "\x45\x4e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x45\x50", "\x45\x51", "\x45\x52", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x53", "\x45\x54", "\x45\x55", "\x00\x00", + "\x00\x00", "\x45\x56", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x45\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x58", "\x45\x59", + "\x45\x5a", "\x45\x5b", "\x45\x5c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x45\x5d", "\x45\x5e", "\x00\x00", "\x00\x00", "\x45\x5f", + "\x45\x60", "\x00\x00", "\x45\x61", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x62", "\x45\x63", "\x45\x64", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x65", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x66", "\x00\x00", "\x00\x00", "\x45\x67", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x68", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x69", "\x00\x00", "\x00\x00", + "\x45\x6a", "\x45\x6b", "\x00\x00", "\x00\x00", "\x45\x6c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x6d", "\x45\x6e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x6f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x70", "\x45\x71", "\x00\x00", "\x00\x00", + "\x00\x00", "\x45\x72", "\x00\x00", "\x00\x00", "\x45\x73", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x74", "\x00\x00", "\x00\x00", + "\x00\x00", "\x45\x75", "\x00\x00", "\x45\x76", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x77", "\x00\x00", "\x00\x00", "\x45\x78", + "\x45\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x45\x7a", "\x00\x00", + "\x00\x00", "\x45\x7b", "\x00\x00", "\x45\x7c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x45\x7d", "\x45\x7e", "\x46\x21", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x22", "\x00\x00", "\x00\x00", "\x46\x23", + "\x46\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x25", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x26", "\x46\x27", "\x00\x00", "\x46\x28", + "\x46\x29", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x2a", + "\x46\x2b", "\x00\x00", "\x00\x00", "\x46\x2c", "\x46\x2d", "\x46\x2e", + "\x00\x00", "\x46\x2f", "\x46\x30", "\x46\x31", "\x00\x00", "\x00\x00", + "\x00\x00", "\x46\x32", "\x46\x33", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x46\x34", "\x46\x35", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x46\x36", "\x00\x00", "\x00\x00", "\x46\x37", "\x46\x38", + "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x39", "\x46\x3a", "\x00\x00", + "\x46\x3b", "\x00\x00", "\x00\x00", "\x46\x3c", "\x46\x3d", "\x46\x3e", + "\x00\x00", "\x00\x00", "\x46\x3f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x40", "\x00\x00", "\x46\x41", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x42", "\x00\x00", + "\x00\x00", "\x46\x43", "\x00\x00", "\x46\x44", "\x46\x45", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x46", "\x00\x00", "\x00\x00", "\x00\x00", + "\x46\x47", "\x46\x48", "\x00\x00", "\x46\x49", "\x00\x00", "\x46\x4a", + "\x46\x4b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x46\x4c", "\x46\x4d", "\x46\x4e", "\x46\x4f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x46\x50", "\x00\x00", "\x46\x51", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x52", "\x00\x00", "\x46\x53", "\x46\x54", + "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x55", "\x46\x56", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x57", "\x46\x58", "\x46\x59", "\x00\x00", + "\x46\x5a", "\x00\x00", "\x46\x5b", "\x00\x00", "\x00\x00", "\x46\x5c", + "\x00\x00", "\x46\x5d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x46\x5e", "\x00\x00", "\x46\x5f", "\x46\x60", "\x47\x36", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x61", "\x00\x00", "\x46\x62", "\x00\x00", + "\x46\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x64", + "\x00\x00", "\x46\x65", "\x00\x00", "\x46\x66", "\x46\x67", "\x00\x00", + "\x46\x68", "\x46\x69", "\x46\x6a", "\x46\x6b", "\x00\x00", "\x46\x6c", + "\x46\x6d", "\x46\x6e", "\x00\x00", "\x46\x6f", "\x46\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x46\x71", "\x00\x00", "\x00\x00", "\x46\x72", + "\x46\x73", "\x00\x00", "\x46\x74", "\x00\x00", "\x46\x75", "\x46\x76", + "\x00\x00", "\x00\x00", "\x00\x00", "\x46\x77", "\x46\x78", "\x00\x00", + "\x46\x79", "\x46\x7a", "\x46\x7b", "\x46\x7c", "\x00\x00", "\x46\x7d", + "\x00\x00", "\x46\x7e", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x21", + "\x00\x00", "\x47\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x23", + "\x47\x24", "\x00\x00", "\x47\x25", "\x00\x00", "\x47\x26", "\x47\x27", + "\x00\x00", "\x47\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x29", + "\x00\x00", "\x47\x2a", "\x47\x2b", "\x00\x00", "\x00\x00", "\x47\x2c", + "\x00\x00", "\x00\x00", "\x47\x2d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x2e", "\x47\x2f", "\x00\x00", "\x47\x30", "\x00\x00", "\x47\x31", + "\x47\x32", "\x47\x33", "\x47\x34", "\x47\x35", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x37", "\x47\x38", "\x00\x00", + "\x47\x39", "\x47\x3a", "\x00\x00", "\x00\x00", "\x47\x3b", "\x00\x00", + "\x00\x00", "\x47\x3c", "\x47\x3d", "\x47\x3e", "\x47\x3f", "\x00\x00", + "\x47\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x41", "\x00\x00", + "\x47\x42", "\x47\x43", "\x47\x44", "\x47\x45", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x46", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x47\x47", "\x47\x48", "\x47\x49", "\x00\x00", + "\x47\x4a", "\x00\x00", "\x47\x4b", "\x47\x4c", "\x47\x4d", "\x47\x4e", + "\x00\x00", "\x47\x4f", "\x47\x50", "\x00\x00", "\x00\x00", "\x47\x51", + "\x00\x00", "\x47\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x53", + "\x00\x00", "\x47\x54", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x56", "\x00\x00", + "\x47\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x58", "\x47\x59", + "\x47\x5a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x5b", + "\x00\x00", "\x47\x5c", "\x00\x00", "\x47\x5d", "\x47\x5e", "\x00\x00", + "\x47\x5f", "\x00\x00", "\x00\x00", "\x47\x60", "\x00\x00", "\x00\x00", + "\x00\x00", "\x47\x61", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x47\x62", "\x47\x63", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x64", "\x00\x00", "\x47\x65", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x47\x66", "\x00\x00", "\x00\x00", "\x00\x00", + "\x47\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x68", "\x47\x69", + "\x00\x00", "\x00\x00", "\x00\x00", "\x47\x6a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x47\x6b", "\x47\x6c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x47\x6d", "\x00\x00", "\x00\x00", "\x47\x6e", "\x00\x00", + "\x47\x6f", "\x47\x70", "\x47\x71", "\x47\x72", "\x00\x00", "\x00\x00", + "\x47\x73", "\x47\x74", "\x00\x00", "\x47\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x47\x76", "\x00\x00", "\x47\x77", "\x47\x78", "\x47\x79", + "\x47\x7a", "\x00\x00", "\x00\x00", "\x47\x7b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x47\x7c", "\x47\x7d", "\x47\x7e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x48\x21", "\x48\x22", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x48\x23", "\x48\x24", "\x48\x25", "\x00\x00", + "\x48\x26", "\x48\x27", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x48\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x48\x29", "\x48\x2a", "\x48\x2b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x2c", "\x48\x2d", "\x00\x00", + "\x00\x00", "\x48\x2e", "\x00\x00", "\x48\x2f", "\x48\x30", "\x00\x00", + "\x00\x00", "\x00\x00", "\x48\x31", "\x48\x32", "\x48\x33", "\x00\x00", + "\x48\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x35", "\x48\x36", + "\x00\x00", "\x48\x37", "\x00\x00", "\x00\x00", "\x48\x38", "\x48\x39", + "\x48\x3a", "\x48\x3b", "\x00\x00", "\x48\x3c", "\x48\x3d", "\x48\x3e", + "\x00\x00", "\x48\x3f", "\x00\x00", "\x48\x40", "\x48\x41", "\x00\x00", + "\x00\x00", "\x00\x00", "\x48\x42", "\x00\x00", "\x48\x43", "\x00\x00", + "\x48\x44", "\x48\x45", "\x48\x46", "\x00\x00", "\x48\x47", "\x00\x00", + "\x48\x48", "\x48\x49", "\x48\x4a", "\x00\x00", "\x00\x00", "\x48\x4b", + "\x48\x4c", "\x00\x00", "\x00\x00", "\x48\x53", "\x00\x00", "\x48\x4d", + "\x48\x4e", "\x00\x00", "\x00\x00", "\x48\x4f", "\x00\x00", "\x00\x00", + "\x48\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x51", + "\x48\x52", "\x48\x54", "\x00\x00", "\x48\x55", "\x48\x56", "\x48\x57", + "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x58", "\x00\x00", "\x48\x59", + "\x48\x5a", "\x00\x00", "\x00\x00", "\x48\x5b", "\x48\x5c", "\x00\x00", + "\x00\x00", "\x48\x5d", "\x48\x5e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x48\x5f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x48\x60", "\x48\x61", "\x48\x62", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x48\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x64", + "\x48\x65", "\x00\x00", "\x00\x00", "\x48\x66", "\x48\x67", "\x48\x68", + "\x00\x00", "\x00\x00", "\x48\x69", "\x00\x00", "\x48\x6a", "\x48\x6b", + "\x48\x6c", "\x00\x00", "\x48\x6d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x48\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x6f", + "\x48\x70", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x71", + "\x48\x72", "\x48\x73", "\x48\x74", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x48\x75", "\x48\x76", "\x48\x77", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x78", "\x48\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x48\x7a", "\x48\x7b", + "\x00\x00", "\x48\x7c", "\x48\x7d", "\x00\x00", "\x48\x7e", "\x49\x21", + "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x22", "\x49\x23", "\x49\x24", + "\x49\x25", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x26", + "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x27", "\x00\x00", "\x00\x00", + "\x49\x28", "\x49\x29", "\x00\x00", "\x00\x00", "\x49\x2a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x2b", "\x49\x2c", "\x49\x2d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x2e", + "\x49\x2f", "\x49\x30", "\x00\x00", "\x00\x00", "\x49\x31", "\x49\x32", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x33", "\x00\x00", + "\x00\x00", "\x49\x34", "\x00\x00", "\x49\x35", "\x00\x00", "\x00\x00", + "\x49\x36", "\x49\x37", "\x49\x38", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x39", "\x49\x3a", "\x49\x3b", "\x49\x3c", "\x00\x00", "\x00\x00", + "\x49\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x3d", "\x49\x3e", "\x49\x3f", "\x49\x40", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x42", "\x49\x43", "\x49\x44", + "\x00\x00", "\x49\x45", "\x49\x46", "\x49\x47", "\x49\x48", "\x00\x00", + "\x00\x00", "\x49\x49", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x4a", + "\x49\x4b", "\x49\x4c", "\x49\x4d", "\x49\x4e", "\x49\x4f", "\x49\x50", + "\x00\x00", "\x00\x00", "\x49\x51", "\x49\x52", "\x49\x53", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x54", "\x49\x55", "\x00\x00", + "\x00\x00", "\x49\x56", "\x00\x00", "\x00\x00", "\x49\x57", "\x49\x58", + "\x49\x59", "\x00\x00", "\x49\x5a", "\x49\x5b", "\x49\x5c", "\x49\x5d", + "\x00\x00", "\x49\x5e", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x5f", + "\x49\x60", "\x49\x61", "\x49\x62", "\x49\x63", "\x49\x64", "\x49\x65", + "\x49\x66", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x67", "\x49\x68", + "\x00\x00", "\x00\x00", "\x49\x69", "\x49\x6a", "\x00\x00", "\x49\x6b", + "\x49\x6c", "\x00\x00", "\x49\x6d", "\x00\x00", "\x49\x6e", "\x49\x6f", + "\x49\x70", "\x49\x71", "\x49\x72", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x73", "\x49\x74", "\x49\x75", "\x00\x00", "\x00\x00", "\x49\x76", + "\x49\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x49\x78", + "\x00\x00", "\x49\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x49\x7a", "\x00\x00", "\x00\x00", "\x49\x7b", "\x00\x00", "\x49\x7c", + "\x00\x00", "\x49\x7d", "\x00\x00", "\x49\x7e", "\x4a\x21", "\x4a\x22", + "\x4a\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x24", + "\x00\x00", "\x4a\x25", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x26", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x27", "\x4a\x28", "\x4a\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x2a", "\x00\x00", "\x4a\x2b", "\x4a\x2c", "\x4a\x2d", + "\x00\x00", "\x4a\x2e", "\x4a\x2f", "\x4a\x30", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4a\x31", "\x4a\x32", "\x4a\x33", "\x00\x00", + "\x00\x00", "\x4a\x34", "\x4a\x35", "\x4a\x36", "\x4a\x37", "\x00\x00", + "\x00\x00", "\x4a\x38", "\x00\x00", "\x00\x00", "\x4a\x39", "\x4a\x3a", + "\x00\x00", "\x4a\x3b", "\x4a\x3c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4a\x3d", "\x00\x00", "\x4a\x3e", "\x4a\x3f", + "\x4a\x40", "\x4a\x41", "\x4a\x42", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x43", "\x00\x00", "\x00\x00", "\x4a\x44", "\x00\x00", "\x00\x00", + "\x4a\x45", "\x00\x00", "\x4a\x46", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x47", "\x4a\x48", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x49", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x4a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x4b", "\x4a\x4c", "\x4a\x4d", + "\x4a\x4e", "\x4a\x4f", "\x00\x00", "\x4a\x50", "\x4a\x51", "\x4a\x52", + "\x4a\x53", "\x00\x00", "\x00\x00", "\x4a\x54", "\x00\x00", "\x4a\x55", + "\x4a\x56", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x57", "\x00\x00", + "\x4a\x58", "\x00\x00", "\x4a\x59", "\x00\x00", "\x4a\x5a", "\x00\x00", + "\x00\x00", "\x4a\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4a\x5c", "\x00\x00", "\x00\x00", "\x4a\x5d", "\x00\x00", "\x00\x00", + "\x4a\x5e", "\x4a\x5f", "\x00\x00", "\x4a\x60", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x61", "\x4a\x62", "\x00\x00", + "\x00\x00", "\x4a\x63", "\x4a\x64", "\x00\x00", "\x00\x00", "\x4a\x65", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x66", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x67", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x68", "\x4a\x69", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x6a", "\x4a\x6b", "\x4a\x6c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4a\x6d", "\x4a\x6e", "\x00\x00", "\x00\x00", + "\x4a\x6f", "\x00\x00", "\x00\x00", "\x4a\x70", "\x4a\x71", "\x00\x00", + "\x00\x00", "\x4a\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x73", "\x00\x00", "\x4a\x74", "\x00\x00", "\x00\x00", + "\x4a\x75", "\x4a\x76", "\x4a\x77", "\x00\x00", "\x4a\x78", "\x4a\x79", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4a\x7a", + "\x4a\x7b", "\x4a\x7c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4a\x7d", "\x4a\x7e", "\x00\x00", "\x00\x00", "\x4b\x21", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x22", "\x00\x00", "\x4b\x23", + "\x4b\x24", "\x00\x00", "\x4b\x25", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4b\x26", "\x00\x00", "\x4b\x27", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x28", "\x4b\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x2a", "\x4b\x2b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x2d", + "\x00\x00", "\x4b\x2e", "\x00\x00", "\x00\x00", "\x4b\x2f", "\x4b\x30", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x31", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4b\x32", "\x4b\x33", "\x00\x00", "\x00\x00", + "\x4b\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x35", + "\x4b\x36", "\x00\x00", "\x4b\x37", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4b\x38", "\x4b\x39", "\x00\x00", "\x00\x00", + "\x4b\x3a", "\x00\x00", "\x4b\x3b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4b\x3c", "\x00\x00", "\x4b\x3d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x3e", "\x4b\x3f", "\x4b\x40", "\x4b\x41", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x42", "\x4b\x43", + "\x00\x00", "\x4b\x44", "\x00\x00", "\x4b\x45", "\x4b\x46", "\x00\x00", + "\x4b\x47", "\x4b\x48", "\x00\x00", "\x4b\x49", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x4a", "\x00\x00", "\x4b\x4b", + "\x00\x00", "\x00\x00", "\x4b\x4c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4b\x4d", "\x4b\x4e", "\x00\x00", "\x4b\x4f", "\x00\x00", "\x4b\x50", + "\x4b\x51", "\x4b\x52", "\x00\x00", "\x4b\x53", "\x00\x00", "\x00\x00", + "\x4b\x54", "\x00\x00", "\x4b\x55", "\x00\x00", "\x4b\x56", "\x4b\x57", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x58", "\x00\x00", "\x4b\x59", + "\x4b\x5a", "\x4b\x5b", "\x00\x00", "\x4b\x5c", "\x00\x00", "\x00\x00", + "\x4b\x5d", "\x4b\x5e", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x5f", + "\x4b\x60", "\x00\x00", "\x4b\x61", "\x4b\x62", "\x00\x00", "\x4b\x63", + "\x00\x00", "\x4b\x64", "\x00\x00", "\x00\x00", "\x4b\x65", "\x4b\x66", + "\x00\x00", "\x4b\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x68", "\x4b\x69", "\x00\x00", "\x00\x00", "\x4b\x6a", + "\x00\x00", "\x4b\x6b", "\x4b\x6c", "\x00\x00", "\x00\x00", "\x4b\x6d", + "\x00\x00", "\x00\x00", "\x4b\x6e", "\x4b\x6f", "\x00\x00", "\x00\x00", + "\x4b\x70", "\x00\x00", "\x00\x00", "\x4b\x71", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4b\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x4b\x73", + "\x00\x00", "\x4b\x74", "\x00\x00", "\x00\x00", "\x4b\x75", "\x4b\x76", + "\x00\x00", "\x4b\x77", "\x4b\x78", "\x4b\x79", "\x00\x00", "\x4b\x7a", + "\x00\x00", "\x4b\x7b", "\x4b\x7c", "\x4b\x7d", "\x00\x00", "\x4b\x7e", + "\x00\x00", "\x4c\x21", "\x4c\x22", "\x4c\x23", "\x00\x00", "\x00\x00", + "\x4c\x24", "\x00\x00", "\x00\x00", "\x4c\x25", "\x00\x00", "\x00\x00", + "\x4c\x26", "\x4c\x27", "\x4c\x28", "\x4c\x29", "\x4c\x2a", "\x00\x00", + "\x4c\x2b", "\x00\x00", "\x4c\x2c", "\x4c\x2d", "\x4c\x2e", "\x4c\x2f", + "\x4c\x30", "\x4c\x31", "\x4c\x32", "\x4c\x33", "\x4c\x34", "\x4c\x35", + "\x4c\x36", "\x4c\x37", "\x00\x00", "\x00\x00", "\x4c\x38", "\x4c\x39", + "\x00\x00", "\x4c\x3a", "\x4c\x3b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x3c", "\x00\x00", "\x4c\x3d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x3e", "\x4c\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x40", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x42", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x43", "\x4c\x44", "\x4c\x45", + "\x00\x00", "\x00\x00", "\x4c\x46", "\x00\x00", "\x4c\x47", "\x4c\x48", + "\x00\x00", "\x00\x00", "\x4c\x49", "\x4c\x4a", "\x4c\x4b", "\x4c\x4c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x4d", "\x4c\x4e", "\x4c\x4f", + "\x00\x00", "\x4c\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4c\x51", "\x4c\x52", "\x4c\x53", "\x4c\x54", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x55", "\x4c\x56", + "\x4c\x57", "\x00\x00", "\x4c\x58", "\x00\x00", "\x00\x00", "\x4c\x59", + "\x4c\x5a", "\x4c\x5b", "\x00\x00", "\x4c\x5c", "\x00\x00", "\x00\x00", + "\x4c\x5d", "\x00\x00", "\x4c\x5e", "\x4c\x5f", "\x4c\x60", "\x4c\x61", + "\x00\x00", "\x00\x00", "\x4c\x62", "\x4c\x63", "\x00\x00", "\x4c\x64", + "\x4c\x65", "\x00\x00", "\x00\x00", "\x4c\x66", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4c\x67", "\x00\x00", "\x4c\x68", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4c\x69", "\x4c\x6a", "\x4c\x6b", "\x00\x00", "\x00\x00", + "\x4c\x6c", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x6d", "\x00\x00", + "\x00\x00", "\x4c\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x6f", "\x00\x00", "\x4c\x70", "\x4c\x71", "\x00\x00", "\x00\x00", + "\x4c\x72", "\x4c\x73", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4c\x74", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x75", "\x00\x00", + "\x4c\x76", "\x4c\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x78", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x79", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4c\x7a", "\x4c\x7b", + "\x4c\x7c", "\x00\x00", "\x00\x00", "\x4c\x7d", "\x4c\x7e", "\x4d\x21", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x22", "\x4d\x23", "\x4d\x24", + "\x4d\x25", "\x00\x00", "\x00\x00", "\x4d\x26", "\x00\x00", "\x00\x00", + "\x4d\x27", "\x00\x00", "\x4d\x28", "\x4d\x29", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4d\x2a", "\x4d\x2b", "\x00\x00", "\x00\x00", + "\x4d\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x2d", "\x4d\x2e", + "\x4d\x2f", "\x4d\x30", "\x00\x00", "\x00\x00", "\x4d\x31", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4d\x32", "\x4d\x33", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x34", "\x00\x00", "\x4d\x35", + "\x00\x00", "\x4d\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4d\x37", "\x4d\x38", "\x4d\x39", "\x00\x00", "\x4d\x3a", "\x4d\x3b", + "\x00\x00", "\x4d\x3c", "\x4d\x3d", "\x4d\x3e", "\x4d\x3f", "\x4d\x40", + "\x4d\x41", "\x4d\x42", "\x00\x00", "\x00\x00", "\x4d\x43", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4d\x44", "\x4d\x45", "\x00\x00", "\x4d\x46", + "\x4d\x47", "\x00\x00", "\x4d\x48", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4d\x49", "\x00\x00", "\x00\x00", "\x4d\x4a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x4b", "\x00\x00", "\x4d\x4c", + "\x4d\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4d\x4e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x4f", + "\x4d\x50", "\x4d\x51", "\x00\x00", "\x00\x00", "\x4d\x52", "\x00\x00", + "\x4d\x53", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4d\x54", "\x00\x00", "\x4d\x55", "\x4d\x56", "\x4d\x57", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x58", "\x00\x00", "\x00\x00", + "\x4d\x59", "\x4d\x5a", "\x4d\x5b", "\x00\x00", "\x00\x00", "\x4d\x5c", + "\x00\x00", "\x00\x00", "\x4d\x5d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4d\x5e", "\x00\x00", "\x4d\x5f", "\x4d\x60", "\x00\x00", + "\x4d\x61", "\x4d\x62", "\x4d\x63", "\x00\x00", "\x4d\x64", "\x4d\x65", + "\x4d\x66", "\x00\x00", "\x00\x00", "\x4d\x67", "\x4d\x68", "\x00\x00", + "\x4d\x69", "\x00\x00", "\x4d\x6a", "\x00\x00", "\x00\x00", "\x4d\x6b", + "\x00\x00", "\x00\x00", "\x4d\x6c", "\x4d\x6d", "\x00\x00", "\x4d\x6e", + "\x4d\x6f", "\x00\x00", "\x00\x00", "\x4d\x70", "\x00\x00", "\x4d\x71", + "\x4d\x72", "\x4d\x73", "\x4d\x74", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4d\x75", "\x00\x00", "\x4d\x76", "\x4d\x77", "\x00\x00", + "\x00\x00", "\x4d\x78", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x79", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4d\x7a", "\x4d\x7b", + "\x00\x00", "\x4d\x7c", "\x00\x00", "\x00\x00", "\x4d\x7d", "\x4d\x7e", + "\x4e\x21", "\x00\x00", "\x4e\x22", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x24", "\x4e\x25", "\x00\x00", "\x4e\x26", "\x4e\x27", "\x4e\x28", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x29", "\x4e\x23", "\x4e\x2a", + "\x4e\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x2c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x2d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x2e", "\x4e\x2f", "\x4e\x30", + "\x4e\x31", "\x4e\x32", "\x00\x00", "\x4e\x33", "\x00\x00", "\x00\x00", + "\x4e\x34", "\x4e\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x36", + "\x4e\x37", "\x4e\x38", "\x4e\x39", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x3a", "\x4e\x3b", "\x4e\x3c", "\x00\x00", + "\x4e\x3d", "\x4e\x3e", "\x00\x00", "\x4e\x3f", "\x4e\x40", "\x4e\x41", + "\x4e\x42", "\x4e\x43", "\x4e\x44", "\x4e\x45", "\x00\x00", "\x4e\x46", + "\x00\x00", "\x00\x00", "\x4e\x47", "\x4e\x48", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4e\x49", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x4a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x4b", "\x00\x00", "\x4e\x4c", + "\x4e\x4d", "\x00\x00", "\x4e\x4e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4e\x50", "\x4e\x51", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x52", "\x00\x00", "\x4e\x53", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x54", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x55", "\x4e\x56", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x57", "\x00\x00", "\x00\x00", "\x4e\x58", "\x00\x00", "\x00\x00", + "\x4e\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x5a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x5b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x5c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x5d", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x5e", "\x00\x00", + "\x4e\x5f", "\x4e\x60", "\x00\x00", "\x4e\x61", "\x00\x00", "\x4e\x62", + "\x4e\x63", "\x00\x00", "\x4e\x64", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x65", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x66", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4e\x67", "\x4e\x68", "\x4e\x69", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4e\x6a", "\x4e\x6b", "\x4e\x6c", "\x00\x00", + "\x00\x00", "\x4e\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x6e", + "\x4e\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x4e\x70", "\x00\x00", + "\x00\x00", "\x4e\x71", "\x4e\x72", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x73", "\x00\x00", "\x00\x00", "\x4e\x74", "\x4e\x75", "\x4e\x76", + "\x00\x00", "\x00\x00", "\x4e\x77", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x78", "\x4e\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4e\x7a", "\x00\x00", "\x4e\x7b", "\x4e\x7c", "\x4e\x7d", "\x00\x00", + "\x4e\x7e", "\x00\x00", "\x4f\x21", "\x00\x00", "\x00\x00", "\x4f\x22", + "\x00\x00", "\x00\x00", "\x4f\x23", "\x00\x00", "\x4f\x24", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4f\x25", "\x00\x00", "\x4f\x26", "\x4f\x27", + "\x4f\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4f\x29", "\x00\x00", "\x00\x00", "\x4f\x2a", "\x00\x00", "\x00\x00", + "\x4f\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x2c", "\x4f\x2d", + "\x4f\x2e", "\x4f\x2f", "\x4f\x30", "\x4f\x31", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4f\x32", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4f\x33", "\x00\x00", "\x00\x00", "\x4f\x34", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4f\x35", "\x00\x00", "\x00\x00", "\x4f\x36", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x37", "\x4f\x38", "\x00\x00", + "\x4f\x39", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x3a", "\x4f\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x3c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x3d", "\x4f\x3e", + "\x4f\x3f", "\x00\x00", "\x00\x00", "\x4f\x40", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4f\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4f\x42", "\x4f\x43", "\x4f\x44", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4f\x45", "\x00\x00", "\x4f\x46", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4f\x47", "\x00\x00", "\x4f\x48", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4f\x49", "\x4f\x4a", "\x00\x00", "\x00\x00", "\x4f\x4b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4f\x4c", "\x00\x00", "\x00\x00", "\x4f\x4d", + "\x4f\x4e", "\x4f\x4f", "\x00\x00", "\x00\x00", "\x4f\x50", "\x00\x00", + "\x00\x00", "\x00\x00", "\x4f\x51", "\x4f\x52", "\x00\x00", "\x00\x00", + "\x4f\x53", "\x4f\x54", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x55", + "\x4f\x56", "\x4f\x57", "\x4f\x58", "\x4f\x59", "\x00\x00", "\x4f\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x5b", "\x00\x00", + "\x4f\x5c", "\x4f\x5d", "\x4f\x5e", "\x00\x00", "\x00\x00", "\x4f\x5f", + "\x4f\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x61", "\x00\x00", + "\x4f\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x63", "\x4f\x64", + "\x00\x00", "\x4f\x65", "\x00\x00", "\x4f\x66", "\x4f\x67", "\x00\x00", + "\x4f\x68", "\x4f\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x6a", + "\x00\x00", "\x4f\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x6c", + "\x4f\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x6e", "\x4f\x6f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x71", "\x00\x00", "\x00\x00", + "\x00\x00", "\x4f\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x4f\x74", "\x4f\x75", "\x4f\x76", "\x00\x00", "\x4f\x73", "\x00\x00", + "\x00\x00", "\x4f\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x78", + "\x00\x00", "\x00\x00", "\x00\x00", "\x4f\x79", "\x4f\x7a", "\x00\x00", + "\x00\x00", "\x4f\x7b", "\x4f\x7c", "\x4f\x7d", "\x4f\x7e", "\x50\x21", + "\x00\x00", "\x50\x22", "\x00\x00", "\x50\x23", "\x50\x24", "\x50\x25", + "\x50\x26", "\x00\x00", "\x00\x00", "\x50\x27", "\x00\x00", "\x50\x28", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x29", "\x50\x2a", "\x00\x00", + "\x50\x2b", "\x50\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x50\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x2f", "\x50\x30", + "\x50\x31", "\x00\x00", "\x00\x00", "\x50\x2d", "\x00\x00", "\x50\x32", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x33", "\x50\x34", "\x50\x35", + "\x00\x00", "\x00\x00", "\x50\x37", "\x50\x38", "\x00\x00", "\x00\x00", + "\x50\x39", "\x50\x3a", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x3b", + "\x50\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x50\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x50\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x3e", "\x50\x3f", + "\x00\x00", "\x50\x40", "\x00\x00", "\x50\x41", "\x50\x42", "\x50\x43", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x44", "\x00\x00", + "\x50\x45", "\x00\x00", "\x50\x46", "\x00\x00", "\x00\x00", "\x00\x00", + "\x50\x47", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x48", "\x00\x00", + "\x00\x00", "\x50\x49", "\x50\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x50\x4b", "\x00\x00", "\x50\x4c", "\x00\x00", + "\x50\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x4e", + "\x50\x4f", "\x50\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x51", + "\x50\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x53", "\x00\x00", + "\x50\x54", "\x00\x00", "\x00\x00", "\x50\x55", "\x00\x00", "\x00\x00", + "\x00\x00", "\x50\x56", "\x00\x00", "\x00\x00", "\x50\x57", "\x50\x58", + "\x50\x59", "\x00\x00", "\x50\x5a", "\x00\x00", "\x50\x5b", "\x50\x5c", + "\x50\x5d", "\x00\x00", "\x50\x5e", "\x50\x5f", "\x00\x00", "\x50\x60", + "\x50\x61", "\x50\x62", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x50\x63", "\x00\x00", "\x50\x64", "\x50\x65", "\x50\x66", "\x50\x67", + "\x00\x00", "\x50\x68", "\x00\x00", "\x00\x00", "\x50\x69", "\x50\x6a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x6b", "\x50\x6c", + "\x50\x6d", "\x00\x00", "\x50\x6e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x50\x6f", "\x00\x00", "\x50\x70", "\x00\x00", "\x00\x00", "\x50\x71", + "\x00\x00", "\x00\x00", "\x00\x00", "\x50\x72", "\x00\x00", "\x00\x00", + "\x50\x73", "\x50\x74", "\x00\x00", "\x50\x75", "\x00\x00", "\x00\x00", + "\x50\x76", "\x50\x77", "\x00\x00", "\x50\x78", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x50\x79", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x50\x7a", "\x00\x00", "\x50\x7b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x50\x7c", "\x00\x00", "\x00\x00", "\x50\x7d", "\x50\x7e", + "\x00\x00", "\x51\x21", "\x00\x00", "\x51\x22", "\x00\x00", "\x00\x00", + "\x51\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x24", + "\x51\x25", "\x00\x00", "\x51\x26", "\x00\x00", "\x00\x00", "\x00\x00", + "\x51\x27", "\x51\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x29", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x2a", + "\x51\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x2c", "\x00\x00", + "\x51\x2d", "\x51\x2e", "\x00\x00", "\x51\x2f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x51\x30", "\x00\x00", "\x00\x00", "\x00\x00", + "\x51\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x51\x32", "\x00\x00", "\x00\x00", "\x51\x33", "\x00\x00", "\x00\x00", + "\x51\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x51\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x36", "\x00\x00", + "\x51\x37", "\x00\x00", "\x51\x38", "\x51\x39", "\x00\x00", "\x00\x00", + "\x00\x00", "\x51\x3a", "\x51\x3b", "\x00\x00", "\x00\x00", "\x51\x3c", + "\x51\x3d", "\x51\x3e", "\x51\x3f", "\x51\x40", "\x00\x00", "\x51\x41", + "\x51\x42", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x43", "\x51\x44", + "\x51\x45", "\x00\x00", "\x00\x00", "\x51\x46", "\x00\x00", "\x00\x00", + "\x51\x47", "\x51\x48", "\x00\x00", "\x51\x49", "\x51\x4a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x4b", "\x00\x00", "\x51\x4c", + "\x00\x00", "\x00\x00", "\x51\x4d", "\x00\x00", "\x00\x00", "\x51\x4e", + "\x51\x4f", "\x00\x00", "\x00\x00", "\x51\x50", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x51", "\x00\x00", "\x51\x52", + "\x00\x00", "\x51\x53", "\x00\x00", "\x00\x00", "\x51\x54", "\x51\x55", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x56", "\x51\x57", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x58", "\x51\x59", "\x00\x00", + "\x00\x00", "\x51\x5a", "\x51\x5b", "\x00\x00", "\x51\x5c", "\x00\x00", + "\x00\x00", "\x51\x5d", "\x51\x5e", "\x51\x5f", "\x00\x00", "\x51\x60", + "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x61", "\x00\x00", "\x51\x62", + "\x51\x63", "\x51\x64", "\x00\x00", "\x00\x00", "\x51\x65", "\x00\x00", + "\x00\x00", "\x51\x66", "\x00\x00", "\x51\x67", "\x00\x00", "\x00\x00", + "\x51\x68", "\x51\x69", "\x51\x6a", "\x51\x6b", "\x00\x00", "\x51\x6c", + "\x51\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x6e", + "\x00\x00", "\x00\x00", "\x51\x6f", "\x51\x70", "\x00\x00", "\x51\x71", + "\x51\x72", "\x51\x73", "\x51\x74", "\x51\x75", "\x00\x00", "\x00\x00", + "\x00\x00", "\x51\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x51\x77", + "\x00\x00", "\x51\x78", "\x51\x79", "\x51\x7a", "\x00\x00", "\x51\x7b", + "\x51\x7c", "\x51\x7d", "\x51\x7e", "\x52\x21", "\x00\x00", "\x00\x00", + "\x52\x22", "\x52\x23", "\x00\x00", "\x52\x24", "\x52\x25", "\x52\x26", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x27", + "\x52\x28", "\x52\x29", "\x52\x2a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x52\x2b", "\x00\x00", "\x52\x2c", "\x00\x00", "\x00\x00", "\x52\x2d", + "\x52\x2e", "\x00\x00", "\x00\x00", "\x52\x2f", "\x00\x00", "\x52\x30", + "\x00\x00", "\x00\x00", "\x52\x31", "\x52\x32", "\x00\x00", "\x00\x00", + "\x00\x00", "\x52\x33", "\x52\x34", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x52\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x52\x36", "\x00\x00", "\x52\x37", "\x52\x38", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x52\x39", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x52\x3a", "\x00\x00", "\x00\x00", "\x52\x3b", "\x00\x00", + "\x52\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x3d", + "\x52\x3e", "\x00\x00", "\x00\x00", "\x52\x3f", "\x52\x40", "\x00\x00", + "\x52\x41", "\x00\x00", "\x00\x00", "\x52\x42", "\x52\x43", "\x00\x00", + "\x00\x00", "\x00\x00", "\x52\x44", "\x52\x45", "\x52\x46", "\x52\x47", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x48", "\x00\x00", + "\x00\x00", "\x52\x49", "\x00\x00", "\x00\x00", "\x52\x4a", "\x00\x00", + "\x52\x4b", "\x52\x4c", "\x00\x00", "\x52\x4d", "\x52\x4e", "\x00\x00", + "\x52\x4f", "\x52\x50", "\x52\x51", "\x52\x52", "\x00\x00", "\x52\x53", + "\x52\x54", "\x00\x00", "\x52\x55", "\x52\x56", "\x00\x00", "\x00\x00", + "\x52\x57", "\x52\x58", "\x52\x59", "\x00\x00", "\x52\x5a", "\x00\x00", + "\x52\x5b", "\x00\x00", "\x00\x00", "\x52\x5c", "\x52\x5d", "\x52\x5e", + "\x52\x5f", "\x00\x00", "\x52\x60", "\x00\x00", "\x00\x00", "\x52\x61", + "\x00\x00", "\x52\x62", "\x52\x63", "\x00\x00", "\x52\x64", "\x52\x65", + "\x52\x66", "\x00\x00", "\x52\x67", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x52\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x52\x69", "\x52\x6a", "\x00\x00", "\x52\x6b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x52\x6c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x52\x6d", "\x00\x00", "\x52\x6e", "\x52\x6f", "\x00\x00", "\x52\x70", + "\x00\x00", "\x00\x00", "\x52\x71", "\x52\x72", "\x52\x73", "\x00\x00", + "\x00\x00", "\x00\x00", "\x52\x74", "\x52\x76", "\x52\x77", "\x52\x78", + "\x00\x00", "\x52\x75", "\x00\x00", "\x00\x00", "\x00\x00", "\x52\x79", + "\x52\x7a", "\x52\x7b", "\x52\x7c", "\x52\x7d", "\x52\x7e", "\x00\x00", + "\x00\x00", "\x53\x21", "\x00\x00", "\x53\x22", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x23", "\x00\x00", "\x53\x24", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x25", "\x53\x26", "\x00\x00", "\x53\x27", "\x00\x00", + "\x53\x28", "\x53\x29", "\x00\x00", "\x00\x00", "\x53\x2a", "\x53\x2b", + "\x53\x2c", "\x53\x2d", "\x53\x2e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x2f", "\x53\x30", "\x00\x00", "\x53\x31", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x32", "\x53\x33", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x34", + "\x53\x35", "\x00\x00", "\x00\x00", "\x53\x36", "\x53\x37", "\x53\x38", + "\x00\x00", "\x00\x00", "\x53\x39", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x3a", "\x00\x00", "\x00\x00", "\x53\x3b", "\x53\x3c", + "\x53\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x3e", "\x00\x00", + "\x53\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x40", "\x53\x41", + "\x53\x42", "\x00\x00", "\x53\x43", "\x00\x00", "\x53\x44", "\x53\x45", + "\x00\x00", "\x00\x00", "\x53\x46", "\x53\x47", "\x00\x00", "\x00\x00", + "\x53\x48", "\x00\x00", "\x53\x49", "\x53\x4a", "\x53\x4b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x4c", "\x53\x4d", "\x53\x4e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x53\x4f", "\x00\x00", + "\x53\x50", "\x53\x51", "\x53\x52", "\x00\x00", "\x00\x00", "\x53\x53", + "\x53\x54", "\x53\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x53\x56", "\x00\x00", "\x00\x00", "\x53\x57", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x58", "\x00\x00", "\x00\x00", "\x53\x59", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x5a", "\x53\x5b", "\x53\x5c", "\x53\x5d", + "\x00\x00", "\x53\x5e", "\x53\x5f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x60", "\x53\x61", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x62", "\x00\x00", "\x00\x00", "\x00\x00", + "\x53\x63", "\x00\x00", "\x53\x64", "\x00\x00", "\x00\x00", "\x00\x00", + "\x53\x65", "\x00\x00", "\x53\x66", "\x53\x67", "\x00\x00", "\x53\x68", + "\x53\x69", "\x53\x6a", "\x00\x00", "\x53\x6b", "\x00\x00", "\x00\x00", + "\x53\x6c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x53\x6d", "\x53\x6e", "\x00\x00", "\x53\x6f", "\x53\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x71", "\x00\x00", "\x53\x72", "\x53\x73", + "\x53\x74", "\x00\x00", "\x53\x75", "\x53\x76", "\x00\x00", "\x53\x77", + "\x00\x00", "\x00\x00", "\x53\x78", "\x53\x79", "\x53\x7a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x7b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x53\x7c", "\x53\x7d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x53\x7e", "\x54\x21", "\x54\x22", "\x54\x23", + "\x00\x00", "\x00\x00", "\x54\x24", "\x54\x25", "\x00\x00", "\x00\x00", + "\x54\x26", "\x54\x27", "\x00\x00", "\x54\x28", "\x54\x29", "\x54\x2a", + "\x54\x2b", "\x54\x2c", "\x54\x2d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x54\x2e", "\x54\x2f", "\x54\x30", "\x54\x31", + "\x00\x00", "\x54\x32", "\x54\x34", "\x00\x00", "\x00\x00", "\x54\x35", + "\x54\x36", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x37", "\x54\x38", + "\x00\x00", "\x54\x39", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x3a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x3b", "\x54\x3c", "\x00\x00", + "\x00\x00", "\x54\x3d", "\x54\x3e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x54\x33", "\x54\x3f", "\x54\x40", "\x54\x41", + "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x42", "\x00\x00", "\x54\x43", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x44", "\x54\x45", + "\x00\x00", "\x00\x00", "\x54\x46", "\x54\x47", "\x54\x48", "\x00\x00", + "\x00\x00", "\x00\x00", "\x54\x49", "\x54\x4a", "\x00\x00", "\x54\x4b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x4c", "\x00\x00", "\x00\x00", + "\x54\x4d", "\x54\x4e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x4f", "\x54\x50", "\x00\x00", "\x54\x51", "\x54\x52", "\x00\x00", + "\x54\x53", "\x00\x00", "\x54\x54", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x54\x55", "\x54\x56", "\x00\x00", "\x54\x57", + "\x54\x58", "\x00\x00", "\x00\x00", "\x54\x59", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x5a", "\x00\x00", "\x00\x00", + "\x54\x5b", "\x54\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x5d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x5e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x5f", "\x00\x00", + "\x00\x00", "\x54\x60", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x54\x61", "\x54\x62", "\x00\x00", "\x00\x00", "\x54\x63", "\x00\x00", + "\x00\x00", "\x54\x64", "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x65", + "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x66", "\x00\x00", "\x00\x00", + "\x54\x67", "\x00\x00", "\x54\x68", "\x00\x00", "\x00\x00", "\x54\x69", + "\x54\x6a", "\x54\x6c", "\x54\x6b", "\x54\x6d", "\x54\x6e", "\x54\x6f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x54\x70", "\x54\x71", "\x00\x00", + "\x00\x00", "\x54\x72", "\x54\x73", "\x00\x00", "\x00\x00", "\x54\x74", + "\x54\x75", "\x54\x76", "\x54\x77", "\x54\x78", "\x00\x00", "\x00\x00", + "\x00\x00", "\x54\x79", "\x00\x00", "\x54\x7a", "\x54\x7b", "\x54\x7c", + "\x54\x7d", "\x54\x7e", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x21", + "\x55\x22", "\x55\x23", "\x55\x24", "\x55\x25", "\x55\x26", "\x00\x00", + "\x55\x27", "\x00\x00", "\x55\x28", "\x55\x29", "\x55\x2a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x2b", "\x55\x2c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x2d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x55\x2e", "\x55\x2f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x55\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x31", + "\x00\x00", "\x00\x00", "\x55\x32", "\x55\x33", "\x55\x34", "\x00\x00", + "\x00\x00", "\x55\x35", "\x55\x36", "\x00\x00", "\x00\x00", "\x55\x37", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x38", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x39", "\x55\x3a", + "\x55\x3b", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x3c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x55\x3d", "\x00\x00", "\x55\x3e", "\x00\x00", + "\x00\x00", "\x55\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x40", + "\x00\x00", "\x55\x41", "\x55\x42", "\x00\x00", "\x00\x00", "\x55\x43", + "\x55\x44", "\x00\x00", "\x00\x00", "\x55\x45", "\x55\x46", "\x55\x47", + "\x55\x48", "\x55\x49", "\x00\x00", "\x55\x4a", "\x00\x00", "\x00\x00", + "\x55\x4b", "\x55\x4c", "\x55\x4d", "\x00\x00", "\x55\x4e", "\x00\x00", + "\x55\x4f", "\x55\x50", "\x00\x00", "\x55\x51", "\x55\x52", "\x55\x53", + "\x55\x54", "\x55\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x56", + "\x00\x00", "\x55\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x55\x58", "\x00\x00", "\x55\x59", "\x00\x00", "\x55\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x5b", "\x55\x5c", "\x00\x00", + "\x55\x5d", "\x00\x00", "\x55\x5e", "\x55\x5f", "\x00\x00", "\x55\x60", + "\x00\x00", "\x55\x61", "\x00\x00", "\x55\x62", "\x00\x00", "\x00\x00", + "\x00\x00", "\x55\x63", "\x55\x64", "\x00\x00", "\x00\x00", "\x00\x00", + "\x55\x65", "\x00\x00", "\x55\x66", "\x55\x67", "\x00\x00", "\x00\x00", + "\x00\x00", "\x55\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x69", + "\x55\x6a", "\x55\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x55\x6c", "\x55\x6d", "\x00\x00", "\x55\x6e", "\x55\x6f", + "\x55\x70", "\x00\x00", "\x00\x00", "\x00\x00", "\x55\x71", "\x55\x72", + "\x55\x73", "\x55\x74", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x55\x75", "\x00\x00", "\x55\x76", "\x00\x00", "\x00\x00", "\x55\x77", + "\x00\x00", "\x55\x78", "\x55\x79", "\x00\x00", "\x55\x7a", "\x55\x7b", + "\x55\x7c", "\x55\x7d", "\x55\x7e", "\x00\x00", "\x56\x21", "\x00\x00", + "\x56\x22", "\x56\x23", "\x00\x00", "\x00\x00", "\x56\x24", "\x00\x00", + "\x00\x00", "\x56\x25", "\x56\x26", "\x00\x00", "\x00\x00", "\x00\x00", + "\x56\x27", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x28", + "\x56\x29", "\x56\x2a", "\x56\x2b", "\x56\x2c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x2d", "\x00\x00", "\x56\x2e", "\x00\x00", "\x56\x2f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x30", "\x00\x00", "\x00\x00", + "\x56\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x32", + "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x33", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x56\x34", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x35", "\x00\x00", "\x56\x36", "\x56\x37", "\x00\x00", + "\x56\x38", "\x00\x00", "\x00\x00", "\x56\x39", "\x00\x00", "\x56\x3a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x3c", "\x56\x3d", + "\x56\x3e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x56\x3f", "\x56\x40", "\x56\x41", "\x00\x00", "\x00\x00", "\x00\x00", + "\x56\x42", "\x00\x00", "\x56\x43", "\x56\x44", "\x56\x45", "\x00\x00", + "\x00\x00", "\x56\x47", "\x56\x48", "\x56\x49", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x56\x4a", "\x00\x00", "\x00\x00", "\x56\x4b", + "\x00\x00", "\x56\x46", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x4c", "\x00\x00", "\x56\x4d", "\x00\x00", "\x00\x00", + "\x56\x4e", "\x00\x00", "\x00\x00", "\x56\x4f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x50", "\x56\x51", "\x00\x00", "\x00\x00", "\x00\x00", + "\x56\x52", "\x00\x00", "\x56\x53", "\x56\x54", "\x56\x56", "\x00\x00", + "\x56\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x58", + "\x56\x55", "\x00\x00", "\x00\x00", "\x56\x59", "\x56\x5a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x5b", "\x00\x00", + "\x56\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x5d", "\x00\x00", + "\x56\x5e", "\x56\x5f", "\x00\x00", "\x00\x00", "\x56\x60", "\x00\x00", + "\x00\x00", "\x56\x61", "\x56\x62", "\x56\x63", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x64", "\x56\x65", "\x56\x66", "\x00\x00", "\x00\x00", + "\x56\x67", "\x56\x68", "\x00\x00", "\x56\x69", "\x56\x6a", "\x00\x00", + "\x00\x00", "\x00\x00", "\x56\x6b", "\x00\x00", "\x56\x6c", "\x56\x6d", + "\x00\x00", "\x00\x00", "\x56\x6e", "\x56\x6f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x70", "\x56\x71", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x72", "\x56\x73", "\x00\x00", "\x00\x00", "\x56\x74", + "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x75", "\x56\x76", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x56\x77", "\x56\x78", + "\x00\x00", "\x56\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x56\x7a", "\x56\x7b", "\x56\x7c", "\x56\x7d", "\x56\x7e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x21", "\x00\x00", + "\x00\x00", "\x57\x22", "\x57\x23", "\x00\x00", "\x57\x24", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x25", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x26", "\x00\x00", "\x00\x00", + "\x00\x00", "\x57\x27", "\x00\x00", "\x00\x00", "\x57\x28", "\x00\x00", + "\x00\x00", "\x00\x00", "\x57\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x57\x2a", "\x57\x2b", "\x57\x2c", "\x00\x00", + "\x57\x2d", "\x00\x00", "\x57\x2e", "\x57\x2f", "\x57\x30", "\x00\x00", + "\x57\x31", "\x57\x32", "\x00\x00", "\x00\x00", "\x57\x33", "\x00\x00", + "\x57\x34", "\x57\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x36", + "\x00\x00", "\x00\x00", "\x57\x37", "\x00\x00", "\x00\x00", "\x57\x38", + "\x00\x00", "\x57\x39", "\x00\x00", "\x57\x3a", "\x00\x00", "\x57\x3b", + "\x57\x3c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x3d", + "\x57\x3e", "\x00\x00", "\x57\x3f", "\x57\x40", "\x00\x00", "\x00\x00", + "\x57\x41", "\x57\x42", "\x57\x43", "\x57\x44", "\x00\x00", "\x00\x00", + "\x00\x00", "\x57\x45", "\x00\x00", "\x57\x46", "\x00\x00", "\x57\x47", + "\x00\x00", "\x57\x48", "\x00\x00", "\x00\x00", "\x57\x49", "\x00\x00", + "\x00\x00", "\x57\x4a", "\x00\x00", "\x57\x4b", "\x00\x00", "\x57\x4c", + "\x57\x4d", "\x57\x4e", "\x57\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x57\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x57\x51", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x57\x52", "\x00\x00", "\x57\x53", "\x00\x00", "\x57\x54", "\x00\x00", + "\x00\x00", "\x00\x00", "\x57\x55", "\x00\x00", "\x57\x56", "\x00\x00", + "\x00\x00", "\x57\x57", "\x00\x00", "\x57\x58", "\x57\x59", "\x57\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x5b", + "\x57\x5c", "\x00\x00", "\x57\x5d", "\x57\x5e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x5f", "\x57\x60", "\x00\x00", + "\x57\x61", "\x57\x62", "\x57\x64", "\x00\x00", "\x57\x65", "\x57\x66", + "\x57\x67", "\x00\x00", "\x57\x68", "\x57\x69", "\x57\x6a", "\x57\x6b", + "\x57\x6c", "\x00\x00", "\x57\x6d", "\x00\x00", "\x00\x00", "\x57\x6e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x57\x6f", "\x00\x00", "\x00\x00", + "\x57\x70", "\x00\x00", "\x57\x71", "\x57\x72", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x57\x73", "\x57\x74", "\x57\x75", "\x00\x00", + "\x00\x00", "\x57\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x57\x77", "\x57\x78", "\x00\x00", "\x00\x00", "\x57\x79", + "\x00\x00", "\x58\x3e", "\x57\x63", "\x57\x7a", "\x57\x7b", "\x57\x7c", + "\x57\x7d", "\x57\x7e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x58\x21", "\x00\x00", "\x58\x22", "\x58\x23", "\x00\x00", "\x58\x24", + "\x00\x00", "\x58\x25", "\x00\x00", "\x58\x26", "\x58\x27", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x28", "\x00\x00", "\x58\x29", + "\x58\x2a", "\x00\x00", "\x00\x00", "\x58\x2b", "\x58\x2c", "\x00\x00", + "\x58\x2d", "\x58\x2e", "\x58\x2f", "\x58\x30", "\x58\x31", "\x00\x00", + "\x58\x32", "\x00\x00", "\x00\x00", "\x58\x33", "\x58\x4c", "\x58\x34", + "\x58\x35", "\x58\x36", "\x58\x37", "\x00\x00", "\x58\x38", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x39", "\x58\x3a", + "\x58\x3b", "\x00\x00", "\x00\x00", "\x58\x3c", "\x58\x3d", "\x58\x3f", + "\x00\x00", "\x58\x40", "\x58\x41", "\x00\x00", "\x58\x42", "\x58\x43", + "\x00\x00", "\x00\x00", "\x58\x44", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x58\x45", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x58\x46", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x47", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x48", "\x00\x00", "\x58\x49", + "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x4a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x58\x4b", "\x58\x4d", "\x58\x4e", "\x58\x4f", "\x00\x00", + "\x58\x50", "\x58\x51", "\x00\x00", "\x58\x52", "\x00\x00", "\x00\x00", + "\x58\x53", "\x00\x00", "\x58\x54", "\x00\x00", "\x58\x55", "\x58\x56", + "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x57", "\x00\x00", "\x58\x58", + "\x58\x59", "\x58\x5a", "\x00\x00", "\x58\x5b", "\x00\x00", "\x00\x00", + "\x00\x00", "\x58\x5c", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x5d", + "\x58\x5e", "\x00\x00", "\x58\x5f", "\x00\x00", "\x00\x00", "\x58\x60", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x61", + "\x00\x00", "\x00\x00", "\x58\x62", "\x58\x63", "\x00\x00", "\x58\x64", + "\x00\x00", "\x58\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x66", + "\x58\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x68", "\x00\x00", + "\x00\x00", "\x00\x00", "\x58\x69", "\x58\x6a", "\x58\x6b", "\x00\x00", + "\x58\x6c", "\x58\x6d", "\x58\x6e", "\x00\x00", "\x58\x6f", "\x58\x70", + "\x58\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x72", + "\x00\x00", "\x58\x73", "\x00\x00", "\x00\x00", "\x58\x74", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x75", "\x00\x00", + "\x00\x00", "\x58\x76", "\x58\x77", "\x00\x00", "\x58\x78", "\x00\x00", + "\x58\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x7a", + "\x58\x7b", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x7c", "\x00\x00", + "\x00\x00", "\x58\x7d", "\x00\x00", "\x00\x00", "\x00\x00", "\x58\x7e", + "\x59\x21", "\x59\x22", "\x00\x00", "\x00\x00", "\x59\x23", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x24", "\x59\x25", "\x59\x26", + "\x59\x27", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x28", + "\x00\x00", "\x00\x00", "\x59\x2a", "\x59\x2b", "\x00\x00", "\x59\x2c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x2d", "\x59\x2e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x2f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x59\x30", "\x00\x00", "\x59\x31", "\x00\x00", + "\x59\x32", "\x59\x33", "\x00\x00", "\x59\x34", "\x00\x00", "\x00\x00", + "\x00\x00", "\x59\x35", "\x59\x36", "\x59\x37", "\x59\x38", "\x00\x00", + "\x59\x39", "\x00\x00", "\x00\x00", "\x59\x3a", "\x59\x3b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x59\x3c", "\x00\x00", "\x00\x00", "\x59\x29", + "\x59\x3d", "\x59\x3e", "\x00\x00", "\x59\x3f", "\x59\x40", "\x59\x41", + "\x59\x42", "\x59\x43", "\x59\x44", "\x59\x45", "\x59\x46", "\x00\x00", + "\x00\x00", "\x59\x47", "\x00\x00", "\x00\x00", "\x59\x48", "\x00\x00", + "\x00\x00", "\x59\x49", "\x59\x4a", "\x59\x4b", "\x59\x4c", "\x59\x4d", + "\x59\x4e", "\x59\x4f", "\x00\x00", "\x59\x50", "\x59\x51", "\x00\x00", + "\x00\x00", "\x00\x00", "\x59\x52", "\x59\x53", "\x59\x54", "\x59\x55", + "\x00\x00", "\x59\x56", "\x00\x00", "\x59\x57", "\x00\x00", "\x59\x58", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x59", "\x59\x5a", "\x00\x00", + "\x00\x00", "\x59\x5b", "\x00\x00", "\x59\x5c", "\x59\x5d", "\x00\x00", + "\x00\x00", "\x59\x5e", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x5f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x60", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x61", "\x00\x00", "\x59\x62", + "\x59\x63", "\x00\x00", "\x59\x64", "\x00\x00", "\x00\x00", "\x59\x65", + "\x00\x00", "\x59\x66", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x59\x74", "\x59\x67", "\x00\x00", "\x59\x68", "\x59\x69", + "\x59\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x6b", "\x59\x6c", + "\x59\x6d", "\x59\x6e", "\x00\x00", "\x00\x00", "\x59\x6f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x70", "\x00\x00", "\x00\x00", + "\x59\x71", "\x59\x72", "\x00\x00", "\x00\x00", "\x59\x73", "\x59\x75", + "\x00\x00", "\x59\x76", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x59\x77", "\x59\x78", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x59\x79", "\x00\x00", "\x59\x7a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x59\x7b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x59\x7c", "\x00\x00", "\x00\x00", "\x59\x7d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x59\x7e", + "\x00\x00", "\x00\x00", "\x5a\x21", "\x5a\x22", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5a\x23", "\x5a\x24", "\x5a\x25", "\x5a\x26", "\x00\x00", + "\x5a\x27", "\x5a\x28", "\x5a\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5a\x2a", "\x5a\x2b", "\x00\x00", "\x5a\x2c", + "\x00\x00", "\x00\x00", "\x5a\x2d", "\x00\x00", "\x00\x00", "\x5a\x2e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x2f", + "\x00\x00", "\x5a\x30", "\x5a\x31", "\x00\x00", "\x5a\x32", "\x00\x00", + "\x5a\x33", "\x00\x00", "\x5a\x34", "\x5a\x35", "\x00\x00", "\x00\x00", + "\x5a\x36", "\x38\x66", "\x5a\x37", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5a\x38", "\x5a\x39", "\x5a\x3a", "\x00\x00", "\x00\x00", "\x5a\x3b", + "\x5a\x3c", "\x5a\x3d", "\x5a\x3e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5a\x3f", "\x00\x00", "\x00\x00", "\x5a\x40", "\x5a\x41", "\x5a\x42", + "\x5a\x43", "\x5a\x44", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5a\x45", "\x00\x00", "\x00\x00", "\x5a\x46", "\x00\x00", "\x00\x00", + "\x5a\x47", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5a\x48", "\x5a\x49", "\x5a\x4a", "\x00\x00", "\x00\x00", "\x5a\x4b", + "\x5a\x6d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x4c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x4d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5a\x4e", "\x00\x00", "\x5a\x4f", "\x00\x00", + "\x5a\x50", "\x00\x00", "\x5a\x51", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5a\x52", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5a\x53", "\x5a\x54", "\x5a\x55", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5a\x56", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x57", + "\x00\x00", "\x5a\x58", "\x5a\x59", "\x5a\x5a", "\x00\x00", "\x5a\x5b", + "\x5a\x5c", "\x5a\x5d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5a\x5e", "\x5a\x5f", "\x5a\x60", "\x00\x00", "\x5a\x61", + "\x00\x00", "\x5a\x62", "\x5a\x63", "\x5a\x64", "\x00\x00", "\x00\x00", + "\x5a\x65", "\x00\x00", "\x5a\x66", "\x00\x00", "\x00\x00", "\x5a\x67", + "\x00\x00", "\x5a\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x5a\x69", + "\x00\x00", "\x00\x00", "\x5a\x6a", "\x00\x00", "\x5a\x6b", "\x00\x00", + "\x5a\x6c", "\x5a\x6e", "\x00\x00", "\x5a\x6f", "\x5a\x70", "\x5a\x71", + "\x5a\x72", "\x00\x00", "\x5a\x73", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5a\x74", "\x00\x00", "\x00\x00", "\x5a\x75", "\x5a\x76", "\x5a\x77", + "\x00\x00", "\x00\x00", "\x5a\x78", "\x5a\x79", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5a\x7a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5a\x7b", "\x5a\x7c", "\x00\x00", "\x5a\x7d", "\x00\x00", + "\x5a\x7e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x21", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x22", + "\x5b\x23", "\x00\x00", "\x5b\x24", "\x5b\x25", "\x5b\x26", "\x5b\x27", + "\x00\x00", "\x5b\x28", "\x5b\x29", "\x5b\x2a", "\x00\x00", "\x5b\x2b", + "\x00\x00", "\x00\x00", "\x5b\x2c", "\x00\x00", "\x5b\x2d", "\x5b\x2e", + "\x5b\x2f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x30", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x31", "\x00\x00", "\x00\x00", + "\x5b\x32", "\x5b\x33", "\x5b\x34", "\x00\x00", "\x5b\x35", "\x5b\x36", + "\x5b\x37", "\x5b\x38", "\x5b\x39", "\x5b\x3a", "\x5b\x3b", "\x5b\x3c", + "\x5b\x3d", "\x5b\x3e", "\x00\x00", "\x5b\x3f", "\x5b\x40", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x41", "\x00\x00", "\x00\x00", "\x5b\x42", + "\x00\x00", "\x5b\x43", "\x00\x00", "\x5b\x44", "\x5b\x45", "\x5b\x46", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x47", "\x00\x00", + "\x5b\x48", "\x00\x00", "\x00\x00", "\x5b\x49", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5b\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5b\x4b", "\x5b\x4c", "\x5b\x4d", "\x00\x00", "\x00\x00", "\x5b\x4e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x4f", "\x5b\x50", "\x5b\x51", + "\x00\x00", "\x5b\x52", "\x5b\x53", "\x5b\x54", "\x5b\x55", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x56", "\x5b\x57", "\x5b\x58", "\x00\x00", + "\x00\x00", "\x5b\x59", "\x5b\x5a", "\x00\x00", "\x5b\x5b", "\x00\x00", + "\x00\x00", "\x5b\x5c", "\x00\x00", "\x00\x00", "\x5b\x5d", "\x5b\x5e", + "\x5b\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5b\x60", "\x5b\x61", "\x00\x00", "\x5b\x62", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5b\x63", "\x00\x00", "\x5b\x64", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x65", "\x00\x00", "\x5b\x66", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x67", "\x00\x00", "\x5b\x68", + "\x00\x00", "\x5b\x69", "\x00\x00", "\x00\x00", "\x5b\x6a", "\x00\x00", + "\x00\x00", "\x5b\x6b", "\x5b\x6c", "\x5b\x6d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5b\x6e", "\x00\x00", "\x5b\x70", "\x5b\x71", + "\x5b\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x73", "\x5b\x6f", + "\x5b\x74", "\x5b\x75", "\x5b\x76", "\x00\x00", "\x5b\x77", "\x5b\x78", + "\x5b\x79", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5b\x7a", + "\x5b\x7b", "\x00\x00", "\x5b\x7c", "\x00\x00", "\x5b\x7d", "\x00\x00", + "\x00\x00", "\x5b\x7e", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5c\x21", "\x00\x00", "\x5c\x22", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5c\x23", "\x00\x00", "\x5c\x24", "\x00\x00", "\x5c\x25", + "\x00\x00", "\x00\x00", "\x5c\x26", "\x5c\x27", "\x5c\x28", "\x5c\x29", + "\x00\x00", "\x00\x00", "\x5c\x2a", "\x00\x00", "\x00\x00", "\x5c\x2b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x2c", "\x5c\x2d", "\x00\x00", + "\x5c\x2e", "\x00\x00", "\x5c\x2f", "\x00\x00", "\x5c\x30", "\x00\x00", + "\x00\x00", "\x5c\x31", "\x5c\x32", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5c\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x34", + "\x5c\x35", "\x5c\x36", "\x00\x00", "\x5c\x37", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5c\x38", "\x5c\x39", "\x00\x00", "\x5c\x3a", + "\x5c\x3b", "\x5c\x3c", "\x00\x00", "\x00\x00", "\x5c\x3d", "\x5c\x3e", + "\x5c\x3f", "\x00\x00", "\x5c\x40", "\x5c\x41", "\x00\x00", "\x00\x00", + "\x5c\x42", "\x5c\x43", "\x00\x00", "\x5c\x44", "\x5c\x45", "\x5c\x46", + "\x5c\x47", "\x5c\x48", "\x5c\x49", "\x00\x00", "\x00\x00", "\x5c\x4a", + "\x5c\x4b", "\x5c\x4c", "\x5c\x4d", "\x00\x00", "\x00\x00", "\x5c\x4e", + "\x5c\x4f", "\x5c\x50", "\x5c\x51", "\x5c\x52", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5c\x53", "\x00\x00", "\x5c\x54", "\x5c\x55", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x56", "\x5c\x57", "\x5c\x58", + "\x5c\x59", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5c\x5a", "\x5c\x5b", "\x00\x00", "\x5c\x5c", "\x5c\x5d", "\x5c\x5e", + "\x00\x00", "\x5c\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x60", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x61", + "\x5c\x62", "\x5c\x63", "\x5c\x64", "\x5c\x65", "\x5c\x66", "\x00\x00", + "\x00\x00", "\x5c\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x68", + "\x5c\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x6a", "\x00\x00", + "\x5c\x6b", "\x00\x00", "\x5c\x6c", "\x00\x00", "\x00\x00", "\x5c\x6d", + "\x5c\x6e", "\x00\x00", "\x00\x00", "\x5c\x6f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x70", "\x00\x00", "\x00\x00", + "\x5c\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x72", + "\x00\x00", "\x00\x00", "\x5c\x73", "\x5c\x74", "\x5c\x75", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x76", "\x5c\x77", "\x5c\x78", + "\x5c\x79", "\x00\x00", "\x00\x00", "\x5c\x7a", "\x00\x00", "\x5c\x7b", + "\x00\x00", "\x00\x00", "\x5c\x7c", "\x00\x00", "\x5c\x7d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5c\x7e", "\x5d\x21", "\x5d\x22", + "\x5d\x23", "\x5d\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x25", + "\x00\x00", "\x00\x00", "\x5d\x26", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5d\x27", "\x5d\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5d\x29", "\x5d\x2a", "\x00\x00", "\x00\x00", "\x5d\x2b", + "\x5d\x2c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x2d", + "\x5d\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x2f", "\x5d\x30", + "\x5d\x31", "\x5d\x32", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5d\x33", "\x5d\x34", "\x5d\x35", "\x5d\x36", "\x5d\x37", "\x5d\x38", + "\x5d\x39", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x3a", "\x00\x00", + "\x5d\x3b", "\x00\x00", "\x5d\x3c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5d\x3d", "\x00\x00", "\x5d\x3e", "\x00\x00", "\x00\x00", "\x5d\x3f", + "\x00\x00", "\x00\x00", "\x5d\x40", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5d\x41", "\x00\x00", "\x5d\x42", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5d\x43", "\x5d\x44", "\x00\x00", "\x5d\x45", "\x5d\x46", + "\x00\x00", "\x5d\x47", "\x5d\x48", "\x00\x00", "\x5d\x49", "\x5d\x4a", + "\x5d\x4b", "\x00\x00", "\x5d\x4c", "\x00\x00", "\x5d\x4d", "\x00\x00", + "\x5d\x4e", "\x00\x00", "\x5d\x4f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5d\x50", "\x5d\x51", "\x00\x00", "\x00\x00", "\x5d\x52", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x53", + "\x00\x00", "\x5d\x54", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5d\x55", "\x5d\x56", "\x00\x00", "\x5d\x57", "\x00\x00", + "\x00\x00", "\x5d\x58", "\x00\x00", "\x5d\x59", "\x00\x00", "\x5d\x5a", + "\x00\x00", "\x5d\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x5c", + "\x5d\x5d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x5e", + "\x00\x00", "\x00\x00", "\x5d\x5f", "\x5d\x60", "\x5d\x61", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5d\x62", "\x5d\x63", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5d\x64", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x65", + "\x00\x00", "\x5d\x66", "\x5d\x67", "\x5d\x68", "\x5d\x69", "\x00\x00", + "\x5d\x6a", "\x5d\x6b", "\x5d\x6c", "\x00\x00", "\x00\x00", "\x5d\x6d", + "\x5d\x6e", "\x5d\x6f", "\x00\x00", "\x00\x00", "\x5d\x70", "\x00\x00", + "\x00\x00", "\x5d\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5d\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x73", "\x5d\x74", + "\x00\x00", "\x5d\x75", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x76", + "\x5d\x77", "\x00\x00", "\x5d\x78", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5d\x79", "\x5d\x7a", "\x00\x00", "\x5d\x7b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x7c", "\x5d\x7d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5d\x7e", "\x00\x00", "\x00\x00", + "\x5e\x21", "\x5e\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x23", + "\x00\x00", "\x00\x00", "\x5e\x24", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x25", "\x00\x00", "\x00\x00", "\x5e\x26", "\x00\x00", + "\x5e\x27", "\x5e\x28", "\x5e\x29", "\x5e\x2a", "\x00\x00", "\x5e\x2b", + "\x5e\x2c", "\x5e\x2d", "\x00\x00", "\x5e\x2e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x2f", "\x00\x00", "\x5e\x30", + "\x5e\x31", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x32", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5e\x33", "\x5e\x34", "\x5e\x35", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x36", "\x00\x00", + "\x00\x00", "\x5e\x37", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x38", "\x5e\x39", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5e\x3f", "\x5e\x3a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x3b", "\x5e\x3c", "\x00\x00", "\x5e\x3d", "\x5e\x3e", + "\x5e\x40", "\x00\x00", "\x00\x00", "\x5e\x41", "\x5e\x42", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x43", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x44", "\x5e\x45", "\x5e\x46", + "\x5e\x47", "\x5e\x48", "\x00\x00", "\x5e\x49", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5e\x4e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x4a", "\x5e\x4b", "\x5e\x4c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5e\x4d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x4f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5e\x50", "\x5e\x51", "\x5e\x52", "\x00\x00", "\x5e\x53", "\x5e\x54", + "\x00\x00", "\x00\x00", "\x5e\x55", "\x00\x00", "\x5e\x56", "\x00\x00", + "\x00\x00", "\x5e\x57", "\x00\x00", "\x00\x00", "\x5e\x58", "\x5e\x59", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x5a", + "\x00\x00", "\x5e\x5b", "\x00\x00", "\x5e\x5c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5e\x5d", "\x5e\x5e", "\x5e\x5f", "\x00\x00", + "\x5e\x60", "\x5e\x61", "\x5e\x62", "\x5e\x63", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x64", "\x5e\x65", "\x5e\x66", "\x00\x00", "\x5e\x67", + "\x00\x00", "\x5e\x68", "\x00\x00", "\x5e\x69", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x6a", "\x00\x00", "\x5e\x6b", "\x00\x00", "\x5e\x6c", + "\x5e\x6d", "\x00\x00", "\x00\x00", "\x5e\x6e", "\x5e\x6f", "\x5e\x72", + "\x00\x00", "\x5e\x70", "\x00\x00", "\x5e\x71", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x73", "\x5e\x74", "\x00\x00", + "\x5e\x75", "\x00\x00", "\x5e\x76", "\x5e\x77", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x78", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5e\x79", "\x00\x00", "\x5e\x7a", "\x5e\x7b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5e\x7c", "\x00\x00", "\x00\x00", + "\x5e\x7d", "\x5e\x7e", "\x5f\x21", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x23", + "\x00\x00", "\x5f\x24", "\x5f\x25", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x26", "\x00\x00", "\x5f\x27", "\x5f\x28", + "\x5f\x29", "\x5f\x2a", "\x5f\x2b", "\x5f\x2c", "\x5f\x2d", "\x00\x00", + "\x00\x00", "\x5f\x2e", "\x00\x00", "\x5f\x2f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x32", "\x5f\x31", "\x00\x00", "\x00\x00", "\x5f\x33", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x34", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x35", "\x5f\x36", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x37", "\x00\x00", "\x00\x00", "\x5f\x38", "\x5f\x39", "\x00\x00", + "\x5f\x3a", "\x00\x00", "\x00\x00", "\x5f\x3b", "\x00\x00", "\x5f\x3c", + "\x5f\x3d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x3e", "\x5f\x3f", "\x00\x00", "\x5f\x40", "\x00\x00", "\x5f\x41", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x42", + "\x5f\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x44", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x45", "\x5f\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x47", "\x00\x00", "\x00\x00", "\x5f\x48", + "\x00\x00", "\x5f\x49", "\x5f\x4a", "\x00\x00", "\x00\x00", "\x5f\x4b", + "\x00\x00", "\x5f\x4c", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x4d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x4e", "\x00\x00", + "\x00\x00", "\x5f\x4f", "\x5f\x50", "\x00\x00", "\x00\x00", "\x00\x00", + "\x5f\x51", "\x5f\x52", "\x5f\x53", "\x5f\x54", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x55", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x56", "\x5f\x57", "\x00\x00", "\x00\x00", + "\x5f\x58", "\x00\x00", "\x00\x00", "\x5f\x59", "\x00\x00", "\x00\x00", + "\x5f\x5a", "\x00\x00", "\x5f\x5b", "\x00\x00", "\x5f\x5c", "\x00\x00", + "\x5f\x5d", "\x5f\x6f", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x5e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x5f", "\x5f\x60", + "\x5f\x61", "\x5f\x62", "\x00\x00", "\x5f\x63", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x64", "\x00\x00", "\x00\x00", "\x5f\x65", "\x00\x00", + "\x00\x00", "\x5f\x66", "\x5f\x67", "\x00\x00", "\x5f\x68", "\x00\x00", + "\x5f\x69", "\x5f\x6a", "\x5f\x6b", "\x00\x00", "\x5f\x6c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x6d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x5f\x6e", "\x5f\x70", "\x5f\x71", "\x00\x00", "\x5f\x72", + "\x5f\x73", "\x00\x00", "\x00\x00", "\x00\x00", "\x5f\x74", "\x00\x00", + "\x00\x00", "\x5f\x75", "\x5f\x76", "\x5f\x77", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x78", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x5f\x79", "\x00\x00", "\x00\x00", "\x5f\x7a", + "\x00\x00", "\x5f\x7b", "\x5f\x7c", "\x5f\x7d", "\x5f\x7e", "\x60\x21", + "\x00\x00", "\x00\x00", "\x60\x22", "\x60\x23", "\x60\x24", "\x00\x00", + "\x60\x25", "\x00\x00", "\x00\x00", "\x60\x26", "\x60\x27", "\x60\x28", + "\x60\x29", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x2a", "\x00\x00", + "\x00\x00", "\x60\x2b", "\x60\x2c", "\x60\x2d", "\x00\x00", "\x60\x2e", + "\x60\x2f", "\x60\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x60\x31", "\x60\x32", "\x60\x33", "\x60\x34", "\x60\x35", "\x00\x00", + "\x00\x00", "\x60\x36", "\x60\x37", "\x60\x38", "\x00\x00", "\x00\x00", + "\x60\x39", "\x60\x3a", "\x00\x00", "\x60\x3b", "\x60\x3c", "\x60\x3d", + "\x60\x3e", "\x60\x3f", "\x60\x40", "\x60\x41", "\x60\x42", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x43", "\x60\x44", + "\x00\x00", "\x60\x45", "\x00\x00", "\x00\x00", "\x60\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x47", "\x60\x48", "\x00\x00", + "\x60\x49", "\x60\x4a", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x4b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x4c", "\x00\x00", + "\x60\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x4e", "\x60\x4f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x50", "\x00\x00", + "\x60\x51", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x52", + "\x60\x53", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x54", + "\x60\x55", "\x00\x00", "\x60\x56", "\x60\x57", "\x00\x00", "\x00\x00", + "\x60\x58", "\x60\x59", "\x00\x00", "\x60\x5a", "\x00\x00", "\x00\x00", + "\x60\x5b", "\x60\x5c", "\x60\x5d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x60\x64", "\x60\x5e", "\x00\x00", "\x60\x5f", "\x60\x60", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x61", + "\x00\x00", "\x60\x62", "\x60\x63", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x60\x65", "\x00\x00", "\x60\x66", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x67", "\x60\x68", "\x60\x69", + "\x60\x6a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x60\x6b", "\x60\x6c", "\x60\x6d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x60\x6e", "\x00\x00", "\x60\x6f", "\x60\x70", + "\x00\x00", "\x60\x71", "\x00\x00", "\x60\x72", "\x00\x00", "\x60\x73", + "\x60\x74", "\x00\x00", "\x00\x00", "\x00\x00", "\x60\x75", "\x60\x76", + "\x60\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x60\x78", "\x60\x79", "\x60\x7a", "\x60\x7b", "\x00\x00", "\x00\x00", + "\x60\x7c", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x60\x7d", "\x60\x7e", "\x00\x00", "\x61\x21", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x22", "\x61\x23", "\x00\x00", "\x61\x24", "\x61\x25", + "\x61\x26", "\x61\x27", "\x61\x28", "\x00\x00", "\x00\x00", "\x61\x29", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x2a", "\x61\x2b", + "\x61\x2c", "\x61\x2d", "\x00\x00", "\x00\x00", "\x61\x2e", "\x61\x2f", + "\x00\x00", "\x00\x00", "\x61\x30", "\x61\x31", "\x61\x32", "\x61\x33", + "\x61\x34", "\x00\x00", "\x61\x35", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x61\x36", "\x00\x00", "\x61\x37", "\x61\x38", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x39", "\x00\x00", + "\x00\x00", "\x00\x00", "\x61\x3a", "\x61\x3b", "\x00\x00", "\x61\x3c", + "\x00\x00", "\x00\x00", "\x61\x3d", "\x00\x00", "\x61\x3e", "\x61\x3f", + "\x00\x00", "\x61\x40", "\x61\x41", "\x00\x00", "\x00\x00", "\x61\x42", + "\x61\x43", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x44", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x45", "\x00\x00", + "\x00\x00", "\x61\x46", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x47", + "\x61\x48", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x49", + "\x00\x00", "\x00\x00", "\x61\x4a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x61\x4b", "\x00\x00", "\x61\x4c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x61\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x4e", "\x61\x4f", + "\x00\x00", "\x00\x00", "\x61\x50", "\x61\x51", "\x61\x52", "\x61\x54", + "\x00\x00", "\x61\x55", "\x61\x56", "\x00\x00", "\x61\x53", "\x00\x00", + "\x00\x00", "\x00\x00", "\x61\x57", "\x61\x58", "\x00\x00", "\x00\x00", + "\x61\x59", "\x61\x5a", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x5b", + "\x61\x5c", "\x61\x5d", "\x61\x5e", "\x00\x00", "\x61\x5f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x60", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x61", "\x61\x62", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x64", + "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x65", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x61\x66", "\x61\x67", "\x00\x00", "\x00\x00", + "\x61\x68", "\x00\x00", "\x00\x00", "\x61\x69", "\x61\x6a", "\x00\x00", + "\x61\x6b", "\x00\x00", "\x61\x6c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x6d", "\x00\x00", "\x61\x6e", "\x61\x6f", "\x61\x70", + "\x00\x00", "\x61\x71", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x61\x72", "\x61\x73", "\x61\x74", "\x00\x00", "\x00\x00", "\x61\x75", + "\x61\x76", "\x00\x00", "\x61\x77", "\x61\x78", "\x61\x79", "\x00\x00", + "\x61\x7a", "\x61\x7b", "\x61\x7d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x61\x7e", "\x62\x21", "\x62\x22", "\x00\x00", "\x62\x23", + "\x62\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x61\x7c", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x2d", "\x00\x00", + "\x00\x00", "\x62\x25", "\x00\x00", "\x62\x26", "\x62\x27", "\x62\x28", + "\x00\x00", "\x00\x00", "\x62\x29", "\x62\x2a", "\x00\x00", "\x62\x2b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x2c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x2f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x30", "\x62\x31", "\x00\x00", + "\x00\x00", "\x00\x00", "\x62\x32", "\x00\x00", "\x62\x2e", "\x62\x33", + "\x62\x34", "\x62\x35", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x36", + "\x62\x37", "\x62\x38", "\x00\x00", "\x62\x39", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x62\x3a", "\x00\x00", "\x00\x00", "\x62\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x3c", "\x00\x00", "\x62\x3d", + "\x62\x3e", "\x62\x3f", "\x00\x00", "\x62\x40", "\x00\x00", "\x62\x41", + "\x00\x00", "\x62\x42", "\x00\x00", "\x62\x43", "\x00\x00", "\x62\x45", + "\x62\x46", "\x00\x00", "\x62\x44", "\x00\x00", "\x62\x47", "\x00\x00", + "\x62\x48", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x49", + "\x62\x4a", "\x00\x00", "\x62\x4b", "\x00\x00", "\x00\x00", "\x62\x4c", + "\x00\x00", "\x62\x4d", "\x62\x4e", "\x00\x00", "\x62\x4f", "\x62\x50", + "\x00\x00", "\x62\x51", "\x62\x52", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x62\x53", "\x00\x00", "\x00\x00", "\x00\x00", + "\x62\x54", "\x62\x55", "\x62\x56", "\x00\x00", "\x00\x00", "\x00\x00", + "\x62\x57", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x58", "\x00\x00", + "\x62\x59", "\x62\x5a", "\x62\x5b", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x62\x5c", "\x00\x00", "\x00\x00", "\x62\x5d", + "\x00\x00", "\x00\x00", "\x62\x5e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x62\x5f", "\x62\x60", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x62\x61", "\x62\x62", "\x62\x63", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x64", "\x00\x00", + "\x62\x65", "\x00\x00", "\x62\x66", "\x62\x67", "\x00\x00", "\x00\x00", + "\x00\x00", "\x62\x68", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x69", + "\x00\x00", "\x00\x00", "\x62\x6a", "\x00\x00", "\x62\x6b", "\x62\x6c", + "\x62\x6d", "\x00\x00", "\x00\x00", "\x62\x6e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x6f", "\x00\x00", "\x00\x00", + "\x62\x70", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x71", + "\x00\x00", "\x62\x72", "\x00\x00", "\x00\x00", "\x00\x00", "\x62\x73", + "\x62\x74", "\x62\x75", "\x00\x00", "\x62\x76", "\x62\x77", "\x62\x78", + "\x62\x79", "\x00\x00", "\x00\x00", "\x62\x7a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x62\x7b", "\x62\x7c", "\x62\x7d", "\x00\x00", + "\x62\x7e", "\x00\x00", "\x00\x00", "\x63\x21", "\x63\x22", "\x00\x00", + "\x63\x23", "\x63\x24", "\x63\x25", "\x00\x00", "\x00\x00", "\x63\x26", + "\x00\x00", "\x63\x27", "\x63\x28", "\x00\x00", "\x00\x00", "\x00\x00", + "\x63\x29", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x63\x2a", "\x63\x2b", "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x2c", + "\x63\x2d", "\x00\x00", "\x63\x2e", "\x63\x2f", "\x63\x30", "\x63\x31", + "\x63\x32", "\x63\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x63\x34", "\x00\x00", "\x63\x35", "\x00\x00", "\x63\x36", + "\x00\x00", "\x63\x37", "\x00\x00", "\x00\x00", "\x63\x38", "\x63\x39", + "\x00\x00", "\x00\x00", "\x63\x3a", "\x63\x3b", "\x63\x3c", "\x63\x3d", + "\x00\x00", "\x63\x3e", "\x63\x3f", "\x00\x00", "\x63\x40", "\x00\x00", + "\x00\x00", "\x00\x00", "\x63\x41", "\x00\x00", "\x63\x42", "\x63\x43", + "\x00\x00", "\x00\x00", "\x63\x44", "\x00\x00", "\x63\x45", "\x00\x00", + "\x00\x00", "\x00\x00", "\x63\x46", "\x63\x47", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x48", "\x63\x49", "\x63\x4a", + "\x63\x4b", "\x00\x00", "\x63\x4c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x63\x4d", "\x63\x4e", "\x63\x4f", "\x00\x00", + "\x00\x00", "\x63\x50", "\x00\x00", "\x63\x51", "\x63\x52", "\x00\x00", + "\x63\x53", "\x63\x54", "\x63\x55", "\x00\x00", "\x63\x56", "\x00\x00", + "\x63\x57", "\x00\x00", "\x63\x58", "\x00\x00", "\x63\x59", "\x63\x5a", + "\x00\x00", "\x00\x00", "\x63\x5b", "\x63\x5c", "\x00\x00", "\x00\x00", + "\x63\x5d", "\x00\x00", "\x00\x00", "\x63\x5e", "\x63\x5f", "\x63\x60", + "\x00\x00", "\x63\x61", "\x63\x62", "\x63\x63", "\x00\x00", "\x00\x00", + "\x63\x64", "\x63\x65", "\x00\x00", "\x00\x00", "\x63\x66", "\x63\x67", + "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x68", "\x00\x00", "\x63\x69", + "\x63\x6a", "\x63\x6b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x63\x6c", "\x63\x6d", "\x63\x6e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x63\x6f", "\x63\x70", "\x63\x71", "\x63\x72", "\x63\x73", + "\x00\x00", "\x63\x74", "\x63\x75", "\x63\x76", "\x00\x00", "\x63\x77", + "\x63\x78", "\x63\x79", "\x63\x7a", "\x00\x00", "\x00\x00", "\x63\x7b", + "\x63\x7c", "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x7d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x63\x7e", "\x00\x00", "\x64\x21", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x22", + "\x64\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x24", "\x64\x25", + "\x00\x00", "\x64\x26", "\x64\x27", "\x00\x00", "\x00\x00", "\x64\x28", + "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x29", "\x00\x00", "\x00\x00", + "\x64\x2a", "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x2b", "\x00\x00", + "\x64\x2c", "\x00\x00", "\x64\x2d", "\x64\x2e", "\x64\x2f", "\x64\x30", + "\x00\x00", "\x64\x31", "\x64\x32", "\x64\x33", "\x64\x34", "\x64\x35", + "\x00\x00", "\x64\x36", "\x64\x37", "\x64\x38", "\x64\x39", "\x00\x00", + "\x00\x00", "\x64\x3a", "\x64\x3b", "\x64\x3c", "\x64\x3d", "\x00\x00", + "\x64\x3e", "\x00\x00", "\x00\x00", "\x64\x3f", "\x00\x00", "\x64\x40", + "\x00\x00", "\x64\x41", "\x64\x42", "\x64\x43", "\x00\x00", "\x00\x00", + "\x64\x44", "\x64\x45", "\x00\x00", "\x64\x46", "\x64\x47", "\x64\x48", + "\x00\x00", "\x64\x49", "\x00\x00", "\x64\x4a", "\x00\x00", "\x64\x4b", + "\x64\x4c", "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x4d", "\x00\x00", + "\x64\x4e", "\x00\x00", "\x64\x4f", "\x64\x50", "\x00\x00", "\x64\x51", + "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x52", "\x64\x53", "\x00\x00", + "\x64\x54", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x64\x55", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x56", + "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x57", "\x00\x00", "\x00\x00", + "\x64\x58", "\x64\x59", "\x64\x5a", "\x64\x5b", "\x64\x5c", "\x64\x5d", + "\x00\x00", "\x64\x5e", "\x00\x00", "\x00\x00", "\x64\x5f", "\x64\x60", + "\x00\x00", "\x64\x61", "\x00\x00", "\x64\x62", "\x64\x63", "\x64\x64", + "\x64\x65", "\x00\x00", "\x64\x66", "\x64\x67", "\x64\x68", "\x64\x69", + "\x64\x6a", "\x64\x6b", "\x64\x6c", "\x64\x6d", "\x00\x00", "\x00\x00", + "\x64\x6e", "\x00\x00", "\x64\x6f", "\x64\x70", "\x00\x00", "\x64\x71", + "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x72", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x64\x73", "\x64\x74", "\x00\x00", + "\x64\x75", "\x00\x00", "\x64\x76", "\x64\x77", "\x00\x00", "\x00\x00", + "\x64\x78", "\x00\x00", "\x64\x79", "\x64\x7a", "\x64\x7b", "\x00\x00", + "\x64\x7c", "\x64\x7d", "\x00\x00", "\x64\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x65\x21", "\x00\x00", "\x00\x00", "\x65\x22", "\x00\x00", + "\x65\x23", "\x65\x24", "\x65\x25", "\x65\x26", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x27", "\x00\x00", "\x65\x28", + "\x65\x29", "\x00\x00", "\x65\x2a", "\x00\x00", "\x65\x2b", "\x00\x00", + "\x00\x00", "\x65\x2c", "\x00\x00", "\x00\x00", "\x65\x2d", "\x00\x00", + "\x00\x00", "\x65\x2e", "\x00\x00", "\x00\x00", "\x65\x2f", "\x00\x00", + "\x00\x00", "\x65\x30", "\x00\x00", "\x00\x00", "\x65\x31", "\x00\x00", + "\x65\x32", "\x65\x33", "\x00\x00", "\x65\x34", "\x00\x00", "\x65\x35", + "\x65\x3b", "\x00\x00", "\x65\x36", "\x65\x37", "\x65\x38", "\x65\x39", + "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x3a", "\x65\x3c", "\x00\x00", + "\x00\x00", "\x65\x3d", "\x65\x3e", "\x65\x3f", "\x65\x40", "\x00\x00", + "\x65\x41", "\x65\x42", "\x65\x43", "\x65\x44", "\x65\x45", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x46", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x47", "\x00\x00", + "\x00\x00", "\x65\x48", "\x00\x00", "\x65\x49", "\x65\x4a", "\x00\x00", + "\x00\x00", "\x65\x4b", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x4c", + "\x65\x4d", "\x65\x4f", "\x65\x50", "\x65\x4e", "\x65\x51", "\x65\x52", + "\x00\x00", "\x65\x53", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x54", + "\x65\x55", "\x00\x00", "\x65\x56", "\x00\x00", "\x00\x00", "\x00\x00", + "\x65\x57", "\x65\x58", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x59", + "\x65\x5a", "\x65\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x65\x5c", "\x65\x5d", "\x65\x5e", "\x65\x5f", "\x65\x60", + "\x65\x61", "\x00\x00", "\x65\x62", "\x65\x63", "\x65\x64", "\x65\x65", + "\x65\x66", "\x00\x00", "\x65\x68", "\x00\x00", "\x65\x67", "\x00\x00", + "\x00\x00", "\x00\x00", "\x65\x69", "\x00\x00", "\x65\x6a", "\x00\x00", + "\x00\x00", "\x65\x6b", "\x00\x00", "\x65\x6c", "\x00\x00", "\x65\x6d", + "\x65\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x65\x6f", "\x00\x00", + "\x00\x00", "\x65\x70", "\x00\x00", "\x00\x00", "\x65\x71", "\x00\x00", + "\x65\x72", "\x00\x00", "\x65\x73", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x65\x74", "\x00\x00", "\x00\x00", "\x65\x75", "\x00\x00", + "\x65\x76", "\x65\x77", "\x65\x78", "\x00\x00", "\x65\x79", "\x65\x7a", + "\x65\x7c", "\x65\x7b", "\x65\x7d", "\x65\x7e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x21", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x22", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x23", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x24", "\x66\x25", + "\x66\x26", "\x66\x27", "\x66\x28", "\x66\x29", "\x00\x00", "\x66\x2a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x2b", "\x00\x00", + "\x00\x00", "\x66\x2c", "\x00\x00", "\x66\x2d", "\x66\x2e", "\x66\x2f", + "\x00\x00", "\x66\x30", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x31", + "\x00\x00", "\x00\x00", "\x66\x32", "\x00\x00", "\x66\x33", "\x66\x34", + "\x00\x00", "\x66\x35", "\x66\x36", "\x00\x00", "\x66\x37", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x38", "\x66\x39", "\x66\x3a", + "\x66\x3b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x3c", "\x66\x3d", "\x00\x00", "\x00\x00", "\x66\x3e", "\x66\x3f", + "\x66\x40", "\x66\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x42", + "\x00\x00", "\x66\x43", "\x66\x44", "\x66\x45", "\x00\x00", "\x00\x00", + "\x00\x00", "\x66\x46", "\x00\x00", "\x66\x47", "\x66\x48", "\x66\x49", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x4a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x4b", "\x00\x00", + "\x66\x4c", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x4d", "\x66\x4e", + "\x66\x4f", "\x66\x50", "\x00\x00", "\x66\x51", "\x66\x52", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x53", "\x66\x54", "\x00\x00", "\x66\x55", + "\x00\x00", "\x66\x56", "\x66\x57", "\x66\x58", "\x66\x59", "\x66\x5a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x5b", + "\x66\x5c", "\x66\x5d", "\x00\x00", "\x66\x5e", "\x66\x5f", "\x00\x00", + "\x66\x60", "\x66\x61", "\x66\x62", "\x66\x63", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x64", "\x66\x65", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x66", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x67", "\x00\x00", "\x00\x00", "\x66\x68", "\x00\x00", "\x66\x69", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x6a", "\x66\x6b", + "\x66\x6c", "\x00\x00", "\x00\x00", "\x66\x6d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x66\x6e", "\x66\x6f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x66\x70", "\x66\x71", "\x66\x72", "\x66\x73", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x66\x75", "\x00\x00", + "\x66\x76", "\x00\x00", "\x00\x00", "\x66\x77", "\x66\x78", "\x66\x79", + "\x66\x7a", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x66\x7b", "\x00\x00", "\x66\x7c", "\x66\x7d", "\x66\x7e", "\x67\x21", + "\x00\x00", "\x67\x22", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x23", + "\x67\x24", "\x67\x25", "\x00\x00", "\x67\x26", "\x00\x00", "\x00\x00", + "\x00\x00", "\x67\x27", "\x67\x28", "\x67\x29", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x67\x2a", "\x67\x2b", "\x00\x00", "\x67\x2c", + "\x67\x2d", "\x00\x00", "\x67\x2e", "\x67\x2f", "\x00\x00", "\x00\x00", + "\x00\x00", "\x67\x30", "\x67\x31", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x67\x32", "\x00\x00", "\x67\x33", "\x67\x34", + "\x00\x00", "\x67\x35", "\x67\x36", "\x67\x37", "\x00\x00", "\x00\x00", + "\x00\x00", "\x67\x38", "\x00\x00", "\x00\x00", "\x67\x39", "\x00\x00", + "\x00\x00", "\x00\x00", "\x67\x3a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x67\x3b", "\x00\x00", "\x00\x00", "\x67\x3c", "\x67\x3d", + "\x67\x3e", "\x00\x00", "\x00\x00", "\x67\x3f", "\x00\x00", "\x67\x40", + "\x00\x00", "\x67\x41", "\x67\x42", "\x67\x43", "\x67\x44", "\x67\x45", + "\x67\x46", "\x00\x00", "\x67\x47", "\x67\x48", "\x00\x00", "\x00\x00", + "\x00\x00", "\x67\x49", "\x67\x4a", "\x00\x00", "\x00\x00", "\x67\x4b", + "\x67\x4c", "\x00\x00", "\x67\x4d", "\x00\x00", "\x00\x00", "\x67\x4e", + "\x67\x4f", "\x00\x00", "\x00\x00", "\x67\x50", "\x67\x51", "\x00\x00", + "\x67\x52", "\x67\x53", "\x67\x54", "\x00\x00", "\x67\x55", "\x00\x00", + "\x67\x56", "\x67\x57", "\x00\x00", "\x67\x58", "\x00\x00", "\x00\x00", + "\x67\x59", "\x67\x5a", "\x00\x00", "\x67\x5b", "\x00\x00", "\x67\x5c", + "\x67\x5d", "\x00\x00", "\x67\x5e", "\x67\x5f", "\x67\x60", "\x00\x00", + "\x67\x61", "\x67\x62", "\x00\x00", "\x00\x00", "\x67\x63", "\x00\x00", + "\x00\x00", "\x67\x64", "\x67\x65", "\x67\x66", "\x00\x00", "\x67\x6a", + "\x00\x00", "\x67\x67", "\x67\x68", "\x00\x00", "\x67\x69", "\x67\x6b", + "\x00\x00", "\x00\x00", "\x67\x6c", "\x67\x6d", "\x00\x00", "\x67\x6e", + "\x00\x00", "\x00\x00", "\x67\x6f", "\x00\x00", "\x00\x00", "\x67\x70", + "\x67\x71", "\x00\x00", "\x67\x72", "\x67\x73", "\x00\x00", "\x00\x00", + "\x67\x74", "\x00\x00", "\x00\x00", "\x67\x76", "\x67\x77", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x67\x78", "\x00\x00", + "\x67\x79", "\x00\x00", "\x00\x00", "\x67\x75", "\x00\x00", "\x00\x00", + "\x67\x7a", "\x00\x00", "\x67\x7b", "\x00\x00", "\x67\x7c", "\x00\x00", + "\x00\x00", "\x67\x7d", "\x00\x00", "\x68\x28", "\x67\x7e", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x21", "\x00\x00", "\x00\x00", + "\x68\x22", "\x68\x23", "\x68\x24", "\x00\x00", "\x68\x25", "\x68\x26", + "\x00\x00", "\x68\x27", "\x68\x29", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x2a", "\x00\x00", "\x00\x00", "\x68\x2b", + "\x00\x00", "\x00\x00", "\x68\x2c", "\x68\x2d", "\x68\x2e", "\x68\x2f", + "\x00\x00", "\x00\x00", "\x68\x30", "\x68\x31", "\x00\x00", "\x68\x32", + "\x68\x33", "\x68\x34", "\x68\x35", "\x00\x00", "\x68\x36", "\x68\x37", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x38", "\x00\x00", "\x68\x39", + "\x68\x3a", "\x00\x00", "\x68\x3b", "\x68\x3c", "\x00\x00", "\x68\x3d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x3e", "\x00\x00", "\x00\x00", + "\x68\x3f", "\x68\x40", "\x00\x00", "\x68\x41", "\x68\x42", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x43", "\x00\x00", "\x00\x00", "\x68\x44", + "\x00\x00", "\x00\x00", "\x68\x45", "\x00\x00", "\x00\x00", "\x68\x46", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x47", "\x68\x48", "\x00\x00", + "\x68\x49", "\x00\x00", "\x68\x4a", "\x68\x4b", "\x68\x4c", "\x00\x00", + "\x00\x00", "\x68\x4d", "\x68\x4e", "\x00\x00", "\x00\x00", "\x68\x4f", + "\x68\x50", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x51", + "\x68\x52", "\x68\x53", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x54", + "\x68\x55", "\x68\x56", "\x00\x00", "\x00\x00", "\x68\x57", "\x68\x58", + "\x68\x59", "\x00\x00", "\x00\x00", "\x68\x5a", "\x00\x00", "\x00\x00", + "\x68\x5b", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x5c", "\x68\x5d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x5e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x5f", "\x68\x60", "\x68\x61", + "\x68\x62", "\x68\x63", "\x00\x00", "\x00\x00", "\x00\x00", "\x68\x64", + "\x68\x65", "\x68\x66", "\x68\x67", "\x00\x00", "\x00\x00", "\x00\x00", + "\x68\x68", "\x68\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x68\x6a", "\x68\x6b", "\x68\x6c", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x68\x6d", "\x68\x6e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x68\x6f", "\x00\x00", "\x00\x00", "\x00\x00", + "\x68\x70", "\x68\x71", "\x00\x00", "\x68\x72", "\x68\x73", "\x00\x00", + "\x68\x74", "\x68\x75", "\x68\x76", "\x68\x77", "\x00\x00", "\x68\x78", + "\x00\x00", "\x68\x79", "\x68\x7a", "\x68\x7b", "\x68\x7c", "\x68\x7d", + "\x00\x00", "\x00\x00", "\x68\x7e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x69\x21", "\x69\x22", "\x00\x00", "\x00\x00", "\x69\x23", "\x00\x00", + "\x69\x24", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x25", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x26", "\x69\x27", + "\x69\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x29", + "\x69\x2a", "\x00\x00", "\x69\x2b", "\x00\x00", "\x69\x2c", "\x69\x2d", + "\x00\x00", "\x00\x00", "\x69\x2e", "\x69\x2f", "\x69\x30", "\x00\x00", + "\x00\x00", "\x00\x00", "\x69\x31", "\x00\x00", "\x00\x00", "\x00\x00", + "\x69\x32", "\x69\x33", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x34", + "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x35", "\x69\x36", "\x00\x00", + "\x00\x00", "\x00\x00", "\x69\x37", "\x69\x38", "\x69\x39", "\x69\x3a", + "\x69\x3b", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x3c", "\x69\x3d", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x3e", "\x69\x3f", + "\x00\x00", "\x69\x40", "\x00\x00", "\x69\x41", "\x69\x42", "\x69\x43", + "\x00\x00", "\x00\x00", "\x69\x44", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x69\x45", "\x69\x46", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x69\x47", "\x00\x00", "\x69\x48", "\x69\x49", + "\x00\x00", "\x69\x4a", "\x69\x4c", "\x00\x00", "\x00\x00", "\x69\x4d", + "\x00\x00", "\x00\x00", "\x69\x4b", "\x00\x00", "\x00\x00", "\x69\x4e", + "\x69\x4f", "\x69\x50", "\x00\x00", "\x69\x51", "\x00\x00", "\x00\x00", + "\x69\x52", "\x00\x00", "\x00\x00", "\x69\x53", "\x00\x00", "\x69\x54", + "\x69\x55", "\x69\x56", "\x00\x00", "\x69\x57", "\x00\x00", "\x69\x58", + "\x69\x59", "\x00\x00", "\x00\x00", "\x69\x5a", "\x00\x00", "\x69\x5b", + "\x69\x5c", "\x69\x5d", "\x00\x00", "\x00\x00", "\x69\x5e", "\x00\x00", + "\x69\x5f", "\x00\x00", "\x00\x00", "\x69\x60", "\x69\x61", "\x00\x00", + "\x69\x62", "\x00\x00", "\x69\x63", "\x00\x00", "\x00\x00", "\x69\x64", + "\x00\x00", "\x69\x65", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x69\x66", "\x00\x00", "\x69\x67", "\x00\x00", "\x69\x68", + "\x00\x00", "\x00\x00", "\x69\x69", "\x69\x6a", "\x69\x6b", "\x00\x00", + "\x00\x00", "\x00\x00", "\x69\x6c", "\x69\x6d", "\x00\x00", "\x00\x00", + "\x00\x00", "\x69\x6e", "\x00\x00", "\x00\x00", "\x00\x00", "\x69\x6f", + "\x69\x70", "\x00\x00", "\x69\x71", "\x00\x00", "\x69\x72", "\x00\x00", + "\x00\x00", "\x69\x73", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x69\x74", "\x69\x75", "\x00\x00", "\x69\x76", "\x00\x00", + "\x00\x00", "\x00\x00", "\x69\x77", "\x69\x78", "\x00\x00", "\x00\x00", + "\x69\x79", "\x00\x00", "\x69\x7a", "\x69\x7b", "\x69\x7c", "\x69\x7d", + "\x69\x7e", "\x6a\x21", "\x6a\x22", "\x00\x00", "\x00\x00", "\x6a\x23", + "\x6a\x24", "\x00\x00", "\x6a\x25", "\x6a\x26", "\x6a\x27", "\x6a\x28", + "\x00\x00", "\x6a\x29", "\x00\x00", "\x6a\x2a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6a\x2b", "\x00\x00", "\x00\x00", "\x6a\x2c", "\x00\x00", + "\x6a\x2d", "\x6a\x2e", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x2f", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x30", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x31", "\x00\x00", + "\x6a\x32", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6a\x33", "\x6a\x34", "\x6a\x35", "\x00\x00", "\x6a\x36", "\x00\x00", + "\x6a\x37", "\x6a\x38", "\x00\x00", "\x00\x00", "\x6a\x39", "\x6a\x3a", + "\x00\x00", "\x00\x00", "\x6a\x3b", "\x6a\x3c", "\x6a\x3d", "\x6a\x3e", + "\x6a\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x40", "\x00\x00", + "\x00\x00", "\x6a\x41", "\x00\x00", "\x00\x00", "\x6a\x42", "\x00\x00", + "\x6a\x43", "\x00\x00", "\x6a\x44", "\x6a\x45", "\x00\x00", "\x6a\x46", + "\x00\x00", "\x6a\x47", "\x6a\x48", "\x6a\x49", "\x6a\x4a", "\x6a\x4b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x4c", "\x00\x00", + "\x6a\x4d", "\x00\x00", "\x6a\x4e", "\x6a\x4f", "\x6a\x50", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x51", "\x6a\x52", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x53", "\x6a\x54", "\x6a\x55", + "\x6a\x56", "\x00\x00", "\x6a\x57", "\x6a\x58", "\x6a\x59", "\x00\x00", + "\x6a\x5a", "\x00\x00", "\x6a\x5b", "\x6a\x5c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6a\x5d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6a\x5e", "\x00\x00", "\x00\x00", "\x6a\x5f", "\x6a\x60", + "\x6a\x61", "\x6a\x62", "\x00\x00", "\x6a\x63", "\x00\x00", "\x00\x00", + "\x6a\x64", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x65", "\x6a\x66", + "\x6a\x67", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x68", + "\x6a\x69", "\x00\x00", "\x00\x00", "\x6a\x6a", "\x6a\x6b", "\x00\x00", + "\x6a\x6c", "\x6a\x6d", "\x00\x00", "\x6a\x6e", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x6f", "\x6a\x70", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x71", "\x00\x00", + "\x6a\x72", "\x6a\x73", "\x6a\x74", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6a\x75", "\x00\x00", "\x6a\x76", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x77", "\x00\x00", "\x6a\x78", + "\x00\x00", "\x00\x00", "\x6a\x79", "\x6a\x7a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6a\x7b", "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x7c", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6a\x7d", "\x6a\x7e", "\x6b\x21", + "\x6b\x22", "\x00\x00", "\x00\x00", "\x6b\x23", "\x00\x00", "\x6b\x24", + "\x6b\x25", "\x00\x00", "\x6b\x26", "\x6b\x27", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6b\x28", "\x00\x00", "\x6b\x29", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6b\x2a", "\x00\x00", "\x6b\x2b", "\x6b\x2c", + "\x6b\x2d", "\x00\x00", "\x6b\x2e", "\x00\x00", "\x6b\x2f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6b\x30", "\x6b\x31", "\x00\x00", "\x00\x00", + "\x6b\x32", "\x6b\x33", "\x6b\x34", "\x6b\x35", "\x6b\x36", "\x6b\x37", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x38", "\x6b\x39", "\x6b\x3a", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x3b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x3c", "\x00\x00", "\x6b\x3d", + "\x6b\x3e", "\x6b\x3f", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x40", + "\x6b\x41", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x42", "\x6b\x43", + "\x6b\x44", "\x00\x00", "\x00\x00", "\x6b\x45", "\x6b\x46", "\x00\x00", + "\x6b\x47", "\x00\x00", "\x6b\x48", "\x00\x00", "\x00\x00", "\x6b\x49", + "\x6b\x50", "\x6b\x4a", "\x6b\x4b", "\x6b\x4c", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6b\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x52", "\x6b\x4e", "\x6b\x4f", "\x6b\x51", "\x00\x00", "\x00\x00", + "\x6b\x53", "\x00\x00", "\x6b\x54", "\x00\x00", "\x6b\x55", "\x00\x00", + "\x00\x00", "\x6b\x56", "\x00\x00", "\x6b\x57", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6b\x58", "\x6b\x59", "\x6b\x5a", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6b\x5b", "\x00\x00", "\x6b\x5c", "\x6b\x5e", + "\x6b\x5d", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x5f", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x60", "\x6b\x61", "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x62", + "\x6b\x63", "\x6b\x64", "\x6b\x65", "\x6b\x66", "\x00\x00", "\x6b\x67", + "\x6b\x68", "\x6b\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6b\x6a", "\x00\x00", "\x6b\x6b", "\x6b\x6d", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6b\x6e", "\x6b\x6f", "\x00\x00", + "\x6b\x6c", "\x00\x00", "\x6b\x70", "\x00\x00", "\x00\x00", "\x6b\x71", + "\x6b\x72", "\x6b\x73", "\x6b\x74", "\x00\x00", "\x00\x00", "\x6b\x76", + "\x6b\x75", "\x00\x00", "\x6b\x77", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x78", "\x6b\x79", "\x6b\x7a", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6b\x7b", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6b\x7c", "\x6b\x7d", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6b\x7e", "\x6c\x21", "\x00\x00", "\x6c\x22", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6c\x23", "\x6c\x24", "\x00\x00", "\x6c\x25", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x26", "\x00\x00", "\x00\x00", + "\x6c\x27", "\x6c\x28", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x29", + "\x6c\x2a", "\x00\x00", "\x6c\x2b", "\x6c\x2c", "\x6c\x2d", "\x6c\x2e", + "\x6c\x2f", "\x6c\x30", "\x00\x00", "\x6c\x31", "\x00\x00", "\x6c\x32", + "\x00\x00", "\x00\x00", "\x6c\x33", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6c\x34", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x35", "\x00\x00", + "\x00\x00", "\x6c\x36", "\x00\x00", "\x00\x00", "\x6c\x37", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6c\x38", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6c\x39", "\x00\x00", "\x6c\x3a", "\x6c\x3b", "\x6c\x3c", "\x6c\x3d", + "\x6c\x3e", "\x6c\x3f", "\x00\x00", "\x00\x00", "\x6c\x40", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6c\x41", "\x6c\x42", "\x6c\x43", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x44", "\x00\x00", "\x6c\x45", + "\x00\x00", "\x6c\x46", "\x00\x00", "\x6c\x47", "\x00\x00", "\x00\x00", + "\x6c\x48", "\x00\x00", "\x6c\x49", "\x00\x00", "\x00\x00", "\x6c\x4a", + "\x6c\x4b", "\x6c\x4c", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x4e", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x4f", "\x00\x00", + "\x00\x00", "\x6c\x4d", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x50", + "\x00\x00", "\x6c\x51", "\x6c\x52", "\x6c\x53", "\x00\x00", "\x00\x00", + "\x6c\x54", "\x6c\x55", "\x00\x00", "\x00\x00", "\x6c\x56", "\x00\x00", + "\x00\x00", "\x6c\x57", "\x6c\x58", "\x6c\x59", "\x6c\x5a", "\x6c\x5b", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x5c", "\x00\x00", "\x6c\x5d", + "\x6c\x5e", "\x6c\x5f", "\x6c\x60", "\x00\x00", "\x6c\x61", "\x6c\x62", + "\x6c\x63", "\x6c\x64", "\x00\x00", "\x6c\x65", "\x00\x00", "\x00\x00", + "\x6c\x66", "\x00\x00", "\x00\x00", "\x6c\x67", "\x00\x00", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x68", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6c\x69", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x6a", + "\x00\x00", "\x6c\x6b", "\x6c\x6c", "\x6c\x6d", "\x00\x00", "\x00\x00", + "\x6c\x6e", "\x6c\x6f", "\x6c\x70", "\x6c\x71", "\x00\x00", "\x6c\x72", + "\x00\x00", "\x00\x00", "\x6c\x73", "\x6c\x74", "\x6c\x75", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x76", "\x00\x00", "\x00\x00", + "\x6c\x77", "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6c\x78", + "\x6c\x79", "\x6c\x7a", "\x00\x00", "\x6c\x7b", "\x6c\x7c", "\x6c\x7d", + "\x00\x00", "\x00\x00", "\x6c\x7e", "\x00\x00", "\x00\x00", "\x6d\x21", + "\x6d\x22", "\x00\x00", "\x00\x00", "\x6d\x23", "\x6d\x24", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x25", "\x00\x00", + "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x26", "\x6d\x27", + "\x6d\x28", "\x6d\x29", "\x00\x00", "\x6d\x2a", "\x00\x00", "\x6d\x2b", + "\x6d\x2c", "\x00\x00", "\x6d\x2d", "\x6d\x2e", "\x6d\x2f", "\x00\x00", + "\x00\x00", "\x00\x00", "\x6d\x30", "\x00\x00", "\x00\x00", "\x6d\x31", + "\x00\x00", "\x00\x00", "\x00\x00", "\x6d\x32", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6d\x33", "\x6d\x34", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6d\x35", "\x00\x00", "\x6d\x36", "\x6d\x37", "\x00\x00", "\x6d\x38", + "\x00\x00", "\x00\x00", "\x6d\x39", "\x00\x00", "\x6d\x3a", "\x6d\x3b", + "\x00\x00", "\x6d\x3c", "\x6d\x3d", "\x00\x00", "\x6d\x3e", "\x00\x00", + "\x6d\x3f", "\x00\x00", "\x6d\x40", "\x6d\x41", "\x6d\x42", "\x6d\x43", + "\x6d\x44", "\x6d\x45", "\x00\x00", "\x6d\x46", "\x6d\x47", "\x6d\x48", + "\x6d\x49", "\x00\x00", "\x6d\x4a", "\x00\x00", "\x00\x00", "\x6d\x4b", + "\x6d\x4c", "\x6d\x4d", "\x6d\x4e", "\x00\x00", "\x00\x00", "\x00\x00", + "\x6d\x4f", "\x6d\x50", "\x6d\x51", "\x6d\x52", "\x6d\x53", "\x00\x00", + "\x6d\x54", "\x00\x00", "\x6d\x55", "\x00\x00", "\x00\x00", "\x00\x00", + "\x00\x00", "\x6d\x56", "\x00\x00", "\x00\x00", "\x6d\x57", "\x6d\x58", + "\x6d\x59", "\x6d\x5a", "\x6d\x5b", "\x00\x00", "\x6d\x5c", "\x00\x00", + "\x6d\x5d", "\x6d\x5e", "\x6d\x5f", "\x00\x00", "\x00\x00", "\x6d\x60", + "\x6d\x61", "\x6d\x62", "\x00\x00", "\x6d\x63", "\x22\x37" +}; diff --git a/newlib/iconvdata/jis0212.h b/newlib/iconvdata/jis0212.h new file mode 100644 index 000000000..f57778eba --- /dev/null +++ b/newlib/iconvdata/jis0212.h @@ -0,0 +1,110 @@ +/* Access functions for JISX0212 conversion. + Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _JIS0212_H +#define _JIS0212_H 1 + +#include +#include + + +/* Struct for table with indeces in mapping table. */ +struct jisx0212_idx +{ + uint16_t start; + uint16_t end; + uint16_t idx; +}; + +/* Conversion table. */ +extern const struct jisx0212_idx __jisx0212_to_ucs_idx[]; +extern const uint16_t __jisx0212_to_ucs[]; + +extern const struct jisx0212_idx __jisx0212_from_ucs_idx[]; +extern const char __jisx0212_from_ucs[][2]; + + +static inline uint32_t +jisx0212_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset) +{ + const struct jisx0212_idx *rp = __jisx0212_to_ucs_idx; + unsigned char ch = *(*s); + unsigned char ch2; + uint32_t wch = 0; + int idx; + + if (ch < offset || (ch - offset) < 0x22 || (ch - offset) > 0x6d) + return __UNKNOWN_10646_CHAR; + + if (avail < 2) + return 0; + + ch2 = (*s)[1]; + if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f) + return __UNKNOWN_10646_CHAR; + + idx = (ch - offset - 0x21) * 94 + (ch2 - offset - 0x21); + + while (idx > rp->end) + ++rp; + if (idx >= rp->start) + wch = __jisx0212_to_ucs[rp->idx + idx - rp->start]; + + if (wch != L'\0') + (*s) += 2; + else + wch = __UNKNOWN_10646_CHAR; + + return wch; +} + + +static inline size_t +ucs4_to_jisx0212 (uint32_t wch, char *s, size_t avail) +{ + const struct jisx0212_idx *rp = __jisx0212_from_ucs_idx; + unsigned int ch = (unsigned int) wch; + const char *cp; + + if (ch >= 0xffff) + return __UNKNOWN_10646_CHAR; + while (ch > rp->end) + ++rp; + if (ch >= rp->start) + cp = __jisx0212_from_ucs[rp->idx + ch - rp->start]; + else + return __UNKNOWN_10646_CHAR; + + if (cp[0] == '\0') + return __UNKNOWN_10646_CHAR; + + s[0] = cp[0]; + if (cp[1] != '\0') + { + if (avail < 2) + return 0; + + s[1] = cp[1]; + } + + return 2; +} + +#endif /* jis0212.h */ diff --git a/newlib/iconvdata/sjis.c b/newlib/iconvdata/sjis.c new file mode 100644 index 000000000..3a19642c8 --- /dev/null +++ b/newlib/iconvdata/sjis.c @@ -0,0 +1,4512 @@ +/* Mapping tables for SJIS handling. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +static const uint32_t halfkana_to_ucs4[] = +{ + 0xff61, 0xff62, 0xff63, 0xff64, 0xff65, 0xff66, 0xff67, 0xff68, + 0xff69, 0xff6a, 0xff6b, 0xff6c, 0xff6d, 0xff6e, 0xff6f, 0xff70, + 0xff71, 0xff72, 0xff73, 0xff74, 0xff75, 0xff76, 0xff77, 0xff78, + 0xff79, 0xff7a, 0xff7b, 0xff7c, 0xff7d, 0xff7e, 0xff7f, 0xff80, + 0xff81, 0xff82, 0xff83, 0xff84, 0xff85, 0xff86, 0xff87, 0xff88, + 0xff89, 0xff8a, 0xff8b, 0xff8c, 0xff8d, 0xff8e, 0xff8f, 0xff90, + 0xff91, 0xff92, 0xff93, 0xff94, 0xff95, 0xff96, 0xff97, 0xff98, + 0xff99, 0xff9a, 0xff9b, 0xff9c, 0xff9d, 0xff9e, 0xff9f +}; + + +/* The following table can be generated from the file + unix/mappings/eastasia/jis/shiftjis.txt + from the Unicode CD (also available on their FTP server) using + the command + + egrep '^0x8[01234][[:xdigit:]][[:xdigit:]]' \ + /mnt/cdrom/unix/mappings/eastasia/jis/shiftjis.txt | perl ~/sjis.pl + + where sjis.pl contains: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + while (<>) { + local($sjis, $ucs, %rest) = split; + $sjis = hex($sjis) - 0x8140; + local($sidx) = int($sjis / 256) * 192 + ($sjis % 256); + printf "\n " if (($n % 4) == 0); + ++$n; + printf " [%4d] = %s,", $sidx, $ucs; + } + print "\n"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +static const uint16_t cjk_block1[703] = +{ + [ 0] = 0x3000, [ 1] = 0x3001, [ 2] = 0x3002, [ 3] = 0xFF0C, + [ 4] = 0xFF0E, [ 5] = 0x30FB, [ 6] = 0xFF1A, [ 7] = 0xFF1B, + [ 8] = 0xFF1F, [ 9] = 0xFF01, [ 10] = 0x309B, [ 11] = 0x309C, + [ 12] = 0x00B4, [ 13] = 0xFF40, [ 14] = 0x00A8, [ 15] = 0xFF3E, + [ 16] = 0xFFE3, [ 17] = 0xFF3F, [ 18] = 0x30FD, [ 19] = 0x30FE, + [ 20] = 0x309D, [ 21] = 0x309E, [ 22] = 0x3003, [ 23] = 0x4EDD, + [ 24] = 0x3005, [ 25] = 0x3006, [ 26] = 0x3007, [ 27] = 0x30FC, + [ 28] = 0x2015, [ 29] = 0x2010, [ 30] = 0xFF0F, [ 31] = 0xFF3C, + [ 32] = 0x301C, [ 33] = 0x2016, [ 34] = 0xFF5C, [ 35] = 0x2026, + [ 36] = 0x2025, [ 37] = 0x2018, [ 38] = 0x2019, [ 39] = 0x201C, + [ 40] = 0x201D, [ 41] = 0xFF08, [ 42] = 0xFF09, [ 43] = 0x3014, + [ 44] = 0x3015, [ 45] = 0xFF3B, [ 46] = 0xFF3D, [ 47] = 0xFF5B, + [ 48] = 0xFF5D, [ 49] = 0x3008, [ 50] = 0x3009, [ 51] = 0x300A, + [ 52] = 0x300B, [ 53] = 0x300C, [ 54] = 0x300D, [ 55] = 0x300E, + [ 56] = 0x300F, [ 57] = 0x3010, [ 58] = 0x3011, [ 59] = 0xFF0B, + [ 60] = 0x2212, [ 61] = 0x00B1, [ 62] = 0x00D7, [ 64] = 0x00F7, + [ 65] = 0xFF1D, [ 66] = 0x2260, [ 67] = 0xFF1C, [ 68] = 0xFF1E, + [ 69] = 0x2266, [ 70] = 0x2267, [ 71] = 0x221E, [ 72] = 0x2234, + [ 73] = 0x2642, [ 74] = 0x2640, [ 75] = 0x00B0, [ 76] = 0x2032, + [ 77] = 0x2033, [ 78] = 0x2103, [ 79] = 0xFFE5, [ 80] = 0xFF04, + [ 81] = 0x00A2, [ 82] = 0x00A3, [ 83] = 0xFF05, [ 84] = 0xFF03, + [ 85] = 0xFF06, [ 86] = 0xFF0A, [ 87] = 0xFF20, [ 88] = 0x00A7, + [ 89] = 0x2606, [ 90] = 0x2605, [ 91] = 0x25CB, [ 92] = 0x25CF, + [ 93] = 0x25CE, [ 94] = 0x25C7, [ 95] = 0x25C6, [ 96] = 0x25A1, + [ 97] = 0x25A0, [ 98] = 0x25B3, [ 99] = 0x25B2, [100] = 0x25BD, + [101] = 0x25BC, [102] = 0x203B, [103] = 0x3012, [104] = 0x2192, + [105] = 0x2190, [106] = 0x2191, [107] = 0x2193, [108] = 0x3013, + [120] = 0x2208, [121] = 0x220B, [122] = 0x2286, [123] = 0x2287, + [124] = 0x2282, [125] = 0x2283, [126] = 0x222A, [127] = 0x2229, + [136] = 0x2227, [137] = 0x2228, [138] = 0x00AC, [139] = 0x21D2, + [140] = 0x21D4, [141] = 0x2200, [142] = 0x2203, [154] = 0x2220, + [155] = 0x22A5, [156] = 0x2312, [157] = 0x2202, [158] = 0x2207, + [159] = 0x2261, [160] = 0x2252, [161] = 0x226A, [162] = 0x226B, + [163] = 0x221A, [164] = 0x223D, [165] = 0x221D, [166] = 0x2235, + [167] = 0x222B, [168] = 0x222C, [176] = 0x212B, [177] = 0x2030, + [178] = 0x266F, [179] = 0x266D, [180] = 0x266A, [181] = 0x2020, + [182] = 0x2021, [183] = 0x00B6, [188] = 0x25EF, [207] = 0xFF10, + [208] = 0xFF11, [209] = 0xFF12, [210] = 0xFF13, [211] = 0xFF14, + [212] = 0xFF15, [213] = 0xFF16, [214] = 0xFF17, [215] = 0xFF18, + [216] = 0xFF19, [224] = 0xFF21, [225] = 0xFF22, [226] = 0xFF23, + [227] = 0xFF24, [228] = 0xFF25, [229] = 0xFF26, [230] = 0xFF27, + [231] = 0xFF28, [232] = 0xFF29, [233] = 0xFF2A, [234] = 0xFF2B, + [235] = 0xFF2C, [236] = 0xFF2D, [237] = 0xFF2E, [238] = 0xFF2F, + [239] = 0xFF30, [240] = 0xFF31, [241] = 0xFF32, [242] = 0xFF33, + [243] = 0xFF34, [244] = 0xFF35, [245] = 0xFF36, [246] = 0xFF37, + [247] = 0xFF38, [248] = 0xFF39, [249] = 0xFF3A, [257] = 0xFF41, + [258] = 0xFF42, [259] = 0xFF43, [260] = 0xFF44, [261] = 0xFF45, + [262] = 0xFF46, [263] = 0xFF47, [264] = 0xFF48, [265] = 0xFF49, + [266] = 0xFF4A, [267] = 0xFF4B, [268] = 0xFF4C, [269] = 0xFF4D, + [270] = 0xFF4E, [271] = 0xFF4F, [272] = 0xFF50, [273] = 0xFF51, + [274] = 0xFF52, [275] = 0xFF53, [276] = 0xFF54, [277] = 0xFF55, + [278] = 0xFF56, [279] = 0xFF57, [280] = 0xFF58, [281] = 0xFF59, + [282] = 0xFF5A, [287] = 0x3041, [288] = 0x3042, [289] = 0x3043, + [290] = 0x3044, [291] = 0x3045, [292] = 0x3046, [293] = 0x3047, + [294] = 0x3048, [295] = 0x3049, [296] = 0x304A, [297] = 0x304B, + [298] = 0x304C, [299] = 0x304D, [300] = 0x304E, [301] = 0x304F, + [302] = 0x3050, [303] = 0x3051, [304] = 0x3052, [305] = 0x3053, + [306] = 0x3054, [307] = 0x3055, [308] = 0x3056, [309] = 0x3057, + [310] = 0x3058, [311] = 0x3059, [312] = 0x305A, [313] = 0x305B, + [314] = 0x305C, [315] = 0x305D, [316] = 0x305E, [317] = 0x305F, + [318] = 0x3060, [319] = 0x3061, [320] = 0x3062, [321] = 0x3063, + [322] = 0x3064, [323] = 0x3065, [324] = 0x3066, [325] = 0x3067, + [326] = 0x3068, [327] = 0x3069, [328] = 0x306A, [329] = 0x306B, + [330] = 0x306C, [331] = 0x306D, [332] = 0x306E, [333] = 0x306F, + [334] = 0x3070, [335] = 0x3071, [336] = 0x3072, [337] = 0x3073, + [338] = 0x3074, [339] = 0x3075, [340] = 0x3076, [341] = 0x3077, + [342] = 0x3078, [343] = 0x3079, [344] = 0x307A, [345] = 0x307B, + [346] = 0x307C, [347] = 0x307D, [348] = 0x307E, [349] = 0x307F, + [350] = 0x3080, [351] = 0x3081, [352] = 0x3082, [353] = 0x3083, + [354] = 0x3084, [355] = 0x3085, [356] = 0x3086, [357] = 0x3087, + [358] = 0x3088, [359] = 0x3089, [360] = 0x308A, [361] = 0x308B, + [362] = 0x308C, [363] = 0x308D, [364] = 0x308E, [365] = 0x308F, + [366] = 0x3090, [367] = 0x3091, [368] = 0x3092, [369] = 0x3093, + [384] = 0x30A1, [385] = 0x30A2, [386] = 0x30A3, [387] = 0x30A4, + [388] = 0x30A5, [389] = 0x30A6, [390] = 0x30A7, [391] = 0x30A8, + [392] = 0x30A9, [393] = 0x30AA, [394] = 0x30AB, [395] = 0x30AC, + [396] = 0x30AD, [397] = 0x30AE, [398] = 0x30AF, [399] = 0x30B0, + [400] = 0x30B1, [401] = 0x30B2, [402] = 0x30B3, [403] = 0x30B4, + [404] = 0x30B5, [405] = 0x30B6, [406] = 0x30B7, [407] = 0x30B8, + [408] = 0x30B9, [409] = 0x30BA, [410] = 0x30BB, [411] = 0x30BC, + [412] = 0x30BD, [413] = 0x30BE, [414] = 0x30BF, [415] = 0x30C0, + [416] = 0x30C1, [417] = 0x30C2, [418] = 0x30C3, [419] = 0x30C4, + [420] = 0x30C5, [421] = 0x30C6, [422] = 0x30C7, [423] = 0x30C8, + [424] = 0x30C9, [425] = 0x30CA, [426] = 0x30CB, [427] = 0x30CC, + [428] = 0x30CD, [429] = 0x30CE, [430] = 0x30CF, [431] = 0x30D0, + [432] = 0x30D1, [433] = 0x30D2, [434] = 0x30D3, [435] = 0x30D4, + [436] = 0x30D5, [437] = 0x30D6, [438] = 0x30D7, [439] = 0x30D8, + [440] = 0x30D9, [441] = 0x30DA, [442] = 0x30DB, [443] = 0x30DC, + [444] = 0x30DD, [445] = 0x30DE, [446] = 0x30DF, [448] = 0x30E0, + [449] = 0x30E1, [450] = 0x30E2, [451] = 0x30E3, [452] = 0x30E4, + [453] = 0x30E5, [454] = 0x30E6, [455] = 0x30E7, [456] = 0x30E8, + [457] = 0x30E9, [458] = 0x30EA, [459] = 0x30EB, [460] = 0x30EC, + [461] = 0x30ED, [462] = 0x30EE, [463] = 0x30EF, [464] = 0x30F0, + [465] = 0x30F1, [466] = 0x30F2, [467] = 0x30F3, [468] = 0x30F4, + [469] = 0x30F5, [470] = 0x30F6, [479] = 0x0391, [480] = 0x0392, + [481] = 0x0393, [482] = 0x0394, [483] = 0x0395, [484] = 0x0396, + [485] = 0x0397, [486] = 0x0398, [487] = 0x0399, [488] = 0x039A, + [489] = 0x039B, [490] = 0x039C, [491] = 0x039D, [492] = 0x039E, + [493] = 0x039F, [494] = 0x03A0, [495] = 0x03A1, [496] = 0x03A3, + [497] = 0x03A4, [498] = 0x03A5, [499] = 0x03A6, [500] = 0x03A7, + [501] = 0x03A8, [502] = 0x03A9, [511] = 0x03B1, [512] = 0x03B2, + [513] = 0x03B3, [514] = 0x03B4, [515] = 0x03B5, [516] = 0x03B6, + [517] = 0x03B7, [518] = 0x03B8, [519] = 0x03B9, [520] = 0x03BA, + [521] = 0x03BB, [522] = 0x03BC, [523] = 0x03BD, [524] = 0x03BE, + [525] = 0x03BF, [526] = 0x03C0, [527] = 0x03C1, [528] = 0x03C3, + [529] = 0x03C4, [530] = 0x03C5, [531] = 0x03C6, [532] = 0x03C7, + [533] = 0x03C8, [534] = 0x03C9, [576] = 0x0410, [577] = 0x0411, + [578] = 0x0412, [579] = 0x0413, [580] = 0x0414, [581] = 0x0415, + [582] = 0x0401, [583] = 0x0416, [584] = 0x0417, [585] = 0x0418, + [586] = 0x0419, [587] = 0x041A, [588] = 0x041B, [589] = 0x041C, + [590] = 0x041D, [591] = 0x041E, [592] = 0x041F, [593] = 0x0420, + [594] = 0x0421, [595] = 0x0422, [596] = 0x0423, [597] = 0x0424, + [598] = 0x0425, [599] = 0x0426, [600] = 0x0427, [601] = 0x0428, + [602] = 0x0429, [603] = 0x042A, [604] = 0x042B, [605] = 0x042C, + [606] = 0x042D, [607] = 0x042E, [608] = 0x042F, [624] = 0x0430, + [625] = 0x0431, [626] = 0x0432, [627] = 0x0433, [628] = 0x0434, + [629] = 0x0435, [630] = 0x0451, [631] = 0x0436, [632] = 0x0437, + [633] = 0x0438, [634] = 0x0439, [635] = 0x043A, [636] = 0x043B, + [637] = 0x043C, [638] = 0x043D, [640] = 0x043E, [641] = 0x043F, + [642] = 0x0440, [643] = 0x0441, [644] = 0x0442, [645] = 0x0443, + [646] = 0x0444, [647] = 0x0445, [648] = 0x0446, [649] = 0x0447, + [650] = 0x0448, [651] = 0x0449, [652] = 0x044A, [653] = 0x044B, + [654] = 0x044C, [655] = 0x044D, [656] = 0x044E, [657] = 0x044F, + [671] = 0x2500, [672] = 0x2502, [673] = 0x250C, [674] = 0x2510, + [675] = 0x2518, [676] = 0x2514, [677] = 0x251C, [678] = 0x252C, + [679] = 0x2524, [680] = 0x2534, [681] = 0x253C, [682] = 0x2501, + [683] = 0x2503, [684] = 0x250F, [685] = 0x2513, [686] = 0x251B, + [687] = 0x2517, [688] = 0x2523, [689] = 0x2533, [690] = 0x252B, + [691] = 0x253B, [692] = 0x254B, [693] = 0x2520, [694] = 0x252F, + [695] = 0x2528, [696] = 0x2537, [697] = 0x253F, [698] = 0x251D, + [699] = 0x2530, [700] = 0x2525, [701] = 0x2538, [702] = 0x2542 +}; + + +/* The following table can be generated from the file + unix/mappings/eastasia/jis/shiftjis.txt + from the Unicode CD (also available on their FTP server) using + the command + + egrep '^0x8[89][[:xdigit:]][[:xdigit:]]' \ + /mnt/cdrom/unix/mappings/eastasia/jis/shiftjis.txt | perl ~/sjis.pl + + where sjis.pl contains: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + while (<>) { + local($sjis, $ucs, %rest) = split; + $sjis = hex($sjis) - 0x8840; + local($sidx) = int($sjis / 256) * 192 + ($sjis % 256) - 0x5f; + printf "\n " if (($n % 4) == 0); + ++$n; + printf " [%3d] = %s,", $sidx, $ucs; + } + print "\n"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +static const uint16_t cjk_block2[94] = +{ + [ 0] = 0x4E9C, [ 1] = 0x5516, [ 2] = 0x5A03, [ 3] = 0x963F, + [ 4] = 0x54C0, [ 5] = 0x611B, [ 6] = 0x6328, [ 7] = 0x59F6, + [ 8] = 0x9022, [ 9] = 0x8475, [ 10] = 0x831C, [ 11] = 0x7A50, + [ 12] = 0x60AA, [ 13] = 0x63E1, [ 14] = 0x6E25, [ 15] = 0x65ED, + [ 16] = 0x8466, [ 17] = 0x82A6, [ 18] = 0x9BF5, [ 19] = 0x6893, + [ 20] = 0x5727, [ 21] = 0x65A1, [ 22] = 0x6271, [ 23] = 0x5B9B, + [ 24] = 0x59D0, [ 25] = 0x867B, [ 26] = 0x98F4, [ 27] = 0x7D62, + [ 28] = 0x7DBE, [ 29] = 0x9B8E, [ 30] = 0x6216, [ 31] = 0x7C9F, + [ 32] = 0x88B7, [ 33] = 0x5B89, [ 34] = 0x5EB5, [ 35] = 0x6309, + [ 36] = 0x6697, [ 37] = 0x6848, [ 38] = 0x95C7, [ 39] = 0x978D, + [ 40] = 0x674F, [ 41] = 0x4EE5, [ 42] = 0x4F0A, [ 43] = 0x4F4D, + [ 44] = 0x4F9D, [ 45] = 0x5049, [ 46] = 0x56F2, [ 47] = 0x5937, + [ 48] = 0x59D4, [ 49] = 0x5A01, [ 50] = 0x5C09, [ 51] = 0x60DF, + [ 52] = 0x610F, [ 53] = 0x6170, [ 54] = 0x6613, [ 55] = 0x6905, + [ 56] = 0x70BA, [ 57] = 0x754F, [ 58] = 0x7570, [ 59] = 0x79FB, + [ 60] = 0x7DAD, [ 61] = 0x7DEF, [ 62] = 0x80C3, [ 63] = 0x840E, + [ 64] = 0x8863, [ 65] = 0x8B02, [ 66] = 0x9055, [ 67] = 0x907A, + [ 68] = 0x533B, [ 69] = 0x4E95, [ 70] = 0x4EA5, [ 71] = 0x57DF, + [ 72] = 0x80B2, [ 73] = 0x90C1, [ 74] = 0x78EF, [ 75] = 0x4E00, + [ 76] = 0x58F1, [ 77] = 0x6EA2, [ 78] = 0x9038, [ 79] = 0x7A32, + [ 80] = 0x8328, [ 81] = 0x828B, [ 82] = 0x9C2F, [ 83] = 0x5141, + [ 84] = 0x5370, [ 85] = 0x54BD, [ 86] = 0x54E1, [ 87] = 0x56E0, + [ 88] = 0x59FB, [ 89] = 0x5F15, [ 90] = 0x98F2, [ 91] = 0x6DEB, + [ 92] = 0x80E4, [ 93] = 0x852D +}; + +/* The following table can be generated from the file + unix/mappings/eastasia/jis/shiftjis.txt + from the Unicode CD (also available on their FTP server) using + the command + + egrep '^0x(8[9a-fA-F]|9[[:xdigit:]])[[:xdigit:]][[:xdigit:]]' \ + /mnt/cdrom/unix/mappings/eastasia/jis/shiftjis.txt | perl ~/sjis.pl + + where sjis.pl contains: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + while (<>) { + local($sjis, $ucs, %rest) = split; + $sjis = hex($sjis) - 0x8940; + local($sidx) = int($sjis / 256) * 192 + ($sjis % 256) - 0x5f; + printf "\n " if (($n % 4) == 0); + ++$n; + printf " [%4d] = %s,", $sidx, $ucs; + } + print "\n"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +static const uint16_t cjk_block3[4413] = +{ + [ 0] = 0x9662, [ 1] = 0x9670, [ 2] = 0x96A0, [ 3] = 0x97FB, + [ 4] = 0x540B, [ 5] = 0x53F3, [ 6] = 0x5B87, [ 7] = 0x70CF, + [ 8] = 0x7FBD, [ 9] = 0x8FC2, [ 10] = 0x96E8, [ 11] = 0x536F, + [ 12] = 0x9D5C, [ 13] = 0x7ABA, [ 14] = 0x4E11, [ 15] = 0x7893, + [ 16] = 0x81FC, [ 17] = 0x6E26, [ 18] = 0x5618, [ 19] = 0x5504, + [ 20] = 0x6B1D, [ 21] = 0x851A, [ 22] = 0x9C3B, [ 23] = 0x59E5, + [ 24] = 0x53A9, [ 25] = 0x6D66, [ 26] = 0x74DC, [ 27] = 0x958F, + [ 28] = 0x5642, [ 29] = 0x4E91, [ 30] = 0x904B, [ 31] = 0x96F2, + [ 32] = 0x834F, [ 33] = 0x990C, [ 34] = 0x53E1, [ 35] = 0x55B6, + [ 36] = 0x5B30, [ 37] = 0x5F71, [ 38] = 0x6620, [ 39] = 0x66F3, + [ 40] = 0x6804, [ 41] = 0x6C38, [ 42] = 0x6CF3, [ 43] = 0x6D29, + [ 44] = 0x745B, [ 45] = 0x76C8, [ 46] = 0x7A4E, [ 47] = 0x9834, + [ 48] = 0x82F1, [ 49] = 0x885B, [ 50] = 0x8A60, [ 51] = 0x92ED, + [ 52] = 0x6DB2, [ 53] = 0x75AB, [ 54] = 0x76CA, [ 55] = 0x99C5, + [ 56] = 0x60A6, [ 57] = 0x8B01, [ 58] = 0x8D8A, [ 59] = 0x95B2, + [ 60] = 0x698E, [ 61] = 0x53AD, [ 62] = 0x5186, [ 64] = 0x5712, + [ 65] = 0x5830, [ 66] = 0x5944, [ 67] = 0x5BB4, [ 68] = 0x5EF6, + [ 69] = 0x6028, [ 70] = 0x63A9, [ 71] = 0x63F4, [ 72] = 0x6CBF, + [ 73] = 0x6F14, [ 74] = 0x708E, [ 75] = 0x7114, [ 76] = 0x7159, + [ 77] = 0x71D5, [ 78] = 0x733F, [ 79] = 0x7E01, [ 80] = 0x8276, + [ 81] = 0x82D1, [ 82] = 0x8597, [ 83] = 0x9060, [ 84] = 0x925B, + [ 85] = 0x9D1B, [ 86] = 0x5869, [ 87] = 0x65BC, [ 88] = 0x6C5A, + [ 89] = 0x7525, [ 90] = 0x51F9, [ 91] = 0x592E, [ 92] = 0x5965, + [ 93] = 0x5F80, [ 94] = 0x5FDC, [ 95] = 0x62BC, [ 96] = 0x65FA, + [ 97] = 0x6A2A, [ 98] = 0x6B27, [ 99] = 0x6BB4, [ 100] = 0x738B, + [ 101] = 0x7FC1, [ 102] = 0x8956, [ 103] = 0x9D2C, [ 104] = 0x9D0E, + [ 105] = 0x9EC4, [ 106] = 0x5CA1, [ 107] = 0x6C96, [ 108] = 0x837B, + [ 109] = 0x5104, [ 110] = 0x5C4B, [ 111] = 0x61B6, [ 112] = 0x81C6, + [ 113] = 0x6876, [ 114] = 0x7261, [ 115] = 0x4E59, [ 116] = 0x4FFA, + [ 117] = 0x5378, [ 118] = 0x6069, [ 119] = 0x6E29, [ 120] = 0x7A4F, + [ 121] = 0x97F3, [ 122] = 0x4E0B, [ 123] = 0x5316, [ 124] = 0x4EEE, + [ 125] = 0x4F55, [ 126] = 0x4F3D, [ 127] = 0x4FA1, [ 128] = 0x4F73, + [ 129] = 0x52A0, [ 130] = 0x53EF, [ 131] = 0x5609, [ 132] = 0x590F, + [ 133] = 0x5AC1, [ 134] = 0x5BB6, [ 135] = 0x5BE1, [ 136] = 0x79D1, + [ 137] = 0x6687, [ 138] = 0x679C, [ 139] = 0x67B6, [ 140] = 0x6B4C, + [ 141] = 0x6CB3, [ 142] = 0x706B, [ 143] = 0x73C2, [ 144] = 0x798D, + [ 145] = 0x79BE, [ 146] = 0x7A3C, [ 147] = 0x7B87, [ 148] = 0x82B1, + [ 149] = 0x82DB, [ 150] = 0x8304, [ 151] = 0x8377, [ 152] = 0x83EF, + [ 153] = 0x83D3, [ 154] = 0x8766, [ 155] = 0x8AB2, [ 156] = 0x5629, + [ 157] = 0x8CA8, [ 158] = 0x8FE6, [ 159] = 0x904E, [ 160] = 0x971E, + [ 161] = 0x868A, [ 162] = 0x4FC4, [ 163] = 0x5CE8, [ 164] = 0x6211, + [ 165] = 0x7259, [ 166] = 0x753B, [ 167] = 0x81E5, [ 168] = 0x82BD, + [ 169] = 0x86FE, [ 170] = 0x8CC0, [ 171] = 0x96C5, [ 172] = 0x9913, + [ 173] = 0x99D5, [ 174] = 0x4ECB, [ 175] = 0x4F1A, [ 176] = 0x89E3, + [ 177] = 0x56DE, [ 178] = 0x584A, [ 179] = 0x58CA, [ 180] = 0x5EFB, + [ 181] = 0x5FEB, [ 182] = 0x602A, [ 183] = 0x6094, [ 184] = 0x6062, + [ 185] = 0x61D0, [ 186] = 0x6212, [ 187] = 0x62D0, [ 188] = 0x6539, + [ 192] = 0x9B41, [ 193] = 0x6666, [ 194] = 0x68B0, [ 195] = 0x6D77, + [ 196] = 0x7070, [ 197] = 0x754C, [ 198] = 0x7686, [ 199] = 0x7D75, + [ 200] = 0x82A5, [ 201] = 0x87F9, [ 202] = 0x958B, [ 203] = 0x968E, + [ 204] = 0x8C9D, [ 205] = 0x51F1, [ 206] = 0x52BE, [ 207] = 0x5916, + [ 208] = 0x54B3, [ 209] = 0x5BB3, [ 210] = 0x5D16, [ 211] = 0x6168, + [ 212] = 0x6982, [ 213] = 0x6DAF, [ 214] = 0x788D, [ 215] = 0x84CB, + [ 216] = 0x8857, [ 217] = 0x8A72, [ 218] = 0x93A7, [ 219] = 0x9AB8, + [ 220] = 0x6D6C, [ 221] = 0x99A8, [ 222] = 0x86D9, [ 223] = 0x57A3, + [ 224] = 0x67FF, [ 225] = 0x86CE, [ 226] = 0x920E, [ 227] = 0x5283, + [ 228] = 0x5687, [ 229] = 0x5404, [ 230] = 0x5ED3, [ 231] = 0x62E1, + [ 232] = 0x64B9, [ 233] = 0x683C, [ 234] = 0x6838, [ 235] = 0x6BBB, + [ 236] = 0x7372, [ 237] = 0x78BA, [ 238] = 0x7A6B, [ 239] = 0x899A, + [ 240] = 0x89D2, [ 241] = 0x8D6B, [ 242] = 0x8F03, [ 243] = 0x90ED, + [ 244] = 0x95A3, [ 245] = 0x9694, [ 246] = 0x9769, [ 247] = 0x5B66, + [ 248] = 0x5CB3, [ 249] = 0x697D, [ 250] = 0x984D, [ 251] = 0x984E, + [ 252] = 0x639B, [ 253] = 0x7B20, [ 254] = 0x6A2B, [ 256] = 0x6A7F, + [ 257] = 0x68B6, [ 258] = 0x9C0D, [ 259] = 0x6F5F, [ 260] = 0x5272, + [ 261] = 0x559D, [ 262] = 0x6070, [ 263] = 0x62EC, [ 264] = 0x6D3B, + [ 265] = 0x6E07, [ 266] = 0x6ED1, [ 267] = 0x845B, [ 268] = 0x8910, + [ 269] = 0x8F44, [ 270] = 0x4E14, [ 271] = 0x9C39, [ 272] = 0x53F6, + [ 273] = 0x691B, [ 274] = 0x6A3A, [ 275] = 0x9784, [ 276] = 0x682A, + [ 277] = 0x515C, [ 278] = 0x7AC3, [ 279] = 0x84B2, [ 280] = 0x91DC, + [ 281] = 0x938C, [ 282] = 0x565B, [ 283] = 0x9D28, [ 284] = 0x6822, + [ 285] = 0x8305, [ 286] = 0x8431, [ 287] = 0x7CA5, [ 288] = 0x5208, + [ 289] = 0x82C5, [ 290] = 0x74E6, [ 291] = 0x4E7E, [ 292] = 0x4F83, + [ 293] = 0x51A0, [ 294] = 0x5BD2, [ 295] = 0x520A, [ 296] = 0x52D8, + [ 297] = 0x52E7, [ 298] = 0x5DFB, [ 299] = 0x559A, [ 300] = 0x582A, + [ 301] = 0x59E6, [ 302] = 0x5B8C, [ 303] = 0x5B98, [ 304] = 0x5BDB, + [ 305] = 0x5E72, [ 306] = 0x5E79, [ 307] = 0x60A3, [ 308] = 0x611F, + [ 309] = 0x6163, [ 310] = 0x61BE, [ 311] = 0x63DB, [ 312] = 0x6562, + [ 313] = 0x67D1, [ 314] = 0x6853, [ 315] = 0x68FA, [ 316] = 0x6B3E, + [ 317] = 0x6B53, [ 318] = 0x6C57, [ 319] = 0x6F22, [ 320] = 0x6F97, + [ 321] = 0x6F45, [ 322] = 0x74B0, [ 323] = 0x7518, [ 324] = 0x76E3, + [ 325] = 0x770B, [ 326] = 0x7AFF, [ 327] = 0x7BA1, [ 328] = 0x7C21, + [ 329] = 0x7DE9, [ 330] = 0x7F36, [ 331] = 0x7FF0, [ 332] = 0x809D, + [ 333] = 0x8266, [ 334] = 0x839E, [ 335] = 0x89B3, [ 336] = 0x8ACC, + [ 337] = 0x8CAB, [ 338] = 0x9084, [ 339] = 0x9451, [ 340] = 0x9593, + [ 341] = 0x9591, [ 342] = 0x95A2, [ 343] = 0x9665, [ 344] = 0x97D3, + [ 345] = 0x9928, [ 346] = 0x8218, [ 347] = 0x4E38, [ 348] = 0x542B, + [ 349] = 0x5CB8, [ 350] = 0x5DCC, [ 351] = 0x73A9, [ 352] = 0x764C, + [ 353] = 0x773C, [ 354] = 0x5CA9, [ 355] = 0x7FEB, [ 356] = 0x8D0B, + [ 357] = 0x96C1, [ 358] = 0x9811, [ 359] = 0x9854, [ 360] = 0x9858, + [ 361] = 0x4F01, [ 362] = 0x4F0E, [ 363] = 0x5371, [ 364] = 0x559C, + [ 365] = 0x5668, [ 366] = 0x57FA, [ 367] = 0x5947, [ 368] = 0x5B09, + [ 369] = 0x5BC4, [ 370] = 0x5C90, [ 371] = 0x5E0C, [ 372] = 0x5E7E, + [ 373] = 0x5FCC, [ 374] = 0x63EE, [ 375] = 0x673A, [ 376] = 0x65D7, + [ 377] = 0x65E2, [ 378] = 0x671F, [ 379] = 0x68CB, [ 380] = 0x68C4, + [ 384] = 0x6A5F, [ 385] = 0x5E30, [ 386] = 0x6BC5, [ 387] = 0x6C17, + [ 388] = 0x6C7D, [ 389] = 0x757F, [ 390] = 0x7948, [ 391] = 0x5B63, + [ 392] = 0x7A00, [ 393] = 0x7D00, [ 394] = 0x5FBD, [ 395] = 0x898F, + [ 396] = 0x8A18, [ 397] = 0x8CB4, [ 398] = 0x8D77, [ 399] = 0x8ECC, + [ 400] = 0x8F1D, [ 401] = 0x98E2, [ 402] = 0x9A0E, [ 403] = 0x9B3C, + [ 404] = 0x4E80, [ 405] = 0x507D, [ 406] = 0x5100, [ 407] = 0x5993, + [ 408] = 0x5B9C, [ 409] = 0x622F, [ 410] = 0x6280, [ 411] = 0x64EC, + [ 412] = 0x6B3A, [ 413] = 0x72A0, [ 414] = 0x7591, [ 415] = 0x7947, + [ 416] = 0x7FA9, [ 417] = 0x87FB, [ 418] = 0x8ABC, [ 419] = 0x8B70, + [ 420] = 0x63AC, [ 421] = 0x83CA, [ 422] = 0x97A0, [ 423] = 0x5409, + [ 424] = 0x5403, [ 425] = 0x55AB, [ 426] = 0x6854, [ 427] = 0x6A58, + [ 428] = 0x8A70, [ 429] = 0x7827, [ 430] = 0x6775, [ 431] = 0x9ECD, + [ 432] = 0x5374, [ 433] = 0x5BA2, [ 434] = 0x811A, [ 435] = 0x8650, + [ 436] = 0x9006, [ 437] = 0x4E18, [ 438] = 0x4E45, [ 439] = 0x4EC7, + [ 440] = 0x4F11, [ 441] = 0x53CA, [ 442] = 0x5438, [ 443] = 0x5BAE, + [ 444] = 0x5F13, [ 445] = 0x6025, [ 446] = 0x6551, [ 448] = 0x673D, + [ 449] = 0x6C42, [ 450] = 0x6C72, [ 451] = 0x6CE3, [ 452] = 0x7078, + [ 453] = 0x7403, [ 454] = 0x7A76, [ 455] = 0x7AAE, [ 456] = 0x7B08, + [ 457] = 0x7D1A, [ 458] = 0x7CFE, [ 459] = 0x7D66, [ 460] = 0x65E7, + [ 461] = 0x725B, [ 462] = 0x53BB, [ 463] = 0x5C45, [ 464] = 0x5DE8, + [ 465] = 0x62D2, [ 466] = 0x62E0, [ 467] = 0x6319, [ 468] = 0x6E20, + [ 469] = 0x865A, [ 470] = 0x8A31, [ 471] = 0x8DDD, [ 472] = 0x92F8, + [ 473] = 0x6F01, [ 474] = 0x79A6, [ 475] = 0x9B5A, [ 476] = 0x4EA8, + [ 477] = 0x4EAB, [ 478] = 0x4EAC, [ 479] = 0x4F9B, [ 480] = 0x4FA0, + [ 481] = 0x50D1, [ 482] = 0x5147, [ 483] = 0x7AF6, [ 484] = 0x5171, + [ 485] = 0x51F6, [ 486] = 0x5354, [ 487] = 0x5321, [ 488] = 0x537F, + [ 489] = 0x53EB, [ 490] = 0x55AC, [ 491] = 0x5883, [ 492] = 0x5CE1, + [ 493] = 0x5F37, [ 494] = 0x5F4A, [ 495] = 0x602F, [ 496] = 0x6050, + [ 497] = 0x606D, [ 498] = 0x631F, [ 499] = 0x6559, [ 500] = 0x6A4B, + [ 501] = 0x6CC1, [ 502] = 0x72C2, [ 503] = 0x72ED, [ 504] = 0x77EF, + [ 505] = 0x80F8, [ 506] = 0x8105, [ 507] = 0x8208, [ 508] = 0x854E, + [ 509] = 0x90F7, [ 510] = 0x93E1, [ 511] = 0x97FF, [ 512] = 0x9957, + [ 513] = 0x9A5A, [ 514] = 0x4EF0, [ 515] = 0x51DD, [ 516] = 0x5C2D, + [ 517] = 0x6681, [ 518] = 0x696D, [ 519] = 0x5C40, [ 520] = 0x66F2, + [ 521] = 0x6975, [ 522] = 0x7389, [ 523] = 0x6850, [ 524] = 0x7C81, + [ 525] = 0x50C5, [ 526] = 0x52E4, [ 527] = 0x5747, [ 528] = 0x5DFE, + [ 529] = 0x9326, [ 530] = 0x65A4, [ 531] = 0x6B23, [ 532] = 0x6B3D, + [ 533] = 0x7434, [ 534] = 0x7981, [ 535] = 0x79BD, [ 536] = 0x7B4B, + [ 537] = 0x7DCA, [ 538] = 0x82B9, [ 539] = 0x83CC, [ 540] = 0x887F, + [ 541] = 0x895F, [ 542] = 0x8B39, [ 543] = 0x8FD1, [ 544] = 0x91D1, + [ 545] = 0x541F, [ 546] = 0x9280, [ 547] = 0x4E5D, [ 548] = 0x5036, + [ 549] = 0x53E5, [ 550] = 0x533A, [ 551] = 0x72D7, [ 552] = 0x7396, + [ 553] = 0x77E9, [ 554] = 0x82E6, [ 555] = 0x8EAF, [ 556] = 0x99C6, + [ 557] = 0x99C8, [ 558] = 0x99D2, [ 559] = 0x5177, [ 560] = 0x611A, + [ 561] = 0x865E, [ 562] = 0x55B0, [ 563] = 0x7A7A, [ 564] = 0x5076, + [ 565] = 0x5BD3, [ 566] = 0x9047, [ 567] = 0x9685, [ 568] = 0x4E32, + [ 569] = 0x6ADB, [ 570] = 0x91E7, [ 571] = 0x5C51, [ 572] = 0x5C48, + [ 576] = 0x6398, [ 577] = 0x7A9F, [ 578] = 0x6C93, [ 579] = 0x9774, + [ 580] = 0x8F61, [ 581] = 0x7AAA, [ 582] = 0x718A, [ 583] = 0x9688, + [ 584] = 0x7C82, [ 585] = 0x6817, [ 586] = 0x7E70, [ 587] = 0x6851, + [ 588] = 0x936C, [ 589] = 0x52F2, [ 590] = 0x541B, [ 591] = 0x85AB, + [ 592] = 0x8A13, [ 593] = 0x7FA4, [ 594] = 0x8ECD, [ 595] = 0x90E1, + [ 596] = 0x5366, [ 597] = 0x8888, [ 598] = 0x7941, [ 599] = 0x4FC2, + [ 600] = 0x50BE, [ 601] = 0x5211, [ 602] = 0x5144, [ 603] = 0x5553, + [ 604] = 0x572D, [ 605] = 0x73EA, [ 606] = 0x578B, [ 607] = 0x5951, + [ 608] = 0x5F62, [ 609] = 0x5F84, [ 610] = 0x6075, [ 611] = 0x6176, + [ 612] = 0x6167, [ 613] = 0x61A9, [ 614] = 0x63B2, [ 615] = 0x643A, + [ 616] = 0x656C, [ 617] = 0x666F, [ 618] = 0x6842, [ 619] = 0x6E13, + [ 620] = 0x7566, [ 621] = 0x7A3D, [ 622] = 0x7CFB, [ 623] = 0x7D4C, + [ 624] = 0x7D99, [ 625] = 0x7E4B, [ 626] = 0x7F6B, [ 627] = 0x830E, + [ 628] = 0x834A, [ 629] = 0x86CD, [ 630] = 0x8A08, [ 631] = 0x8A63, + [ 632] = 0x8B66, [ 633] = 0x8EFD, [ 634] = 0x981A, [ 635] = 0x9D8F, + [ 636] = 0x82B8, [ 637] = 0x8FCE, [ 638] = 0x9BE8, [ 640] = 0x5287, + [ 641] = 0x621F, [ 642] = 0x6483, [ 643] = 0x6FC0, [ 644] = 0x9699, + [ 645] = 0x6841, [ 646] = 0x5091, [ 647] = 0x6B20, [ 648] = 0x6C7A, + [ 649] = 0x6F54, [ 650] = 0x7A74, [ 651] = 0x7D50, [ 652] = 0x8840, + [ 653] = 0x8A23, [ 654] = 0x6708, [ 655] = 0x4EF6, [ 656] = 0x5039, + [ 657] = 0x5026, [ 658] = 0x5065, [ 659] = 0x517C, [ 660] = 0x5238, + [ 661] = 0x5263, [ 662] = 0x55A7, [ 663] = 0x570F, [ 664] = 0x5805, + [ 665] = 0x5ACC, [ 666] = 0x5EFA, [ 667] = 0x61B2, [ 668] = 0x61F8, + [ 669] = 0x62F3, [ 670] = 0x6372, [ 671] = 0x691C, [ 672] = 0x6A29, + [ 673] = 0x727D, [ 674] = 0x72AC, [ 675] = 0x732E, [ 676] = 0x7814, + [ 677] = 0x786F, [ 678] = 0x7D79, [ 679] = 0x770C, [ 680] = 0x80A9, + [ 681] = 0x898B, [ 682] = 0x8B19, [ 683] = 0x8CE2, [ 684] = 0x8ED2, + [ 685] = 0x9063, [ 686] = 0x9375, [ 687] = 0x967A, [ 688] = 0x9855, + [ 689] = 0x9A13, [ 690] = 0x9E78, [ 691] = 0x5143, [ 692] = 0x539F, + [ 693] = 0x53B3, [ 694] = 0x5E7B, [ 695] = 0x5F26, [ 696] = 0x6E1B, + [ 697] = 0x6E90, [ 698] = 0x7384, [ 699] = 0x73FE, [ 700] = 0x7D43, + [ 701] = 0x8237, [ 702] = 0x8A00, [ 703] = 0x8AFA, [ 704] = 0x9650, + [ 705] = 0x4E4E, [ 706] = 0x500B, [ 707] = 0x53E4, [ 708] = 0x547C, + [ 709] = 0x56FA, [ 710] = 0x59D1, [ 711] = 0x5B64, [ 712] = 0x5DF1, + [ 713] = 0x5EAB, [ 714] = 0x5F27, [ 715] = 0x6238, [ 716] = 0x6545, + [ 717] = 0x67AF, [ 718] = 0x6E56, [ 719] = 0x72D0, [ 720] = 0x7CCA, + [ 721] = 0x88B4, [ 722] = 0x80A1, [ 723] = 0x80E1, [ 724] = 0x83F0, + [ 725] = 0x864E, [ 726] = 0x8A87, [ 727] = 0x8DE8, [ 728] = 0x9237, + [ 729] = 0x96C7, [ 730] = 0x9867, [ 731] = 0x9F13, [ 732] = 0x4E94, + [ 733] = 0x4E92, [ 734] = 0x4F0D, [ 735] = 0x5348, [ 736] = 0x5449, + [ 737] = 0x543E, [ 738] = 0x5A2F, [ 739] = 0x5F8C, [ 740] = 0x5FA1, + [ 741] = 0x609F, [ 742] = 0x68A7, [ 743] = 0x6A8E, [ 744] = 0x745A, + [ 745] = 0x7881, [ 746] = 0x8A9E, [ 747] = 0x8AA4, [ 748] = 0x8B77, + [ 749] = 0x9190, [ 750] = 0x4E5E, [ 751] = 0x9BC9, [ 752] = 0x4EA4, + [ 753] = 0x4F7C, [ 754] = 0x4FAF, [ 755] = 0x5019, [ 756] = 0x5016, + [ 757] = 0x5149, [ 758] = 0x516C, [ 759] = 0x529F, [ 760] = 0x52B9, + [ 761] = 0x52FE, [ 762] = 0x539A, [ 763] = 0x53E3, [ 764] = 0x5411, + [ 768] = 0x540E, [ 769] = 0x5589, [ 770] = 0x5751, [ 771] = 0x57A2, + [ 772] = 0x597D, [ 773] = 0x5B54, [ 774] = 0x5B5D, [ 775] = 0x5B8F, + [ 776] = 0x5DE5, [ 777] = 0x5DE7, [ 778] = 0x5DF7, [ 779] = 0x5E78, + [ 780] = 0x5E83, [ 781] = 0x5E9A, [ 782] = 0x5EB7, [ 783] = 0x5F18, + [ 784] = 0x6052, [ 785] = 0x614C, [ 786] = 0x6297, [ 787] = 0x62D8, + [ 788] = 0x63A7, [ 789] = 0x653B, [ 790] = 0x6602, [ 791] = 0x6643, + [ 792] = 0x66F4, [ 793] = 0x676D, [ 794] = 0x6821, [ 795] = 0x6897, + [ 796] = 0x69CB, [ 797] = 0x6C5F, [ 798] = 0x6D2A, [ 799] = 0x6D69, + [ 800] = 0x6E2F, [ 801] = 0x6E9D, [ 802] = 0x7532, [ 803] = 0x7687, + [ 804] = 0x786C, [ 805] = 0x7A3F, [ 806] = 0x7CE0, [ 807] = 0x7D05, + [ 808] = 0x7D18, [ 809] = 0x7D5E, [ 810] = 0x7DB1, [ 811] = 0x8015, + [ 812] = 0x8003, [ 813] = 0x80AF, [ 814] = 0x80B1, [ 815] = 0x8154, + [ 816] = 0x818F, [ 817] = 0x822A, [ 818] = 0x8352, [ 819] = 0x884C, + [ 820] = 0x8861, [ 821] = 0x8B1B, [ 822] = 0x8CA2, [ 823] = 0x8CFC, + [ 824] = 0x90CA, [ 825] = 0x9175, [ 826] = 0x9271, [ 827] = 0x783F, + [ 828] = 0x92FC, [ 829] = 0x95A4, [ 830] = 0x964D, [ 832] = 0x9805, + [ 833] = 0x9999, [ 834] = 0x9AD8, [ 835] = 0x9D3B, [ 836] = 0x525B, + [ 837] = 0x52AB, [ 838] = 0x53F7, [ 839] = 0x5408, [ 840] = 0x58D5, + [ 841] = 0x62F7, [ 842] = 0x6FE0, [ 843] = 0x8C6A, [ 844] = 0x8F5F, + [ 845] = 0x9EB9, [ 846] = 0x514B, [ 847] = 0x523B, [ 848] = 0x544A, + [ 849] = 0x56FD, [ 850] = 0x7A40, [ 851] = 0x9177, [ 852] = 0x9D60, + [ 853] = 0x9ED2, [ 854] = 0x7344, [ 855] = 0x6F09, [ 856] = 0x8170, + [ 857] = 0x7511, [ 858] = 0x5FFD, [ 859] = 0x60DA, [ 860] = 0x9AA8, + [ 861] = 0x72DB, [ 862] = 0x8FBC, [ 863] = 0x6B64, [ 864] = 0x9803, + [ 865] = 0x4ECA, [ 866] = 0x56F0, [ 867] = 0x5764, [ 868] = 0x58BE, + [ 869] = 0x5A5A, [ 870] = 0x6068, [ 871] = 0x61C7, [ 872] = 0x660F, + [ 873] = 0x6606, [ 874] = 0x6839, [ 875] = 0x68B1, [ 876] = 0x6DF7, + [ 877] = 0x75D5, [ 878] = 0x7D3A, [ 879] = 0x826E, [ 880] = 0x9B42, + [ 881] = 0x4E9B, [ 882] = 0x4F50, [ 883] = 0x53C9, [ 884] = 0x5506, + [ 885] = 0x5D6F, [ 886] = 0x5DE6, [ 887] = 0x5DEE, [ 888] = 0x67FB, + [ 889] = 0x6C99, [ 890] = 0x7473, [ 891] = 0x7802, [ 892] = 0x8A50, + [ 893] = 0x9396, [ 894] = 0x88DF, [ 895] = 0x5750, [ 896] = 0x5EA7, + [ 897] = 0x632B, [ 898] = 0x50B5, [ 899] = 0x50AC, [ 900] = 0x518D, + [ 901] = 0x6700, [ 902] = 0x54C9, [ 903] = 0x585E, [ 904] = 0x59BB, + [ 905] = 0x5BB0, [ 906] = 0x5F69, [ 907] = 0x624D, [ 908] = 0x63A1, + [ 909] = 0x683D, [ 910] = 0x6B73, [ 911] = 0x6E08, [ 912] = 0x707D, + [ 913] = 0x91C7, [ 914] = 0x7280, [ 915] = 0x7815, [ 916] = 0x7826, + [ 917] = 0x796D, [ 918] = 0x658E, [ 919] = 0x7D30, [ 920] = 0x83DC, + [ 921] = 0x88C1, [ 922] = 0x8F09, [ 923] = 0x969B, [ 924] = 0x5264, + [ 925] = 0x5728, [ 926] = 0x6750, [ 927] = 0x7F6A, [ 928] = 0x8CA1, + [ 929] = 0x51B4, [ 930] = 0x5742, [ 931] = 0x962A, [ 932] = 0x583A, + [ 933] = 0x698A, [ 934] = 0x80B4, [ 935] = 0x54B2, [ 936] = 0x5D0E, + [ 937] = 0x57FC, [ 938] = 0x7895, [ 939] = 0x9DFA, [ 940] = 0x4F5C, + [ 941] = 0x524A, [ 942] = 0x548B, [ 943] = 0x643E, [ 944] = 0x6628, + [ 945] = 0x6714, [ 946] = 0x67F5, [ 947] = 0x7A84, [ 948] = 0x7B56, + [ 949] = 0x7D22, [ 950] = 0x932F, [ 951] = 0x685C, [ 952] = 0x9BAD, + [ 953] = 0x7B39, [ 954] = 0x5319, [ 955] = 0x518A, [ 956] = 0x5237, + [ 960] = 0x5BDF, [ 961] = 0x62F6, [ 962] = 0x64AE, [ 963] = 0x64E6, + [ 964] = 0x672D, [ 965] = 0x6BBA, [ 966] = 0x85A9, [ 967] = 0x96D1, + [ 968] = 0x7690, [ 969] = 0x9BD6, [ 970] = 0x634C, [ 971] = 0x9306, + [ 972] = 0x9BAB, [ 973] = 0x76BF, [ 974] = 0x6652, [ 975] = 0x4E09, + [ 976] = 0x5098, [ 977] = 0x53C2, [ 978] = 0x5C71, [ 979] = 0x60E8, + [ 980] = 0x6492, [ 981] = 0x6563, [ 982] = 0x685F, [ 983] = 0x71E6, + [ 984] = 0x73CA, [ 985] = 0x7523, [ 986] = 0x7B97, [ 987] = 0x7E82, + [ 988] = 0x8695, [ 989] = 0x8B83, [ 990] = 0x8CDB, [ 991] = 0x9178, + [ 992] = 0x9910, [ 993] = 0x65AC, [ 994] = 0x66AB, [ 995] = 0x6B8B, + [ 996] = 0x4ED5, [ 997] = 0x4ED4, [ 998] = 0x4F3A, [ 999] = 0x4F7F, + [1000] = 0x523A, [1001] = 0x53F8, [1002] = 0x53F2, [1003] = 0x55E3, + [1004] = 0x56DB, [1005] = 0x58EB, [1006] = 0x59CB, [1007] = 0x59C9, + [1008] = 0x59FF, [1009] = 0x5B50, [1010] = 0x5C4D, [1011] = 0x5E02, + [1012] = 0x5E2B, [1013] = 0x5FD7, [1014] = 0x601D, [1015] = 0x6307, + [1016] = 0x652F, [1017] = 0x5B5C, [1018] = 0x65AF, [1019] = 0x65BD, + [1020] = 0x65E8, [1021] = 0x679D, [1022] = 0x6B62, [1024] = 0x6B7B, + [1025] = 0x6C0F, [1026] = 0x7345, [1027] = 0x7949, [1028] = 0x79C1, + [1029] = 0x7CF8, [1030] = 0x7D19, [1031] = 0x7D2B, [1032] = 0x80A2, + [1033] = 0x8102, [1034] = 0x81F3, [1035] = 0x8996, [1036] = 0x8A5E, + [1037] = 0x8A69, [1038] = 0x8A66, [1039] = 0x8A8C, [1040] = 0x8AEE, + [1041] = 0x8CC7, [1042] = 0x8CDC, [1043] = 0x96CC, [1044] = 0x98FC, + [1045] = 0x6B6F, [1046] = 0x4E8B, [1047] = 0x4F3C, [1048] = 0x4F8D, + [1049] = 0x5150, [1050] = 0x5B57, [1051] = 0x5BFA, [1052] = 0x6148, + [1053] = 0x6301, [1054] = 0x6642, [1055] = 0x6B21, [1056] = 0x6ECB, + [1057] = 0x6CBB, [1058] = 0x723E, [1059] = 0x74BD, [1060] = 0x75D4, + [1061] = 0x78C1, [1062] = 0x793A, [1063] = 0x800C, [1064] = 0x8033, + [1065] = 0x81EA, [1066] = 0x8494, [1067] = 0x8F9E, [1068] = 0x6C50, + [1069] = 0x9E7F, [1070] = 0x5F0F, [1071] = 0x8B58, [1072] = 0x9D2B, + [1073] = 0x7AFA, [1074] = 0x8EF8, [1075] = 0x5B8D, [1076] = 0x96EB, + [1077] = 0x4E03, [1078] = 0x53F1, [1079] = 0x57F7, [1080] = 0x5931, + [1081] = 0x5AC9, [1082] = 0x5BA4, [1083] = 0x6089, [1084] = 0x6E7F, + [1085] = 0x6F06, [1086] = 0x75BE, [1087] = 0x8CEA, [1088] = 0x5B9F, + [1089] = 0x8500, [1090] = 0x7BE0, [1091] = 0x5072, [1092] = 0x67F4, + [1093] = 0x829D, [1094] = 0x5C61, [1095] = 0x854A, [1096] = 0x7E1E, + [1097] = 0x820E, [1098] = 0x5199, [1099] = 0x5C04, [1100] = 0x6368, + [1101] = 0x8D66, [1102] = 0x659C, [1103] = 0x716E, [1104] = 0x793E, + [1105] = 0x7D17, [1106] = 0x8005, [1107] = 0x8B1D, [1108] = 0x8ECA, + [1109] = 0x906E, [1110] = 0x86C7, [1111] = 0x90AA, [1112] = 0x501F, + [1113] = 0x52FA, [1114] = 0x5C3A, [1115] = 0x6753, [1116] = 0x707C, + [1117] = 0x7235, [1118] = 0x914C, [1119] = 0x91C8, [1120] = 0x932B, + [1121] = 0x82E5, [1122] = 0x5BC2, [1123] = 0x5F31, [1124] = 0x60F9, + [1125] = 0x4E3B, [1126] = 0x53D6, [1127] = 0x5B88, [1128] = 0x624B, + [1129] = 0x6731, [1130] = 0x6B8A, [1131] = 0x72E9, [1132] = 0x73E0, + [1133] = 0x7A2E, [1134] = 0x816B, [1135] = 0x8DA3, [1136] = 0x9152, + [1137] = 0x9996, [1138] = 0x5112, [1139] = 0x53D7, [1140] = 0x546A, + [1141] = 0x5BFF, [1142] = 0x6388, [1143] = 0x6A39, [1144] = 0x7DAC, + [1145] = 0x9700, [1146] = 0x56DA, [1147] = 0x53CE, [1148] = 0x5468, + [1152] = 0x5B97, [1153] = 0x5C31, [1154] = 0x5DDE, [1155] = 0x4FEE, + [1156] = 0x6101, [1157] = 0x62FE, [1158] = 0x6D32, [1159] = 0x79C0, + [1160] = 0x79CB, [1161] = 0x7D42, [1162] = 0x7E4D, [1163] = 0x7FD2, + [1164] = 0x81ED, [1165] = 0x821F, [1166] = 0x8490, [1167] = 0x8846, + [1168] = 0x8972, [1169] = 0x8B90, [1170] = 0x8E74, [1171] = 0x8F2F, + [1172] = 0x9031, [1173] = 0x914B, [1174] = 0x916C, [1175] = 0x96C6, + [1176] = 0x919C, [1177] = 0x4EC0, [1178] = 0x4F4F, [1179] = 0x5145, + [1180] = 0x5341, [1181] = 0x5F93, [1182] = 0x620E, [1183] = 0x67D4, + [1184] = 0x6C41, [1185] = 0x6E0B, [1186] = 0x7363, [1187] = 0x7E26, + [1188] = 0x91CD, [1189] = 0x9283, [1190] = 0x53D4, [1191] = 0x5919, + [1192] = 0x5BBF, [1193] = 0x6DD1, [1194] = 0x795D, [1195] = 0x7E2E, + [1196] = 0x7C9B, [1197] = 0x587E, [1198] = 0x719F, [1199] = 0x51FA, + [1200] = 0x8853, [1201] = 0x8FF0, [1202] = 0x4FCA, [1203] = 0x5CFB, + [1204] = 0x6625, [1205] = 0x77AC, [1206] = 0x7AE3, [1207] = 0x821C, + [1208] = 0x99FF, [1209] = 0x51C6, [1210] = 0x5FAA, [1211] = 0x65EC, + [1212] = 0x696F, [1213] = 0x6B89, [1214] = 0x6DF3, [1216] = 0x6E96, + [1217] = 0x6F64, [1218] = 0x76FE, [1219] = 0x7D14, [1220] = 0x5DE1, + [1221] = 0x9075, [1222] = 0x9187, [1223] = 0x9806, [1224] = 0x51E6, + [1225] = 0x521D, [1226] = 0x6240, [1227] = 0x6691, [1228] = 0x66D9, + [1229] = 0x6E1A, [1230] = 0x5EB6, [1231] = 0x7DD2, [1232] = 0x7F72, + [1233] = 0x66F8, [1234] = 0x85AF, [1235] = 0x85F7, [1236] = 0x8AF8, + [1237] = 0x52A9, [1238] = 0x53D9, [1239] = 0x5973, [1240] = 0x5E8F, + [1241] = 0x5F90, [1242] = 0x6055, [1243] = 0x92E4, [1244] = 0x9664, + [1245] = 0x50B7, [1246] = 0x511F, [1247] = 0x52DD, [1248] = 0x5320, + [1249] = 0x5347, [1250] = 0x53EC, [1251] = 0x54E8, [1252] = 0x5546, + [1253] = 0x5531, [1254] = 0x5617, [1255] = 0x5968, [1256] = 0x59BE, + [1257] = 0x5A3C, [1258] = 0x5BB5, [1259] = 0x5C06, [1260] = 0x5C0F, + [1261] = 0x5C11, [1262] = 0x5C1A, [1263] = 0x5E84, [1264] = 0x5E8A, + [1265] = 0x5EE0, [1266] = 0x5F70, [1267] = 0x627F, [1268] = 0x6284, + [1269] = 0x62DB, [1270] = 0x638C, [1271] = 0x6377, [1272] = 0x6607, + [1273] = 0x660C, [1274] = 0x662D, [1275] = 0x6676, [1276] = 0x677E, + [1277] = 0x68A2, [1278] = 0x6A1F, [1279] = 0x6A35, [1280] = 0x6CBC, + [1281] = 0x6D88, [1282] = 0x6E09, [1283] = 0x6E58, [1284] = 0x713C, + [1285] = 0x7126, [1286] = 0x7167, [1287] = 0x75C7, [1288] = 0x7701, + [1289] = 0x785D, [1290] = 0x7901, [1291] = 0x7965, [1292] = 0x79F0, + [1293] = 0x7AE0, [1294] = 0x7B11, [1295] = 0x7CA7, [1296] = 0x7D39, + [1297] = 0x8096, [1298] = 0x83D6, [1299] = 0x848B, [1300] = 0x8549, + [1301] = 0x885D, [1302] = 0x88F3, [1303] = 0x8A1F, [1304] = 0x8A3C, + [1305] = 0x8A54, [1306] = 0x8A73, [1307] = 0x8C61, [1308] = 0x8CDE, + [1309] = 0x91A4, [1310] = 0x9266, [1311] = 0x937E, [1312] = 0x9418, + [1313] = 0x969C, [1314] = 0x9798, [1315] = 0x4E0A, [1316] = 0x4E08, + [1317] = 0x4E1E, [1318] = 0x4E57, [1319] = 0x5197, [1320] = 0x5270, + [1321] = 0x57CE, [1322] = 0x5834, [1323] = 0x58CC, [1324] = 0x5B22, + [1325] = 0x5E38, [1326] = 0x60C5, [1327] = 0x64FE, [1328] = 0x6761, + [1329] = 0x6756, [1330] = 0x6D44, [1331] = 0x72B6, [1332] = 0x7573, + [1333] = 0x7A63, [1334] = 0x84B8, [1335] = 0x8B72, [1336] = 0x91B8, + [1337] = 0x9320, [1338] = 0x5631, [1339] = 0x57F4, [1340] = 0x98FE, + [1344] = 0x62ED, [1345] = 0x690D, [1346] = 0x6B96, [1347] = 0x71ED, + [1348] = 0x7E54, [1349] = 0x8077, [1350] = 0x8272, [1351] = 0x89E6, + [1352] = 0x98DF, [1353] = 0x8755, [1354] = 0x8FB1, [1355] = 0x5C3B, + [1356] = 0x4F38, [1357] = 0x4FE1, [1358] = 0x4FB5, [1359] = 0x5507, + [1360] = 0x5A20, [1361] = 0x5BDD, [1362] = 0x5BE9, [1363] = 0x5FC3, + [1364] = 0x614E, [1365] = 0x632F, [1366] = 0x65B0, [1367] = 0x664B, + [1368] = 0x68EE, [1369] = 0x699B, [1370] = 0x6D78, [1371] = 0x6DF1, + [1372] = 0x7533, [1373] = 0x75B9, [1374] = 0x771F, [1375] = 0x795E, + [1376] = 0x79E6, [1377] = 0x7D33, [1378] = 0x81E3, [1379] = 0x82AF, + [1380] = 0x85AA, [1381] = 0x89AA, [1382] = 0x8A3A, [1383] = 0x8EAB, + [1384] = 0x8F9B, [1385] = 0x9032, [1386] = 0x91DD, [1387] = 0x9707, + [1388] = 0x4EBA, [1389] = 0x4EC1, [1390] = 0x5203, [1391] = 0x5875, + [1392] = 0x58EC, [1393] = 0x5C0B, [1394] = 0x751A, [1395] = 0x5C3D, + [1396] = 0x814E, [1397] = 0x8A0A, [1398] = 0x8FC5, [1399] = 0x9663, + [1400] = 0x976D, [1401] = 0x7B25, [1402] = 0x8ACF, [1403] = 0x9808, + [1404] = 0x9162, [1405] = 0x56F3, [1406] = 0x53A8, [1408] = 0x9017, + [1409] = 0x5439, [1410] = 0x5782, [1411] = 0x5E25, [1412] = 0x63A8, + [1413] = 0x6C34, [1414] = 0x708A, [1415] = 0x7761, [1416] = 0x7C8B, + [1417] = 0x7FE0, [1418] = 0x8870, [1419] = 0x9042, [1420] = 0x9154, + [1421] = 0x9310, [1422] = 0x9318, [1423] = 0x968F, [1424] = 0x745E, + [1425] = 0x9AC4, [1426] = 0x5D07, [1427] = 0x5D69, [1428] = 0x6570, + [1429] = 0x67A2, [1430] = 0x8DA8, [1431] = 0x96DB, [1432] = 0x636E, + [1433] = 0x6749, [1434] = 0x6919, [1435] = 0x83C5, [1436] = 0x9817, + [1437] = 0x96C0, [1438] = 0x88FE, [1439] = 0x6F84, [1440] = 0x647A, + [1441] = 0x5BF8, [1442] = 0x4E16, [1443] = 0x702C, [1444] = 0x755D, + [1445] = 0x662F, [1446] = 0x51C4, [1447] = 0x5236, [1448] = 0x52E2, + [1449] = 0x59D3, [1450] = 0x5F81, [1451] = 0x6027, [1452] = 0x6210, + [1453] = 0x653F, [1454] = 0x6574, [1455] = 0x661F, [1456] = 0x6674, + [1457] = 0x68F2, [1458] = 0x6816, [1459] = 0x6B63, [1460] = 0x6E05, + [1461] = 0x7272, [1462] = 0x751F, [1463] = 0x76DB, [1464] = 0x7CBE, + [1465] = 0x8056, [1466] = 0x58F0, [1467] = 0x88FD, [1468] = 0x897F, + [1469] = 0x8AA0, [1470] = 0x8A93, [1471] = 0x8ACB, [1472] = 0x901D, + [1473] = 0x9192, [1474] = 0x9752, [1475] = 0x9759, [1476] = 0x6589, + [1477] = 0x7A0E, [1478] = 0x8106, [1479] = 0x96BB, [1480] = 0x5E2D, + [1481] = 0x60DC, [1482] = 0x621A, [1483] = 0x65A5, [1484] = 0x6614, + [1485] = 0x6790, [1486] = 0x77F3, [1487] = 0x7A4D, [1488] = 0x7C4D, + [1489] = 0x7E3E, [1490] = 0x810A, [1491] = 0x8CAC, [1492] = 0x8D64, + [1493] = 0x8DE1, [1494] = 0x8E5F, [1495] = 0x78A9, [1496] = 0x5207, + [1497] = 0x62D9, [1498] = 0x63A5, [1499] = 0x6442, [1500] = 0x6298, + [1501] = 0x8A2D, [1502] = 0x7A83, [1503] = 0x7BC0, [1504] = 0x8AAC, + [1505] = 0x96EA, [1506] = 0x7D76, [1507] = 0x820C, [1508] = 0x8749, + [1509] = 0x4ED9, [1510] = 0x5148, [1511] = 0x5343, [1512] = 0x5360, + [1513] = 0x5BA3, [1514] = 0x5C02, [1515] = 0x5C16, [1516] = 0x5DDD, + [1517] = 0x6226, [1518] = 0x6247, [1519] = 0x64B0, [1520] = 0x6813, + [1521] = 0x6834, [1522] = 0x6CC9, [1523] = 0x6D45, [1524] = 0x6D17, + [1525] = 0x67D3, [1526] = 0x6F5C, [1527] = 0x714E, [1528] = 0x717D, + [1529] = 0x65CB, [1530] = 0x7A7F, [1531] = 0x7BAD, [1532] = 0x7DDA, + [1536] = 0x7E4A, [1537] = 0x7FA8, [1538] = 0x817A, [1539] = 0x821B, + [1540] = 0x8239, [1541] = 0x85A6, [1542] = 0x8A6E, [1543] = 0x8CCE, + [1544] = 0x8DF5, [1545] = 0x9078, [1546] = 0x9077, [1547] = 0x92AD, + [1548] = 0x9291, [1549] = 0x9583, [1550] = 0x9BAE, [1551] = 0x524D, + [1552] = 0x5584, [1553] = 0x6F38, [1554] = 0x7136, [1555] = 0x5168, + [1556] = 0x7985, [1557] = 0x7E55, [1558] = 0x81B3, [1559] = 0x7CCE, + [1560] = 0x564C, [1561] = 0x5851, [1562] = 0x5CA8, [1563] = 0x63AA, + [1564] = 0x66FE, [1565] = 0x66FD, [1566] = 0x695A, [1567] = 0x72D9, + [1568] = 0x758F, [1569] = 0x758E, [1570] = 0x790E, [1571] = 0x7956, + [1572] = 0x79DF, [1573] = 0x7C97, [1574] = 0x7D20, [1575] = 0x7D44, + [1576] = 0x8607, [1577] = 0x8A34, [1578] = 0x963B, [1579] = 0x9061, + [1580] = 0x9F20, [1581] = 0x50E7, [1582] = 0x5275, [1583] = 0x53CC, + [1584] = 0x53E2, [1585] = 0x5009, [1586] = 0x55AA, [1587] = 0x58EE, + [1588] = 0x594F, [1589] = 0x723D, [1590] = 0x5B8B, [1591] = 0x5C64, + [1592] = 0x531D, [1593] = 0x60E3, [1594] = 0x60F3, [1595] = 0x635C, + [1596] = 0x6383, [1597] = 0x633F, [1598] = 0x63BB, [1600] = 0x64CD, + [1601] = 0x65E9, [1602] = 0x66F9, [1603] = 0x5DE3, [1604] = 0x69CD, + [1605] = 0x69FD, [1606] = 0x6F15, [1607] = 0x71E5, [1608] = 0x4E89, + [1609] = 0x75E9, [1610] = 0x76F8, [1611] = 0x7A93, [1612] = 0x7CDF, + [1613] = 0x7DCF, [1614] = 0x7D9C, [1615] = 0x8061, [1616] = 0x8349, + [1617] = 0x8358, [1618] = 0x846C, [1619] = 0x84BC, [1620] = 0x85FB, + [1621] = 0x88C5, [1622] = 0x8D70, [1623] = 0x9001, [1624] = 0x906D, + [1625] = 0x9397, [1626] = 0x971C, [1627] = 0x9A12, [1628] = 0x50CF, + [1629] = 0x5897, [1630] = 0x618E, [1631] = 0x81D3, [1632] = 0x8535, + [1633] = 0x8D08, [1634] = 0x9020, [1635] = 0x4FC3, [1636] = 0x5074, + [1637] = 0x5247, [1638] = 0x5373, [1639] = 0x606F, [1640] = 0x6349, + [1641] = 0x675F, [1642] = 0x6E2C, [1643] = 0x8DB3, [1644] = 0x901F, + [1645] = 0x4FD7, [1646] = 0x5C5E, [1647] = 0x8CCA, [1648] = 0x65CF, + [1649] = 0x7D9A, [1650] = 0x5352, [1651] = 0x8896, [1652] = 0x5176, + [1653] = 0x63C3, [1654] = 0x5B58, [1655] = 0x5B6B, [1656] = 0x5C0A, + [1657] = 0x640D, [1658] = 0x6751, [1659] = 0x905C, [1660] = 0x4ED6, + [1661] = 0x591A, [1662] = 0x592A, [1663] = 0x6C70, [1664] = 0x8A51, + [1665] = 0x553E, [1666] = 0x5815, [1667] = 0x59A5, [1668] = 0x60F0, + [1669] = 0x6253, [1670] = 0x67C1, [1671] = 0x8235, [1672] = 0x6955, + [1673] = 0x9640, [1674] = 0x99C4, [1675] = 0x9A28, [1676] = 0x4F53, + [1677] = 0x5806, [1678] = 0x5BFE, [1679] = 0x8010, [1680] = 0x5CB1, + [1681] = 0x5E2F, [1682] = 0x5F85, [1683] = 0x6020, [1684] = 0x614B, + [1685] = 0x6234, [1686] = 0x66FF, [1687] = 0x6CF0, [1688] = 0x6EDE, + [1689] = 0x80CE, [1690] = 0x817F, [1691] = 0x82D4, [1692] = 0x888B, + [1693] = 0x8CB8, [1694] = 0x9000, [1695] = 0x902E, [1696] = 0x968A, + [1697] = 0x9EDB, [1698] = 0x9BDB, [1699] = 0x4EE3, [1700] = 0x53F0, + [1701] = 0x5927, [1702] = 0x7B2C, [1703] = 0x918D, [1704] = 0x984C, + [1705] = 0x9DF9, [1706] = 0x6EDD, [1707] = 0x7027, [1708] = 0x5353, + [1709] = 0x5544, [1710] = 0x5B85, [1711] = 0x6258, [1712] = 0x629E, + [1713] = 0x62D3, [1714] = 0x6CA2, [1715] = 0x6FEF, [1716] = 0x7422, + [1717] = 0x8A17, [1718] = 0x9438, [1719] = 0x6FC1, [1720] = 0x8AFE, + [1721] = 0x8338, [1722] = 0x51E7, [1723] = 0x86F8, [1724] = 0x53EA, + [1728] = 0x53E9, [1729] = 0x4F46, [1730] = 0x9054, [1731] = 0x8FB0, + [1732] = 0x596A, [1733] = 0x8131, [1734] = 0x5DFD, [1735] = 0x7AEA, + [1736] = 0x8FBF, [1737] = 0x68DA, [1738] = 0x8C37, [1739] = 0x72F8, + [1740] = 0x9C48, [1741] = 0x6A3D, [1742] = 0x8AB0, [1743] = 0x4E39, + [1744] = 0x5358, [1745] = 0x5606, [1746] = 0x5766, [1747] = 0x62C5, + [1748] = 0x63A2, [1749] = 0x65E6, [1750] = 0x6B4E, [1751] = 0x6DE1, + [1752] = 0x6E5B, [1753] = 0x70AD, [1754] = 0x77ED, [1755] = 0x7AEF, + [1756] = 0x7BAA, [1757] = 0x7DBB, [1758] = 0x803D, [1759] = 0x80C6, + [1760] = 0x86CB, [1761] = 0x8A95, [1762] = 0x935B, [1763] = 0x56E3, + [1764] = 0x58C7, [1765] = 0x5F3E, [1766] = 0x65AD, [1767] = 0x6696, + [1768] = 0x6A80, [1769] = 0x6BB5, [1770] = 0x7537, [1771] = 0x8AC7, + [1772] = 0x5024, [1773] = 0x77E5, [1774] = 0x5730, [1775] = 0x5F1B, + [1776] = 0x6065, [1777] = 0x667A, [1778] = 0x6C60, [1779] = 0x75F4, + [1780] = 0x7A1A, [1781] = 0x7F6E, [1782] = 0x81F4, [1783] = 0x8718, + [1784] = 0x9045, [1785] = 0x99B3, [1786] = 0x7BC9, [1787] = 0x755C, + [1788] = 0x7AF9, [1789] = 0x7B51, [1790] = 0x84C4, [1792] = 0x9010, + [1793] = 0x79E9, [1794] = 0x7A92, [1795] = 0x8336, [1796] = 0x5AE1, + [1797] = 0x7740, [1798] = 0x4E2D, [1799] = 0x4EF2, [1800] = 0x5B99, + [1801] = 0x5FE0, [1802] = 0x62BD, [1803] = 0x663C, [1804] = 0x67F1, + [1805] = 0x6CE8, [1806] = 0x866B, [1807] = 0x8877, [1808] = 0x8A3B, + [1809] = 0x914E, [1810] = 0x92F3, [1811] = 0x99D0, [1812] = 0x6A17, + [1813] = 0x7026, [1814] = 0x732A, [1815] = 0x82E7, [1816] = 0x8457, + [1817] = 0x8CAF, [1818] = 0x4E01, [1819] = 0x5146, [1820] = 0x51CB, + [1821] = 0x558B, [1822] = 0x5BF5, [1823] = 0x5E16, [1824] = 0x5E33, + [1825] = 0x5E81, [1826] = 0x5F14, [1827] = 0x5F35, [1828] = 0x5F6B, + [1829] = 0x5FB4, [1830] = 0x61F2, [1831] = 0x6311, [1832] = 0x66A2, + [1833] = 0x671D, [1834] = 0x6F6E, [1835] = 0x7252, [1836] = 0x753A, + [1837] = 0x773A, [1838] = 0x8074, [1839] = 0x8139, [1840] = 0x8178, + [1841] = 0x8776, [1842] = 0x8ABF, [1843] = 0x8ADC, [1844] = 0x8D85, + [1845] = 0x8DF3, [1846] = 0x929A, [1847] = 0x9577, [1848] = 0x9802, + [1849] = 0x9CE5, [1850] = 0x52C5, [1851] = 0x6357, [1852] = 0x76F4, + [1853] = 0x6715, [1854] = 0x6C88, [1855] = 0x73CD, [1856] = 0x8CC3, + [1857] = 0x93AE, [1858] = 0x9673, [1859] = 0x6D25, [1860] = 0x589C, + [1861] = 0x690E, [1862] = 0x69CC, [1863] = 0x8FFD, [1864] = 0x939A, + [1865] = 0x75DB, [1866] = 0x901A, [1867] = 0x585A, [1868] = 0x6802, + [1869] = 0x63B4, [1870] = 0x69FB, [1871] = 0x4F43, [1872] = 0x6F2C, + [1873] = 0x67D8, [1874] = 0x8FBB, [1875] = 0x8526, [1876] = 0x7DB4, + [1877] = 0x9354, [1878] = 0x693F, [1879] = 0x6F70, [1880] = 0x576A, + [1881] = 0x58F7, [1882] = 0x5B2C, [1883] = 0x7D2C, [1884] = 0x722A, + [1885] = 0x540A, [1886] = 0x91E3, [1887] = 0x9DB4, [1888] = 0x4EAD, + [1889] = 0x4F4E, [1890] = 0x505C, [1891] = 0x5075, [1892] = 0x5243, + [1893] = 0x8C9E, [1894] = 0x5448, [1895] = 0x5824, [1896] = 0x5B9A, + [1897] = 0x5E1D, [1898] = 0x5E95, [1899] = 0x5EAD, [1900] = 0x5EF7, + [1901] = 0x5F1F, [1902] = 0x608C, [1903] = 0x62B5, [1904] = 0x633A, + [1905] = 0x63D0, [1906] = 0x68AF, [1907] = 0x6C40, [1908] = 0x7887, + [1909] = 0x798E, [1910] = 0x7A0B, [1911] = 0x7DE0, [1912] = 0x8247, + [1913] = 0x8A02, [1914] = 0x8AE6, [1915] = 0x8E44, [1916] = 0x9013, + [1920] = 0x90B8, [1921] = 0x912D, [1922] = 0x91D8, [1923] = 0x9F0E, + [1924] = 0x6CE5, [1925] = 0x6458, [1926] = 0x64E2, [1927] = 0x6575, + [1928] = 0x6EF4, [1929] = 0x7684, [1930] = 0x7B1B, [1931] = 0x9069, + [1932] = 0x93D1, [1933] = 0x6EBA, [1934] = 0x54F2, [1935] = 0x5FB9, + [1936] = 0x64A4, [1937] = 0x8F4D, [1938] = 0x8FED, [1939] = 0x9244, + [1940] = 0x5178, [1941] = 0x586B, [1942] = 0x5929, [1943] = 0x5C55, + [1944] = 0x5E97, [1945] = 0x6DFB, [1946] = 0x7E8F, [1947] = 0x751C, + [1948] = 0x8CBC, [1949] = 0x8EE2, [1950] = 0x985B, [1951] = 0x70B9, + [1952] = 0x4F1D, [1953] = 0x6BBF, [1954] = 0x6FB1, [1955] = 0x7530, + [1956] = 0x96FB, [1957] = 0x514E, [1958] = 0x5410, [1959] = 0x5835, + [1960] = 0x5857, [1961] = 0x59AC, [1962] = 0x5C60, [1963] = 0x5F92, + [1964] = 0x6597, [1965] = 0x675C, [1966] = 0x6E21, [1967] = 0x767B, + [1968] = 0x83DF, [1969] = 0x8CED, [1970] = 0x9014, [1971] = 0x90FD, + [1972] = 0x934D, [1973] = 0x7825, [1974] = 0x783A, [1975] = 0x52AA, + [1976] = 0x5EA6, [1977] = 0x571F, [1978] = 0x5974, [1979] = 0x6012, + [1980] = 0x5012, [1981] = 0x515A, [1982] = 0x51AC, [1984] = 0x51CD, + [1985] = 0x5200, [1986] = 0x5510, [1987] = 0x5854, [1988] = 0x5858, + [1989] = 0x5957, [1990] = 0x5B95, [1991] = 0x5CF6, [1992] = 0x5D8B, + [1993] = 0x60BC, [1994] = 0x6295, [1995] = 0x642D, [1996] = 0x6771, + [1997] = 0x6843, [1998] = 0x68BC, [1999] = 0x68DF, [2000] = 0x76D7, + [2001] = 0x6DD8, [2002] = 0x6E6F, [2003] = 0x6D9B, [2004] = 0x706F, + [2005] = 0x71C8, [2006] = 0x5F53, [2007] = 0x75D8, [2008] = 0x7977, + [2009] = 0x7B49, [2010] = 0x7B54, [2011] = 0x7B52, [2012] = 0x7CD6, + [2013] = 0x7D71, [2014] = 0x5230, [2015] = 0x8463, [2016] = 0x8569, + [2017] = 0x85E4, [2018] = 0x8A0E, [2019] = 0x8B04, [2020] = 0x8C46, + [2021] = 0x8E0F, [2022] = 0x9003, [2023] = 0x900F, [2024] = 0x9419, + [2025] = 0x9676, [2026] = 0x982D, [2027] = 0x9A30, [2028] = 0x95D8, + [2029] = 0x50CD, [2030] = 0x52D5, [2031] = 0x540C, [2032] = 0x5802, + [2033] = 0x5C0E, [2034] = 0x61A7, [2035] = 0x649E, [2036] = 0x6D1E, + [2037] = 0x77B3, [2038] = 0x7AE5, [2039] = 0x80F4, [2040] = 0x8404, + [2041] = 0x9053, [2042] = 0x9285, [2043] = 0x5CE0, [2044] = 0x9D07, + [2045] = 0x533F, [2046] = 0x5F97, [2047] = 0x5FB3, [2048] = 0x6D9C, + [2049] = 0x7279, [2050] = 0x7763, [2051] = 0x79BF, [2052] = 0x7BE4, + [2053] = 0x6BD2, [2054] = 0x72EC, [2055] = 0x8AAD, [2056] = 0x6803, + [2057] = 0x6A61, [2058] = 0x51F8, [2059] = 0x7A81, [2060] = 0x6934, + [2061] = 0x5C4A, [2062] = 0x9CF6, [2063] = 0x82EB, [2064] = 0x5BC5, + [2065] = 0x9149, [2066] = 0x701E, [2067] = 0x5678, [2068] = 0x5C6F, + [2069] = 0x60C7, [2070] = 0x6566, [2071] = 0x6C8C, [2072] = 0x8C5A, + [2073] = 0x9041, [2074] = 0x9813, [2075] = 0x5451, [2076] = 0x66C7, + [2077] = 0x920D, [2078] = 0x5948, [2079] = 0x90A3, [2080] = 0x5185, + [2081] = 0x4E4D, [2082] = 0x51EA, [2083] = 0x8599, [2084] = 0x8B0E, + [2085] = 0x7058, [2086] = 0x637A, [2087] = 0x934B, [2088] = 0x6962, + [2089] = 0x99B4, [2090] = 0x7E04, [2091] = 0x7577, [2092] = 0x5357, + [2093] = 0x6960, [2094] = 0x8EDF, [2095] = 0x96E3, [2096] = 0x6C5D, + [2097] = 0x4E8C, [2098] = 0x5C3C, [2099] = 0x5F10, [2100] = 0x8FE9, + [2101] = 0x5302, [2102] = 0x8CD1, [2103] = 0x8089, [2104] = 0x8679, + [2105] = 0x5EFF, [2106] = 0x65E5, [2107] = 0x4E73, [2108] = 0x5165, + [2112] = 0x5982, [2113] = 0x5C3F, [2114] = 0x97EE, [2115] = 0x4EFB, + [2116] = 0x598A, [2117] = 0x5FCD, [2118] = 0x8A8D, [2119] = 0x6FE1, + [2120] = 0x79B0, [2121] = 0x7962, [2122] = 0x5BE7, [2123] = 0x8471, + [2124] = 0x732B, [2125] = 0x71B1, [2126] = 0x5E74, [2127] = 0x5FF5, + [2128] = 0x637B, [2129] = 0x649A, [2130] = 0x71C3, [2131] = 0x7C98, + [2132] = 0x4E43, [2133] = 0x5EFC, [2134] = 0x4E4B, [2135] = 0x57DC, + [2136] = 0x56A2, [2137] = 0x60A9, [2138] = 0x6FC3, [2139] = 0x7D0D, + [2140] = 0x80FD, [2141] = 0x8133, [2142] = 0x81BF, [2143] = 0x8FB2, + [2144] = 0x8997, [2145] = 0x86A4, [2146] = 0x5DF4, [2147] = 0x628A, + [2148] = 0x64AD, [2149] = 0x8987, [2150] = 0x6777, [2151] = 0x6CE2, + [2152] = 0x6D3E, [2153] = 0x7436, [2154] = 0x7834, [2155] = 0x5A46, + [2156] = 0x7F75, [2157] = 0x82AD, [2158] = 0x99AC, [2159] = 0x4FF3, + [2160] = 0x5EC3, [2161] = 0x62DD, [2162] = 0x6392, [2163] = 0x6557, + [2164] = 0x676F, [2165] = 0x76C3, [2166] = 0x724C, [2167] = 0x80CC, + [2168] = 0x80BA, [2169] = 0x8F29, [2170] = 0x914D, [2171] = 0x500D, + [2172] = 0x57F9, [2173] = 0x5A92, [2174] = 0x6885, [2176] = 0x6973, + [2177] = 0x7164, [2178] = 0x72FD, [2179] = 0x8CB7, [2180] = 0x58F2, + [2181] = 0x8CE0, [2182] = 0x966A, [2183] = 0x9019, [2184] = 0x877F, + [2185] = 0x79E4, [2186] = 0x77E7, [2187] = 0x8429, [2188] = 0x4F2F, + [2189] = 0x5265, [2190] = 0x535A, [2191] = 0x62CD, [2192] = 0x67CF, + [2193] = 0x6CCA, [2194] = 0x767D, [2195] = 0x7B94, [2196] = 0x7C95, + [2197] = 0x8236, [2198] = 0x8584, [2199] = 0x8FEB, [2200] = 0x66DD, + [2201] = 0x6F20, [2202] = 0x7206, [2203] = 0x7E1B, [2204] = 0x83AB, + [2205] = 0x99C1, [2206] = 0x9EA6, [2207] = 0x51FD, [2208] = 0x7BB1, + [2209] = 0x7872, [2210] = 0x7BB8, [2211] = 0x8087, [2212] = 0x7B48, + [2213] = 0x6AE8, [2214] = 0x5E61, [2215] = 0x808C, [2216] = 0x7551, + [2217] = 0x7560, [2218] = 0x516B, [2219] = 0x9262, [2220] = 0x6E8C, + [2221] = 0x767A, [2222] = 0x9197, [2223] = 0x9AEA, [2224] = 0x4F10, + [2225] = 0x7F70, [2226] = 0x629C, [2227] = 0x7B4F, [2228] = 0x95A5, + [2229] = 0x9CE9, [2230] = 0x567A, [2231] = 0x5859, [2232] = 0x86E4, + [2233] = 0x96BC, [2234] = 0x4F34, [2235] = 0x5224, [2236] = 0x534A, + [2237] = 0x53CD, [2238] = 0x53DB, [2239] = 0x5E06, [2240] = 0x642C, + [2241] = 0x6591, [2242] = 0x677F, [2243] = 0x6C3E, [2244] = 0x6C4E, + [2245] = 0x7248, [2246] = 0x72AF, [2247] = 0x73ED, [2248] = 0x7554, + [2249] = 0x7E41, [2250] = 0x822C, [2251] = 0x85E9, [2252] = 0x8CA9, + [2253] = 0x7BC4, [2254] = 0x91C6, [2255] = 0x7169, [2256] = 0x9812, + [2257] = 0x98EF, [2258] = 0x633D, [2259] = 0x6669, [2260] = 0x756A, + [2261] = 0x76E4, [2262] = 0x78D0, [2263] = 0x8543, [2264] = 0x86EE, + [2265] = 0x532A, [2266] = 0x5351, [2267] = 0x5426, [2268] = 0x5983, + [2269] = 0x5E87, [2270] = 0x5F7C, [2271] = 0x60B2, [2272] = 0x6249, + [2273] = 0x6279, [2274] = 0x62AB, [2275] = 0x6590, [2276] = 0x6BD4, + [2277] = 0x6CCC, [2278] = 0x75B2, [2279] = 0x76AE, [2280] = 0x7891, + [2281] = 0x79D8, [2282] = 0x7DCB, [2283] = 0x7F77, [2284] = 0x80A5, + [2285] = 0x88AB, [2286] = 0x8AB9, [2287] = 0x8CBB, [2288] = 0x907F, + [2289] = 0x975E, [2290] = 0x98DB, [2291] = 0x6A0B, [2292] = 0x7C38, + [2293] = 0x5099, [2294] = 0x5C3E, [2295] = 0x5FAE, [2296] = 0x6787, + [2297] = 0x6BD8, [2298] = 0x7435, [2299] = 0x7709, [2300] = 0x7F8E, + [2304] = 0x9F3B, [2305] = 0x67CA, [2306] = 0x7A17, [2307] = 0x5339, + [2308] = 0x758B, [2309] = 0x9AED, [2310] = 0x5F66, [2311] = 0x819D, + [2312] = 0x83F1, [2313] = 0x8098, [2314] = 0x5F3C, [2315] = 0x5FC5, + [2316] = 0x7562, [2317] = 0x7B46, [2318] = 0x903C, [2319] = 0x6867, + [2320] = 0x59EB, [2321] = 0x5A9B, [2322] = 0x7D10, [2323] = 0x767E, + [2324] = 0x8B2C, [2325] = 0x4FF5, [2326] = 0x5F6A, [2327] = 0x6A19, + [2328] = 0x6C37, [2329] = 0x6F02, [2330] = 0x74E2, [2331] = 0x7968, + [2332] = 0x8868, [2333] = 0x8A55, [2334] = 0x8C79, [2335] = 0x5EDF, + [2336] = 0x63CF, [2337] = 0x75C5, [2338] = 0x79D2, [2339] = 0x82D7, + [2340] = 0x9328, [2341] = 0x92F2, [2342] = 0x849C, [2343] = 0x86ED, + [2344] = 0x9C2D, [2345] = 0x54C1, [2346] = 0x5F6C, [2347] = 0x658C, + [2348] = 0x6D5C, [2349] = 0x7015, [2350] = 0x8CA7, [2351] = 0x8CD3, + [2352] = 0x983B, [2353] = 0x654F, [2354] = 0x74F6, [2355] = 0x4E0D, + [2356] = 0x4ED8, [2357] = 0x57E0, [2358] = 0x592B, [2359] = 0x5A66, + [2360] = 0x5BCC, [2361] = 0x51A8, [2362] = 0x5E03, [2363] = 0x5E9C, + [2364] = 0x6016, [2365] = 0x6276, [2366] = 0x6577, [2368] = 0x65A7, + [2369] = 0x666E, [2370] = 0x6D6E, [2371] = 0x7236, [2372] = 0x7B26, + [2373] = 0x8150, [2374] = 0x819A, [2375] = 0x8299, [2376] = 0x8B5C, + [2377] = 0x8CA0, [2378] = 0x8CE6, [2379] = 0x8D74, [2380] = 0x961C, + [2381] = 0x9644, [2382] = 0x4FAE, [2383] = 0x64AB, [2384] = 0x6B66, + [2385] = 0x821E, [2386] = 0x8461, [2387] = 0x856A, [2388] = 0x90E8, + [2389] = 0x5C01, [2390] = 0x6953, [2391] = 0x98A8, [2392] = 0x847A, + [2393] = 0x8557, [2394] = 0x4F0F, [2395] = 0x526F, [2396] = 0x5FA9, + [2397] = 0x5E45, [2398] = 0x670D, [2399] = 0x798F, [2400] = 0x8179, + [2401] = 0x8907, [2402] = 0x8986, [2403] = 0x6DF5, [2404] = 0x5F17, + [2405] = 0x6255, [2406] = 0x6CB8, [2407] = 0x4ECF, [2408] = 0x7269, + [2409] = 0x9B92, [2410] = 0x5206, [2411] = 0x543B, [2412] = 0x5674, + [2413] = 0x58B3, [2414] = 0x61A4, [2415] = 0x626E, [2416] = 0x711A, + [2417] = 0x596E, [2418] = 0x7C89, [2419] = 0x7CDE, [2420] = 0x7D1B, + [2421] = 0x96F0, [2422] = 0x6587, [2423] = 0x805E, [2424] = 0x4E19, + [2425] = 0x4F75, [2426] = 0x5175, [2427] = 0x5840, [2428] = 0x5E63, + [2429] = 0x5E73, [2430] = 0x5F0A, [2431] = 0x67C4, [2432] = 0x4E26, + [2433] = 0x853D, [2434] = 0x9589, [2435] = 0x965B, [2436] = 0x7C73, + [2437] = 0x9801, [2438] = 0x50FB, [2439] = 0x58C1, [2440] = 0x7656, + [2441] = 0x78A7, [2442] = 0x5225, [2443] = 0x77A5, [2444] = 0x8511, + [2445] = 0x7B86, [2446] = 0x504F, [2447] = 0x5909, [2448] = 0x7247, + [2449] = 0x7BC7, [2450] = 0x7DE8, [2451] = 0x8FBA, [2452] = 0x8FD4, + [2453] = 0x904D, [2454] = 0x4FBF, [2455] = 0x52C9, [2456] = 0x5A29, + [2457] = 0x5F01, [2458] = 0x97AD, [2459] = 0x4FDD, [2460] = 0x8217, + [2461] = 0x92EA, [2462] = 0x5703, [2463] = 0x6355, [2464] = 0x6B69, + [2465] = 0x752B, [2466] = 0x88DC, [2467] = 0x8F14, [2468] = 0x7A42, + [2469] = 0x52DF, [2470] = 0x5893, [2471] = 0x6155, [2472] = 0x620A, + [2473] = 0x66AE, [2474] = 0x6BCD, [2475] = 0x7C3F, [2476] = 0x83E9, + [2477] = 0x5023, [2478] = 0x4FF8, [2479] = 0x5305, [2480] = 0x5446, + [2481] = 0x5831, [2482] = 0x5949, [2483] = 0x5B9D, [2484] = 0x5CF0, + [2485] = 0x5CEF, [2486] = 0x5D29, [2487] = 0x5E96, [2488] = 0x62B1, + [2489] = 0x6367, [2490] = 0x653E, [2491] = 0x65B9, [2492] = 0x670B, + [2496] = 0x6CD5, [2497] = 0x6CE1, [2498] = 0x70F9, [2499] = 0x7832, + [2500] = 0x7E2B, [2501] = 0x80DE, [2502] = 0x82B3, [2503] = 0x840C, + [2504] = 0x84EC, [2505] = 0x8702, [2506] = 0x8912, [2507] = 0x8A2A, + [2508] = 0x8C4A, [2509] = 0x90A6, [2510] = 0x92D2, [2511] = 0x98FD, + [2512] = 0x9CF3, [2513] = 0x9D6C, [2514] = 0x4E4F, [2515] = 0x4EA1, + [2516] = 0x508D, [2517] = 0x5256, [2518] = 0x574A, [2519] = 0x59A8, + [2520] = 0x5E3D, [2521] = 0x5FD8, [2522] = 0x5FD9, [2523] = 0x623F, + [2524] = 0x66B4, [2525] = 0x671B, [2526] = 0x67D0, [2527] = 0x68D2, + [2528] = 0x5192, [2529] = 0x7D21, [2530] = 0x80AA, [2531] = 0x81A8, + [2532] = 0x8B00, [2533] = 0x8C8C, [2534] = 0x8CBF, [2535] = 0x927E, + [2536] = 0x9632, [2537] = 0x5420, [2538] = 0x982C, [2539] = 0x5317, + [2540] = 0x50D5, [2541] = 0x535C, [2542] = 0x58A8, [2543] = 0x64B2, + [2544] = 0x6734, [2545] = 0x7267, [2546] = 0x7766, [2547] = 0x7A46, + [2548] = 0x91E6, [2549] = 0x52C3, [2550] = 0x6CA1, [2551] = 0x6B86, + [2552] = 0x5800, [2553] = 0x5E4C, [2554] = 0x5954, [2555] = 0x672C, + [2556] = 0x7FFB, [2557] = 0x51E1, [2558] = 0x76C6, [2560] = 0x6469, + [2561] = 0x78E8, [2562] = 0x9B54, [2563] = 0x9EBB, [2564] = 0x57CB, + [2565] = 0x59B9, [2566] = 0x6627, [2567] = 0x679A, [2568] = 0x6BCE, + [2569] = 0x54E9, [2570] = 0x69D9, [2571] = 0x5E55, [2572] = 0x819C, + [2573] = 0x6795, [2574] = 0x9BAA, [2575] = 0x67FE, [2576] = 0x9C52, + [2577] = 0x685D, [2578] = 0x4EA6, [2579] = 0x4FE3, [2580] = 0x53C8, + [2581] = 0x62B9, [2582] = 0x672B, [2583] = 0x6CAB, [2584] = 0x8FC4, + [2585] = 0x4FAD, [2586] = 0x7E6D, [2587] = 0x9EBF, [2588] = 0x4E07, + [2589] = 0x6162, [2590] = 0x6E80, [2591] = 0x6F2B, [2592] = 0x8513, + [2593] = 0x5473, [2594] = 0x672A, [2595] = 0x9B45, [2596] = 0x5DF3, + [2597] = 0x7B95, [2598] = 0x5CAC, [2599] = 0x5BC6, [2600] = 0x871C, + [2601] = 0x6E4A, [2602] = 0x84D1, [2603] = 0x7A14, [2604] = 0x8108, + [2605] = 0x5999, [2606] = 0x7C8D, [2607] = 0x6C11, [2608] = 0x7720, + [2609] = 0x52D9, [2610] = 0x5922, [2611] = 0x7121, [2612] = 0x725F, + [2613] = 0x77DB, [2614] = 0x9727, [2615] = 0x9D61, [2616] = 0x690B, + [2617] = 0x5A7F, [2618] = 0x5A18, [2619] = 0x51A5, [2620] = 0x540D, + [2621] = 0x547D, [2622] = 0x660E, [2623] = 0x76DF, [2624] = 0x8FF7, + [2625] = 0x9298, [2626] = 0x9CF4, [2627] = 0x59EA, [2628] = 0x725D, + [2629] = 0x6EC5, [2630] = 0x514D, [2631] = 0x68C9, [2632] = 0x7DBF, + [2633] = 0x7DEC, [2634] = 0x9762, [2635] = 0x9EBA, [2636] = 0x6478, + [2637] = 0x6A21, [2638] = 0x8302, [2639] = 0x5984, [2640] = 0x5B5F, + [2641] = 0x6BDB, [2642] = 0x731B, [2643] = 0x76F2, [2644] = 0x7DB2, + [2645] = 0x8017, [2646] = 0x8499, [2647] = 0x5132, [2648] = 0x6728, + [2649] = 0x9ED9, [2650] = 0x76EE, [2651] = 0x6762, [2652] = 0x52FF, + [2653] = 0x9905, [2654] = 0x5C24, [2655] = 0x623B, [2656] = 0x7C7E, + [2657] = 0x8CB0, [2658] = 0x554F, [2659] = 0x60B6, [2660] = 0x7D0B, + [2661] = 0x9580, [2662] = 0x5301, [2663] = 0x4E5F, [2664] = 0x51B6, + [2665] = 0x591C, [2666] = 0x723A, [2667] = 0x8036, [2668] = 0x91CE, + [2669] = 0x5F25, [2670] = 0x77E2, [2671] = 0x5384, [2672] = 0x5F79, + [2673] = 0x7D04, [2674] = 0x85AC, [2675] = 0x8A33, [2676] = 0x8E8D, + [2677] = 0x9756, [2678] = 0x67F3, [2679] = 0x85AE, [2680] = 0x9453, + [2681] = 0x6109, [2682] = 0x6108, [2683] = 0x6CB9, [2684] = 0x7652, + [2688] = 0x8AED, [2689] = 0x8F38, [2690] = 0x552F, [2691] = 0x4F51, + [2692] = 0x512A, [2693] = 0x52C7, [2694] = 0x53CB, [2695] = 0x5BA5, + [2696] = 0x5E7D, [2697] = 0x60A0, [2698] = 0x6182, [2699] = 0x63D6, + [2700] = 0x6709, [2701] = 0x67DA, [2702] = 0x6E67, [2703] = 0x6D8C, + [2704] = 0x7336, [2705] = 0x7337, [2706] = 0x7531, [2707] = 0x7950, + [2708] = 0x88D5, [2709] = 0x8A98, [2710] = 0x904A, [2711] = 0x9091, + [2712] = 0x90F5, [2713] = 0x96C4, [2714] = 0x878D, [2715] = 0x5915, + [2716] = 0x4E88, [2717] = 0x4F59, [2718] = 0x4E0E, [2719] = 0x8A89, + [2720] = 0x8F3F, [2721] = 0x9810, [2722] = 0x50AD, [2723] = 0x5E7C, + [2724] = 0x5996, [2725] = 0x5BB9, [2726] = 0x5EB8, [2727] = 0x63DA, + [2728] = 0x63FA, [2729] = 0x64C1, [2730] = 0x66DC, [2731] = 0x694A, + [2732] = 0x69D8, [2733] = 0x6D0B, [2734] = 0x6EB6, [2735] = 0x7194, + [2736] = 0x7528, [2737] = 0x7AAF, [2738] = 0x7F8A, [2739] = 0x8000, + [2740] = 0x8449, [2741] = 0x84C9, [2742] = 0x8981, [2743] = 0x8B21, + [2744] = 0x8E0A, [2745] = 0x9065, [2746] = 0x967D, [2747] = 0x990A, + [2748] = 0x617E, [2749] = 0x6291, [2750] = 0x6B32, [2752] = 0x6C83, + [2753] = 0x6D74, [2754] = 0x7FCC, [2755] = 0x7FFC, [2756] = 0x6DC0, + [2757] = 0x7F85, [2758] = 0x87BA, [2759] = 0x88F8, [2760] = 0x6765, + [2761] = 0x83B1, [2762] = 0x983C, [2763] = 0x96F7, [2764] = 0x6D1B, + [2765] = 0x7D61, [2766] = 0x843D, [2767] = 0x916A, [2768] = 0x4E71, + [2769] = 0x5375, [2770] = 0x5D50, [2771] = 0x6B04, [2772] = 0x6FEB, + [2773] = 0x85CD, [2774] = 0x862D, [2775] = 0x89A7, [2776] = 0x5229, + [2777] = 0x540F, [2778] = 0x5C65, [2779] = 0x674E, [2780] = 0x68A8, + [2781] = 0x7406, [2782] = 0x7483, [2783] = 0x75E2, [2784] = 0x88CF, + [2785] = 0x88E1, [2786] = 0x91CC, [2787] = 0x96E2, [2788] = 0x9678, + [2789] = 0x5F8B, [2790] = 0x7387, [2791] = 0x7ACB, [2792] = 0x844E, + [2793] = 0x63A0, [2794] = 0x7565, [2795] = 0x5289, [2796] = 0x6D41, + [2797] = 0x6E9C, [2798] = 0x7409, [2799] = 0x7559, [2800] = 0x786B, + [2801] = 0x7C92, [2802] = 0x9686, [2803] = 0x7ADC, [2804] = 0x9F8D, + [2805] = 0x4FB6, [2806] = 0x616E, [2807] = 0x65C5, [2808] = 0x865C, + [2809] = 0x4E86, [2810] = 0x4EAE, [2811] = 0x50DA, [2812] = 0x4E21, + [2813] = 0x51CC, [2814] = 0x5BEE, [2815] = 0x6599, [2816] = 0x6881, + [2817] = 0x6DBC, [2818] = 0x731F, [2819] = 0x7642, [2820] = 0x77AD, + [2821] = 0x7A1C, [2822] = 0x7CE7, [2823] = 0x826F, [2824] = 0x8AD2, + [2825] = 0x907C, [2826] = 0x91CF, [2827] = 0x9675, [2828] = 0x9818, + [2829] = 0x529B, [2830] = 0x7DD1, [2831] = 0x502B, [2832] = 0x5398, + [2833] = 0x6797, [2834] = 0x6DCB, [2835] = 0x71D0, [2836] = 0x7433, + [2837] = 0x81E8, [2838] = 0x8F2A, [2839] = 0x96A3, [2840] = 0x9C57, + [2841] = 0x9E9F, [2842] = 0x7460, [2843] = 0x5841, [2844] = 0x6D99, + [2845] = 0x7D2F, [2846] = 0x985E, [2847] = 0x4EE4, [2848] = 0x4F36, + [2849] = 0x4F8B, [2850] = 0x51B7, [2851] = 0x52B1, [2852] = 0x5DBA, + [2853] = 0x601C, [2854] = 0x73B2, [2855] = 0x793C, [2856] = 0x82D3, + [2857] = 0x9234, [2858] = 0x96B7, [2859] = 0x96F6, [2860] = 0x970A, + [2861] = 0x9E97, [2862] = 0x9F62, [2863] = 0x66A6, [2864] = 0x6B74, + [2865] = 0x5217, [2866] = 0x52A3, [2867] = 0x70C8, [2868] = 0x88C2, + [2869] = 0x5EC9, [2870] = 0x604B, [2871] = 0x6190, [2872] = 0x6F23, + [2873] = 0x7149, [2874] = 0x7C3E, [2875] = 0x7DF4, [2876] = 0x806F, + [2880] = 0x84EE, [2881] = 0x9023, [2882] = 0x932C, [2883] = 0x5442, + [2884] = 0x9B6F, [2885] = 0x6AD3, [2886] = 0x7089, [2887] = 0x8CC2, + [2888] = 0x8DEF, [2889] = 0x9732, [2890] = 0x52B4, [2891] = 0x5A41, + [2892] = 0x5ECA, [2893] = 0x5F04, [2894] = 0x6717, [2895] = 0x697C, + [2896] = 0x6994, [2897] = 0x6D6A, [2898] = 0x6F0F, [2899] = 0x7262, + [2900] = 0x72FC, [2901] = 0x7BED, [2902] = 0x8001, [2903] = 0x807E, + [2904] = 0x874B, [2905] = 0x90CE, [2906] = 0x516D, [2907] = 0x9E93, + [2908] = 0x7984, [2909] = 0x808B, [2910] = 0x9332, [2911] = 0x8AD6, + [2912] = 0x502D, [2913] = 0x548C, [2914] = 0x8A71, [2915] = 0x6B6A, + [2916] = 0x8CC4, [2917] = 0x8107, [2918] = 0x60D1, [2919] = 0x67A0, + [2920] = 0x9DF2, [2921] = 0x4E99, [2922] = 0x4E98, [2923] = 0x9C10, + [2924] = 0x8A6B, [2925] = 0x85C1, [2926] = 0x8568, [2927] = 0x6900, + [2928] = 0x6E7E, [2929] = 0x7897, [2930] = 0x8155, [2975] = 0x5F0C, + [2976] = 0x4E10, [2977] = 0x4E15, [2978] = 0x4E2A, [2979] = 0x4E31, + [2980] = 0x4E36, [2981] = 0x4E3C, [2982] = 0x4E3F, [2983] = 0x4E42, + [2984] = 0x4E56, [2985] = 0x4E58, [2986] = 0x4E82, [2987] = 0x4E85, + [2988] = 0x8C6B, [2989] = 0x4E8A, [2990] = 0x8212, [2991] = 0x5F0D, + [2992] = 0x4E8E, [2993] = 0x4E9E, [2994] = 0x4E9F, [2995] = 0x4EA0, + [2996] = 0x4EA2, [2997] = 0x4EB0, [2998] = 0x4EB3, [2999] = 0x4EB6, + [3000] = 0x4ECE, [3001] = 0x4ECD, [3002] = 0x4EC4, [3003] = 0x4EC6, + [3004] = 0x4EC2, [3005] = 0x4ED7, [3006] = 0x4EDE, [3007] = 0x4EED, + [3008] = 0x4EDF, [3009] = 0x4EF7, [3010] = 0x4F09, [3011] = 0x4F5A, + [3012] = 0x4F30, [3013] = 0x4F5B, [3014] = 0x4F5D, [3015] = 0x4F57, + [3016] = 0x4F47, [3017] = 0x4F76, [3018] = 0x4F88, [3019] = 0x4F8F, + [3020] = 0x4F98, [3021] = 0x4F7B, [3022] = 0x4F69, [3023] = 0x4F70, + [3024] = 0x4F91, [3025] = 0x4F6F, [3026] = 0x4F86, [3027] = 0x4F96, + [3028] = 0x5118, [3029] = 0x4FD4, [3030] = 0x4FDF, [3031] = 0x4FCE, + [3032] = 0x4FD8, [3033] = 0x4FDB, [3034] = 0x4FD1, [3035] = 0x4FDA, + [3036] = 0x4FD0, [3037] = 0x4FE4, [3038] = 0x4FE5, [3039] = 0x501A, + [3040] = 0x5028, [3041] = 0x5014, [3042] = 0x502A, [3043] = 0x5025, + [3044] = 0x5005, [3045] = 0x4F1C, [3046] = 0x4FF6, [3047] = 0x5021, + [3048] = 0x5029, [3049] = 0x502C, [3050] = 0x4FFE, [3051] = 0x4FEF, + [3052] = 0x5011, [3053] = 0x5006, [3054] = 0x5043, [3055] = 0x5047, + [3056] = 0x6703, [3057] = 0x5055, [3058] = 0x5050, [3059] = 0x5048, + [3060] = 0x505A, [3061] = 0x5056, [3062] = 0x506C, [3063] = 0x5078, + [3064] = 0x5080, [3065] = 0x509A, [3066] = 0x5085, [3067] = 0x50B4, + [3068] = 0x50B2, [3072] = 0x50C9, [3073] = 0x50CA, [3074] = 0x50B3, + [3075] = 0x50C2, [3076] = 0x50D6, [3077] = 0x50DE, [3078] = 0x50E5, + [3079] = 0x50ED, [3080] = 0x50E3, [3081] = 0x50EE, [3082] = 0x50F9, + [3083] = 0x50F5, [3084] = 0x5109, [3085] = 0x5101, [3086] = 0x5102, + [3087] = 0x5116, [3088] = 0x5115, [3089] = 0x5114, [3090] = 0x511A, + [3091] = 0x5121, [3092] = 0x513A, [3093] = 0x5137, [3094] = 0x513C, + [3095] = 0x513B, [3096] = 0x513F, [3097] = 0x5140, [3098] = 0x5152, + [3099] = 0x514C, [3100] = 0x5154, [3101] = 0x5162, [3102] = 0x7AF8, + [3103] = 0x5169, [3104] = 0x516A, [3105] = 0x516E, [3106] = 0x5180, + [3107] = 0x5182, [3108] = 0x56D8, [3109] = 0x518C, [3110] = 0x5189, + [3111] = 0x518F, [3112] = 0x5191, [3113] = 0x5193, [3114] = 0x5195, + [3115] = 0x5196, [3116] = 0x51A4, [3117] = 0x51A6, [3118] = 0x51A2, + [3119] = 0x51A9, [3120] = 0x51AA, [3121] = 0x51AB, [3122] = 0x51B3, + [3123] = 0x51B1, [3124] = 0x51B2, [3125] = 0x51B0, [3126] = 0x51B5, + [3127] = 0x51BD, [3128] = 0x51C5, [3129] = 0x51C9, [3130] = 0x51DB, + [3131] = 0x51E0, [3132] = 0x8655, [3133] = 0x51E9, [3134] = 0x51ED, + [3136] = 0x51F0, [3137] = 0x51F5, [3138] = 0x51FE, [3139] = 0x5204, + [3140] = 0x520B, [3141] = 0x5214, [3142] = 0x520E, [3143] = 0x5227, + [3144] = 0x522A, [3145] = 0x522E, [3146] = 0x5233, [3147] = 0x5239, + [3148] = 0x524F, [3149] = 0x5244, [3150] = 0x524B, [3151] = 0x524C, + [3152] = 0x525E, [3153] = 0x5254, [3154] = 0x526A, [3155] = 0x5274, + [3156] = 0x5269, [3157] = 0x5273, [3158] = 0x527F, [3159] = 0x527D, + [3160] = 0x528D, [3161] = 0x5294, [3162] = 0x5292, [3163] = 0x5271, + [3164] = 0x5288, [3165] = 0x5291, [3166] = 0x8FA8, [3167] = 0x8FA7, + [3168] = 0x52AC, [3169] = 0x52AD, [3170] = 0x52BC, [3171] = 0x52B5, + [3172] = 0x52C1, [3173] = 0x52CD, [3174] = 0x52D7, [3175] = 0x52DE, + [3176] = 0x52E3, [3177] = 0x52E6, [3178] = 0x98ED, [3179] = 0x52E0, + [3180] = 0x52F3, [3181] = 0x52F5, [3182] = 0x52F8, [3183] = 0x52F9, + [3184] = 0x5306, [3185] = 0x5308, [3186] = 0x7538, [3187] = 0x530D, + [3188] = 0x5310, [3189] = 0x530F, [3190] = 0x5315, [3191] = 0x531A, + [3192] = 0x5323, [3193] = 0x532F, [3194] = 0x5331, [3195] = 0x5333, + [3196] = 0x5338, [3197] = 0x5340, [3198] = 0x5346, [3199] = 0x5345, + [3200] = 0x4E17, [3201] = 0x5349, [3202] = 0x534D, [3203] = 0x51D6, + [3204] = 0x535E, [3205] = 0x5369, [3206] = 0x536E, [3207] = 0x5918, + [3208] = 0x537B, [3209] = 0x5377, [3210] = 0x5382, [3211] = 0x5396, + [3212] = 0x53A0, [3213] = 0x53A6, [3214] = 0x53A5, [3215] = 0x53AE, + [3216] = 0x53B0, [3217] = 0x53B6, [3218] = 0x53C3, [3219] = 0x7C12, + [3220] = 0x96D9, [3221] = 0x53DF, [3222] = 0x66FC, [3223] = 0x71EE, + [3224] = 0x53EE, [3225] = 0x53E8, [3226] = 0x53ED, [3227] = 0x53FA, + [3228] = 0x5401, [3229] = 0x543D, [3230] = 0x5440, [3231] = 0x542C, + [3232] = 0x542D, [3233] = 0x543C, [3234] = 0x542E, [3235] = 0x5436, + [3236] = 0x5429, [3237] = 0x541D, [3238] = 0x544E, [3239] = 0x548F, + [3240] = 0x5475, [3241] = 0x548E, [3242] = 0x545F, [3243] = 0x5471, + [3244] = 0x5477, [3245] = 0x5470, [3246] = 0x5492, [3247] = 0x547B, + [3248] = 0x5480, [3249] = 0x5476, [3250] = 0x5484, [3251] = 0x5490, + [3252] = 0x5486, [3253] = 0x54C7, [3254] = 0x54A2, [3255] = 0x54B8, + [3256] = 0x54A5, [3257] = 0x54AC, [3258] = 0x54C4, [3259] = 0x54C8, + [3260] = 0x54A8, [3264] = 0x54AB, [3265] = 0x54C2, [3266] = 0x54A4, + [3267] = 0x54BE, [3268] = 0x54BC, [3269] = 0x54D8, [3270] = 0x54E5, + [3271] = 0x54E6, [3272] = 0x550F, [3273] = 0x5514, [3274] = 0x54FD, + [3275] = 0x54EE, [3276] = 0x54ED, [3277] = 0x54FA, [3278] = 0x54E2, + [3279] = 0x5539, [3280] = 0x5540, [3281] = 0x5563, [3282] = 0x554C, + [3283] = 0x552E, [3284] = 0x555C, [3285] = 0x5545, [3286] = 0x5556, + [3287] = 0x5557, [3288] = 0x5538, [3289] = 0x5533, [3290] = 0x555D, + [3291] = 0x5599, [3292] = 0x5580, [3293] = 0x54AF, [3294] = 0x558A, + [3295] = 0x559F, [3296] = 0x557B, [3297] = 0x557E, [3298] = 0x5598, + [3299] = 0x559E, [3300] = 0x55AE, [3301] = 0x557C, [3302] = 0x5583, + [3303] = 0x55A9, [3304] = 0x5587, [3305] = 0x55A8, [3306] = 0x55DA, + [3307] = 0x55C5, [3308] = 0x55DF, [3309] = 0x55C4, [3310] = 0x55DC, + [3311] = 0x55E4, [3312] = 0x55D4, [3313] = 0x5614, [3314] = 0x55F7, + [3315] = 0x5616, [3316] = 0x55FE, [3317] = 0x55FD, [3318] = 0x561B, + [3319] = 0x55F9, [3320] = 0x564E, [3321] = 0x5650, [3322] = 0x71DF, + [3323] = 0x5634, [3324] = 0x5636, [3325] = 0x5632, [3326] = 0x5638, + [3328] = 0x566B, [3329] = 0x5664, [3330] = 0x562F, [3331] = 0x566C, + [3332] = 0x566A, [3333] = 0x5686, [3334] = 0x5680, [3335] = 0x568A, + [3336] = 0x56A0, [3337] = 0x5694, [3338] = 0x568F, [3339] = 0x56A5, + [3340] = 0x56AE, [3341] = 0x56B6, [3342] = 0x56B4, [3343] = 0x56C2, + [3344] = 0x56BC, [3345] = 0x56C1, [3346] = 0x56C3, [3347] = 0x56C0, + [3348] = 0x56C8, [3349] = 0x56CE, [3350] = 0x56D1, [3351] = 0x56D3, + [3352] = 0x56D7, [3353] = 0x56EE, [3354] = 0x56F9, [3355] = 0x5700, + [3356] = 0x56FF, [3357] = 0x5704, [3358] = 0x5709, [3359] = 0x5708, + [3360] = 0x570B, [3361] = 0x570D, [3362] = 0x5713, [3363] = 0x5718, + [3364] = 0x5716, [3365] = 0x55C7, [3366] = 0x571C, [3367] = 0x5726, + [3368] = 0x5737, [3369] = 0x5738, [3370] = 0x574E, [3371] = 0x573B, + [3372] = 0x5740, [3373] = 0x574F, [3374] = 0x5769, [3375] = 0x57C0, + [3376] = 0x5788, [3377] = 0x5761, [3378] = 0x577F, [3379] = 0x5789, + [3380] = 0x5793, [3381] = 0x57A0, [3382] = 0x57B3, [3383] = 0x57A4, + [3384] = 0x57AA, [3385] = 0x57B0, [3386] = 0x57C3, [3387] = 0x57C6, + [3388] = 0x57D4, [3389] = 0x57D2, [3390] = 0x57D3, [3391] = 0x580A, + [3392] = 0x57D6, [3393] = 0x57E3, [3394] = 0x580B, [3395] = 0x5819, + [3396] = 0x581D, [3397] = 0x5872, [3398] = 0x5821, [3399] = 0x5862, + [3400] = 0x584B, [3401] = 0x5870, [3402] = 0x6BC0, [3403] = 0x5852, + [3404] = 0x583D, [3405] = 0x5879, [3406] = 0x5885, [3407] = 0x58B9, + [3408] = 0x589F, [3409] = 0x58AB, [3410] = 0x58BA, [3411] = 0x58DE, + [3412] = 0x58BB, [3413] = 0x58B8, [3414] = 0x58AE, [3415] = 0x58C5, + [3416] = 0x58D3, [3417] = 0x58D1, [3418] = 0x58D7, [3419] = 0x58D9, + [3420] = 0x58D8, [3421] = 0x58E5, [3422] = 0x58DC, [3423] = 0x58E4, + [3424] = 0x58DF, [3425] = 0x58EF, [3426] = 0x58FA, [3427] = 0x58F9, + [3428] = 0x58FB, [3429] = 0x58FC, [3430] = 0x58FD, [3431] = 0x5902, + [3432] = 0x590A, [3433] = 0x5910, [3434] = 0x591B, [3435] = 0x68A6, + [3436] = 0x5925, [3437] = 0x592C, [3438] = 0x592D, [3439] = 0x5932, + [3440] = 0x5938, [3441] = 0x593E, [3442] = 0x7AD2, [3443] = 0x5955, + [3444] = 0x5950, [3445] = 0x594E, [3446] = 0x595A, [3447] = 0x5958, + [3448] = 0x5962, [3449] = 0x5960, [3450] = 0x5967, [3451] = 0x596C, + [3452] = 0x5969, [3456] = 0x5978, [3457] = 0x5981, [3458] = 0x599D, + [3459] = 0x4F5E, [3460] = 0x4FAB, [3461] = 0x59A3, [3462] = 0x59B2, + [3463] = 0x59C6, [3464] = 0x59E8, [3465] = 0x59DC, [3466] = 0x598D, + [3467] = 0x59D9, [3468] = 0x59DA, [3469] = 0x5A25, [3470] = 0x5A1F, + [3471] = 0x5A11, [3472] = 0x5A1C, [3473] = 0x5A09, [3474] = 0x5A1A, + [3475] = 0x5A40, [3476] = 0x5A6C, [3477] = 0x5A49, [3478] = 0x5A35, + [3479] = 0x5A36, [3480] = 0x5A62, [3481] = 0x5A6A, [3482] = 0x5A9A, + [3483] = 0x5ABC, [3484] = 0x5ABE, [3485] = 0x5ACB, [3486] = 0x5AC2, + [3487] = 0x5ABD, [3488] = 0x5AE3, [3489] = 0x5AD7, [3490] = 0x5AE6, + [3491] = 0x5AE9, [3492] = 0x5AD6, [3493] = 0x5AFA, [3494] = 0x5AFB, + [3495] = 0x5B0C, [3496] = 0x5B0B, [3497] = 0x5B16, [3498] = 0x5B32, + [3499] = 0x5AD0, [3500] = 0x5B2A, [3501] = 0x5B36, [3502] = 0x5B3E, + [3503] = 0x5B43, [3504] = 0x5B45, [3505] = 0x5B40, [3506] = 0x5B51, + [3507] = 0x5B55, [3508] = 0x5B5A, [3509] = 0x5B5B, [3510] = 0x5B65, + [3511] = 0x5B69, [3512] = 0x5B70, [3513] = 0x5B73, [3514] = 0x5B75, + [3515] = 0x5B78, [3516] = 0x6588, [3517] = 0x5B7A, [3518] = 0x5B80, + [3520] = 0x5B83, [3521] = 0x5BA6, [3522] = 0x5BB8, [3523] = 0x5BC3, + [3524] = 0x5BC7, [3525] = 0x5BC9, [3526] = 0x5BD4, [3527] = 0x5BD0, + [3528] = 0x5BE4, [3529] = 0x5BE6, [3530] = 0x5BE2, [3531] = 0x5BDE, + [3532] = 0x5BE5, [3533] = 0x5BEB, [3534] = 0x5BF0, [3535] = 0x5BF6, + [3536] = 0x5BF3, [3537] = 0x5C05, [3538] = 0x5C07, [3539] = 0x5C08, + [3540] = 0x5C0D, [3541] = 0x5C13, [3542] = 0x5C20, [3543] = 0x5C22, + [3544] = 0x5C28, [3545] = 0x5C38, [3546] = 0x5C39, [3547] = 0x5C41, + [3548] = 0x5C46, [3549] = 0x5C4E, [3550] = 0x5C53, [3551] = 0x5C50, + [3552] = 0x5C4F, [3553] = 0x5B71, [3554] = 0x5C6C, [3555] = 0x5C6E, + [3556] = 0x4E62, [3557] = 0x5C76, [3558] = 0x5C79, [3559] = 0x5C8C, + [3560] = 0x5C91, [3561] = 0x5C94, [3562] = 0x599B, [3563] = 0x5CAB, + [3564] = 0x5CBB, [3565] = 0x5CB6, [3566] = 0x5CBC, [3567] = 0x5CB7, + [3568] = 0x5CC5, [3569] = 0x5CBE, [3570] = 0x5CC7, [3571] = 0x5CD9, + [3572] = 0x5CE9, [3573] = 0x5CFD, [3574] = 0x5CFA, [3575] = 0x5CED, + [3576] = 0x5D8C, [3577] = 0x5CEA, [3578] = 0x5D0B, [3579] = 0x5D15, + [3580] = 0x5D17, [3581] = 0x5D5C, [3582] = 0x5D1F, [3583] = 0x5D1B, + [3584] = 0x5D11, [3585] = 0x5D14, [3586] = 0x5D22, [3587] = 0x5D1A, + [3588] = 0x5D19, [3589] = 0x5D18, [3590] = 0x5D4C, [3591] = 0x5D52, + [3592] = 0x5D4E, [3593] = 0x5D4B, [3594] = 0x5D6C, [3595] = 0x5D73, + [3596] = 0x5D76, [3597] = 0x5D87, [3598] = 0x5D84, [3599] = 0x5D82, + [3600] = 0x5DA2, [3601] = 0x5D9D, [3602] = 0x5DAC, [3603] = 0x5DAE, + [3604] = 0x5DBD, [3605] = 0x5D90, [3606] = 0x5DB7, [3607] = 0x5DBC, + [3608] = 0x5DC9, [3609] = 0x5DCD, [3610] = 0x5DD3, [3611] = 0x5DD2, + [3612] = 0x5DD6, [3613] = 0x5DDB, [3614] = 0x5DEB, [3615] = 0x5DF2, + [3616] = 0x5DF5, [3617] = 0x5E0B, [3618] = 0x5E1A, [3619] = 0x5E19, + [3620] = 0x5E11, [3621] = 0x5E1B, [3622] = 0x5E36, [3623] = 0x5E37, + [3624] = 0x5E44, [3625] = 0x5E43, [3626] = 0x5E40, [3627] = 0x5E4E, + [3628] = 0x5E57, [3629] = 0x5E54, [3630] = 0x5E5F, [3631] = 0x5E62, + [3632] = 0x5E64, [3633] = 0x5E47, [3634] = 0x5E75, [3635] = 0x5E76, + [3636] = 0x5E7A, [3637] = 0x9EBC, [3638] = 0x5E7F, [3639] = 0x5EA0, + [3640] = 0x5EC1, [3641] = 0x5EC2, [3642] = 0x5EC8, [3643] = 0x5ED0, + [3644] = 0x5ECF, [3648] = 0x5ED6, [3649] = 0x5EE3, [3650] = 0x5EDD, + [3651] = 0x5EDA, [3652] = 0x5EDB, [3653] = 0x5EE2, [3654] = 0x5EE1, + [3655] = 0x5EE8, [3656] = 0x5EE9, [3657] = 0x5EEC, [3658] = 0x5EF1, + [3659] = 0x5EF3, [3660] = 0x5EF0, [3661] = 0x5EF4, [3662] = 0x5EF8, + [3663] = 0x5EFE, [3664] = 0x5F03, [3665] = 0x5F09, [3666] = 0x5F5D, + [3667] = 0x5F5C, [3668] = 0x5F0B, [3669] = 0x5F11, [3670] = 0x5F16, + [3671] = 0x5F29, [3672] = 0x5F2D, [3673] = 0x5F38, [3674] = 0x5F41, + [3675] = 0x5F48, [3676] = 0x5F4C, [3677] = 0x5F4E, [3678] = 0x5F2F, + [3679] = 0x5F51, [3680] = 0x5F56, [3681] = 0x5F57, [3682] = 0x5F59, + [3683] = 0x5F61, [3684] = 0x5F6D, [3685] = 0x5F73, [3686] = 0x5F77, + [3687] = 0x5F83, [3688] = 0x5F82, [3689] = 0x5F7F, [3690] = 0x5F8A, + [3691] = 0x5F88, [3692] = 0x5F91, [3693] = 0x5F87, [3694] = 0x5F9E, + [3695] = 0x5F99, [3696] = 0x5F98, [3697] = 0x5FA0, [3698] = 0x5FA8, + [3699] = 0x5FAD, [3700] = 0x5FBC, [3701] = 0x5FD6, [3702] = 0x5FFB, + [3703] = 0x5FE4, [3704] = 0x5FF8, [3705] = 0x5FF1, [3706] = 0x5FDD, + [3707] = 0x60B3, [3708] = 0x5FFF, [3709] = 0x6021, [3710] = 0x6060, + [3712] = 0x6019, [3713] = 0x6010, [3714] = 0x6029, [3715] = 0x600E, + [3716] = 0x6031, [3717] = 0x601B, [3718] = 0x6015, [3719] = 0x602B, + [3720] = 0x6026, [3721] = 0x600F, [3722] = 0x603A, [3723] = 0x605A, + [3724] = 0x6041, [3725] = 0x606A, [3726] = 0x6077, [3727] = 0x605F, + [3728] = 0x604A, [3729] = 0x6046, [3730] = 0x604D, [3731] = 0x6063, + [3732] = 0x6043, [3733] = 0x6064, [3734] = 0x6042, [3735] = 0x606C, + [3736] = 0x606B, [3737] = 0x6059, [3738] = 0x6081, [3739] = 0x608D, + [3740] = 0x60E7, [3741] = 0x6083, [3742] = 0x609A, [3743] = 0x6084, + [3744] = 0x609B, [3745] = 0x6096, [3746] = 0x6097, [3747] = 0x6092, + [3748] = 0x60A7, [3749] = 0x608B, [3750] = 0x60E1, [3751] = 0x60B8, + [3752] = 0x60E0, [3753] = 0x60D3, [3754] = 0x60B4, [3755] = 0x5FF0, + [3756] = 0x60BD, [3757] = 0x60C6, [3758] = 0x60B5, [3759] = 0x60D8, + [3760] = 0x614D, [3761] = 0x6115, [3762] = 0x6106, [3763] = 0x60F6, + [3764] = 0x60F7, [3765] = 0x6100, [3766] = 0x60F4, [3767] = 0x60FA, + [3768] = 0x6103, [3769] = 0x6121, [3770] = 0x60FB, [3771] = 0x60F1, + [3772] = 0x610D, [3773] = 0x610E, [3774] = 0x6147, [3775] = 0x613E, + [3776] = 0x6128, [3777] = 0x6127, [3778] = 0x614A, [3779] = 0x613F, + [3780] = 0x613C, [3781] = 0x612C, [3782] = 0x6134, [3783] = 0x613D, + [3784] = 0x6142, [3785] = 0x6144, [3786] = 0x6173, [3787] = 0x6177, + [3788] = 0x6158, [3789] = 0x6159, [3790] = 0x615A, [3791] = 0x616B, + [3792] = 0x6174, [3793] = 0x616F, [3794] = 0x6165, [3795] = 0x6171, + [3796] = 0x615F, [3797] = 0x615D, [3798] = 0x6153, [3799] = 0x6175, + [3800] = 0x6199, [3801] = 0x6196, [3802] = 0x6187, [3803] = 0x61AC, + [3804] = 0x6194, [3805] = 0x619A, [3806] = 0x618A, [3807] = 0x6191, + [3808] = 0x61AB, [3809] = 0x61AE, [3810] = 0x61CC, [3811] = 0x61CA, + [3812] = 0x61C9, [3813] = 0x61F7, [3814] = 0x61C8, [3815] = 0x61C3, + [3816] = 0x61C6, [3817] = 0x61BA, [3818] = 0x61CB, [3819] = 0x7F79, + [3820] = 0x61CD, [3821] = 0x61E6, [3822] = 0x61E3, [3823] = 0x61F6, + [3824] = 0x61FA, [3825] = 0x61F4, [3826] = 0x61FF, [3827] = 0x61FD, + [3828] = 0x61FC, [3829] = 0x61FE, [3830] = 0x6200, [3831] = 0x6208, + [3832] = 0x6209, [3833] = 0x620D, [3834] = 0x620C, [3835] = 0x6214, + [3836] = 0x621B, [3840] = 0x621E, [3841] = 0x6221, [3842] = 0x622A, + [3843] = 0x622E, [3844] = 0x6230, [3845] = 0x6232, [3846] = 0x6233, + [3847] = 0x6241, [3848] = 0x624E, [3849] = 0x625E, [3850] = 0x6263, + [3851] = 0x625B, [3852] = 0x6260, [3853] = 0x6268, [3854] = 0x627C, + [3855] = 0x6282, [3856] = 0x6289, [3857] = 0x627E, [3858] = 0x6292, + [3859] = 0x6293, [3860] = 0x6296, [3861] = 0x62D4, [3862] = 0x6283, + [3863] = 0x6294, [3864] = 0x62D7, [3865] = 0x62D1, [3866] = 0x62BB, + [3867] = 0x62CF, [3868] = 0x62FF, [3869] = 0x62C6, [3870] = 0x64D4, + [3871] = 0x62C8, [3872] = 0x62DC, [3873] = 0x62CC, [3874] = 0x62CA, + [3875] = 0x62C2, [3876] = 0x62C7, [3877] = 0x629B, [3878] = 0x62C9, + [3879] = 0x630C, [3880] = 0x62EE, [3881] = 0x62F1, [3882] = 0x6327, + [3883] = 0x6302, [3884] = 0x6308, [3885] = 0x62EF, [3886] = 0x62F5, + [3887] = 0x6350, [3888] = 0x633E, [3889] = 0x634D, [3890] = 0x641C, + [3891] = 0x634F, [3892] = 0x6396, [3893] = 0x638E, [3894] = 0x6380, + [3895] = 0x63AB, [3896] = 0x6376, [3897] = 0x63A3, [3898] = 0x638F, + [3899] = 0x6389, [3900] = 0x639F, [3901] = 0x63B5, [3902] = 0x636B, + [3904] = 0x6369, [3905] = 0x63BE, [3906] = 0x63E9, [3907] = 0x63C0, + [3908] = 0x63C6, [3909] = 0x63E3, [3910] = 0x63C9, [3911] = 0x63D2, + [3912] = 0x63F6, [3913] = 0x63C4, [3914] = 0x6416, [3915] = 0x6434, + [3916] = 0x6406, [3917] = 0x6413, [3918] = 0x6426, [3919] = 0x6436, + [3920] = 0x651D, [3921] = 0x6417, [3922] = 0x6428, [3923] = 0x640F, + [3924] = 0x6467, [3925] = 0x646F, [3926] = 0x6476, [3927] = 0x644E, + [3928] = 0x652A, [3929] = 0x6495, [3930] = 0x6493, [3931] = 0x64A5, + [3932] = 0x64A9, [3933] = 0x6488, [3934] = 0x64BC, [3935] = 0x64DA, + [3936] = 0x64D2, [3937] = 0x64C5, [3938] = 0x64C7, [3939] = 0x64BB, + [3940] = 0x64D8, [3941] = 0x64C2, [3942] = 0x64F1, [3943] = 0x64E7, + [3944] = 0x8209, [3945] = 0x64E0, [3946] = 0x64E1, [3947] = 0x62AC, + [3948] = 0x64E3, [3949] = 0x64EF, [3950] = 0x652C, [3951] = 0x64F6, + [3952] = 0x64F4, [3953] = 0x64F2, [3954] = 0x64FA, [3955] = 0x6500, + [3956] = 0x64FD, [3957] = 0x6518, [3958] = 0x651C, [3959] = 0x6505, + [3960] = 0x6524, [3961] = 0x6523, [3962] = 0x652B, [3963] = 0x6534, + [3964] = 0x6535, [3965] = 0x6537, [3966] = 0x6536, [3967] = 0x6538, + [3968] = 0x754B, [3969] = 0x6548, [3970] = 0x6556, [3971] = 0x6555, + [3972] = 0x654D, [3973] = 0x6558, [3974] = 0x655E, [3975] = 0x655D, + [3976] = 0x6572, [3977] = 0x6578, [3978] = 0x6582, [3979] = 0x6583, + [3980] = 0x8B8A, [3981] = 0x659B, [3982] = 0x659F, [3983] = 0x65AB, + [3984] = 0x65B7, [3985] = 0x65C3, [3986] = 0x65C6, [3987] = 0x65C1, + [3988] = 0x65C4, [3989] = 0x65CC, [3990] = 0x65D2, [3991] = 0x65DB, + [3992] = 0x65D9, [3993] = 0x65E0, [3994] = 0x65E1, [3995] = 0x65F1, + [3996] = 0x6772, [3997] = 0x660A, [3998] = 0x6603, [3999] = 0x65FB, + [4000] = 0x6773, [4001] = 0x6635, [4002] = 0x6636, [4003] = 0x6634, + [4004] = 0x661C, [4005] = 0x664F, [4006] = 0x6644, [4007] = 0x6649, + [4008] = 0x6641, [4009] = 0x665E, [4010] = 0x665D, [4011] = 0x6664, + [4012] = 0x6667, [4013] = 0x6668, [4014] = 0x665F, [4015] = 0x6662, + [4016] = 0x6670, [4017] = 0x6683, [4018] = 0x6688, [4019] = 0x668E, + [4020] = 0x6689, [4021] = 0x6684, [4022] = 0x6698, [4023] = 0x669D, + [4024] = 0x66C1, [4025] = 0x66B9, [4026] = 0x66C9, [4027] = 0x66BE, + [4028] = 0x66BC, [4032] = 0x66C4, [4033] = 0x66B8, [4034] = 0x66D6, + [4035] = 0x66DA, [4036] = 0x66E0, [4037] = 0x663F, [4038] = 0x66E6, + [4039] = 0x66E9, [4040] = 0x66F0, [4041] = 0x66F5, [4042] = 0x66F7, + [4043] = 0x670F, [4044] = 0x6716, [4045] = 0x671E, [4046] = 0x6726, + [4047] = 0x6727, [4048] = 0x9738, [4049] = 0x672E, [4050] = 0x673F, + [4051] = 0x6736, [4052] = 0x6741, [4053] = 0x6738, [4054] = 0x6737, + [4055] = 0x6746, [4056] = 0x675E, [4057] = 0x6760, [4058] = 0x6759, + [4059] = 0x6763, [4060] = 0x6764, [4061] = 0x6789, [4062] = 0x6770, + [4063] = 0x67A9, [4064] = 0x677C, [4065] = 0x676A, [4066] = 0x678C, + [4067] = 0x678B, [4068] = 0x67A6, [4069] = 0x67A1, [4070] = 0x6785, + [4071] = 0x67B7, [4072] = 0x67EF, [4073] = 0x67B4, [4074] = 0x67EC, + [4075] = 0x67B3, [4076] = 0x67E9, [4077] = 0x67B8, [4078] = 0x67E4, + [4079] = 0x67DE, [4080] = 0x67DD, [4081] = 0x67E2, [4082] = 0x67EE, + [4083] = 0x67B9, [4084] = 0x67CE, [4085] = 0x67C6, [4086] = 0x67E7, + [4087] = 0x6A9C, [4088] = 0x681E, [4089] = 0x6846, [4090] = 0x6829, + [4091] = 0x6840, [4092] = 0x684D, [4093] = 0x6832, [4094] = 0x684E, + [4096] = 0x68B3, [4097] = 0x682B, [4098] = 0x6859, [4099] = 0x6863, + [4100] = 0x6877, [4101] = 0x687F, [4102] = 0x689F, [4103] = 0x688F, + [4104] = 0x68AD, [4105] = 0x6894, [4106] = 0x689D, [4107] = 0x689B, + [4108] = 0x6883, [4109] = 0x6AAE, [4110] = 0x68B9, [4111] = 0x6874, + [4112] = 0x68B5, [4113] = 0x68A0, [4114] = 0x68BA, [4115] = 0x690F, + [4116] = 0x688D, [4117] = 0x687E, [4118] = 0x6901, [4119] = 0x68CA, + [4120] = 0x6908, [4121] = 0x68D8, [4122] = 0x6922, [4123] = 0x6926, + [4124] = 0x68E1, [4125] = 0x690C, [4126] = 0x68CD, [4127] = 0x68D4, + [4128] = 0x68E7, [4129] = 0x68D5, [4130] = 0x6936, [4131] = 0x6912, + [4132] = 0x6904, [4133] = 0x68D7, [4134] = 0x68E3, [4135] = 0x6925, + [4136] = 0x68F9, [4137] = 0x68E0, [4138] = 0x68EF, [4139] = 0x6928, + [4140] = 0x692A, [4141] = 0x691A, [4142] = 0x6923, [4143] = 0x6921, + [4144] = 0x68C6, [4145] = 0x6979, [4146] = 0x6977, [4147] = 0x695C, + [4148] = 0x6978, [4149] = 0x696B, [4150] = 0x6954, [4151] = 0x697E, + [4152] = 0x696E, [4153] = 0x6939, [4154] = 0x6974, [4155] = 0x693D, + [4156] = 0x6959, [4157] = 0x6930, [4158] = 0x6961, [4159] = 0x695E, + [4160] = 0x695D, [4161] = 0x6981, [4162] = 0x696A, [4163] = 0x69B2, + [4164] = 0x69AE, [4165] = 0x69D0, [4166] = 0x69BF, [4167] = 0x69C1, + [4168] = 0x69D3, [4169] = 0x69BE, [4170] = 0x69CE, [4171] = 0x5BE8, + [4172] = 0x69CA, [4173] = 0x69DD, [4174] = 0x69BB, [4175] = 0x69C3, + [4176] = 0x69A7, [4177] = 0x6A2E, [4178] = 0x6991, [4179] = 0x69A0, + [4180] = 0x699C, [4181] = 0x6995, [4182] = 0x69B4, [4183] = 0x69DE, + [4184] = 0x69E8, [4185] = 0x6A02, [4186] = 0x6A1B, [4187] = 0x69FF, + [4188] = 0x6B0A, [4189] = 0x69F9, [4190] = 0x69F2, [4191] = 0x69E7, + [4192] = 0x6A05, [4193] = 0x69B1, [4194] = 0x6A1E, [4195] = 0x69ED, + [4196] = 0x6A14, [4197] = 0x69EB, [4198] = 0x6A0A, [4199] = 0x6A12, + [4200] = 0x6AC1, [4201] = 0x6A23, [4202] = 0x6A13, [4203] = 0x6A44, + [4204] = 0x6A0C, [4205] = 0x6A72, [4206] = 0x6A36, [4207] = 0x6A78, + [4208] = 0x6A47, [4209] = 0x6A62, [4210] = 0x6A59, [4211] = 0x6A66, + [4212] = 0x6A48, [4213] = 0x6A38, [4214] = 0x6A22, [4215] = 0x6A90, + [4216] = 0x6A8D, [4217] = 0x6AA0, [4218] = 0x6A84, [4219] = 0x6AA2, + [4220] = 0x6AA3, [4224] = 0x6A97, [4225] = 0x8617, [4226] = 0x6ABB, + [4227] = 0x6AC3, [4228] = 0x6AC2, [4229] = 0x6AB8, [4230] = 0x6AB3, + [4231] = 0x6AAC, [4232] = 0x6ADE, [4233] = 0x6AD1, [4234] = 0x6ADF, + [4235] = 0x6AAA, [4236] = 0x6ADA, [4237] = 0x6AEA, [4238] = 0x6AFB, + [4239] = 0x6B05, [4240] = 0x8616, [4241] = 0x6AFA, [4242] = 0x6B12, + [4243] = 0x6B16, [4244] = 0x9B31, [4245] = 0x6B1F, [4246] = 0x6B38, + [4247] = 0x6B37, [4248] = 0x76DC, [4249] = 0x6B39, [4250] = 0x98EE, + [4251] = 0x6B47, [4252] = 0x6B43, [4253] = 0x6B49, [4254] = 0x6B50, + [4255] = 0x6B59, [4256] = 0x6B54, [4257] = 0x6B5B, [4258] = 0x6B5F, + [4259] = 0x6B61, [4260] = 0x6B78, [4261] = 0x6B79, [4262] = 0x6B7F, + [4263] = 0x6B80, [4264] = 0x6B84, [4265] = 0x6B83, [4266] = 0x6B8D, + [4267] = 0x6B98, [4268] = 0x6B95, [4269] = 0x6B9E, [4270] = 0x6BA4, + [4271] = 0x6BAA, [4272] = 0x6BAB, [4273] = 0x6BAF, [4274] = 0x6BB2, + [4275] = 0x6BB1, [4276] = 0x6BB3, [4277] = 0x6BB7, [4278] = 0x6BBC, + [4279] = 0x6BC6, [4280] = 0x6BCB, [4281] = 0x6BD3, [4282] = 0x6BDF, + [4283] = 0x6BEC, [4284] = 0x6BEB, [4285] = 0x6BF3, [4286] = 0x6BEF, + [4288] = 0x9EBE, [4289] = 0x6C08, [4290] = 0x6C13, [4291] = 0x6C14, + [4292] = 0x6C1B, [4293] = 0x6C24, [4294] = 0x6C23, [4295] = 0x6C5E, + [4296] = 0x6C55, [4297] = 0x6C62, [4298] = 0x6C6A, [4299] = 0x6C82, + [4300] = 0x6C8D, [4301] = 0x6C9A, [4302] = 0x6C81, [4303] = 0x6C9B, + [4304] = 0x6C7E, [4305] = 0x6C68, [4306] = 0x6C73, [4307] = 0x6C92, + [4308] = 0x6C90, [4309] = 0x6CC4, [4310] = 0x6CF1, [4311] = 0x6CD3, + [4312] = 0x6CBD, [4313] = 0x6CD7, [4314] = 0x6CC5, [4315] = 0x6CDD, + [4316] = 0x6CAE, [4317] = 0x6CB1, [4318] = 0x6CBE, [4319] = 0x6CBA, + [4320] = 0x6CDB, [4321] = 0x6CEF, [4322] = 0x6CD9, [4323] = 0x6CEA, + [4324] = 0x6D1F, [4325] = 0x884D, [4326] = 0x6D36, [4327] = 0x6D2B, + [4328] = 0x6D3D, [4329] = 0x6D38, [4330] = 0x6D19, [4331] = 0x6D35, + [4332] = 0x6D33, [4333] = 0x6D12, [4334] = 0x6D0C, [4335] = 0x6D63, + [4336] = 0x6D93, [4337] = 0x6D64, [4338] = 0x6D5A, [4339] = 0x6D79, + [4340] = 0x6D59, [4341] = 0x6D8E, [4342] = 0x6D95, [4343] = 0x6FE4, + [4344] = 0x6D85, [4345] = 0x6DF9, [4346] = 0x6E15, [4347] = 0x6E0A, + [4348] = 0x6DB5, [4349] = 0x6DC7, [4350] = 0x6DE6, [4351] = 0x6DB8, + [4352] = 0x6DC6, [4353] = 0x6DEC, [4354] = 0x6DDE, [4355] = 0x6DCC, + [4356] = 0x6DE8, [4357] = 0x6DD2, [4358] = 0x6DC5, [4359] = 0x6DFA, + [4360] = 0x6DD9, [4361] = 0x6DE4, [4362] = 0x6DD5, [4363] = 0x6DEA, + [4364] = 0x6DEE, [4365] = 0x6E2D, [4366] = 0x6E6E, [4367] = 0x6E2E, + [4368] = 0x6E19, [4369] = 0x6E72, [4370] = 0x6E5F, [4371] = 0x6E3E, + [4372] = 0x6E23, [4373] = 0x6E6B, [4374] = 0x6E2B, [4375] = 0x6E76, + [4376] = 0x6E4D, [4377] = 0x6E1F, [4378] = 0x6E43, [4379] = 0x6E3A, + [4380] = 0x6E4E, [4381] = 0x6E24, [4382] = 0x6EFF, [4383] = 0x6E1D, + [4384] = 0x6E38, [4385] = 0x6E82, [4386] = 0x6EAA, [4387] = 0x6E98, + [4388] = 0x6EC9, [4389] = 0x6EB7, [4390] = 0x6ED3, [4391] = 0x6EBD, + [4392] = 0x6EAF, [4393] = 0x6EC4, [4394] = 0x6EB2, [4395] = 0x6ED4, + [4396] = 0x6ED5, [4397] = 0x6E8F, [4398] = 0x6EA5, [4399] = 0x6EC2, + [4400] = 0x6E9F, [4401] = 0x6F41, [4402] = 0x6F11, [4403] = 0x704C, + [4404] = 0x6EEC, [4405] = 0x6EF8, [4406] = 0x6EFE, [4407] = 0x6F3F, + [4408] = 0x6EF2, [4409] = 0x6F31, [4410] = 0x6EEF, [4411] = 0x6F32, + [4412] = 0x6ECC +}; + + +/* The following table can be generated from the file + unix/mappings/eastasia/jis/shiftjis.txt + from the Unicode CD (also available on their FTP server) using + the command + + egrep '^0x[eE][[:xdigit:]][[:xdigit:]][[:xdigit:]]' \ + /mnt/cdrom/unix/mappings/eastasia/jis/shiftjis.txt | perl ~/sjis.pl + + where sjis.pl contains: + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $n = 0; + while (<>) { + local($sjis, $ucs, %rest) = split; + $sjis = hex($sjis) - 0xe040; + local($sidx) = int($sjis / 256) * 192 + ($sjis % 256); + printf "\n " if (($n % 4) == 0); + ++$n; + printf " [%4d] = %s,", $sidx, $ucs; + } + print "\n"; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +static const uint16_t cjk_block4[2021] = +{ + [ 0] = 0x6F3E, [ 1] = 0x6F13, [ 2] = 0x6EF7, [ 3] = 0x6F86, + [ 4] = 0x6F7A, [ 5] = 0x6F78, [ 6] = 0x6F81, [ 7] = 0x6F80, + [ 8] = 0x6F6F, [ 9] = 0x6F5B, [ 10] = 0x6FF3, [ 11] = 0x6F6D, + [ 12] = 0x6F82, [ 13] = 0x6F7C, [ 14] = 0x6F58, [ 15] = 0x6F8E, + [ 16] = 0x6F91, [ 17] = 0x6FC2, [ 18] = 0x6F66, [ 19] = 0x6FB3, + [ 20] = 0x6FA3, [ 21] = 0x6FA1, [ 22] = 0x6FA4, [ 23] = 0x6FB9, + [ 24] = 0x6FC6, [ 25] = 0x6FAA, [ 26] = 0x6FDF, [ 27] = 0x6FD5, + [ 28] = 0x6FEC, [ 29] = 0x6FD4, [ 30] = 0x6FD8, [ 31] = 0x6FF1, + [ 32] = 0x6FEE, [ 33] = 0x6FDB, [ 34] = 0x7009, [ 35] = 0x700B, + [ 36] = 0x6FFA, [ 37] = 0x7011, [ 38] = 0x7001, [ 39] = 0x700F, + [ 40] = 0x6FFE, [ 41] = 0x701B, [ 42] = 0x701A, [ 43] = 0x6F74, + [ 44] = 0x701D, [ 45] = 0x7018, [ 46] = 0x701F, [ 47] = 0x7030, + [ 48] = 0x703E, [ 49] = 0x7032, [ 50] = 0x7051, [ 51] = 0x7063, + [ 52] = 0x7099, [ 53] = 0x7092, [ 54] = 0x70AF, [ 55] = 0x70F1, + [ 56] = 0x70AC, [ 57] = 0x70B8, [ 58] = 0x70B3, [ 59] = 0x70AE, + [ 60] = 0x70DF, [ 61] = 0x70CB, [ 62] = 0x70DD, [ 64] = 0x70D9, + [ 65] = 0x7109, [ 66] = 0x70FD, [ 67] = 0x711C, [ 68] = 0x7119, + [ 69] = 0x7165, [ 70] = 0x7155, [ 71] = 0x7188, [ 72] = 0x7166, + [ 73] = 0x7162, [ 74] = 0x714C, [ 75] = 0x7156, [ 76] = 0x716C, + [ 77] = 0x718F, [ 78] = 0x71FB, [ 79] = 0x7184, [ 80] = 0x7195, + [ 81] = 0x71A8, [ 82] = 0x71AC, [ 83] = 0x71D7, [ 84] = 0x71B9, + [ 85] = 0x71BE, [ 86] = 0x71D2, [ 87] = 0x71C9, [ 88] = 0x71D4, + [ 89] = 0x71CE, [ 90] = 0x71E0, [ 91] = 0x71EC, [ 92] = 0x71E7, + [ 93] = 0x71F5, [ 94] = 0x71FC, [ 95] = 0x71F9, [ 96] = 0x71FF, + [ 97] = 0x720D, [ 98] = 0x7210, [ 99] = 0x721B, [ 100] = 0x7228, + [ 101] = 0x722D, [ 102] = 0x722C, [ 103] = 0x7230, [ 104] = 0x7232, + [ 105] = 0x723B, [ 106] = 0x723C, [ 107] = 0x723F, [ 108] = 0x7240, + [ 109] = 0x7246, [ 110] = 0x724B, [ 111] = 0x7258, [ 112] = 0x7274, + [ 113] = 0x727E, [ 114] = 0x7282, [ 115] = 0x7281, [ 116] = 0x7287, + [ 117] = 0x7292, [ 118] = 0x7296, [ 119] = 0x72A2, [ 120] = 0x72A7, + [ 121] = 0x72B9, [ 122] = 0x72B2, [ 123] = 0x72C3, [ 124] = 0x72C6, + [ 125] = 0x72C4, [ 126] = 0x72CE, [ 127] = 0x72D2, [ 128] = 0x72E2, + [ 129] = 0x72E0, [ 130] = 0x72E1, [ 131] = 0x72F9, [ 132] = 0x72F7, + [ 133] = 0x500F, [ 134] = 0x7317, [ 135] = 0x730A, [ 136] = 0x731C, + [ 137] = 0x7316, [ 138] = 0x731D, [ 139] = 0x7334, [ 140] = 0x732F, + [ 141] = 0x7329, [ 142] = 0x7325, [ 143] = 0x733E, [ 144] = 0x734E, + [ 145] = 0x734F, [ 146] = 0x9ED8, [ 147] = 0x7357, [ 148] = 0x736A, + [ 149] = 0x7368, [ 150] = 0x7370, [ 151] = 0x7378, [ 152] = 0x7375, + [ 153] = 0x737B, [ 154] = 0x737A, [ 155] = 0x73C8, [ 156] = 0x73B3, + [ 157] = 0x73CE, [ 158] = 0x73BB, [ 159] = 0x73C0, [ 160] = 0x73E5, + [ 161] = 0x73EE, [ 162] = 0x73DE, [ 163] = 0x74A2, [ 164] = 0x7405, + [ 165] = 0x746F, [ 166] = 0x7425, [ 167] = 0x73F8, [ 168] = 0x7432, + [ 169] = 0x743A, [ 170] = 0x7455, [ 171] = 0x743F, [ 172] = 0x745F, + [ 173] = 0x7459, [ 174] = 0x7441, [ 175] = 0x745C, [ 176] = 0x7469, + [ 177] = 0x7470, [ 178] = 0x7463, [ 179] = 0x746A, [ 180] = 0x7476, + [ 181] = 0x747E, [ 182] = 0x748B, [ 183] = 0x749E, [ 184] = 0x74A7, + [ 185] = 0x74CA, [ 186] = 0x74CF, [ 187] = 0x74D4, [ 188] = 0x73F1, + [ 192] = 0x74E0, [ 193] = 0x74E3, [ 194] = 0x74E7, [ 195] = 0x74E9, + [ 196] = 0x74EE, [ 197] = 0x74F2, [ 198] = 0x74F0, [ 199] = 0x74F1, + [ 200] = 0x74F8, [ 201] = 0x74F7, [ 202] = 0x7504, [ 203] = 0x7503, + [ 204] = 0x7505, [ 205] = 0x750C, [ 206] = 0x750E, [ 207] = 0x750D, + [ 208] = 0x7515, [ 209] = 0x7513, [ 210] = 0x751E, [ 211] = 0x7526, + [ 212] = 0x752C, [ 213] = 0x753C, [ 214] = 0x7544, [ 215] = 0x754D, + [ 216] = 0x754A, [ 217] = 0x7549, [ 218] = 0x755B, [ 219] = 0x7546, + [ 220] = 0x755A, [ 221] = 0x7569, [ 222] = 0x7564, [ 223] = 0x7567, + [ 224] = 0x756B, [ 225] = 0x756D, [ 226] = 0x7578, [ 227] = 0x7576, + [ 228] = 0x7586, [ 229] = 0x7587, [ 230] = 0x7574, [ 231] = 0x758A, + [ 232] = 0x7589, [ 233] = 0x7582, [ 234] = 0x7594, [ 235] = 0x759A, + [ 236] = 0x759D, [ 237] = 0x75A5, [ 238] = 0x75A3, [ 239] = 0x75C2, + [ 240] = 0x75B3, [ 241] = 0x75C3, [ 242] = 0x75B5, [ 243] = 0x75BD, + [ 244] = 0x75B8, [ 245] = 0x75BC, [ 246] = 0x75B1, [ 247] = 0x75CD, + [ 248] = 0x75CA, [ 249] = 0x75D2, [ 250] = 0x75D9, [ 251] = 0x75E3, + [ 252] = 0x75DE, [ 253] = 0x75FE, [ 254] = 0x75FF, [ 256] = 0x75FC, + [ 257] = 0x7601, [ 258] = 0x75F0, [ 259] = 0x75FA, [ 260] = 0x75F2, + [ 261] = 0x75F3, [ 262] = 0x760B, [ 263] = 0x760D, [ 264] = 0x7609, + [ 265] = 0x761F, [ 266] = 0x7627, [ 267] = 0x7620, [ 268] = 0x7621, + [ 269] = 0x7622, [ 270] = 0x7624, [ 271] = 0x7634, [ 272] = 0x7630, + [ 273] = 0x763B, [ 274] = 0x7647, [ 275] = 0x7648, [ 276] = 0x7646, + [ 277] = 0x765C, [ 278] = 0x7658, [ 279] = 0x7661, [ 280] = 0x7662, + [ 281] = 0x7668, [ 282] = 0x7669, [ 283] = 0x766A, [ 284] = 0x7667, + [ 285] = 0x766C, [ 286] = 0x7670, [ 287] = 0x7672, [ 288] = 0x7676, + [ 289] = 0x7678, [ 290] = 0x767C, [ 291] = 0x7680, [ 292] = 0x7683, + [ 293] = 0x7688, [ 294] = 0x768B, [ 295] = 0x768E, [ 296] = 0x7696, + [ 297] = 0x7693, [ 298] = 0x7699, [ 299] = 0x769A, [ 300] = 0x76B0, + [ 301] = 0x76B4, [ 302] = 0x76B8, [ 303] = 0x76B9, [ 304] = 0x76BA, + [ 305] = 0x76C2, [ 306] = 0x76CD, [ 307] = 0x76D6, [ 308] = 0x76D2, + [ 309] = 0x76DE, [ 310] = 0x76E1, [ 311] = 0x76E5, [ 312] = 0x76E7, + [ 313] = 0x76EA, [ 314] = 0x862F, [ 315] = 0x76FB, [ 316] = 0x7708, + [ 317] = 0x7707, [ 318] = 0x7704, [ 319] = 0x7729, [ 320] = 0x7724, + [ 321] = 0x771E, [ 322] = 0x7725, [ 323] = 0x7726, [ 324] = 0x771B, + [ 325] = 0x7737, [ 326] = 0x7738, [ 327] = 0x7747, [ 328] = 0x775A, + [ 329] = 0x7768, [ 330] = 0x776B, [ 331] = 0x775B, [ 332] = 0x7765, + [ 333] = 0x777F, [ 334] = 0x777E, [ 335] = 0x7779, [ 336] = 0x778E, + [ 337] = 0x778B, [ 338] = 0x7791, [ 339] = 0x77A0, [ 340] = 0x779E, + [ 341] = 0x77B0, [ 342] = 0x77B6, [ 343] = 0x77B9, [ 344] = 0x77BF, + [ 345] = 0x77BC, [ 346] = 0x77BD, [ 347] = 0x77BB, [ 348] = 0x77C7, + [ 349] = 0x77CD, [ 350] = 0x77D7, [ 351] = 0x77DA, [ 352] = 0x77DC, + [ 353] = 0x77E3, [ 354] = 0x77EE, [ 355] = 0x77FC, [ 356] = 0x780C, + [ 357] = 0x7812, [ 358] = 0x7926, [ 359] = 0x7820, [ 360] = 0x792A, + [ 361] = 0x7845, [ 362] = 0x788E, [ 363] = 0x7874, [ 364] = 0x7886, + [ 365] = 0x787C, [ 366] = 0x789A, [ 367] = 0x788C, [ 368] = 0x78A3, + [ 369] = 0x78B5, [ 370] = 0x78AA, [ 371] = 0x78AF, [ 372] = 0x78D1, + [ 373] = 0x78C6, [ 374] = 0x78CB, [ 375] = 0x78D4, [ 376] = 0x78BE, + [ 377] = 0x78BC, [ 378] = 0x78C5, [ 379] = 0x78CA, [ 380] = 0x78EC, + [ 384] = 0x78E7, [ 385] = 0x78DA, [ 386] = 0x78FD, [ 387] = 0x78F4, + [ 388] = 0x7907, [ 389] = 0x7912, [ 390] = 0x7911, [ 391] = 0x7919, + [ 392] = 0x792C, [ 393] = 0x792B, [ 394] = 0x7940, [ 395] = 0x7960, + [ 396] = 0x7957, [ 397] = 0x795F, [ 398] = 0x795A, [ 399] = 0x7955, + [ 400] = 0x7953, [ 401] = 0x797A, [ 402] = 0x797F, [ 403] = 0x798A, + [ 404] = 0x799D, [ 405] = 0x79A7, [ 406] = 0x9F4B, [ 407] = 0x79AA, + [ 408] = 0x79AE, [ 409] = 0x79B3, [ 410] = 0x79B9, [ 411] = 0x79BA, + [ 412] = 0x79C9, [ 413] = 0x79D5, [ 414] = 0x79E7, [ 415] = 0x79EC, + [ 416] = 0x79E1, [ 417] = 0x79E3, [ 418] = 0x7A08, [ 419] = 0x7A0D, + [ 420] = 0x7A18, [ 421] = 0x7A19, [ 422] = 0x7A20, [ 423] = 0x7A1F, + [ 424] = 0x7980, [ 425] = 0x7A31, [ 426] = 0x7A3B, [ 427] = 0x7A3E, + [ 428] = 0x7A37, [ 429] = 0x7A43, [ 430] = 0x7A57, [ 431] = 0x7A49, + [ 432] = 0x7A61, [ 433] = 0x7A62, [ 434] = 0x7A69, [ 435] = 0x9F9D, + [ 436] = 0x7A70, [ 437] = 0x7A79, [ 438] = 0x7A7D, [ 439] = 0x7A88, + [ 440] = 0x7A97, [ 441] = 0x7A95, [ 442] = 0x7A98, [ 443] = 0x7A96, + [ 444] = 0x7AA9, [ 445] = 0x7AC8, [ 446] = 0x7AB0, [ 448] = 0x7AB6, + [ 449] = 0x7AC5, [ 450] = 0x7AC4, [ 451] = 0x7ABF, [ 452] = 0x9083, + [ 453] = 0x7AC7, [ 454] = 0x7ACA, [ 455] = 0x7ACD, [ 456] = 0x7ACF, + [ 457] = 0x7AD5, [ 458] = 0x7AD3, [ 459] = 0x7AD9, [ 460] = 0x7ADA, + [ 461] = 0x7ADD, [ 462] = 0x7AE1, [ 463] = 0x7AE2, [ 464] = 0x7AE6, + [ 465] = 0x7AED, [ 466] = 0x7AF0, [ 467] = 0x7B02, [ 468] = 0x7B0F, + [ 469] = 0x7B0A, [ 470] = 0x7B06, [ 471] = 0x7B33, [ 472] = 0x7B18, + [ 473] = 0x7B19, [ 474] = 0x7B1E, [ 475] = 0x7B35, [ 476] = 0x7B28, + [ 477] = 0x7B36, [ 478] = 0x7B50, [ 479] = 0x7B7A, [ 480] = 0x7B04, + [ 481] = 0x7B4D, [ 482] = 0x7B0B, [ 483] = 0x7B4C, [ 484] = 0x7B45, + [ 485] = 0x7B75, [ 486] = 0x7B65, [ 487] = 0x7B74, [ 488] = 0x7B67, + [ 489] = 0x7B70, [ 490] = 0x7B71, [ 491] = 0x7B6C, [ 492] = 0x7B6E, + [ 493] = 0x7B9D, [ 494] = 0x7B98, [ 495] = 0x7B9F, [ 496] = 0x7B8D, + [ 497] = 0x7B9C, [ 498] = 0x7B9A, [ 499] = 0x7B8B, [ 500] = 0x7B92, + [ 501] = 0x7B8F, [ 502] = 0x7B5D, [ 503] = 0x7B99, [ 504] = 0x7BCB, + [ 505] = 0x7BC1, [ 506] = 0x7BCC, [ 507] = 0x7BCF, [ 508] = 0x7BB4, + [ 509] = 0x7BC6, [ 510] = 0x7BDD, [ 511] = 0x7BE9, [ 512] = 0x7C11, + [ 513] = 0x7C14, [ 514] = 0x7BE6, [ 515] = 0x7BE5, [ 516] = 0x7C60, + [ 517] = 0x7C00, [ 518] = 0x7C07, [ 519] = 0x7C13, [ 520] = 0x7BF3, + [ 521] = 0x7BF7, [ 522] = 0x7C17, [ 523] = 0x7C0D, [ 524] = 0x7BF6, + [ 525] = 0x7C23, [ 526] = 0x7C27, [ 527] = 0x7C2A, [ 528] = 0x7C1F, + [ 529] = 0x7C37, [ 530] = 0x7C2B, [ 531] = 0x7C3D, [ 532] = 0x7C4C, + [ 533] = 0x7C43, [ 534] = 0x7C54, [ 535] = 0x7C4F, [ 536] = 0x7C40, + [ 537] = 0x7C50, [ 538] = 0x7C58, [ 539] = 0x7C5F, [ 540] = 0x7C64, + [ 541] = 0x7C56, [ 542] = 0x7C65, [ 543] = 0x7C6C, [ 544] = 0x7C75, + [ 545] = 0x7C83, [ 546] = 0x7C90, [ 547] = 0x7CA4, [ 548] = 0x7CAD, + [ 549] = 0x7CA2, [ 550] = 0x7CAB, [ 551] = 0x7CA1, [ 552] = 0x7CA8, + [ 553] = 0x7CB3, [ 554] = 0x7CB2, [ 555] = 0x7CB1, [ 556] = 0x7CAE, + [ 557] = 0x7CB9, [ 558] = 0x7CBD, [ 559] = 0x7CC0, [ 560] = 0x7CC5, + [ 561] = 0x7CC2, [ 562] = 0x7CD8, [ 563] = 0x7CD2, [ 564] = 0x7CDC, + [ 565] = 0x7CE2, [ 566] = 0x9B3B, [ 567] = 0x7CEF, [ 568] = 0x7CF2, + [ 569] = 0x7CF4, [ 570] = 0x7CF6, [ 571] = 0x7CFA, [ 572] = 0x7D06, + [ 576] = 0x7D02, [ 577] = 0x7D1C, [ 578] = 0x7D15, [ 579] = 0x7D0A, + [ 580] = 0x7D45, [ 581] = 0x7D4B, [ 582] = 0x7D2E, [ 583] = 0x7D32, + [ 584] = 0x7D3F, [ 585] = 0x7D35, [ 586] = 0x7D46, [ 587] = 0x7D73, + [ 588] = 0x7D56, [ 589] = 0x7D4E, [ 590] = 0x7D72, [ 591] = 0x7D68, + [ 592] = 0x7D6E, [ 593] = 0x7D4F, [ 594] = 0x7D63, [ 595] = 0x7D93, + [ 596] = 0x7D89, [ 597] = 0x7D5B, [ 598] = 0x7D8F, [ 599] = 0x7D7D, + [ 600] = 0x7D9B, [ 601] = 0x7DBA, [ 602] = 0x7DAE, [ 603] = 0x7DA3, + [ 604] = 0x7DB5, [ 605] = 0x7DC7, [ 606] = 0x7DBD, [ 607] = 0x7DAB, + [ 608] = 0x7E3D, [ 609] = 0x7DA2, [ 610] = 0x7DAF, [ 611] = 0x7DDC, + [ 612] = 0x7DB8, [ 613] = 0x7D9F, [ 614] = 0x7DB0, [ 615] = 0x7DD8, + [ 616] = 0x7DDD, [ 617] = 0x7DE4, [ 618] = 0x7DDE, [ 619] = 0x7DFB, + [ 620] = 0x7DF2, [ 621] = 0x7DE1, [ 622] = 0x7E05, [ 623] = 0x7E0A, + [ 624] = 0x7E23, [ 625] = 0x7E21, [ 626] = 0x7E12, [ 627] = 0x7E31, + [ 628] = 0x7E1F, [ 629] = 0x7E09, [ 630] = 0x7E0B, [ 631] = 0x7E22, + [ 632] = 0x7E46, [ 633] = 0x7E66, [ 634] = 0x7E3B, [ 635] = 0x7E35, + [ 636] = 0x7E39, [ 637] = 0x7E43, [ 638] = 0x7E37, [ 640] = 0x7E32, + [ 641] = 0x7E3A, [ 642] = 0x7E67, [ 643] = 0x7E5D, [ 644] = 0x7E56, + [ 645] = 0x7E5E, [ 646] = 0x7E59, [ 647] = 0x7E5A, [ 648] = 0x7E79, + [ 649] = 0x7E6A, [ 650] = 0x7E69, [ 651] = 0x7E7C, [ 652] = 0x7E7B, + [ 653] = 0x7E83, [ 654] = 0x7DD5, [ 655] = 0x7E7D, [ 656] = 0x8FAE, + [ 657] = 0x7E7F, [ 658] = 0x7E88, [ 659] = 0x7E89, [ 660] = 0x7E8C, + [ 661] = 0x7E92, [ 662] = 0x7E90, [ 663] = 0x7E93, [ 664] = 0x7E94, + [ 665] = 0x7E96, [ 666] = 0x7E8E, [ 667] = 0x7E9B, [ 668] = 0x7E9C, + [ 669] = 0x7F38, [ 670] = 0x7F3A, [ 671] = 0x7F45, [ 672] = 0x7F4C, + [ 673] = 0x7F4D, [ 674] = 0x7F4E, [ 675] = 0x7F50, [ 676] = 0x7F51, + [ 677] = 0x7F55, [ 678] = 0x7F54, [ 679] = 0x7F58, [ 680] = 0x7F5F, + [ 681] = 0x7F60, [ 682] = 0x7F68, [ 683] = 0x7F69, [ 684] = 0x7F67, + [ 685] = 0x7F78, [ 686] = 0x7F82, [ 687] = 0x7F86, [ 688] = 0x7F83, + [ 689] = 0x7F88, [ 690] = 0x7F87, [ 691] = 0x7F8C, [ 692] = 0x7F94, + [ 693] = 0x7F9E, [ 694] = 0x7F9D, [ 695] = 0x7F9A, [ 696] = 0x7FA3, + [ 697] = 0x7FAF, [ 698] = 0x7FB2, [ 699] = 0x7FB9, [ 700] = 0x7FAE, + [ 701] = 0x7FB6, [ 702] = 0x7FB8, [ 703] = 0x8B71, [ 704] = 0x7FC5, + [ 705] = 0x7FC6, [ 706] = 0x7FCA, [ 707] = 0x7FD5, [ 708] = 0x7FD4, + [ 709] = 0x7FE1, [ 710] = 0x7FE6, [ 711] = 0x7FE9, [ 712] = 0x7FF3, + [ 713] = 0x7FF9, [ 714] = 0x98DC, [ 715] = 0x8006, [ 716] = 0x8004, + [ 717] = 0x800B, [ 718] = 0x8012, [ 719] = 0x8018, [ 720] = 0x8019, + [ 721] = 0x801C, [ 722] = 0x8021, [ 723] = 0x8028, [ 724] = 0x803F, + [ 725] = 0x803B, [ 726] = 0x804A, [ 727] = 0x8046, [ 728] = 0x8052, + [ 729] = 0x8058, [ 730] = 0x805A, [ 731] = 0x805F, [ 732] = 0x8062, + [ 733] = 0x8068, [ 734] = 0x8073, [ 735] = 0x8072, [ 736] = 0x8070, + [ 737] = 0x8076, [ 738] = 0x8079, [ 739] = 0x807D, [ 740] = 0x807F, + [ 741] = 0x8084, [ 742] = 0x8086, [ 743] = 0x8085, [ 744] = 0x809B, + [ 745] = 0x8093, [ 746] = 0x809A, [ 747] = 0x80AD, [ 748] = 0x5190, + [ 749] = 0x80AC, [ 750] = 0x80DB, [ 751] = 0x80E5, [ 752] = 0x80D9, + [ 753] = 0x80DD, [ 754] = 0x80C4, [ 755] = 0x80DA, [ 756] = 0x80D6, + [ 757] = 0x8109, [ 758] = 0x80EF, [ 759] = 0x80F1, [ 760] = 0x811B, + [ 761] = 0x8129, [ 762] = 0x8123, [ 763] = 0x812F, [ 764] = 0x814B, + [ 768] = 0x968B, [ 769] = 0x8146, [ 770] = 0x813E, [ 771] = 0x8153, + [ 772] = 0x8151, [ 773] = 0x80FC, [ 774] = 0x8171, [ 775] = 0x816E, + [ 776] = 0x8165, [ 777] = 0x8166, [ 778] = 0x8174, [ 779] = 0x8183, + [ 780] = 0x8188, [ 781] = 0x818A, [ 782] = 0x8180, [ 783] = 0x8182, + [ 784] = 0x81A0, [ 785] = 0x8195, [ 786] = 0x81A4, [ 787] = 0x81A3, + [ 788] = 0x815F, [ 789] = 0x8193, [ 790] = 0x81A9, [ 791] = 0x81B0, + [ 792] = 0x81B5, [ 793] = 0x81BE, [ 794] = 0x81B8, [ 795] = 0x81BD, + [ 796] = 0x81C0, [ 797] = 0x81C2, [ 798] = 0x81BA, [ 799] = 0x81C9, + [ 800] = 0x81CD, [ 801] = 0x81D1, [ 802] = 0x81D9, [ 803] = 0x81D8, + [ 804] = 0x81C8, [ 805] = 0x81DA, [ 806] = 0x81DF, [ 807] = 0x81E0, + [ 808] = 0x81E7, [ 809] = 0x81FA, [ 810] = 0x81FB, [ 811] = 0x81FE, + [ 812] = 0x8201, [ 813] = 0x8202, [ 814] = 0x8205, [ 815] = 0x8207, + [ 816] = 0x820A, [ 817] = 0x820D, [ 818] = 0x8210, [ 819] = 0x8216, + [ 820] = 0x8229, [ 821] = 0x822B, [ 822] = 0x8238, [ 823] = 0x8233, + [ 824] = 0x8240, [ 825] = 0x8259, [ 826] = 0x8258, [ 827] = 0x825D, + [ 828] = 0x825A, [ 829] = 0x825F, [ 830] = 0x8264, [ 832] = 0x8262, + [ 833] = 0x8268, [ 834] = 0x826A, [ 835] = 0x826B, [ 836] = 0x822E, + [ 837] = 0x8271, [ 838] = 0x8277, [ 839] = 0x8278, [ 840] = 0x827E, + [ 841] = 0x828D, [ 842] = 0x8292, [ 843] = 0x82AB, [ 844] = 0x829F, + [ 845] = 0x82BB, [ 846] = 0x82AC, [ 847] = 0x82E1, [ 848] = 0x82E3, + [ 849] = 0x82DF, [ 850] = 0x82D2, [ 851] = 0x82F4, [ 852] = 0x82F3, + [ 853] = 0x82FA, [ 854] = 0x8393, [ 855] = 0x8303, [ 856] = 0x82FB, + [ 857] = 0x82F9, [ 858] = 0x82DE, [ 859] = 0x8306, [ 860] = 0x82DC, + [ 861] = 0x8309, [ 862] = 0x82D9, [ 863] = 0x8335, [ 864] = 0x8334, + [ 865] = 0x8316, [ 866] = 0x8332, [ 867] = 0x8331, [ 868] = 0x8340, + [ 869] = 0x8339, [ 870] = 0x8350, [ 871] = 0x8345, [ 872] = 0x832F, + [ 873] = 0x832B, [ 874] = 0x8317, [ 875] = 0x8318, [ 876] = 0x8385, + [ 877] = 0x839A, [ 878] = 0x83AA, [ 879] = 0x839F, [ 880] = 0x83A2, + [ 881] = 0x8396, [ 882] = 0x8323, [ 883] = 0x838E, [ 884] = 0x8387, + [ 885] = 0x838A, [ 886] = 0x837C, [ 887] = 0x83B5, [ 888] = 0x8373, + [ 889] = 0x8375, [ 890] = 0x83A0, [ 891] = 0x8389, [ 892] = 0x83A8, + [ 893] = 0x83F4, [ 894] = 0x8413, [ 895] = 0x83EB, [ 896] = 0x83CE, + [ 897] = 0x83FD, [ 898] = 0x8403, [ 899] = 0x83D8, [ 900] = 0x840B, + [ 901] = 0x83C1, [ 902] = 0x83F7, [ 903] = 0x8407, [ 904] = 0x83E0, + [ 905] = 0x83F2, [ 906] = 0x840D, [ 907] = 0x8422, [ 908] = 0x8420, + [ 909] = 0x83BD, [ 910] = 0x8438, [ 911] = 0x8506, [ 912] = 0x83FB, + [ 913] = 0x846D, [ 914] = 0x842A, [ 915] = 0x843C, [ 916] = 0x855A, + [ 917] = 0x8484, [ 918] = 0x8477, [ 919] = 0x846B, [ 920] = 0x84AD, + [ 921] = 0x846E, [ 922] = 0x8482, [ 923] = 0x8469, [ 924] = 0x8446, + [ 925] = 0x842C, [ 926] = 0x846F, [ 927] = 0x8479, [ 928] = 0x8435, + [ 929] = 0x84CA, [ 930] = 0x8462, [ 931] = 0x84B9, [ 932] = 0x84BF, + [ 933] = 0x849F, [ 934] = 0x84D9, [ 935] = 0x84CD, [ 936] = 0x84BB, + [ 937] = 0x84DA, [ 938] = 0x84D0, [ 939] = 0x84C1, [ 940] = 0x84C6, + [ 941] = 0x84D6, [ 942] = 0x84A1, [ 943] = 0x8521, [ 944] = 0x84FF, + [ 945] = 0x84F4, [ 946] = 0x8517, [ 947] = 0x8518, [ 948] = 0x852C, + [ 949] = 0x851F, [ 950] = 0x8515, [ 951] = 0x8514, [ 952] = 0x84FC, + [ 953] = 0x8540, [ 954] = 0x8563, [ 955] = 0x8558, [ 956] = 0x8548, + [ 960] = 0x8541, [ 961] = 0x8602, [ 962] = 0x854B, [ 963] = 0x8555, + [ 964] = 0x8580, [ 965] = 0x85A4, [ 966] = 0x8588, [ 967] = 0x8591, + [ 968] = 0x858A, [ 969] = 0x85A8, [ 970] = 0x856D, [ 971] = 0x8594, + [ 972] = 0x859B, [ 973] = 0x85EA, [ 974] = 0x8587, [ 975] = 0x859C, + [ 976] = 0x8577, [ 977] = 0x857E, [ 978] = 0x8590, [ 979] = 0x85C9, + [ 980] = 0x85BA, [ 981] = 0x85CF, [ 982] = 0x85B9, [ 983] = 0x85D0, + [ 984] = 0x85D5, [ 985] = 0x85DD, [ 986] = 0x85E5, [ 987] = 0x85DC, + [ 988] = 0x85F9, [ 989] = 0x860A, [ 990] = 0x8613, [ 991] = 0x860B, + [ 992] = 0x85FE, [ 993] = 0x85FA, [ 994] = 0x8606, [ 995] = 0x8622, + [ 996] = 0x861A, [ 997] = 0x8630, [ 998] = 0x863F, [ 999] = 0x864D, + [1000] = 0x4E55, [1001] = 0x8654, [1002] = 0x865F, [1003] = 0x8667, + [1004] = 0x8671, [1005] = 0x8693, [1006] = 0x86A3, [1007] = 0x86A9, + [1008] = 0x86AA, [1009] = 0x868B, [1010] = 0x868C, [1011] = 0x86B6, + [1012] = 0x86AF, [1013] = 0x86C4, [1014] = 0x86C6, [1015] = 0x86B0, + [1016] = 0x86C9, [1017] = 0x8823, [1018] = 0x86AB, [1019] = 0x86D4, + [1020] = 0x86DE, [1021] = 0x86E9, [1022] = 0x86EC, [1024] = 0x86DF, + [1025] = 0x86DB, [1026] = 0x86EF, [1027] = 0x8712, [1028] = 0x8706, + [1029] = 0x8708, [1030] = 0x8700, [1031] = 0x8703, [1032] = 0x86FB, + [1033] = 0x8711, [1034] = 0x8709, [1035] = 0x870D, [1036] = 0x86F9, + [1037] = 0x870A, [1038] = 0x8734, [1039] = 0x873F, [1040] = 0x8737, + [1041] = 0x873B, [1042] = 0x8725, [1043] = 0x8729, [1044] = 0x871A, + [1045] = 0x8760, [1046] = 0x875F, [1047] = 0x8778, [1048] = 0x874C, + [1049] = 0x874E, [1050] = 0x8774, [1051] = 0x8757, [1052] = 0x8768, + [1053] = 0x876E, [1054] = 0x8759, [1055] = 0x8753, [1056] = 0x8763, + [1057] = 0x876A, [1058] = 0x8805, [1059] = 0x87A2, [1060] = 0x879F, + [1061] = 0x8782, [1062] = 0x87AF, [1063] = 0x87CB, [1064] = 0x87BD, + [1065] = 0x87C0, [1066] = 0x87D0, [1067] = 0x96D6, [1068] = 0x87AB, + [1069] = 0x87C4, [1070] = 0x87B3, [1071] = 0x87C7, [1072] = 0x87C6, + [1073] = 0x87BB, [1074] = 0x87EF, [1075] = 0x87F2, [1076] = 0x87E0, + [1077] = 0x880F, [1078] = 0x880D, [1079] = 0x87FE, [1080] = 0x87F6, + [1081] = 0x87F7, [1082] = 0x880E, [1083] = 0x87D2, [1084] = 0x8811, + [1085] = 0x8816, [1086] = 0x8815, [1087] = 0x8822, [1088] = 0x8821, + [1089] = 0x8831, [1090] = 0x8836, [1091] = 0x8839, [1092] = 0x8827, + [1093] = 0x883B, [1094] = 0x8844, [1095] = 0x8842, [1096] = 0x8852, + [1097] = 0x8859, [1098] = 0x885E, [1099] = 0x8862, [1100] = 0x886B, + [1101] = 0x8881, [1102] = 0x887E, [1103] = 0x889E, [1104] = 0x8875, + [1105] = 0x887D, [1106] = 0x88B5, [1107] = 0x8872, [1108] = 0x8882, + [1109] = 0x8897, [1110] = 0x8892, [1111] = 0x88AE, [1112] = 0x8899, + [1113] = 0x88A2, [1114] = 0x888D, [1115] = 0x88A4, [1116] = 0x88B0, + [1117] = 0x88BF, [1118] = 0x88B1, [1119] = 0x88C3, [1120] = 0x88C4, + [1121] = 0x88D4, [1122] = 0x88D8, [1123] = 0x88D9, [1124] = 0x88DD, + [1125] = 0x88F9, [1126] = 0x8902, [1127] = 0x88FC, [1128] = 0x88F4, + [1129] = 0x88E8, [1130] = 0x88F2, [1131] = 0x8904, [1132] = 0x890C, + [1133] = 0x890A, [1134] = 0x8913, [1135] = 0x8943, [1136] = 0x891E, + [1137] = 0x8925, [1138] = 0x892A, [1139] = 0x892B, [1140] = 0x8941, + [1141] = 0x8944, [1142] = 0x893B, [1143] = 0x8936, [1144] = 0x8938, + [1145] = 0x894C, [1146] = 0x891D, [1147] = 0x8960, [1148] = 0x895E, + [1152] = 0x8966, [1153] = 0x8964, [1154] = 0x896D, [1155] = 0x896A, + [1156] = 0x896F, [1157] = 0x8974, [1158] = 0x8977, [1159] = 0x897E, + [1160] = 0x8983, [1161] = 0x8988, [1162] = 0x898A, [1163] = 0x8993, + [1164] = 0x8998, [1165] = 0x89A1, [1166] = 0x89A9, [1167] = 0x89A6, + [1168] = 0x89AC, [1169] = 0x89AF, [1170] = 0x89B2, [1171] = 0x89BA, + [1172] = 0x89BD, [1173] = 0x89BF, [1174] = 0x89C0, [1175] = 0x89DA, + [1176] = 0x89DC, [1177] = 0x89DD, [1178] = 0x89E7, [1179] = 0x89F4, + [1180] = 0x89F8, [1181] = 0x8A03, [1182] = 0x8A16, [1183] = 0x8A10, + [1184] = 0x8A0C, [1185] = 0x8A1B, [1186] = 0x8A1D, [1187] = 0x8A25, + [1188] = 0x8A36, [1189] = 0x8A41, [1190] = 0x8A5B, [1191] = 0x8A52, + [1192] = 0x8A46, [1193] = 0x8A48, [1194] = 0x8A7C, [1195] = 0x8A6D, + [1196] = 0x8A6C, [1197] = 0x8A62, [1198] = 0x8A85, [1199] = 0x8A82, + [1200] = 0x8A84, [1201] = 0x8AA8, [1202] = 0x8AA1, [1203] = 0x8A91, + [1204] = 0x8AA5, [1205] = 0x8AA6, [1206] = 0x8A9A, [1207] = 0x8AA3, + [1208] = 0x8AC4, [1209] = 0x8ACD, [1210] = 0x8AC2, [1211] = 0x8ADA, + [1212] = 0x8AEB, [1213] = 0x8AF3, [1214] = 0x8AE7, [1216] = 0x8AE4, + [1217] = 0x8AF1, [1218] = 0x8B14, [1219] = 0x8AE0, [1220] = 0x8AE2, + [1221] = 0x8AF7, [1222] = 0x8ADE, [1223] = 0x8ADB, [1224] = 0x8B0C, + [1225] = 0x8B07, [1226] = 0x8B1A, [1227] = 0x8AE1, [1228] = 0x8B16, + [1229] = 0x8B10, [1230] = 0x8B17, [1231] = 0x8B20, [1232] = 0x8B33, + [1233] = 0x97AB, [1234] = 0x8B26, [1235] = 0x8B2B, [1236] = 0x8B3E, + [1237] = 0x8B28, [1238] = 0x8B41, [1239] = 0x8B4C, [1240] = 0x8B4F, + [1241] = 0x8B4E, [1242] = 0x8B49, [1243] = 0x8B56, [1244] = 0x8B5B, + [1245] = 0x8B5A, [1246] = 0x8B6B, [1247] = 0x8B5F, [1248] = 0x8B6C, + [1249] = 0x8B6F, [1250] = 0x8B74, [1251] = 0x8B7D, [1252] = 0x8B80, + [1253] = 0x8B8C, [1254] = 0x8B8E, [1255] = 0x8B92, [1256] = 0x8B93, + [1257] = 0x8B96, [1258] = 0x8B99, [1259] = 0x8B9A, [1260] = 0x8C3A, + [1261] = 0x8C41, [1262] = 0x8C3F, [1263] = 0x8C48, [1264] = 0x8C4C, + [1265] = 0x8C4E, [1266] = 0x8C50, [1267] = 0x8C55, [1268] = 0x8C62, + [1269] = 0x8C6C, [1270] = 0x8C78, [1271] = 0x8C7A, [1272] = 0x8C82, + [1273] = 0x8C89, [1274] = 0x8C85, [1275] = 0x8C8A, [1276] = 0x8C8D, + [1277] = 0x8C8E, [1278] = 0x8C94, [1279] = 0x8C7C, [1280] = 0x8C98, + [1281] = 0x621D, [1282] = 0x8CAD, [1283] = 0x8CAA, [1284] = 0x8CBD, + [1285] = 0x8CB2, [1286] = 0x8CB3, [1287] = 0x8CAE, [1288] = 0x8CB6, + [1289] = 0x8CC8, [1290] = 0x8CC1, [1291] = 0x8CE4, [1292] = 0x8CE3, + [1293] = 0x8CDA, [1294] = 0x8CFD, [1295] = 0x8CFA, [1296] = 0x8CFB, + [1297] = 0x8D04, [1298] = 0x8D05, [1299] = 0x8D0A, [1300] = 0x8D07, + [1301] = 0x8D0F, [1302] = 0x8D0D, [1303] = 0x8D10, [1304] = 0x9F4E, + [1305] = 0x8D13, [1306] = 0x8CCD, [1307] = 0x8D14, [1308] = 0x8D16, + [1309] = 0x8D67, [1310] = 0x8D6D, [1311] = 0x8D71, [1312] = 0x8D73, + [1313] = 0x8D81, [1314] = 0x8D99, [1315] = 0x8DC2, [1316] = 0x8DBE, + [1317] = 0x8DBA, [1318] = 0x8DCF, [1319] = 0x8DDA, [1320] = 0x8DD6, + [1321] = 0x8DCC, [1322] = 0x8DDB, [1323] = 0x8DCB, [1324] = 0x8DEA, + [1325] = 0x8DEB, [1326] = 0x8DDF, [1327] = 0x8DE3, [1328] = 0x8DFC, + [1329] = 0x8E08, [1330] = 0x8E09, [1331] = 0x8DFF, [1332] = 0x8E1D, + [1333] = 0x8E1E, [1334] = 0x8E10, [1335] = 0x8E1F, [1336] = 0x8E42, + [1337] = 0x8E35, [1338] = 0x8E30, [1339] = 0x8E34, [1340] = 0x8E4A, + [1344] = 0x8E47, [1345] = 0x8E49, [1346] = 0x8E4C, [1347] = 0x8E50, + [1348] = 0x8E48, [1349] = 0x8E59, [1350] = 0x8E64, [1351] = 0x8E60, + [1352] = 0x8E2A, [1353] = 0x8E63, [1354] = 0x8E55, [1355] = 0x8E76, + [1356] = 0x8E72, [1357] = 0x8E7C, [1358] = 0x8E81, [1359] = 0x8E87, + [1360] = 0x8E85, [1361] = 0x8E84, [1362] = 0x8E8B, [1363] = 0x8E8A, + [1364] = 0x8E93, [1365] = 0x8E91, [1366] = 0x8E94, [1367] = 0x8E99, + [1368] = 0x8EAA, [1369] = 0x8EA1, [1370] = 0x8EAC, [1371] = 0x8EB0, + [1372] = 0x8EC6, [1373] = 0x8EB1, [1374] = 0x8EBE, [1375] = 0x8EC5, + [1376] = 0x8EC8, [1377] = 0x8ECB, [1378] = 0x8EDB, [1379] = 0x8EE3, + [1380] = 0x8EFC, [1381] = 0x8EFB, [1382] = 0x8EEB, [1383] = 0x8EFE, + [1384] = 0x8F0A, [1385] = 0x8F05, [1386] = 0x8F15, [1387] = 0x8F12, + [1388] = 0x8F19, [1389] = 0x8F13, [1390] = 0x8F1C, [1391] = 0x8F1F, + [1392] = 0x8F1B, [1393] = 0x8F0C, [1394] = 0x8F26, [1395] = 0x8F33, + [1396] = 0x8F3B, [1397] = 0x8F39, [1398] = 0x8F45, [1399] = 0x8F42, + [1400] = 0x8F3E, [1401] = 0x8F4C, [1402] = 0x8F49, [1403] = 0x8F46, + [1404] = 0x8F4E, [1405] = 0x8F57, [1406] = 0x8F5C, [1408] = 0x8F62, + [1409] = 0x8F63, [1410] = 0x8F64, [1411] = 0x8F9C, [1412] = 0x8F9F, + [1413] = 0x8FA3, [1414] = 0x8FAD, [1415] = 0x8FAF, [1416] = 0x8FB7, + [1417] = 0x8FDA, [1418] = 0x8FE5, [1419] = 0x8FE2, [1420] = 0x8FEA, + [1421] = 0x8FEF, [1422] = 0x9087, [1423] = 0x8FF4, [1424] = 0x9005, + [1425] = 0x8FF9, [1426] = 0x8FFA, [1427] = 0x9011, [1428] = 0x9015, + [1429] = 0x9021, [1430] = 0x900D, [1431] = 0x901E, [1432] = 0x9016, + [1433] = 0x900B, [1434] = 0x9027, [1435] = 0x9036, [1436] = 0x9035, + [1437] = 0x9039, [1438] = 0x8FF8, [1439] = 0x904F, [1440] = 0x9050, + [1441] = 0x9051, [1442] = 0x9052, [1443] = 0x900E, [1444] = 0x9049, + [1445] = 0x903E, [1446] = 0x9056, [1447] = 0x9058, [1448] = 0x905E, + [1449] = 0x9068, [1450] = 0x906F, [1451] = 0x9076, [1452] = 0x96A8, + [1453] = 0x9072, [1454] = 0x9082, [1455] = 0x907D, [1456] = 0x9081, + [1457] = 0x9080, [1458] = 0x908A, [1459] = 0x9089, [1460] = 0x908F, + [1461] = 0x90A8, [1462] = 0x90AF, [1463] = 0x90B1, [1464] = 0x90B5, + [1465] = 0x90E2, [1466] = 0x90E4, [1467] = 0x6248, [1468] = 0x90DB, + [1469] = 0x9102, [1470] = 0x9112, [1471] = 0x9119, [1472] = 0x9132, + [1473] = 0x9130, [1474] = 0x914A, [1475] = 0x9156, [1476] = 0x9158, + [1477] = 0x9163, [1478] = 0x9165, [1479] = 0x9169, [1480] = 0x9173, + [1481] = 0x9172, [1482] = 0x918B, [1483] = 0x9189, [1484] = 0x9182, + [1485] = 0x91A2, [1486] = 0x91AB, [1487] = 0x91AF, [1488] = 0x91AA, + [1489] = 0x91B5, [1490] = 0x91B4, [1491] = 0x91BA, [1492] = 0x91C0, + [1493] = 0x91C1, [1494] = 0x91C9, [1495] = 0x91CB, [1496] = 0x91D0, + [1497] = 0x91D6, [1498] = 0x91DF, [1499] = 0x91E1, [1500] = 0x91DB, + [1501] = 0x91FC, [1502] = 0x91F5, [1503] = 0x91F6, [1504] = 0x921E, + [1505] = 0x91FF, [1506] = 0x9214, [1507] = 0x922C, [1508] = 0x9215, + [1509] = 0x9211, [1510] = 0x925E, [1511] = 0x9257, [1512] = 0x9245, + [1513] = 0x9249, [1514] = 0x9264, [1515] = 0x9248, [1516] = 0x9295, + [1517] = 0x923F, [1518] = 0x924B, [1519] = 0x9250, [1520] = 0x929C, + [1521] = 0x9296, [1522] = 0x9293, [1523] = 0x929B, [1524] = 0x925A, + [1525] = 0x92CF, [1526] = 0x92B9, [1527] = 0x92B7, [1528] = 0x92E9, + [1529] = 0x930F, [1530] = 0x92FA, [1531] = 0x9344, [1532] = 0x932E, + [1536] = 0x9319, [1537] = 0x9322, [1538] = 0x931A, [1539] = 0x9323, + [1540] = 0x933A, [1541] = 0x9335, [1542] = 0x933B, [1543] = 0x935C, + [1544] = 0x9360, [1545] = 0x937C, [1546] = 0x936E, [1547] = 0x9356, + [1548] = 0x93B0, [1549] = 0x93AC, [1550] = 0x93AD, [1551] = 0x9394, + [1552] = 0x93B9, [1553] = 0x93D6, [1554] = 0x93D7, [1555] = 0x93E8, + [1556] = 0x93E5, [1557] = 0x93D8, [1558] = 0x93C3, [1559] = 0x93DD, + [1560] = 0x93D0, [1561] = 0x93C8, [1562] = 0x93E4, [1563] = 0x941A, + [1564] = 0x9414, [1565] = 0x9413, [1566] = 0x9403, [1567] = 0x9407, + [1568] = 0x9410, [1569] = 0x9436, [1570] = 0x942B, [1571] = 0x9435, + [1572] = 0x9421, [1573] = 0x943A, [1574] = 0x9441, [1575] = 0x9452, + [1576] = 0x9444, [1577] = 0x945B, [1578] = 0x9460, [1579] = 0x9462, + [1580] = 0x945E, [1581] = 0x946A, [1582] = 0x9229, [1583] = 0x9470, + [1584] = 0x9475, [1585] = 0x9477, [1586] = 0x947D, [1587] = 0x945A, + [1588] = 0x947C, [1589] = 0x947E, [1590] = 0x9481, [1591] = 0x947F, + [1592] = 0x9582, [1593] = 0x9587, [1594] = 0x958A, [1595] = 0x9594, + [1596] = 0x9596, [1597] = 0x9598, [1598] = 0x9599, [1600] = 0x95A0, + [1601] = 0x95A8, [1602] = 0x95A7, [1603] = 0x95AD, [1604] = 0x95BC, + [1605] = 0x95BB, [1606] = 0x95B9, [1607] = 0x95BE, [1608] = 0x95CA, + [1609] = 0x6FF6, [1610] = 0x95C3, [1611] = 0x95CD, [1612] = 0x95CC, + [1613] = 0x95D5, [1614] = 0x95D4, [1615] = 0x95D6, [1616] = 0x95DC, + [1617] = 0x95E1, [1618] = 0x95E5, [1619] = 0x95E2, [1620] = 0x9621, + [1621] = 0x9628, [1622] = 0x962E, [1623] = 0x962F, [1624] = 0x9642, + [1625] = 0x964C, [1626] = 0x964F, [1627] = 0x964B, [1628] = 0x9677, + [1629] = 0x965C, [1630] = 0x965E, [1631] = 0x965D, [1632] = 0x965F, + [1633] = 0x9666, [1634] = 0x9672, [1635] = 0x966C, [1636] = 0x968D, + [1637] = 0x9698, [1638] = 0x9695, [1639] = 0x9697, [1640] = 0x96AA, + [1641] = 0x96A7, [1642] = 0x96B1, [1643] = 0x96B2, [1644] = 0x96B0, + [1645] = 0x96B4, [1646] = 0x96B6, [1647] = 0x96B8, [1648] = 0x96B9, + [1649] = 0x96CE, [1650] = 0x96CB, [1651] = 0x96C9, [1652] = 0x96CD, + [1653] = 0x894D, [1654] = 0x96DC, [1655] = 0x970D, [1656] = 0x96D5, + [1657] = 0x96F9, [1658] = 0x9704, [1659] = 0x9706, [1660] = 0x9708, + [1661] = 0x9713, [1662] = 0x970E, [1663] = 0x9711, [1664] = 0x970F, + [1665] = 0x9716, [1666] = 0x9719, [1667] = 0x9724, [1668] = 0x972A, + [1669] = 0x9730, [1670] = 0x9739, [1671] = 0x973D, [1672] = 0x973E, + [1673] = 0x9744, [1674] = 0x9746, [1675] = 0x9748, [1676] = 0x9742, + [1677] = 0x9749, [1678] = 0x975C, [1679] = 0x9760, [1680] = 0x9764, + [1681] = 0x9766, [1682] = 0x9768, [1683] = 0x52D2, [1684] = 0x976B, + [1685] = 0x9771, [1686] = 0x9779, [1687] = 0x9785, [1688] = 0x977C, + [1689] = 0x9781, [1690] = 0x977A, [1691] = 0x9786, [1692] = 0x978B, + [1693] = 0x978F, [1694] = 0x9790, [1695] = 0x979C, [1696] = 0x97A8, + [1697] = 0x97A6, [1698] = 0x97A3, [1699] = 0x97B3, [1700] = 0x97B4, + [1701] = 0x97C3, [1702] = 0x97C6, [1703] = 0x97C8, [1704] = 0x97CB, + [1705] = 0x97DC, [1706] = 0x97ED, [1707] = 0x9F4F, [1708] = 0x97F2, + [1709] = 0x7ADF, [1710] = 0x97F6, [1711] = 0x97F5, [1712] = 0x980F, + [1713] = 0x980C, [1714] = 0x9838, [1715] = 0x9824, [1716] = 0x9821, + [1717] = 0x9837, [1718] = 0x983D, [1719] = 0x9846, [1720] = 0x984F, + [1721] = 0x984B, [1722] = 0x986B, [1723] = 0x986F, [1724] = 0x9870, + [1728] = 0x9871, [1729] = 0x9874, [1730] = 0x9873, [1731] = 0x98AA, + [1732] = 0x98AF, [1733] = 0x98B1, [1734] = 0x98B6, [1735] = 0x98C4, + [1736] = 0x98C3, [1737] = 0x98C6, [1738] = 0x98E9, [1739] = 0x98EB, + [1740] = 0x9903, [1741] = 0x9909, [1742] = 0x9912, [1743] = 0x9914, + [1744] = 0x9918, [1745] = 0x9921, [1746] = 0x991D, [1747] = 0x991E, + [1748] = 0x9924, [1749] = 0x9920, [1750] = 0x992C, [1751] = 0x992E, + [1752] = 0x993D, [1753] = 0x993E, [1754] = 0x9942, [1755] = 0x9949, + [1756] = 0x9945, [1757] = 0x9950, [1758] = 0x994B, [1759] = 0x9951, + [1760] = 0x9952, [1761] = 0x994C, [1762] = 0x9955, [1763] = 0x9997, + [1764] = 0x9998, [1765] = 0x99A5, [1766] = 0x99AD, [1767] = 0x99AE, + [1768] = 0x99BC, [1769] = 0x99DF, [1770] = 0x99DB, [1771] = 0x99DD, + [1772] = 0x99D8, [1773] = 0x99D1, [1774] = 0x99ED, [1775] = 0x99EE, + [1776] = 0x99F1, [1777] = 0x99F2, [1778] = 0x99FB, [1779] = 0x99F8, + [1780] = 0x9A01, [1781] = 0x9A0F, [1782] = 0x9A05, [1783] = 0x99E2, + [1784] = 0x9A19, [1785] = 0x9A2B, [1786] = 0x9A37, [1787] = 0x9A45, + [1788] = 0x9A42, [1789] = 0x9A40, [1790] = 0x9A43, [1792] = 0x9A3E, + [1793] = 0x9A55, [1794] = 0x9A4D, [1795] = 0x9A5B, [1796] = 0x9A57, + [1797] = 0x9A5F, [1798] = 0x9A62, [1799] = 0x9A65, [1800] = 0x9A64, + [1801] = 0x9A69, [1802] = 0x9A6B, [1803] = 0x9A6A, [1804] = 0x9AAD, + [1805] = 0x9AB0, [1806] = 0x9ABC, [1807] = 0x9AC0, [1808] = 0x9ACF, + [1809] = 0x9AD1, [1810] = 0x9AD3, [1811] = 0x9AD4, [1812] = 0x9ADE, + [1813] = 0x9ADF, [1814] = 0x9AE2, [1815] = 0x9AE3, [1816] = 0x9AE6, + [1817] = 0x9AEF, [1818] = 0x9AEB, [1819] = 0x9AEE, [1820] = 0x9AF4, + [1821] = 0x9AF1, [1822] = 0x9AF7, [1823] = 0x9AFB, [1824] = 0x9B06, + [1825] = 0x9B18, [1826] = 0x9B1A, [1827] = 0x9B1F, [1828] = 0x9B22, + [1829] = 0x9B23, [1830] = 0x9B25, [1831] = 0x9B27, [1832] = 0x9B28, + [1833] = 0x9B29, [1834] = 0x9B2A, [1835] = 0x9B2E, [1836] = 0x9B2F, + [1837] = 0x9B32, [1838] = 0x9B44, [1839] = 0x9B43, [1840] = 0x9B4F, + [1841] = 0x9B4D, [1842] = 0x9B4E, [1843] = 0x9B51, [1844] = 0x9B58, + [1845] = 0x9B74, [1846] = 0x9B93, [1847] = 0x9B83, [1848] = 0x9B91, + [1849] = 0x9B96, [1850] = 0x9B97, [1851] = 0x9B9F, [1852] = 0x9BA0, + [1853] = 0x9BA8, [1854] = 0x9BB4, [1855] = 0x9BC0, [1856] = 0x9BCA, + [1857] = 0x9BB9, [1858] = 0x9BC6, [1859] = 0x9BCF, [1860] = 0x9BD1, + [1861] = 0x9BD2, [1862] = 0x9BE3, [1863] = 0x9BE2, [1864] = 0x9BE4, + [1865] = 0x9BD4, [1866] = 0x9BE1, [1867] = 0x9C3A, [1868] = 0x9BF2, + [1869] = 0x9BF1, [1870] = 0x9BF0, [1871] = 0x9C15, [1872] = 0x9C14, + [1873] = 0x9C09, [1874] = 0x9C13, [1875] = 0x9C0C, [1876] = 0x9C06, + [1877] = 0x9C08, [1878] = 0x9C12, [1879] = 0x9C0A, [1880] = 0x9C04, + [1881] = 0x9C2E, [1882] = 0x9C1B, [1883] = 0x9C25, [1884] = 0x9C24, + [1885] = 0x9C21, [1886] = 0x9C30, [1887] = 0x9C47, [1888] = 0x9C32, + [1889] = 0x9C46, [1890] = 0x9C3E, [1891] = 0x9C5A, [1892] = 0x9C60, + [1893] = 0x9C67, [1894] = 0x9C76, [1895] = 0x9C78, [1896] = 0x9CE7, + [1897] = 0x9CEC, [1898] = 0x9CF0, [1899] = 0x9D09, [1900] = 0x9D08, + [1901] = 0x9CEB, [1902] = 0x9D03, [1903] = 0x9D06, [1904] = 0x9D2A, + [1905] = 0x9D26, [1906] = 0x9DAF, [1907] = 0x9D23, [1908] = 0x9D1F, + [1909] = 0x9D44, [1910] = 0x9D15, [1911] = 0x9D12, [1912] = 0x9D41, + [1913] = 0x9D3F, [1914] = 0x9D3E, [1915] = 0x9D46, [1916] = 0x9D48, + [1920] = 0x9D5D, [1921] = 0x9D5E, [1922] = 0x9D64, [1923] = 0x9D51, + [1924] = 0x9D50, [1925] = 0x9D59, [1926] = 0x9D72, [1927] = 0x9D89, + [1928] = 0x9D87, [1929] = 0x9DAB, [1930] = 0x9D6F, [1931] = 0x9D7A, + [1932] = 0x9D9A, [1933] = 0x9DA4, [1934] = 0x9DA9, [1935] = 0x9DB2, + [1936] = 0x9DC4, [1937] = 0x9DC1, [1938] = 0x9DBB, [1939] = 0x9DB8, + [1940] = 0x9DBA, [1941] = 0x9DC6, [1942] = 0x9DCF, [1943] = 0x9DC2, + [1944] = 0x9DD9, [1945] = 0x9DD3, [1946] = 0x9DF8, [1947] = 0x9DE6, + [1948] = 0x9DED, [1949] = 0x9DEF, [1950] = 0x9DFD, [1951] = 0x9E1A, + [1952] = 0x9E1B, [1953] = 0x9E1E, [1954] = 0x9E75, [1955] = 0x9E79, + [1956] = 0x9E7D, [1957] = 0x9E81, [1958] = 0x9E88, [1959] = 0x9E8B, + [1960] = 0x9E8C, [1961] = 0x9E92, [1962] = 0x9E95, [1963] = 0x9E91, + [1964] = 0x9E9D, [1965] = 0x9EA5, [1966] = 0x9EA9, [1967] = 0x9EB8, + [1968] = 0x9EAA, [1969] = 0x9EAD, [1970] = 0x9761, [1971] = 0x9ECC, + [1972] = 0x9ECE, [1973] = 0x9ECF, [1974] = 0x9ED0, [1975] = 0x9ED4, + [1976] = 0x9EDC, [1977] = 0x9EDE, [1978] = 0x9EDD, [1979] = 0x9EE0, + [1980] = 0x9EE5, [1981] = 0x9EE8, [1982] = 0x9EEF, [1984] = 0x9EF4, + [1985] = 0x9EF6, [1986] = 0x9EF7, [1987] = 0x9EF9, [1988] = 0x9EFB, + [1989] = 0x9EFC, [1990] = 0x9EFD, [1991] = 0x9F07, [1992] = 0x9F08, + [1993] = 0x76B7, [1994] = 0x9F15, [1995] = 0x9F21, [1996] = 0x9F2C, + [1997] = 0x9F3E, [1998] = 0x9F4A, [1999] = 0x9F52, [2000] = 0x9F54, + [2001] = 0x9F63, [2002] = 0x9F5F, [2003] = 0x9F60, [2004] = 0x9F61, + [2005] = 0x9F66, [2006] = 0x9F67, [2007] = 0x9F6C, [2008] = 0x9F6A, + [2009] = 0x9F77, [2010] = 0x9F72, [2011] = 0x9F76, [2012] = 0x9F95, + [2013] = 0x9F9C, [2014] = 0x9FA0, [2015] = 0x582F, [2016] = 0x69C7, + [2017] = 0x9059, [2018] = 0x7464, [2019] = 0x51DC, [2020] = 0x7199 +}; + + + + +/* The following table can be generated using + + awk '/^0x/ { print $2, $1; }' < .../eastasia/jis/shiftjis.txt | + egrep "^0x00[[:xdigit:]][[:xdigit:]]" | + sort -u | perl tab.pl + + where tab.pl is + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $n=0; + while (<>) { + local($ucs4, $sjis, %rest) = split; + local($u)=hex($ucs4); + local($s)=hex($sjis); + printf ("\n ") if ($n % 3 == 0); + ++$n; + printf (" [0x%04x] = \"\\x%02x\\x%02x\",", $u, + $s < 0x100 ? $s : int($s/256), $s < 0x100 ? 0 : $s&255); + } + printf ("\n"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The only problem is that the shiftjis.txt file does not contain the + mapping for the characters 0x00 to 0x1f. We add them ourself. + + A much bigger problem is that mapping of the tilde and the backslash + character. There are no such characters in SJIS. The proposed + handling is to simply map the two input values to the corresponding + byte values of ASCII. Things fall more or less in place this way. +*/ +static const char from_ucs4_lat1[0xf8][2] = +{ + [0x0000] = "\x00\x00", [0x0001] = "\x01\x00", [0x0002] = "\x02\x00", + [0x0003] = "\x03\x00", [0x0004] = "\x04\x00", [0x0005] = "\x05\x00", + [0x0006] = "\x06\x00", [0x0007] = "\x07\x00", [0x0008] = "\x08\x00", + [0x0009] = "\x09\x00", [0x000a] = "\x0a\x00", [0x000b] = "\x0b\x00", + [0x000c] = "\x0c\x00", [0x000d] = "\x0d\x00", [0x000e] = "\x0e\x00", + [0x000f] = "\x0f\x00", [0x0010] = "\x10\x00", [0x0011] = "\x11\x00", + [0x0012] = "\x12\x00", [0x0013] = "\x13\x00", [0x0014] = "\x14\x00", + [0x0015] = "\x15\x00", [0x0016] = "\x16\x00", [0x0017] = "\x17\x00", + [0x0018] = "\x18\x00", [0x0019] = "\x19\x00", [0x001a] = "\x1a\x00", + [0x001b] = "\x1b\x00", [0x001c] = "\x1c\x00", [0x001d] = "\x1d\x00", + [0x001e] = "\x1e\x00", [0x001f] = "\x1f\x00", [0x0020] = "\x20\x00", + [0x0021] = "\x21\x00", [0x0022] = "\x22\x00", [0x0023] = "\x23\x00", + [0x0024] = "\x24\x00", [0x0025] = "\x25\x00", [0x0026] = "\x26\x00", + [0x0027] = "\x27\x00", [0x0028] = "\x28\x00", [0x0029] = "\x29\x00", + [0x002a] = "\x2a\x00", [0x002b] = "\x2b\x00", [0x002c] = "\x2c\x00", + [0x002d] = "\x2d\x00", [0x002e] = "\x2e\x00", [0x002f] = "\x2f\x00", + [0x0030] = "\x30\x00", [0x0031] = "\x31\x00", [0x0032] = "\x32\x00", + [0x0033] = "\x33\x00", [0x0034] = "\x34\x00", [0x0035] = "\x35\x00", + [0x0036] = "\x36\x00", [0x0037] = "\x37\x00", [0x0038] = "\x38\x00", + [0x0039] = "\x39\x00", [0x003a] = "\x3a\x00", [0x003b] = "\x3b\x00", + [0x003c] = "\x3c\x00", [0x003d] = "\x3d\x00", [0x003e] = "\x3e\x00", + [0x003f] = "\x3f\x00", [0x0040] = "\x40\x00", [0x0041] = "\x41\x00", + [0x0042] = "\x42\x00", [0x0043] = "\x43\x00", [0x0044] = "\x44\x00", + [0x0045] = "\x45\x00", [0x0046] = "\x46\x00", [0x0047] = "\x47\x00", + [0x0048] = "\x48\x00", [0x0049] = "\x49\x00", [0x004a] = "\x4a\x00", + [0x004b] = "\x4b\x00", [0x004c] = "\x4c\x00", [0x004d] = "\x4d\x00", + [0x004e] = "\x4e\x00", [0x004f] = "\x4f\x00", [0x0050] = "\x50\x00", + [0x0051] = "\x51\x00", [0x0052] = "\x52\x00", [0x0053] = "\x53\x00", + [0x0054] = "\x54\x00", [0x0055] = "\x55\x00", [0x0056] = "\x56\x00", + [0x0057] = "\x57\x00", [0x0058] = "\x58\x00", [0x0059] = "\x59\x00", + [0x005a] = "\x5a\x00", [0x005b] = "\x5b\x00", [0x005c] = "\x5c\x00", + [0x005d] = "\x5d\x00", [0x005e] = "\x5e\x00", [0x005f] = "\x5f\x00", + [0x0060] = "\x60\x00", [0x0061] = "\x61\x00", [0x0062] = "\x62\x00", + [0x0063] = "\x63\x00", [0x0064] = "\x64\x00", [0x0065] = "\x65\x00", + [0x0066] = "\x66\x00", [0x0067] = "\x67\x00", [0x0068] = "\x68\x00", + [0x0069] = "\x69\x00", [0x006a] = "\x6a\x00", [0x006b] = "\x6b\x00", + [0x006c] = "\x6c\x00", [0x006d] = "\x6d\x00", [0x006e] = "\x6e\x00", + [0x006f] = "\x6f\x00", [0x0070] = "\x70\x00", [0x0071] = "\x71\x00", + [0x0072] = "\x72\x00", [0x0073] = "\x73\x00", [0x0074] = "\x74\x00", + [0x0075] = "\x75\x00", [0x0076] = "\x76\x00", [0x0077] = "\x77\x00", + [0x0078] = "\x78\x00", [0x0079] = "\x79\x00", [0x007a] = "\x7a\x00", + [0x007b] = "\x7b\x00", [0x007c] = "\x7c\x00", [0x007d] = "\x7d\x00", + [0x007e] = "\x7e\x00", [0x007f] = "\x7f\x00", + [0x00a2] = "\x81\x91", [0x00a3] = "\x81\x92", [0x00a5] = "\x5c\x00", + [0x00a7] = "\x81\x98", [0x00a8] = "\x81\x4e", [0x00ac] = "\x81\xca", + [0x00b0] = "\x81\x8b", [0x00b1] = "\x81\x7d", [0x00b4] = "\x81\x4c", + [0x00b6] = "\x81\xf7", [0x00d7] = "\x81\x7e", [0x00f7] = "\x81\x80" +}; + + +/* The following table can be generated using + + awk '/^0x/ { print $2, $1; }' < .../eastasia/jis/shiftjis.txt | + egrep "^0x0[34][[:xdigit:]][[:xdigit:]]" | + sort -u | perl tab.pl + + where tab.pl is + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $n=0; + while (<>) { + local($ucs4, $sjis, %rest) = split; + local($u)=hex($ucs4); + local($s)=hex($sjis); + printf ("\n ") if ($n % 3 == 0); + ++$n; + printf (" [0x%04x] = \"\\x%02x\\x%02x\",", $u - 0x391, + $s < 0x100 ? $s : int($s/256), $s < 0x100 ? 0 : $s&255); + } + printf ("\n"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +static const char from_ucs4_greek[193][2] = +{ + [0x0000] = "\x83\x9f", [0x0001] = "\x83\xa0", [0x0002] = "\x83\xa1", + [0x0003] = "\x83\xa2", [0x0004] = "\x83\xa3", [0x0005] = "\x83\xa4", + [0x0006] = "\x83\xa5", [0x0007] = "\x83\xa6", [0x0008] = "\x83\xa7", + [0x0009] = "\x83\xa8", [0x000a] = "\x83\xa9", [0x000b] = "\x83\xaa", + [0x000c] = "\x83\xab", [0x000d] = "\x83\xac", [0x000e] = "\x83\xad", + [0x000f] = "\x83\xae", [0x0010] = "\x83\xaf", [0x0012] = "\x83\xb0", + [0x0013] = "\x83\xb1", [0x0014] = "\x83\xb2", [0x0015] = "\x83\xb3", + [0x0016] = "\x83\xb4", [0x0017] = "\x83\xb5", [0x0018] = "\x83\xb6", + [0x0020] = "\x83\xbf", [0x0021] = "\x83\xc0", [0x0022] = "\x83\xc1", + [0x0023] = "\x83\xc2", [0x0024] = "\x83\xc3", [0x0025] = "\x83\xc4", + [0x0026] = "\x83\xc5", [0x0027] = "\x83\xc6", [0x0028] = "\x83\xc7", + [0x0029] = "\x83\xc8", [0x002a] = "\x83\xc9", [0x002b] = "\x83\xca", + [0x002c] = "\x83\xcb", [0x002d] = "\x83\xcc", [0x002e] = "\x83\xcd", + [0x002f] = "\x83\xce", [0x0030] = "\x83\xcf", [0x0032] = "\x83\xd0", + [0x0033] = "\x83\xd1", [0x0034] = "\x83\xd2", [0x0035] = "\x83\xd3", + [0x0036] = "\x83\xd4", [0x0037] = "\x83\xd5", [0x0038] = "\x83\xd6", + [0x0070] = "\x84\x46", [0x007f] = "\x84\x40", [0x0080] = "\x84\x41", + [0x0081] = "\x84\x42", [0x0082] = "\x84\x43", [0x0083] = "\x84\x44", + [0x0084] = "\x84\x45", [0x0085] = "\x84\x47", [0x0086] = "\x84\x48", + [0x0087] = "\x84\x49", [0x0088] = "\x84\x4a", [0x0089] = "\x84\x4b", + [0x008a] = "\x84\x4c", [0x008b] = "\x84\x4d", [0x008c] = "\x84\x4e", + [0x008d] = "\x84\x4f", [0x008e] = "\x84\x50", [0x008f] = "\x84\x51", + [0x0090] = "\x84\x52", [0x0091] = "\x84\x53", [0x0092] = "\x84\x54", + [0x0093] = "\x84\x55", [0x0094] = "\x84\x56", [0x0095] = "\x84\x57", + [0x0096] = "\x84\x58", [0x0097] = "\x84\x59", [0x0098] = "\x84\x5a", + [0x0099] = "\x84\x5b", [0x009a] = "\x84\x5c", [0x009b] = "\x84\x5d", + [0x009c] = "\x84\x5e", [0x009d] = "\x84\x5f", [0x009e] = "\x84\x60", + [0x009f] = "\x84\x70", [0x00a0] = "\x84\x71", [0x00a1] = "\x84\x72", + [0x00a2] = "\x84\x73", [0x00a3] = "\x84\x74", [0x00a4] = "\x84\x75", + [0x00a5] = "\x84\x77", [0x00a6] = "\x84\x78", [0x00a7] = "\x84\x79", + [0x00a8] = "\x84\x7a", [0x00a9] = "\x84\x7b", [0x00aa] = "\x84\x7c", + [0x00ab] = "\x84\x7d", [0x00ac] = "\x84\x7e", [0x00ad] = "\x84\x80", + [0x00ae] = "\x84\x81", [0x00af] = "\x84\x82", [0x00b0] = "\x84\x83", + [0x00b1] = "\x84\x84", [0x00b2] = "\x84\x85", [0x00b3] = "\x84\x86", + [0x00b4] = "\x84\x87", [0x00b5] = "\x84\x88", [0x00b6] = "\x84\x89", + [0x00b7] = "\x84\x8a", [0x00b8] = "\x84\x8b", [0x00b9] = "\x84\x8c", + [0x00ba] = "\x84\x8d", [0x00bb] = "\x84\x8e", [0x00bc] = "\x84\x8f", + [0x00bd] = "\x84\x90", [0x00be] = "\x84\x91", [0x00c0] = "\x84\x76" +}; + + +/* The mapping of the Kanji is horrible. The glyphs covered by Shift JIS + are spreaded all around the Unicode CJK area. We use one big table + since using the gaps will not buy us much. + + The following table can be generated using + + awk '/^0x/ { print $2, $1; }' < ...eastasia/jis/shiftjis.txt | + egrep "^0x[2-9][[:xdigit:]][[:xdigit:]][[:xdigit:]]" | + sort -u | perl tab.pl + + where tab.pl is + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $n=0; + while (<>) { + local($ucs4, $sjis, %rest) = split; + local($u)=hex($ucs4); + local($s)=hex($sjis); + printf ("\n ") if ($n % 3 == 0); + ++$n; + printf (" [0x%04x] = \"\\x%02x\\x%02x\",", $u - 0x2010, + $s < 0x100 ? $s : int($s/256), $s < 0x100 ? 0 : $s&255); + } + printf ("\n"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +static const char from_ucs4_cjk[32657][2] = +{ + [0x0000] = "\x81\x5d", [0x0005] = "\x81\x5c", [0x0006] = "\x81\x61", + [0x0008] = "\x81\x65", [0x0009] = "\x81\x66", [0x000c] = "\x81\x67", + [0x000d] = "\x81\x68", [0x0010] = "\x81\xf5", [0x0011] = "\x81\xf6", + [0x0015] = "\x81\x64", [0x0016] = "\x81\x63", [0x0020] = "\x81\xf1", + [0x0022] = "\x81\x8c", [0x0023] = "\x81\x8d", [0x002b] = "\x81\xa6", + [0x002e] = "\x7e\x00", [0x00f3] = "\x81\x8e", [0x011b] = "\x81\xf0", + [0x0180] = "\x81\xa9", [0x0181] = "\x81\xaa", [0x0182] = "\x81\xa8", + [0x0183] = "\x81\xab", [0x01c2] = "\x81\xcb", [0x01c4] = "\x81\xcc", + [0x01f0] = "\x81\xcd", [0x01f2] = "\x81\xdd", [0x01f3] = "\x81\xce", + [0x01f7] = "\x81\xde", [0x01f8] = "\x81\xb8", [0x01fb] = "\x81\xb9", + [0x0202] = "\x81\x7c", [0x020a] = "\x81\xe3", [0x020d] = "\x81\xe5", + [0x020e] = "\x81\x87", [0x0210] = "\x81\xda", [0x0217] = "\x81\xc8", + [0x0218] = "\x81\xc9", [0x0219] = "\x81\xbf", [0x021a] = "\x81\xbe", + [0x021b] = "\x81\xe7", [0x021c] = "\x81\xe8", [0x0224] = "\x81\x88", + [0x0225] = "\x81\xe6", [0x022d] = "\x81\xe4", [0x0242] = "\x81\xe0", + [0x0250] = "\x81\x82", [0x0251] = "\x81\xdf", [0x0256] = "\x81\x85", + [0x0257] = "\x81\x86", [0x025a] = "\x81\xe1", [0x025b] = "\x81\xe2", + [0x0272] = "\x81\xbc", [0x0273] = "\x81\xbd", [0x0276] = "\x81\xba", + [0x0277] = "\x81\xbb", [0x0295] = "\x81\xdb", [0x0302] = "\x81\xdc", + [0x04f0] = "\x84\x9f", [0x04f1] = "\x84\xaa", [0x04f2] = "\x84\xa0", + [0x04f3] = "\x84\xab", [0x04fc] = "\x84\xa1", [0x04ff] = "\x84\xac", + [0x0500] = "\x84\xa2", [0x0503] = "\x84\xad", [0x0504] = "\x84\xa4", + [0x0507] = "\x84\xaf", [0x0508] = "\x84\xa3", [0x050b] = "\x84\xae", + [0x050c] = "\x84\xa5", [0x050d] = "\x84\xba", [0x0510] = "\x84\xb5", + [0x0513] = "\x84\xb0", [0x0514] = "\x84\xa7", [0x0515] = "\x84\xbc", + [0x0518] = "\x84\xb7", [0x051b] = "\x84\xb2", [0x051c] = "\x84\xa6", + [0x051f] = "\x84\xb6", [0x0520] = "\x84\xbb", [0x0523] = "\x84\xb1", + [0x0524] = "\x84\xa8", [0x0527] = "\x84\xb8", [0x0528] = "\x84\xbd", + [0x052b] = "\x84\xb3", [0x052c] = "\x84\xa9", [0x052f] = "\x84\xb9", + [0x0532] = "\x84\xbe", [0x053b] = "\x84\xb4", [0x0590] = "\x81\xa1", + [0x0591] = "\x81\xa0", [0x05a2] = "\x81\xa3", [0x05a3] = "\x81\xa2", + [0x05ac] = "\x81\xa5", [0x05ad] = "\x81\xa4", [0x05b6] = "\x81\x9f", + [0x05b7] = "\x81\x9e", [0x05bb] = "\x81\x9b", [0x05be] = "\x81\x9d", + [0x05bf] = "\x81\x9c", [0x05df] = "\x81\xfc", [0x05f5] = "\x81\x9a", + [0x05f6] = "\x81\x99", [0x0630] = "\x81\x8a", [0x0632] = "\x81\x89", + [0x065a] = "\x81\xf4", [0x065d] = "\x81\xf3", [0x065f] = "\x81\xf2", + [0x0ff0] = "\x81\x40", [0x0ff1] = "\x81\x41", [0x0ff2] = "\x81\x42", + [0x0ff3] = "\x81\x56", [0x0ff5] = "\x81\x58", [0x0ff6] = "\x81\x59", + [0x0ff7] = "\x81\x5a", [0x0ff8] = "\x81\x71", [0x0ff9] = "\x81\x72", + [0x0ffa] = "\x81\x73", [0x0ffb] = "\x81\x74", [0x0ffc] = "\x81\x75", + [0x0ffd] = "\x81\x76", [0x0ffe] = "\x81\x77", [0x0fff] = "\x81\x78", + [0x1000] = "\x81\x79", [0x1001] = "\x81\x7a", [0x1002] = "\x81\xa7", + [0x1003] = "\x81\xac", [0x1004] = "\x81\x6b", [0x1005] = "\x81\x6c", + [0x100c] = "\x81\x60", [0x1031] = "\x82\x9f", [0x1032] = "\x82\xa0", + [0x1033] = "\x82\xa1", [0x1034] = "\x82\xa2", [0x1035] = "\x82\xa3", + [0x1036] = "\x82\xa4", [0x1037] = "\x82\xa5", [0x1038] = "\x82\xa6", + [0x1039] = "\x82\xa7", [0x103a] = "\x82\xa8", [0x103b] = "\x82\xa9", + [0x103c] = "\x82\xaa", [0x103d] = "\x82\xab", [0x103e] = "\x82\xac", + [0x103f] = "\x82\xad", [0x1040] = "\x82\xae", [0x1041] = "\x82\xaf", + [0x1042] = "\x82\xb0", [0x1043] = "\x82\xb1", [0x1044] = "\x82\xb2", + [0x1045] = "\x82\xb3", [0x1046] = "\x82\xb4", [0x1047] = "\x82\xb5", + [0x1048] = "\x82\xb6", [0x1049] = "\x82\xb7", [0x104a] = "\x82\xb8", + [0x104b] = "\x82\xb9", [0x104c] = "\x82\xba", [0x104d] = "\x82\xbb", + [0x104e] = "\x82\xbc", [0x104f] = "\x82\xbd", [0x1050] = "\x82\xbe", + [0x1051] = "\x82\xbf", [0x1052] = "\x82\xc0", [0x1053] = "\x82\xc1", + [0x1054] = "\x82\xc2", [0x1055] = "\x82\xc3", [0x1056] = "\x82\xc4", + [0x1057] = "\x82\xc5", [0x1058] = "\x82\xc6", [0x1059] = "\x82\xc7", + [0x105a] = "\x82\xc8", [0x105b] = "\x82\xc9", [0x105c] = "\x82\xca", + [0x105d] = "\x82\xcb", [0x105e] = "\x82\xcc", [0x105f] = "\x82\xcd", + [0x1060] = "\x82\xce", [0x1061] = "\x82\xcf", [0x1062] = "\x82\xd0", + [0x1063] = "\x82\xd1", [0x1064] = "\x82\xd2", [0x1065] = "\x82\xd3", + [0x1066] = "\x82\xd4", [0x1067] = "\x82\xd5", [0x1068] = "\x82\xd6", + [0x1069] = "\x82\xd7", [0x106a] = "\x82\xd8", [0x106b] = "\x82\xd9", + [0x106c] = "\x82\xda", [0x106d] = "\x82\xdb", [0x106e] = "\x82\xdc", + [0x106f] = "\x82\xdd", [0x1070] = "\x82\xde", [0x1071] = "\x82\xdf", + [0x1072] = "\x82\xe0", [0x1073] = "\x82\xe1", [0x1074] = "\x82\xe2", + [0x1075] = "\x82\xe3", [0x1076] = "\x82\xe4", [0x1077] = "\x82\xe5", + [0x1078] = "\x82\xe6", [0x1079] = "\x82\xe7", [0x107a] = "\x82\xe8", + [0x107b] = "\x82\xe9", [0x107c] = "\x82\xea", [0x107d] = "\x82\xeb", + [0x107e] = "\x82\xec", [0x107f] = "\x82\xed", [0x1080] = "\x82\xee", + [0x1081] = "\x82\xef", [0x1082] = "\x82\xf0", [0x1083] = "\x82\xf1", + [0x108b] = "\x81\x4a", [0x108c] = "\x81\x4b", [0x108d] = "\x81\x54", + [0x108e] = "\x81\x55", [0x1091] = "\x83\x40", [0x1092] = "\x83\x41", + [0x1093] = "\x83\x42", [0x1094] = "\x83\x43", [0x1095] = "\x83\x44", + [0x1096] = "\x83\x45", [0x1097] = "\x83\x46", [0x1098] = "\x83\x47", + [0x1099] = "\x83\x48", [0x109a] = "\x83\x49", [0x109b] = "\x83\x4a", + [0x109c] = "\x83\x4b", [0x109d] = "\x83\x4c", [0x109e] = "\x83\x4d", + [0x109f] = "\x83\x4e", [0x10a0] = "\x83\x4f", [0x10a1] = "\x83\x50", + [0x10a2] = "\x83\x51", [0x10a3] = "\x83\x52", [0x10a4] = "\x83\x53", + [0x10a5] = "\x83\x54", [0x10a6] = "\x83\x55", [0x10a7] = "\x83\x56", + [0x10a8] = "\x83\x57", [0x10a9] = "\x83\x58", [0x10aa] = "\x83\x59", + [0x10ab] = "\x83\x5a", [0x10ac] = "\x83\x5b", [0x10ad] = "\x83\x5c", + [0x10ae] = "\x83\x5d", [0x10af] = "\x83\x5e", [0x10b0] = "\x83\x5f", + [0x10b1] = "\x83\x60", [0x10b2] = "\x83\x61", [0x10b3] = "\x83\x62", + [0x10b4] = "\x83\x63", [0x10b5] = "\x83\x64", [0x10b6] = "\x83\x65", + [0x10b7] = "\x83\x66", [0x10b8] = "\x83\x67", [0x10b9] = "\x83\x68", + [0x10ba] = "\x83\x69", [0x10bb] = "\x83\x6a", [0x10bc] = "\x83\x6b", + [0x10bd] = "\x83\x6c", [0x10be] = "\x83\x6d", [0x10bf] = "\x83\x6e", + [0x10c0] = "\x83\x6f", [0x10c1] = "\x83\x70", [0x10c2] = "\x83\x71", + [0x10c3] = "\x83\x72", [0x10c4] = "\x83\x73", [0x10c5] = "\x83\x74", + [0x10c6] = "\x83\x75", [0x10c7] = "\x83\x76", [0x10c8] = "\x83\x77", + [0x10c9] = "\x83\x78", [0x10ca] = "\x83\x79", [0x10cb] = "\x83\x7a", + [0x10cc] = "\x83\x7b", [0x10cd] = "\x83\x7c", [0x10ce] = "\x83\x7d", + [0x10cf] = "\x83\x7e", [0x10d0] = "\x83\x80", [0x10d1] = "\x83\x81", + [0x10d2] = "\x83\x82", [0x10d3] = "\x83\x83", [0x10d4] = "\x83\x84", + [0x10d5] = "\x83\x85", [0x10d6] = "\x83\x86", [0x10d7] = "\x83\x87", + [0x10d8] = "\x83\x88", [0x10d9] = "\x83\x89", [0x10da] = "\x83\x8a", + [0x10db] = "\x83\x8b", [0x10dc] = "\x83\x8c", [0x10dd] = "\x83\x8d", + [0x10de] = "\x83\x8e", [0x10df] = "\x83\x8f", [0x10e0] = "\x83\x90", + [0x10e1] = "\x83\x91", [0x10e2] = "\x83\x92", [0x10e3] = "\x83\x93", + [0x10e4] = "\x83\x94", [0x10e5] = "\x83\x95", [0x10e6] = "\x83\x96", + [0x10eb] = "\x81\x45", [0x10ec] = "\x81\x5b", [0x10ed] = "\x81\x52", + [0x10ee] = "\x81\x53", [0x2df0] = "\x88\xea", [0x2df1] = "\x92\x9a", + [0x2df3] = "\x8e\xb5", [0x2df7] = "\x96\x9c", [0x2df8] = "\x8f\xe4", + [0x2df9] = "\x8e\x4f", [0x2dfa] = "\x8f\xe3", [0x2dfb] = "\x89\xba", + [0x2dfd] = "\x95\x73", [0x2dfe] = "\x97\x5e", [0x2e00] = "\x98\xa0", + [0x2e01] = "\x89\x4e", [0x2e04] = "\x8a\x8e", [0x2e05] = "\x98\xa1", + [0x2e06] = "\x90\xa2", [0x2e07] = "\x99\xc0", [0x2e08] = "\x8b\x75", + [0x2e09] = "\x95\xb8", [0x2e0e] = "\x8f\xe5", [0x2e11] = "\x97\xbc", + [0x2e16] = "\x95\xc0", [0x2e1a] = "\x98\xa2", [0x2e1d] = "\x92\x86", + [0x2e21] = "\x98\xa3", [0x2e22] = "\x8b\xf8", [0x2e26] = "\x98\xa4", + [0x2e28] = "\x8a\xdb", [0x2e29] = "\x92\x4f", [0x2e2b] = "\x8e\xe5", + [0x2e2c] = "\x98\xa5", [0x2e2f] = "\x98\xa6", [0x2e32] = "\x98\xa7", + [0x2e33] = "\x94\x54", [0x2e35] = "\x8b\x76", [0x2e3b] = "\x94\x56", + [0x2e3d] = "\x93\xe1", [0x2e3e] = "\x8c\xc1", [0x2e3f] = "\x96\x52", + [0x2e45] = "\xe5\x68", [0x2e46] = "\x98\xa8", [0x2e47] = "\x8f\xe6", + [0x2e48] = "\x98\xa9", [0x2e49] = "\x89\xb3", [0x2e4d] = "\x8b\xe3", + [0x2e4e] = "\x8c\xee", [0x2e4f] = "\x96\xe7", [0x2e52] = "\x9b\xa4", + [0x2e61] = "\x97\x90", [0x2e63] = "\x93\xfb", [0x2e6e] = "\x8a\xa3", + [0x2e70] = "\x8b\x54", [0x2e72] = "\x98\xaa", [0x2e75] = "\x98\xab", + [0x2e76] = "\x97\xb9", [0x2e78] = "\x97\x5c", [0x2e79] = "\x91\x88", + [0x2e7a] = "\x98\xad", [0x2e7b] = "\x8e\x96", [0x2e7c] = "\x93\xf1", + [0x2e7e] = "\x98\xb0", [0x2e81] = "\x89\x5d", [0x2e82] = "\x8c\xdd", + [0x2e84] = "\x8c\xdc", [0x2e85] = "\x88\xe4", [0x2e88] = "\x98\x6a", + [0x2e89] = "\x98\x69", [0x2e8b] = "\x8d\xb1", [0x2e8c] = "\x88\x9f", + [0x2e8e] = "\x98\xb1", [0x2e8f] = "\x98\xb2", [0x2e90] = "\x98\xb3", + [0x2e91] = "\x96\x53", [0x2e92] = "\x98\xb4", [0x2e94] = "\x8c\xf0", + [0x2e95] = "\x88\xe5", [0x2e96] = "\x96\x92", [0x2e98] = "\x8b\x9c", + [0x2e9b] = "\x8b\x9d", [0x2e9c] = "\x8b\x9e", [0x2e9d] = "\x92\xe0", + [0x2e9e] = "\x97\xba", [0x2ea0] = "\x98\xb5", [0x2ea3] = "\x98\xb6", + [0x2ea6] = "\x98\xb7", [0x2eaa] = "\x90\x6c", [0x2eb0] = "\x8f\x59", + [0x2eb1] = "\x90\x6d", [0x2eb2] = "\x98\xbc", [0x2eb4] = "\x98\xba", + [0x2eb6] = "\x98\xbb", [0x2eb7] = "\x8b\x77", [0x2eba] = "\x8d\xa1", + [0x2ebb] = "\x89\xee", [0x2ebd] = "\x98\xb9", [0x2ebe] = "\x98\xb8", + [0x2ebf] = "\x95\xa7", [0x2ec4] = "\x8e\x65", [0x2ec5] = "\x8e\x64", + [0x2ec6] = "\x91\xbc", [0x2ec7] = "\x98\xbd", [0x2ec8] = "\x95\x74", + [0x2ec9] = "\x90\xe5", [0x2ecd] = "\x81\x57", [0x2ece] = "\x98\xbe", + [0x2ecf] = "\x98\xc0", [0x2ed3] = "\x91\xe3", [0x2ed4] = "\x97\xdf", + [0x2ed5] = "\x88\xc8", [0x2edd] = "\x98\xbf", [0x2ede] = "\x89\xbc", + [0x2ee0] = "\x8b\xc2", [0x2ee2] = "\x92\x87", [0x2ee6] = "\x8c\x8f", + [0x2ee7] = "\x98\xc1", [0x2eeb] = "\x94\x43", [0x2ef1] = "\x8a\xe9", + [0x2ef9] = "\x98\xc2", [0x2efa] = "\x88\xc9", [0x2efd] = "\x8c\xde", + [0x2efe] = "\x8a\xea", [0x2eff] = "\x95\x9a", [0x2f00] = "\x94\xb0", + [0x2f01] = "\x8b\x78", [0x2f0a] = "\x89\xef", [0x2f0c] = "\x98\xe5", + [0x2f0d] = "\x93\x60", [0x2f1f] = "\x94\x8c", [0x2f20] = "\x98\xc4", + [0x2f24] = "\x94\xba", [0x2f26] = "\x97\xe0", [0x2f28] = "\x90\x4c", + [0x2f2a] = "\x8e\x66", [0x2f2c] = "\x8e\x97", [0x2f2d] = "\x89\xbe", + [0x2f33] = "\x92\xcf", [0x2f36] = "\x92\x41", [0x2f37] = "\x98\xc8", + [0x2f3d] = "\x88\xca", [0x2f3e] = "\x92\xe1", [0x2f3f] = "\x8f\x5a", + [0x2f40] = "\x8d\xb2", [0x2f41] = "\x97\x43", [0x2f43] = "\x91\xcc", + [0x2f45] = "\x89\xbd", [0x2f47] = "\x98\xc7", [0x2f49] = "\x97\x5d", + [0x2f4a] = "\x98\xc3", [0x2f4b] = "\x98\xc5", [0x2f4c] = "\x8d\xec", + [0x2f4d] = "\x98\xc6", [0x2f4e] = "\x9b\x43", [0x2f59] = "\x98\xce", + [0x2f5f] = "\x98\xd1", [0x2f60] = "\x98\xcf", [0x2f63] = "\x89\xc0", + [0x2f65] = "\x95\xb9", [0x2f66] = "\x98\xc9", [0x2f6b] = "\x98\xcd", + [0x2f6c] = "\x8c\xf1", [0x2f6f] = "\x8e\x67", [0x2f73] = "\x8a\xa4", + [0x2f76] = "\x98\xd2", [0x2f78] = "\x98\xca", [0x2f7b] = "\x97\xe1", + [0x2f7d] = "\x8e\x98", [0x2f7f] = "\x98\xcb", [0x2f81] = "\x98\xd0", + [0x2f86] = "\x98\xd3", [0x2f88] = "\x98\xcc", [0x2f8b] = "\x8b\x9f", + [0x2f8d] = "\x88\xcb", [0x2f90] = "\x8b\xa0", [0x2f91] = "\x89\xbf", + [0x2f9b] = "\x9b\x44", [0x2f9d] = "\x96\x99", [0x2f9e] = "\x95\x8e", + [0x2f9f] = "\x8c\xf2", [0x2fa5] = "\x90\x4e", [0x2fa6] = "\x97\xb5", + [0x2faf] = "\x95\xd6", [0x2fb2] = "\x8c\x57", [0x2fb3] = "\x91\xa3", + [0x2fb4] = "\x89\xe2", [0x2fba] = "\x8f\x72", [0x2fbe] = "\x98\xd7", + [0x2fc0] = "\x98\xdc", [0x2fc1] = "\x98\xda", [0x2fc4] = "\x98\xd5", + [0x2fc7] = "\x91\xad", [0x2fc8] = "\x98\xd8", [0x2fca] = "\x98\xdb", + [0x2fcb] = "\x98\xd9", [0x2fcd] = "\x95\xdb", [0x2fcf] = "\x98\xd6", + [0x2fd1] = "\x90\x4d", [0x2fd3] = "\x96\x93", [0x2fd4] = "\x98\xdd", + [0x2fd5] = "\x98\xde", [0x2fde] = "\x8f\x43", [0x2fdf] = "\x98\xeb", + [0x2fe3] = "\x94\x6f", [0x2fe5] = "\x95\x55", [0x2fe6] = "\x98\xe6", + [0x2fe8] = "\x95\xee", [0x2fea] = "\x89\xb4", [0x2fee] = "\x98\xea", + [0x2ff5] = "\x98\xe4", [0x2ff6] = "\x98\xed", [0x2ff9] = "\x91\x71", + [0x2ffb] = "\x8c\xc2", [0x2ffd] = "\x94\x7b", [0x2fff] = "\xe0\xc5", + [0x3001] = "\x98\xec", [0x3002] = "\x93\x7c", [0x3004] = "\x98\xe1", + [0x3006] = "\x8c\xf4", [0x3009] = "\x8c\xf3", [0x300a] = "\x98\xdf", + [0x300f] = "\x8e\xd8", [0x3011] = "\x98\xe7", [0x3013] = "\x95\xed", + [0x3014] = "\x92\x6c", [0x3015] = "\x98\xe3", [0x3016] = "\x8c\x91", + [0x3018] = "\x98\xe0", [0x3019] = "\x98\xe8", [0x301a] = "\x98\xe2", + [0x301b] = "\x97\xcf", [0x301c] = "\x98\xe9", [0x301d] = "\x98\x60", + [0x3026] = "\x8b\xe4", [0x3029] = "\x8c\x90", [0x3033] = "\x98\xee", + [0x3037] = "\x98\xef", [0x3038] = "\x98\xf3", [0x3039] = "\x88\xcc", + [0x303f] = "\x95\xce", [0x3040] = "\x98\xf2", [0x3045] = "\x98\xf1", + [0x3046] = "\x98\xf5", [0x304a] = "\x98\xf4", [0x304c] = "\x92\xe2", + [0x3055] = "\x8c\x92", [0x305c] = "\x98\xf6", [0x3062] = "\x8e\xc3", + [0x3064] = "\x91\xa4", [0x3065] = "\x92\xe3", [0x3066] = "\x8b\xf4", + [0x3068] = "\x98\xf7", [0x306d] = "\x8b\x55", [0x3070] = "\x98\xf8", + [0x3075] = "\x98\xfa", [0x307d] = "\x96\x54", [0x3081] = "\x8c\x86", + [0x3088] = "\x8e\x50", [0x3089] = "\x94\xf5", [0x308a] = "\x98\xf9", + [0x309c] = "\x8d\xc3", [0x309d] = "\x97\x62", [0x30a2] = "\x98\xfc", + [0x30a3] = "\x99\x42", [0x30a4] = "\x98\xfb", [0x30a5] = "\x8d\xc2", + [0x30a7] = "\x8f\x9d", [0x30ae] = "\x8c\x58", [0x30b2] = "\x99\x43", + [0x30b5] = "\x8b\xcd", [0x30b9] = "\x99\x40", [0x30ba] = "\x99\x41", + [0x30bd] = "\x93\xad", [0x30bf] = "\x91\x9c", [0x30c1] = "\x8b\xa1", + [0x30c5] = "\x96\x6c", [0x30c6] = "\x99\x44", [0x30ca] = "\x97\xbb", + [0x30ce] = "\x99\x45", [0x30d3] = "\x99\x48", [0x30d5] = "\x99\x46", + [0x30d7] = "\x91\x6d", [0x30dd] = "\x99\x47", [0x30de] = "\x99\x49", + [0x30e5] = "\x99\x4b", [0x30e9] = "\x99\x4a", [0x30eb] = "\x95\xc6", + [0x30f0] = "\x8b\x56", [0x30f1] = "\x99\x4d", [0x30f2] = "\x99\x4e", + [0x30f4] = "\x89\xad", [0x30f9] = "\x99\x4c", [0x3102] = "\x8e\xf2", + [0x3104] = "\x99\x51", [0x3105] = "\x99\x50", [0x3106] = "\x99\x4f", + [0x3108] = "\x98\xd4", [0x310a] = "\x99\x52", [0x310f] = "\x8f\x9e", + [0x3111] = "\x99\x53", [0x311a] = "\x97\x44", [0x3122] = "\x96\xd7", + [0x3127] = "\x99\x55", [0x312a] = "\x99\x54", [0x312b] = "\x99\x57", + [0x312c] = "\x99\x56", [0x312f] = "\x99\x58", [0x3130] = "\x99\x59", + [0x3131] = "\x88\xf2", [0x3133] = "\x8c\xb3", [0x3134] = "\x8c\x5a", + [0x3135] = "\x8f\x5b", [0x3136] = "\x92\x9b", [0x3137] = "\x8b\xa2", + [0x3138] = "\x90\xe6", [0x3139] = "\x8c\xf5", [0x313b] = "\x8d\x8e", + [0x313c] = "\x99\x5b", [0x313d] = "\x96\xc6", [0x313e] = "\x93\x65", + [0x3140] = "\x8e\x99", [0x3142] = "\x99\x5a", [0x3144] = "\x99\x5c", + [0x314a] = "\x93\x7d", [0x314c] = "\x8a\x95", [0x3152] = "\x99\x5d", + [0x3155] = "\x93\xfc", [0x3158] = "\x91\x53", [0x3159] = "\x99\x5f", + [0x315a] = "\x99\x60", [0x315b] = "\x94\xaa", [0x315c] = "\x8c\xf6", + [0x315d] = "\x98\x5a", [0x315e] = "\x99\x61", [0x3161] = "\x8b\xa4", + [0x3165] = "\x95\xba", [0x3166] = "\x91\xb4", [0x3167] = "\x8b\xef", + [0x3168] = "\x93\x54", [0x316c] = "\x8c\x93", [0x3170] = "\x99\x62", + [0x3172] = "\x99\x63", [0x3175] = "\x93\xe0", [0x3176] = "\x89\x7e", + [0x3179] = "\x99\x66", [0x317a] = "\x8d\xfb", [0x317c] = "\x99\x65", + [0x317d] = "\x8d\xc4", [0x317f] = "\x99\x67", [0x3180] = "\xe3\xec", + [0x3181] = "\x99\x68", [0x3182] = "\x96\x60", [0x3183] = "\x99\x69", + [0x3185] = "\x99\x6a", [0x3186] = "\x99\x6b", [0x3187] = "\x8f\xe7", + [0x3189] = "\x8e\xca", [0x3190] = "\x8a\xa5", [0x3192] = "\x99\x6e", + [0x3194] = "\x99\x6c", [0x3195] = "\x96\xbb", [0x3196] = "\x99\x6d", + [0x3198] = "\x95\x79", [0x3199] = "\x99\x6f", [0x319a] = "\x99\x70", + [0x319b] = "\x99\x71", [0x319c] = "\x93\x7e", [0x31a0] = "\x99\x75", + [0x31a1] = "\x99\x73", [0x31a2] = "\x99\x74", [0x31a3] = "\x99\x72", + [0x31a4] = "\x8d\xe1", [0x31a5] = "\x99\x76", [0x31a6] = "\x96\xe8", + [0x31a7] = "\x97\xe2", [0x31ad] = "\x99\x77", [0x31b4] = "\x90\xa6", + [0x31b5] = "\x99\x78", [0x31b6] = "\x8f\x79", [0x31b9] = "\x99\x79", + [0x31bb] = "\x92\x9c", [0x31bc] = "\x97\xbd", [0x31bd] = "\x93\x80", + [0x31c6] = "\x99\xc3", [0x31cb] = "\x99\x7a", [0x31cc] = "\xea\xa3", + [0x31cd] = "\x8b\xc3", [0x31d0] = "\x99\x7b", [0x31d1] = "\x96\x7d", + [0x31d6] = "\x8f\x88", [0x31d7] = "\x91\xfa", [0x31d9] = "\x99\x7d", + [0x31da] = "\x93\xe2", [0x31dd] = "\x99\x7e", [0x31e0] = "\x99\x80", + [0x31e1] = "\x8a\x4d", [0x31e5] = "\x99\x81", [0x31e6] = "\x8b\xa5", + [0x31e8] = "\x93\xca", [0x31e9] = "\x89\x9a", [0x31ea] = "\x8f\x6f", + [0x31ed] = "\x94\x9f", [0x31ee] = "\x99\x82", [0x31f0] = "\x93\x81", + [0x31f3] = "\x90\x6e", [0x31f4] = "\x99\x83", [0x31f6] = "\x95\xaa", + [0x31f7] = "\x90\xd8", [0x31f8] = "\x8a\xa0", [0x31fa] = "\x8a\xa7", + [0x31fb] = "\x99\x84", [0x31fe] = "\x99\x86", [0x3201] = "\x8c\x59", + [0x3204] = "\x99\x85", [0x3207] = "\x97\xf1", [0x320d] = "\x8f\x89", + [0x3214] = "\x94\xbb", [0x3215] = "\x95\xca", [0x3217] = "\x99\x87", + [0x3219] = "\x97\x98", [0x321a] = "\x99\x88", [0x321e] = "\x99\x89", + [0x3220] = "\x93\x9e", [0x3223] = "\x99\x8a", [0x3226] = "\x90\xa7", + [0x3227] = "\x8d\xfc", [0x3228] = "\x8c\x94", [0x3229] = "\x99\x8b", + [0x322a] = "\x8e\x68", [0x322b] = "\x8d\x8f", [0x3233] = "\x92\xe4", + [0x3234] = "\x99\x8d", [0x3237] = "\x91\xa5", [0x323a] = "\x8d\xed", + [0x323b] = "\x99\x8e", [0x323c] = "\x99\x8f", [0x323d] = "\x91\x4f", + [0x323f] = "\x99\x8c", [0x3244] = "\x99\x91", [0x3246] = "\x96\x55", + [0x324b] = "\x8d\x84", [0x324e] = "\x99\x90", [0x3253] = "\x8c\x95", + [0x3254] = "\x8d\xdc", [0x3255] = "\x94\x8d", [0x3259] = "\x99\x94", + [0x325a] = "\x99\x92", [0x325f] = "\x95\x9b", [0x3260] = "\x8f\xe8", + [0x3261] = "\x99\x9b", [0x3262] = "\x8a\x84", [0x3263] = "\x99\x95", + [0x3264] = "\x99\x93", [0x3265] = "\x91\x6e", [0x326d] = "\x99\x97", + [0x326f] = "\x99\x96", [0x3273] = "\x8a\x63", [0x3277] = "\x8c\x80", + [0x3278] = "\x99\x9c", [0x3279] = "\x97\xab", [0x327d] = "\x99\x98", + [0x3281] = "\x99\x9d", [0x3282] = "\x99\x9a", [0x3284] = "\x99\x99", + [0x328b] = "\x97\xcd", [0x328f] = "\x8c\xf7", [0x3290] = "\x89\xc1", + [0x3293] = "\x97\xf2", [0x3299] = "\x8f\x95", [0x329a] = "\x93\x77", + [0x329b] = "\x8d\x85", [0x329c] = "\x99\xa0", [0x329d] = "\x99\xa1", + [0x32a1] = "\x97\xe3", [0x32a4] = "\x98\x4a", [0x32a5] = "\x99\xa3", + [0x32a9] = "\x8c\xf8", [0x32ac] = "\x99\xa2", [0x32ae] = "\x8a\x4e", + [0x32b1] = "\x99\xa4", [0x32b3] = "\x96\x75", [0x32b5] = "\x92\xba", + [0x32b7] = "\x97\x45", [0x32b9] = "\x95\xd7", [0x32bd] = "\x99\xa5", + [0x32c2] = "\xe8\xd3", [0x32c5] = "\x93\xae", [0x32c7] = "\x99\xa6", + [0x32c8] = "\x8a\xa8", [0x32c9] = "\x96\xb1", [0x32cd] = "\x8f\x9f", + [0x32ce] = "\x99\xa7", [0x32cf] = "\x95\xe5", [0x32d0] = "\x99\xab", + [0x32d2] = "\x90\xa8", [0x32d3] = "\x99\xa8", [0x32d4] = "\x8b\xce", + [0x32d6] = "\x99\xa9", [0x32d7] = "\x8a\xa9", [0x32e2] = "\x8c\x4d", + [0x32e3] = "\x99\xac", [0x32e5] = "\x99\xad", [0x32e8] = "\x99\xae", + [0x32e9] = "\x99\xaf", [0x32ea] = "\x8e\xd9", [0x32ee] = "\x8c\xf9", + [0x32ef] = "\x96\xdc", [0x32f1] = "\x96\xe6", [0x32f2] = "\x93\xf5", + [0x32f5] = "\x95\xef", [0x32f6] = "\x99\xb0", [0x32f8] = "\x99\xb1", + [0x32fd] = "\x99\xb3", [0x32ff] = "\x99\xb5", [0x3300] = "\x99\xb4", + [0x3305] = "\x99\xb6", [0x3306] = "\x89\xbb", [0x3307] = "\x96\x6b", + [0x3309] = "\x8d\xfa", [0x330a] = "\x99\xb7", [0x330d] = "\x91\x78", + [0x3310] = "\x8f\xa0", [0x3311] = "\x8b\xa7", [0x3313] = "\x99\xb8", + [0x331a] = "\x94\xd9", [0x331f] = "\x99\xb9", [0x3321] = "\x99\xba", + [0x3323] = "\x99\xbb", [0x3328] = "\x99\xbc", [0x3329] = "\x95\x43", + [0x332a] = "\x8b\xe6", [0x332b] = "\x88\xe3", [0x332f] = "\x93\xbd", + [0x3330] = "\x99\xbd", [0x3331] = "\x8f\x5c", [0x3333] = "\x90\xe7", + [0x3335] = "\x99\xbf", [0x3336] = "\x99\xbe", [0x3337] = "\x8f\xa1", + [0x3338] = "\x8c\xdf", [0x3339] = "\x99\xc1", [0x333a] = "\x94\xbc", + [0x333d] = "\x99\xc2", [0x3341] = "\x94\xda", [0x3342] = "\x91\xb2", + [0x3343] = "\x91\xec", [0x3344] = "\x8b\xa6", [0x3347] = "\x93\xec", + [0x3348] = "\x92\x50", [0x334a] = "\x94\x8e", [0x334c] = "\x96\x6d", + [0x334e] = "\x99\xc4", [0x3350] = "\x90\xe8", [0x3356] = "\x8c\x54", + [0x3359] = "\x99\xc5", [0x335e] = "\x99\xc6", [0x335f] = "\x89\x4b", + [0x3360] = "\x88\xf3", [0x3361] = "\x8a\xeb", [0x3363] = "\x91\xa6", + [0x3364] = "\x8b\x70", [0x3365] = "\x97\x91", [0x3367] = "\x99\xc9", + [0x3368] = "\x89\xb5", [0x336b] = "\x99\xc8", [0x336f] = "\x8b\xa8", + [0x3372] = "\x99\xca", [0x3374] = "\x96\xef", [0x3386] = "\x99\xcb", + [0x3388] = "\x97\xd0", [0x338a] = "\x8c\xfa", [0x338f] = "\x8c\xb4", + [0x3390] = "\x99\xcc", [0x3395] = "\x99\xce", [0x3396] = "\x99\xcd", + [0x3398] = "\x90\x7e", [0x3399] = "\x89\x58", [0x339d] = "\x89\x7d", + [0x339e] = "\x99\xcf", [0x33a0] = "\x99\xd0", [0x33a3] = "\x8c\xb5", + [0x33a6] = "\x99\xd1", [0x33ab] = "\x8b\x8e", [0x33b2] = "\x8e\x51", + [0x33b3] = "\x99\xd2", [0x33b8] = "\x96\x94", [0x33b9] = "\x8d\xb3", + [0x33ba] = "\x8b\x79", [0x33bb] = "\x97\x46", [0x33bc] = "\x91\x6f", + [0x33bd] = "\x94\xbd", [0x33be] = "\x8e\xfb", [0x33c4] = "\x8f\x66", + [0x33c6] = "\x8e\xe6", [0x33c7] = "\x8e\xf3", [0x33c9] = "\x8f\x96", + [0x33cb] = "\x94\xbe", [0x33cf] = "\x99\xd5", [0x33d1] = "\x89\x62", + [0x33d2] = "\x91\x70", [0x33d3] = "\x8c\xfb", [0x33d4] = "\x8c\xc3", + [0x33d5] = "\x8b\xe5", [0x33d8] = "\x99\xd9", [0x33d9] = "\x92\x40", + [0x33da] = "\x91\xfc", [0x33db] = "\x8b\xa9", [0x33dc] = "\x8f\xa2", + [0x33dd] = "\x99\xda", [0x33de] = "\x99\xd8", [0x33df] = "\x89\xc2", + [0x33e0] = "\x91\xe4", [0x33e1] = "\x8e\xb6", [0x33e2] = "\x8e\x6a", + [0x33e3] = "\x89\x45", [0x33e6] = "\x8a\x90", [0x33e7] = "\x8d\x86", + [0x33e8] = "\x8e\x69", [0x33ea] = "\x99\xdb", [0x33f1] = "\x99\xdc", + [0x33f3] = "\x8b\x68", [0x33f4] = "\x8a\x65", [0x33f8] = "\x8d\x87", + [0x33f9] = "\x8b\x67", [0x33fa] = "\x92\xdd", [0x33fb] = "\x89\x44", + [0x33fc] = "\x93\xaf", [0x33fd] = "\x96\xbc", [0x33fe] = "\x8d\x40", + [0x33ff] = "\x97\x99", [0x3400] = "\x93\x66", [0x3401] = "\x8c\xfc", + [0x340b] = "\x8c\x4e", [0x340d] = "\x99\xe5", [0x340f] = "\x8b\xe1", + [0x3410] = "\x96\x69", [0x3416] = "\x94\xdb", [0x3419] = "\x99\xe4", + [0x341b] = "\x8a\xdc", [0x341c] = "\x99\xdf", [0x341d] = "\x99\xe0", + [0x341e] = "\x99\xe2", [0x3426] = "\x99\xe3", [0x3428] = "\x8b\x7a", + [0x3429] = "\x90\x81", [0x342b] = "\x95\xab", [0x342c] = "\x99\xe1", + [0x342d] = "\x99\xdd", [0x342e] = "\x8c\xe1", [0x3430] = "\x99\xde", + [0x3432] = "\x98\x43", [0x3436] = "\x95\xf0", [0x3438] = "\x92\xe6", + [0x3439] = "\x8c\xe0", [0x343a] = "\x8d\x90", [0x343e] = "\x99\xe6", + [0x3441] = "\x93\xdb", [0x344f] = "\x99\xea", [0x3458] = "\x8e\xfc", + [0x345a] = "\x8e\xf4", [0x3460] = "\x99\xed", [0x3461] = "\x99\xeb", + [0x3463] = "\x96\xa1", [0x3465] = "\x99\xe8", [0x3466] = "\x99\xf1", + [0x3467] = "\x99\xec", [0x346b] = "\x99\xef", [0x346c] = "\x8c\xc4", + [0x346d] = "\x96\xbd", [0x3470] = "\x99\xf0", [0x3474] = "\x99\xf2", + [0x3476] = "\x99\xf4", [0x347b] = "\x8d\xee", [0x347c] = "\x98\x61", + [0x347e] = "\x99\xe9", [0x347f] = "\x99\xe7", [0x3480] = "\x99\xf3", + [0x3482] = "\x99\xee", [0x3492] = "\x99\xf6", [0x3494] = "\x9a\x42", + [0x3495] = "\x99\xf8", [0x3498] = "\x99\xfc", [0x349b] = "\x9a\x40", + [0x349c] = "\x99\xf9", [0x349f] = "\x9a\x5d", [0x34a2] = "\x8d\xe7", + [0x34a3] = "\x8a\x50", [0x34a8] = "\x99\xf7", [0x34ac] = "\x9a\x44", + [0x34ad] = "\x88\xf4", [0x34ae] = "\x9a\x43", [0x34b0] = "\x88\xa3", + [0x34b1] = "\x95\x69", [0x34b2] = "\x9a\x41", [0x34b4] = "\x99\xfa", + [0x34b7] = "\x99\xf5", [0x34b8] = "\x99\xfb", [0x34b9] = "\x8d\xc6", + [0x34c8] = "\x9a\x45", [0x34d1] = "\x88\xf5", [0x34d2] = "\x9a\x4e", + [0x34d5] = "\x9a\x46", [0x34d6] = "\x9a\x47", [0x34d8] = "\x8f\xa3", + [0x34d9] = "\x96\x89", [0x34dd] = "\x9a\x4c", [0x34de] = "\x9a\x4b", + [0x34e2] = "\x93\x4e", [0x34ea] = "\x9a\x4d", [0x34ed] = "\x9a\x4a", + [0x34f4] = "\x89\x53", [0x34f6] = "\x8d\xb4", [0x34f7] = "\x90\x4f", + [0x34ff] = "\x9a\x48", [0x3500] = "\x93\x82", [0x3504] = "\x9a\x49", + [0x3506] = "\x88\xa0", [0x351e] = "\x9a\x53", [0x351f] = "\x97\x42", + [0x3521] = "\x8f\xa5", [0x3523] = "\x9a\x59", [0x3528] = "\x9a\x58", + [0x3529] = "\x9a\x4f", [0x352e] = "\x91\xc1", [0x3530] = "\x9a\x50", + [0x3534] = "\x91\xed", [0x3535] = "\x9a\x55", [0x3536] = "\x8f\xa4", + [0x353c] = "\x9a\x52", [0x353f] = "\x96\xe2", [0x3543] = "\x8c\x5b", + [0x3546] = "\x9a\x56", [0x3547] = "\x9a\x57", [0x354c] = "\x9a\x54", + [0x354d] = "\x9a\x5a", [0x3553] = "\x9a\x51", [0x356b] = "\x9a\x60", + [0x356c] = "\x9a\x65", [0x356e] = "\x9a\x61", [0x3570] = "\x9a\x5c", + [0x3573] = "\x9a\x66", [0x3574] = "\x91\x50", [0x3577] = "\x9a\x68", + [0x3579] = "\x8d\x41", [0x357a] = "\x9a\x5e", [0x357b] = "\x92\x9d", + [0x3588] = "\x9a\x62", [0x3589] = "\x9a\x5b", [0x358a] = "\x8a\xab", + [0x358c] = "\x8a\xec", [0x358d] = "\x8a\x85", [0x358e] = "\x9a\x63", + [0x358f] = "\x9a\x5f", [0x3597] = "\x8c\x96", [0x3598] = "\x9a\x69", + [0x3599] = "\x9a\x67", [0x359a] = "\x91\x72", [0x359b] = "\x8b\x69", + [0x359c] = "\x8b\xaa", [0x359e] = "\x9a\x64", [0x35a0] = "\x8b\xf2", + [0x35a6] = "\x89\x63", [0x35b4] = "\x9a\x6d", [0x35b5] = "\x9a\x6b", + [0x35b7] = "\x9a\xa5", [0x35c4] = "\x9a\x70", [0x35ca] = "\x9a\x6a", + [0x35cc] = "\x9a\x6e", [0x35cf] = "\x9a\x6c", [0x35d3] = "\x8e\x6b", + [0x35d4] = "\x9a\x6f", [0x35e7] = "\x9a\x72", [0x35e9] = "\x9a\x77", + [0x35ed] = "\x9a\x75", [0x35ee] = "\x9a\x74", [0x35f6] = "\x92\x51", + [0x35f9] = "\x89\xc3", [0x3604] = "\x9a\x71", [0x3606] = "\x9a\x73", + [0x3607] = "\x8f\xa6", [0x3608] = "\x89\x52", [0x360b] = "\x9a\x76", + [0x3619] = "\x89\xdc", [0x361f] = "\x9a\x82", [0x3621] = "\x8f\xfa", + [0x3622] = "\x9a\x7d", [0x3624] = "\x9a\x7b", [0x3626] = "\x9a\x7c", + [0x3628] = "\x9a\x7e", [0x3632] = "\x89\x5c", [0x363c] = "\x91\x58", + [0x363e] = "\x9a\x78", [0x3640] = "\x9a\x79", [0x364b] = "\x8a\x9a", + [0x3654] = "\x9a\x81", [0x3658] = "\x8a\xed", [0x365a] = "\x9a\x84", + [0x365b] = "\x9a\x80", [0x365c] = "\x9a\x83", [0x3664] = "\x95\xac", + [0x3668] = "\x93\xd3", [0x366a] = "\x94\xb6", [0x3670] = "\x9a\x86", + [0x3676] = "\x9a\x85", [0x3677] = "\x8a\x64", [0x367a] = "\x9a\x87", + [0x367f] = "\x9a\x8a", [0x3684] = "\x9a\x89", [0x3690] = "\x9a\x88", + [0x3692] = "\x94\x58", [0x3695] = "\x9a\x8b", [0x369e] = "\x9a\x8c", + [0x36a4] = "\x9a\x8e", [0x36a6] = "\x9a\x8d", [0x36ac] = "\x9a\x90", + [0x36b0] = "\x9a\x93", [0x36b1] = "\x9a\x91", [0x36b2] = "\x9a\x8f", + [0x36b3] = "\x9a\x92", [0x36b8] = "\x9a\x94", [0x36be] = "\x9a\x95", + [0x36c1] = "\x9a\x96", [0x36c3] = "\x9a\x97", [0x36c7] = "\x9a\x98", + [0x36c8] = "\x99\x64", [0x36ca] = "\x8e\xfa", [0x36cb] = "\x8e\x6c", + [0x36ce] = "\x89\xf1", [0x36d0] = "\x88\xf6", [0x36d3] = "\x92\x63", + [0x36de] = "\x9a\x99", [0x36e0] = "\x8d\xa2", [0x36e2] = "\x88\xcd", + [0x36e3] = "\x90\x7d", [0x36e9] = "\x9a\x9a", [0x36ea] = "\x8c\xc5", + [0x36ed] = "\x8d\x91", [0x36ef] = "\x9a\x9c", [0x36f0] = "\x9a\x9b", + [0x36f3] = "\x95\xde", [0x36f4] = "\x9a\x9d", [0x36f8] = "\x9a\x9f", + [0x36f9] = "\x9a\x9e", [0x36fb] = "\x9a\xa0", [0x36fd] = "\x9a\xa1", + [0x36ff] = "\x8c\x97", [0x3702] = "\x89\x80", [0x3703] = "\x9a\xa2", + [0x3706] = "\x9a\xa4", [0x3708] = "\x9a\xa3", [0x370c] = "\x9a\xa6", + [0x370f] = "\x93\x79", [0x3716] = "\x9a\xa7", [0x3717] = "\x88\xb3", + [0x3718] = "\x8d\xdd", [0x371d] = "\x8c\x5c", [0x3720] = "\x92\x6e", + [0x3727] = "\x9a\xa8", [0x3728] = "\x9a\xa9", [0x372b] = "\x9a\xab", + [0x3730] = "\x9a\xac", [0x3732] = "\x8d\xe2", [0x3737] = "\x8b\xcf", + [0x373a] = "\x96\x56", [0x373e] = "\x9a\xaa", [0x373f] = "\x9a\xad", + [0x3740] = "\x8d\xbf", [0x3741] = "\x8d\x42", [0x3751] = "\x9a\xb1", + [0x3754] = "\x8d\xa3", [0x3756] = "\x92\x52", [0x3759] = "\x9a\xae", + [0x375a] = "\x92\xd8", [0x376f] = "\x9a\xb2", [0x3772] = "\x90\x82", + [0x3778] = "\x9a\xb0", [0x3779] = "\x9a\xb3", [0x377b] = "\x8c\x5e", + [0x3783] = "\x9a\xb4", [0x3790] = "\x9a\xb5", [0x3792] = "\x8d\x43", + [0x3793] = "\x8a\x5f", [0x3794] = "\x9a\xb7", [0x379a] = "\x9a\xb8", + [0x37a0] = "\x9a\xb9", [0x37a3] = "\x9a\xb6", [0x37b0] = "\x9a\xaf", + [0x37b3] = "\x9a\xba", [0x37b6] = "\x9a\xbb", [0x37bb] = "\x96\x84", + [0x37be] = "\x8f\xe9", [0x37c2] = "\x9a\xbd", [0x37c3] = "\x9a\xbe", + [0x37c4] = "\x9a\xbc", [0x37c6] = "\x9a\xc0", [0x37cc] = "\x94\x57", + [0x37cf] = "\x88\xe6", [0x37d0] = "\x95\x75", [0x37d3] = "\x9a\xc1", + [0x37e4] = "\x8f\xfb", [0x37e7] = "\x8e\xb7", [0x37e9] = "\x94\x7c", + [0x37ea] = "\x8a\xee", [0x37ec] = "\x8d\xe9", [0x37f0] = "\x96\x78", + [0x37f2] = "\x93\xb0", [0x37f5] = "\x8c\x98", [0x37f6] = "\x91\xcd", + [0x37fa] = "\x9a\xbf", [0x37fb] = "\x9a\xc2", [0x3805] = "\x91\xc2", + [0x3809] = "\x9a\xc3", [0x380d] = "\x9a\xc4", [0x3811] = "\x9a\xc6", + [0x3814] = "\x92\xe7", [0x381a] = "\x8a\xac", [0x381f] = "\xea\x9f", + [0x3820] = "\x89\x81", [0x3821] = "\x95\xf1", [0x3824] = "\x8f\xea", + [0x3825] = "\x93\x67", [0x382a] = "\x8d\xe4", [0x382d] = "\x9a\xcc", + [0x3830] = "\x95\xbb", [0x3831] = "\x97\xdb", [0x383a] = "\x89\xf2", + [0x383b] = "\x9a\xc8", [0x3841] = "\x91\x59", [0x3842] = "\x9a\xcb", + [0x3844] = "\x93\x83", [0x3847] = "\x93\x68", [0x3848] = "\x93\x84", + [0x3849] = "\x94\xb7", [0x384a] = "\x92\xcb", [0x384e] = "\x8d\xc7", + [0x3852] = "\x9a\xc7", [0x3859] = "\x89\x96", [0x385b] = "\x93\x55", + [0x3860] = "\x9a\xc9", [0x3862] = "\x9a\xc5", [0x3865] = "\x90\x6f", + [0x3869] = "\x9a\xcd", [0x386e] = "\x8f\x6d", [0x3873] = "\x8b\xab", + [0x3875] = "\x9a\xce", [0x3883] = "\x95\xe6", [0x3887] = "\x91\x9d", + [0x388c] = "\x92\xc4", [0x388f] = "\x9a\xd0", [0x3898] = "\x96\x6e", + [0x389b] = "\x9a\xd1", [0x389e] = "\x9a\xd6", [0x38a3] = "\x95\xad", + [0x38a8] = "\x9a\xd5", [0x38a9] = "\x9a\xcf", [0x38aa] = "\x9a\xd2", + [0x38ab] = "\x9a\xd4", [0x38ae] = "\x8d\xa4", [0x38b1] = "\x95\xc7", + [0x38b5] = "\x9a\xd7", [0x38b7] = "\x92\x64", [0x38ba] = "\x89\xf3", + [0x38bc] = "\x8f\xeb", [0x38c1] = "\x9a\xd9", [0x38c3] = "\x9a\xd8", + [0x38c5] = "\x8d\x88", [0x38c7] = "\x9a\xda", [0x38c8] = "\x9a\xdc", + [0x38c9] = "\x9a\xdb", [0x38cc] = "\x9a\xde", [0x38ce] = "\x9a\xd3", + [0x38cf] = "\x9a\xe0", [0x38d4] = "\x9a\xdf", [0x38d5] = "\x9a\xdd", + [0x38db] = "\x8e\x6d", [0x38dc] = "\x90\x70", [0x38de] = "\x91\x73", + [0x38df] = "\x9a\xe1", [0x38e0] = "\x90\xba", [0x38e1] = "\x88\xeb", + [0x38e2] = "\x94\x84", [0x38e7] = "\x92\xd9", [0x38e9] = "\x9a\xe3", + [0x38ea] = "\x9a\xe2", [0x38eb] = "\x9a\xe4", [0x38ec] = "\x9a\xe5", + [0x38ed] = "\x9a\xe6", [0x38f2] = "\x9a\xe7", [0x38f9] = "\x95\xcf", + [0x38fa] = "\x9a\xe8", [0x38ff] = "\x89\xc4", [0x3900] = "\x9a\xe9", + [0x3905] = "\x97\x5b", [0x3906] = "\x8a\x4f", [0x3908] = "\x99\xc7", + [0x3909] = "\x8f\x67", [0x390a] = "\x91\xbd", [0x390b] = "\x9a\xea", + [0x390c] = "\x96\xe9", [0x3912] = "\x96\xb2", [0x3915] = "\x9a\xec", + [0x3917] = "\x91\xe5", [0x3919] = "\x93\x56", [0x391a] = "\x91\xbe", + [0x391b] = "\x95\x76", [0x391c] = "\x9a\xed", [0x391d] = "\x9a\xee", + [0x391e] = "\x89\x9b", [0x3921] = "\x8e\xb8", [0x3922] = "\x9a\xef", + [0x3927] = "\x88\xce", [0x3928] = "\x9a\xf0", [0x392e] = "\x9a\xf1", + [0x3934] = "\x89\x82", [0x3937] = "\x8a\xef", [0x3938] = "\x93\xde", + [0x3939] = "\x95\xf2", [0x393e] = "\x9a\xf5", [0x393f] = "\x91\x74", + [0x3940] = "\x9a\xf4", [0x3941] = "\x8c\x5f", [0x3944] = "\x96\x7a", + [0x3945] = "\x9a\xf3", [0x3947] = "\x93\x85", [0x3948] = "\x9a\xf7", + [0x394a] = "\x9a\xf6", [0x3950] = "\x9a\xf9", [0x3952] = "\x9a\xf8", + [0x3955] = "\x89\x9c", [0x3957] = "\x9a\xfa", [0x3958] = "\x8f\xa7", + [0x3959] = "\x9a\xfc", [0x395a] = "\x92\x44", [0x395c] = "\x9a\xfb", + [0x395e] = "\x95\xb1", [0x3963] = "\x8f\x97", [0x3964] = "\x93\x7a", + [0x3968] = "\x9b\x40", [0x396d] = "\x8d\x44", [0x3971] = "\x9b\x41", + [0x3972] = "\x94\x40", [0x3973] = "\x94\xdc", [0x3974] = "\x96\xcf", + [0x397a] = "\x94\x44", [0x397d] = "\x9b\x4a", [0x3983] = "\x8b\x57", + [0x3986] = "\x97\x64", [0x3989] = "\x96\xad", [0x398b] = "\x9b\xaa", + [0x398d] = "\x9b\x42", [0x3993] = "\x9b\x45", [0x3995] = "\x91\xc3", + [0x3998] = "\x96\x57", [0x399c] = "\x93\x69", [0x39a2] = "\x9b\x46", + [0x39a9] = "\x96\x85", [0x39ab] = "\x8d\xc8", [0x39ae] = "\x8f\xa8", + [0x39b6] = "\x9b\x47", [0x39b9] = "\x8e\x6f", [0x39bb] = "\x8e\x6e", + [0x39c0] = "\x88\xb7", [0x39c1] = "\x8c\xc6", [0x39c3] = "\x90\xa9", + [0x39c4] = "\x88\xcf", [0x39c9] = "\x9b\x4b", [0x39ca] = "\x9b\x4c", + [0x39cc] = "\x9b\x49", [0x39d5] = "\x89\x57", [0x39d6] = "\x8a\xad", + [0x39d8] = "\x9b\x48", [0x39da] = "\x96\xc3", [0x39db] = "\x95\x50", + [0x39e6] = "\x88\xa6", [0x39eb] = "\x88\xf7", [0x39ef] = "\x8e\x70", + [0x39f1] = "\x88\xd0", [0x39f3] = "\x88\xa1", [0x39f9] = "\x9b\x51", + [0x3a01] = "\x9b\x4f", [0x3a08] = "\x96\xba", [0x3a0a] = "\x9b\x52", + [0x3a0c] = "\x9b\x50", [0x3a0f] = "\x9b\x4e", [0x3a10] = "\x90\x50", + [0x3a15] = "\x9b\x4d", [0x3a19] = "\x95\xd8", [0x3a1f] = "\x8c\xe2", + [0x3a25] = "\x9b\x56", [0x3a26] = "\x9b\x57", [0x3a2c] = "\x8f\xa9", + [0x3a30] = "\x9b\x53", [0x3a31] = "\x98\x4b", [0x3a36] = "\x94\x6b", + [0x3a39] = "\x9b\x55", [0x3a4a] = "\x8d\xa5", [0x3a52] = "\x9b\x58", + [0x3a56] = "\x95\x77", [0x3a5a] = "\x9b\x59", [0x3a5c] = "\x9b\x54", + [0x3a6f] = "\x96\xb9", [0x3a82] = "\x94\x7d", [0x3a8a] = "\x9b\x5a", + [0x3a8b] = "\x95\x51", [0x3aac] = "\x9b\x5b", [0x3aad] = "\x9b\x5f", + [0x3aae] = "\x9b\x5c", [0x3ab1] = "\x89\xc5", [0x3ab2] = "\x9b\x5e", + [0x3ab9] = "\x8e\xb9", [0x3abb] = "\x9b\x5d", [0x3abc] = "\x8c\x99", + [0x3ac0] = "\x9b\x6b", [0x3ac6] = "\x9b\x64", [0x3ac7] = "\x9b\x61", + [0x3ad1] = "\x92\x84", [0x3ad3] = "\x9b\x60", [0x3ad6] = "\x9b\x62", + [0x3ad9] = "\x9b\x63", [0x3aea] = "\x9b\x65", [0x3aeb] = "\x9b\x66", + [0x3af9] = "\x8a\xf0", [0x3afb] = "\x9b\x68", [0x3afc] = "\x9b\x67", + [0x3b06] = "\x9b\x69", [0x3b12] = "\x8f\xec", [0x3b1a] = "\x9b\x6c", + [0x3b1c] = "\x92\xda", [0x3b20] = "\x89\x64", [0x3b22] = "\x9b\x6a", + [0x3b26] = "\x9b\x6d", [0x3b2e] = "\x9b\x6e", [0x3b30] = "\x9b\x71", + [0x3b33] = "\x9b\x6f", [0x3b35] = "\x9b\x70", [0x3b40] = "\x8e\x71", + [0x3b41] = "\x9b\x72", [0x3b44] = "\x8d\x45", [0x3b45] = "\x9b\x73", + [0x3b47] = "\x8e\x9a", [0x3b48] = "\x91\xb6", [0x3b4a] = "\x9b\x74", + [0x3b4b] = "\x9b\x75", [0x3b4c] = "\x8e\x79", [0x3b4d] = "\x8d\x46", + [0x3b4f] = "\x96\xd0", [0x3b53] = "\x8b\x47", [0x3b54] = "\x8c\xc7", + [0x3b55] = "\x9b\x76", [0x3b56] = "\x8a\x77", [0x3b59] = "\x9b\x77", + [0x3b5b] = "\x91\xb7", [0x3b60] = "\x9b\x78", [0x3b61] = "\x9b\xa1", + [0x3b63] = "\x9b\x79", [0x3b65] = "\x9b\x7a", [0x3b68] = "\x9b\x7b", + [0x3b6a] = "\x9b\x7d", [0x3b70] = "\x9b\x7e", [0x3b73] = "\x9b\x80", + [0x3b75] = "\x91\xee", [0x3b77] = "\x89\x46", [0x3b78] = "\x8e\xe7", + [0x3b79] = "\x88\xc0", [0x3b7b] = "\x91\x76", [0x3b7c] = "\x8a\xae", + [0x3b7d] = "\x8e\xb3", [0x3b7f] = "\x8d\x47", [0x3b85] = "\x93\x86", + [0x3b87] = "\x8f\x40", [0x3b88] = "\x8a\xaf", [0x3b89] = "\x92\x88", + [0x3b8a] = "\x92\xe8", [0x3b8b] = "\x88\xb6", [0x3b8c] = "\x8b\x58", + [0x3b8d] = "\x95\xf3", [0x3b8f] = "\x8e\xc0", [0x3b92] = "\x8b\x71", + [0x3b93] = "\x90\xe9", [0x3b94] = "\x8e\xba", [0x3b95] = "\x97\x47", + [0x3b96] = "\x9b\x81", [0x3b9e] = "\x8b\x7b", [0x3ba0] = "\x8d\xc9", + [0x3ba3] = "\x8a\x51", [0x3ba4] = "\x89\x83", [0x3ba5] = "\x8f\xaa", + [0x3ba6] = "\x89\xc6", [0x3ba8] = "\x9b\x82", [0x3ba9] = "\x97\x65", + [0x3baf] = "\x8f\x68", [0x3bb2] = "\x8e\xe2", [0x3bb3] = "\x9b\x83", + [0x3bb4] = "\x8a\xf1", [0x3bb5] = "\x93\xd0", [0x3bb6] = "\x96\xa7", + [0x3bb7] = "\x9b\x84", [0x3bb9] = "\x9b\x85", [0x3bbc] = "\x95\x78", + [0x3bc0] = "\x9b\x87", [0x3bc2] = "\x8a\xa6", [0x3bc3] = "\x8b\xf5", + [0x3bc4] = "\x9b\x86", [0x3bcb] = "\x8a\xb0", [0x3bcd] = "\x90\x51", + [0x3bce] = "\x9b\x8b", [0x3bcf] = "\x8e\x40", [0x3bd1] = "\x89\xc7", + [0x3bd2] = "\x9b\x8a", [0x3bd4] = "\x9b\x88", [0x3bd5] = "\x9b\x8c", + [0x3bd6] = "\x9b\x89", [0x3bd7] = "\x94\x4a", [0x3bd8] = "\x9e\xcb", + [0x3bd9] = "\x90\x52", [0x3bdb] = "\x9b\x8d", [0x3bde] = "\x97\xbe", + [0x3be0] = "\x9b\x8e", [0x3be3] = "\x9b\x90", [0x3be5] = "\x92\x9e", + [0x3be6] = "\x9b\x8f", [0x3be8] = "\x90\xa1", [0x3bea] = "\x8e\x9b", + [0x3bee] = "\x91\xce", [0x3bef] = "\x8e\xf5", [0x3bf1] = "\x95\x95", + [0x3bf2] = "\x90\xea", [0x3bf4] = "\x8e\xcb", [0x3bf5] = "\x9b\x91", + [0x3bf6] = "\x8f\xab", [0x3bf7] = "\x9b\x92", [0x3bf8] = "\x9b\x93", + [0x3bf9] = "\x88\xd1", [0x3bfa] = "\x91\xb8", [0x3bfb] = "\x90\x71", + [0x3bfd] = "\x9b\x94", [0x3bfe] = "\x93\xb1", [0x3bff] = "\x8f\xac", + [0x3c01] = "\x8f\xad", [0x3c03] = "\x9b\x95", [0x3c06] = "\x90\xeb", + [0x3c0a] = "\x8f\xae", [0x3c10] = "\x9b\x96", [0x3c12] = "\x9b\x97", + [0x3c14] = "\x96\xde", [0x3c18] = "\x9b\x98", [0x3c1d] = "\x8b\xc4", + [0x3c21] = "\x8f\x41", [0x3c28] = "\x9b\x99", [0x3c29] = "\x9b\x9a", + [0x3c2a] = "\x8e\xda", [0x3c2b] = "\x90\x4b", [0x3c2c] = "\x93\xf2", + [0x3c2d] = "\x90\x73", [0x3c2e] = "\x94\xf6", [0x3c2f] = "\x94\x41", + [0x3c30] = "\x8b\xc7", [0x3c31] = "\x9b\x9b", [0x3c35] = "\x8b\x8f", + [0x3c36] = "\x9b\x9c", [0x3c38] = "\x8b\xfc", [0x3c3a] = "\x93\xcd", + [0x3c3b] = "\x89\xae", [0x3c3d] = "\x8e\x72", [0x3c3e] = "\x9b\x9d", + [0x3c3f] = "\x9b\xa0", [0x3c40] = "\x9b\x9f", [0x3c41] = "\x8b\xfb", + [0x3c43] = "\x9b\x9e", [0x3c45] = "\x93\x57", [0x3c4e] = "\x91\xae", + [0x3c50] = "\x93\x6a", [0x3c51] = "\x8e\xc6", [0x3c54] = "\x91\x77", + [0x3c55] = "\x97\x9a", [0x3c5c] = "\x9b\xa2", [0x3c5e] = "\x9b\xa3", + [0x3c5f] = "\x93\xd4", [0x3c61] = "\x8e\x52", [0x3c66] = "\x9b\xa5", + [0x3c69] = "\x9b\xa6", [0x3c7c] = "\x9b\xa7", [0x3c80] = "\x8a\xf2", + [0x3c81] = "\x9b\xa8", [0x3c84] = "\x9b\xa9", [0x3c91] = "\x89\xaa", + [0x3c98] = "\x91\x5a", [0x3c99] = "\x8a\xe2", [0x3c9b] = "\x9b\xab", + [0x3c9c] = "\x96\xa6", [0x3ca1] = "\x91\xd0", [0x3ca3] = "\x8a\x78", + [0x3ca6] = "\x9b\xad", [0x3ca7] = "\x9b\xaf", [0x3ca8] = "\x8a\xdd", + [0x3cab] = "\x9b\xac", [0x3cac] = "\x9b\xae", [0x3cae] = "\x9b\xb1", + [0x3cb5] = "\x9b\xb0", [0x3cb7] = "\x9b\xb2", [0x3cc9] = "\x9b\xb3", + [0x3cd0] = "\x93\xbb", [0x3cd1] = "\x8b\xac", [0x3cd8] = "\x89\xe3", + [0x3cd9] = "\x9b\xb4", [0x3cda] = "\x9b\xb9", [0x3cdd] = "\x9b\xb7", + [0x3cdf] = "\x95\xf5", [0x3ce0] = "\x95\xf4", [0x3ce6] = "\x93\x87", + [0x3cea] = "\x9b\xb6", [0x3ceb] = "\x8f\x73", [0x3ced] = "\x9b\xb5", + [0x3cf7] = "\x90\x92", [0x3cfb] = "\x9b\xba", [0x3cfe] = "\x8d\xe8", + [0x3d01] = "\x9b\xc0", [0x3d04] = "\x9b\xc1", [0x3d05] = "\x9b\xbb", + [0x3d06] = "\x8a\x52", [0x3d07] = "\x9b\xbc", [0x3d08] = "\x9b\xc5", + [0x3d09] = "\x9b\xc4", [0x3d0a] = "\x9b\xc3", [0x3d0b] = "\x9b\xbf", + [0x3d0f] = "\x9b\xbe", [0x3d12] = "\x9b\xc2", [0x3d19] = "\x95\xf6", + [0x3d3b] = "\x9b\xc9", [0x3d3c] = "\x9b\xc6", [0x3d3e] = "\x9b\xc8", + [0x3d40] = "\x97\x92", [0x3d42] = "\x9b\xc7", [0x3d4c] = "\x9b\xbd", + [0x3d59] = "\x90\x93", [0x3d5c] = "\x9b\xca", [0x3d5f] = "\x8d\xb5", + [0x3d63] = "\x9b\xcb", [0x3d66] = "\x9b\xcc", [0x3d72] = "\x9b\xcf", + [0x3d74] = "\x9b\xce", [0x3d77] = "\x9b\xcd", [0x3d7b] = "\x93\x88", + [0x3d7c] = "\x9b\xb8", [0x3d80] = "\x9b\xd5", [0x3d8d] = "\x9b\xd1", + [0x3d92] = "\x9b\xd0", [0x3d9c] = "\x9b\xd2", [0x3d9e] = "\x9b\xd3", + [0x3da7] = "\x9b\xd6", [0x3daa] = "\x97\xe4", [0x3dac] = "\x9b\xd7", + [0x3dad] = "\x9b\xd4", [0x3db9] = "\x9b\xd8", [0x3dbc] = "\x8a\xde", + [0x3dbd] = "\x9b\xd9", [0x3dc2] = "\x9b\xdb", [0x3dc3] = "\x9b\xda", + [0x3dc6] = "\x9b\xdc", [0x3dcb] = "\x9b\xdd", [0x3dcd] = "\x90\xec", + [0x3dce] = "\x8f\x42", [0x3dd1] = "\x8f\x84", [0x3dd3] = "\x91\x83", + [0x3dd5] = "\x8d\x48", [0x3dd6] = "\x8d\xb6", [0x3dd7] = "\x8d\x49", + [0x3dd8] = "\x8b\x90", [0x3ddb] = "\x9b\xde", [0x3dde] = "\x8d\xb7", + [0x3de1] = "\x8c\xc8", [0x3de2] = "\x9b\xdf", [0x3de3] = "\x96\xa4", + [0x3de4] = "\x94\x62", [0x3de5] = "\x9b\xe0", [0x3de7] = "\x8d\x4a", + [0x3deb] = "\x8a\xaa", [0x3ded] = "\x92\x46", [0x3dee] = "\x8b\xd0", + [0x3df2] = "\x8e\x73", [0x3df3] = "\x95\x7a", [0x3df6] = "\x94\xbf", + [0x3dfb] = "\x9b\xe1", [0x3dfc] = "\x8a\xf3", [0x3e01] = "\x9b\xe4", + [0x3e06] = "\x92\x9f", [0x3e09] = "\x9b\xe3", [0x3e0a] = "\x9b\xe2", + [0x3e0b] = "\x9b\xe5", [0x3e0d] = "\x92\xe9", [0x3e15] = "\x90\x83", + [0x3e1b] = "\x8e\x74", [0x3e1d] = "\x90\xc8", [0x3e1f] = "\x91\xd1", + [0x3e20] = "\x8b\x41", [0x3e23] = "\x92\xa0", [0x3e26] = "\x9b\xe6", + [0x3e27] = "\x9b\xe7", [0x3e28] = "\x8f\xed", [0x3e2d] = "\x96\x58", + [0x3e30] = "\x9b\xea", [0x3e33] = "\x9b\xe9", [0x3e34] = "\x9b\xe8", + [0x3e35] = "\x95\x9d", [0x3e37] = "\x9b\xf1", [0x3e3c] = "\x96\x79", + [0x3e3e] = "\x9b\xeb", [0x3e44] = "\x9b\xed", [0x3e45] = "\x96\x8b", + [0x3e47] = "\x9b\xec", [0x3e4f] = "\x9b\xee", [0x3e51] = "\x94\xa6", + [0x3e52] = "\x9b\xef", [0x3e53] = "\x95\xbc", [0x3e54] = "\x9b\xf0", + [0x3e62] = "\x8a\xb1", [0x3e63] = "\x95\xbd", [0x3e64] = "\x94\x4e", + [0x3e65] = "\x9b\xf2", [0x3e66] = "\x9b\xf3", [0x3e68] = "\x8d\x4b", + [0x3e69] = "\x8a\xb2", [0x3e6a] = "\x9b\xf4", [0x3e6b] = "\x8c\xb6", + [0x3e6c] = "\x97\x63", [0x3e6d] = "\x97\x48", [0x3e6e] = "\x8a\xf4", + [0x3e6f] = "\x9b\xf6", [0x3e71] = "\x92\xa1", [0x3e73] = "\x8d\x4c", + [0x3e74] = "\x8f\xaf", [0x3e77] = "\x94\xdd", [0x3e7a] = "\x8f\xb0", + [0x3e7f] = "\x8f\x98", [0x3e85] = "\x92\xea", [0x3e86] = "\x95\xf7", + [0x3e87] = "\x93\x58", [0x3e8a] = "\x8d\x4d", [0x3e8c] = "\x95\x7b", + [0x3e90] = "\x9b\xf7", [0x3e96] = "\x93\x78", [0x3e97] = "\x8d\xc0", + [0x3e9b] = "\x8c\xc9", [0x3e9d] = "\x92\xeb", [0x3ea5] = "\x88\xc1", + [0x3ea6] = "\x8f\x8e", [0x3ea7] = "\x8d\x4e", [0x3ea8] = "\x97\x66", + [0x3eb1] = "\x9b\xf8", [0x3eb2] = "\x9b\xf9", [0x3eb3] = "\x94\x70", + [0x3eb8] = "\x9b\xfa", [0x3eb9] = "\x97\xf5", [0x3eba] = "\x98\x4c", + [0x3ebf] = "\x9b\xfc", [0x3ec0] = "\x9b\xfb", [0x3ec3] = "\x8a\x66", + [0x3ec6] = "\x9c\x40", [0x3eca] = "\x9c\x43", [0x3ecb] = "\x9c\x44", + [0x3ecd] = "\x9c\x42", [0x3ecf] = "\x95\x5f", [0x3ed0] = "\x8f\xb1", + [0x3ed1] = "\x9c\x46", [0x3ed2] = "\x9c\x45", [0x3ed3] = "\x9c\x41", + [0x3ed8] = "\x9c\x47", [0x3ed9] = "\x9c\x48", [0x3edc] = "\x9c\x49", + [0x3ee0] = "\x9c\x4c", [0x3ee1] = "\x9c\x4a", [0x3ee3] = "\x9c\x4b", + [0x3ee4] = "\x9c\x4d", [0x3ee6] = "\x89\x84", [0x3ee7] = "\x92\xec", + [0x3ee8] = "\x9c\x4e", [0x3eea] = "\x8c\x9a", [0x3eeb] = "\x89\xf4", + [0x3eec] = "\x94\x55", [0x3eee] = "\x9c\x4f", [0x3eef] = "\x93\xf9", + [0x3ef1] = "\x95\xd9", [0x3ef3] = "\x9c\x50", [0x3ef4] = "\x98\x4d", + [0x3ef9] = "\x9c\x51", [0x3efa] = "\x95\xbe", [0x3efb] = "\x9c\x54", + [0x3efc] = "\x98\x9f", [0x3efd] = "\x98\xaf", [0x3eff] = "\x8e\xae", + [0x3f00] = "\x93\xf3", [0x3f01] = "\x9c\x55", [0x3f03] = "\x8b\x7c", + [0x3f04] = "\x92\xa2", [0x3f05] = "\x88\xf8", [0x3f06] = "\x9c\x56", + [0x3f07] = "\x95\xa4", [0x3f08] = "\x8d\x4f", [0x3f0b] = "\x92\x6f", + [0x3f0f] = "\x92\xed", [0x3f15] = "\x96\xed", [0x3f16] = "\x8c\xb7", + [0x3f17] = "\x8c\xca", [0x3f19] = "\x9c\x57", [0x3f1d] = "\x9c\x58", + [0x3f1f] = "\x9c\x5e", [0x3f21] = "\x8e\xe3", [0x3f25] = "\x92\xa3", + [0x3f27] = "\x8b\xad", [0x3f28] = "\x9c\x59", [0x3f2c] = "\x95\x4a", + [0x3f2e] = "\x92\x65", [0x3f31] = "\x9c\x5a", [0x3f38] = "\x9c\x5b", + [0x3f3a] = "\x8b\xae", [0x3f3c] = "\x9c\x5c", [0x3f3e] = "\x9c\x5d", + [0x3f41] = "\x9c\x5f", [0x3f43] = "\x93\x96", [0x3f46] = "\x9c\x60", + [0x3f47] = "\x9c\x61", [0x3f49] = "\x9c\x62", [0x3f4c] = "\x9c\x53", + [0x3f4d] = "\x9c\x52", [0x3f51] = "\x9c\x63", [0x3f52] = "\x8c\x60", + [0x3f56] = "\x95\x46", [0x3f59] = "\x8d\xca", [0x3f5a] = "\x95\x56", + [0x3f5b] = "\x92\xa4", [0x3f5c] = "\x95\x6a", [0x3f5d] = "\x9c\x64", + [0x3f60] = "\x8f\xb2", [0x3f61] = "\x89\x65", [0x3f63] = "\x9c\x65", + [0x3f67] = "\x9c\x66", [0x3f69] = "\x96\xf0", [0x3f6c] = "\x94\xde", + [0x3f6f] = "\x9c\x69", [0x3f70] = "\x89\x9d", [0x3f71] = "\x90\xaa", + [0x3f72] = "\x9c\x68", [0x3f73] = "\x9c\x67", [0x3f74] = "\x8c\x61", + [0x3f75] = "\x91\xd2", [0x3f77] = "\x9c\x6d", [0x3f78] = "\x9c\x6b", + [0x3f7a] = "\x9c\x6a", [0x3f7b] = "\x97\xa5", [0x3f7c] = "\x8c\xe3", + [0x3f80] = "\x8f\x99", [0x3f81] = "\x9c\x6c", [0x3f82] = "\x93\x6b", + [0x3f83] = "\x8f\x5d", [0x3f87] = "\x93\xbe", [0x3f88] = "\x9c\x70", + [0x3f89] = "\x9c\x6f", [0x3f8e] = "\x9c\x6e", [0x3f90] = "\x9c\x71", + [0x3f91] = "\x8c\xe4", [0x3f98] = "\x9c\x72", [0x3f99] = "\x95\x9c", + [0x3f9a] = "\x8f\x7a", [0x3f9d] = "\x9c\x73", [0x3f9e] = "\x94\xf7", + [0x3fa3] = "\x93\xbf", [0x3fa4] = "\x92\xa5", [0x3fa9] = "\x93\x4f", + [0x3fac] = "\x9c\x74", [0x3fad] = "\x8b\x4a", [0x3fb3] = "\x90\x53", + [0x3fb5] = "\x95\x4b", [0x3fbc] = "\x8a\xf5", [0x3fbd] = "\x94\x45", + [0x3fc6] = "\x9c\x75", [0x3fc7] = "\x8e\x75", [0x3fc8] = "\x96\x59", + [0x3fc9] = "\x96\x5a", [0x3fcc] = "\x89\x9e", [0x3fcd] = "\x9c\x7a", + [0x3fd0] = "\x92\x89", [0x3fd4] = "\x9c\x77", [0x3fdb] = "\x89\xf5", + [0x3fe0] = "\x9c\xab", [0x3fe1] = "\x9c\x79", [0x3fe5] = "\x94\x4f", + [0x3fe8] = "\x9c\x78", [0x3feb] = "\x9c\x76", [0x3fed] = "\x8d\x9a", + [0x3fef] = "\x9c\x7c", [0x3ffe] = "\x9c\x83", [0x3fff] = "\x9c\x89", + [0x4000] = "\x9c\x81", [0x4002] = "\x93\x7b", [0x4005] = "\x9c\x86", + [0x4006] = "\x95\x7c", [0x4009] = "\x9c\x80", [0x400b] = "\x9c\x85", + [0x400c] = "\x97\xe5", [0x400d] = "\x8e\x76", [0x4010] = "\x91\xd3", + [0x4011] = "\x9c\x7d", [0x4015] = "\x8b\x7d", [0x4016] = "\x9c\x88", + [0x4017] = "\x90\xab", [0x4018] = "\x89\x85", [0x4019] = "\x9c\x82", + [0x401a] = "\x89\xf6", [0x401b] = "\x9c\x87", [0x401f] = "\x8b\xaf", + [0x4021] = "\x9c\x84", [0x402a] = "\x9c\x8a", [0x4031] = "\x9c\x8c", + [0x4032] = "\x9c\x96", [0x4033] = "\x9c\x94", [0x4036] = "\x9c\x91", + [0x403a] = "\x9c\x90", [0x403b] = "\x97\xf6", [0x403d] = "\x9c\x92", + [0x4040] = "\x8b\xb0", [0x4042] = "\x8d\x50", [0x4045] = "\x8f\x9a", + [0x4049] = "\x9c\x99", [0x404a] = "\x9c\x8b", [0x404f] = "\x9c\x8f", + [0x4050] = "\x9c\x7e", [0x4052] = "\x89\xf8", [0x4053] = "\x9c\x93", + [0x4054] = "\x9c\x95", [0x4055] = "\x92\x70", [0x4058] = "\x8d\xa6", + [0x4059] = "\x89\xb6", [0x405a] = "\x9c\x8d", [0x405b] = "\x9c\x98", + [0x405c] = "\x9c\x97", [0x405d] = "\x8b\xb1", [0x405f] = "\x91\xa7", + [0x4060] = "\x8a\x86", [0x4065] = "\x8c\x62", [0x4067] = "\x9c\x8e", + [0x4071] = "\x9c\x9a", [0x4073] = "\x9c\x9d", [0x4074] = "\x9c\x9f", + [0x4079] = "\x8e\xbb", [0x407b] = "\x9c\xa5", [0x407c] = "\x92\xee", + [0x407d] = "\x9c\x9b", [0x4082] = "\x9c\xa3", [0x4084] = "\x89\xf7", + [0x4086] = "\x9c\xa1", [0x4087] = "\x9c\xa2", [0x408a] = "\x9c\x9e", + [0x408b] = "\x9c\xa0", [0x408f] = "\x8c\xe5", [0x4090] = "\x97\x49", + [0x4093] = "\x8a\xb3", [0x4096] = "\x89\x78", [0x4097] = "\x9c\xa4", + [0x4099] = "\x94\x59", [0x409a] = "\x88\xab", [0x40a2] = "\x94\xdf", + [0x40a3] = "\x9c\x7b", [0x40a4] = "\x9c\xaa", [0x40a5] = "\x9c\xae", + [0x40a6] = "\x96\xe3", [0x40a8] = "\x9c\xa7", [0x40ac] = "\x93\x89", + [0x40ad] = "\x9c\xac", [0x40b5] = "\x8f\xee", [0x40b6] = "\x9c\xad", + [0x40b7] = "\x93\xd5", [0x40c1] = "\x98\x66", [0x40c3] = "\x9c\xa9", + [0x40c8] = "\x9c\xaf", [0x40ca] = "\x8d\x9b", [0x40cc] = "\x90\xc9", + [0x40cf] = "\x88\xd2", [0x40d0] = "\x9c\xa8", [0x40d1] = "\x9c\xa6", + [0x40d3] = "\x91\x79", [0x40d7] = "\x9c\x9c", [0x40d8] = "\x8e\x53", + [0x40e0] = "\x91\xc4", [0x40e1] = "\x9c\xbb", [0x40e3] = "\x91\x7a", + [0x40e4] = "\x9c\xb6", [0x40e6] = "\x9c\xb3", [0x40e7] = "\x9c\xb4", + [0x40e9] = "\x8e\xe4", [0x40ea] = "\x9c\xb7", [0x40eb] = "\x9c\xba", + [0x40f0] = "\x9c\xb5", [0x40f1] = "\x8f\x44", [0x40f3] = "\x9c\xb8", + [0x40f6] = "\x9c\xb2", [0x40f8] = "\x96\xfa", [0x40f9] = "\x96\xf9", + [0x40fd] = "\x9c\xbc", [0x40fe] = "\x9c\xbd", [0x40ff] = "\x88\xd3", + [0x4105] = "\x9c\xb1", [0x410a] = "\x8b\xf0", [0x410b] = "\x88\xa4", + [0x410f] = "\x8a\xb4", [0x4111] = "\x9c\xb9", [0x4117] = "\x9c\xc1", + [0x4118] = "\x9c\xc0", [0x411c] = "\x9c\xc5", [0x4124] = "\x9c\xc6", + [0x412c] = "\x9c\xc4", [0x412d] = "\x9c\xc7", [0x412e] = "\x9c\xbf", + [0x412f] = "\x9c\xc3", [0x4132] = "\x9c\xc8", [0x4134] = "\x9c\xc9", + [0x4137] = "\x9c\xbe", [0x4138] = "\x8e\x9c", [0x413a] = "\x9c\xc2", + [0x413b] = "\x91\xd4", [0x413c] = "\x8d\x51", [0x413d] = "\x9c\xb0", + [0x413e] = "\x90\x54", [0x4143] = "\x9c\xd6", [0x4145] = "\x95\xe7", + [0x4148] = "\x9c\xcc", [0x4149] = "\x9c\xcd", [0x414a] = "\x9c\xce", + [0x414d] = "\x9c\xd5", [0x414f] = "\x9c\xd4", [0x4152] = "\x96\x9d", + [0x4153] = "\x8a\xb5", [0x4155] = "\x9c\xd2", [0x4157] = "\x8c\x64", + [0x4158] = "\x8a\x53", [0x415b] = "\x9c\xcf", [0x415e] = "\x97\xb6", + [0x415f] = "\x9c\xd1", [0x4160] = "\x88\xd4", [0x4161] = "\x9c\xd3", + [0x4163] = "\x9c\xca", [0x4164] = "\x9c\xd0", [0x4165] = "\x9c\xd7", + [0x4166] = "\x8c\x63", [0x4167] = "\x9c\xcb", [0x416e] = "\x97\x7c", + [0x4172] = "\x97\x4a", [0x4177] = "\x9c\xda", [0x417a] = "\x9c\xde", + [0x417e] = "\x91\x9e", [0x4180] = "\x97\xf7", [0x4181] = "\x9c\xdf", + [0x4184] = "\x9c\xdc", [0x4186] = "\x9c\xd9", [0x4189] = "\x9c\xd8", + [0x418a] = "\x9c\xdd", [0x4194] = "\x95\xae", [0x4197] = "\x93\xb2", + [0x4199] = "\x8c\x65", [0x419b] = "\x9c\xe0", [0x419c] = "\x9c\xdb", + [0x419e] = "\x9c\xe1", [0x41a2] = "\x8c\x9b", [0x41a6] = "\x89\xaf", + [0x41aa] = "\x9c\xe9", [0x41ae] = "\x8a\xb6", [0x41b3] = "\x9c\xe7", + [0x41b6] = "\x9c\xe8", [0x41b7] = "\x8d\xa7", [0x41b8] = "\x9c\xe6", + [0x41b9] = "\x9c\xe4", [0x41ba] = "\x9c\xe3", [0x41bb] = "\x9c\xea", + [0x41bc] = "\x9c\xe2", [0x41bd] = "\x9c\xec", [0x41c0] = "\x89\xf9", + [0x41d3] = "\x9c\xee", [0x41d6] = "\x9c\xed", [0x41e2] = "\x92\xa6", + [0x41e4] = "\x9c\xf1", [0x41e6] = "\x9c\xef", [0x41e7] = "\x9c\xe5", + [0x41e8] = "\x8c\x9c", [0x41ea] = "\x9c\xf0", [0x41ec] = "\x9c\xf4", + [0x41ed] = "\x9c\xf3", [0x41ee] = "\x9c\xf5", [0x41ef] = "\x9c\xf2", + [0x41f0] = "\x9c\xf6", [0x41f8] = "\x9c\xf7", [0x41f9] = "\x9c\xf8", + [0x41fa] = "\x95\xe8", [0x41fc] = "\x9c\xfa", [0x41fd] = "\x9c\xf9", + [0x41fe] = "\x8f\x5e", [0x4200] = "\x90\xac", [0x4201] = "\x89\xe4", + [0x4202] = "\x89\xfa", [0x4204] = "\x9c\xfb", [0x4206] = "\x88\xbd", + [0x420a] = "\x90\xca", [0x420b] = "\x9c\xfc", [0x420d] = "\xe6\xc1", + [0x420e] = "\x9d\x40", [0x420f] = "\x8c\x81", [0x4211] = "\x9d\x41", + [0x4216] = "\x90\xed", [0x421a] = "\x9d\x42", [0x421e] = "\x9d\x43", + [0x421f] = "\x8b\x59", [0x4220] = "\x9d\x44", [0x4222] = "\x9d\x45", + [0x4223] = "\x9d\x46", [0x4224] = "\x91\xd5", [0x4228] = "\x8c\xcb", + [0x422b] = "\x96\xdf", [0x422f] = "\x96\x5b", [0x4230] = "\x8f\x8a", + [0x4231] = "\x9d\x47", [0x4237] = "\x90\xee", [0x4238] = "\xe7\xbb", + [0x4239] = "\x94\xe0", [0x423b] = "\x8e\xe8", [0x423d] = "\x8d\xcb", + [0x423e] = "\x9d\x48", [0x4243] = "\x91\xc5", [0x4245] = "\x95\xa5", + [0x4248] = "\x91\xef", [0x424b] = "\x9d\x4b", [0x424e] = "\x9d\x49", + [0x4250] = "\x9d\x4c", [0x4253] = "\x9d\x4a", [0x4258] = "\x9d\x4d", + [0x425e] = "\x95\xaf", [0x4261] = "\x88\xb5", [0x4266] = "\x95\x7d", + [0x4269] = "\x94\xe1", [0x426c] = "\x9d\x4e", [0x426e] = "\x9d\x51", + [0x426f] = "\x8f\xb3", [0x4270] = "\x8b\x5a", [0x4272] = "\x9d\x4f", + [0x4273] = "\x9d\x56", [0x4274] = "\x8f\xb4", [0x4279] = "\x9d\x50", + [0x427a] = "\x94\x63", [0x4281] = "\x97\x7d", [0x4282] = "\x9d\x52", + [0x4283] = "\x9d\x53", [0x4284] = "\x9d\x57", [0x4285] = "\x93\x8a", + [0x4286] = "\x9d\x54", [0x4287] = "\x8d\x52", [0x4288] = "\x90\xdc", + [0x428b] = "\x9d\x65", [0x428c] = "\x94\xb2", [0x428e] = "\x91\xf0", + [0x429b] = "\x94\xe2", [0x429c] = "\x9d\xab", [0x42a1] = "\x95\xf8", + [0x42a5] = "\x92\xef", [0x42a9] = "\x96\x95", [0x42ab] = "\x9d\x5a", + [0x42ac] = "\x89\x9f", [0x42ad] = "\x92\x8a", [0x42b2] = "\x9d\x63", + [0x42b5] = "\x92\x53", [0x42b6] = "\x9d\x5d", [0x42b7] = "\x9d\x64", + [0x42b8] = "\x9d\x5f", [0x42b9] = "\x9d\x66", [0x42ba] = "\x9d\x62", + [0x42bc] = "\x9d\x61", [0x42bd] = "\x94\x8f", [0x42bf] = "\x9d\x5b", + [0x42c0] = "\x89\xfb", [0x42c1] = "\x9d\x59", [0x42c2] = "\x8b\x91", + [0x42c3] = "\x91\xf1", [0x42c4] = "\x9d\x55", [0x42c7] = "\x9d\x58", + [0x42c8] = "\x8d\x53", [0x42c9] = "\x90\xd9", [0x42cb] = "\x8f\xb5", + [0x42cc] = "\x9d\x60", [0x42cd] = "\x94\x71", [0x42d0] = "\x8b\x92", + [0x42d1] = "\x8a\x67", [0x42dc] = "\x8a\x87", [0x42dd] = "\x90\x40", + [0x42de] = "\x9d\x68", [0x42df] = "\x9d\x6d", [0x42e1] = "\x9d\x69", + [0x42e3] = "\x8c\x9d", [0x42e5] = "\x9d\x6e", [0x42e6] = "\x8e\x41", + [0x42e7] = "\x8d\x89", [0x42ee] = "\x8f\x45", [0x42ef] = "\x9d\x5c", + [0x42f1] = "\x8e\x9d", [0x42f2] = "\x9d\x6b", [0x42f7] = "\x8e\x77", + [0x42f8] = "\x9d\x6c", [0x42f9] = "\x88\xc2", [0x42fc] = "\x9d\x67", + [0x4301] = "\x92\xa7", [0x4309] = "\x8b\x93", [0x430f] = "\x8b\xb2", + [0x4317] = "\x9d\x6a", [0x4318] = "\x88\xa5", [0x431b] = "\x8d\xc1", + [0x431f] = "\x90\x55", [0x432a] = "\x92\xf0", [0x432d] = "\x94\xd2", + [0x432e] = "\x9d\x70", [0x432f] = "\x91\x7d", [0x4339] = "\x91\xa8", + [0x433c] = "\x8e\x4a", [0x433d] = "\x9d\x71", [0x433f] = "\x9d\x73", + [0x4340] = "\x9d\x6f", [0x4345] = "\x95\xdf", [0x4347] = "\x92\xbb", + [0x434c] = "\x91\x7b", [0x4357] = "\x95\xf9", [0x4358] = "\x8e\xcc", + [0x4359] = "\x9d\x80", [0x435b] = "\x9d\x7e", [0x435e] = "\x90\x98", + [0x4362] = "\x8c\x9e", [0x4366] = "\x9d\x78", [0x4367] = "\x8f\xb7", + [0x436a] = "\x93\xe6", [0x436b] = "\x94\x50", [0x4370] = "\x9d\x76", + [0x4373] = "\x91\x7c", [0x4378] = "\x8e\xf6", [0x4379] = "\x9d\x7b", + [0x437c] = "\x8f\xb6", [0x437e] = "\x9d\x75", [0x437f] = "\x9d\x7a", + [0x4382] = "\x94\x72", [0x4386] = "\x9d\x74", [0x4388] = "\x8c\x40", + [0x438b] = "\x8a\x7c", [0x438f] = "\x9d\x7c", [0x4390] = "\x97\xa9", + [0x4391] = "\x8d\xcc", [0x4392] = "\x92\x54", [0x4393] = "\x9d\x79", + [0x4395] = "\x90\xda", [0x4397] = "\x8d\x54", [0x4398] = "\x90\x84", + [0x4399] = "\x89\x86", [0x439a] = "\x91\x5b", [0x439b] = "\x9d\x77", + [0x439c] = "\x8b\x64", [0x43a2] = "\x8c\x66", [0x43a4] = "\x92\xcd", + [0x43a5] = "\x9d\x7d", [0x43ab] = "\x91\x7e", [0x43ae] = "\x9d\x81", + [0x43b0] = "\x9d\x83", [0x43b3] = "\x91\xb5", [0x43b4] = "\x9d\x89", + [0x43b6] = "\x9d\x84", [0x43b9] = "\x9d\x86", [0x43bf] = "\x95\x60", + [0x43c0] = "\x92\xf1", [0x43c2] = "\x9d\x87", [0x43c6] = "\x97\x4b", + [0x43ca] = "\x97\x67", [0x43cb] = "\x8a\xb7", [0x43d1] = "\x88\xac", + [0x43d3] = "\x9d\x85", [0x43d9] = "\x9d\x82", [0x43de] = "\x8a\xf6", + [0x43e4] = "\x89\x87", [0x43e6] = "\x9d\x88", [0x43ea] = "\x97\x68", + [0x43f6] = "\x9d\x8c", [0x43fd] = "\x91\xb9", [0x43ff] = "\x9d\x93", + [0x4403] = "\x9d\x8d", [0x4406] = "\x9d\x8a", [0x4407] = "\x9d\x91", + [0x440c] = "\x9d\x72", [0x4416] = "\x9d\x8e", [0x4418] = "\x9d\x92", + [0x441c] = "\x94\xc0", [0x441d] = "\x93\x8b", [0x4424] = "\x9d\x8b", + [0x4426] = "\x9d\x8f", [0x442a] = "\x8c\x67", [0x442e] = "\x8d\xef", + [0x4432] = "\x90\xdb", [0x443e] = "\x9d\x97", [0x4448] = "\x93\x45", + [0x4457] = "\x9d\x94", [0x4459] = "\x96\x80", [0x445f] = "\x9d\x95", + [0x4466] = "\x9d\x96", [0x4468] = "\x96\xcc", [0x446a] = "\x90\xa0", + [0x4473] = "\x8c\x82", [0x4478] = "\x9d\x9d", [0x4482] = "\x8e\x54", + [0x4483] = "\x9d\x9a", [0x4485] = "\x9d\x99", [0x448a] = "\x94\x51", + [0x448e] = "\x93\xb3", [0x4494] = "\x93\x50", [0x4495] = "\x9d\x9b", + [0x4499] = "\x9d\x9c", [0x449b] = "\x95\x8f", [0x449d] = "\x94\x64", + [0x449e] = "\x8e\x42", [0x44a0] = "\x90\xef", [0x44a2] = "\x96\x6f", + [0x44a9] = "\x8a\x68", [0x44ab] = "\x9d\xa3", [0x44ac] = "\x9d\x9e", + [0x44b1] = "\x97\x69", [0x44b2] = "\x9d\xa5", [0x44b5] = "\x9d\xa1", + [0x44b7] = "\x9d\xa2", [0x44bd] = "\x91\x80", [0x44c2] = "\x9d\xa0", + [0x44c4] = "\x9d\x5e", [0x44c8] = "\x9d\xa4", [0x44ca] = "\x9d\x9f", + [0x44d0] = "\x9d\xa9", [0x44d1] = "\x9d\xaa", [0x44d2] = "\x93\x46", + [0x44d3] = "\x9d\xac", [0x44d6] = "\x8e\x43", [0x44d7] = "\x9d\xa7", + [0x44dc] = "\x8b\x5b", [0x44df] = "\x9d\xad", [0x44e1] = "\x9d\xa6", + [0x44e2] = "\x9d\xb1", [0x44e4] = "\x9d\xb0", [0x44e6] = "\x9d\xaf", + [0x44ea] = "\x9d\xb2", [0x44ed] = "\x9d\xb4", [0x44ee] = "\x8f\xef", + [0x44f0] = "\x9d\xb3", [0x44f5] = "\x9d\xb7", [0x4508] = "\x9d\xb5", + [0x450c] = "\x9d\xb6", [0x450d] = "\x9d\x90", [0x4513] = "\x9d\xb9", + [0x4514] = "\x9d\xb8", [0x451a] = "\x9d\x98", [0x451b] = "\x9d\xba", + [0x451c] = "\x9d\xae", [0x451f] = "\x8e\x78", [0x4524] = "\x9d\xbb", + [0x4525] = "\x9d\xbc", [0x4526] = "\x9d\xbe", [0x4527] = "\x9d\xbd", + [0x4528] = "\x9d\xbf", [0x4529] = "\x89\xfc", [0x452b] = "\x8d\x55", + [0x452e] = "\x95\xfa", [0x452f] = "\x90\xad", [0x4535] = "\x8c\xcc", + [0x4538] = "\x9d\xc1", [0x453d] = "\x9d\xc4", [0x453f] = "\x95\x71", + [0x4541] = "\x8b\x7e", [0x4545] = "\x9d\xc3", [0x4546] = "\x9d\xc2", + [0x4547] = "\x94\x73", [0x4548] = "\x9d\xc5", [0x4549] = "\x8b\xb3", + [0x454d] = "\x9d\xc7", [0x454e] = "\x9d\xc6", [0x4552] = "\x8a\xb8", + [0x4553] = "\x8e\x55", [0x4556] = "\x93\xd6", [0x455c] = "\x8c\x68", + [0x4560] = "\x90\x94", [0x4562] = "\x9d\xc8", [0x4564] = "\x90\xae", + [0x4565] = "\x93\x47", [0x4567] = "\x95\x7e", [0x4568] = "\x9d\xc9", + [0x4572] = "\x9d\xca", [0x4573] = "\x9d\xcb", [0x4577] = "\x95\xb6", + [0x4578] = "\x9b\x7c", [0x4579] = "\x90\xc4", [0x457c] = "\x95\x6b", + [0x457e] = "\x8d\xd6", [0x4580] = "\x94\xe3", [0x4581] = "\x94\xc1", + [0x4587] = "\x93\x6c", [0x4589] = "\x97\xbf", [0x458b] = "\x9d\xcd", + [0x458c] = "\x8e\xce", [0x458f] = "\x9d\xce", [0x4591] = "\x88\xb4", + [0x4594] = "\x8b\xd2", [0x4595] = "\x90\xcb", [0x4597] = "\x95\x80", + [0x459b] = "\x9d\xcf", [0x459c] = "\x8e\x61", [0x459d] = "\x92\x66", + [0x459f] = "\x8e\x7a", [0x45a0] = "\x90\x56", [0x45a7] = "\x9d\xd0", + [0x45a9] = "\x95\xfb", [0x45ac] = "\x89\x97", [0x45ad] = "\x8e\x7b", + [0x45b1] = "\x9d\xd3", [0x45b3] = "\x9d\xd1", [0x45b4] = "\x9d\xd4", + [0x45b5] = "\x97\xb7", [0x45b6] = "\x9d\xd2", [0x45bb] = "\x90\xf9", + [0x45bc] = "\x9d\xd5", [0x45bf] = "\x91\xb0", [0x45c2] = "\x9d\xd6", + [0x45c7] = "\x8a\xf8", [0x45c9] = "\x9d\xd8", [0x45cb] = "\x9d\xd7", + [0x45d0] = "\x9d\xd9", [0x45d1] = "\x9d\xda", [0x45d2] = "\x8a\xf9", + [0x45d5] = "\x93\xfa", [0x45d6] = "\x92\x55", [0x45d7] = "\x8b\x8c", + [0x45d8] = "\x8e\x7c", [0x45d9] = "\x91\x81", [0x45dc] = "\x8f\x7b", + [0x45dd] = "\x88\xae", [0x45e1] = "\x9d\xdb", [0x45ea] = "\x89\xa0", + [0x45eb] = "\x9d\xdf", [0x45f2] = "\x8d\x56", [0x45f3] = "\x9d\xde", + [0x45f6] = "\x8d\xa9", [0x45f7] = "\x8f\xb8", [0x45fa] = "\x9d\xdd", + [0x45fc] = "\x8f\xb9", [0x45fe] = "\x96\xbe", [0x45ff] = "\x8d\xa8", + [0x4603] = "\x88\xd5", [0x4604] = "\x90\xcc", [0x460c] = "\x9d\xe4", + [0x460f] = "\x90\xaf", [0x4610] = "\x89\x66", [0x4615] = "\x8f\x74", + [0x4617] = "\x96\x86", [0x4618] = "\x8d\xf0", [0x461d] = "\x8f\xba", + [0x461f] = "\x90\xa5", [0x4624] = "\x9d\xe3", [0x4625] = "\x9d\xe1", + [0x4626] = "\x9d\xe2", [0x462c] = "\x92\x8b", [0x462f] = "\x9e\x45", + [0x4631] = "\x9d\xe8", [0x4632] = "\x8e\x9e", [0x4633] = "\x8d\x57", + [0x4634] = "\x9d\xe6", [0x4639] = "\x9d\xe7", [0x463b] = "\x90\x57", + [0x463f] = "\x9d\xe5", [0x4642] = "\x8e\x4e", [0x464d] = "\x9d\xea", + [0x464e] = "\x9d\xe9", [0x464f] = "\x9d\xee", [0x4652] = "\x9d\xef", + [0x4654] = "\x9d\xeb", [0x4656] = "\x8a\x41", [0x4657] = "\x9d\xec", + [0x4658] = "\x9d\xed", [0x4659] = "\x94\xd3", [0x465e] = "\x95\x81", + [0x465f] = "\x8c\x69", [0x4660] = "\x9d\xf0", [0x4664] = "\x90\xb0", + [0x4666] = "\x8f\xbb", [0x466a] = "\x92\x71", [0x4671] = "\x8b\xc5", + [0x4673] = "\x9d\xf1", [0x4674] = "\x9d\xf5", [0x4677] = "\x89\xc9", + [0x4678] = "\x9d\xf2", [0x4679] = "\x9d\xf4", [0x467e] = "\x9d\xf3", + [0x4681] = "\x8f\x8b", [0x4686] = "\x92\x67", [0x4687] = "\x88\xc3", + [0x4688] = "\x9d\xf6", [0x468d] = "\x9d\xf7", [0x4692] = "\x92\xa8", + [0x4696] = "\x97\xef", [0x469b] = "\x8e\x62", [0x469e] = "\x95\xe9", + [0x46a4] = "\x96\x5c", [0x46a8] = "\x9e\x41", [0x46a9] = "\x9d\xf9", + [0x46ac] = "\x9d\xfc", [0x46ae] = "\x9d\xfb", [0x46b1] = "\x9d\xf8", + [0x46b4] = "\x9e\x40", [0x46b7] = "\x93\xdc", [0x46b9] = "\x9d\xfa", + [0x46c6] = "\x9e\x42", [0x46c9] = "\x8f\x8c", [0x46ca] = "\x9e\x43", + [0x46cc] = "\x97\x6a", [0x46cd] = "\x94\x98", [0x46d0] = "\x9e\x44", + [0x46d6] = "\x9e\x46", [0x46d9] = "\x9e\x47", [0x46e0] = "\x9e\x48", + [0x46e2] = "\x8b\xc8", [0x46e3] = "\x89\x67", [0x46e4] = "\x8d\x58", + [0x46e5] = "\x9e\x49", [0x46e7] = "\x9e\x4a", [0x46e8] = "\x8f\x91", + [0x46e9] = "\x91\x82", [0x46ec] = "\x99\xd6", [0x46ed] = "\x91\x5d", + [0x46ee] = "\x91\x5c", [0x46ef] = "\x91\xd6", [0x46f0] = "\x8d\xc5", + [0x46f3] = "\x98\xf0", [0x46f8] = "\x8c\x8e", [0x46f9] = "\x97\x4c", + [0x46fb] = "\x95\xfc", [0x46fd] = "\x95\x9e", [0x46ff] = "\x9e\x4b", + [0x4704] = "\x8d\xf1", [0x4705] = "\x92\xbd", [0x4706] = "\x9e\x4c", + [0x4707] = "\x98\x4e", [0x470b] = "\x96\x5d", [0x470d] = "\x92\xa9", + [0x470e] = "\x9e\x4d", [0x470f] = "\x8a\xfa", [0x4716] = "\x9e\x4e", + [0x4717] = "\x9e\x4f", [0x4718] = "\x96\xd8", [0x471a] = "\x96\xa2", + [0x471b] = "\x96\x96", [0x471c] = "\x96\x7b", [0x471d] = "\x8e\x44", + [0x471e] = "\x9e\x51", [0x4721] = "\x8e\xe9", [0x4724] = "\x96\x70", + [0x4726] = "\x9e\x53", [0x4727] = "\x9e\x56", [0x4728] = "\x9e\x55", + [0x472a] = "\x8a\xf7", [0x472d] = "\x8b\x80", [0x472f] = "\x9e\x52", + [0x4731] = "\x9e\x54", [0x4736] = "\x9e\x57", [0x4739] = "\x90\x99", + [0x473e] = "\x97\x9b", [0x473f] = "\x88\xc7", [0x4740] = "\x8d\xde", + [0x4741] = "\x91\xba", [0x4743] = "\x8e\xdb", [0x4746] = "\x8f\xf1", + [0x4749] = "\x9e\x5a", [0x474c] = "\x93\x6d", [0x474e] = "\x9e\x58", + [0x474f] = "\x91\xa9", [0x4750] = "\x9e\x59", [0x4751] = "\x8f\xf0", + [0x4752] = "\x96\xdb", [0x4753] = "\x9e\x5b", [0x4754] = "\x9e\x5c", + [0x4755] = "\x97\x88", [0x475a] = "\x9e\x61", [0x475d] = "\x8d\x59", + [0x475f] = "\x94\x74", [0x4760] = "\x9e\x5e", [0x4761] = "\x93\x8c", + [0x4762] = "\x9d\xdc", [0x4763] = "\x9d\xe0", [0x4765] = "\x8b\x6e", + [0x4767] = "\x94\x66", [0x476c] = "\x9e\x60", [0x476e] = "\x8f\xbc", + [0x476f] = "\x94\xc2", [0x4775] = "\x9e\x66", [0x4777] = "\x94\xf8", + [0x4779] = "\x9e\x5d", [0x477b] = "\x9e\x63", [0x477c] = "\x9e\x62", + [0x4780] = "\x90\xcd", [0x4785] = "\x96\x8d", [0x4787] = "\x97\xd1", + [0x478a] = "\x96\x87", [0x478c] = "\x89\xca", [0x478d] = "\x8e\x7d", + [0x4790] = "\x98\x67", [0x4791] = "\x9e\x65", [0x4792] = "\x90\x95", + [0x4796] = "\x9e\x64", [0x4799] = "\x9e\x5f", [0x479f] = "\x8c\xcd", + [0x47a3] = "\x9e\x6b", [0x47a4] = "\x9e\x69", [0x47a6] = "\x89\xcb", + [0x47a7] = "\x9e\x67", [0x47a8] = "\x9e\x6d", [0x47a9] = "\x9e\x73", + [0x47b1] = "\x91\xc6", [0x47b4] = "\x95\xbf", [0x47b6] = "\x9e\x75", + [0x47ba] = "\x95\x41", [0x47be] = "\x9e\x74", [0x47bf] = "\x94\x90", + [0x47c0] = "\x96\x5e", [0x47c1] = "\x8a\xb9", [0x47c3] = "\x90\xf5", + [0x47c4] = "\x8f\x5f", [0x47c8] = "\x92\xd1", [0x47ca] = "\x97\x4d", + [0x47cd] = "\x9e\x70", [0x47ce] = "\x9e\x6f", [0x47d2] = "\x9e\x71", + [0x47d4] = "\x9e\x6e", [0x47d7] = "\x9e\x76", [0x47d9] = "\x9e\x6c", + [0x47dc] = "\x9e\x6a", [0x47de] = "\x9e\x72", [0x47df] = "\x9e\x68", + [0x47e1] = "\x92\x8c", [0x47e3] = "\x96\xf6", [0x47e4] = "\x8e\xc4", + [0x47e5] = "\x8d\xf2", [0x47eb] = "\x8d\xb8", [0x47ee] = "\x96\x8f", + [0x47ef] = "\x8a\x60", [0x47f2] = "\x92\xcc", [0x47f3] = "\x93\xc8", + [0x47f4] = "\x89\x68", [0x4803] = "\x90\xf0", [0x4806] = "\x90\xb2", + [0x4807] = "\x8c\x49", [0x480e] = "\x9e\x78", [0x4811] = "\x8d\x5a", + [0x4812] = "\x8a\x9c", [0x4819] = "\x9e\x7a", [0x481a] = "\x8a\x94", + [0x481b] = "\x9e\x81", [0x4822] = "\x9e\x7d", [0x4824] = "\x90\xf1", + [0x4828] = "\x8a\x6a", [0x4829] = "\x8d\xaa", [0x482c] = "\x8a\x69", + [0x482d] = "\x8d\xcd", [0x4830] = "\x9e\x7b", [0x4831] = "\x8c\x85", + [0x4832] = "\x8c\x6a", [0x4833] = "\x93\x8d", [0x4836] = "\x9e\x79", + [0x4838] = "\x88\xc4", [0x483d] = "\x9e\x7c", [0x483e] = "\x9e\x7e", + [0x4840] = "\x8b\xcb", [0x4841] = "\x8c\x4b", [0x4843] = "\x8a\xba", + [0x4844] = "\x8b\x6a", [0x4849] = "\x9e\x82", [0x484c] = "\x8d\xf7", + [0x484d] = "\x96\x91", [0x484f] = "\x8e\x56", [0x4853] = "\x9e\x83", + [0x4857] = "\x95\x4f", [0x4864] = "\x9e\x8f", [0x4866] = "\x89\xb1", + [0x4867] = "\x9e\x84", [0x486e] = "\x9e\x95", [0x486f] = "\x9e\x85", + [0x4871] = "\x97\xc0", [0x4873] = "\x9e\x8c", [0x4875] = "\x94\x7e", + [0x487d] = "\x9e\x94", [0x487f] = "\x9e\x87", [0x4883] = "\x88\xb2", + [0x4884] = "\x9e\x89", [0x4887] = "\x8d\x5b", [0x488b] = "\x9e\x8b", + [0x488d] = "\x9e\x8a", [0x488f] = "\x9e\x86", [0x4890] = "\x9e\x91", + [0x4892] = "\x8f\xbd", [0x4896] = "\x9a\xeb", [0x4897] = "\x8c\xe6", + [0x4898] = "\x97\x9c", [0x489d] = "\x9e\x88", [0x489f] = "\x92\xf2", + [0x48a0] = "\x8a\x42", [0x48a1] = "\x8d\xab", [0x48a3] = "\x9e\x80", + [0x48a5] = "\x9e\x90", [0x48a6] = "\x8a\x81", [0x48a9] = "\x9e\x8e", + [0x48aa] = "\x9e\x92", [0x48ac] = "\x93\x8e", [0x48b4] = "\x8a\xfc", + [0x48b6] = "\x9e\xb0", [0x48b9] = "\x96\xc7", [0x48ba] = "\x9e\x97", + [0x48bb] = "\x8a\xfb", [0x48bd] = "\x9e\x9e", [0x48c2] = "\x96\x5f", + [0x48c4] = "\x9e\x9f", [0x48c5] = "\x9e\xa1", [0x48c7] = "\x9e\xa5", + [0x48c8] = "\x9e\x99", [0x48ca] = "\x92\x49", [0x48cf] = "\x93\x8f", + [0x48d0] = "\x9e\xa9", [0x48d1] = "\x9e\x9c", [0x48d3] = "\x9e\xa6", + [0x48d7] = "\x9e\xa0", [0x48de] = "\x90\x58", [0x48df] = "\x9e\xaa", + [0x48e2] = "\x90\xb1", [0x48e9] = "\x9e\xa8", [0x48ea] = "\x8a\xbb", + [0x48f0] = "\x98\x6f", [0x48f1] = "\x9e\x96", [0x48f4] = "\x9e\xa4", + [0x48f5] = "\x88\xd6", [0x48f8] = "\x9e\x98", [0x48fb] = "\x96\xb8", + [0x48fc] = "\x9e\x9d", [0x48fd] = "\x90\x41", [0x48fe] = "\x92\xc5", + [0x48ff] = "\x9e\x93", [0x4902] = "\x9e\xa3", [0x4909] = "\x90\x9a", + [0x490a] = "\x9e\xad", [0x490b] = "\x8a\x91", [0x490c] = "\x8c\x9f", + [0x4911] = "\x9e\xaf", [0x4912] = "\x9e\x9a", [0x4913] = "\x9e\xae", + [0x4915] = "\x9e\xa7", [0x4916] = "\x9e\x9b", [0x4918] = "\x9e\xab", + [0x491a] = "\x9e\xac", [0x4920] = "\x9e\xbd", [0x4924] = "\x93\xcc", + [0x4926] = "\x9e\xa2", [0x4929] = "\x9e\xb9", [0x492d] = "\x9e\xbb", + [0x492f] = "\x92\xd6", [0x493a] = "\x97\x6b", [0x4943] = "\x95\x96", + [0x4944] = "\x9e\xb6", [0x4945] = "\x91\xc8", [0x4949] = "\x9e\xbc", + [0x494a] = "\x91\x5e", [0x494c] = "\x9e\xb3", [0x494d] = "\x9e\xc0", + [0x494e] = "\x9e\xbf", [0x4950] = "\x93\xed", [0x4951] = "\x9e\xbe", + [0x4952] = "\x93\xe8", [0x495a] = "\x9e\xc2", [0x495b] = "\x9e\xb5", + [0x495d] = "\x8b\xc6", [0x495e] = "\x9e\xb8", [0x495f] = "\x8f\x7c", + [0x4963] = "\x94\x80", [0x4964] = "\x9e\xba", [0x4965] = "\x8b\xc9", + [0x4967] = "\x9e\xb2", [0x4968] = "\x9e\xb4", [0x4969] = "\x9e\xb1", + [0x496c] = "\x98\x4f", [0x496d] = "\x8a\x79", [0x496e] = "\x9e\xb7", + [0x4971] = "\x9e\xc1", [0x4972] = "\x8a\x54", [0x497a] = "\x8d\xe5", + [0x497e] = "\x89\x7c", [0x4981] = "\x9e\xd2", [0x4984] = "\x98\x50", + [0x4985] = "\x9e\xd5", [0x498b] = "\x90\x59", [0x498c] = "\x9e\xd4", + [0x4990] = "\x9e\xd3", [0x4997] = "\x9e\xd0", [0x499e] = "\x9e\xc4", + [0x49a1] = "\x9e\xe1", [0x49a2] = "\x9e\xc3", [0x49a4] = "\x9e\xd6", + [0x49ab] = "\x9e\xce", [0x49ae] = "\x9e\xc9", [0x49af] = "\x9e\xc6", + [0x49b1] = "\x9e\xc7", [0x49b3] = "\x9e\xcf", [0x49b7] = "\xea\xa0", + [0x49ba] = "\x9e\xcc", [0x49bb] = "\x8d\x5c", [0x49bc] = "\x92\xc6", + [0x49bd] = "\x91\x84", [0x49be] = "\x9e\xca", [0x49c0] = "\x9e\xc5", + [0x49c3] = "\x9e\xc8", [0x49c8] = "\x97\x6c", [0x49c9] = "\x96\x8a", + [0x49cd] = "\x9e\xcd", [0x49ce] = "\x9e\xd7", [0x49d7] = "\x9e\xdf", + [0x49d8] = "\x9e\xd8", [0x49db] = "\x9e\xe5", [0x49dd] = "\x9e\xe3", + [0x49e2] = "\x9e\xde", [0x49e9] = "\x9e\xdd", [0x49eb] = "\x92\xce", + [0x49ed] = "\x91\x85", [0x49ef] = "\x9e\xdb", [0x49f2] = "\x9e\xd9", + [0x49f5] = "\x9e\xe0", [0x49fa] = "\x9e\xe6", [0x49fb] = "\x94\xf3", + [0x49fc] = "\x9e\xec", [0x4a02] = "\x9e\xe7", [0x4a03] = "\x9e\xea", + [0x4a04] = "\x9e\xe4", [0x4a07] = "\x92\x94", [0x4a09] = "\x95\x57", + [0x4a0b] = "\x9e\xda", [0x4a0e] = "\x9e\xe2", [0x4a0f] = "\x8f\xbe", + [0x4a11] = "\x96\xcd", [0x4a12] = "\x9e\xf6", [0x4a13] = "\x9e\xe9", + [0x4a19] = "\x8c\xa0", [0x4a1a] = "\x89\xa1", [0x4a1b] = "\x8a\x7e", + [0x4a1e] = "\x9e\xd1", [0x4a25] = "\x8f\xbf", [0x4a26] = "\x9e\xee", + [0x4a28] = "\x9e\xf5", [0x4a29] = "\x8e\xf7", [0x4a2a] = "\x8a\x92", + [0x4a2d] = "\x92\x4d", [0x4a34] = "\x9e\xeb", [0x4a37] = "\x9e\xf0", + [0x4a38] = "\x9e\xf4", [0x4a3b] = "\x8b\xb4", [0x4a48] = "\x8b\x6b", + [0x4a49] = "\x9e\xf2", [0x4a4f] = "\x8b\x40", [0x4a51] = "\x93\xc9", + [0x4a52] = "\x9e\xf1", [0x4a56] = "\x9e\xf3", [0x4a62] = "\x9e\xed", + [0x4a68] = "\x9e\xef", [0x4a6f] = "\x8a\x80", [0x4a70] = "\x92\x68", + [0x4a74] = "\x9e\xfa", [0x4a7d] = "\x9e\xf8", [0x4a7e] = "\x8c\xe7", + [0x4a80] = "\x9e\xf7", [0x4a87] = "\x9f\x40", [0x4a8c] = "\x9e\x77", + [0x4a90] = "\x9e\xf9", [0x4a92] = "\x9e\xfb", [0x4a93] = "\x9e\xfc", + [0x4a9a] = "\x9f\x4b", [0x4a9c] = "\x9f\x47", [0x4a9e] = "\x9e\x8d", + [0x4aa3] = "\x9f\x46", [0x4aa8] = "\x9f\x45", [0x4aab] = "\x9f\x42", + [0x4ab1] = "\x9e\xe8", [0x4ab2] = "\x9f\x44", [0x4ab3] = "\x9f\x43", + [0x4ac1] = "\x9f\x49", [0x4ac3] = "\x98\x45", [0x4aca] = "\x9f\x4c", + [0x4acb] = "\x8b\xf9", [0x4ace] = "\x9f\x48", [0x4acf] = "\x9f\x4a", + [0x4ad8] = "\x94\xa5", [0x4ada] = "\x9f\x4d", [0x4aea] = "\x9f\x51", + [0x4aeb] = "\x9f\x4e", [0x4af4] = "\x97\x93", [0x4af5] = "\x9f\x4f", + [0x4afa] = "\x9e\xdc", [0x4b02] = "\x9f\x52", [0x4b06] = "\x9f\x53", + [0x4b0d] = "\x89\x54", [0x4b0f] = "\x9f\x55", [0x4b10] = "\x8c\x87", + [0x4b11] = "\x8e\x9f", [0x4b13] = "\x8b\xd3", [0x4b17] = "\x89\xa2", + [0x4b22] = "\x97\x7e", [0x4b27] = "\x9f\x57", [0x4b28] = "\x9f\x56", + [0x4b29] = "\x9f\x59", [0x4b2a] = "\x8b\x5c", [0x4b2d] = "\x8b\xd4", + [0x4b2e] = "\x8a\xbc", [0x4b33] = "\x9f\x5c", [0x4b37] = "\x9f\x5b", + [0x4b39] = "\x9f\x5d", [0x4b3c] = "\x89\xcc", [0x4b3e] = "\x92\x56", + [0x4b40] = "\x9f\x5e", [0x4b43] = "\x8a\xbd", [0x4b44] = "\x9f\x60", + [0x4b49] = "\x9f\x5f", [0x4b4b] = "\x9f\x61", [0x4b4f] = "\x9f\x62", + [0x4b51] = "\x9f\x63", [0x4b52] = "\x8e\x7e", [0x4b53] = "\x90\xb3", + [0x4b54] = "\x8d\x9f", [0x4b56] = "\x95\x90", [0x4b59] = "\x95\xe0", + [0x4b5a] = "\x98\x63", [0x4b5f] = "\x8e\x95", [0x4b63] = "\x8d\xce", + [0x4b64] = "\x97\xf0", [0x4b68] = "\x9f\x64", [0x4b69] = "\x9f\x65", + [0x4b6b] = "\x8e\x80", [0x4b6f] = "\x9f\x66", [0x4b70] = "\x9f\x67", + [0x4b73] = "\x9f\x69", [0x4b74] = "\x9f\x68", [0x4b76] = "\x96\x77", + [0x4b79] = "\x8f\x7d", [0x4b7a] = "\x8e\xea", [0x4b7b] = "\x8e\x63", + [0x4b7d] = "\x9f\x6a", [0x4b85] = "\x9f\x6c", [0x4b86] = "\x90\x42", + [0x4b88] = "\x9f\x6b", [0x4b8e] = "\x9f\x6d", [0x4b94] = "\x9f\x6e", + [0x4b9a] = "\x9f\x6f", [0x4b9b] = "\x9f\x70", [0x4b9f] = "\x9f\x71", + [0x4ba1] = "\x9f\x73", [0x4ba2] = "\x9f\x72", [0x4ba3] = "\x9f\x74", + [0x4ba4] = "\x89\xa3", [0x4ba5] = "\x92\x69", [0x4ba7] = "\x9f\x75", + [0x4baa] = "\x8e\x45", [0x4bab] = "\x8a\x6b", [0x4bac] = "\x9f\x76", + [0x4baf] = "\x93\x61", [0x4bb0] = "\x9a\xca", [0x4bb5] = "\x8b\x42", + [0x4bb6] = "\x9f\x77", [0x4bbb] = "\x9f\x78", [0x4bbd] = "\x95\xea", + [0x4bbe] = "\x96\x88", [0x4bc2] = "\x93\xc5", [0x4bc3] = "\x9f\x79", + [0x4bc4] = "\x94\xe4", [0x4bc8] = "\x94\xf9", [0x4bcb] = "\x96\xd1", + [0x4bcf] = "\x9f\x7a", [0x4bdb] = "\x9f\x7c", [0x4bdc] = "\x9f\x7b", + [0x4bdf] = "\x9f\x7e", [0x4be3] = "\x9f\x7d", [0x4bf8] = "\x9f\x81", + [0x4bff] = "\x8e\x81", [0x4c01] = "\x96\xaf", [0x4c03] = "\x9f\x82", + [0x4c04] = "\x9f\x83", [0x4c07] = "\x8b\x43", [0x4c0b] = "\x9f\x84", + [0x4c13] = "\x9f\x86", [0x4c14] = "\x9f\x85", [0x4c24] = "\x90\x85", + [0x4c27] = "\x95\x58", [0x4c28] = "\x89\x69", [0x4c2e] = "\x94\xc3", + [0x4c30] = "\x92\xf3", [0x4c31] = "\x8f\x60", [0x4c32] = "\x8b\x81", + [0x4c3e] = "\x94\xc4", [0x4c40] = "\x8e\xac", [0x4c45] = "\x9f\x88", + [0x4c47] = "\x8a\xbe", [0x4c4a] = "\x89\x98", [0x4c4d] = "\x93\xf0", + [0x4c4e] = "\x9f\x87", [0x4c4f] = "\x8d\x5d", [0x4c50] = "\x92\x72", + [0x4c52] = "\x9f\x89", [0x4c58] = "\x9f\x91", [0x4c5a] = "\x9f\x8a", + [0x4c60] = "\x91\xbf", [0x4c62] = "\x8b\x82", [0x4c63] = "\x9f\x92", + [0x4c6a] = "\x8c\x88", [0x4c6d] = "\x8b\x44", [0x4c6e] = "\x9f\x90", + [0x4c71] = "\x9f\x8e", [0x4c72] = "\x9f\x8b", [0x4c73] = "\x97\x80", + [0x4c78] = "\x92\xbe", [0x4c7c] = "\x93\xd7", [0x4c7d] = "\x9f\x8c", + [0x4c80] = "\x9f\x94", [0x4c82] = "\x9f\x93", [0x4c83] = "\x8c\x42", + [0x4c86] = "\x89\xab", [0x4c89] = "\x8d\xb9", [0x4c8a] = "\x9f\x8d", + [0x4c8b] = "\x9f\x8f", [0x4c91] = "\x96\x76", [0x4c92] = "\x91\xf2", + [0x4c9b] = "\x96\x97", [0x4c9e] = "\x9f\x9c", [0x4ca1] = "\x9f\x9d", + [0x4ca3] = "\x89\xcd", [0x4ca8] = "\x95\xa6", [0x4ca9] = "\x96\xfb", + [0x4caa] = "\x9f\x9f", [0x4cab] = "\x8e\xa1", [0x4cac] = "\x8f\xc0", + [0x4cad] = "\x9f\x98", [0x4cae] = "\x9f\x9e", [0x4caf] = "\x89\x88", + [0x4cb1] = "\x8b\xb5", [0x4cb4] = "\x9f\x95", [0x4cb5] = "\x9f\x9a", + [0x4cb9] = "\x90\xf2", [0x4cba] = "\x94\x91", [0x4cbc] = "\x94\xe5", + [0x4cc3] = "\x9f\x97", [0x4cc5] = "\x96\x40", [0x4cc7] = "\x9f\x99", + [0x4cc9] = "\x9f\xa2", [0x4ccb] = "\x9f\xa0", [0x4ccd] = "\x9f\x9b", + [0x4cd1] = "\x96\x41", [0x4cd2] = "\x94\x67", [0x4cd3] = "\x8b\x83", + [0x4cd5] = "\x93\x44", [0x4cd8] = "\x92\x8d", [0x4cda] = "\x9f\xa3", + [0x4cdf] = "\x9f\xa1", [0x4ce0] = "\x91\xd7", [0x4ce1] = "\x9f\x96", + [0x4ce3] = "\x89\x6a", [0x4cfb] = "\x97\x6d", [0x4cfc] = "\x9f\xae", + [0x4d02] = "\x9f\xad", [0x4d07] = "\x90\xf4", [0x4d09] = "\x9f\xaa", + [0x4d0b] = "\x97\x8c", [0x4d0e] = "\x93\xb4", [0x4d0f] = "\x9f\xa4", + [0x4d15] = "\x92\xc3", [0x4d19] = "\x89\x6b", [0x4d1a] = "\x8d\x5e", + [0x4d1b] = "\x9f\xa7", [0x4d22] = "\x8f\x46", [0x4d23] = "\x9f\xac", + [0x4d25] = "\x9f\xab", [0x4d26] = "\x9f\xa6", [0x4d28] = "\x9f\xa9", + [0x4d2b] = "\x8a\x88", [0x4d2d] = "\x9f\xa8", [0x4d2e] = "\x94\x68", + [0x4d31] = "\x97\xac", [0x4d34] = "\x8f\xf2", [0x4d35] = "\x90\xf3", + [0x4d49] = "\x9f\xb4", [0x4d4a] = "\x9f\xb2", [0x4d4c] = "\x95\x6c", + [0x4d53] = "\x9f\xaf", [0x4d54] = "\x9f\xb1", [0x4d56] = "\x89\x59", + [0x4d59] = "\x8d\x5f", [0x4d5a] = "\x98\x51", [0x4d5c] = "\x8a\x5c", + [0x4d5e] = "\x95\x82", [0x4d64] = "\x97\x81", [0x4d67] = "\x8a\x43", + [0x4d68] = "\x90\x5a", [0x4d69] = "\x9f\xb3", [0x4d75] = "\x9f\xb8", + [0x4d78] = "\x8f\xc1", [0x4d7c] = "\x97\x4f", [0x4d7e] = "\x9f\xb5", + [0x4d83] = "\x9f\xb0", [0x4d85] = "\x9f\xb6", [0x4d89] = "\x97\xdc", + [0x4d8b] = "\x93\x93", [0x4d8c] = "\x93\xc0", [0x4d9f] = "\x8a\x55", + [0x4da2] = "\x89\x74", [0x4da5] = "\x9f\xbc", [0x4da8] = "\x9f\xbf", + [0x4dac] = "\x97\xc1", [0x4db0] = "\x97\x84", [0x4db5] = "\x9f\xc6", + [0x4db6] = "\x9f\xc0", [0x4db7] = "\x9f\xbd", [0x4dbb] = "\x97\xd2", + [0x4dbc] = "\x9f\xc3", [0x4dc1] = "\x8f\x69", [0x4dc2] = "\x9f\xc5", + [0x4dc5] = "\x9f\xca", [0x4dc8] = "\x93\x91", [0x4dc9] = "\x9f\xc8", + [0x4dce] = "\x9f\xc2", [0x4dd1] = "\x92\x57", [0x4dd4] = "\x9f\xc9", + [0x4dd6] = "\x9f\xbe", [0x4dd8] = "\x9f\xc4", [0x4dda] = "\x9f\xcb", + [0x4ddb] = "\x88\xfa", [0x4ddc] = "\x9f\xc1", [0x4dde] = "\x9f\xcc", + [0x4de1] = "\x90\x5b", [0x4de3] = "\x8f\x7e", [0x4de5] = "\x95\xa3", + [0x4de7] = "\x8d\xac", [0x4de9] = "\x9f\xb9", [0x4dea] = "\x9f\xc7", + [0x4deb] = "\x93\x59", [0x4df5] = "\x90\xb4", [0x4df7] = "\x8a\x89", + [0x4df8] = "\x8d\xcf", [0x4df9] = "\x8f\xc2", [0x4dfa] = "\x9f\xbb", + [0x4dfb] = "\x8f\x61", [0x4e03] = "\x8c\x6b", [0x4e05] = "\x9f\xba", + [0x4e09] = "\x9f\xd0", [0x4e0a] = "\x8f\x8d", [0x4e0b] = "\x8c\xb8", + [0x4e0d] = "\x9f\xdf", [0x4e0f] = "\x9f\xd9", [0x4e10] = "\x8b\x94", + [0x4e11] = "\x93\x6e", [0x4e13] = "\x9f\xd4", [0x4e14] = "\x9f\xdd", + [0x4e15] = "\x88\xad", [0x4e16] = "\x89\x51", [0x4e19] = "\x89\xb7", + [0x4e1b] = "\x9f\xd6", [0x4e1c] = "\x91\xaa", [0x4e1d] = "\x9f\xcd", + [0x4e1e] = "\x9f\xcf", [0x4e1f] = "\x8d\x60", [0x4e28] = "\x9f\xe0", + [0x4e2a] = "\x9f\xdb", [0x4e2e] = "\x9f\xd3", [0x4e33] = "\x9f\xda", + [0x4e3a] = "\x96\xa9", [0x4e3d] = "\x9f\xd8", [0x4e3e] = "\x9f\xdc", + [0x4e46] = "\x8c\xce", [0x4e48] = "\x8f\xc3", [0x4e4b] = "\x92\x58", + [0x4e4f] = "\x9f\xd2", [0x4e57] = "\x97\x4e", [0x4e5b] = "\x9f\xd5", + [0x4e5e] = "\x9f\xce", [0x4e5f] = "\x93\x92", [0x4e62] = "\x9f\xd1", + [0x4e66] = "\x9f\xd7", [0x4e6e] = "\x98\x70", [0x4e6f] = "\x8e\xbc", + [0x4e70] = "\x96\x9e", [0x4e72] = "\x9f\xe1", [0x4e7c] = "\x94\xac", + [0x4e7f] = "\x9f\xed", [0x4e80] = "\x8c\xb9", [0x4e86] = "\x8f\x80", + [0x4e88] = "\x9f\xe3", [0x4e8c] = "\x97\xad", [0x4e8d] = "\x8d\x61", + [0x4e8f] = "\x9f\xf0", [0x4e92] = "\x88\xec", [0x4e95] = "\x9f\xee", + [0x4e9a] = "\x9f\xe2", [0x4e9f] = "\x9f\xe8", [0x4ea2] = "\x9f\xea", + [0x4ea6] = "\x97\x6e", [0x4ea7] = "\x9f\xe5", [0x4eaa] = "\x93\x4d", + [0x4ead] = "\x9f\xe7", [0x4eb2] = "\x9f\xef", [0x4eb4] = "\x9f\xe9", + [0x4eb5] = "\x96\xc5", [0x4eb9] = "\x9f\xe4", [0x4ebb] = "\x8e\xa0", + [0x4ebc] = "\x9f\xfc", [0x4ec1] = "\x8a\x8a", [0x4ec3] = "\x9f\xe6", + [0x4ec4] = "\x9f\xeb", [0x4ec5] = "\x9f\xec", [0x4ecd] = "\x91\xea", + [0x4ece] = "\x91\xd8", [0x4edc] = "\x9f\xf4", [0x4edf] = "\x9f\xfa", + [0x4ee2] = "\x9f\xf8", [0x4ee4] = "\x93\x48", [0x4ee7] = "\xe0\x42", + [0x4ee8] = "\x9f\xf5", [0x4eee] = "\x9f\xf6", [0x4eef] = "\x9f\xde", + [0x4ef1] = "\x8b\x99", [0x4ef2] = "\x95\x59", [0x4ef6] = "\x8e\xbd", + [0x4ef9] = "\x8d\x97", [0x4eff] = "\x98\x52", [0x4f01] = "\x9f\xf2", + [0x4f03] = "\xe0\x41", [0x4f04] = "\x89\x89", [0x4f05] = "\x91\x86", + [0x4f10] = "\x94\x99", [0x4f12] = "\x8a\xbf", [0x4f13] = "\x97\xf8", + [0x4f1b] = "\x96\x9f", [0x4f1c] = "\x92\xd0", [0x4f21] = "\x9f\xf9", + [0x4f22] = "\x9f\xfb", [0x4f28] = "\x91\x51", [0x4f2e] = "\xe0\x40", + [0x4f2f] = "\x9f\xf7", [0x4f31] = "\x9f\xf1", [0x4f35] = "\x8a\xc1", + [0x4f44] = "\x8c\x89", [0x4f48] = "\xe0\x4e", [0x4f4b] = "\xe0\x49", + [0x4f4c] = "\x90\xf6", [0x4f4f] = "\x8a\x83", [0x4f54] = "\x8f\x81", + [0x4f56] = "\xe0\x52", [0x4f5d] = "\xe0\x4b", [0x4f5e] = "\x92\xaa", + [0x4f5f] = "\xe0\x48", [0x4f60] = "\x92\xd7", [0x4f64] = "\xe0\x6b", + [0x4f68] = "\xe0\x45", [0x4f6a] = "\xe0\x44", [0x4f6c] = "\xe0\x4d", + [0x4f70] = "\xe0\x47", [0x4f71] = "\xe0\x46", [0x4f72] = "\xe0\x4c", + [0x4f74] = "\x90\x9f", [0x4f76] = "\xe0\x43", [0x4f7e] = "\xe0\x4f", + [0x4f81] = "\xe0\x50", [0x4f87] = "\x8a\xc0", [0x4f91] = "\xe0\x55", + [0x4f93] = "\xe0\x54", [0x4f94] = "\xe0\x56", [0x4f9a] = "\xe0\x59", + [0x4fa1] = "\x93\x62", [0x4fa3] = "\xe0\x53", [0x4fa9] = "\xe0\x57", + [0x4fb0] = "\x8c\x83", [0x4fb1] = "\x91\xf7", [0x4fb2] = "\xe0\x51", + [0x4fb3] = "\x94\x5a", [0x4fb6] = "\xe0\x58", [0x4fc4] = "\xe0\x5d", + [0x4fc5] = "\xe0\x5b", [0x4fc8] = "\xe0\x5e", [0x4fcb] = "\xe0\x61", + [0x4fcf] = "\xe0\x5a", [0x4fd0] = "\x8d\x8a", [0x4fd1] = "\x94\x47", + [0x4fd4] = "\x9f\xb7", [0x4fdb] = "\x97\x94", [0x4fdc] = "\xe0\x5c", + [0x4fde] = "\xe0\x60", [0x4fdf] = "\x91\xf3", [0x4fe1] = "\xe0\x5f", + [0x4fe3] = "\xe0\x4a", [0x4fe6] = "\xe8\x89", [0x4fea] = "\xe0\x64", + [0x4fee] = "\xe0\x68", [0x4ff1] = "\xe0\x66", [0x4ff9] = "\xe0\x62", + [0x4ffb] = "\xe0\x63", [0x4fff] = "\xe0\x67", [0x5001] = "\xe0\x65", + [0x5005] = "\x95\x6d", [0x5008] = "\xe0\x6d", [0x500a] = "\xe0\x6a", + [0x500b] = "\xe0\x69", [0x500d] = "\xe0\x6c", [0x500e] = "\x93\xd2", + [0x500f] = "\xe0\x6e", [0x5016] = "\x92\x95", [0x5017] = "\x91\xeb", + [0x501c] = "\x90\xa3", [0x5020] = "\xe0\x6f", [0x5022] = "\xe0\x71", + [0x502e] = "\xe0\x70", [0x503c] = "\x9f\xf3", [0x5041] = "\xe0\x72", + [0x5048] = "\x93\xe5", [0x5053] = "\xe0\x73", [0x505b] = "\x89\xce", + [0x505f] = "\x93\x94", [0x5060] = "\x8a\x44", [0x5068] = "\x8b\x84", + [0x506c] = "\x8e\xdc", [0x506d] = "\x8d\xd0", [0x5079] = "\x98\x46", + [0x507a] = "\x90\x86", [0x507e] = "\x89\x8a", [0x5082] = "\xe0\x75", + [0x5089] = "\xe0\x74", [0x509c] = "\xe0\x78", [0x509d] = "\x92\x59", + [0x509e] = "\xe0\x7b", [0x509f] = "\xe0\x76", [0x50a3] = "\xe0\x7a", + [0x50a8] = "\xe0\x79", [0x50a9] = "\x93\x5f", [0x50aa] = "\x88\xd7", + [0x50b8] = "\x97\xf3", [0x50bb] = "\xe0\x7d", [0x50bf] = "\x89\x47", + [0x50c9] = "\xe0\x80", [0x50cd] = "\xe0\x7e", [0x50cf] = "\xe0\x7c", + [0x50e1] = "\xe0\x77", [0x50e9] = "\x96\x42", [0x50ed] = "\xe0\x82", + [0x50f9] = "\xe0\x81", [0x5104] = "\x89\x8b", [0x5109] = "\xe0\x84", + [0x510a] = "\x95\xb0", [0x510c] = "\xe0\x83", [0x5111] = "\x96\xb3", + [0x5116] = "\x8f\xc5", [0x5126] = "\x91\x52", [0x512c] = "\x8f\xc4", + [0x5139] = "\x97\xf9", [0x513c] = "\xe0\x8a", [0x513e] = "\x90\xf7", + [0x5145] = "\xe0\x86", [0x5146] = "\xe0\x8b", [0x5149] = "\x89\x8c", + [0x5152] = "\xe0\x89", [0x5154] = "\x94\x81", [0x5155] = "\xe0\x85", + [0x5156] = "\xe0\x88", [0x5157] = "\x8f\xc6", [0x5159] = "\x94\xcf", + [0x515c] = "\xe0\x8c", [0x515e] = "\x8e\xcf", [0x516d] = "\x90\xf8", + [0x5174] = "\xe0\x8f", [0x5178] = "\xe0\x87", [0x517a] = "\x8c\x46", + [0x517f] = "\xe0\x8d", [0x5184] = "\x97\x6f", [0x5185] = "\xe0\x90", + [0x5189] = "\xea\xa4", [0x518f] = "\x8f\x6e", [0x5198] = "\xe0\x91", + [0x519c] = "\xe0\x92", [0x51a1] = "\x94\x4d", [0x51a9] = "\xe0\x94", + [0x51ae] = "\xe0\x95", [0x51b3] = "\x94\x52", [0x51b8] = "\x93\x95", + [0x51b9] = "\xe0\x97", [0x51be] = "\xe0\x99", [0x51c0] = "\x97\xd3", + [0x51c2] = "\xe0\x96", [0x51c4] = "\xe0\x98", [0x51c5] = "\x89\x8d", + [0x51c7] = "\xe0\x93", [0x51cf] = "\x9a\x7a", [0x51d0] = "\xe0\x9a", + [0x51d5] = "\x91\x87", [0x51d6] = "\x8e\x57", [0x51d7] = "\xe0\x9c", + [0x51dc] = "\xe0\x9b", [0x51dd] = "\x90\x43", [0x51de] = "\x99\xd7", + [0x51e5] = "\xe0\x9d", [0x51e9] = "\xe0\x9f", [0x51eb] = "\xe0\x8e", + [0x51ec] = "\xe0\x9e", [0x51ef] = "\xe0\xa0", [0x51f6] = "\x94\x9a", + [0x51fd] = "\xe0\xa1", [0x5200] = "\xe0\xa2", [0x520b] = "\xe0\xa3", + [0x5218] = "\xe0\xa4", [0x521a] = "\x92\xdc", [0x521c] = "\xe0\xa6", + [0x521d] = "\xe0\xa5", [0x5220] = "\xe0\xa7", [0x5222] = "\xe0\xa8", + [0x5225] = "\x8e\xdd", [0x5226] = "\x95\x83", [0x522a] = "\x96\xea", + [0x522b] = "\xe0\xa9", [0x522c] = "\xe0\xaa", [0x522d] = "\x91\x75", + [0x522e] = "\x8e\xa2", [0x522f] = "\xe0\xab", [0x5230] = "\xe0\xac", + [0x5236] = "\xe0\xad", [0x5237] = "\x95\xd0", [0x5238] = "\x94\xc5", + [0x523b] = "\xe0\xae", [0x523c] = "\x94\x76", [0x5242] = "\x92\xab", + [0x5248] = "\xe0\xaf", [0x5249] = "\x89\xe5", [0x524b] = "\x8b\x8d", + [0x524d] = "\x96\xc4", [0x524f] = "\x96\xb4", [0x5251] = "\x89\xb2", + [0x5252] = "\x98\x53", [0x5257] = "\x96\x71", [0x5259] = "\x95\xa8", + [0x5262] = "\x90\xb5", [0x5264] = "\xe0\xb0", [0x5269] = "\x93\xc1", + [0x526d] = "\x8c\xa1", [0x526e] = "\xe0\xb1", [0x5270] = "\x8d\xd2", + [0x5271] = "\xe0\xb3", [0x5272] = "\xe0\xb2", [0x5277] = "\xe0\xb4", + [0x5282] = "\xe0\xb5", [0x5286] = "\xe0\xb6", [0x5290] = "\x8b\x5d", + [0x5292] = "\xe0\xb7", [0x5297] = "\xe0\xb8", [0x529c] = "\x8c\xa2", + [0x529f] = "\x94\xc6", [0x52a2] = "\xe0\xba", [0x52a6] = "\x8f\xf3", + [0x52a9] = "\xe0\xb9", [0x52b2] = "\x8b\xb6", [0x52b3] = "\xe0\xbb", + [0x52b4] = "\xe0\xbd", [0x52b6] = "\xe0\xbc", [0x52be] = "\xe0\xbe", + [0x52c0] = "\x8c\xcf", [0x52c2] = "\xe0\xbf", [0x52c7] = "\x8b\xe7", + [0x52c9] = "\x91\x5f", [0x52cb] = "\x8d\x9d", [0x52d0] = "\xe0\xc1", + [0x52d1] = "\xe0\xc2", [0x52d2] = "\xe0\xc0", [0x52d9] = "\x8e\xeb", + [0x52dc] = "\x93\xc6", [0x52dd] = "\x8b\xb7", [0x52e7] = "\xe0\xc4", + [0x52e8] = "\x92\x4b", [0x52e9] = "\xe0\xc3", [0x52ec] = "\x98\x54", + [0x52ed] = "\x94\x82", [0x52fa] = "\xe0\xc7", [0x5306] = "\xe0\xc9", + [0x5307] = "\xe0\xc6", [0x530b] = "\x96\xd2", [0x530c] = "\xe0\xc8", + [0x530d] = "\xe0\xca", [0x530f] = "\x97\xc2", [0x5315] = "\xe0\xce", + [0x5319] = "\xe0\xcd", [0x531a] = "\x92\x96", [0x531b] = "\x94\x4c", + [0x531e] = "\x8c\xa3", [0x531f] = "\xe0\xcc", [0x5324] = "\xe0\xcb", + [0x5326] = "\x97\x50", [0x5327] = "\x97\x51", [0x532e] = "\xe0\xcf", + [0x532f] = "\x89\x8e", [0x5334] = "\x8d\x96", [0x5335] = "\x8e\x82", + [0x533e] = "\xe0\xd0", [0x533f] = "\xe0\xd1", [0x5347] = "\xe0\xd3", + [0x5353] = "\x8f\x62", [0x5358] = "\xe0\xd5", [0x535a] = "\xe0\xd4", + [0x5360] = "\xe0\xd6", [0x5362] = "\x8a\x6c", [0x5365] = "\xe0\xd8", + [0x5368] = "\xe0\xd7", [0x536a] = "\xe0\xda", [0x536b] = "\xe0\xd9", + [0x5374] = "\x8c\xba", [0x5377] = "\x97\xa6", [0x5379] = "\x8b\xca", + [0x537b] = "\x89\xa4", [0x5386] = "\x8b\xe8", [0x5399] = "\x8a\xdf", + [0x53a2] = "\x97\xe6", [0x53a3] = "\xe0\xdc", [0x53ab] = "\xe0\xde", + [0x53b0] = "\xe0\xdf", [0x53b2] = "\x89\xcf", [0x53b8] = "\xe0\xdb", + [0x53ba] = "\x8e\x58", [0x53bd] = "\x92\xbf", [0x53be] = "\xe0\xdd", + [0x53ce] = "\xe0\xe2", [0x53d0] = "\x8e\xec", [0x53d5] = "\xe0\xe0", + [0x53da] = "\x8c\x5d", [0x53dd] = "\x94\xc7", [0x53de] = "\xe0\xe1", + [0x53e1] = "\xe0\xfc", [0x53e8] = "\xe0\xe7", [0x53ee] = "\x8c\xbb", + [0x53f3] = "\x8b\x85", [0x53f5] = "\xe0\xe4", [0x53f6] = "\x97\x9d", + [0x53f9] = "\x97\xae", [0x5412] = "\x91\xf4", [0x5415] = "\xe0\xe6", + [0x5422] = "\xe0\xe8", [0x5423] = "\x97\xd4", [0x5424] = "\x8b\xd5", + [0x5425] = "\x94\xfa", [0x5426] = "\x94\x69", [0x542a] = "\xe0\xe9", + [0x542f] = "\xe0\xeb", [0x5431] = "\xe0\xee", [0x5445] = "\xe0\xea", + [0x5449] = "\xe0\xed", [0x544a] = "\x8c\xe8", [0x544b] = "\x89\x6c", + [0x544c] = "\xe0\xef", [0x544e] = "\x90\x90", [0x544f] = "\xe0\xec", + [0x5450] = "\x97\xda", [0x5453] = "\xe0\xf2", [0x5454] = "\xea\xa2", + [0x5459] = "\xe0\xf0", [0x545a] = "\xe0\xf3", [0x545f] = "\xe0\xe5", + [0x5460] = "\xe0\xf1", [0x5463] = "\x8d\xba", [0x5466] = "\xe0\xf4", + [0x546e] = "\xe0\xf5", [0x5473] = "\x97\x9e", [0x547b] = "\xe0\xf6", + [0x548e] = "\xe0\xf7", [0x5492] = "\xe0\xe3", [0x5497] = "\xe0\xf8", + [0x54a0] = "\x8a\xc2", [0x54ad] = "\x8e\xa3", [0x54ba] = "\xe0\xf9", + [0x54bf] = "\xe0\xfa", [0x54c4] = "\xe0\xfb", [0x54cc] = "\x89\x5a", + [0x54d0] = "\xe1\x40", [0x54d2] = "\x95\x5a", [0x54d3] = "\xe1\x41", + [0x54d6] = "\x8a\xa2", [0x54d7] = "\xe1\x42", [0x54d9] = "\xe1\x43", + [0x54de] = "\xe1\x44", [0x54e0] = "\xe1\x46", [0x54e1] = "\xe1\x47", + [0x54e2] = "\xe1\x45", [0x54e6] = "\x95\x72", [0x54e7] = "\xe1\x49", + [0x54e8] = "\xe1\x48", [0x54f3] = "\xe1\x4b", [0x54f4] = "\xe1\x4a", + [0x54f5] = "\xe1\x4c", [0x54fc] = "\xe1\x4d", [0x54fd] = "\xe1\x4f", + [0x54fe] = "\xe1\x4e", [0x5501] = "\x8d\x99", [0x5503] = "\xe1\x51", + [0x5505] = "\xe1\x50", [0x5508] = "\x8a\xc3", [0x550a] = "\x90\x72", + [0x550c] = "\x93\x5b", [0x550e] = "\xe1\x52", [0x550f] = "\x90\xb6", + [0x5513] = "\x8e\x59", [0x5515] = "\x89\x99", [0x5516] = "\xe1\x53", + [0x5518] = "\x97\x70", [0x551b] = "\x95\xe1", [0x551c] = "\xe1\x54", + [0x5520] = "\x93\x63", [0x5521] = "\x97\x52", [0x5522] = "\x8d\x62", + [0x5523] = "\x90\x5c", [0x5527] = "\x92\x6a", [0x5528] = "\x99\xb2", + [0x552a] = "\x92\xac", [0x552b] = "\x89\xe6", [0x552c] = "\xe1\x55", + [0x5534] = "\xe1\x56", [0x5536] = "\xe1\x5b", [0x5539] = "\xe1\x59", + [0x553a] = "\xe1\x58", [0x553b] = "\x9d\xc0", [0x553c] = "\x8a\x45", + [0x553d] = "\xe1\x57", [0x553f] = "\x88\xd8", [0x5541] = "\x94\xa8", + [0x5544] = "\x94\xc8", [0x5549] = "\x97\xaf", [0x554a] = "\xe1\x5c", + [0x554b] = "\xe1\x5a", [0x554c] = "\x92\x7b", [0x554d] = "\x90\xa4", + [0x5550] = "\x94\xa9", [0x5552] = "\x95\x4c", [0x5554] = "\xe1\x5e", + [0x5555] = "\x97\xaa", [0x5556] = "\x8c\x6c", [0x5557] = "\xe1\x5f", + [0x5559] = "\xe1\x5d", [0x555a] = "\x94\xd4", [0x555b] = "\xe1\x60", + [0x555d] = "\xe1\x61", [0x5560] = "\x88\xd9", [0x5563] = "\x8f\xf4", + [0x5564] = "\xe1\x66", [0x5566] = "\xe1\x63", [0x5567] = "\x93\xeb", + [0x5568] = "\xe1\x62", [0x556f] = "\x8b\x45", [0x5572] = "\xe1\x69", + [0x5576] = "\xe1\x64", [0x5577] = "\xe1\x65", [0x5579] = "\xe1\x68", + [0x557a] = "\xe1\x67", [0x557b] = "\x95\x44", [0x557e] = "\x91\x61", + [0x557f] = "\x91\x60", [0x5581] = "\x8b\x5e", [0x5584] = "\xe1\x6a", + [0x558a] = "\xe1\x6b", [0x558d] = "\xe1\x6c", [0x5593] = "\xe1\x6e", + [0x5595] = "\xe1\x6d", [0x559b] = "\x89\x75", [0x55a1] = "\xe1\x76", + [0x55a2] = "\x94\xe6", [0x55a3] = "\xe1\x70", [0x55a5] = "\xe1\x72", + [0x55a8] = "\xe1\x74", [0x55a9] = "\x90\x5d", [0x55ac] = "\xe1\x75", + [0x55ad] = "\xe1\x73", [0x55ae] = "\x8e\xbe", [0x55b2] = "\xe1\x6f", + [0x55b3] = "\xe1\x71", [0x55b5] = "\x95\x61", [0x55b7] = "\x8f\xc7", + [0x55ba] = "\xe1\x78", [0x55bd] = "\xe1\x77", [0x55c2] = "\xe1\x79", + [0x55c4] = "\x8e\xa4", [0x55c5] = "\x8d\xad", [0x55c8] = "\x93\x97", + [0x55c9] = "\xe1\x7a", [0x55cb] = "\x92\xc9", [0x55ce] = "\xe1\x7c", + [0x55d2] = "\x97\x9f", [0x55d3] = "\xe1\x7b", [0x55d9] = "\x91\x89", + [0x55e0] = "\xe1\x82", [0x55e2] = "\xe1\x84", [0x55e3] = "\xe1\x85", + [0x55e4] = "\x92\x73", [0x55ea] = "\xe1\x83", [0x55ec] = "\xe1\x80", + [0x55ee] = "\xe1\x7d", [0x55ef] = "\xe1\x7e", [0x55f1] = "\xe1\x81", + [0x55f9] = "\xe1\x88", [0x55fb] = "\xe1\x86", [0x55fd] = "\xe1\x87", + [0x560f] = "\xe1\x89", [0x5610] = "\xe1\x8b", [0x5611] = "\xe1\x8c", + [0x5612] = "\xe1\x8d", [0x5614] = "\xe1\x8e", [0x5617] = "\xe1\x8a", + [0x5620] = "\xe1\x90", [0x5624] = "\xe1\x8f", [0x562b] = "\xe1\x91", + [0x5632] = "\x97\xc3", [0x5636] = "\xe1\x94", [0x5637] = "\xe1\x92", + [0x5638] = "\xe1\x93", [0x563c] = "\x8a\xe0", [0x5642] = "\x96\xfc", + [0x5646] = "\x95\xc8", [0x5648] = "\xe1\x96", [0x564c] = "\xe1\x95", + [0x5651] = "\xe1\x97", [0x5652] = "\xe1\x98", [0x5657] = "\xe1\x9c", + [0x5658] = "\xe1\x99", [0x5659] = "\xe1\x9a", [0x565a] = "\xe1\x9b", + [0x565c] = "\xe1\x9d", [0x5660] = "\xe1\x9e", [0x5662] = "\xe1\x9f", + [0x5666] = "\xe1\xa0", [0x5668] = "\xe1\xa1", [0x566a] = "\x94\xad", + [0x566b] = "\x93\x6f", [0x566c] = "\xe1\xa2", [0x566d] = "\x94\x92", + [0x566e] = "\x95\x53", [0x5670] = "\xe1\xa3", [0x5673] = "\xe1\xa4", + [0x5674] = "\x93\x49", [0x5676] = "\x8a\x46", [0x5677] = "\x8d\x63", + [0x5678] = "\xe1\xa5", [0x567b] = "\xe1\xa6", [0x567e] = "\xe1\xa7", + [0x5680] = "\x8e\x48", [0x5683] = "\xe1\xa9", [0x5686] = "\xe1\xa8", + [0x5689] = "\xe1\xaa", [0x568a] = "\xe1\xab", [0x569e] = "\x94\xe7", + [0x56a0] = "\xe1\xac", [0x56a4] = "\xe1\xad", [0x56a7] = "\xea\x89", + [0x56a8] = "\xe1\xae", [0x56a9] = "\xe1\xaf", [0x56aa] = "\xe1\xb0", + [0x56af] = "\x8e\x4d", [0x56b2] = "\xe1\xb1", [0x56b3] = "\x94\x75", + [0x56b6] = "\x96\x7e", [0x56b8] = "\x89\x6d", [0x56ba] = "\x89\x76", + [0x56bd] = "\xe1\xb2", [0x56c2] = "\xe1\xb4", [0x56c6] = "\xe1\xb3", + [0x56c7] = "\x93\x90", [0x56cb] = "\x90\xb7", [0x56cc] = "\x9f\x58", + [0x56ce] = "\xe1\xb5", [0x56cf] = "\x96\xbf", [0x56d1] = "\xe1\xb6", + [0x56d3] = "\x8a\xc4", [0x56d4] = "\x94\xd5", [0x56d5] = "\xe1\xb7", + [0x56d7] = "\xe1\xb8", [0x56da] = "\xe1\xb9", [0x56de] = "\x96\xda", + [0x56e2] = "\x96\xd3", [0x56e4] = "\x92\xbc", [0x56e8] = "\x91\x8a", + [0x56eb] = "\xe1\xbb", [0x56ee] = "\x8f\x82", [0x56f1] = "\x8f\xc8", + [0x56f4] = "\xe1\xbe", [0x56f7] = "\xe1\xbd", [0x56f8] = "\xe1\xbc", + [0x56f9] = "\x94\xfb", [0x56fb] = "\x8a\xc5", [0x56fc] = "\x8c\xa7", + [0x570b] = "\xe1\xc4", [0x570e] = "\xe1\xc1", [0x570f] = "\x90\x5e", + [0x5710] = "\x96\xb0", [0x5714] = "\xe1\xc0", [0x5715] = "\xe1\xc2", + [0x5716] = "\xe1\xc3", [0x5719] = "\xe1\xbf", [0x5727] = "\xe1\xc5", + [0x5728] = "\xe1\xc6", [0x572a] = "\x92\xad", [0x572c] = "\x8a\xe1", + [0x5730] = "\x92\x85", [0x5737] = "\xe1\xc7", [0x574a] = "\xe1\xc8", + [0x574b] = "\xe1\xcb", [0x5751] = "\x90\x87", [0x5753] = "\x93\xc2", + [0x5755] = "\xe1\xcc", [0x5756] = "\x96\x72", [0x5758] = "\xe1\xc9", + [0x575b] = "\xe1\xca", [0x5769] = "\xe1\xcf", [0x576e] = "\xe1\xce", + [0x576f] = "\xe1\xcd", [0x577b] = "\xe1\xd1", [0x577e] = "\xe1\xd0", + [0x5781] = "\xe1\xd2", [0x578e] = "\xe1\xd4", [0x5790] = "\xe1\xd3", + [0x5795] = "\x95\xcb", [0x579c] = "\x8f\x75", [0x579d] = "\x97\xc4", + [0x57a0] = "\xe1\xd5", [0x57a3] = "\x93\xb5", [0x57a6] = "\xe1\xd6", + [0x57a9] = "\xe1\xd7", [0x57ab] = "\xe1\xdb", [0x57ac] = "\xe1\xd9", + [0x57ad] = "\xe1\xda", [0x57af] = "\xe1\xd8", [0x57b7] = "\xe1\xdc", + [0x57bd] = "\xe1\xdd", [0x57c7] = "\xe1\xde", [0x57ca] = "\xe1\xdf", + [0x57cb] = "\x96\xb5", [0x57cc] = "\xe1\xe0", [0x57d2] = "\x96\xee", + [0x57d3] = "\xe1\xe1", [0x57d5] = "\x92\x6d", [0x57d7] = "\x94\x8a", + [0x57d9] = "\x8b\xe9", [0x57dd] = "\x92\x5a", [0x57de] = "\xe1\xe2", + [0x57df] = "\x8b\xb8", [0x57e3] = "\x90\xce", [0x57ec] = "\xe1\xe3", + [0x57f2] = "\x8d\xbb", [0x57fc] = "\xe1\xe4", [0x5802] = "\xe1\xe5", + [0x5804] = "\x8c\xa4", [0x5805] = "\x8d\xd3", [0x5810] = "\xe1\xe7", + [0x5815] = "\x93\x75", [0x5816] = "\x8d\xd4", [0x5817] = "\x8b\x6d", + [0x5822] = "\x96\x43", [0x5824] = "\x94\x6a", [0x582a] = "\x93\x76", + [0x582f] = "\x8d\x7b", [0x5835] = "\xe1\xe9", [0x584d] = "\x8f\xc9", + [0x585b] = "\x97\xb0", [0x585c] = "\x8d\x64", [0x585f] = "\x8c\xa5", + [0x5862] = "\x94\xa1", [0x5864] = "\xe1\xeb", [0x586c] = "\xe1\xed", + [0x5871] = "\x8c\xe9", [0x5876] = "\xe1\xec", [0x5877] = "\x92\xf4", + [0x587c] = "\xe1\xef", [0x587d] = "\x8a\x56", [0x587e] = "\xe1\xea", + [0x5881] = "\x94\xe8", [0x5883] = "\x89\x4f", [0x5885] = "\x8d\xea", + [0x5887] = "\x98\x71", [0x588a] = "\xe1\xee", [0x5893] = "\xe1\xf0", + [0x5897] = "\x95\xc9", [0x5899] = "\x90\xd7", [0x589a] = "\xe1\xf2", + [0x589f] = "\xe1\xf3", [0x58a5] = "\xe1\xf1", [0x58aa] = "\x8a\x6d", + [0x58ac] = "\xe1\xf9", [0x58ae] = "\xe1\xf8", [0x58b1] = "\x8e\xa5", + [0x58b5] = "\xe1\xfa", [0x58b6] = "\xe1\xf5", [0x58ba] = "\xe1\xfb", + [0x58bb] = "\xe1\xf6", [0x58c0] = "\x94\xd6", [0x58c1] = "\xe1\xf4", + [0x58c4] = "\xe1\xf7", [0x58ca] = "\xe2\x41", [0x58d7] = "\xe2\x40", + [0x58d8] = "\x96\x81", [0x58dc] = "\xe1\xfc", [0x58df] = "\x88\xe9", + [0x58e4] = "\xe2\x43", [0x58ed] = "\xe2\x42", [0x58f1] = "\x8f\xca", + [0x58f7] = "\xe2\x44", [0x58fe] = "\x91\x62", [0x5901] = "\xe2\x46", + [0x5902] = "\xe2\x45", [0x5909] = "\xe2\x47", [0x5916] = "\xe1\xe6", + [0x591a] = "\xe1\xe8", [0x591b] = "\xe2\x49", [0x591c] = "\xe2\x48", + [0x592a] = "\x8e\xa6", [0x592c] = "\x97\xe7", [0x592e] = "\x8e\xd0", + [0x5930] = "\xe2\x4a", [0x5931] = "\x8c\x56", [0x5937] = "\x8b\x5f", + [0x5938] = "\x8b\x46", [0x5939] = "\x8e\x83", [0x5940] = "\x97\x53", + [0x5943] = "\xe2\x50", [0x5945] = "\xe2\x4f", [0x5946] = "\x91\x63", + [0x5947] = "\xe2\x4c", [0x594a] = "\xe2\x4e", [0x594d] = "\x8f\x6a", + [0x594e] = "\x90\x5f", [0x594f] = "\xe2\x4d", [0x5950] = "\xe2\x4b", + [0x5952] = "\x94\x49", [0x5955] = "\x8f\xcb", [0x5958] = "\x95\x5b", + [0x595d] = "\x8d\xd5", [0x5967] = "\x93\x98", [0x596a] = "\xe2\x51", + [0x596f] = "\xe2\x52", [0x5970] = "\xe2\x68", [0x5971] = "\x8b\xd6", + [0x5974] = "\x98\x5c", [0x5975] = "\x91\x54", [0x597a] = "\xe2\x53", + [0x597d] = "\x89\xd0", [0x597e] = "\x92\xf5", [0x597f] = "\x95\x9f", + [0x598d] = "\xe2\x54", [0x5996] = "\x8b\x9a", [0x5997] = "\xe2\x55", + [0x599a] = "\xe2\x57", [0x599e] = "\xe2\x58", [0x59a0] = "\x94\x48", + [0x59a3] = "\xe2\x59", [0x59a9] = "\xe2\x5a", [0x59aa] = "\xe2\x5b", + [0x59ad] = "\x8b\xd7", [0x59ae] = "\x89\xd1", [0x59af] = "\x93\xc3", + [0x59b0] = "\x8f\x47", [0x59b1] = "\x8e\x84", [0x59b9] = "\xe2\x5c", + [0x59bb] = "\x8f\x48", [0x59c1] = "\x89\xc8", [0x59c2] = "\x95\x62", + [0x59c5] = "\xe2\x5d", [0x59c8] = "\x94\xe9", [0x59cf] = "\x91\x64", + [0x59d1] = "\xe2\x60", [0x59d3] = "\xe2\x61", [0x59d4] = "\x94\x89", + [0x59d6] = "\x90\x60", [0x59d7] = "\xe2\x5e", [0x59d9] = "\x92\x81", + [0x59dc] = "\xe2\x5f", [0x59e0] = "\x8f\xcc", [0x59eb] = "\x88\xda", + [0x59f0] = "\x8b\x48", [0x59f8] = "\xe2\x62", [0x59fb] = "\x92\xf6", + [0x59fd] = "\xe2\x63", [0x59fe] = "\x90\xc5", [0x5a04] = "\x96\xab", + [0x5a07] = "\x95\x42", [0x5a08] = "\xe2\x64", [0x5a09] = "\xe2\x65", + [0x5a0a] = "\x92\x74", [0x5a0c] = "\x97\xc5", [0x5a0f] = "\xe2\x67", + [0x5a10] = "\xe2\x66", [0x5a1e] = "\x8e\xed", [0x5a21] = "\xe2\x69", + [0x5a22] = "\x88\xee", [0x5a27] = "\xe2\x6c", [0x5a2b] = "\xe2\x6a", + [0x5a2c] = "\x89\xd2", [0x5a2d] = "\x8c\x6d", [0x5a2e] = "\xe2\x6b", + [0x5a2f] = "\x8d\x65", [0x5a30] = "\x8d\x92", [0x5a32] = "\x95\xe4", + [0x5a33] = "\xe2\x6d", [0x5a36] = "\x96\x73", [0x5a39] = "\xe2\x6f", + [0x5a3d] = "\x90\xcf", [0x5a3e] = "\x89\x6e", [0x5a3f] = "\x89\xb8", + [0x5a40] = "\x88\xaa", [0x5a47] = "\xe2\x6e", [0x5a51] = "\xe2\x70", + [0x5a52] = "\xe2\x71", [0x5a53] = "\x8f\xf5", [0x5a59] = "\xe2\x72", + [0x5a5b] = "\x8a\x6e", [0x5a60] = "\xe2\x74", [0x5a64] = "\x8c\x8a", + [0x5a66] = "\x8b\x86", [0x5a69] = "\xe2\x75", [0x5a6a] = "\x8b\xf3", + [0x5a6d] = "\xe2\x76", [0x5a6f] = "\x90\xfa", [0x5a71] = "\x93\xcb", + [0x5a73] = "\x90\xde", [0x5a74] = "\x8d\xf3", [0x5a78] = "\xe2\x77", + [0x5a82] = "\x92\x82", [0x5a83] = "\x91\x8b", [0x5a85] = "\xe2\x79", + [0x5a86] = "\xe2\x7b", [0x5a87] = "\xe2\x78", [0x5a88] = "\xe2\x7a", + [0x5a8f] = "\x8c\x41", [0x5a99] = "\xe2\x7c", [0x5a9a] = "\x8c\x45", + [0x5a9e] = "\x8b\x87", [0x5a9f] = "\x97\x71", [0x5aa0] = "\xe2\x7e", + [0x5aa6] = "\xe2\x80", [0x5aaa] = "\x89\x4d", [0x5aaf] = "\xe2\x83", + [0x5ab3] = "\x8a\x96", [0x5ab4] = "\xe2\x82", [0x5ab5] = "\xe2\x81", + [0x5ab7] = "\xe2\x85", [0x5ab8] = "\xe2\x7d", [0x5aba] = "\xe2\x86", + [0x5abb] = "\x97\xa7", [0x5abd] = "\xe2\x87", [0x5abf] = "\xe2\x88", + [0x5ac2] = "\x9a\xf2", [0x5ac3] = "\xe2\x8a", [0x5ac5] = "\xe2\x89", + [0x5ac9] = "\xe2\x8b", [0x5aca] = "\xe2\x8c", [0x5acc] = "\x97\xb3", + [0x5acd] = "\xe2\x8d", [0x5acf] = "\xe8\xed", [0x5ad0] = "\x8f\xcd", + [0x5ad1] = "\xe2\x8e", [0x5ad2] = "\xe2\x8f", [0x5ad3] = "\x8f\x76", + [0x5ad5] = "\x93\xb6", [0x5ad6] = "\xe2\x90", [0x5ada] = "\x92\x47", + [0x5add] = "\xe2\x91", [0x5adf] = "\x92\x5b", [0x5ae0] = "\xe2\x92", + [0x5ae6] = "\x8b\xa3", [0x5ae8] = "\x99\x5e", [0x5ae9] = "\x92\x7c", + [0x5aea] = "\x8e\xb1", [0x5aef] = "\x8a\xc6", [0x5af2] = "\xe2\x93", + [0x5af4] = "\xe2\xa0", [0x5af6] = "\xe2\x96", [0x5af8] = "\x8b\x88", + [0x5afa] = "\xe2\x95", [0x5afb] = "\xe2\xa2", [0x5aff] = "\xe2\x94", + [0x5b01] = "\x8f\xce", [0x5b08] = "\xe2\x98", [0x5b09] = "\xe2\x99", + [0x5b0b] = "\x93\x4a", [0x5b0e] = "\xe2\x9a", [0x5b10] = "\x8a\x7d", + [0x5b15] = "\x90\x79", [0x5b16] = "\x95\x84", [0x5b18] = "\xe2\x9c", + [0x5b1c] = "\x91\xe6", [0x5b23] = "\xe2\x97", [0x5b25] = "\xe2\x9b", + [0x5b26] = "\xe2\x9d", [0x5b29] = "\x8d\xf9", [0x5b35] = "\xe2\xa4", + [0x5b36] = "\x95\x4d", [0x5b38] = "\x94\xa4", [0x5b39] = "\x93\x99", + [0x5b3b] = "\x8b\xd8", [0x5b3c] = "\xe2\xa3", [0x5b3d] = "\xe2\xa1", + [0x5b3f] = "\x94\xb3", [0x5b40] = "\xe2\x9e", [0x5b41] = "\x92\x7d", + [0x5b42] = "\x93\x9b", [0x5b44] = "\x93\x9a", [0x5b46] = "\x8d\xf4", + [0x5b4d] = "\xe2\xb6", [0x5b55] = "\xe2\xa6", [0x5b57] = "\xe2\xa8", + [0x5b5c] = "\xe2\xab", [0x5b5e] = "\xe2\xac", [0x5b60] = "\xe2\xa9", + [0x5b61] = "\xe2\xaa", [0x5b64] = "\xe2\xa7", [0x5b65] = "\xe2\xa5", + [0x5b6a] = "\xe2\x9f", [0x5b76] = "\x95\xcd", [0x5b77] = "\x89\xd3", + [0x5b7b] = "\xe2\xb3", [0x5b7d] = "\xe2\xb0", [0x5b7f] = "\xe2\xb5", + [0x5b82] = "\xe2\xb4", [0x5b84] = "\x94\x93", [0x5b85] = "\x96\xa5", + [0x5b87] = "\x8e\x5a", [0x5b88] = "\xe2\xae", [0x5b89] = "\xe2\xb7", + [0x5b8a] = "\xe2\xb2", [0x5b8c] = "\xe2\xb1", [0x5b8d] = "\xe2\xad", + [0x5b8f] = "\xe2\xaf", [0x5b91] = "\x8a\xc7", [0x5b9a] = "\x92\x5c", + [0x5b9d] = "\x90\xfb", [0x5ba1] = "\x94\xa0", [0x5ba4] = "\xe2\xbc", + [0x5ba8] = "\x94\xa2", [0x5bb0] = "\x90\xdf", [0x5bb1] = "\xe2\xb9", + [0x5bb4] = "\x94\xcd", [0x5bb6] = "\xe2\xbd", [0x5bb7] = "\x95\xd1", + [0x5bb9] = "\x92\x7a", [0x5bbb] = "\xe2\xb8", [0x5bbc] = "\xe2\xba", + [0x5bbf] = "\xe2\xbb", [0x5bcd] = "\xe2\xbe", [0x5bd0] = "\x8e\xc2", + [0x5bd4] = "\x93\xc4", [0x5bd5] = "\xe2\xc3", [0x5bd6] = "\xe2\xc2", + [0x5bd9] = "\xe2\xbf", [0x5bdd] = "\x98\x55", [0x5be3] = "\xe2\xc8", + [0x5be6] = "\xe2\xcc", [0x5be7] = "\xe2\xc9", [0x5bf0] = "\xe2\xc5", + [0x5bf7] = "\xe2\xc6", [0x5bfd] = "\xe2\xcb", [0x5c01] = "\xe2\xc0", + [0x5c02] = "\x99\xd3", [0x5c03] = "\xe2\xc7", [0x5c04] = "\xe2\xc1", + [0x5c07] = "\xe2\xca", [0x5c0f] = "\xe2\xd0", [0x5c11] = "\x8a\xc8", + [0x5c13] = "\xe2\xcd", [0x5c17] = "\xe2\xce", [0x5c1a] = "\xe2\xcf", + [0x5c1b] = "\xe2\xd2", [0x5c27] = "\xe2\xd1", [0x5c28] = "\x94\xf4", + [0x5c2d] = "\xe2\xd3", [0x5c2e] = "\x97\xfa", [0x5c2f] = "\x95\xeb", + [0x5c30] = "\xe2\xd8", [0x5c33] = "\xe2\xd5", [0x5c3c] = "\xe2\xd4", + [0x5c3d] = "\x90\xd0", [0x5c3f] = "\xe2\xd7", [0x5c40] = "\xe2\xd9", + [0x5c44] = "\xe2\xd6", [0x5c46] = "\xe2\xdd", [0x5c48] = "\xe2\xda", + [0x5c4f] = "\xe2\xdb", [0x5c50] = "\xe2\xc4", [0x5c54] = "\xe2\xdc", + [0x5c55] = "\xe2\xde", [0x5c5c] = "\xe2\xdf", [0x5c63] = "\x95\xc4", + [0x5c65] = "\xe2\xe0", [0x5c6e] = "\x96\xe0", [0x5c71] = "\x8b\xcc", + [0x5c72] = "\x8c\x48", [0x5c73] = "\xe2\xe1", [0x5c79] = "\x95\xb2", + [0x5c7b] = "\x90\x88", [0x5c7d] = "\x96\xae", [0x5c80] = "\xe2\xe2", + [0x5c82] = "\x97\xb1", [0x5c85] = "\x94\x94", [0x5c87] = "\x91\x65", + [0x5c88] = "\x94\x53", [0x5c8b] = "\x8f\x6c", [0x5c8f] = "\x88\xbe", + [0x5c91] = "\xe2\xe7", [0x5c92] = "\xe2\xe5", [0x5c94] = "\xe2\xe3", + [0x5c95] = "\x8a\x9f", [0x5c97] = "\x8f\xcf", [0x5c98] = "\xe2\xe8", + [0x5c9b] = "\xe2\xe6", [0x5c9d] = "\xe2\xe4", [0x5c9e] = "\xe2\xec", + [0x5ca1] = "\xe2\xeb", [0x5ca2] = "\xe2\xea", [0x5ca3] = "\xe2\xe9", + [0x5ca9] = "\xe2\xed", [0x5cad] = "\xe2\xee", [0x5cae] = "\x90\xb8", + [0x5cb0] = "\xe2\xef", [0x5cb2] = "\xe2\xf1", [0x5cb5] = "\xe2\xf0", + [0x5cba] = "\x8c\xd0", [0x5cbe] = "\x91\x57", [0x5cc2] = "\xe2\xf3", + [0x5cc6] = "\x93\x9c", [0x5cc8] = "\xe2\xf2", [0x5ccc] = "\xe2\xf4", + [0x5cce] = "\x95\xb3", [0x5ccf] = "\x91\x8c", [0x5cd0] = "\x8d\x66", + [0x5cd2] = "\xe2\xf5", [0x5cd7] = "\x97\xc6", [0x5cdf] = "\xe2\xf7", + [0x5ce2] = "\xe2\xf8", [0x5ce4] = "\xe2\xf9", [0x5ce6] = "\xe2\xfa", + [0x5ce8] = "\x8e\x85", [0x5cea] = "\xe2\xfb", [0x5ceb] = "\x8c\x6e", + [0x5cee] = "\x8b\x8a", [0x5cf0] = "\x8b\x49", [0x5cf2] = "\xe3\x40", + [0x5cf4] = "\x96\xf1", [0x5cf5] = "\x8d\x67", [0x5cf6] = "\xe2\xfc", + [0x5cfa] = "\xe3\x43", [0x5cfb] = "\x96\xe4", [0x5cfd] = "\x94\x5b", + [0x5d00] = "\x95\x52", [0x5d04] = "\x8f\x83", [0x5d05] = "\xe3\x42", + [0x5d07] = "\x8e\xd1", [0x5d08] = "\x8d\x68", [0x5d09] = "\x8e\x86", + [0x5d0a] = "\x8b\x89", [0x5d0b] = "\x95\xb4", [0x5d0c] = "\xe3\x41", + [0x5d10] = "\x91\x66", [0x5d11] = "\x96\x61", [0x5d12] = "\x8d\xf5", + [0x5d1b] = "\x8e\x87", [0x5d1c] = "\x92\xdb", [0x5d1e] = "\xe3\x46", + [0x5d1f] = "\x97\xdd", [0x5d20] = "\x8d\xd7", [0x5d22] = "\xe3\x47", + [0x5d23] = "\x90\x61", [0x5d25] = "\xe3\x49", [0x5d29] = "\x8f\xd0", + [0x5d2a] = "\x8d\xae", [0x5d2f] = "\xe3\x48", [0x5d32] = "\x8f\x49", + [0x5d33] = "\x8c\xbc", [0x5d34] = "\x91\x67", [0x5d35] = "\xe3\x44", + [0x5d36] = "\xe3\x4a", [0x5d3b] = "\xe3\x45", [0x5d3c] = "\x8c\x6f", + [0x5d3e] = "\xe3\x4d", [0x5d3f] = "\xe3\x51", [0x5d40] = "\x8c\x8b", + [0x5d46] = "\xe3\x4c", [0x5d4b] = "\xe3\x55", [0x5d4e] = "\x8d\x69", + [0x5d51] = "\x97\x8d", [0x5d52] = "\x88\xba", [0x5d53] = "\xe3\x52", + [0x5d56] = "\x8b\x8b", [0x5d58] = "\xe3\x4f", [0x5d5e] = "\xe3\x50", + [0x5d61] = "\x93\x9d", [0x5d62] = "\xe3\x4e", [0x5d63] = "\xe3\x4b", + [0x5d65] = "\x8a\x47", [0x5d66] = "\x90\xe2", [0x5d69] = "\x8c\xa6", + [0x5d6d] = "\xe3\x57", [0x5d79] = "\xe3\x54", [0x5d7f] = "\xe3\x56", + [0x5d83] = "\xe3\x53", [0x5d89] = "\x8c\x70", [0x5d8a] = "\x91\xb1", + [0x5d8b] = "\xe3\x58", [0x5d8c] = "\x91\x8e", [0x5d8f] = "\xe3\x65", + [0x5d92] = "\xe3\x61", [0x5d93] = "\xe3\x5b", [0x5d9b] = "\xe3\x5f", + [0x5d9c] = "\x8e\xf8", [0x5d9d] = "\x88\xdb", [0x5d9e] = "\xe3\x5a", + [0x5d9f] = "\xe3\x62", [0x5da0] = "\xe3\x66", [0x5da1] = "\x8d\x6a", + [0x5da2] = "\x96\xd4", [0x5da4] = "\x92\xd4", [0x5da5] = "\xe3\x5c", + [0x5da8] = "\xe3\x64", [0x5daa] = "\xe3\x59", [0x5dab] = "\x92\x5d", + [0x5dad] = "\xe3\x5e", [0x5dae] = "\x88\xbb", [0x5daf] = "\x96\xc8", + [0x5db7] = "\xe3\x5d", [0x5dba] = "\x8b\xd9", [0x5dbb] = "\x94\xea", + [0x5dbf] = "\x91\x8d", [0x5dc1] = "\x97\xce", [0x5dc2] = "\x8f\x8f", + [0x5dc5] = "\xe3\x8e", [0x5dc8] = "\xe3\x67", [0x5dca] = "\x90\xfc", + [0x5dcc] = "\xe3\x63", [0x5dcd] = "\xe3\x68", [0x5dce] = "\xe3\x6a", + [0x5dd0] = "\x92\xf7", [0x5dd1] = "\xe3\x6d", [0x5dd4] = "\xe3\x69", + [0x5dd8] = "\x95\xd2", [0x5dd9] = "\x8a\xc9", [0x5ddc] = "\x96\xc9", + [0x5ddf] = "\x88\xdc", [0x5de2] = "\xe3\x6c", [0x5de4] = "\x97\xfb", + [0x5deb] = "\xe3\x6b", [0x5df1] = "\x89\x8f", [0x5df4] = "\x93\xea", + [0x5df5] = "\xe3\x6e", [0x5df9] = "\xe3\x75", [0x5dfa] = "\xe3\x6f", + [0x5dfb] = "\xe3\x76", [0x5e02] = "\xe3\x72", [0x5e0b] = "\x94\x9b", + [0x5e0e] = "\x8e\xc8", [0x5e0f] = "\xe3\x74", [0x5e11] = "\xe3\x71", + [0x5e12] = "\xe3\x77", [0x5e13] = "\xe3\x70", [0x5e16] = "\x8f\x63", + [0x5e1b] = "\x96\x44", [0x5e1e] = "\x8f\x6b", [0x5e21] = "\xe3\x73", + [0x5e22] = "\xe3\x80", [0x5e25] = "\xe3\x7b", [0x5e27] = "\xe3\x7e", + [0x5e29] = "\xe3\x7c", [0x5e2a] = "\xe3\x81", [0x5e2b] = "\xe3\x7a", + [0x5e2d] = "\xe3\x60", [0x5e2e] = "\x90\xd1", [0x5e31] = "\x94\xc9", + [0x5e33] = "\xe3\x7d", [0x5e36] = "\xe3\x78", [0x5e3a] = "\x91\x40", + [0x5e3b] = "\x8c\x71", [0x5e3d] = "\x8f\x4a", [0x5e44] = "\x90\x44", + [0x5e45] = "\x91\x55", [0x5e46] = "\xe3\x84", [0x5e49] = "\xe3\x86", + [0x5e4a] = "\xe3\x87", [0x5e4d] = "\xe3\x83", [0x5e4e] = "\xe3\x85", + [0x5e56] = "\xe3\x79", [0x5e57] = "\xe3\x82", [0x5e59] = "\xe3\x8a", + [0x5e5a] = "\xe3\x89", [0x5e5d] = "\x96\x9a", [0x5e60] = "\x8c\x4a", + [0x5e69] = "\xe3\x88", [0x5e6b] = "\xe3\x8c", [0x5e6c] = "\xe3\x8b", + [0x5e6d] = "\xe3\x8f", [0x5e6f] = "\xe3\x91", [0x5e72] = "\x8e\x5b", + [0x5e73] = "\xe3\x8d", [0x5e78] = "\xe3\x92", [0x5e79] = "\xe3\x93", + [0x5e7c] = "\xe3\x94", [0x5e7e] = "\xe3\x9a", [0x5e7f] = "\x93\x5a", + [0x5e80] = "\xe3\x96", [0x5e82] = "\xe3\x95", [0x5e83] = "\xe3\x97", + [0x5e84] = "\xe3\x98", [0x5e86] = "\xe3\x99", [0x5e8b] = "\xe3\x9b", + [0x5e8c] = "\xe3\x9c", [0x5f26] = "\x8a\xca", [0x5f28] = "\xe3\x9d", + [0x5f2a] = "\xe3\x9e", [0x5f35] = "\xe3\x9f", [0x5f3c] = "\xe3\xa0", + [0x5f3d] = "\xe3\xa1", [0x5f3e] = "\xe3\xa2", [0x5f40] = "\xe3\xa3", + [0x5f41] = "\xe3\xa4", [0x5f44] = "\xe3\xa6", [0x5f45] = "\xe3\xa5", + [0x5f48] = "\xe3\xa7", [0x5f4f] = "\xe3\xa8", [0x5f50] = "\xe3\xa9", + [0x5f57] = "\xe3\xac", [0x5f58] = "\xe3\xaa", [0x5f59] = "\xe3\xab", + [0x5f5a] = "\x8d\xdf", [0x5f5b] = "\x8c\x72", [0x5f5e] = "\x92\x75", + [0x5f60] = "\x94\xb1", [0x5f62] = "\x8f\x90", [0x5f65] = "\x94\x6c", + [0x5f67] = "\x94\xeb", [0x5f68] = "\xe3\xad", [0x5f69] = "\x9c\xeb", + [0x5f72] = "\xe3\xae", [0x5f73] = "\xe3\xb0", [0x5f75] = "\x97\x85", + [0x5f76] = "\xe3\xaf", [0x5f77] = "\xe3\xb2", [0x5f78] = "\xe3\xb1", + [0x5f7a] = "\x97\x72", [0x5f7c] = "\xe3\xb3", [0x5f7e] = "\x94\xfc", + [0x5f84] = "\xe3\xb4", [0x5f8a] = "\xe3\xb7", [0x5f8d] = "\xe3\xb6", + [0x5f8e] = "\xe3\xb5", [0x5f93] = "\xe3\xb8", [0x5f94] = "\x8c\x51", + [0x5f98] = "\x91\x41", [0x5f99] = "\x8b\x60", [0x5f9e] = "\xe3\xbc", + [0x5f9f] = "\xe3\xb9", [0x5fa2] = "\xe3\xba", [0x5fa6] = "\xe3\xbd", + [0x5fa8] = "\xe3\xbe", [0x5fa9] = "\xe3\xbb", [0x5fad] = "\x89\x48", + [0x5fb1] = "\x89\xa5", [0x5fb5] = "\xe3\xc0", [0x5fb6] = "\xe3\xc1", + [0x5fba] = "\xe3\xc2", [0x5fbc] = "\x97\x82", [0x5fc2] = "\x8f\x4b", + [0x5fc4] = "\xe3\xc4", [0x5fc5] = "\xe3\xc3", [0x5fd0] = "\x90\x89", + [0x5fd1] = "\xe3\xc5", [0x5fd6] = "\xe3\xc6", [0x5fd9] = "\xe3\xc7", + [0x5fdb] = "\x8a\xe3", [0x5fe0] = "\x8a\xcb", [0x5fe3] = "\xe3\xc8", + [0x5fe9] = "\xe3\xc9", [0x5feb] = "\x96\x7c", [0x5fec] = "\x97\x83", + [0x5ff0] = "\x97\x73", [0x5ff1] = "\x98\x56", [0x5ff3] = "\x8d\x6c", + [0x5ff4] = "\xe3\xcc", [0x5ff5] = "\x8e\xd2", [0x5ff6] = "\xe3\xcb", + [0x5ffb] = "\xe3\xcd", [0x5ffc] = "\x8e\xa7", [0x6000] = "\x91\xcf", + [0x6002] = "\xe3\xce", [0x6005] = "\x8d\x6b", [0x6007] = "\x96\xd5", + [0x6008] = "\xe3\xcf", [0x6009] = "\xe3\xd0", [0x600c] = "\xe3\xd1", + [0x6011] = "\xe3\xd2", [0x6018] = "\xe3\xd3", [0x6023] = "\x8e\xa8", + [0x6026] = "\x96\xeb", [0x602b] = "\xe3\xd5", [0x602d] = "\x92\x5e", + [0x602f] = "\xe3\xd4", [0x6036] = "\xe3\xd7", [0x603a] = "\xe3\xd6", + [0x6042] = "\xe3\xd8", [0x6046] = "\x90\xb9", [0x6048] = "\xe3\xd9", + [0x604a] = "\xe3\xda", [0x604e] = "\x95\xb7", [0x604f] = "\xe3\xdb", + [0x6051] = "\x91\x8f", [0x6052] = "\xe3\xdc", [0x6058] = "\xe3\xdd", + [0x605f] = "\x97\xfc", [0x6060] = "\xe3\xe0", [0x6062] = "\xe3\xdf", + [0x6063] = "\xe3\xde", [0x6064] = "\x92\xae", [0x6066] = "\xe3\xe1", + [0x6067] = "\x90\x45", [0x6069] = "\xe3\xe2", [0x606d] = "\xe3\xe3", + [0x606e] = "\x98\x57", [0x606f] = "\xe3\xe4", [0x6074] = "\xe3\xe5", + [0x6075] = "\xe3\xe7", [0x6076] = "\xe3\xe6", [0x6077] = "\x94\xa3", + [0x6079] = "\x93\xf7", [0x607b] = "\x98\x5d", [0x607c] = "\x94\xa7", + [0x6083] = "\xe3\xe9", [0x6086] = "\x8f\xd1", [0x6088] = "\x95\x49", + [0x608a] = "\xe3\xea", [0x608b] = "\xe3\xe8", [0x608d] = "\x8a\xcc", + [0x6091] = "\x8c\xd2", [0x6092] = "\x8e\x88", [0x6095] = "\x94\xec", + [0x6099] = "\x8c\xa8", [0x609a] = "\x96\x62", [0x609c] = "\xe3\xed", + [0x609d] = "\xe3\xeb", [0x609f] = "\x8d\x6d", [0x60a1] = "\x8d\x6e", + [0x60a2] = "\x88\xe7", [0x60a4] = "\x8d\xe6", [0x60aa] = "\x94\x78", + [0x60b3] = "\x88\xdd", [0x60b4] = "\xe3\xf2", [0x60b6] = "\x92\x5f", + [0x60bc] = "\x94\x77", [0x60be] = "\x91\xd9", [0x60c6] = "\xe3\xf4", + [0x60c9] = "\xe3\xf0", [0x60ca] = "\xe3\xf3", [0x60cb] = "\xe3\xee", + [0x60cd] = "\xe3\xf1", [0x60ce] = "\x96\x45", [0x60d1] = "\x8c\xd3", + [0x60d4] = "\x88\xfb", [0x60d5] = "\xe3\xef", [0x60df] = "\xe3\xf6", + [0x60e1] = "\xe3\xf7", [0x60e4] = "\x93\xb7", [0x60e8] = "\x8b\xb9", + [0x60ec] = "\xe4\x45", [0x60ed] = "\x94\x5c", [0x60f2] = "\x8e\x89", + [0x60f5] = "\x8b\xba", [0x60f6] = "\x90\xc6", [0x60f7] = "\x98\x65", + [0x60f8] = "\x96\xac", [0x60f9] = "\xe3\xf5", [0x60fa] = "\x90\xd2", + [0x610a] = "\x8b\x72", [0x610b] = "\xe3\xf8", [0x6113] = "\xe3\xfa", + [0x6119] = "\xe3\xf9", [0x611f] = "\xe3\xfb", [0x6121] = "\x92\x45", + [0x6123] = "\x94\x5d", [0x6129] = "\x92\xaf", [0x612e] = "\xe4\x42", + [0x6136] = "\xe4\x41", [0x613b] = "\xe3\xfc", [0x613e] = "\x90\x74", + [0x6140] = "\x95\x85", [0x6141] = "\xe4\x44", [0x6143] = "\xe4\x43", + [0x6144] = "\x8d\x6f", [0x6145] = "\x98\x72", [0x614f] = "\xe4\x54", + [0x6155] = "\xe4\x48", [0x6156] = "\xe4\x49", [0x615b] = "\x8e\xee", + [0x615e] = "\xe4\x47", [0x6160] = "\x8d\x98", [0x6161] = "\xe4\x46", + [0x6164] = "\xe4\x4a", [0x6168] = "\x92\xb0", [0x6169] = "\x95\xa0", + [0x616a] = "\x91\x42", [0x616f] = "\x91\xda", [0x6170] = "\xe4\x4e", + [0x6172] = "\xe4\x4f", [0x6173] = "\xe4\x4b", [0x6178] = "\xe4\x4c", + [0x617a] = "\xe4\x4d", [0x617f] = "\x8d\x70", [0x6183] = "\xe4\x55", + [0x6185] = "\xe4\x51", [0x618a] = "\x95\x86", [0x618c] = "\x96\x8c", + [0x618d] = "\x95\x47", [0x6190] = "\xe4\x50", [0x6193] = "\xe4\x53", + [0x6194] = "\xe4\x52", [0x6198] = "\x96\x63", [0x6199] = "\xe4\x56", + [0x61a0] = "\xe4\x57", [0x61a3] = "\x91\x56", [0x61a5] = "\xe4\x58", + [0x61a8] = "\xe4\x5a", [0x61aa] = "\xe4\x5e", [0x61ad] = "\xe4\x5b", + [0x61ae] = "\xe4\x59", [0x61af] = "\x94\x5e", [0x61b0] = "\xe4\x5c", + [0x61b2] = "\xe4\x5d", [0x61b6] = "\x89\xb0", [0x61b8] = "\xe4\x64", + [0x61b9] = "\xe4\x5f", [0x61bd] = "\xe4\x60", [0x61c1] = "\xe4\x61", + [0x61c3] = "\x91\x9f", [0x61c8] = "\xe4\x63", [0x61c9] = "\xe4\x62", + [0x61ca] = "\xe4\x65", [0x61cf] = "\xe4\x66", [0x61d0] = "\xe4\x67", + [0x61d3] = "\x90\x62", [0x61d5] = "\x89\xe7", [0x61d7] = "\xe4\x68", + [0x61d8] = "\x97\xd5", [0x61da] = "\x8e\xa9", [0x61dd] = "\x8f\x4c", + [0x61e3] = "\x8e\x8a", [0x61e4] = "\x92\x76", [0x61ea] = "\xe4\x69", + [0x61eb] = "\xe4\x6a", [0x61ec] = "\x89\x50", [0x61ee] = "\xe4\x6b", + [0x61f1] = "\xe4\x6c", [0x61f2] = "\xe4\x6d", [0x61f5] = "\xe4\x6e", + [0x61f7] = "\xe4\x6f", [0x61f8] = "\x8b\xbb", [0x61f9] = "\x9d\xa8", + [0x61fa] = "\xe4\x70", [0x61fc] = "\x90\xe3", [0x61fd] = "\xe4\x71", + [0x61fe] = "\x8e\xc9", [0x6200] = "\xe4\x72", [0x6202] = "\x98\xae", + [0x6206] = "\xe4\x73", [0x6207] = "\x95\xdc", [0x6208] = "\x8a\xda", + [0x620b] = "\x91\x43", [0x620c] = "\x8f\x77", [0x620e] = "\x95\x91", + [0x620f] = "\x8f\x4d", [0x6219] = "\xe4\x74", [0x621a] = "\x8d\x71", + [0x621b] = "\xe4\x75", [0x621c] = "\x94\xca", [0x621e] = "\xe4\x84", + [0x6223] = "\xe4\x77", [0x6225] = "\x91\xc7", [0x6226] = "\x94\x95", + [0x6227] = "\x8c\xbd", [0x6228] = "\xe4\x76", [0x6229] = "\x91\x44", + [0x6230] = "\xe4\x78", [0x6237] = "\x92\xf8", [0x6248] = "\xe4\x7a", + [0x6249] = "\xe4\x79", [0x624a] = "\xe4\x7c", [0x624d] = "\xe4\x7b", + [0x624f] = "\xe4\x7d", [0x6252] = "\xe4\x80", [0x6254] = "\xe4\x7e", + [0x6256] = "\x8a\xcd", [0x6258] = "\xe4\x81", [0x625a] = "\xe4\x82", + [0x625b] = "\xe4\x83", [0x625e] = "\x8d\xaf", [0x625f] = "\x97\xc7", + [0x6261] = "\xe4\x85", [0x6262] = "\x90\x46", [0x6266] = "\x89\x90", + [0x6267] = "\xe4\x86", [0x6268] = "\xe4\x87", [0x626e] = "\xe4\x88", + [0x627b] = "\x88\xf0", [0x627d] = "\xe4\x89", [0x6282] = "\xe4\x8a", + [0x6289] = "\x95\x87", [0x628d] = "\x8e\xc5", [0x628f] = "\xe4\x8c", + [0x6295] = "\x8a\x48", [0x6296] = "\x88\xb0", [0x629b] = "\xe4\x8b", + [0x629c] = "\xe4\x8e", [0x629d] = "\x94\x6d", [0x629f] = "\x90\x63", + [0x62a1] = "\x89\xd4", [0x62a3] = "\x96\x46", [0x62a8] = "\x8c\x7c", + [0x62a9] = "\x8b\xda", [0x62ab] = "\xe4\x8d", [0x62ad] = "\x89\xe8", + [0x62b5] = "\x8a\xa1", [0x62c1] = "\x89\x91", [0x62c2] = "\xe4\x92", + [0x62c3] = "\x97\xe8", [0x62c4] = "\x91\xdb", [0x62c7] = "\x95\x63", + [0x62c9] = "\xe4\x9e", [0x62cb] = "\x89\xd5", [0x62cc] = "\xe4\x9c", + [0x62ce] = "\xe4\x9a", [0x62cf] = "\xe4\x91", [0x62d1] = "\xe4\x8f", + [0x62d3] = "\xe4\x90", [0x62d5] = "\x8e\xe1", [0x62d6] = "\x8b\xea", + [0x62d7] = "\x92\x97", [0x62db] = "\x93\xcf", [0x62e1] = "\x89\x70", + [0x62e3] = "\xe4\x94", [0x62e4] = "\xe4\x93", [0x62e9] = "\xe4\x99", + [0x62ea] = "\xe4\x95", [0x62eb] = "\xe4\x98", [0x62f2] = "\x96\xce", + [0x62f3] = "\xe4\x97", [0x62f4] = "\x89\xd6", [0x62f5] = "\x8a\x9d", + [0x62f6] = "\xe4\x9b", [0x62f9] = "\xe4\x9d", [0x62fe] = "\x8c\x73", + [0x6306] = "\xe4\xa1", [0x6307] = "\xe4\xaa", [0x6308] = "\xe4\xab", + [0x630c] = "\x88\xa9", [0x6313] = "\xe4\xb2", [0x6318] = "\x88\xef", + [0x631b] = "\xe4\xa9", [0x631f] = "\xe4\xa8", [0x6321] = "\xe4\xa3", + [0x6322] = "\xe4\xa2", [0x6324] = "\xe4\xa0", [0x6325] = "\xe4\x9f", + [0x6326] = "\x92\x83", [0x6328] = "\x91\xf9", [0x6329] = "\xe4\xa5", + [0x6330] = "\xe4\xa4", [0x6335] = "\xe4\xa7", [0x6339] = "\x91\x90", + [0x633a] = "\x8c\x74", [0x633f] = "\x89\x60", [0x6340] = "\xe4\xa6", + [0x6342] = "\x8d\x72", [0x6348] = "\x91\x91", [0x6363] = "\xe4\xb8", + [0x6365] = "\xe4\xb9", [0x6367] = "\x89\xd7", [0x636b] = "\x89\xac", + [0x636c] = "\xe4\xb6", [0x6375] = "\xe4\xac", [0x6377] = "\xe4\xb4", + [0x6379] = "\xe4\xbb", [0x637a] = "\xe4\xb5", [0x637e] = "\xe4\xb3", + [0x6383] = "\xe4\x96", [0x6386] = "\xe4\xb1", [0x638a] = "\xe4\xad", + [0x638e] = "\x8a\xce", [0x638f] = "\xe4\xaf", [0x6390] = "\xe4\xba", + [0x6392] = "\xe4\xb0", [0x6398] = "\xe4\xbc", [0x639a] = "\xe4\xae", + [0x639b] = "\x94\x9c", [0x63a1] = "\x97\x89", [0x63a5] = "\xe4\xb7", + [0x63ad] = "\xe4\xcd", [0x63b1] = "\xe4\xc5", [0x63b5] = "\x90\x9b", + [0x63ba] = "\x8b\x65", [0x63bc] = "\x8b\xdb", [0x63be] = "\xe4\xc0", + [0x63c3] = "\x89\xd9", [0x63c6] = "\x8f\xd2", [0x63c8] = "\xe4\xc3", + [0x63cc] = "\x8d\xd8", [0x63cf] = "\x93\x70", [0x63d0] = "\xe4\xc8", + [0x63d9] = "\x95\xec", [0x63db] = "\xe4\xbf", [0x63df] = "\x89\xd8", + [0x63e0] = "\x8c\xd4", [0x63e1] = "\x95\x48", [0x63e2] = "\xe4\xc9", + [0x63e4] = "\xe4\xbd", [0x63e7] = "\xe4\xc6", [0x63eb] = "\xe4\xd0", + [0x63ed] = "\xe4\xc1", [0x63f3] = "\xe4\xc2", [0x63f4] = "\x93\xb8", + [0x63f7] = "\xe4\xc7", [0x63fb] = "\xe4\xc4", [0x63fc] = "\x96\x47", + [0x63fd] = "\xe4\xca", [0x63fe] = "\x88\xde", [0x6403] = "\xe4\xbe", + [0x6410] = "\xe4\xcc", [0x6412] = "\xe4\xcb", [0x6419] = "\x94\x8b", + [0x641a] = "\xe4\xd2", [0x641c] = "\xe4\xdd", [0x6421] = "\x8a\x9e", + [0x6425] = "\xe4\xe0", [0x6428] = "\xe4\xce", [0x642c] = "\xe4\xd3", + [0x642d] = "\x97\x8e", [0x6436] = "\xe4\xdc", [0x6439] = "\x97\x74", + [0x643e] = "\x97\xa8", [0x6447] = "\x92\x98", [0x644b] = "\x8a\x8b", + [0x6451] = "\x95\x92", [0x6452] = "\xe4\xe2", [0x6453] = "\x93\x9f", + [0x6456] = "\x88\xaf", [0x6459] = "\xe4\xdb", [0x645b] = "\xe4\xd7", + [0x645c] = "\x91\x92", [0x645d] = "\xe4\xd1", [0x645e] = "\xe4\xd9", + [0x645f] = "\xe4\xde", [0x6461] = "\x94\x4b", [0x6465] = "\x88\xa8", + [0x6467] = "\xe4\xd6", [0x6469] = "\xe4\xdf", [0x646a] = "\x95\x98", + [0x6472] = "\xe4\xda", [0x6474] = "\xe4\xd5", [0x647b] = "\x8f\xd3", + [0x6480] = "\x8f\x4e", [0x6484] = "\x8e\xaa", [0x6489] = "\x96\xd6", + [0x648c] = "\x95\x66", [0x648f] = "\xe4\xe5", [0x6491] = "\xe4\xee", + [0x649d] = "\xe4\xd8", [0x64a2] = "\x8a\x97", [0x64a8] = "\x8f\xf6", + [0x64a9] = "\xe4\xe3", [0x64ab] = "\xe4\xe8", [0x64ac] = "\x91\x93", + [0x64af] = "\xe4\xe4", [0x64b1] = "\xe4\xeb", [0x64b4] = "\x92\x7e", + [0x64b6] = "\xe4\xec", [0x64b9] = "\x97\x75", [0x64ba] = "\xe4\xe1", + [0x64bb] = "\x8a\x57", [0x64bd] = "\xe4\xe7", [0x64c0] = "\xe4\xea", + [0x64c1] = "\x96\xaa", [0x64c6] = "\xe4\xed", [0x64c9] = "\xe4\xe6", + [0x64ca] = "\xe4\xe9", [0x64dc] = "\x96\x48", [0x64de] = "\x98\x40", + [0x64e4] = "\xe4\xf1", [0x64ec] = "\xe4\xf8", [0x64ef] = "\xe4\xf0", + [0x64f0] = "\x8e\xc1", [0x64f6] = "\xe4\xcf", [0x6501] = "\x95\xcc", + [0x6503] = "\x96\xa0", [0x6504] = "\xe4\xf7", [0x6505] = "\xe4\xf6", + [0x6507] = "\xe4\xf2", [0x6508] = "\xe4\xf3", [0x650a] = "\x89\x55", + [0x650f] = "\xe4\xf5", [0x6511] = "\xe4\xef", [0x6516] = "\x92\xd3", + [0x651c] = "\xe4\xf4", [0x651d] = "\x88\xfc", [0x6525] = "\x91\xa0", + [0x652d] = "\x95\xc1", [0x6530] = "\xe4\xf9", [0x6531] = "\xe5\x40", + [0x6533] = "\x94\xd7", [0x6538] = "\xe4\xfc", [0x6539] = "\x8f\xd4", + [0x653a] = "\x8e\xc7", [0x653b] = "\xe5\x42", [0x653e] = "\x8b\xbc", + [0x6545] = "\xe5\x43", [0x6547] = "\x95\x99", [0x6548] = "\xe4\xfb", + [0x654a] = "\xe4\xd4", [0x6553] = "\xe4\xfa", [0x6558] = "\x98\x6e", + [0x6559] = "\x93\xa0", [0x655a] = "\x95\x93", [0x655d] = "\xe5\x4a", + [0x6567] = "\xe5\x50", [0x656e] = "\xe5\x51", [0x6570] = "\xe5\x44", + [0x6574] = "\x94\x96", [0x6577] = "\xe5\x4e", [0x6578] = "\xe5\x46", + [0x657a] = "\xe5\x48", [0x6580] = "\xe5\x52", [0x6581] = "\xe5\x47", + [0x6584] = "\xe5\x4b", [0x6587] = "\x89\x92", [0x6589] = "\x93\xe3", + [0x658b] = "\xe5\x4c", [0x658c] = "\xe5\x4f", [0x6594] = "\xe5\x45", + [0x6596] = "\x91\x45", [0x6598] = "\xe5\x49", [0x6599] = "\x8e\x46", + [0x659a] = "\x90\x64", [0x659b] = "\x8c\x4f", [0x659c] = "\x96\xf2", + [0x659e] = "\x96\xf7", [0x659f] = "\x8f\x92", [0x65a9] = "\xe5\x56", + [0x65aa] = "\xe5\x54", [0x65b1] = "\x98\x6d", [0x65b9] = "\xe5\x53", + [0x65bd] = "\x97\x95", [0x65bf] = "\xe5\x55", [0x65c0] = "\xe5\x57", + [0x65c5] = "\xe5\x58", [0x65cc] = "\xe5\x5b", [0x65cd] = "\xe5\x59", + [0x65d4] = "\x93\xa1", [0x65d5] = "\xe5\x5a", [0x65d9] = "\x94\xcb", + [0x65da] = "\xe5\x4d", [0x65e7] = "\x8f\x93", [0x65e9] = "\xe5\x5c", + [0x65ea] = "\xe5\x61", [0x65eb] = "\x91\x94", [0x65ee] = "\xe5\x60", + [0x65f2] = "\xe5\x41", [0x65f6] = "\xe5\x62", [0x65f7] = "\x91\x68", + [0x65fa] = "\xe5\x5d", [0x65fb] = "\xe5\x5f", [0x6603] = "\xe5\x5e", + [0x6606] = "\x9f\x50", [0x6607] = "\x9f\x41", [0x660a] = "\xe5\x64", + [0x6612] = "\xe5\x63", [0x661d] = "\x97\x96", [0x661f] = "\xe1\xba", + [0x6620] = "\xe5\x65", [0x662f] = "\xe5\x66", [0x663d] = "\xe5\x67", + [0x663e] = "\x8c\xd5", [0x6640] = "\x8b\x73", [0x6644] = "\xe5\x69", + [0x6645] = "\x99\x7c", [0x664a] = "\x8b\x95", [0x664c] = "\x97\xb8", + [0x664e] = "\x8b\xf1", [0x664f] = "\xe5\x6a", [0x6657] = "\xe5\x6b", + [0x665b] = "\x92\x8e", [0x6661] = "\xe5\x6c", [0x6669] = "\x93\xf8", + [0x666b] = "\x88\xb8", [0x667a] = "\x89\xe1", [0x667b] = "\xe5\x71", + [0x667c] = "\xe5\x72", [0x6683] = "\xe5\x6d", [0x6685] = "\x8e\x5c", + [0x6693] = "\xe5\x6e", [0x6694] = "\x94\x61", [0x6699] = "\xe5\x6f", + [0x669a] = "\xe5\x70", [0x669b] = "\xe5\x7a", [0x669f] = "\xe5\x74", + [0x66a0] = "\xe5\x77", [0x66a6] = "\xe5\x73", [0x66b4] = "\xe5\x75", + [0x66b6] = "\xe5\x76", [0x66b7] = "\x8e\xd6", [0x66b9] = "\xe5\x78", + [0x66bb] = "\x92\x60", [0x66bd] = "\x8c\x75", [0x66be] = "\x8a\x61", + [0x66c4] = "\xe5\x7b", [0x66c9] = "\x8a\x5e", [0x66cb] = "\xe5\x81", + [0x66ce] = "\xe5\x7c", [0x66cf] = "\xe5\x80", [0x66d4] = "\x94\xb8", + [0x66d9] = "\xe5\x7d", [0x66dc] = "\xe5\x7e", [0x66dd] = "\x95\x67", + [0x66de] = "\x94\xd8", [0x66df] = "\xe5\x82", [0x66e8] = "\x91\xfb", + [0x66e9] = "\xe5\x8c", [0x66eb] = "\xe5\x88", [0x66ee] = "\x89\xe9", + [0x66f0] = "\xe5\x86", [0x66f2] = "\x96\x49", [0x66f3] = "\xe5\x87", + [0x66f6] = "\xe5\x84", [0x66f8] = "\xe5\x85", [0x66f9] = "\xe5\x8a", + [0x66fa] = "\xe5\x8d", [0x66fd] = "\xe5\x8b", [0x6701] = "\xe5\x89", + [0x6702] = "\xe5\x83", [0x6708] = "\x92\x77", [0x670a] = "\xe5\x94", + [0x670c] = "\x96\xa8", [0x6715] = "\xe5\x92", [0x6719] = "\xe5\x93", + [0x6724] = "\xe5\x8e", [0x6727] = "\xe5\x90", [0x672b] = "\xe5\x91", + [0x672f] = "\xe5\x8f", [0x6739] = "\x90\xe4", [0x673b] = "\x98\x58", + [0x673c] = "\xe5\x98", [0x673e] = "\xe5\x99", [0x6743] = "\xe5\x9f", + [0x6745] = "\x90\x49", [0x6747] = "\xe5\x9b", [0x6749] = "\xe5\x9e", + [0x674f] = "\xe5\x96", [0x6750] = "\xe5\x95", [0x6753] = "\xe5\xa0", + [0x6756] = "\x89\xda", [0x6758] = "\xe5\x9c", [0x675a] = "\xe5\xa1", + [0x675e] = "\xe5\x9d", [0x6764] = "\xe5\x9a", [0x6766] = "\x92\xb1", + [0x6768] = "\xe5\x97", [0x676f] = "\x94\x88", [0x6772] = "\xe5\xa5", + [0x677d] = "\x97\x5a", [0x678f] = "\xe5\xa4", [0x6792] = "\xe5\xa3", + [0x679b] = "\xe5\xac", [0x679f] = "\xe5\xa6", [0x67a3] = "\xe5\xae", + [0x67aa] = "\x97\x86", [0x67ab] = "\xe5\xb1", [0x67ad] = "\xe5\xa8", + [0x67b0] = "\xe5\xa9", [0x67b4] = "\xe5\xad", [0x67b6] = "\xe5\xb0", + [0x67b7] = "\xe5\xaf", [0x67bb] = "\xe5\xa7", [0x67c0] = "\xe5\xaa", + [0x67c2] = "\xe5\xbb", [0x67d0] = "\xe5\xb4", [0x67df] = "\xe5\xb2", + [0x67e2] = "\xe5\xb3", [0x67e6] = "\xe5\xb8", [0x67e7] = "\xe5\xb9", + [0x67e9] = "\x8a\x49", [0x67eb] = "\x8b\x61", [0x67ee] = "\xe5\xb7", + [0x67f5] = "\xe5\xa2", [0x67fd] = "\xe5\xb6", [0x67fe] = "\xe5\xba", + [0x67ff] = "\xe5\xb5", [0x6801] = "\xe5\xbc", [0x6805] = "\xe5\xbe", + [0x6806] = "\xe5\xbd", [0x6811] = "\xe5\xc0", [0x6812] = "\xe5\xbf", + [0x6813] = "\xe5\x79", [0x6817] = "\xe5\xc4", [0x6821] = "\xe5\xc1", + [0x6826] = "\xe5\xc2", [0x6829] = "\xe5\xc3", [0x682b] = "\xe5\xc5", + [0x6830] = "\x8c\x8c", [0x6832] = "\xe5\xc7", [0x6834] = "\xe5\xc6", + [0x6836] = "\x8f\x4f", [0x683c] = "\x8d\x73", [0x683d] = "\x9f\xa5", + [0x6842] = "\xe5\xc8", [0x6843] = "\x8f\x70", [0x6847] = "\x8a\x58", + [0x6849] = "\xe5\xc9", [0x684b] = "\x89\x71", [0x684d] = "\x8f\xd5", + [0x684e] = "\xe5\xca", [0x6851] = "\x8d\x74", [0x6852] = "\xe5\xcb", + [0x6853] = "\x88\xdf", [0x6858] = "\x95\x5c", [0x685b] = "\xe5\xcc", + [0x6860] = "\x90\x8a", [0x6862] = "\xe5\xd3", [0x6865] = "\xe5\xd0", + [0x6867] = "\x92\x8f", [0x686d] = "\xe5\xd1", [0x686e] = "\xe5\xce", + [0x686f] = "\x8b\xdc", [0x6871] = "\xe5\xcd", [0x6872] = "\xe5\xd4", + [0x6878] = "\x8c\x55", [0x687b] = "\x91\xdc", [0x687d] = "\xe5\xda", + [0x6882] = "\xe5\xd6", [0x6886] = "\x91\xb3", [0x6887] = "\xe5\xd5", + [0x6889] = "\xe5\xd8", [0x688e] = "\xe5\xcf", [0x6892] = "\xe5\xd9", + [0x6894] = "\xe5\xdb", [0x689b] = "\x94\xed", [0x689e] = "\xe5\xd7", + [0x68a0] = "\xe5\xdc", [0x68a1] = "\xe5\xde", [0x68a4] = "\x8c\xd1", + [0x68a5] = "\xe5\xd2", [0x68a7] = "\x88\xbf", [0x68af] = "\xe5\xdd", + [0x68b1] = "\x8d\xd9", [0x68b2] = "\x97\xf4", [0x68b3] = "\xe5\xdf", + [0x68b4] = "\xe5\xe0", [0x68b5] = "\x91\x95", [0x68bf] = "\x97\xa0", + [0x68c4] = "\xe5\xe1", [0x68c5] = "\x97\x54", [0x68c8] = "\xe5\xe2", + [0x68c9] = "\xe5\xe3", [0x68cc] = "\x95\xe2", [0x68cd] = "\xe5\xe4", + [0x68cf] = "\x8d\xbe", [0x68d1] = "\x97\xa1", [0x68d8] = "\xe5\xe9", + [0x68e2] = "\xe5\xea", [0x68e3] = "\x8f\xd6", [0x68e4] = "\xe5\xe8", + [0x68e8] = "\x97\x87", [0x68e9] = "\xe5\xe5", [0x68ec] = "\xe5\xe7", + [0x68ed] = "\x90\xbb", [0x68ee] = "\x90\x9e", [0x68f2] = "\xe5\xe6", + [0x68f4] = "\xe5\xeb", [0x68f7] = "\x95\xa1", [0x68fa] = "\xe5\xed", + [0x68fc] = "\xe5\xec", [0x6900] = "\x8a\x8c", [0x6902] = "\x96\x4a", + [0x6903] = "\xe5\xee", [0x690d] = "\xe5\xfa", [0x690e] = "\xe5\xf0", + [0x6915] = "\xe5\xf1", [0x691a] = "\xe5\xf2", [0x691b] = "\xe5\xf3", + [0x6926] = "\xe5\xf7", [0x6928] = "\xe5\xf8", [0x692b] = "\xe5\xf6", + [0x6931] = "\xe5\xf4", [0x6933] = "\xe5\xef", [0x6934] = "\xe5\xf5", + [0x693c] = "\xe5\xf9", [0x693d] = "\xe8\xb5", [0x6946] = "\x89\xa6", + [0x694e] = "\xe5\xfc", [0x694f] = "\x8b\xdd", [0x6950] = "\xe5\xfb", + [0x6954] = "\xe6\x41", [0x6956] = "\xe6\x40", [0x695a] = "\xe6\x43", + [0x695d] = "\xe6\x42", [0x695f] = "\xe6\x44", [0x6962] = "\x8f\x50", + [0x6964] = "\xe6\x45", [0x6967] = "\xe6\x46", [0x696e] = "\xe6\x47", + [0x696f] = "\x90\xbc", [0x6971] = "\x97\x76", [0x6973] = "\xe6\x48", + [0x6976] = "\x95\xa2", [0x6977] = "\x94\x65", [0x6978] = "\xe6\x49", + [0x697a] = "\xe6\x4a", [0x697b] = "\x8c\xa9", [0x697f] = "\x8b\x4b", + [0x6983] = "\xe6\x4b", [0x6986] = "\x8e\x8b", [0x6987] = "\x94\x60", + [0x6988] = "\xe6\x4c", [0x698a] = "\x8a\x6f", [0x6991] = "\xe6\x4d", + [0x6996] = "\xe6\x4f", [0x6997] = "\x97\x97", [0x6999] = "\xe6\x4e", + [0x699a] = "\x90\x65", [0x699c] = "\xe6\x50", [0x699f] = "\xe6\x51", + [0x69a2] = "\xe6\x52", [0x69a3] = "\x8a\xcf", [0x69aa] = "\xe6\x53", + [0x69ad] = "\xe6\x54", [0x69af] = "\xe6\x55", [0x69b0] = "\xe6\x56", + [0x69c2] = "\x8a\x70", [0x69ca] = "\xe6\x57", [0x69cc] = "\xe6\x58", + [0x69cd] = "\xe6\x59", [0x69d3] = "\x89\xf0", [0x69d6] = "\x90\x47", + [0x69d7] = "\xe6\x5a", [0x69e4] = "\xe6\x5b", [0x69e8] = "\xe6\x5c", + [0x69f0] = "\x8c\xbe", [0x69f2] = "\x92\xf9", [0x69f3] = "\xe6\x5d", + [0x69f8] = "\x8c\x76", [0x69fa] = "\x90\x75", [0x69fc] = "\xe6\x60", + [0x69fe] = "\x93\xa2", [0x6a00] = "\xe6\x5f", [0x6a03] = "\x8c\x50", + [0x6a06] = "\xe6\x5e", [0x6a07] = "\x91\xf5", [0x6a08] = "\x8b\x4c", + [0x6a0b] = "\xe6\x61", [0x6a0d] = "\xe6\x62", [0x6a0f] = "\x8f\xd7", + [0x6a13] = "\x8c\x8d", [0x6a15] = "\xe6\x63", [0x6a1a] = "\x96\x4b", + [0x6a1d] = "\x90\xdd", [0x6a21] = "\x8b\x96", [0x6a23] = "\x96\xf3", + [0x6a24] = "\x91\x69", [0x6a26] = "\xe6\x64", [0x6a2a] = "\x90\x66", + [0x6a2b] = "\x92\x90", [0x6a2c] = "\x8f\xd8", [0x6a31] = "\xe6\x65", + [0x6a36] = "\xe6\x68", [0x6a38] = "\xe6\x69", [0x6a40] = "\x8d\xbc", + [0x6a41] = "\x91\xc0", [0x6a42] = "\xe6\x67", [0x6a44] = "\x8f\xd9", + [0x6a45] = "\x95\x5d", [0x6a4b] = "\xe6\x66", [0x6a4e] = "\x8e\x8c", + [0x6a50] = "\x89\x72", [0x6a52] = "\xe6\x6d", [0x6a53] = "\x8c\x77", + [0x6a56] = "\x8e\x8e", [0x6a59] = "\x8e\x8d", [0x6a5b] = "\x98\x6c", + [0x6a5c] = "\xe6\x6c", [0x6a5d] = "\xe6\x6b", [0x6a5e] = "\x91\x46", + [0x6a60] = "\x8b\x6c", [0x6a61] = "\x98\x62", [0x6a62] = "\x8a\x59", + [0x6a63] = "\x8f\xda", [0x6a6c] = "\xe6\x6a", [0x6a72] = "\xe6\x6f", + [0x6a74] = "\xe6\x70", [0x6a75] = "\xe6\x6e", [0x6a77] = "\x8c\xd6", + [0x6a79] = "\x97\x5f", [0x6a7c] = "\x8e\x8f", [0x6a7d] = "\x94\x46", + [0x6a81] = "\xe6\x73", [0x6a83] = "\x90\xbe", [0x6a85] = "\x92\x61", + [0x6a88] = "\x97\x55", [0x6a8a] = "\xe6\x76", [0x6a8e] = "\x8c\xea", + [0x6a90] = "\x90\xbd", [0x6a91] = "\xe6\x72", [0x6a93] = "\xe6\x77", + [0x6a94] = "\x8c\xeb", [0x6a95] = "\xe6\x74", [0x6a96] = "\xe6\x75", + [0x6a98] = "\xe6\x71", [0x6a9c] = "\x90\xe0", [0x6a9d] = "\x93\xc7", + [0x6aa0] = "\x92\x4e", [0x6aa2] = "\x89\xdb", [0x6aa9] = "\x94\xee", + [0x6aac] = "\x8b\x62", [0x6aaf] = "\x92\xb2", [0x6ab2] = "\xe6\x7a", + [0x6ab4] = "\xe6\x78", [0x6ab7] = "\x92\x6b", [0x6abb] = "\x90\xbf", + [0x6abc] = "\x8a\xd0", [0x6abd] = "\xe6\x79", [0x6abf] = "\x90\x7a", + [0x6ac2] = "\x97\xc8", [0x6ac6] = "\x98\x5f", [0x6aca] = "\xe6\x7b", + [0x6acb] = "\xe6\x87", [0x6acc] = "\x92\xb3", [0x6ace] = "\xe6\x86", + [0x6ad0] = "\xe6\x83", [0x6ad1] = "\xe6\x8b", [0x6ad2] = "\xe6\x84", + [0x6ad4] = "\xe6\x80", [0x6ad6] = "\x92\xfa", [0x6ad7] = "\xe6\x7e", + [0x6adb] = "\xe6\x7c", [0x6add] = "\x97\x40", [0x6ade] = "\x8e\x90", + [0x6ae1] = "\xe6\x81", [0x6ae3] = "\xe6\x7d", [0x6ae7] = "\xe6\x85", + [0x6ae8] = "\x8f\x94", [0x6aea] = "\x8c\xbf", [0x6aee] = "\x91\xf8", + [0x6af0] = "\x96\x64", [0x6af1] = "\x89\x79", [0x6af2] = "\x88\xe0", + [0x6af4] = "\x93\xa3", [0x6af7] = "\xe6\x89", [0x6afc] = "\xe6\x88", + [0x6afe] = "\x93\xe4", [0x6b00] = "\xe6\x8d", [0x6b04] = "\xe6\x82", + [0x6b06] = "\xe6\x8c", [0x6b07] = "\xe6\x8e", [0x6b09] = "\x8c\xaa", + [0x6b0a] = "\xe6\x8a", [0x6b0b] = "\x8d\x75", [0x6b0d] = "\x8e\xd3", + [0x6b10] = "\xe6\x8f", [0x6b11] = "\x97\x77", [0x6b16] = "\xe6\x92", + [0x6b18] = "\xe6\x95", [0x6b1b] = "\xe6\x93", [0x6b1c] = "\x95\x54", + [0x6b23] = "\xe6\x90", [0x6b29] = "\x8b\xde", [0x6b2e] = "\xe6\x94", + [0x6b31] = "\xe6\x96", [0x6b39] = "\xe6\x9a", [0x6b3c] = "\xe6\x97", + [0x6b3e] = "\xe6\x99", [0x6b3f] = "\xe6\x98", [0x6b46] = "\xe6\x9b", + [0x6b48] = "\x8e\xaf", [0x6b4a] = "\xe6\x9d", [0x6b4b] = "\xe6\x9c", + [0x6b4c] = "\x95\x88", [0x6b4f] = "\xe6\x9f", [0x6b56] = "\x8c\x78", + [0x6b5b] = "\xe6\x9e", [0x6b5c] = "\xe6\xa0", [0x6b5f] = "\xe6\xa1", + [0x6b60] = "\x8b\x63", [0x6b61] = "\xe3\xbf", [0x6b62] = "\x8f\xf7", + [0x6b64] = "\xe6\xa2", [0x6b67] = "\x8c\xec", [0x6b6d] = "\xe6\xa3", + [0x6b70] = "\xe6\xa4", [0x6b73] = "\x8e\x5d", [0x6b7a] = "\x9d\xcc", + [0x6b7c] = "\xe6\xa5", [0x6b7e] = "\xe6\xa6", [0x6b80] = "\x8f\x51", + [0x6b82] = "\xe6\xa7", [0x6b83] = "\xe6\xa8", [0x6b86] = "\xe6\xa9", + [0x6b89] = "\xe6\xaa", [0x6b8a] = "\xe6\xab", [0x6c27] = "\x92\x4a", + [0x6c2a] = "\xe6\xac", [0x6c2f] = "\xe6\xae", [0x6c31] = "\xe6\xad", + [0x6c36] = "\x93\xa4", [0x6c38] = "\xe6\xaf", [0x6c3a] = "\x96\x4c", + [0x6c3c] = "\xe6\xb0", [0x6c3e] = "\xe6\xb1", [0x6c40] = "\xe6\xb2", + [0x6c45] = "\xe6\xb3", [0x6c4a] = "\x93\xd8", [0x6c51] = "\x8f\xdb", + [0x6c52] = "\xe6\xb4", [0x6c5a] = "\x8d\x8b", [0x6c5b] = "\x98\xac", + [0x6c5c] = "\xe6\xb5", [0x6c68] = "\xe6\xb6", [0x6c69] = "\x95\x5e", + [0x6c6a] = "\xe6\xb7", [0x6c6c] = "\xe6\xbf", [0x6c72] = "\xe6\xb8", + [0x6c75] = "\xe6\xba", [0x6c79] = "\xe6\xb9", [0x6c7a] = "\xe6\xbb", + [0x6c7c] = "\x96\x65", [0x6c7d] = "\xe6\xbc", [0x6c7e] = "\xe6\xbd", + [0x6c84] = "\xe6\xbe", [0x6c88] = "\xe6\xc0", [0x6c8d] = "\x8a\x4c", + [0x6c8e] = "\x92\xe5", [0x6c90] = "\x95\x89", [0x6c91] = "\x8d\xe0", + [0x6c92] = "\x8d\x76", [0x6c97] = "\x95\x6e", [0x6c98] = "\x89\xdd", + [0x6c99] = "\x94\xcc", [0x6c9a] = "\xe6\xc3", [0x6c9b] = "\x8a\xd1", + [0x6c9c] = "\x90\xd3", [0x6c9d] = "\xe6\xc2", [0x6c9e] = "\xe6\xc7", + [0x6c9f] = "\x92\x99", [0x6ca0] = "\x96\xe1", [0x6ca2] = "\xe6\xc5", + [0x6ca3] = "\xe6\xc6", [0x6ca4] = "\x8b\x4d", [0x6ca6] = "\xe6\xc8", + [0x6ca7] = "\x94\x83", [0x6ca8] = "\x91\xdd", [0x6cab] = "\x94\xef", + [0x6cac] = "\x93\x5c", [0x6cad] = "\xe6\xc4", [0x6caf] = "\x96\x66", + [0x6cb0] = "\x89\xea", [0x6cb1] = "\xe6\xca", [0x6cb2] = "\x98\x47", + [0x6cb3] = "\x92\xc0", [0x6cb4] = "\x98\x64", [0x6cb7] = "\x8e\x91", + [0x6cb8] = "\xe6\xc9", [0x6cba] = "\x91\xaf", [0x6cbd] = "\xe6\xda", + [0x6cbe] = "\x91\x47", [0x6cc1] = "\x93\xf6", [0x6cc3] = "\x95\x6f", + [0x6cca] = "\xe6\xcd", [0x6ccb] = "\x8e\x5e", [0x6ccc] = "\x8e\x92", + [0x6cce] = "\x8f\xdc", [0x6cd0] = "\x94\x85", [0x6cd2] = "\x8c\xab", + [0x6cd3] = "\xe6\xcc", [0x6cd4] = "\xe6\xcb", [0x6cd6] = "\x95\x8a", + [0x6cda] = "\x8e\xbf", [0x6cdd] = "\x93\x71", [0x6cea] = "\xe6\xcf", + [0x6ceb] = "\xe6\xd0", [0x6cec] = "\x8d\x77", [0x6ced] = "\xe6\xce", + [0x6cf4] = "\xe6\xd1", [0x6cf5] = "\xe6\xd2", [0x6cf7] = "\xe6\xd4", + [0x6cf8] = "\x91\xa1", [0x6cfa] = "\xe6\xd3", [0x6cfb] = "\x8a\xe4", + [0x6cfd] = "\xe6\xd6", [0x6cff] = "\xe6\xd5", [0x6d00] = "\xe6\xd7", + [0x6d03] = "\xe6\xd9", [0x6d04] = "\xe6\xdb", [0x6d06] = "\xe6\xdc", + [0x6d54] = "\x90\xd4", [0x6d56] = "\x8e\xcd", [0x6d57] = "\xe6\xdd", + [0x6d5b] = "\x8a\x71", [0x6d5d] = "\xe6\xde", [0x6d60] = "\x91\x96", + [0x6d61] = "\xe6\xdf", [0x6d63] = "\xe6\xe0", [0x6d64] = "\x95\x8b", + [0x6d67] = "\x8b\x4e", [0x6d71] = "\xe6\xe1", [0x6d75] = "\x92\xb4", + [0x6d7a] = "\x89\x7a", [0x6d89] = "\xe6\xe2", [0x6d93] = "\x8e\xef", + [0x6d98] = "\x90\x96", [0x6da3] = "\x91\xab", [0x6daa] = "\xe6\xe5", + [0x6dae] = "\xe6\xe4", [0x6db2] = "\xe6\xe3", [0x6dbb] = "\xe6\xeb", + [0x6dbc] = "\xe6\xe9", [0x6dbf] = "\xe6\xe6", [0x6dc6] = "\xe6\xe8", + [0x6dca] = "\xe6\xe7", [0x6dcb] = "\xe6\xea", [0x6dcd] = "\x8b\x97", + [0x6dcf] = "\xe6\xee", [0x6dd1] = "\x90\xd5", [0x6dd3] = "\xe6\xef", + [0x6dd8] = "\x8c\xd7", [0x6dda] = "\xe6\xec", [0x6ddb] = "\xe6\xed", + [0x6ddf] = "\x98\x48", [0x6de3] = "\x92\xb5", [0x6de5] = "\x91\x48", + [0x6dec] = "\xe6\xf0", [0x6def] = "\xe6\xf3", [0x6df8] = "\xe6\xf1", + [0x6df9] = "\xe6\xf2", [0x6dfa] = "\x97\x78", [0x6dff] = "\x93\xa5", + [0x6e00] = "\xe6\xf6", [0x6e0d] = "\xe6\xf4", [0x6e0e] = "\xe6\xf5", + [0x6e0f] = "\xe6\xf7", [0x6e1a] = "\xe7\x48", [0x6e20] = "\xe6\xfa", + [0x6e24] = "\xe6\xfb", [0x6e25] = "\xe6\xf9", [0x6e32] = "\xe6\xf8", + [0x6e34] = "\x92\xfb", [0x6e37] = "\xe7\x40", [0x6e38] = "\xe7\x44", + [0x6e39] = "\xe7\x41", [0x6e3a] = "\xe6\xfc", [0x6e3c] = "\xe7\x42", + [0x6e40] = "\xe7\x43", [0x6e45] = "\xe7\x4a", [0x6e49] = "\xe7\x45", + [0x6e4f] = "\x90\xd6", [0x6e50] = "\xe7\x47", [0x6e53] = "\xe7\x49", + [0x6e54] = "\xe7\x46", [0x6e62] = "\xe7\x4c", [0x6e64] = "\x8f\x52", + [0x6e66] = "\xe7\x4b", [0x6e6c] = "\xe7\x4d", [0x6e71] = "\xe7\x4e", + [0x6e74] = "\xe7\x51", [0x6e75] = "\xe7\x50", [0x6e77] = "\xe7\x4f", + [0x6e7a] = "\xe7\x53", [0x6e7b] = "\xe7\x52", [0x6e7d] = "\x96\xf4", + [0x6e81] = "\xe7\x55", [0x6e83] = "\xe7\x54", [0x6e84] = "\xe7\x56", + [0x6e89] = "\xe7\x57", [0x6e91] = "\xe7\x59", [0x6e9a] = "\xe7\x58", + [0x6e9b] = "\x90\x67", [0x6e9c] = "\xe7\x5a", [0x6e9f] = "\x8b\xeb", + [0x6ea0] = "\xe7\x5b", [0x6ea1] = "\xe7\x5d", [0x6eae] = "\xe7\x5e", + [0x6eb5] = "\xe7\x5f", [0x6eb6] = "\xe7\x5c", [0x6eb8] = "\xe7\x60", + [0x6eba] = "\x8e\xd4", [0x6ebb] = "\xe7\x61", [0x6ebc] = "\x8b\x4f", + [0x6ebd] = "\x8c\x52", [0x6ec2] = "\x8c\xac", [0x6ecb] = "\xe7\x62", + [0x6ecf] = "\x93\xee", [0x6ed2] = "\x93\x5d", [0x6ed3] = "\xe7\x63", + [0x6edb] = "\xe7\x66", [0x6ee8] = "\x8e\xb2", [0x6eeb] = "\xe7\x65", + [0x6eec] = "\xe7\x64", [0x6eed] = "\x8c\x79", [0x6eee] = "\xe7\x67", + [0x6ef3] = "\x8a\x72", [0x6ef5] = "\xe7\x69", [0x6ef9] = "\x8d\xda", + [0x6efa] = "\xe7\x68", [0x6efc] = "\xe7\x71", [0x6f02] = "\xe7\x6b", + [0x6f03] = "\xe7\x6d", [0x6f04] = "\x95\xe3", [0x6f05] = "\xe7\x6a", + [0x6f09] = "\xe7\x6c", [0x6f0b] = "\xe7\x70", [0x6f0c] = "\xe7\x6e", + [0x6f0d] = "\x8b\x50", [0x6f0f] = "\xe7\x6f", [0x6f16] = "\xe7\x72", + [0x6f19] = "\x94\x79", [0x6f1a] = "\x97\xd6", [0x6f1f] = "\x8f\x53", + [0x6f23] = "\xe7\x73", [0x6f28] = "\x97\x41", [0x6f29] = "\xe7\x75", + [0x6f2b] = "\xe7\x74", [0x6f2e] = "\xe7\x78", [0x6f2f] = "\x97\x60", + [0x6f32] = "\xe7\x77", [0x6f34] = "\x8a\x8d", [0x6f35] = "\xe7\x76", + [0x6f36] = "\xe7\x7b", [0x6f39] = "\xe7\x7a", [0x6f3c] = "\xe7\x79", + [0x6f3d] = "\x93\x51", [0x6f3e] = "\xe7\x7c", [0x6f47] = "\xe7\x7d", + [0x6f4c] = "\xe7\x7e", [0x6f4f] = "\x8d\x8c", [0x6f51] = "\x8c\x44", + [0x6f52] = "\xe7\x80", [0x6f53] = "\xe7\x81", [0x6f54] = "\xe7\x82", + [0x6f8b] = "\x90\x68", [0x6f8c] = "\xe7\x83", [0x6f8e] = "\x8e\xab", + [0x6f8f] = "\xe7\x84", [0x6f93] = "\xe7\x85", [0x6f97] = "\x99\x9f", + [0x6f98] = "\x99\x9e", [0x6f9d] = "\xe7\x86", [0x6f9e] = "\xe3\x90", + [0x6f9f] = "\xe7\x87", [0x6fa0] = "\x92\x43", [0x6fa1] = "\x90\x4a", + [0x6fa2] = "\x94\x5f", [0x6fa7] = "\xe7\x88", [0x6faa] = "\x95\xd3", + [0x6fab] = "\x92\xd2", [0x6fac] = "\x8d\x9e", [0x6faf] = "\x92\x48", + [0x6fb2] = "\x89\x49", [0x6fb4] = "\x96\x98", [0x6fb5] = "\x90\x76", + [0x6fbe] = "\x8c\x7d", [0x6fc1] = "\x8b\xdf", [0x6fc4] = "\x95\xd4", + [0x6fca] = "\xe7\x89", [0x6fd2] = "\xe7\x8b", [0x6fd5] = "\xe7\x8a", + [0x6fd6] = "\x89\xde", [0x6fd9] = "\x93\xf4", [0x6fda] = "\xe7\x8c", + [0x6fdb] = "\x94\x97", [0x6fdd] = "\x93\x52", [0x6fdf] = "\xe7\x8d", + [0x6fe0] = "\x8f\x71", [0x6fe4] = "\xe7\x8f", [0x6fe7] = "\x96\xc0", + [0x6fe8] = "\xe7\x9e", [0x6fe9] = "\xe7\x91", [0x6fea] = "\xe7\x92", + [0x6fed] = "\x92\xc7", [0x6ff0] = "\x91\xde", [0x6ff1] = "\x91\x97", + [0x6ff3] = "\x93\xa6", [0x6ff5] = "\xe7\x90", [0x6ff6] = "\x8b\x74", + [0x6ffb] = "\xe7\x99", [0x6ffd] = "\xe7\x96", [0x6ffe] = "\xe7\xa3", + [0x6fff] = "\x93\xa7", [0x7000] = "\x92\x80", [0x7001] = "\xe7\x93", + [0x7003] = "\x92\xfc", [0x7004] = "\x93\x72", [0x7005] = "\xe7\x94", + [0x7006] = "\xe7\x98", [0x7007] = "\x90\x80", [0x7009] = "\x94\x87", + [0x700a] = "\x92\xca", [0x700d] = "\x90\xc0", [0x700e] = "\xe7\x97", + [0x700f] = "\x91\xac", [0x7010] = "\x91\xa2", [0x7011] = "\xe7\x95", + [0x7012] = "\x88\xa7", [0x7013] = "\x98\x41", [0x7017] = "\xe7\x9a", + [0x701e] = "\x91\xdf", [0x7021] = "\x8f\x54", [0x7022] = "\x90\x69", + [0x7025] = "\xe7\x9c", [0x7026] = "\xe7\x9b", [0x7028] = "\x88\xed", + [0x7029] = "\xe7\x9d", [0x702c] = "\x95\x4e", [0x702e] = "\xe7\xa5", + [0x7031] = "\x93\xd9", [0x7032] = "\x90\x8b", [0x7035] = "\x92\x78", + [0x7037] = "\x8b\xf6", [0x7039] = "\xe7\xa4", [0x703a] = "\x97\x56", + [0x703b] = "\x89\x5e", [0x703d] = "\x95\xd5", [0x703e] = "\x89\xdf", + [0x703f] = "\xe7\x9f", [0x7040] = "\xe7\xa0", [0x7041] = "\xe7\xa1", + [0x7042] = "\xe7\xa2", [0x7043] = "\x93\xb9", [0x7044] = "\x92\x42", + [0x7045] = "\x88\xe1", [0x7046] = "\xe7\xa6", [0x7048] = "\xe7\xa7", + [0x7049] = "\xea\xa1", [0x704c] = "\x91\xbb", [0x704e] = "\xe7\xa8", + [0x7050] = "\x89\x93", [0x7051] = "\x91\x6b", [0x7053] = "\x8c\xad", + [0x7055] = "\x97\x79", [0x7058] = "\xe7\xa9", [0x7059] = "\x93\x4b", + [0x705d] = "\x91\x98", [0x705e] = "\x8e\xd5", [0x705f] = "\xe7\xaa", + [0x7062] = "\xe7\xad", [0x7065] = "\x8f\x85", [0x7066] = "\xe7\xab", + [0x7067] = "\x91\x4a", [0x7068] = "\x91\x49", [0x706a] = "\x88\xe2", + [0x706c] = "\x97\xc9", [0x706d] = "\xe7\xaf", [0x706f] = "\x94\xf0", + [0x7070] = "\xe7\xb1", [0x7071] = "\xe7\xb0", [0x7072] = "\xe7\xae", + [0x7073] = "\xe2\x84", [0x7074] = "\x8a\xd2", [0x7077] = "\xe7\x8e", + [0x7079] = "\xe7\xb3", [0x707a] = "\xe7\xb2", [0x707f] = "\xe7\xb4", + [0x7081] = "\x97\x57", [0x7093] = "\x93\xdf", [0x7096] = "\x96\x4d", + [0x7098] = "\xe7\xb5", [0x709a] = "\x8e\xd7", [0x709f] = "\xe7\xb6", + [0x70a1] = "\xe7\xb7", [0x70a5] = "\xe7\xb8", [0x70a8] = "\x93\x40", + [0x70b1] = "\x88\xe8", [0x70ba] = "\x8d\x78", [0x70be] = "\x98\x59", + [0x70cb] = "\xe7\xbc", [0x70d1] = "\x8c\x53", [0x70d2] = "\xe7\xb9", + [0x70d4] = "\xe7\xba", [0x70d8] = "\x95\x94", [0x70dd] = "\x8a\x73", + [0x70e5] = "\x97\x58", [0x70e7] = "\x8b\xbd", [0x70ed] = "\x93\x73", + [0x70f2] = "\xe7\xbd", [0x7102] = "\xe7\xbe", [0x7109] = "\xe7\xbf", + [0x711d] = "\x93\x41", [0x7120] = "\xe7\xc1", [0x7122] = "\xe7\xc0", + [0x7139] = "\x93\xd1", [0x713a] = "\xe7\xc2", [0x713b] = "\x8f\x55", + [0x713c] = "\x8e\xde", [0x713d] = "\x94\x7a", [0x713e] = "\x92\x91", + [0x7142] = "\x8e\xf0", [0x7144] = "\x90\x8c", [0x7146] = "\xe7\xc3", + [0x7148] = "\xe7\xc4", [0x7152] = "\x90\x7c", [0x7153] = "\xe7\xc5", + [0x7155] = "\xe7\xc6", [0x7159] = "\xe7\xc7", [0x715a] = "\x97\x8f", + [0x715c] = "\x8f\x56", [0x7162] = "\xe7\xc9", [0x7163] = "\xe7\xc8", + [0x7165] = "\x8d\x79", [0x7167] = "\x8d\x93", [0x7168] = "\x8e\x5f", + [0x7172] = "\xe7\xcc", [0x7177] = "\x8f\x86", [0x7179] = "\xe7\xcb", + [0x717b] = "\xe7\xca", [0x717d] = "\x91\xe7", [0x7180] = "\x8c\xed", + [0x7182] = "\x90\xc1", [0x7187] = "\x94\xae", [0x718c] = "\x8f\x58", + [0x7192] = "\xe7\xcd", [0x7194] = "\x8f\xdd", [0x719a] = "\xe7\xd0", + [0x719b] = "\xe7\xce", [0x719f] = "\xe7\xcf", [0x71a4] = "\xe7\xd2", + [0x71a5] = "\xe7\xd1", [0x71a8] = "\x8f\xf8", [0x71aa] = "\xe7\xd3", + [0x71b0] = "\xe7\xd4", [0x71b1] = "\xe7\xd5", [0x71b6] = "\x94\xce", + [0x71b7] = "\x8d\xd1", [0x71b8] = "\x8e\xdf", [0x71b9] = "\xe7\xd6", + [0x71bb] = "\xe7\xd7", [0x71bc] = "\x97\xa2", [0x71bd] = "\x8f\x64", + [0x71be] = "\x96\xec", [0x71bf] = "\x97\xca", [0x71c0] = "\xe7\xd8", + [0x71c1] = "\x8b\xe0", [0x71c6] = "\xe7\xd9", [0x71c8] = "\x93\x42", + [0x71cb] = "\xe7\xdc", [0x71cc] = "\x8a\x98", [0x71cd] = "\x90\x6a", + [0x71cf] = "\xe7\xda", [0x71d1] = "\xe7\xdb", [0x71d3] = "\x92\xde", + [0x71d6] = "\x96\x74", [0x71d7] = "\x8b\xfa", [0x71e5] = "\xe7\xde", + [0x71e6] = "\xe7\xdf", [0x71ec] = "\xe7\xdd", [0x71ef] = "\xe7\xe1", + [0x71fd] = "\x93\xdd", [0x71fe] = "\x8a\x62", [0x7201] = "\xe7\xe5", + [0x7204] = "\xe7\xe2", [0x7205] = "\xe7\xe4", [0x720e] = "\xe7\xe0", + [0x7219] = "\xe8\x6e", [0x721c] = "\xe7\xe3", [0x7224] = "\x97\xe9", + [0x7227] = "\x8c\xd8", [0x722f] = "\xe7\xed", [0x7234] = "\x93\x53", + [0x7235] = "\xe7\xe8", [0x7238] = "\xe7\xeb", [0x7239] = "\xe7\xe9", + [0x723b] = "\xe7\xee", [0x7240] = "\xe7\xef", [0x7247] = "\xe7\xe7", + [0x724a] = "\xe7\xf4", [0x724b] = "\x89\x94", [0x724e] = "\xe7\xe6", + [0x7252] = "\x94\xab", [0x7254] = "\xe7\xea", [0x7256] = "\x8f\xde", + [0x7261] = "\x8d\x7a", [0x726e] = "\x96\x67", [0x7270] = "\x8b\xe2", + [0x7273] = "\x8f\x65", [0x7275] = "\x93\xba", [0x7281] = "\x91\x4c", + [0x7283] = "\xe7\xf2", [0x7285] = "\xe7\xec", [0x7286] = "\xe7\xf1", + [0x7288] = "\x96\xc1", [0x728a] = "\x92\xb6", [0x728b] = "\xe7\xf3", + [0x728c] = "\xe7\xf0", [0x729d] = "\x91\x4b", [0x72a7] = "\xe7\xf7", + [0x72a9] = "\xe7\xf6", [0x72bf] = "\xe7\xf5", [0x72c2] = "\x96\x4e", + [0x72d4] = "\x8f\x9b", [0x72d9] = "\xe7\xf8", [0x72da] = "\x95\xdd", + [0x72dd] = "\x89\x73", [0x72e2] = "\x95\x65", [0x72e3] = "\x92\x92", + [0x72e8] = "\x8b\x98", [0x72ea] = "\xe7\xfa", [0x72ec] = "\x8d\x7c", + [0x72f6] = "\x8e\x4b", [0x72ff] = "\xe7\xf9", [0x7300] = "\x90\x8d", + [0x7308] = "\x90\x8e", [0x7309] = "\xe8\x40", [0x730a] = "\xe8\x42", + [0x7310] = "\x8f\xf9", [0x7312] = "\xe8\x41", [0x7313] = "\xe8\x43", + [0x7316] = "\x8b\xd1", [0x7318] = "\x95\x64", [0x731b] = "\x8e\xe0", + [0x731c] = "\x98\x42", [0x731e] = "\xe7\xfc", [0x731f] = "\x8d\xf6", + [0x7322] = "\x98\x5e", [0x7325] = "\xe8\x45", [0x732a] = "\xe8\x44", + [0x732b] = "\xe8\x46", [0x7334] = "\xe7\xfb", [0x733b] = "\x93\xe7", + [0x733d] = "\x93\x74", [0x7344] = "\x92\xd5", [0x7346] = "\xe8\x4b", + [0x734b] = "\x92\x62", [0x734c] = "\xe8\x47", [0x7350] = "\xe8\x48", + [0x735c] = "\x8c\x4c", [0x735e] = "\xe8\x4a", [0x7365] = "\x8c\xae", + [0x736c] = "\xe8\x49", [0x736e] = "\x8f\xdf", [0x737c] = "\x8a\x99", + [0x7384] = "\xe8\x4f", [0x7386] = "\x8d\xbd", [0x7387] = "\x91\x99", + [0x738a] = "\x92\xc8", [0x7397] = "\x8a\x5a", [0x739c] = "\xe8\x4d", + [0x739d] = "\xe8\x4e", [0x739e] = "\x92\xc1", [0x73a0] = "\xe8\x4c", + [0x73a9] = "\xe8\x50", [0x73b3] = "\xe8\x56", [0x73b8] = "\xe8\x59", + [0x73c0] = "\xe8\x58", [0x73c1] = "\x93\x4c", [0x73c6] = "\xe8\x51", + [0x73c7] = "\xe8\x52", [0x73c8] = "\xe8\x55", [0x73cd] = "\xe8\x57", + [0x73d1] = "\x8b\xbe", [0x73d4] = "\xe8\x5a", [0x73d5] = "\xe8\x54", + [0x73d8] = "\xe8\x53", [0x73f3] = "\xe8\x5e", [0x73f7] = "\xe8\x5f", + [0x7400] = "\xe8\x60", [0x7403] = "\xe8\x5d", [0x7404] = "\xe8\x5c", + [0x7408] = "\x8f\xe0", [0x7409] = "\x93\xa8", [0x740a] = "\xe8\x5b", + [0x7411] = "\xe8\x64", [0x741b] = "\xe8\x62", [0x7425] = "\xe8\x63", + [0x7426] = "\xe8\x61", [0x7428] = "\x91\xf6", [0x742a] = "\xe8\x65", + [0x7431] = "\xe8\x66", [0x7434] = "\xe8\x68", [0x7441] = "\x8a\xd3", + [0x7442] = "\xe8\x67", [0x7443] = "\x96\xf8", [0x744a] = "\xe8\x73", + [0x744b] = "\xe8\x69", [0x744e] = "\xe8\x6c", [0x7450] = "\xe8\x6a", + [0x7452] = "\xe8\x6b", [0x745a] = "\xe8\x6d", [0x7460] = "\xe8\x6f", + [0x7465] = "\xe8\x70", [0x7467] = "\xe8\x71", [0x746c] = "\xe8\x74", + [0x746d] = "\xe8\x72", [0x746e] = "\xe8\x75", [0x746f] = "\xe8\x77", + [0x7471] = "\xe8\x76", [0x7567] = "\x92\xb7", [0x7570] = "\x96\xe5", + [0x7572] = "\xe8\x78", [0x7573] = "\x91\x4d", [0x7577] = "\xe8\x79", + [0x7579] = "\x95\xc2", [0x757a] = "\xe8\x7a", [0x757b] = "\x8a\x4a", + [0x757f] = "\x89\x5b", [0x7581] = "\x8a\xd5", [0x7583] = "\x8a\xd4", + [0x7584] = "\xe8\x7b", [0x7586] = "\xe8\x7c", [0x7588] = "\xe8\x7d", + [0x7589] = "\xe8\x7e", [0x7590] = "\xe8\x80", [0x7592] = "\x8a\xd6", + [0x7593] = "\x8a\x74", [0x7594] = "\x8d\x7d", [0x7595] = "\x94\xb4", + [0x7597] = "\xe8\x82", [0x7598] = "\xe8\x81", [0x759d] = "\xe8\x83", + [0x75a2] = "\x89\x7b", [0x75a9] = "\xe8\x86", [0x75ab] = "\xe8\x85", + [0x75ac] = "\xe8\x84", [0x75ae] = "\xe8\x87", [0x75b3] = "\xe8\x8a", + [0x75b7] = "\x88\xc5", [0x75ba] = "\xe8\x88", [0x75bc] = "\xe8\x8c", + [0x75bd] = "\xe8\x8b", [0x75c4] = "\xe8\x8e", [0x75c5] = "\xe8\x8d", + [0x75c6] = "\xe8\x8f", [0x75c8] = "\x93\xac", [0x75cc] = "\xe8\x90", + [0x75d1] = "\xe8\x91", [0x75d2] = "\xe8\x93", [0x75d5] = "\xe8\x92", + [0x760c] = "\x95\x8c", [0x7611] = "\xe8\x94", [0x7618] = "\xe8\x95", + [0x761a] = "\x8d\xe3", [0x761e] = "\xe8\x96", [0x761f] = "\xe8\x97", + [0x7622] = "\x96\x68", [0x762b] = "\x91\x6a", [0x762f] = "\x88\xa2", + [0x7630] = "\x91\xc9", [0x7632] = "\xe8\x98", [0x7634] = "\x95\x8d", + [0x763b] = "\xe8\x9b", [0x763c] = "\xe8\x99", [0x763d] = "\x8d\x7e", + [0x763f] = "\xe8\x9a", [0x7640] = "\x8c\xc0", [0x764b] = "\x95\xc3", + [0x764c] = "\xe8\x9d", [0x764d] = "\xe8\x9f", [0x764e] = "\xe8\x9e", + [0x764f] = "\xe8\xa0", [0x7652] = "\x89\x40", [0x7653] = "\x90\x77", + [0x7654] = "\x8f\x9c", [0x7655] = "\x8a\xd7", [0x7656] = "\xe8\xa1", + [0x765a] = "\x94\x86", [0x765c] = "\xe8\xa3", [0x7660] = "\x89\x41", + [0x7662] = "\xe8\xa2", [0x7663] = "\x92\xc2", [0x7665] = "\x97\xcb", + [0x7666] = "\x93\xa9", [0x7667] = "\xe8\x9c", [0x7668] = "\x97\xa4", + [0x766a] = "\x8c\xaf", [0x766d] = "\x97\x7a", [0x7675] = "\x8b\xf7", + [0x7676] = "\x97\xb2", [0x7678] = "\x8c\x47", [0x767a] = "\x91\xe0", + [0x767b] = "\xe4\x40", [0x767d] = "\xe8\xa4", [0x767e] = "\x8a\x4b", + [0x767f] = "\x90\x8f", [0x7684] = "\x8a\x75", [0x7685] = "\xe8\xa6", + [0x7687] = "\xe8\xa7", [0x7688] = "\xe8\xa5", [0x7689] = "\x8c\x84", + [0x768b] = "\x8d\xdb", [0x768c] = "\x8f\xe1", [0x7690] = "\x89\x42", + [0x7693] = "\x97\xd7", [0x7697] = "\xe8\xa9", [0x7698] = "\xe7\xac", + [0x769a] = "\xe8\xa8", [0x76a0] = "\xe8\xac", [0x76a1] = "\xe8\xaa", + [0x76a2] = "\xe8\xab", [0x76a4] = "\xe8\xad", [0x76a6] = "\xe8\xae", + [0x76a7] = "\x97\xea", [0x76a8] = "\xe8\xaf", [0x76a9] = "\xe8\xb0", + [0x76ab] = "\x90\xc7", [0x76ac] = "\x94\xb9", [0x76b0] = "\x90\x9d", + [0x76b1] = "\x8a\xe5", [0x76b4] = "\x97\x59", [0x76b5] = "\x89\xeb", + [0x76b6] = "\x8f\x57", [0x76b7] = "\x8c\xd9", [0x76b9] = "\xe8\xb3", + [0x76bb] = "\xe8\xb2", [0x76bc] = "\x8e\x93", [0x76bd] = "\xe8\xb4", + [0x76be] = "\xe8\xb1", [0x76c1] = "\x8e\x47", [0x76c5] = "\xe8\xb8", + [0x76c6] = "\xe5\xab", [0x76c9] = "\x99\xd4", [0x76cb] = "\x90\x97", + [0x76cc] = "\xe8\xb6", [0x76d2] = "\x97\xa3", [0x76d3] = "\x93\xef", + [0x76d8] = "\x89\x4a", [0x76da] = "\x90\xe1", [0x76db] = "\x8e\xb4", + [0x76e0] = "\x95\xb5", [0x76e2] = "\x89\x5f", [0x76e6] = "\x97\xeb", + [0x76e7] = "\x97\x8b", [0x76e9] = "\xe8\xb9", [0x76eb] = "\x93\x64", + [0x76f0] = "\x8e\xf9", [0x76f4] = "\xe8\xba", [0x76f6] = "\xe8\xbb", + [0x76f7] = "\x90\x6b", [0x76f8] = "\xe8\xbc", [0x76fa] = "\x97\xec", + [0x76fd] = "\xe8\xb7", [0x76fe] = "\xe8\xbe", [0x76ff] = "\xe8\xc0", + [0x7701] = "\xe8\xbf", [0x7703] = "\xe8\xbd", [0x7706] = "\xe8\xc1", + [0x7709] = "\xe8\xc2", [0x770c] = "\x91\x9a", [0x770e] = "\x89\xe0", + [0x7714] = "\xe8\xc3", [0x7717] = "\x96\xb6", [0x771a] = "\xe8\xc4", + [0x7720] = "\xe8\xc5", [0x7722] = "\x98\x49", [0x7728] = "\x9e\x50", + [0x7729] = "\xe8\xc6", [0x772d] = "\xe8\xc7", [0x772e] = "\xe8\xc8", + [0x7732] = "\xe8\xcc", [0x7734] = "\xe8\xc9", [0x7736] = "\xe8\xca", + [0x7738] = "\xe8\xcb", [0x7739] = "\xe8\xcd", [0x7742] = "\x90\xc2", + [0x7746] = "\x96\xf5", [0x7749] = "\x90\xc3", [0x774c] = "\xe8\xce", + [0x774e] = "\x94\xf1", [0x7750] = "\xe8\xcf", [0x7751] = "\xea\x72", + [0x7752] = "\x96\xca", [0x7754] = "\xe8\xd0", [0x7756] = "\xe8\xd1", + [0x7758] = "\xe8\xd2", [0x7759] = "\x8a\x76", [0x775b] = "\xe8\xd4", + [0x775d] = "\x90\x78", [0x7761] = "\xe8\xd5", [0x7764] = "\x8c\x43", + [0x7769] = "\xe8\xd6", [0x776a] = "\xe8\xda", [0x776c] = "\xe8\xd8", + [0x7771] = "\xe8\xd9", [0x7774] = "\x8a\x93", [0x7775] = "\xe8\xd7", + [0x7776] = "\xe8\xdb", [0x777b] = "\xe8\xdc", [0x777d] = "\x88\xc6", + [0x777f] = "\xe8\xdd", [0x7780] = "\xe8\xde", [0x7788] = "\x8f\xe2", + [0x778c] = "\xe8\xdf", [0x7790] = "\x8b\x66", [0x7793] = "\xe8\xe2", + [0x7796] = "\xe8\xe1", [0x7798] = "\xe8\xe0", [0x779b] = "\xe6\x91", + [0x779d] = "\x95\xda", [0x77a3] = "\xe8\xe3", [0x77a4] = "\xe8\xe4", + [0x77b3] = "\xe8\xe5", [0x77b6] = "\xe8\xe6", [0x77b8] = "\xe8\xe7", + [0x77bb] = "\xe8\xe8", [0x77c3] = "\x8a\xd8", [0x77cc] = "\xe8\xe9", + [0x77dd] = "\xe8\xea", [0x77de] = "\x94\x42", [0x77e2] = "\xe8\xec", + [0x77e3] = "\x89\xb9", [0x77e5] = "\xe8\xef", [0x77e6] = "\xe8\xee", + [0x77eb] = "\x89\x43", [0x77ef] = "\x8b\xbf", [0x77f1] = "\x95\xc5", + [0x77f2] = "\x92\xb8", [0x77f3] = "\x8d\xa0", [0x77f5] = "\x8d\x80", + [0x77f6] = "\x8f\x87", [0x77f8] = "\x90\x7b", [0x77fc] = "\xe8\xf1", + [0x77ff] = "\xe8\xf0", [0x7800] = "\x97\x61", [0x7801] = "\x8a\xe6", + [0x7802] = "\x94\xd0", [0x7803] = "\x93\xda", [0x7807] = "\x90\x9c", + [0x7808] = "\x97\xcc", [0x780a] = "\x8c\x7a", [0x7811] = "\xe8\xf4", + [0x7814] = "\xe8\xf3", [0x781c] = "\x96\x6a", [0x781d] = "\x93\xaa", + [0x7824] = "\x89\x6f", [0x7827] = "\xe8\xf5", [0x7828] = "\xe8\xf2", + [0x782b] = "\x95\x70", [0x782c] = "\x97\x8a", [0x782d] = "\xe8\xf6", + [0x7836] = "\xe8\xf7", [0x783b] = "\xe8\xf9", [0x783c] = "\x91\xe8", + [0x783d] = "\x8a\x7a", [0x783e] = "\x8a\x7b", [0x783f] = "\xe8\xf8", + [0x7844] = "\x8a\xe7", [0x7845] = "\x8c\xb0", [0x7848] = "\x8a\xe8", + [0x784b] = "\x93\x5e", [0x784e] = "\x97\xde", [0x7857] = "\x8c\xda", + [0x785b] = "\xe8\xfa", [0x785f] = "\xe8\xfb", [0x7860] = "\xe8\xfc", + [0x7861] = "\xe9\x40", [0x7863] = "\xe9\x42", [0x7864] = "\xe9\x41", + [0x7898] = "\x95\x97", [0x789a] = "\xe9\x43", [0x789f] = "\xe9\x44", + [0x78a1] = "\xe9\x45", [0x78a6] = "\xe9\x46", [0x78b3] = "\xe9\x48", + [0x78b4] = "\xe9\x47", [0x78b6] = "\xe9\x49", [0x78cb] = "\x94\xf2", + [0x78cc] = "\xe3\xca", [0x78cf] = "\x90\x48", [0x78d2] = "\x8b\x51", + [0x78d9] = "\xe9\x4a", [0x78db] = "\xe9\x4b", [0x78dd] = "\x99\xaa", + [0x78de] = "\x9f\x5a", [0x78df] = "\x94\xd1", [0x78e2] = "\x88\xf9", + [0x78e4] = "\x88\xb9", [0x78ec] = "\x8e\x94", [0x78ed] = "\x96\x4f", + [0x78ee] = "\x8f\xfc", [0x78f3] = "\xe9\x4c", [0x78f5] = "\x96\xdd", + [0x78f9] = "\xe9\x4d", [0x78fa] = "\x97\x7b", [0x78fc] = "\x89\x61", + [0x7900] = "\x8e\x60", [0x7902] = "\xe9\x4e", [0x7903] = "\x89\xec", + [0x7904] = "\xe9\x4f", [0x7908] = "\xe9\x50", [0x790d] = "\xe9\x52", + [0x790e] = "\xe9\x53", [0x7910] = "\xe9\x55", [0x7911] = "\xe9\x51", + [0x7914] = "\xe9\x54", [0x7918] = "\x8a\xd9", [0x791c] = "\xe9\x56", + [0x791e] = "\xe9\x57", [0x792d] = "\xe9\x58", [0x792e] = "\xe9\x59", + [0x7932] = "\xe9\x5a", [0x7935] = "\xe9\x5c", [0x7939] = "\xe9\x5b", + [0x793b] = "\xe9\x5e", [0x793c] = "\xe9\x61", [0x7940] = "\xe9\x5d", + [0x7941] = "\xe9\x5f", [0x7942] = "\xe9\x60", [0x7945] = "\xe9\x62", + [0x7947] = "\x8b\xc0", [0x7986] = "\x8e\xf1", [0x7987] = "\xe9\x63", + [0x7988] = "\xe9\x64", [0x7989] = "\x8d\x81", [0x7995] = "\xe9\x65", + [0x7998] = "\x8a\x5d", [0x799c] = "\x94\x6e", [0x799d] = "\xe9\x66", + [0x799e] = "\xe9\x67", [0x79a3] = "\x92\x79", [0x79a4] = "\x93\xe9", + [0x79ac] = "\xe9\x68", [0x79b1] = "\x94\x9d", [0x79b4] = "\x91\xca", + [0x79b5] = "\x89\x77", [0x79b6] = "\x8b\xec", [0x79b8] = "\x8b\xed", + [0x79c0] = "\x92\x93", [0x79c1] = "\xe9\x6d", [0x79c2] = "\x8b\xee", + [0x79c5] = "\x89\xed", [0x79c8] = "\xe9\x6c", [0x79cb] = "\xe9\x6a", + [0x79cd] = "\xe9\x6b", [0x79cf] = "\xe9\x69", [0x79d2] = "\xe9\x77", + [0x79dd] = "\xe9\x6e", [0x79de] = "\xe9\x6f", [0x79e1] = "\xe9\x70", + [0x79e2] = "\xe9\x71", [0x79e8] = "\xe9\x73", [0x79eb] = "\xe9\x72", + [0x79ef] = "\x8f\x78", [0x79f1] = "\xe9\x74", [0x79f5] = "\xe9\x76", + [0x79fe] = "\x8b\x52", [0x79ff] = "\xe9\x75", [0x7a02] = "\x91\x9b", + [0x7a03] = "\x8c\xb1", [0x7a09] = "\xe9\x78", [0x7a18] = "\x91\xcb", + [0x7a1b] = "\xe9\x79", [0x7a20] = "\x93\xab", [0x7a27] = "\xe9\x7a", + [0x7a2e] = "\xe9\x80", [0x7a30] = "\xe9\x7d", [0x7a32] = "\xe9\x7c", + [0x7a33] = "\xe9\x7e", [0x7a35] = "\xe9\x7b", [0x7a3d] = "\xe9\x82", + [0x7a45] = "\xe9\x81", [0x7a47] = "\xe9\x84", [0x7a4a] = "\x8b\xc1", + [0x7a4b] = "\xe9\x83", [0x7a4f] = "\xe9\x85", [0x7a52] = "\xe9\x86", + [0x7a54] = "\xe9\x88", [0x7a55] = "\xe9\x87", [0x7a59] = "\xe9\x89", + [0x7a5a] = "\xe9\x8b", [0x7a5b] = "\xe9\x8a", [0x7a98] = "\x8d\x9c", + [0x7a9d] = "\xe9\x8c", [0x7aa0] = "\xe9\x8d", [0x7aa8] = "\x8a\x5b", + [0x7aac] = "\xe9\x8e", [0x7ab0] = "\xe9\x8f", [0x7ab4] = "\x90\x91", + [0x7abf] = "\xe9\x90", [0x7ac1] = "\xe9\x91", [0x7ac3] = "\xe9\x92", + [0x7ac4] = "\xe9\x93", [0x7ac8] = "\x8d\x82", [0x7ace] = "\xe9\x94", + [0x7acf] = "\xe9\x95", [0x7ad2] = "\xe9\x96", [0x7ad3] = "\xe9\x97", + [0x7ad6] = "\xe9\x98", [0x7ada] = "\x94\xaf", [0x7adb] = "\xe9\x9a", + [0x7add] = "\x95\x45", [0x7ade] = "\xe9\x9b", [0x7adf] = "\xe9\x99", + [0x7ae1] = "\xe9\x9d", [0x7ae4] = "\xe9\x9c", [0x7ae7] = "\xe9\x9e", + [0x7aeb] = "\xe9\x9f", [0x7af6] = "\xe9\xa0", [0x7b08] = "\xe9\xa1", + [0x7b0a] = "\xe9\xa2", [0x7b0f] = "\xe9\xa3", [0x7b12] = "\xe9\xa4", + [0x7b13] = "\xe9\xa5", [0x7b15] = "\xe9\xa6", [0x7b17] = "\xe9\xa7", + [0x7b18] = "\xe9\xa8", [0x7b19] = "\xe9\xa9", [0x7b1a] = "\xe9\xaa", + [0x7b1e] = "\xe9\xab", [0x7b1f] = "\xe9\xac", [0x7b21] = "\x9f\x54", + [0x7b22] = "\xe9\xad", [0x7b2b] = "\xe2\xf6", [0x7b2c] = "\x8b\x53", + [0x7b31] = "\x8a\x40", [0x7b32] = "\x8d\xb0", [0x7b33] = "\xe9\xaf", + [0x7b34] = "\xe9\xae", [0x7b35] = "\x96\xa3", [0x7b3d] = "\xe9\xb1", + [0x7b3e] = "\xe9\xb2", [0x7b3f] = "\xe9\xb0", [0x7b41] = "\xe9\xb3", + [0x7b44] = "\x96\x82", [0x7b48] = "\xe9\xb4", [0x7b4a] = "\x8b\x9b", + [0x7b5f] = "\x98\x44", [0x7b64] = "\xe9\xb5", [0x7b73] = "\xe9\xb7", + [0x7b7e] = "\x88\xbc", [0x7b81] = "\xe9\xb8", [0x7b82] = "\x95\xa9", + [0x7b83] = "\xe9\xb6", [0x7b86] = "\xe9\xb9", [0x7b87] = "\xe9\xba", + [0x7b8f] = "\xe9\xbb", [0x7b90] = "\xe9\xbc", [0x7b98] = "\xe9\xbd", + [0x7b9a] = "\x96\x8e", [0x7b9b] = "\x8e\x4c", [0x7b9d] = "\x8d\xf8", + [0x7b9e] = "\x91\x4e", [0x7ba4] = "\xe9\xbe", [0x7ba9] = "\xe9\xc1", + [0x7bb0] = "\xe9\xbf", [0x7bb6] = "\xe9\xc2", [0x7bb9] = "\x8c\xef", + [0x7bba] = "\xe9\xc0", [0x7bbf] = "\xe9\xc3", [0x7bc1] = "\xe9\xc4", + [0x7bc2] = "\xe9\xc5", [0x7bc4] = "\xe9\xc9", [0x7bc6] = "\x8e\x49", + [0x7bcb] = "\x91\xe2", [0x7bd1] = "\xe9\xca", [0x7bd2] = "\xe9\xc7", + [0x7bd3] = "\xe9\xc6", [0x7bd4] = "\xe9\xc8", [0x7bd8] = "\x8c\x7e", + [0x7be0] = "\xe9\xce", [0x7be1] = "\xe9\xcd", [0x7be2] = "\xe9\xcc", + [0x7be5] = "\x88\xb1", [0x7bf4] = "\xe9\xd8", [0x7bf6] = "\xe9\xd4", + [0x7bf8] = "\xe9\xd5", [0x7bf9] = "\xe9\xd1", [0x7bfa] = "\xe9\xd7", + [0x7bfc] = "\xe9\xd3", [0x7bfd] = "\x8a\x82", [0x7c00] = "\x98\x6b", + [0x7c02] = "\xe9\xd6", [0x7c03] = "\xe9\xd2", [0x7c04] = "\xe9\xd0", + [0x7c05] = "\xe9\xcf", [0x7c0b] = "\xe9\xda", [0x7c11] = "\xe9\xdd", + [0x7c14] = "\xe9\xdc", [0x7c15] = "\xe9\xdb", [0x7c1d] = "\x95\x68", + [0x7c1e] = "\xe9\xd9", [0x7c1f] = "\x88\xf1", [0x7c20] = "\xe9\xde", + [0x7c22] = "\xe9\xe0", [0x7c29] = "\x8a\x8f", [0x7c2a] = "\xe9\xcb", + [0x7c2b] = "\x89\x56", [0x7c2e] = "\xe9\xe2", [0x7c36] = "\xe9\xe1", + [0x7c37] = "\xe9\xdf", [0x7c38] = "\x92\x4c", [0x7c42] = "\x96\x90", + [0x7c47] = "\x97\xd8", [0x7c4a] = "\xe9\xe3", [0x7c50] = "\xe9\xe4", + [0x7c57] = "\xe9\xe5", [0x7c66] = "\xe9\xe6", [0x7c68] = "\xe9\xe7", + [0x7cd5] = "\x92\xb9", [0x7cd7] = "\xe9\xe8", [0x7cd9] = "\x94\xb5", + [0x7cdb] = "\xe9\xed", [0x7cdc] = "\xe9\xe9", [0x7ce0] = "\xe9\xea", + [0x7ce3] = "\x96\x50", [0x7ce4] = "\x96\xc2", [0x7ce6] = "\x93\xce", + [0x7cf3] = "\xe9\xee", [0x7cf6] = "\xe9\xef", [0x7cf7] = "\x93\xbc", + [0x7cf8] = "\xe9\xec", [0x7cf9] = "\xe9\xeb", [0x7cfe] = "\x89\xa8", + [0x7d02] = "\xe9\xf7", [0x7d05] = "\xe9\xf6", [0x7d0b] = "\x89\x95", + [0x7d0f] = "\xe9\xf4", [0x7d13] = "\xe9\xf3", [0x7d16] = "\xe9\xf1", + [0x7d18] = "\x8a\x9b", [0x7d1a] = "\xe9\xf0", [0x7d1b] = "\x8e\xb0", + [0x7d1c] = "\x89\xa7", [0x7d2b] = "\x8d\x83", [0x7d2e] = "\xe9\xfa", + [0x7d2f] = "\xe9\xf9", [0x7d31] = "\xe9\xf8", [0x7d34] = "\xe9\xf5", + [0x7d36] = "\xe9\xfb", [0x7d38] = "\xe9\xfc", [0x7d40] = "\xea\x44", + [0x7d41] = "\xea\x43", [0x7d49] = "\xea\x45", [0x7d4c] = "\x89\x4c", + [0x7d4d] = "\xea\x40", [0x7d4e] = "\xea\x41", [0x7d50] = "\x8d\x94", + [0x7d51] = "\x96\xb7", [0x7d54] = "\xea\x42", [0x7d5c] = "\x96\x51", + [0x7d5f] = "\xea\x4a", [0x7d62] = "\xea\x46", [0x7d6a] = "\xea\x4b", + [0x7d77] = "\xea\x48", [0x7d79] = "\xea\x47", [0x7d7f] = "\x8c\x7b", + [0x7d8a] = "\xea\x4c", [0x7d94] = "\xea\x4d", [0x7d99] = "\xea\x4e", + [0x7d9b] = "\xea\x49", [0x7d9f] = "\xe9\xf2", [0x7da2] = "\xea\x4f", + [0x7da4] = "\x92\xdf", [0x7da8] = "\xea\x53", [0x7daa] = "\xea\x54", + [0x7dab] = "\xea\x52", [0x7db1] = "\xea\x51", [0x7db2] = "\xea\x57", + [0x7db4] = "\xea\x50", [0x7db6] = "\xea\x55", [0x7dbf] = "\xea\x56", + [0x7dc3] = "\xea\x59", [0x7dc9] = "\xea\x58", [0x7dd6] = "\xea\x5b", + [0x7ddd] = "\xea\x5c", [0x7ddf] = "\xea\x5d", [0x7de2] = "\x98\x68", + [0x7de8] = "\xea\x5a", [0x7de9] = "\x91\xe9", [0x7dea] = "\x8d\xeb", + [0x7ded] = "\xea\x5e", [0x7e0a] = "\xea\x5f", [0x7e0b] = "\xea\x60", + [0x7e0e] = "\xea\x61", [0x7e65] = "\xea\x62", [0x7e68] = "\x8c\xb2", + [0x7e69] = "\xea\x63", [0x7e6d] = "\xea\x64", [0x7e6f] = "\x8e\xad", + [0x7e71] = "\xea\x65", [0x7e78] = "\xea\x66", [0x7e7b] = "\xea\x67", + [0x7e7c] = "\xea\x68", [0x7e81] = "\xea\x6b", [0x7e82] = "\xea\x69", + [0x7e83] = "\x98\x5b", [0x7e85] = "\xea\x6a", [0x7e87] = "\x97\xed", + [0x7e8d] = "\xea\x6c", [0x7e8f] = "\x97\xd9", [0x7e95] = "\xea\x6d", + [0x7e96] = "\x94\x9e", [0x7e99] = "\xea\x6e", [0x7e9a] = "\xea\x70", + [0x7e9d] = "\xea\x71", [0x7ea8] = "\xea\x6f", [0x7ea9] = "\x8d\x8d", + [0x7eaa] = "\x96\xcb", [0x7eab] = "\x96\x83", [0x7eac] = "\x9b\xf5", + [0x7eae] = "\x9f\x80", [0x7eaf] = "\x96\x9b", [0x7eb4] = "\x89\xa9", + [0x7ebc] = "\xea\x73", [0x7ebd] = "\x8b\x6f", [0x7ebe] = "\xea\x74", + [0x7ebf] = "\xea\x75", [0x7ec0] = "\xea\x76", [0x7ec2] = "\x8d\x95", + [0x7ec4] = "\xea\x77", [0x7ec8] = "\xe0\xd2", [0x7ec9] = "\x96\xd9", + [0x7ecb] = "\x91\xe1", [0x7ecc] = "\xea\x78", [0x7ecd] = "\xea\x7a", + [0x7ece] = "\xea\x79", [0x7ed0] = "\xea\x7b", [0x7ed5] = "\xea\x7c", + [0x7ed8] = "\xea\x7d", [0x7edf] = "\xea\x7e", [0x7ee4] = "\xea\x80", + [0x7ee6] = "\xea\x81", [0x7ee7] = "\xea\x82", [0x7ee9] = "\xea\x83", + [0x7eeb] = "\xea\x84", [0x7eec] = "\xea\x85", [0x7eed] = "\xea\x86", + [0x7ef7] = "\xea\x87", [0x7ef8] = "\xea\x88", [0x7efe] = "\x93\x43", + [0x7f03] = "\x8c\xdb", [0x7f05] = "\xea\x8a", [0x7f10] = "\x91\x6c", + [0x7f11] = "\xea\x8b", [0x7f1c] = "\xea\x8c", [0x7f2b] = "\x95\x40", + [0x7f2e] = "\xea\x8d", [0x7f3a] = "\xea\x8e", [0x7f3b] = "\xe2\x56", + [0x7f3e] = "\xe6\xd8", [0x7f3f] = "\xe8\xeb", [0x7f42] = "\xea\x8f", + [0x7f44] = "\xea\x90", [0x7f4f] = "\xea\x92", [0x7f50] = "\xea\x93", + [0x7f51] = "\xea\x94", [0x7f52] = "\x97\xee", [0x7f53] = "\xea\x91", + [0x7f56] = "\xea\x95", [0x7f57] = "\xea\x96", [0x7f5a] = "\xea\x98", + [0x7f5c] = "\xea\x97", [0x7f62] = "\xea\x9a", [0x7f66] = "\xea\x9b", + [0x7f67] = "\xea\x99", [0x7f7d] = "\x97\xb4", [0x7f85] = "\xea\x9c", + [0x7f8c] = "\xea\x9d", [0x7f8d] = "\xe2\x73", [0x7f90] = "\xea\x9e" +}; + +static const char from_ucs4_extra[0x100][2] = +{ + [0x0001] = "\x81\x49", [0x0003] = "\x81\x94", [0x0004] = "\x81\x90", + [0x0005] = "\x81\x93", [0x0006] = "\x81\x95", [0x0008] = "\x81\x69", + [0x0009] = "\x81\x6a", [0x000a] = "\x81\x96", [0x000b] = "\x81\x7b", + [0x000c] = "\x81\x43", [0x000e] = "\x81\x44", [0x000f] = "\x81\x5e", + [0x0010] = "\x82\x4f", [0x0011] = "\x82\x50", [0x0012] = "\x82\x51", + [0x0013] = "\x82\x52", [0x0014] = "\x82\x53", [0x0015] = "\x82\x54", + [0x0016] = "\x82\x55", [0x0017] = "\x82\x56", [0x0018] = "\x82\x57", + [0x0019] = "\x82\x58", [0x001a] = "\x81\x46", [0x001b] = "\x81\x47", + [0x001c] = "\x81\x83", [0x001d] = "\x81\x81", [0x001e] = "\x81\x84", + [0x001f] = "\x81\x48", [0x0020] = "\x81\x97", [0x0021] = "\x82\x60", + [0x0022] = "\x82\x61", [0x0023] = "\x82\x62", [0x0024] = "\x82\x63", + [0x0025] = "\x82\x64", [0x0026] = "\x82\x65", [0x0027] = "\x82\x66", + [0x0028] = "\x82\x67", [0x0029] = "\x82\x68", [0x002a] = "\x82\x69", + [0x002b] = "\x82\x6a", [0x002c] = "\x82\x6b", [0x002d] = "\x82\x6c", + [0x002e] = "\x82\x6d", [0x002f] = "\x82\x6e", [0x0030] = "\x82\x6f", + [0x0031] = "\x82\x70", [0x0032] = "\x82\x71", [0x0033] = "\x82\x72", + [0x0034] = "\x82\x73", [0x0035] = "\x82\x74", [0x0036] = "\x82\x75", + [0x0037] = "\x82\x76", [0x0038] = "\x82\x77", [0x0039] = "\x82\x78", + [0x003a] = "\x82\x79", [0x003b] = "\x81\x6d", [0x003c] = "\x81\x5f", + [0x003d] = "\x81\x6e", [0x003e] = "\x81\x4f", [0x003f] = "\x81\x51", + [0x0040] = "\x81\x4d", [0x0041] = "\x82\x81", [0x0042] = "\x82\x82", + [0x0043] = "\x82\x83", [0x0044] = "\x82\x84", [0x0045] = "\x82\x85", + [0x0046] = "\x82\x86", [0x0047] = "\x82\x87", [0x0048] = "\x82\x88", + [0x0049] = "\x82\x89", [0x004a] = "\x82\x8a", [0x004b] = "\x82\x8b", + [0x004c] = "\x82\x8c", [0x004d] = "\x82\x8d", [0x004e] = "\x82\x8e", + [0x004f] = "\x82\x8f", [0x0050] = "\x82\x90", [0x0051] = "\x82\x91", + [0x0052] = "\x82\x92", [0x0053] = "\x82\x93", [0x0054] = "\x82\x94", + [0x0055] = "\x82\x95", [0x0056] = "\x82\x96", [0x0057] = "\x82\x97", + [0x0058] = "\x82\x98", [0x0059] = "\x82\x99", [0x005a] = "\x82\x9a", + [0x005b] = "\x81\x6f", [0x005c] = "\x81\x62", [0x005d] = "\x81\x70", + [0x005e] = "\x00\x00", [0x005f] = "\x00\x00", + [0x0060] = "\x00\x00", [0x0061] = "\xa1\x00", [0x0062] = "\xa2\x00", + [0x0063] = "\xa3\x00", [0x0064] = "\xa4\x00", [0x0065] = "\xa5\x00", + [0x0066] = "\xa6\x00", [0x0067] = "\xa7\x00", [0x0068] = "\xa8\x00", + [0x0069] = "\xa9\x00", [0x006a] = "\xaa\x00", [0x006b] = "\xab\x00", + [0x006c] = "\xac\x00", [0x006d] = "\xad\x00", [0x006e] = "\xae\x00", + [0x006f] = "\xaf\x00", [0x0070] = "\xb0\x00", [0x0071] = "\xb1\x00", + [0x0072] = "\xb2\x00", [0x0073] = "\xb3\x00", [0x0074] = "\xb4\x00", + [0x0075] = "\xb5\x00", [0x0076] = "\xb6\x00", [0x0077] = "\xb7\x00", + [0x0078] = "\xb8\x00", [0x0079] = "\xb9\x00", [0x007a] = "\xba\x00", + [0x007b] = "\xbb\x00", [0x007c] = "\xbc\x00", [0x007d] = "\xbd\x00", + [0x007e] = "\xbe\x00", [0x007f] = "\xbf\x00", [0x0080] = "\xc0\x00", + [0x0081] = "\xc1\x00", [0x0082] = "\xc2\x00", [0x0083] = "\xc3\x00", + [0x0084] = "\xc4\x00", [0x0085] = "\xc5\x00", [0x0086] = "\xc6\x00", + [0x0087] = "\xc7\x00", [0x0088] = "\xc8\x00", [0x0089] = "\xc9\x00", + [0x008a] = "\xca\x00", [0x008b] = "\xcb\x00", [0x008c] = "\xcc\x00", + [0x008d] = "\xcd\x00", [0x008e] = "\xce\x00", [0x008f] = "\xcf\x00", + [0x0090] = "\xd0\x00", [0x0091] = "\xd1\x00", [0x0092] = "\xd2\x00", + [0x0093] = "\xd3\x00", [0x0094] = "\xd4\x00", [0x0095] = "\xd5\x00", + [0x0096] = "\xd6\x00", [0x0097] = "\xd7\x00", [0x0098] = "\xd8\x00", + [0x0099] = "\xd9\x00", [0x009a] = "\xda\x00", [0x009b] = "\xdb\x00", + [0x009c] = "\xdc\x00", [0x009d] = "\xdd\x00", [0x009e] = "\xde\x00", + [0x009f] = "\xdf\x00", + [0x00e0] = "\x81\x91", [0x00e1] = "\x81\x92", [0x00e2] = "\x81\xCA", + [0x00e3] = "\x81\x50", [0x00e5] = "\x81\x8f" +}; + +/* Definitions used in the body of the `gconv' function. */ +#define CHARSET_NAME "SJIS//" +#define FROM_LOOP from_sjis +#define TO_LOOP to_sjis +#define DEFINE_INIT 1 +#define DEFINE_FINI 1 +#define MIN_NEEDED_FROM 1 +#define MAX_NEEDED_FROM 2 +#define MIN_NEEDED_TO 4 + +/* First define the conversion function from SJIS to UCS4. */ +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MAX_NEEDED_INPUT MAX_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint32_t ch = *inptr; \ + \ + if (__builtin_expect (ch, 0) == 0x5c) \ + { \ + ch = 0xa5; \ + ++inptr; \ + } \ + else if (__builtin_expect (ch, 0) == 0x7e) \ + { \ + ch = 0x203e; \ + ++inptr; \ + } \ + else if (ch < 0x80) \ + ++inptr; \ + else if (ch >= 0xa1 && ch <= 0xdf) \ + { \ + ch = halfkana_to_ucs4[ch - 0xa1]; \ + ++inptr; \ + } \ + else if (__builtin_expect (ch > 0xea, 0) \ + || __builtin_expect (ch, 0) == 0xa0 \ + || __builtin_expect (ch <= 0x80, 0)) \ + { \ + /* These are illegal. */ \ + if (! ignore_errors_p ()) \ + { \ + /* This is an illegal character. */ \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + ++inptr; \ + ++*irreversible; \ + continue; \ + } \ + else \ + { \ + /* Two-byte character. First test whether the next character \ + is also available. */ \ + uint32_t ch2; \ + uint_fast32_t idx; \ + \ + if (__builtin_expect (inptr + 1 >= inend, 0)) \ + { \ + /* The second character is not available. Store \ + the intermediate result. */ \ + result = __GCONV_INCOMPLETE_INPUT; \ + break; \ + } \ + \ + ch2 = inptr[1]; \ + idx = ch * 256 + ch2; \ + if (__builtin_expect (ch2 < 0x40, 0) \ + || (__builtin_expect (idx > 0x84be, 0) && idx < 0x889f) \ + || (__builtin_expect (idx > 0x88fc, 0) && idx < 0x8940) \ + || (__builtin_expect (idx > 0x9ffc, 0) && idx < 0xe040) \ + || __builtin_expect (idx > 0xeaa4, 0)) \ + { \ + /* This is illegal. */ \ + if (! ignore_errors_p ()) \ + { \ + /* This is an illegal character. */ \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + ++inptr; \ + ++*irreversible; \ + continue; \ + } \ + else \ + { \ + /* We could pack the data a bit more dense. The second \ + byte will never be 0x7f and it will also be never \ + >0xfc. But this would mean yet more `if's. */ \ + if (idx <= 0x84be) \ + ch = cjk_block1[(ch - 0x81) * 192 + ch2 - 0x40]; \ + else if (idx <= 0x88fc) \ + ch = cjk_block2[(ch - 0x88) * 192 + ch2 - 0x9f]; \ + else if (idx <= 0x9ffc) \ + ch = cjk_block3[(ch - 0x89) * 192 + ch2 - 0x40]; \ + else \ + ch = cjk_block4[(ch - 0xe0) * 192 + ch2 - 0x40]; \ + \ + inptr += 2; \ + } \ + \ + if (__builtin_expect (ch, 1) == 0) \ + { \ + /* This is an illegal character. */ \ + if (! ignore_errors_p ()) \ + { \ + /* This is an illegal character. */ \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + inptr += 2; \ + ++*irreversible; \ + continue; \ + } \ + } \ + \ + put32 (outptr, ch); \ + outptr += 4; \ + } +#define LOOP_NEED_FLAGS +#include + + +/* Next, define the other direction. */ +#define MIN_NEEDED_INPUT MIN_NEEDED_TO +#define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM +#define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM +#define LOOPFCT TO_LOOP +#define BODY \ + { \ + uint32_t ch = get32 (inptr); \ + const char *cp; \ + \ + if (ch >= (sizeof (from_ucs4_lat1) / sizeof (from_ucs4_lat1[0]))) \ + { \ + if (ch >= 0x0391 && ch <= 0x0451) \ + cp = from_ucs4_greek[ch - 0x391]; \ + else if (ch >= 0x2010 && ch <= 0x9fa0) \ + cp = from_ucs4_cjk[ch - 0x02010]; \ + else if (__builtin_expect (ch >= 0xff01, 1) \ + && __builtin_expect (ch <= 0xffef, 1)) \ + cp = from_ucs4_extra[ch - 0xff00]; \ + else \ + { \ + UNICODE_TAG_HANDLER (ch, 4); \ + /* Illegal character. */ \ + cp = ""; \ + } \ + } \ + else \ + cp = from_ucs4_lat1[ch]; \ + \ + if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \ + { \ + /* Illegal character. */ \ + STANDARD_ERR_HANDLER (4); \ + } \ + else \ + { \ + *outptr = cp[0]; \ + /* Now test for a possible second byte and write this if possible. */\ + if (cp[1] != '\0') \ + { \ + if (__builtin_expect (outptr + 1 >= outend, 0)) \ + { \ + /* The result does not fit into the buffer. */ \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + *++outptr = cp[1]; \ + } \ + ++outptr; \ + } \ + \ + inptr += 4; \ + } +#define LOOP_NEED_FLAGS +#include + + +/* Now define the toplevel functions. */ +#include diff --git a/newlib/libc/include/errno.h b/newlib/libc/include/errno.h index 81eaef710..7cc2ca86f 100644 --- a/newlib/libc/include/errno.h +++ b/newlib/libc/include/errno.h @@ -1,7 +1,10 @@ #ifndef __ERRNO_H__ #define __ERRNO_H__ +#ifndef __error_t_defined typedef int error_t; +#define __error_t_defined 1 +#endif #include diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am index 69eaa7e88..be9790308 100644 --- a/newlib/libc/sys/linux/Makefile.am +++ b/newlib/libc/sys/linux/Makefile.am @@ -169,6 +169,8 @@ liblinux_la_LDFLAGS = -Xcompiler -nostdlib ADD_OBJS = \ malloc.$(oext) \ + gethostid.$(oext) \ + sethostid.$(oext) \ $(LINUX_MACH_LIB) if USE_LIBTOOL diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in index 7a4045431..560ce1b58 100644 --- a/newlib/libc/sys/linux/Makefile.in +++ b/newlib/libc/sys/linux/Makefile.in @@ -257,6 +257,8 @@ liblinux_la_LDFLAGS = -Xcompiler -nostdlib ADD_OBJS = \ malloc.$(oext) \ + gethostid.$(oext) \ + sethostid.$(oext) \ $(LINUX_MACH_LIB) diff --git a/newlib/libc/sys/linux/configure b/newlib/libc/sys/linux/configure index 89fda7ed6..c7e1d3833 100755 --- a/newlib/libc/sys/linux/configure +++ b/newlib/libc/sys/linux/configure @@ -3043,6 +3043,17 @@ fi EXTRA_SUBDIRS= EXTRA_SUBLIBS= +if test "${newlib_multithread}" = "yes"; then +EXTRA_CONFIG_DIRS=linuxthreads +fi +if test "x${newlib_elix_level}" = "x1"; then +EXTRA_SUBDIRS=linuxthreads net +else +EXTRA_SUBDIRS="linuxthreads net intl stdlib iconv dl" +EXTRA_SUBLIBS="net/libnet.la intl/libintl.la stdlib/libstdlib.la iconv/libiconv.la dl/libdl.la" +fi + + subdirs="machine $EXTRA_CONFIG_DIRS" @@ -3161,7 +3172,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile cmath/Makefile argp/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile intl/Makefile net/Makefile stdlib/Makefile iconv/Makefile dl/Makefile cmath/Makefile argp/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/newlib/libc/sys/linux/configure.in b/newlib/libc/sys/linux/configure.in index c97ca87d7..e03bcd960 100644 --- a/newlib/libc/sys/linux/configure.in +++ b/newlib/libc/sys/linux/configure.in @@ -31,9 +31,20 @@ AC_SUBST(LINUX_MACH_LIB) EXTRA_SUBDIRS= EXTRA_SUBLIBS= + +if test "${newlib_multithread}" = "yes"; then +EXTRA_CONFIG_DIRS=linuxthreads +fi +if test "x${newlib_elix_level}" = "x1"; then +EXTRA_SUBDIRS=linuxthreads net +else +EXTRA_SUBDIRS="linuxthreads net intl stdlib iconv dl" +EXTRA_SUBLIBS="net/libnet.la intl/libintl.la stdlib/libstdlib.la iconv/libiconv.la dl/libdl.la" +fi + AC_SUBST(EXTRA_SUBDIRS) AC_SUBST(EXTRA_SUBLIBS) AC_CONFIG_SUBDIRS(machine $EXTRA_CONFIG_DIRS) -AC_OUTPUT(Makefile cmath/Makefile argp/Makefile) +AC_OUTPUT(Makefile intl/Makefile net/Makefile stdlib/Makefile iconv/Makefile dl/Makefile cmath/Makefile argp/Makefile) diff --git a/newlib/libc/sys/linux/dl/Makefile.am b/newlib/libc/sys/linux/dl/Makefile.am new file mode 100644 index 000000000..9c73a1367 --- /dev/null +++ b/newlib/libc/sys/linux/dl/Makefile.am @@ -0,0 +1,25 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -DSHARED -D_GNU_SOURCE $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) -I$(srcdir)/.. + +LIB_SOURCES = \ + dl-addr.c dl-deps.c dl-init.c dl-load.c dl-misc.c dl-profile.c dl-runtime.c dl-version.c \ + dl-close.c dl-error.c dl-iteratephdr.c dl-lookup.c dl-object.c dl-profstub.c dl-support.c \ + dl-debug.c dl-fini.c dl-libc.c dl-open.c dl-reloc.c dl-sym.c dl-cache.c + +AM_CFLAGS = -D_GNU_SOURCE -D__strerror_r=strerror_r +libdl_la_LDFLAGS = -Xcompiler -nostdlib + +if USE_LIBTOOL +noinst_LTLIBRARIES = libdl.la +libdl_la_SOURCES = $(LIB_SOURCES) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(LIB_SOURCES) +noinst_DATA = +endif # USE_LIBTOOL + +include $(srcdir)/../../../../Makefile.shared diff --git a/newlib/libc/sys/linux/dl/Makefile.in b/newlib/libc/sys/linux/dl/Makefile.in new file mode 100644 index 000000000..56e88ae0a --- /dev/null +++ b/newlib/libc/sys/linux/dl/Makefile.in @@ -0,0 +1,379 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LINUX_MACH_LIB = @LINUX_MACH_LIB@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +aext = @aext@ +libm_machine_dir = @libm_machine_dir@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -DSHARED -D_GNU_SOURCE $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) -I$(srcdir)/.. + +LIB_SOURCES = \ + dl-addr.c dl-deps.c dl-init.c dl-load.c dl-misc.c dl-profile.c dl-runtime.c dl-version.c \ + dl-close.c dl-error.c dl-iteratephdr.c dl-lookup.c dl-object.c dl-profstub.c dl-support.c \ + dl-debug.c dl-fini.c dl-libc.c dl-open.c dl-reloc.c dl-sym.c dl-cache.c + + +AM_CFLAGS = -D_GNU_SOURCE -D__strerror_r=strerror_r +libdl_la_LDFLAGS = -Xcompiler -nostdlib + +@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libdl.la +@USE_LIBTOOL_TRUE@libdl_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) +@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in +@USE_LIBTOOL_FALSE@noinst_DATA = +@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a +@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +lib_a_LIBADD = +@USE_LIBTOOL_FALSE@lib_a_OBJECTS = dl-addr.$(OBJEXT) dl-deps.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-init.$(OBJEXT) dl-load.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-misc.$(OBJEXT) dl-profile.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-runtime.$(OBJEXT) dl-version.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-close.$(OBJEXT) dl-error.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-iteratephdr.$(OBJEXT) dl-lookup.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-object.$(OBJEXT) dl-profstub.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-support.$(OBJEXT) dl-debug.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-fini.$(OBJEXT) dl-libc.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-open.$(OBJEXT) dl-reloc.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dl-sym.$(OBJEXT) dl-cache.$(OBJEXT) +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libdl_la_LIBADD = +@USE_LIBTOOL_TRUE@libdl_la_OBJECTS = dl-addr.lo dl-deps.lo dl-init.lo \ +@USE_LIBTOOL_TRUE@dl-load.lo dl-misc.lo dl-profile.lo dl-runtime.lo \ +@USE_LIBTOOL_TRUE@dl-version.lo dl-close.lo dl-error.lo \ +@USE_LIBTOOL_TRUE@dl-iteratephdr.lo dl-lookup.lo dl-object.lo \ +@USE_LIBTOOL_TRUE@dl-profstub.lo dl-support.lo dl-debug.lo dl-fini.lo \ +@USE_LIBTOOL_TRUE@dl-libc.lo dl-open.lo dl-reloc.lo dl-sym.lo \ +@USE_LIBTOOL_TRUE@dl-cache.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(noinst_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(lib_a_SOURCES) $(libdl_la_SOURCES) +OBJECTS = $(lib_a_OBJECTS) $(libdl_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../Makefile.shared + cd $(top_srcdir) && $(AUTOMAKE) --cygnus dl/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) + -rm -f lib.a + $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +mostlyclean-noinstLTLIBRARIES: + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + +distclean-noinstLTLIBRARIES: + +maintainer-clean-noinstLTLIBRARIES: + +libdl.la: $(libdl_la_OBJECTS) $(libdl_la_DEPENDENCIES) + $(LINK) $(libdl_la_LDFLAGS) $(libdl_la_OBJECTS) $(libdl_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = dl + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ + clean-noinstLTLIBRARIES clean-tags clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstLIBRARIES distclean-compile \ + distclean-libtool distclean-noinstLTLIBRARIES \ + distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-noinstLTLIBRARIES \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ +distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ +maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-info-am install-info \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/libc/sys/linux/dl/abi-tag.h b/newlib/libc/sys/linux/dl/abi-tag.h new file mode 100644 index 000000000..85db374c6 --- /dev/null +++ b/newlib/libc/sys/linux/dl/abi-tag.h @@ -0,0 +1,4 @@ +#define __ABI_TAG_OS 0 +#ifndef __ABI_TAG_VERSION +# define __ABI_TAG_VERSION 2,0,0 +#endif diff --git a/newlib/libc/sys/linux/dl/atomicity.h b/newlib/libc/sys/linux/dl/atomicity.h new file mode 100644 index 000000000..8b52ab407 --- /dev/null +++ b/newlib/libc/sys/linux/dl/atomicity.h @@ -0,0 +1,56 @@ +/* Low-level functions for atomic operations. ix86 version, x >= 4. + Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ATOMICITY_H +#define _ATOMICITY_H 1 + + + +static inline uint32_t +__attribute__ ((unused)) +exchange_and_add (volatile uint32_t *mem, uint32_t val) +{ + register uint32_t result; + __asm__ __volatile__ ("lock; xaddl %0,%1" + : "=r" (result), "=m" (*mem) : "0" (val), "1" (*mem)); + return result; +} + +static inline void +__attribute__ ((unused)) +atomic_add (volatile uint32_t *mem, int val) +{ + __asm__ __volatile__ ("lock; addl %1,%0" + : "=m" (*mem) : "ir" (val), "0" (*mem)); +} + +static inline char +__attribute__ ((unused)) +compare_and_swap (volatile long int *p, long int oldval, long int newval) +{ + char ret; + long int readval; + + __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" + : "=q" (ret), "=m" (*p), "=a" (readval) + : "r" (newval), "1" (*p), "a" (oldval)); + return ret; +} + +#endif /* atomicity.h */ diff --git a/newlib/libc/sys/linux/dl/dl-addr.c b/newlib/libc/sys/linux/dl/dl-addr.c new file mode 100644 index 000000000..23867491f --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-addr.c @@ -0,0 +1,101 @@ +/* Locate the shared object symbol nearest a given address. + Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +int +internal_function +_dl_addr (const void *address, Dl_info *info) +{ + const ElfW(Addr) addr = DL_LOOKUP_ADDRESS (address); + struct link_map *l, *match; + const ElfW(Sym) *symtab, *matchsym; + const char *strtab; + ElfW(Word) strtabsize; + + /* Find the highest-addressed object that ADDRESS is not below. */ + match = NULL; + for (l = _dl_loaded; l; l = l->l_next) + if (addr >= l->l_map_start && addr < l->l_map_end) + { + /* We know ADDRESS lies within L if in any shared object. + Make sure it isn't past the end of L's segments. */ + size_t n = l->l_phnum; + if (n > 0) + { + do + --n; + while (l->l_phdr[n].p_type != PT_LOAD); + if (addr >= (l->l_addr + + l->l_phdr[n].p_vaddr + l->l_phdr[n].p_memsz)) + /* Off the end of the highest-addressed shared object. */ + continue; + } + + match = l; + break; + } + + if (match == NULL) + return 0; + + /* Now we know what object the address lies in. */ + info->dli_fname = match->l_name; + info->dli_fbase = (void *) match->l_addr; + + /* If this is the main program the information is incomplete. */ + if (__builtin_expect (info->dli_fbase == NULL, 0)) + { + info->dli_fname = _dl_argv[0]; + info->dli_fbase = (void *) match->l_map_start; + } + + symtab = (const void *) D_PTR (match, l_info[DT_SYMTAB]); + strtab = (const void *) D_PTR (match, l_info[DT_STRTAB]); + strtabsize = match->l_info[DT_STRSZ]->d_un.d_val; + + /* We assume that the string table follows the symbol table, because + there is no way in ELF to know the size of the dynamic symbol table!! */ + for (matchsym = NULL; (void *) symtab < (void *) strtab; ++symtab) + if (addr >= match->l_addr + symtab->st_value + && ((symtab->st_size == 0 && addr == match->l_addr + symtab->st_value) + || addr < match->l_addr + symtab->st_value + symtab->st_size) + && symtab->st_name < strtabsize + && (matchsym == NULL || matchsym->st_value < symtab->st_value) + && (ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL + || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK)) + matchsym = symtab; + + if (matchsym) + { + /* We found a symbol close by. Fill in its name and exact address. */ + info->dli_sname = strtab + matchsym->st_name; + info->dli_saddr = (void *) (match->l_addr + matchsym->st_value); + } + else + { + /* No symbol matches. We return only the containing object. */ + info->dli_sname = NULL; + info->dli_saddr = NULL; + } + + return 1; +} diff --git a/newlib/libc/sys/linux/dl/dl-cache.c b/newlib/libc/sys/linux/dl/dl-cache.c new file mode 100644 index 000000000..a71e5e876 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-cache.c @@ -0,0 +1,271 @@ +/* Support for reading /etc/ld.so.cache files written by Linux ldconfig. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include + +extern const char *_dl_platform; + +#ifndef _DL_PLATFORMS_COUNT +# define _DL_PLATFORMS_COUNT 0 +#endif + +/* This is the starting address and the size of the mmap()ed file. */ +static struct cache_file *cache; +static struct cache_file_new *cache_new; +static size_t cachesize; + +/* 1 if cache_data + PTR points into the cache. */ +#define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size) + +/* This is the cache ID we expect. Normally it is 3 for glibc linked + binaries. */ +int _dl_correct_cache_id = _DL_CACHE_DEFAULT_ID; + +#define SEARCH_CACHE(cache) \ +/* We use binary search since the table is sorted in the cache file. \ + The first matching entry in the table is returned. \ + It is important to use the same algorithm as used while generating \ + the cache file. */ \ +do \ + { \ + left = 0; \ + right = cache->nlibs - 1; \ + \ + while (left <= right) \ + { \ + __typeof__ (cache->libs[0].key) key; \ + \ + middle = (left + right) / 2; \ + \ + key = cache->libs[middle].key; \ + \ + /* Make sure string table indices are not bogus before using \ + them. */ \ + if (! _dl_cache_verify_ptr (key)) \ + { \ + cmpres = 1; \ + break; \ + } \ + \ + /* Actually compare the entry with the key. */ \ + cmpres = _dl_cache_libcmp (name, cache_data + key); \ + if (__builtin_expect (cmpres == 0, 0)) \ + { \ + /* Found it. LEFT now marks the last entry for which we \ + know the name is correct. */ \ + left = middle; \ + \ + /* There might be entries with this name before the one we \ + found. So we have to find the beginning. */ \ + while (middle > 0) \ + { \ + __typeof__ (cache->libs[0].key) key; \ + \ + key = cache->libs[middle - 1].key; \ + /* Make sure string table indices are not bogus before \ + using them. */ \ + if (! _dl_cache_verify_ptr (key) \ + /* Actually compare the entry. */ \ + || _dl_cache_libcmp (name, cache_data + key) != 0) \ + break; \ + --middle; \ + } \ + \ + do \ + { \ + int flags; \ + __typeof__ (cache->libs[0]) *lib = &cache->libs[middle]; \ + \ + /* Only perform the name test if necessary. */ \ + if (middle > left \ + /* We haven't seen this string so far. Test whether the \ + index is ok and whether the name matches. Otherwise \ + we are done. */ \ + && (! _dl_cache_verify_ptr (lib->key) \ + || (_dl_cache_libcmp (name, cache_data + lib->key) \ + != 0))) \ + break; \ + \ + flags = lib->flags; \ + if (_dl_cache_check_flags (flags) \ + && _dl_cache_verify_ptr (lib->value)) \ + { \ + if (best == NULL || flags == _dl_correct_cache_id) \ + { \ + HWCAP_CHECK; \ + best = cache_data + lib->value; \ + \ + if (flags == _dl_correct_cache_id) \ + /* We've found an exact match for the shared \ + object and no general `ELF' release. Stop \ + searching. */ \ + break; \ + } \ + } \ + } \ + while (++middle <= right); \ + break; \ + } \ + \ + if (cmpres < 0) \ + left = middle + 1; \ + else \ + right = middle - 1; \ + } \ + } \ +while (0) + + + +/* Look up NAME in ld.so.cache and return the file name stored there, + or null if none is found. */ + +const char * +internal_function +_dl_load_cache_lookup (const char *name) +{ + int left, right, middle; + int cmpres; + const char *cache_data; + uint32_t cache_data_size; + const char *best; + + if (cache == NULL) + { + /* Read the contents of the file. */ + void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize, + PROT_READ); + + /* We can handle three different cache file formats here: + - the old libc5/glibc2.0/2.1 format + - the old format with the new format in it + - only the new format + The following checks if the cache contains any of these formats. */ + if (file != MAP_FAILED && cachesize > sizeof *cache + && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0) + { + size_t offset; + /* Looks ok. */ + cache = file; + + /* Check for new version. */ + offset = ALIGN_CACHE (sizeof (struct cache_file) + + cache->nlibs * sizeof (struct file_entry)); + + cache_new = (struct cache_file_new *) ((void *) cache + offset); + if (cachesize < (offset + sizeof (struct cache_file_new)) + || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW, + sizeof CACHEMAGIC_VERSION_NEW - 1) != 0) + cache_new = (void *) -1; + } + else if (file != MAP_FAILED && cachesize > sizeof *cache_new + && memcmp (file, CACHEMAGIC_VERSION_NEW, + sizeof CACHEMAGIC_VERSION_NEW - 1) == 0) + { + cache_new = file; + cache = file; + } + else + { + if (file != MAP_FAILED) + munmap (file, cachesize); + cache = (void *) -1; + } + + assert (cache != NULL); + } + + if (cache == (void *) -1) + /* Previously looked for the cache file and didn't find it. */ + return NULL; + + best = NULL; + + if (cache_new != (void *) -1) + { + /* This file ends in static libraries where we don't have a hwcap. */ + unsigned long int *hwcap; + uint64_t platform; + weak_extern (_dl_hwcap); + + /* This is where the strings start. */ + cache_data = (const char *) cache_new; + + /* Now we can compute how large the string table is. */ + cache_data_size = (const char *) cache + cachesize - cache_data; + + hwcap = &_dl_hwcap; + platform = _dl_string_platform (_dl_platform); + if (platform != -1) + platform = 1ULL << platform; + + /* Only accept hwcap if it's for the right platform. */ +#define HWCAP_CHECK \ + if (_dl_osversion && cache_new->libs[middle].osversion > _dl_osversion) \ + continue; \ + if (_DL_PLATFORMS_COUNT && platform != -1 \ + && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \ + && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \ + continue; \ + if (hwcap \ + && ((lib->hwcap & *hwcap & ~_DL_HWCAP_PLATFORM) > *hwcap)) \ + continue + SEARCH_CACHE (cache_new); + } + else + { + /* This is where the strings start. */ + cache_data = (const char *) &cache->libs[cache->nlibs]; + + /* Now we can compute how large the string table is. */ + cache_data_size = (const char *) cache + cachesize - cache_data; + +#undef HWCAP_CHECK +#define HWCAP_CHECK do {} while (0) + SEARCH_CACHE (cache); + } + + /* Print our result if wanted. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0) && best != NULL) + _dl_debug_printf (" trying file=%s\n", best); + + return best; +} + +#ifndef MAP_COPY +/* If the system does not support MAP_COPY we cannot leave the file open + all the time since this would create problems when the file is replaced. + Therefore we provide this function to close the file and open it again + once needed. */ +void +_dl_unload_cache (void) +{ + if (cache != NULL && cache != (struct cache_file *) -1) + { + munmap (cache, cachesize); + cache = NULL; + } +} +#endif diff --git a/newlib/libc/sys/linux/dl/dl-cache.h b/newlib/libc/sys/linux/dl/dl-cache.h new file mode 100644 index 000000000..0699853e7 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-cache.h @@ -0,0 +1,140 @@ +/* Support for reading /etc/ld.so.cache files written by Linux ldconfig. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#ifndef _DL_CACHE_DEFAULT_ID +# define _DL_CACHE_DEFAULT_ID 3 +#endif + +#ifndef _dl_cache_check_flags +# define _dl_cache_check_flags(flags) \ + ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID) +#endif + +#ifndef SYSCONFDIR +# define SYSCONFDIR "/etc" +#endif + +#ifndef LD_SO_CACHE +# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache" +#endif + +#define CACHEMAGIC "ld.so-1.7.0" + +/* libc5 and glibc 2.0/2.1 use the same format. For glibc 2.2 another + format has been added in a compatible way: + The beginning of the string table is used for the new table: + old_magic + nlibs + libs[0] + ... + libs[nlibs-1] + pad, new magic needs to be aligned + - this is string[0] for the old format + new magic - this is string[0] for the new format + newnlibs + ... + newlibs[0] + ... + newlibs[newnlibs-1] + string 1 + string 2 + ... +*/ +struct file_entry +{ + int flags; /* This is 1 for an ELF library. */ + unsigned int key, value; /* String table indices. */ +}; + +struct cache_file +{ + char magic[sizeof CACHEMAGIC - 1]; + unsigned int nlibs; + struct file_entry libs[0]; +}; + +#define CACHEMAGIC_NEW "glibc-ld.so.cache" +#define CACHE_VERSION "1.1" +#define CACHEMAGIC_VERSION_NEW CACHEMAGIC_NEW CACHE_VERSION + + +struct file_entry_new +{ + int32_t flags; /* This is 1 for an ELF library. */ + uint32_t key, value; /* String table indices. */ + uint32_t osversion; /* Required OS version. */ + uint64_t hwcap; /* Hwcap entry. */ +}; + +struct cache_file_new +{ + char magic[sizeof CACHEMAGIC_NEW - 1]; + char version[sizeof CACHE_VERSION - 1]; + uint32_t nlibs; /* Number of entries. */ + uint32_t len_strings; /* Size of string table. */ + uint32_t unused[5]; /* Leave space for future extensions + and align to 8 byte boundary. */ + struct file_entry_new libs[0]; /* Entries describing libraries. */ + /* After this the string table of size len_strings is found. */ +}; + +/* Used to align cache_file_new. */ +#define ALIGN_CACHE(addr) \ +(((addr) + __alignof__ (struct cache_file_new) -1) \ + & (~(__alignof__ (struct cache_file_new) - 1))) + +static int +_dl_cache_libcmp (const char *p1, const char *p2) +{ + while (*p1 != '\0') + { + if (*p1 >= '0' && *p1 <= '9') + { + if (*p2 >= '0' && *p2 <= '9') + { + /* Must compare this numerically. */ + int val1; + int val2; + + val1 = *p1++ - '0'; + val2 = *p2++ - '0'; + while (*p1 >= '0' && *p1 <= '9') + val1 = val1 * 10 + *p1++ - '0'; + while (*p2 >= '0' && *p2 <= '9') + val2 = val2 * 10 + *p2++ - '0'; + if (val1 != val2) + return val1 - val2; + } + else + return 1; + } + else if (*p2 >= '0' && *p2 <= '9') + return -1; + else if (*p1 != *p2) + return *p1 - *p2; + else + { + ++p1; + ++p2; + } + } + return *p1 - *p2; +} diff --git a/newlib/libc/sys/linux/dl/dl-close.c b/newlib/libc/sys/linux/dl/dl-close.c new file mode 100644 index 000000000..ef53868d9 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-close.c @@ -0,0 +1,334 @@ +/* Close a shared object opened by `_dl_open'. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* Type of the constructor functions. */ +typedef void (*fini_t) (void); + + +void +internal_function +_dl_close (void *_map) +{ + struct reldep_list + { + struct link_map **rellist; + unsigned int nrellist; + struct reldep_list *next; + } *reldeps = NULL; + struct link_map **list; + struct link_map *map = _map; + unsigned int i; + unsigned int *new_opencount; + + /* First see whether we can remove the object at all. */ + if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0) + && map->l_init_called) + /* Nope. Do nothing. */ + return; + + if (__builtin_expect (map->l_opencount, 1) == 0) + _dl_signal_error (0, map->l_name, NULL, N_("shared object not open")); + + /* Acquire the lock. */ +#ifdef HAVE_DD_LOCK + __lock_acquire(_dl_load_lock); +#endif + + + /* Decrement the reference count. */ + if (map->l_opencount > 1 || map->l_type != lt_loaded) + { + /* There are still references to this object. Do nothing more. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0)) + _dl_debug_printf ("\nclosing file=%s; opencount == %u\n", + map->l_name, map->l_opencount); + + /* One decrement the object itself, not the dependencies. */ + --map->l_opencount; + +#ifdef HAVE_DD_LOCK + __lock_release(_dl_load_lock); +#endif + + return; + } + + list = map->l_initfini; + + /* Compute the new l_opencount values. */ + i = map->l_searchlist.r_nlist; + if (__builtin_expect (i == 0, 0)) + /* This can happen if we handle relocation dependencies for an + object which wasn't loaded directly. */ + for (i = 1; list[i] != NULL; ++i) + ; + + new_opencount = (unsigned int *) alloca (i * sizeof (unsigned int)); + + for (i = 0; list[i] != NULL; ++i) + { + list[i]->l_idx = i; + new_opencount[i] = list[i]->l_opencount; + } + --new_opencount[0]; + for (i = 1; list[i] != NULL; ++i) + if ((! (list[i]->l_flags_1 & DF_1_NODELETE) || ! list[i]->l_init_called) + /* Decrement counter. */ + && --new_opencount[i] == 0 + /* Test whether this object was also loaded directly. */ + && list[i]->l_searchlist.r_list != NULL) + { + /* In this case we have the decrement all the dependencies of + this object. They are all in MAP's dependency list. */ + unsigned int j; + struct link_map **dep_list = list[i]->l_searchlist.r_list; + + for (j = 1; j < list[i]->l_searchlist.r_nlist; ++j) + if (! (dep_list[j]->l_flags_1 & DF_1_NODELETE) + || ! dep_list[j]->l_init_called) + { + assert (dep_list[j]->l_idx < map->l_searchlist.r_nlist); + --new_opencount[dep_list[j]->l_idx]; + } + } + assert (new_opencount[0] == 0); + + /* Call all termination functions at once. */ + for (i = 0; list[i] != NULL; ++i) + { + struct link_map *imap = list[i]; + if (new_opencount[i] == 0 && imap->l_type == lt_loaded + && (imap->l_info[DT_FINI] || imap->l_info[DT_FINI_ARRAY]) + && (! (imap->l_flags_1 & DF_1_NODELETE) || ! imap->l_init_called) + /* Skip any half-cooked objects that were never initialized. */ + && imap->l_init_called) + { + /* When debugging print a message first. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + _dl_debug_printf ("\ncalling fini: %s\n\n", imap->l_name); + + /* Call its termination function. */ + if (imap->l_info[DT_FINI_ARRAY] != NULL) + { + ElfW(Addr) *array = + (ElfW(Addr) *) (imap->l_addr + + imap->l_info[DT_FINI_ARRAY]->d_un.d_ptr); + unsigned int sz = (imap->l_info[DT_FINI_ARRAYSZ]->d_un.d_val + / sizeof (ElfW(Addr))); + unsigned int cnt; + + for (cnt = 0; cnt < sz; ++cnt) + ((fini_t) (imap->l_addr + array[cnt])) (); + } + + /* Next try the old-style destructor. */ + if (imap->l_info[DT_FINI] != NULL) + (*(void (*) (void)) DL_DT_FINI_ADDRESS + (imap, (void *) imap->l_addr + + imap->l_info[DT_FINI]->d_un.d_ptr)) (); + } + else if (new_opencount[i] != 0 && imap->l_type == lt_loaded) + { + /* The object is still used. But the object we are unloading + right now is responsible for loading it and therefore we + have the search list of the current object in its scope. + Remove it. */ + struct r_scope_elem **runp = imap->l_scope; + + while (*runp != NULL) + if (*runp == &map->l_searchlist) + { + /* Copy all later elements. */ + while ((runp[0] = runp[1]) != NULL) + ++runp; + break; + } + else + ++runp; + } + + /* Store the new l_opencount value. */ + imap->l_opencount = new_opencount[i]; + /* Just a sanity check. */ + assert (imap->l_type == lt_loaded || imap->l_opencount > 0); + } + + /* Notify the debugger we are about to remove some loaded objects. */ + _r_debug.r_state = RT_DELETE; + _dl_debug_state (); + + /* Check each element of the search list to see if all references to + it are gone. */ + for (i = 0; list[i] != NULL; ++i) + { + struct link_map *imap = list[i]; + if (imap->l_opencount == 0 && imap->l_type == lt_loaded) + { + struct libname_list *lnp; + + /* That was the last reference, and this was a dlopen-loaded + object. We can unmap it. */ + if (__builtin_expect (imap->l_global, 0)) + { + /* This object is in the global scope list. Remove it. */ + unsigned int cnt = _dl_main_searchlist->r_nlist; + + do + --cnt; + while (_dl_main_searchlist->r_list[cnt] != imap); + + /* The object was already correctly registered. */ + while (++cnt < _dl_main_searchlist->r_nlist) + _dl_main_searchlist->r_list[cnt - 1] + = _dl_main_searchlist->r_list[cnt]; + + --_dl_main_searchlist->r_nlist; + } + + /* We can unmap all the maps at once. We determined the + start address and length when we loaded the object and + the `munmap' call does the rest. */ + DL_UNMAP (imap); + + /* Finally, unlink the data structure and free it. */ +#ifdef SHARED + /* We will unlink the first object only if this is a statically + linked program. */ + assert (imap->l_prev != NULL); + imap->l_prev->l_next = imap->l_next; +#else + if (imap->l_prev != NULL) + imap->l_prev->l_next = imap->l_next; + else + _dl_loaded = imap->l_next; +#endif + --_dl_nloaded; + if (imap->l_next) + imap->l_next->l_prev = imap->l_prev; + + if (imap->l_versions != NULL) + free (imap->l_versions); + if (imap->l_origin != NULL && imap->l_origin != (char *) -1) + free ((char *) imap->l_origin); + + /* If the object has relocation dependencies save this + information for latter. */ + if (__builtin_expect (imap->l_reldeps != NULL, 0)) + { + struct reldep_list *newrel; + + newrel = (struct reldep_list *) alloca (sizeof (*reldeps)); + newrel->rellist = imap->l_reldeps; + newrel->nrellist = imap->l_reldepsact; + newrel->next = reldeps; + + reldeps = newrel; + } + + /* This name always is allocated. */ + free (imap->l_name); + /* Remove the list with all the names of the shared object. */ + lnp = imap->l_libname; + do + { + struct libname_list *this = lnp; + lnp = lnp->next; + if (!this->dont_free) + free (this); + } + while (lnp != NULL); + + /* Remove the searchlists. */ + if (imap != map) + free (imap->l_initfini); + + /* Remove the scope array if we allocated it. */ + if (imap->l_scope != imap->l_scope_mem) + free (imap->l_scope); + + if (imap->l_phdr_allocated) + free ((void *) imap->l_phdr); + + if (imap->l_rpath_dirs.dirs != (void *) -1) + free (imap->l_rpath_dirs.dirs); + if (imap->l_runpath_dirs.dirs != (void *) -1) + free (imap->l_runpath_dirs.dirs); + + free (imap); + } + } + + /* Notify the debugger those objects are finalized and gone. */ + _r_debug.r_state = RT_CONSISTENT; + _dl_debug_state (); + + /* Now we can perhaps also remove the modules for which we had + dependencies because of symbol lookup. */ + while (__builtin_expect (reldeps != NULL, 0)) + { + while (reldeps->nrellist-- > 0) + _dl_close (reldeps->rellist[reldeps->nrellist]); + + free (reldeps->rellist); + + reldeps = reldeps->next; + } + + free (list); + + /* Release the lock. */ +#ifdef HAVE_DD_LOCK + __lock_release(_dl_load_lock); +#endif + + +} + + +static void +free_mem (void) +{ + if (__builtin_expect (_dl_global_scope_alloc, 0) != 0 + && _dl_main_searchlist->r_nlist == _dl_initial_searchlist.r_nlist) + { + /* All object dynamically loaded by the program are unloaded. Free + the memory allocated for the global scope variable. */ + struct link_map **old = _dl_main_searchlist->r_list; + + /* Put the old map in. */ + _dl_main_searchlist->r_list = _dl_initial_searchlist.r_list; + /* Signal that the original map is used. */ + _dl_global_scope_alloc = 0; + + /* Now free the old map. */ + free (old); + } +} +text_set_element (__libc_subfreeres, free_mem); diff --git a/newlib/libc/sys/linux/dl/dl-debug.c b/newlib/libc/sys/linux/dl/dl-debug.c new file mode 100644 index 000000000..5a51b5335 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-debug.c @@ -0,0 +1,57 @@ +/* Communicate dynamic linker state to the debugger at runtime. + Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +/* This structure communicates dl state to the debugger. The debugger + normally finds it via the DT_DEBUG entry in the dynamic section, but in + a statically-linked program there is no dynamic section for the debugger + to examine and it looks for this particular symbol name. */ +struct r_debug _r_debug; + + +/* Initialize _r_debug if it has not already been done. The argument is + the run-time load address of the dynamic linker, to be put in + _r_debug.r_ldbase. Returns the address of _r_debug. */ + +struct r_debug * +internal_function +_dl_debug_initialize (ElfW(Addr) ldbase) +{ + if (_r_debug.r_brk == 0) + { + /* Tell the debugger where to find the map of loaded objects. */ + _r_debug.r_version = 1 /* R_DEBUG_VERSION XXX */; + _r_debug.r_ldbase = ldbase; + _r_debug.r_map = _dl_loaded; + _r_debug.r_brk = (ElfW(Addr)) &_dl_debug_state; + } + + return &_r_debug; +} + + +/* This function exists solely to have a breakpoint set on it by the + debugger. The debugger is supposed to find this function's address by + examining the r_brk member of struct r_debug, but GDB 4.15 in fact looks + for this particular symbol name in the PT_INTERP file. */ +void +_dl_debug_state (void) +{ +} diff --git a/newlib/libc/sys/linux/dl/dl-deps.c b/newlib/libc/sys/linux/dl/dl-deps.c new file mode 100644 index 000000000..4596a85d7 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-deps.c @@ -0,0 +1,561 @@ +/* Load the dependencies of a mapped object. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Whether an shared object references one or more auxiliary objects + is signaled by the AUXTAG entry in l_info. */ +#define AUXTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \ + + DT_EXTRATAGIDX (DT_AUXILIARY)) +/* Whether an shared object references one or more auxiliary objects + is signaled by the AUXTAG entry in l_info. */ +#define FILTERTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \ + + DT_EXTRATAGIDX (DT_FILTER)) + +/* This is zero at program start to signal that the global scope map is + allocated by rtld. Later it keeps the size of the map. It might be + reset if in _dl_close if the last global object is removed. */ +size_t _dl_global_scope_alloc; + +extern size_t _dl_platformlen; + +/* When loading auxiliary objects we must ignore errors. It's ok if + an object is missing. */ +struct openaux_args + { + /* The arguments to openaux. */ + struct link_map *map; + int trace_mode; + const char *strtab; + const char *name; + + /* The return value of openaux. */ + struct link_map *aux; + }; + +static void +openaux (void *a) +{ + struct openaux_args *args = (struct openaux_args *) a; + + args->aux = _dl_map_object (args->map, args->name, 0, + (args->map->l_type == lt_executable + ? lt_library : args->map->l_type), + args->trace_mode, 0); +} + + + +/* We use a very special kind of list to track the path + through the list of loaded shared objects. We have to + produce a flat list with unique members of all involved objects. +*/ +struct list + { + int done; /* Nonzero if this map was processed. */ + struct link_map *map; /* The data. */ + struct list *next; /* Elements for normal list. */ + }; + + +/* Macro to expand DST. It is an macro since we use `alloca'. */ +#define expand_dst(l, str, fatal) \ + ({ \ + const char *__str = (str); \ + const char *__result = __str; \ + size_t __cnt = DL_DST_COUNT(__str, 0); \ + \ + if (__cnt != 0) \ + { \ + char *__newp; \ + \ + __newp = (char *) alloca (DL_DST_REQUIRED (l, __str, strlen (__str), \ + __cnt)); \ + \ + __result = DL_DST_SUBSTITUTE (l, __str, __newp, 0); \ + \ + if (*__result == '\0') \ + { \ + /* The replacement for the DST is not known. We can't \ + processed. */ \ + if (fatal) \ + _dl_signal_error (0, __str, NULL, N_("\ +empty dynamics string token substitution")); \ + else \ + { \ + /* This is for DT_AUXILIARY. */ \ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) \ + _dl_debug_printf ("cannot load auxiliary `%s' because of" \ + "empty dynamic string token " \ + "substitution\n", __str); \ + continue; \ + } \ + } \ + } \ + \ + __result; }) + + +void +internal_function +_dl_map_object_deps (struct link_map *map, + struct link_map **preloads, unsigned int npreloads, + int trace_mode) +{ + struct list known[1 + npreloads + 1]; + struct list *runp, *tail; + unsigned int nlist, i; + /* Object name. */ + const char *name; + int errno_saved; + int errno_reason; + const char *errstring; + const char *objname; + + auto inline void preload (struct link_map *map); + + inline void preload (struct link_map *map) + { + known[nlist].done = 0; + known[nlist].map = map; + known[nlist].next = &known[nlist + 1]; + + ++nlist; + /* We use `l_reserved' as a mark bit to detect objects we have + already put in the search list and avoid adding duplicate + elements later in the list. */ + map->l_reserved = 1; + } + + /* No loaded object so far. */ + nlist = 0; + + /* First load MAP itself. */ + preload (map); + + /* Add the preloaded items after MAP but before any of its dependencies. */ + for (i = 0; i < npreloads; ++i) + preload (preloads[i]); + + /* Terminate the lists. */ + known[nlist - 1].next = NULL; + + /* Pointer to last unique object. */ + tail = &known[nlist - 1]; + + /* Process each element of the search list, loading each of its + auxiliary objects and immediate dependencies. Auxiliary objects + will be added in the list before the object itself and + dependencies will be appended to the list as we step through it. + This produces a flat, ordered list that represents a + breadth-first search of the dependency tree. + + The whole process is complicated by the fact that we better + should use alloca for the temporary list elements. But using + alloca means we cannot use recursive function calls. */ + errno_saved = errno; + errno_reason = 0; + errstring = NULL; + errno = 0; + name = NULL; + for (runp = known; runp; ) + { + struct link_map *l = runp->map; + struct link_map **needed = NULL; + unsigned int nneeded = 0; + + /* Unless otherwise stated, this object is handled. */ + runp->done = 1; + + /* Allocate a temporary record to contain the references to the + dependencies of this object. */ + if (l->l_searchlist.r_list == NULL && l->l_initfini == NULL + && l != map && l->l_ldnum > 0) + needed = (struct link_map **) alloca (l->l_ldnum + * sizeof (struct link_map *)); + + if (l->l_info[DT_NEEDED] || l->l_info[AUXTAG] || l->l_info[FILTERTAG]) + { + const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); + struct openaux_args args; + struct list *orig; + const ElfW(Dyn) *d; + + args.strtab = strtab; + args.map = l; + args.trace_mode = trace_mode; + orig = runp; + + for (d = l->l_ld; d->d_tag != DT_NULL; ++d) + if (__builtin_expect (d->d_tag, DT_NEEDED) == DT_NEEDED) + { + /* Map in the needed object. */ + struct link_map *dep; + int err; + + /* Recognize DSTs. */ + name = expand_dst (l, strtab + d->d_un.d_val, 0); + /* Store the tag in the argument structure. */ + args.name = name; + + err = _dl_catch_error (&objname, &errstring, openaux, &args); + if (__builtin_expect (errstring != NULL, 0)) + { + if (err) + errno_reason = err; + else + errno_reason = -1; + goto out; + } + else + dep = args.aux; + + if (! dep->l_reserved) + { + /* Allocate new entry. */ + struct list *newp; + + newp = alloca (sizeof (struct list)); + + /* Append DEP to the list. */ + newp->map = dep; + newp->done = 0; + newp->next = NULL; + tail->next = newp; + tail = newp; + ++nlist; + /* Set the mark bit that says it's already in the list. */ + dep->l_reserved = 1; + } + + /* Remember this dependency. */ + if (needed != NULL) + needed[nneeded++] = dep; + } + else if (d->d_tag == DT_AUXILIARY || d->d_tag == DT_FILTER) + { + struct list *newp; + + /* Recognize DSTs. */ + name = expand_dst (l, strtab + d->d_un.d_val, + d->d_tag == DT_AUXILIARY); + /* Store the tag in the argument structure. */ + args.name = name; + + if (d->d_tag == DT_AUXILIARY) + { + int err; + + /* Say that we are about to load an auxiliary library. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) + _dl_debug_printf ("load auxiliary object=%s" + " requested by file=%s\n", name, + l->l_name[0] + ? l->l_name : _dl_argv[0]); + + /* We must be prepared that the addressed shared + object is not available. */ + err = _dl_catch_error (&objname, &errstring, openaux, + &args); + if (__builtin_expect (errstring != NULL, 0)) + { + /* We are not interested in the error message. */ + assert (errstring != NULL); + if (errstring != _dl_out_of_memory) + free ((char *) errstring); + + /* Simply ignore this error and continue the work. */ + continue; + } + } + else + { + int err; + + /* Say that we are about to load an auxiliary library. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) + _dl_debug_printf ("load filtered object=%s" + " requested by file=%s\n", name, + l->l_name[0] + ? l->l_name : _dl_argv[0]); + + /* For filter objects the dependency must be available. */ + err = _dl_catch_error (&objname, &errstring, openaux, + &args); + if (__builtin_expect (errstring != NULL, 0)) + { + if (err) + errno_reason = err; + else + errno_reason = -1; + goto out; + } + } + + /* The auxiliary object is actually available. + Incorporate the map in all the lists. */ + + /* Allocate new entry. This always has to be done. */ + newp = alloca (sizeof (struct list)); + + /* We want to insert the new map before the current one, + but we have no back links. So we copy the contents of + the current entry over. Note that ORIG and NEWP now + have switched their meanings. */ + memcpy (newp, orig, sizeof (*newp)); + + /* Initialize new entry. */ + orig->done = 0; + orig->map = args.aux; + + /* Remember this dependency. */ + if (needed != NULL) + needed[nneeded++] = args.aux; + + /* We must handle two situations here: the map is new, + so we must add it in all three lists. If the map + is already known, we have two further possibilities: + - if the object is before the current map in the + search list, we do nothing. It is already found + early + - if the object is after the current one, we must + move it just before the current map to make sure + the symbols are found early enough + */ + if (args.aux->l_reserved) + { + /* The object is already somewhere in the list. + Locate it first. */ + struct list *late; + + /* This object is already in the search list we + are building. Don't add a duplicate pointer. + Just added by _dl_map_object. */ + for (late = newp; late->next != NULL; late = late->next) + if (late->next->map == args.aux) + break; + + if (late->next != NULL) + { + /* The object is somewhere behind the current + position in the search path. We have to + move it to this earlier position. */ + orig->next = newp; + + /* Now remove the later entry from the list + and adjust the tail pointer. */ + if (tail == late->next) + tail = late; + late->next = late->next->next; + + /* We must move the object earlier in the chain. */ + if (args.aux->l_prev != NULL) + args.aux->l_prev->l_next = args.aux->l_next; + if (args.aux->l_next != NULL) + args.aux->l_next->l_prev = args.aux->l_prev; + + args.aux->l_prev = newp->map->l_prev; + newp->map->l_prev = args.aux; + if (args.aux->l_prev != NULL) + args.aux->l_prev->l_next = args.aux; + args.aux->l_next = newp->map; + } + else + { + /* The object must be somewhere earlier in the + list. Undo to the current list element what + we did above. */ + memcpy (orig, newp, sizeof (*newp)); + continue; + } + } + else + { + /* This is easy. We just add the symbol right here. */ + orig->next = newp; + ++nlist; + /* Set the mark bit that says it's already in the list. */ + args.aux->l_reserved = 1; + + /* The only problem is that in the double linked + list of all objects we don't have this new + object at the correct place. Correct this here. */ + if (args.aux->l_prev) + args.aux->l_prev->l_next = args.aux->l_next; + if (args.aux->l_next) + args.aux->l_next->l_prev = args.aux->l_prev; + + args.aux->l_prev = newp->map->l_prev; + newp->map->l_prev = args.aux; + if (args.aux->l_prev != NULL) + args.aux->l_prev->l_next = args.aux; + args.aux->l_next = newp->map; + } + + /* Move the tail pointer if necessary. */ + if (orig == tail) + tail = newp; + + /* Move on the insert point. */ + orig = newp; + } + } + + /* Terminate the list of dependencies and store the array address. */ + if (needed != NULL) + { + needed[nneeded++] = NULL; + + l->l_initfini = (struct link_map **) + malloc ((nneeded + 1) * sizeof needed[0]); + if (l->l_initfini == NULL) + _dl_signal_error (ENOMEM, map->l_name, NULL, + N_("cannot allocate dependency list")); + l->l_initfini[0] = l; + memcpy (&l->l_initfini[1], needed, nneeded * sizeof needed[0]); + } + + /* If we have no auxiliary objects just go on to the next map. */ + if (runp->done) + do + runp = runp->next; + while (runp != NULL && runp->done); + } + + out: + if (errno == 0 && errno_saved != 0) + __set_errno (errno_saved); + + if (map->l_initfini != NULL && map->l_type == lt_loaded) + { + /* This object was previously loaded as a dependency and we have + a separate l_initfini list. We don't need it anymore. */ + assert (map->l_searchlist.r_list == NULL); + free (map->l_initfini); + } + + /* Store the search list we built in the object. It will be used for + searches in the scope of this object. */ + map->l_initfini = + (struct link_map **) malloc ((2 * nlist + 1) + * sizeof (struct link_map *)); + if (map->l_initfini == NULL) + _dl_signal_error (ENOMEM, map->l_name, NULL, + N_("cannot allocate symbol search list")); + + + map->l_searchlist.r_list = &map->l_initfini[nlist + 1]; + map->l_searchlist.r_nlist = nlist; + + for (nlist = 0, runp = known; runp; runp = runp->next) + { + if (__builtin_expect (trace_mode, 0) && runp->map->l_faked) + /* This can happen when we trace the loading. */ + --map->l_searchlist.r_nlist; + else + map->l_searchlist.r_list[nlist++] = runp->map; + + /* Now clear all the mark bits we set in the objects on the search list + to avoid duplicates, so the next call starts fresh. */ + runp->map->l_reserved = 0; + } + + /* Maybe we can remove some relocation dependencies now. */ + assert (map->l_searchlist.r_list[0] == map); + for (i = 0; i < map->l_reldepsact; ++i) + { + unsigned int j; + + for (j = 1; j < nlist; ++j) + if (map->l_searchlist.r_list[j] == map->l_reldeps[i]) + { + /* A direct or transitive dependency is also on the list + of relocation dependencies. Remove the latter. */ + --map->l_reldeps[i]->l_opencount; + + for (j = i + 1; j < map->l_reldepsact; ++j) + map->l_reldeps[j - 1] = map->l_reldeps[j]; + + --map->l_reldepsact; + + /* Account for the '++i' performed by the 'for'. */ + --i; + break; + } + } + + /* Now determine the order in which the initialization has to happen. */ + memcpy (map->l_initfini, map->l_searchlist.r_list, + nlist * sizeof (struct link_map *)); + /* We can skip looking for the binary itself which is at the front + of the search list. Look through the list backward so that circular + dependencies are not changing the order. */ + for (i = 1; i < nlist; ++i) + { + struct link_map *l = map->l_searchlist.r_list[i]; + unsigned int j; + unsigned int k; + + /* Find the place in the initfini list where the map is currently + located. */ + for (j = 1; map->l_initfini[j] != l; ++j) + ; + + /* Find all object for which the current one is a dependency and + move the found object (if necessary) in front. */ + for (k = j + 1; k < nlist; ++k) + { + struct link_map **runp; + + runp = map->l_initfini[k]->l_initfini; + if (runp != NULL) + { + while (*runp != NULL) + if (__builtin_expect (*runp++ == l, 0)) + { + struct link_map *here = map->l_initfini[k]; + + /* Move it now. */ + memmove (&map->l_initfini[j] + 1, + &map->l_initfini[j], + (k - j) * sizeof (struct link_map *)); + map->l_initfini[j] = here; + + break; + } + } + } + } + /* Terminate the list of dependencies. */ + map->l_initfini[nlist] = NULL; + + if (errno_reason) + _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, + objname, NULL, errstring); +} diff --git a/newlib/libc/sys/linux/dl/dl-dst.h b/newlib/libc/sys/linux/dl/dl-dst.h new file mode 100644 index 000000000..ccebf9259 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-dst.h @@ -0,0 +1,45 @@ +/* Handling of dynamic sring tokens. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Determine the number of DST elements in the name. Only if IS_PATH is + nonzero paths are recognized (i.e., multiple, ':' separated filenames). */ +#define DL_DST_COUNT(name, is_path) \ + ({ \ + size_t __cnt = 0; \ + const char *__sf = strchr (name, '$'); \ + \ + if (__builtin_expect (__sf != NULL, 0)) \ + __cnt = _dl_dst_count (__sf, is_path); \ + \ + __cnt; }) + +/* Prototype for used function. */ +extern size_t _dl_dst_count (const char *name, int is_path); + + +/* Guess from the number of DSTs the length of the result string. */ +#define DL_DST_REQUIRED(l, name, len, cnt) 1024 + +/* Perform the DST substitution. */ +#define DL_DST_SUBSTITUTE(l, name, res, is_path) \ + _dl_dst_substitute (l, name, res, is_path) + +/* Prototype for used function. */ +extern char *_dl_dst_substitute (struct link_map *l, const char *name, + char *result, int is_path); diff --git a/newlib/libc/sys/linux/dl/dl-error.c b/newlib/libc/sys/linux/dl/dl-error.c new file mode 100644 index 000000000..9c0f55f7f --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-error.c @@ -0,0 +1,189 @@ +/* Error handling for runtime dynamic linker. + Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include + +/* This structure communicates state between _dl_catch_error and + _dl_signal_error. */ +struct catch + { + const char *objname; /* Object/File name. */ + const char *errstring; /* Error detail filled in here. */ + jmp_buf env; /* longjmp here on error. */ + }; + +/* Multiple threads at once can use the `_dl_catch_error' function. The + calls can come from `_dl_map_object_deps', `_dlerror_run', or from + any of the libc functionality which loads dynamic objects (NSS, iconv). + Therefore we have to be prepared to save the state in thread-local + memory. */ + +__libc_tsd_define (static, DL_ERROR) +#define tsd_getspecific() __libc_tsd_get (DL_ERROR) +#define tsd_setspecific(data) __libc_tsd_set (DL_ERROR, (data)) + + +/* This message we return as a last resort. We define the string in a + variable since we have to avoid freeing it and so have to enable + a pointer comparison. See below and in dlfcn/dlerror.c. */ +const char _dl_out_of_memory[] = "out of memory"; + + +/* This points to a function which is called when an continuable error is + received. Unlike the handling of `catch' this function may return. + The arguments will be the `errstring' and `objname'. + + Since this functionality is not used in normal programs (only in ld.so) + we do not care about multi-threaded programs here. We keep this as a + global variable. */ +static receiver_fct receiver; + + +void +internal_function +_dl_signal_error (int errcode, const char *objname, const char *occation, + const char *errstring) +{ + struct catch *lcatch; + + if (! errstring) + errstring = N_("DYNAMIC LINKER BUG!!!"); + + lcatch = tsd_getspecific (); + if (objname == NULL) + objname = ""; + if (lcatch != NULL) + { + /* We are inside _dl_catch_error. Return to it. We have to + duplicate the error string since it might be allocated on the + stack. The object name is always a string constant. */ + size_t len_objname = strlen (objname) + 1; + size_t len_errstring = strlen (errstring) + 1; + + lcatch->errstring = (char *) malloc (len_objname + len_errstring); + if (lcatch->errstring != NULL) + { + char *tmp; + /* Make a copy of the object file name and the error string. */ + tmp = memcpy ((char *) lcatch->errstring, + errstring, len_errstring); + tmp += len_errstring; + lcatch->objname = memcpy (tmp, + objname, len_objname); + } + else + { + /* This is better than nothing. */ + lcatch->objname = ""; + lcatch->errstring = _dl_out_of_memory; + } + longjmp (lcatch->env, errcode ?: -1); + } + else + { + /* Lossage while resolving the program's own symbols is always fatal. */ + char buffer[1024]; + _dl_fatal_printf ("%s: %s: %s%s%s%s%s\n", + _dl_argv[0] ?: "", + occation ?: N_("error while loading shared libraries"), + objname, *objname ? ": " : "", + errstring, errcode ? ": " : "", + (errcode + ? __strerror_r (errcode, buffer, sizeof buffer) + : "")); + } +} + + +void +internal_function +_dl_signal_cerror (int errcode, const char *objname, const char *occation, + const char *errstring) +{ + if (receiver) + { + /* We are inside _dl_receive_error. Call the user supplied + handler and resume the work. The receiver will still be + installed. */ + (*receiver) (errcode, objname, errstring); + } + else + _dl_signal_error (errcode, objname, occation, errstring); +} + + +int +internal_function +_dl_catch_error (const char **objname, const char **errstring, + void (*operate) (void *), void *args) +{ + int errcode; + struct catch *volatile old; + struct catch c; + /* We need not handle `receiver' since setting a `catch' is handled + before it. */ + + /* Some systems (e.g., SPARC) handle constructors to local variables + inefficient. So we initialize `c' by hand. */ + c.errstring = NULL; + + old = tsd_getspecific (); + errcode = setjmp (c.env); + if (__builtin_expect (errcode, 0) == 0) + { + tsd_setspecific (&c); + (*operate) (args); + tsd_setspecific (old); + *objname = NULL; + *errstring = NULL; + return 0; + } + + /* We get here only if we longjmp'd out of OPERATE. */ + tsd_setspecific (old); + *objname = c.objname; + *errstring = c.errstring; + return errcode == -1 ? 0 : errcode; +} + +void +internal_function +_dl_receive_error (receiver_fct fct, void (*operate) (void *), void *args) +{ + struct catch *old_catch; + receiver_fct old_receiver; + + old_catch = tsd_getspecific (); + old_receiver = receiver; + + /* Set the new values. */ + tsd_setspecific (NULL); + receiver = fct; + + (*operate) (args); + + tsd_setspecific (old_catch); + receiver = old_receiver; +} diff --git a/newlib/libc/sys/linux/dl/dl-fini.c b/newlib/libc/sys/linux/dl/dl-fini.c new file mode 100644 index 000000000..fc4f4b68a --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-fini.c @@ -0,0 +1,172 @@ +/* Call the termination functions of loaded shared objects. + Copyright (C) 1995,96,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + + +/* Type of the constructor functions. */ +typedef void (*fini_t) (void); + + +void +internal_function +_dl_fini (void) +{ + /* Lots of fun ahead. We have to call the destructors for all still + loaded objects. The problem is that the ELF specification now + demands that dependencies between the modules are taken into account. + I.e., the destructor for a module is called before the ones for any + of its dependencies. + + To make things more complicated, we cannot simply use the reverse + order of the constructors. Since the user might have loaded objects + using `dlopen' there are possibly several other modules with its + dependencies to be taken into account. Therefore we have to start + determining the order of the modules once again from the beginning. */ + unsigned int i; + struct link_map *l; + struct link_map **maps; + + /* XXX Could it be (in static binaries) that there is no object loaded? */ + assert (_dl_nloaded > 0); + + /* Now we can allocate an array to hold all the pointers and copy + the pointers in. */ + maps = (struct link_map **) alloca (_dl_nloaded + * sizeof (struct link_map *)); + for (l = _dl_loaded, i = 0; l != NULL; l = l->l_next) + { + assert (i < _dl_nloaded); + + maps[i++] = l; + + /* Bump l_opencount of all objects so that they are not dlclose()ed + from underneath us. */ + ++l->l_opencount; + } + assert (i == _dl_nloaded); + + /* Now we have to do the sorting. */ + for (l = _dl_loaded->l_next; l != NULL; l = l->l_next) + { + unsigned int j; + unsigned int k; + + /* Find the place in the `maps' array. */ + for (j = 1; maps[j] != l; ++j) + ; + + /* Find all object for which the current one is a dependency and + move the found object (if necessary) in front. */ + for (k = j + 1; k < _dl_nloaded; ++k) + { + struct link_map **runp; + + runp = maps[k]->l_initfini; + if (runp != NULL) + { + while (*runp != NULL) + if (*runp == l) + { + struct link_map *here = maps[k]; + + /* Move it now. */ + memmove (&maps[j] + 1, + &maps[j], + (k - j) * sizeof (struct link_map *)); + maps[j++] = here; + + break; + } + else + ++runp; + } + + if (__builtin_expect (maps[k]->l_reldeps != NULL, 0)) + { + unsigned int m = maps[k]->l_reldepsact; + struct link_map **relmaps = maps[k]->l_reldeps; + + while (m-- > 0) + { + if (relmaps[m] == l) + { + struct link_map *here = maps[k]; + + /* Move it now. */ + memmove (&maps[j] + 1, + &maps[j], + (k - j) * sizeof (struct link_map *)); + maps[j] = here; + + break; + } + + } + } + } + } + + /* `maps' now contains the objects in the right order. Now call the + destructors. We have to process this array from the front. */ + for (i = 0; i < _dl_nloaded; ++i) + { + l = maps[i]; + + if (l->l_init_called) + { + /* Make sure nothing happens if we are called twice. */ + l->l_init_called = 0; + + /* Don't call the destructors for objects we are not supposed to. */ + if (l->l_name[0] == '\0' && l->l_type == lt_executable) + continue; + + /* Is there a destructor function? */ + if (l->l_info[DT_FINI_ARRAY] == NULL && l->l_info[DT_FINI] == NULL) + continue; + + /* When debugging print a message first. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + _dl_debug_printf ("\ncalling fini: %s\n\n", + l->l_name[0] ? l->l_name : _dl_argv[0]); + + /* First see whether an array is given. */ + if (l->l_info[DT_FINI_ARRAY] != NULL) + { + ElfW(Addr) *array = + (ElfW(Addr) *) (l->l_addr + + l->l_info[DT_FINI_ARRAY]->d_un.d_ptr); + unsigned int sz = (l->l_info[DT_FINI_ARRAYSZ]->d_un.d_val + / sizeof (ElfW(Addr))); + unsigned int cnt; + + for (cnt = 0; cnt < sz; ++cnt) + ((fini_t) (l->l_addr + array[cnt])) (); + } + + /* Next try the old-style destructor. */ + if (l->l_info[DT_FINI] != NULL) + ((fini_t) DL_DT_FINI_ADDRESS (l, l->l_addr + l->l_info[DT_FINI]->d_un.d_ptr)) (); + } + } +} diff --git a/newlib/libc/sys/linux/dl/dl-init.c b/newlib/libc/sys/linux/dl/dl-init.c new file mode 100644 index 000000000..5448b03c3 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-init.c @@ -0,0 +1,149 @@ +/* Return the next shared object initializer function not yet run. + Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +/* Type of the initializer. */ +typedef void (*init_t) (int, char **, char **); + +/* Flag, nonzero during startup phase. */ +extern int _dl_starting_up; + +/* The object to be initialized first. */ +extern struct link_map *_dl_initfirst; + + +static void +call_init (struct link_map *l, int argc, char **argv, char **env) +{ + if (l->l_init_called) + /* This object is all done. */ + return; + + /* Avoid handling this constructor again in case we have a circular + dependency. */ + l->l_init_called = 1; + + /* Check for object which constructors we do not run here. */ + if (__builtin_expect (l->l_name[0], 'a') == '\0' + && l->l_type == lt_executable) + return; + + /* Are there any constructors? */ + if (l->l_info[DT_INIT] == NULL + && __builtin_expect (l->l_info[DT_INIT_ARRAY] == NULL, 1)) + return; + + /* Print a debug message if wanted. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + _dl_debug_printf ("\ncalling init: %s\n\n", + l->l_name[0] ? l->l_name : _dl_argv[0]); + + /* Now run the local constructors. There are two forms of them: + - the one named by DT_INIT + - the others in the DT_INIT_ARRAY. + */ + if (l->l_info[DT_INIT] != NULL) + { + init_t init = (init_t) DL_DT_INIT_ADDRESS + (l, l->l_addr + l->l_info[DT_INIT]->d_un.d_ptr); + + /* Call the function. */ + init (argc, argv, env); + } + + /* Next see whether there is an array with initialization functions. */ + if (l->l_info[DT_INIT_ARRAY] != NULL) + { + unsigned int j; + unsigned int jm; + ElfW(Addr) *addrs; + + jm = l->l_info[DT_INIT_ARRAYSZ]->d_un.d_val / sizeof (ElfW(Addr)); + + addrs = (ElfW(Addr) *) (l->l_info[DT_INIT_ARRAY]->d_un.d_ptr + + l->l_addr); + for (j = 0; j < jm; ++j) + ((init_t) addrs[j]) (argc, argv, env); + } +} + + +void +internal_function +_dl_init (struct link_map *main_map, int argc, char **argv, char **env) +{ + ElfW(Dyn) *preinit_array = main_map->l_info[DT_PREINIT_ARRAY]; + struct r_debug *r; + unsigned int i; + + if (__builtin_expect (_dl_initfirst != NULL, 0)) + { + call_init (_dl_initfirst, argc, argv, env); + _dl_initfirst = NULL; + } + + /* Don't do anything if there is no preinit array. */ + if (__builtin_expect (preinit_array != NULL, 0) + && (i = preinit_array->d_un.d_val / sizeof (ElfW(Addr))) > 0) + { + ElfW(Addr) *addrs; + unsigned int cnt; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + _dl_debug_printf ("\ncalling preinit: %s\n\n", + main_map->l_name[0] + ? main_map->l_name : _dl_argv[0]); + + addrs = (ElfW(Addr) *) (main_map->l_info[DT_PREINIT_ARRAY]->d_un.d_ptr + + main_map->l_addr); + for (cnt = 0; cnt < i; ++cnt) + ((init_t) addrs[cnt]) (argc, argv, env); + } + + /* Notify the debugger we have added some objects. We need to call + _dl_debug_initialize in a static program in case dynamic linking has + not been used before. */ + r = _dl_debug_initialize (0); + r->r_state = RT_ADD; + _dl_debug_state (); + + /* Stupid users forced the ELF specification to be changed. It now + says that the dynamic loader is responsible for determining the + order in which the constructors have to run. The constructors + for all dependencies of an object must run before the constructor + for the object itself. Circular dependencies are left unspecified. + + This is highly questionable since it puts the burden on the dynamic + loader which has to find the dependencies at runtime instead of + letting the user do it right. Stupidity rules! */ + + i = main_map->l_searchlist.r_nlist; + while (i-- > 0) + call_init (main_map->l_initfini[i], argc, argv, env); + + /* Notify the debugger all new objects are now ready to go. */ + r->r_state = RT_CONSISTENT; + _dl_debug_state (); + + /* Finished starting up. */ + _dl_starting_up = 0; +} diff --git a/newlib/libc/sys/linux/dl/dl-iteratephdr.c b/newlib/libc/sys/linux/dl/dl-iteratephdr.c new file mode 100644 index 000000000..a39a4934e --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-iteratephdr.c @@ -0,0 +1,65 @@ +/* Get loaded objects program headers. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +int +__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size, void *data), void *data) +{ + struct link_map *l; + struct dl_phdr_info info; + int ret = 0; + + /* Make sure we are alone. */ +#ifdef HAVE_DD_LOCK + __lock_acquire(_dl_load_lock); +#endif + + + for (l = _dl_loaded; l != NULL; l = l->l_next) + { + /* Skip the dynamic linker. */ + if (l->l_phdr == NULL) + continue; + info.dlpi_addr = l->l_addr; + info.dlpi_name = l->l_name; + info.dlpi_phdr = l->l_phdr; + info.dlpi_phnum = l->l_phnum; + ret = callback (&info, sizeof (struct dl_phdr_info), data); + if (ret) + break; + } + + /* Release the lock. */ +#ifdef HAVE_DD_LOCK + __lock_release(_dl_load_lock); +#endif + + + return ret; +} + +#ifdef SHARED +weak_alias (__dl_iterate_phdr, dl_iterate_phdr); +#endif diff --git a/newlib/libc/sys/linux/dl/dl-libc.c b/newlib/libc/sys/linux/dl/dl-libc.c new file mode 100644 index 000000000..c83448df7 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-libc.c @@ -0,0 +1,156 @@ +/* Handle loading and unloading shared objects for internal libc purposes. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Zack Weinberg , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +/* The purpose of this file is to provide wrappers around the dynamic + linker error mechanism (similar to dlopen() et al in libdl) which + are usable from within libc. Generally we want to throw away the + string that dlerror() would return and just pass back a null pointer + for errors. This also lets the rest of libc not know about the error + handling mechanism. + + Much of this code came from gconv_dl.c with slight modifications. */ + +static int +internal_function +dlerror_run (void (*operate) (void *), void *args) +{ + const char *objname; + const char *last_errstring = NULL; + int result; + + (void) _dl_catch_error (&objname, &last_errstring, operate, args); + + result = last_errstring != NULL; + if (result && last_errstring != _dl_out_of_memory) + free ((char *) last_errstring); + + return result; +} + +/* These functions are called by dlerror_run... */ + +struct do_dlopen_args +{ + /* Argument to do_dlopen. */ + const char *name; + + /* Return from do_dlopen. */ + struct link_map *map; +}; + +struct do_dlsym_args +{ + /* Arguments to do_dlsym. */ + struct link_map *map; + const char *name; + + /* Return values of do_dlsym. */ + lookup_t loadbase; + const ElfW(Sym) *ref; +}; + +static void +do_dlopen (void *ptr) +{ + struct do_dlopen_args *args = (struct do_dlopen_args *) ptr; + /* Open and relocate the shared object. */ + args->map = _dl_open (args->name, RTLD_LAZY, NULL); +} + +static void +do_dlsym (void *ptr) +{ + struct do_dlsym_args *args = (struct do_dlsym_args *) ptr; + args->ref = NULL; + args->loadbase = _dl_lookup_symbol (args->name, args->map, &args->ref, + args->map->l_local_scope, 0, 1); +} + +static void +do_dlclose (void *ptr) +{ + _dl_close ((struct link_map *) ptr); +} + +/* ... and these functions call dlerror_run. */ + +void * +__libc_dlopen (const char *__name) +{ + struct do_dlopen_args args; + args.name = __name; + + return (dlerror_run (do_dlopen, &args) ? NULL : (void *) args.map); +} + +void * +__libc_dlsym (void *__map, const char *__name) +{ + struct do_dlsym_args args; + args.map = __map; + args.name = __name; + + return (dlerror_run (do_dlsym, &args) ? NULL + : (void *) (DL_SYMBOL_ADDRESS (args.loadbase, args.ref))); +} + +int +__libc_dlclose (void *__map) +{ + return dlerror_run (do_dlclose, __map); +} + + +static void +free_mem (void) +{ + struct link_map *l; + struct r_search_path_elem *d; + + /* Remove all search directories. */ + d = _dl_all_dirs; + while (d != _dl_init_all_dirs) + { + struct r_search_path_elem *old = d; + d = d->next; + free (old); + } + + /* Remove all additional names added to the objects. */ + for (l = _dl_loaded; l != NULL; l = l->l_next) + { + struct libname_list *lnp = l->l_libname->next; + + l->l_libname->next = NULL; + + while (lnp != NULL) + { + struct libname_list *old = lnp; + lnp = lnp->next; + if (! old->dont_free) + free (old); + } + } +} +text_set_element (__libc_subfreeres, free_mem); diff --git a/newlib/libc/sys/linux/dl/dl-librecon.h b/newlib/libc/sys/linux/dl/dl-librecon.h new file mode 100644 index 000000000..3e39a32e6 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-librecon.h @@ -0,0 +1,87 @@ +/* Optional code to distinguish library flavours. + Copyright (C) 1998, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DL_LIBRECON_H +#define _DL_LIBRECON_H 1 + +#define DISTINGUISH_LIB_VERSIONS \ + do \ + { \ + /* We have to find out whether the binary is linked against \ + libc 5 or glibc. We do this by looking at all the DT_NEEDED \ + entries. If one is libc.so.5 this is a libc 5 linked binary. */ \ + if (_dl_loaded->l_info[DT_NEEDED]) \ + { \ + /* We have dependencies. */ \ + const ElfW(Dyn) *d; \ + const char *strtab; \ + \ + strtab = (const char *) D_PTR (_dl_loaded, l_info[DT_STRTAB]); \ + \ + for (d = _dl_loaded->l_ld; d->d_tag != DT_NULL; ++d) \ + if (d->d_tag == DT_NEEDED \ + && strcmp (strtab + d->d_un.d_val, "libc.so.5") == 0) \ + break; \ + \ + /* We print a `5' or `6' depending on the outcome. */ \ + _dl_printf (d->d_tag != DT_NULL ? "5\n" : "6\n"); \ + } \ + } \ + while (0) + +/* Recognizing extra environment variables. */ +#define EXTRA_LD_ENVVARS \ + case 13: \ + if (memcmp (envline, "ASSUME_KERNEL", 13) == 0) \ + { \ + unsigned long int i, j, osversion = 0; \ + char *p = &envline[14], *q; \ + \ + for (i = 0; i < 3; i++, p = q + 1) \ + { \ + j = __strtoul_internal (p, &q, 0, 0); \ + if (j >= 255 || p == q || (i < 2 && *q && *q != '.')) \ + { \ + osversion = 0; \ + break; \ + } \ + osversion |= j << (16 - 8 * i); \ + if (!*q) \ + break; \ + } \ + if (osversion) \ + _dl_osversion = osversion; \ + break; \ + } \ + \ + case 15: \ + if (memcmp (envline, "LIBRARY_VERSION", 15) == 0) \ + { \ + _dl_correct_cache_id = envline[16] == '5' ? 2 : 3; \ + break; \ + } + +/* Extra unsecure variables. The names are all stuffed in a single + string which means they have to be terminated with a '\0' explicitly. */ +#define EXTRA_UNSECURE_ENVVARS \ + "LD_AOUT_LIBRARY_PATH\0" \ + "LD_AOUT_PRELOAD\0" + +#endif /* dl-librecon.h */ diff --git a/newlib/libc/sys/linux/dl/dl-load.c b/newlib/libc/sys/linux/dl/dl-load.c new file mode 100644 index 000000000..65b72c729 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-load.c @@ -0,0 +1,1830 @@ +/* Map in a shared object's segments from the file. + Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "dynamic-link.h" +#include +#include + +#include + +/* On some systems, no flag bits are given to specify file mapping. */ +#ifndef MAP_FILE +# define MAP_FILE 0 +#endif + +/* The right way to map in the shared library files is MAP_COPY, which + makes a virtual copy of the data at the time of the mmap call; this + guarantees the mapped pages will be consistent even if the file is + overwritten. Some losing VM systems like Linux's lack MAP_COPY. All we + get is MAP_PRIVATE, which copies each page when it is modified; this + means if the file is overwritten, we may at some point get some pages + from the new version after starting with pages from the old version. */ +#ifndef MAP_COPY +# define MAP_COPY MAP_PRIVATE +#endif + +/* Some systems link their relocatable objects for another base address + than 0. We want to know the base address for these such that we can + subtract this address from the segment addresses during mapping. + This results in a more efficient address space usage. Defaults to + zero for almost all systems. */ +#ifndef MAP_BASE_ADDR +# define MAP_BASE_ADDR(l) 0 +#endif + + +#include +#if BYTE_ORDER == BIG_ENDIAN +# define byteorder ELFDATA2MSB +#elif BYTE_ORDER == LITTLE_ENDIAN +# define byteorder ELFDATA2LSB +#else +# error "Unknown BYTE_ORDER " BYTE_ORDER +# define byteorder ELFDATANONE +#endif + +#define STRING(x) __STRING (x) + +#ifdef MAP_ANON +/* The fd is not examined when using MAP_ANON. */ +# define ANONFD -1 +#else +int _dl_zerofd = -1; +# define ANONFD _dl_zerofd +#endif + +/* Handle situations where we have a preferred location in memory for + the shared objects. */ +#ifdef ELF_PREFERRED_ADDRESS_DATA +ELF_PREFERRED_ADDRESS_DATA; +#endif +#ifndef ELF_PREFERRED_ADDRESS +# define ELF_PREFERRED_ADDRESS(loader, maplength, mapstartpref) (mapstartpref) +#endif +#ifndef ELF_FIXED_ADDRESS +# define ELF_FIXED_ADDRESS(loader, mapstart) ((void) 0) +#endif + +/* Type for the buffer we put the ELF header and hopefully the program + header. This buffer does not really have to be too large. In most + cases the program header follows the ELF header directly. If this + is not the case all bets are off and we can make the header arbitrarily + large and still won't get it read. This means the only question is + how large are the ELF and program header combined. The ELF header + in 64-bit files is 56 bytes long. Each program header entry is again + 56 bytes long. I.e., even with a file which has 17 program header + entries we only have to read 1kB. And 17 program header entries is + plenty, normal files have < 10. If this heuristic should really fail + for some file the code in `_dl_map_object_from_fd' knows how to + recover. */ +struct filebuf +{ + ssize_t len; + char buf[1024]; +}; + +size_t _dl_pagesize; + +unsigned int _dl_osversion; + +int _dl_clktck; + +extern const char *_dl_platform; +extern size_t _dl_platformlen; + +/* The object to be initialized first. */ +struct link_map *_dl_initfirst; + +/* This is the decomposed LD_LIBRARY_PATH search path. */ +static struct r_search_path_struct env_path_list; + +/* List of the hardware capabilities we might end up using. */ +static const struct r_strlenpair *capstr; +static size_t ncapstr; +static size_t max_capstrlen; + + +/* Get the generated information about the trusted directories. */ +#include "trusted-dirs.h" + +static const char system_dirs[] = SYSTEM_DIRS; +static const size_t system_dirs_len[] = +{ + SYSTEM_DIRS_LEN +}; +#define nsystem_dirs_len \ + (sizeof (system_dirs_len) / sizeof (system_dirs_len[0])) + + +/* Local version of `strdup' function. */ +static inline char * +local_strdup (const char *s) +{ + size_t len = strlen (s) + 1; + void *new = malloc (len); + + if (new == NULL) + return NULL; + + return (char *) memcpy (new, s, len); +} + + +static size_t +is_dst (const char *start, const char *name, const char *str, size_t cmplen, + int is_path, int secure) +{ + size_t len; + + if (strncmp (name, str, cmplen) == 0) + len = cmplen + 1; + else if (strncmp (name, str + 1, cmplen - 2) == 0 + && (name[cmplen - 2] == '\0' || name[cmplen - 2] == '/' + || (is_path && name[cmplen - 2] == ':'))) + len = cmplen - 1; + else + return 0; + + if (__builtin_expect (secure, 0) + && ((name[len - 1] != '\0' && (!is_path || name[len - 1] != ':')) + || (name != start + 1 && (!is_path || name[-2] != ':')))) + return 0; + + return len; +} + + +size_t +_dl_dst_count (const char *name, int is_path) +{ + const char *const start = name; + size_t cnt = 0; + + do + { + size_t len = 1; + + /* $ORIGIN is not expanded for SUID/GUID programs (except if it + is $ORIGIN alone) and it must always appear first in path. + + Note that it is no bug that the string in the second and + fourth `strncmp' call is longer than the sequence which is + actually tested. */ + if ((len = is_dst (start, name + 1, "{ORIGIN}", 8, is_path, + 0)) != 0 + || ((len = is_dst (start, name + 1, "{PLATFORM}", 10, is_path, 0)) + != 0)) + ++cnt; + + name = strchr (name + len, '$'); + } + while (name != NULL); + + return cnt; +} + + +char * +_dl_dst_substitute (struct link_map *l, const char *name, char *result, + int is_path) +{ + const char *const start = name; + char *last_elem, *wp; + + /* Now fill the result path. While copying over the string we keep + track of the start of the last path element. When we come accross + a DST we copy over the value or (if the value is not available) + leave the entire path element out. */ + last_elem = wp = result; + + do + { + if (__builtin_expect (*name == '$', 0)) + { + const char *repl = NULL; + size_t len = 1; + + /* Note that it is no bug that the string in the second and + fourth `strncmp' call is longer than the sequence which + is actually tested. */ + if ((len = is_dst (start, name + 1, "{ORIGIN}", 8, is_path, + 0)) != 0) + repl = l->l_origin; + else if ((len = is_dst (start, name + 1, "{PLATFORM}", 10, is_path, + 0)) != 0) + repl = _dl_platform; + + if (repl != NULL && repl != (const char *) -1) + { + wp = strcpy (wp, repl); + wp += strlen (repl); + name += len; + } + else if (len > 1) + { + /* We cannot use this path element, the value of the + replacement is unknown. */ + wp = last_elem; + name += len; + while (*name != '\0' && (!is_path || *name != ':')) + ++name; + } + else + /* No DST we recognize. */ + *wp++ = *name++; + } + else + { + *wp++ = *name++; + if (is_path && *name == ':') + last_elem = wp; + } + } + while (*name != '\0'); + + *wp = '\0'; + + return result; +} + + +/* Return copy of argument with all recognized dynamic string tokens + ($ORIGIN and $PLATFORM for now) replaced. On some platforms it + might not be possible to determine the path from which the object + belonging to the map is loaded. In this case the path element + containing $ORIGIN is left out. */ +static char * +expand_dynamic_string_token (struct link_map *l, const char *s) +{ + /* We make two runs over the string. First we determine how large the + resulting string is and then we copy it over. Since this is now + frequently executed operation we are looking here not for performance + but rather for code size. */ + size_t cnt; + size_t total; + char *result; + + /* Determine the number of DST elements. */ + cnt = DL_DST_COUNT (s, 1); + + /* If we do not have to replace anything simply copy the string. */ + if (__builtin_expect (cnt, 0) == 0) + return local_strdup (s); + + /* Determine the length of the substituted string. */ + total = DL_DST_REQUIRED (l, s, strlen (s), cnt); + + /* Allocate the necessary memory. */ + result = (char *) malloc (total + 1); + if (result == NULL) + return NULL; + + return DL_DST_SUBSTITUTE (l, s, result, 1); +} + + +/* Add `name' to the list of names for a particular shared object. + `name' is expected to have been allocated with malloc and will + be freed if the shared object already has this name. + Returns false if the object already had this name. */ +static void +internal_function +add_name_to_object (struct link_map *l, const char *name) +{ + struct libname_list *lnp, *lastp; + struct libname_list *newname; + size_t name_len; + + lastp = NULL; + for (lnp = l->l_libname; lnp != NULL; lastp = lnp, lnp = lnp->next) + if (strcmp (name, lnp->name) == 0) + return; + + name_len = strlen (name) + 1; + newname = (struct libname_list *) malloc (sizeof *newname + name_len); + if (newname == NULL) + { + /* No more memory. */ + _dl_signal_error (ENOMEM, name, NULL, N_("cannot allocate name record")); + return; + } + /* The object should have a libname set from _dl_new_object. */ + assert (lastp != NULL); + + newname->name = memcpy (newname + 1, name, name_len); + newname->next = NULL; + newname->dont_free = 0; + lastp->next = newname; +} + +/* All known directories in sorted order. */ +struct r_search_path_elem *_dl_all_dirs; + +/* All directories after startup. */ +struct r_search_path_elem *_dl_init_all_dirs; + +/* Standard search directories. */ +static struct r_search_path_struct rtld_search_dirs; + +static size_t max_dirnamelen; + +static inline struct r_search_path_elem ** +fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep, + int check_trusted, const char *what, const char *where) +{ + char *cp; + size_t nelems = 0; + + printf("In fillin_rpath\n"); + while ((cp = strsep (&rpath, sep)) != NULL) + { + struct r_search_path_elem *dirp; + size_t len = strlen (cp); + + /* `strsep' can pass an empty string. This has to be + interpreted as `use the current directory'. */ + if (len == 0) + { + static const char curwd[] = "./"; + cp = (char *) curwd; + } + + /* Remove trailing slashes (except for "/"). */ + while (len > 1 && cp[len - 1] == '/') + --len; + + /* Now add one if there is none so far. */ + if (len > 0 && cp[len - 1] != '/') + cp[len++] = '/'; + + /* Make sure we don't use untrusted directories if we run SUID. */ + if (__builtin_expect (check_trusted, 0)) + { + const char *trun = system_dirs; + size_t idx; + int unsecure = 1; + + /* All trusted directories must be complete names. */ + if (cp[0] == '/') + { + for (idx = 0; idx < nsystem_dirs_len; ++idx) + { + if (len == system_dirs_len[idx] + && memcmp (trun, cp, len) == 0) + { + /* Found it. */ + unsecure = 0; + break; + } + + trun += system_dirs_len[idx] + 1; + } + } + + if (unsecure) + /* Simply drop this directory. */ + continue; + } + + /* See if this directory is already known. */ + for (dirp = _dl_all_dirs; dirp != NULL; dirp = dirp->next) + if (dirp->dirnamelen == len && memcmp (cp, dirp->dirname, len) == 0) + break; + + if (dirp != NULL) + { + /* It is available, see whether it's on our own list. */ + size_t cnt; + for (cnt = 0; cnt < nelems; ++cnt) + if (result[cnt] == dirp) + break; + + if (cnt == nelems) + result[nelems++] = dirp; + } + else + { + size_t cnt; + enum r_dir_status init_val; + size_t where_len = where ? strlen (where) + 1 : 0; + + /* It's a new directory. Create an entry and add it. */ + dirp = (struct r_search_path_elem *) + malloc (sizeof (*dirp) + ncapstr * sizeof (enum r_dir_status) + + where_len + len + 1); + if (dirp == NULL) + _dl_signal_error (ENOMEM, NULL, NULL, + N_("cannot create cache for search path")); + + dirp->dirname = ((char *) dirp + sizeof (*dirp) + + ncapstr * sizeof (enum r_dir_status)); + *((char *) (memcpy ((char *) dirp->dirname, cp, len) + len)) = '\0'; + dirp->dirnamelen = len; + + if (len > max_dirnamelen) + max_dirnamelen = len; + + /* We have to make sure all the relative directories are + never ignored. The current directory might change and + all our saved information would be void. */ + init_val = cp[0] != '/' ? existing : unknown; + for (cnt = 0; cnt < ncapstr; ++cnt) + dirp->status[cnt] = init_val; + + dirp->what = what; + if (__builtin_expect (where != NULL, 1)) + dirp->where = memcpy ((char *) dirp + sizeof (*dirp) + len + 1 + + ncapstr * sizeof (enum r_dir_status), + where, where_len); + else + dirp->where = NULL; + + dirp->next = _dl_all_dirs; + _dl_all_dirs = dirp; + + /* Put it in the result array. */ + result[nelems++] = dirp; + } + } + + /* Terminate the array. */ + result[nelems] = NULL; + + return result; +} + + +static void +internal_function +decompose_rpath (struct r_search_path_struct *sps, + const char *rpath, struct link_map *l, const char *what) +{ + /* Make a copy we can work with. */ + const char *where = l->l_name; + char *copy; + char *cp; + struct r_search_path_elem **result; + size_t nelems; + /* Initialize to please the compiler. */ + const char *errstring = NULL; + + /* First see whether we must forget the RUNPATH and RPATH from this + object. */ + if (__builtin_expect (_dl_inhibit_rpath != NULL, 0)) + { + const char *found = strstr (_dl_inhibit_rpath, where); + if (found != NULL) + { + size_t len = strlen (where); + if ((found == _dl_inhibit_rpath || found[-1] == ':') + && (found[len] == '\0' || found[len] == ':')) + { + /* This object is on the list of objects for which the + RUNPATH and RPATH must not be used. */ + result = (struct r_search_path_elem **) + malloc (sizeof (*result)); + if (result == NULL) + { + signal_error_cache: + errstring = N_("cannot create cache for search path"); + signal_error: + _dl_signal_error (ENOMEM, NULL, NULL, errstring); + } + + result[0] = NULL; + + sps->dirs = result; + sps->malloced = 1; + + return; + } + } + } + + /* Make a writable copy. At the same time expand possible dynamic + string tokens. */ + copy = expand_dynamic_string_token (l, rpath); + if (copy == NULL) + { + errstring = N_("cannot create RUNPATH/RPATH copy"); + goto signal_error; + } + + /* Count the number of necessary elements in the result array. */ + nelems = 0; + for (cp = copy; *cp != '\0'; ++cp) + if (*cp == ':') + ++nelems; + + /* Allocate room for the result. NELEMS + 1 is an upper limit for the + number of necessary entries. */ + result = (struct r_search_path_elem **) malloc ((nelems + 1 + 1) + * sizeof (*result)); + if (result == NULL) + goto signal_error_cache; + + fillin_rpath (copy, result, ":", 0, what, where); + + /* Free the copied RPATH string. `fillin_rpath' make own copies if + necessary. */ + free (copy); + + sps->dirs = result; + /* The caller will change this value if we haven't used a real malloc. */ + sps->malloced = 1; +} + + +void +internal_function +_dl_init_paths (const char *llp) +{ + size_t idx; + const char *strp; + struct r_search_path_elem *pelem, **aelem; + size_t round_size; +#ifdef SHARED + struct link_map *l; +#endif + /* Initialize to please the compiler. */ + const char *errstring = NULL; + + /* Fill in the information about the application's RPATH and the + directories addressed by the LD_LIBRARY_PATH environment variable. */ + + /* Get the capabilities. */ + capstr = _dl_important_hwcaps (_dl_platform, _dl_platformlen, + &ncapstr, &max_capstrlen); + + /* First set up the rest of the default search directory entries. */ + aelem = rtld_search_dirs.dirs = (struct r_search_path_elem **) + malloc ((nsystem_dirs_len + 1) * sizeof (struct r_search_path_elem *)); + if (rtld_search_dirs.dirs == NULL) + { + errstring = N_("cannot create search path array"); + signal_error: + _dl_signal_error (ENOMEM, NULL, NULL, errstring); + } + + round_size = ((2 * sizeof (struct r_search_path_elem) - 1 + + ncapstr * sizeof (enum r_dir_status)) + / sizeof (struct r_search_path_elem)); + + rtld_search_dirs.dirs[0] = (struct r_search_path_elem *) + malloc ((sizeof (system_dirs) / sizeof (system_dirs[0])) + * round_size * sizeof (struct r_search_path_elem)); + if (rtld_search_dirs.dirs[0] == NULL) + { + errstring = N_("cannot create cache for search path"); + goto signal_error; + } + + rtld_search_dirs.malloced = 0; + pelem = _dl_all_dirs = rtld_search_dirs.dirs[0]; + strp = system_dirs; + idx = 0; + + do + { + size_t cnt; + + *aelem++ = pelem; + + pelem->what = "system search path"; + pelem->where = NULL; + + pelem->dirname = strp; + pelem->dirnamelen = system_dirs_len[idx]; + strp += system_dirs_len[idx] + 1; + + /* System paths must be absolute. */ + assert (pelem->dirname[0] == '/'); + for (cnt = 0; cnt < ncapstr; ++cnt) + pelem->status[cnt] = unknown; + + pelem->next = (++idx == nsystem_dirs_len ? NULL : (pelem + round_size)); + + pelem += round_size; + } + while (idx < nsystem_dirs_len); + + max_dirnamelen = SYSTEM_DIRS_MAX_LEN; + *aelem = NULL; + +#ifdef SHARED + /* This points to the map of the main object. */ + l = _dl_loaded; + if (l != NULL) + { + assert (l->l_type != lt_loaded); + + if (l->l_info[DT_RUNPATH]) + { + /* Allocate room for the search path and fill in information + from RUNPATH. */ + decompose_rpath (&l->l_runpath_dirs, + (const void *) (D_PTR (l, l_info[DT_STRTAB]) + + l->l_info[DT_RUNPATH]->d_un.d_val), + l, "RUNPATH"); + + /* The RPATH is ignored. */ + l->l_rpath_dirs.dirs = (void *) -1; + } + else + { + l->l_runpath_dirs.dirs = (void *) -1; + + if (l->l_info[DT_RPATH]) + { + /* Allocate room for the search path and fill in information + from RPATH. */ + decompose_rpath (&l->l_rpath_dirs, + (const void *) (D_PTR (l, l_info[DT_STRTAB]) + + l->l_info[DT_RPATH]->d_un.d_val), + l, "RPATH"); + l->l_rpath_dirs.malloced = 0; + } + else + l->l_rpath_dirs.dirs = (void *) -1; + } + } +#endif /* SHARED */ + + if (llp != NULL && *llp != '\0') + { + size_t nllp; + const char *cp = llp; + const char *old = llp; + size_t len = strlen (old) + 1; + char *new = alloca(len); + char *llp_tmp; + + llp_tmp = memcpy (new, old, len); + + /* Decompose the LD_LIBRARY_PATH contents. First determine how many + elements it has. */ + nllp = 1; + while (*cp) + { + if (*cp == ':' || *cp == ';') + ++nllp; + ++cp; + } + + env_path_list.dirs = (struct r_search_path_elem **) + malloc ((nllp + 1) * sizeof (struct r_search_path_elem *)); + if (env_path_list.dirs == NULL) + { + errstring = N_("cannot create cache for search path"); + goto signal_error; + } + + (void) fillin_rpath (llp_tmp, env_path_list.dirs, ":;", + 0, "LD_LIBRARY_PATH", NULL); + + if (env_path_list.dirs[0] == NULL) + { + free (env_path_list.dirs); + env_path_list.dirs = (void *) -1; + } + + env_path_list.malloced = 0; + } + else + env_path_list.dirs = (void *) -1; + + /* Remember the last search directory added at startup. */ + _dl_init_all_dirs = _dl_all_dirs; +} + + +/* Think twice before changing anything in this function. It is placed + here and prepared using the `alloca' magic to prevent it from being + inlined. The function is only called in case of an error. But then + performance does not count. The function used to be "inlinable" and + the compiled did so all the time. This increased the code size for + absolutely no good reason. */ +static void +__attribute__ ((noreturn)) +lose (int code, int fd, const char *name, char *realname, struct link_map *l, + const char *msg) +{ + /* The use of `alloca' here looks ridiculous but it helps. The goal + is to avoid the function from being inlined. There is no official + way to do this so we use this trick. gcc never inlines functions + which use `alloca'. */ + int *a = (int *) alloca (sizeof (int)); + a[0] = fd; + /* The file might already be closed. */ + if (a[0] != -1) + (void) close (a[0]); + if (l != NULL) + { + /* Remove the stillborn object from the list and free it. */ + assert (l->l_next == NULL); +#ifndef SHARED + if (l->l_prev == NULL) + /* No other module loaded. */ + _dl_loaded = NULL; + else +#endif + l->l_prev->l_next = NULL; + --_dl_nloaded; + free (l); + } + free (realname); + _dl_signal_error (code, name, NULL, msg); +} + + +/* Map in the shared object NAME, actually located in REALNAME, and already + opened on FD. */ + +#ifndef EXTERNAL_MAP_FROM_FD +static +#endif +struct link_map * +_dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, + char *realname, struct link_map *loader, int l_type, + int mode) +{ + struct link_map *l = NULL; + const ElfW(Ehdr) *header; + const ElfW(Phdr) *phdr; + const ElfW(Phdr) *ph; + size_t maplength; + int type; + struct stat64 st; + /* Initialize to keep the compiler happy. */ + const char *errstring = NULL; + int errval = 0; + + /* Get file information. */ + if (__builtin_expect (fstat64 (fd, &st) < 0, 0)) + { + errstring = N_("cannot stat shared object"); + call_lose_errno: + errval = errno; + call_lose: + fprintf (stderr, "%s\n", errstring); + lose (errval, fd, name, realname, l, errstring); + } + + /* Look again to see if the real name matched another already loaded. */ + for (l = _dl_loaded; l; l = l->l_next) + if (l->l_ino == st.st_ino && l->l_dev == st.st_dev) + { + /* The object is already loaded. + Just bump its reference count and return it. */ + close (fd); + + /* If the name is not in the list of names for this object add + it. */ + free (realname); + add_name_to_object (l, name); + + return l; + } + + if (mode & RTLD_NOLOAD) + /* We are not supposed to load the object unless it is already + loaded. So return now. */ + return NULL; + + /* Print debugging message. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0)) + _dl_debug_printf ("file=%s; generating link map\n", name); + + /* This is the ELF header. We read it in `open_verify'. */ + header = (void *) fbp->buf; + +#ifndef MAP_ANON +# define MAP_ANON 0 + if (_dl_zerofd == -1) + { + _dl_zerofd = _dl_sysdep_open_zero_fill (); + if (_dl_zerofd == -1) + { + close (fd); + _dl_signal_error (errno, NULL, NULL, + N_("cannot open zero fill device")); + } + } +#endif + + /* Enter the new object in the list of loaded objects. */ + l = _dl_new_object (realname, name, l_type, loader); + if (__builtin_expect (! l, 0)) + { + errstring = N_("cannot create shared object descriptor"); + goto call_lose_errno; + } + + /* Extract the remaining details we need from the ELF header + and then read in the program header table. */ + l->l_entry = header->e_entry; + type = header->e_type; + l->l_phnum = header->e_phnum; + + maplength = header->e_phnum * sizeof (ElfW(Phdr)); + if (header->e_phoff + maplength <= fbp->len) + phdr = (void *) (fbp->buf + header->e_phoff); + else + { + phdr = alloca (maplength); + lseek (fd, SEEK_SET, header->e_phoff); + if (__libc_read (fd, (void *) phdr, maplength) != maplength) + { + errstring = N_("cannot read file data"); + goto call_lose_errno; + } + } + + { + /* Scan the program header table, collecting its load commands. */ + struct loadcmd + { + ElfW(Addr) mapstart, mapend, dataend, allocend; + off_t mapoff; + int prot; + } loadcmds[l->l_phnum], *c; + size_t nloadcmds = 0; + + /* The struct is initialized to zero so this is not necessary: + l->l_ld = 0; + l->l_phdr = 0; + l->l_addr = 0; */ + for (ph = phdr; ph < &phdr[l->l_phnum]; ++ph) + switch (ph->p_type) + { + /* These entries tell us where to find things once the file's + segments are mapped in. We record the addresses it says + verbatim, and later correct for the run-time load address. */ + case PT_DYNAMIC: + l->l_ld = (void *) ph->p_vaddr; + l->l_ldnum = ph->p_memsz / sizeof (ElfW(Dyn)); + break; + + case PT_PHDR: + l->l_phdr = (void *) ph->p_vaddr; + break; + + case PT_LOAD: + /* A load command tells us to map in part of the file. + We record the load commands and process them all later. */ + if ((ph->p_align & (_dl_pagesize - 1)) != 0) + { + errstring = N_("ELF load command alignment not page-aligned"); + goto call_lose; + } + if (((ph->p_vaddr - ph->p_offset) & (ph->p_align - 1)) != 0) + { + errstring + = N_("ELF load command address/offset not properly aligned"); + goto call_lose; + } + + { + struct loadcmd *c = &loadcmds[nloadcmds++]; + c->mapstart = ph->p_vaddr & ~(ph->p_align - 1); + c->mapend = ((ph->p_vaddr + ph->p_filesz + _dl_pagesize - 1) + & ~(_dl_pagesize - 1)); + c->dataend = ph->p_vaddr + ph->p_filesz; + c->allocend = ph->p_vaddr + ph->p_memsz; + c->mapoff = ph->p_offset & ~(ph->p_align - 1); + + /* Optimize a common case. */ +#if (PF_R | PF_W | PF_X) == 7 && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7 + c->prot = (PF_TO_PROT + >> ((ph->p_flags & (PF_R | PF_W | PF_X)) * 4)) & 0xf; +#else + c->prot = 0; + if (ph->p_flags & PF_R) + c->prot |= PROT_READ; + if (ph->p_flags & PF_W) + c->prot |= PROT_WRITE; + if (ph->p_flags & PF_X) + c->prot |= PROT_EXEC; +#endif + } + break; + } + + /* Now process the load commands and map segments into memory. */ + c = loadcmds; + + /* Length of the sections to be loaded. */ + maplength = loadcmds[nloadcmds - 1].allocend - c->mapstart; + + if (__builtin_expect (type, ET_DYN) == ET_DYN) + { + /* This is a position-independent shared object. We can let the + kernel map it anywhere it likes, but we must have space for all + the segments in their specified positions relative to the first. + So we map the first segment without MAP_FIXED, but with its + extent increased to cover all the segments. Then we remove + access from excess portion, and there is known sufficient space + there to remap from the later segments. + + As a refinement, sometimes we have an address that we would + prefer to map such objects at; but this is only a preference, + the OS can do whatever it likes. */ + ElfW(Addr) mappref; + mappref = (ELF_PREFERRED_ADDRESS (loader, maplength, c->mapstart) + - MAP_BASE_ADDR (l)); + + /* Remember which part of the address space this object uses. */ + l->l_map_start = (ElfW(Addr)) mmap ((void *) mappref, maplength, + c->prot, MAP_COPY | MAP_FILE, + fd, c->mapoff); + if ((void *) l->l_map_start == MAP_FAILED) + { + map_error: + errstring = N_("failed to map segment from shared object"); + goto call_lose_errno; + } + + l->l_map_end = l->l_map_start + maplength; + l->l_addr = l->l_map_start - c->mapstart; + + /* Change protection on the excess portion to disallow all access; + the portions we do not remap later will be inaccessible as if + unallocated. Then jump into the normal segment-mapping loop to + handle the portion of the segment past the end of the file + mapping. */ + mprotect ((caddr_t) (l->l_addr + c->mapend), + loadcmds[nloadcmds - 1].allocend - c->mapend, + PROT_NONE); + + goto postmap; + } + else + { + /* This object is loaded at a fixed address. This must never + happen for objects loaded with dlopen(). */ + if (__builtin_expect (mode & __RTLD_DLOPEN, 0)) + { + errstring = N_("cannot dynamically load executable"); + goto call_lose; + } + + /* Notify ELF_PREFERRED_ADDRESS that we have to load this one + fixed. */ + ELF_FIXED_ADDRESS (loader, c->mapstart); + } + + /* Remember which part of the address space this object uses. */ + l->l_map_start = c->mapstart + l->l_addr; + l->l_map_end = l->l_map_start + maplength; + + while (c < &loadcmds[nloadcmds]) + { + if (c->mapend > c->mapstart + /* Map the segment contents from the file. */ + && (mmap ((void *) (l->l_addr + c->mapstart), + c->mapend - c->mapstart, c->prot, + MAP_FIXED | MAP_COPY | MAP_FILE, fd, c->mapoff) + == MAP_FAILED)) + goto map_error; + + postmap: + if (l->l_phdr == 0 + && c->mapoff <= header->e_phoff + && (c->mapend - c->mapstart + c->mapoff + >= header->e_phoff + header->e_phnum * sizeof (ElfW(Phdr)))) + /* Found the program header in this segment. */ + l->l_phdr = (void *) (c->mapstart + header->e_phoff - c->mapoff); + + if (c->allocend > c->dataend) + { + /* Extra zero pages should appear at the end of this segment, + after the data mapped from the file. */ + ElfW(Addr) zero, zeroend, zeropage; + + zero = l->l_addr + c->dataend; + zeroend = l->l_addr + c->allocend; + zeropage = (zero + _dl_pagesize - 1) & ~(_dl_pagesize - 1); + + if (zeroend < zeropage) + /* All the extra data is in the last page of the segment. + We can just zero it. */ + zeropage = zeroend; + + if (zeropage > zero) + { + /* Zero the final part of the last page of the segment. */ + if ((c->prot & PROT_WRITE) == 0) + { + /* Dag nab it. */ + if (mprotect ((caddr_t) (zero & ~(_dl_pagesize - 1)), + _dl_pagesize, c->prot|PROT_WRITE) < 0) + { + errstring = N_("cannot change memory protections"); + goto call_lose_errno; + } + } + memset ((void *) zero, '\0', zeropage - zero); + if ((c->prot & PROT_WRITE) == 0) + mprotect ((caddr_t) (zero & ~(_dl_pagesize - 1)), + _dl_pagesize, c->prot); + } + + if (zeroend > zeropage) + { + /* Map the remaining zero pages in from the zero fill FD. */ + caddr_t mapat; + mapat = mmap ((caddr_t) zeropage, zeroend - zeropage, + c->prot, MAP_ANON|MAP_PRIVATE|MAP_FIXED, + ANONFD, 0); + if (mapat == MAP_FAILED) + { + errstring = N_("cannot map zero-fill pages"); + goto call_lose_errno; + } + } + } + + ++c; + } + + if (l->l_phdr == NULL) + { + /* The program header is not contained in any of the segments. + We have to allocate memory ourself and copy it over from + out temporary place. */ + ElfW(Phdr) *newp = (ElfW(Phdr) *) malloc (header->e_phnum + * sizeof (ElfW(Phdr))); + if (newp == NULL) + { + errstring = N_("cannot allocate memory for program header"); + goto call_lose_errno; + } + + l->l_phdr = memcpy (newp, phdr, + (header->e_phnum * sizeof (ElfW(Phdr)))); + l->l_phdr_allocated = 1; + } + else + /* Adjust the PT_PHDR value by the runtime load address. */ + (ElfW(Addr)) l->l_phdr += l->l_addr; + } + + /* We are done mapping in the file. We no longer need the descriptor. */ + close (fd); + /* Signal that we closed the file. */ + fd = -1; + + if (l->l_type == lt_library && type == ET_EXEC) + l->l_type = lt_executable; + + if (l->l_ld == 0) + { + if (type == ET_DYN) + { + errstring = N_("object file has no dynamic section"); + goto call_lose; + } + } + else + (ElfW(Addr)) l->l_ld += l->l_addr; + + l->l_entry += l->l_addr; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0)) + _dl_debug_printf (" dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n" + " entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n", + (int) sizeof (void *) * 2, (unsigned long int) l->l_ld, + (int) sizeof (void *) * 2, (unsigned long int) l->l_addr, + (int) sizeof (void *) * 2, maplength, + (int) sizeof (void *) * 2, (unsigned long int) l->l_entry, + (int) sizeof (void *) * 2, (unsigned long int) l->l_phdr, + (int) sizeof (void *) * 2, l->l_phnum); + + elf_get_dynamic_info (l); + + /* Make sure we are dlopen()ing an object which has the DF_1_NOOPEN + flag set. */ + if (__builtin_expect (l->l_flags_1 & DF_1_NOOPEN, 0) + && (mode & __RTLD_DLOPEN)) + { + /* We are not supposed to load this object. Free all resources. */ + munmap ((void *) l->l_map_start, l->l_map_end - l->l_map_start); + + if (!l->l_libname->dont_free) + free (l->l_libname); + + if (l->l_phdr_allocated) + free ((void *) l->l_phdr); + + errstring = N_("shared object cannot be dlopen()ed"); + goto call_lose; + } + + if (l->l_info[DT_HASH]) + _dl_setup_hash (l); + + /* If this object has DT_SYMBOLIC set modify now its scope. We don't + have to do this for the main map. */ + if (__builtin_expect (l->l_info[DT_SYMBOLIC] != NULL, 0) + && &l->l_searchlist != l->l_scope[0]) + { + /* Create an appropriate searchlist. It contains only this map. + + XXX This is the definition of DT_SYMBOLIC in SysVr4. The old + GNU ld.so implementation had a different interpretation which + is more reasonable. We are prepared to add this possibility + back as part of a GNU extension of the ELF format. */ + l->l_symbolic_searchlist.r_list = + (struct link_map **) malloc (sizeof (struct link_map *)); + + if (l->l_symbolic_searchlist.r_list == NULL) + { + errstring = N_("cannot create searchlist"); + goto call_lose_errno; + } + + l->l_symbolic_searchlist.r_list[0] = l; + l->l_symbolic_searchlist.r_nlist = 1; + + /* Now move the existing entries one back. */ + memmove (&l->l_scope[1], &l->l_scope[0], + (l->l_scope_max - 1) * sizeof (l->l_scope[0])); + + /* Now add the new entry. */ + l->l_scope[0] = &l->l_symbolic_searchlist; + } + + /* Remember whether this object must be initialized first. */ + if (l->l_flags_1 & DF_1_INITFIRST) + _dl_initfirst = l; + + /* Finally the file information. */ + l->l_dev = st.st_dev; + l->l_ino = st.st_ino; + + return l; +} + +/* Print search path. */ +static void +print_search_path (struct r_search_path_elem **list, + const char *what, const char *name) +{ + char buf[max_dirnamelen + max_capstrlen]; + int first = 1; + + _dl_debug_printf (" search path="); + + while (*list != NULL && (*list)->what == what) /* Yes, ==. */ + { + char *endp = memcpy (buf, (*list)->dirname, (*list)->dirnamelen); + size_t cnt; + endp += (*list)->dirnamelen; + + + for (cnt = 0; cnt < ncapstr; ++cnt) + if ((*list)->status[cnt] != nonexisting) + { + char *cp = memcpy (endp, capstr[cnt].str, capstr[cnt].len); + cp += capstr[cnt].len; + + if (cp == buf || (cp == buf + 1 && buf[0] == '/')) + cp[0] = '\0'; + else + cp[-1] = '\0'; + + _dl_debug_printf_c (first ? "%s" : ":%s", buf); + first = 0; + } + + ++list; + } + + if (name != NULL) + _dl_debug_printf_c ("\t\t(%s from file %s)\n", what, + name[0] ? name : _dl_argv[0]); + else + _dl_debug_printf_c ("\t\t(%s)\n", what); +} + +/* Open a file and verify it is an ELF file for this architecture. We + ignore only ELF files for other architectures. Non-ELF files and + ELF files with different header information cause fatal errors since + this could mean there is something wrong in the installation and the + user might want to know about this. */ +static int +open_verify (const char *name, struct filebuf *fbp) +{ + /* This is the expected ELF header. */ +#define ELF32_CLASS ELFCLASS32 +#define ELF64_CLASS ELFCLASS64 +#ifndef VALID_ELF_HEADER +# define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0) +# define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV) +# define VALID_ELF_ABIVERSION(ver) (ver == 0) +#endif + static const unsigned char expected[EI_PAD] = + { + [EI_MAG0] = ELFMAG0, + [EI_MAG1] = ELFMAG1, + [EI_MAG2] = ELFMAG2, + [EI_MAG3] = ELFMAG3, + [EI_CLASS] = ELFW(CLASS), + [EI_DATA] = byteorder, + [EI_VERSION] = EV_CURRENT, + [EI_OSABI] = ELFOSABI_SYSV, + [EI_ABIVERSION] = 0 + }; + static const struct + { + ElfW(Word) vendorlen; + ElfW(Word) datalen; + ElfW(Word) type; + char vendor[4]; + } expected_note = { 4, 16, 1, "GNU" }; + int fd; + /* Initialize it to make the compiler happy. */ + const char *errstring = NULL; + int errval = 0; + + /* Open the file. We always open files read-only. */ + fd = open (name, O_RDONLY); + if (fd != -1) + { + ElfW(Ehdr) *ehdr; + ElfW(Phdr) *phdr, *ph; + ElfW(Word) *abi_note, abi_note_buf[8]; + unsigned int osversion; + size_t maplength; + + /* We successfully openened the file. Now verify it is a file + we can use. */ + __set_errno (0); + fbp->len = __libc_read (fd, fbp->buf, sizeof (fbp->buf)); + + /* This is where the ELF header is loaded. */ + assert (sizeof (fbp->buf) > sizeof (ElfW(Ehdr))); + ehdr = (ElfW(Ehdr) *) fbp->buf; + + /* Now run the tests. */ + if (__builtin_expect (fbp->len < (ssize_t) sizeof (ElfW(Ehdr)), 0)) + { + errval = errno; + errstring = (errval == 0 + ? N_("file too short") : N_("cannot read file data")); + call_lose: + lose (errval, fd, name, NULL, NULL, errstring); + } + + /* See whether the ELF header is what we expect. */ + if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected, + EI_PAD), 0)) + { + /* Something is wrong. */ + if (*(Elf32_Word *) &ehdr->e_ident != +#if BYTE_ORDER == LITTLE_ENDIAN + ((ELFMAG0 << (EI_MAG0 * 8)) | + (ELFMAG1 << (EI_MAG1 * 8)) | + (ELFMAG2 << (EI_MAG2 * 8)) | + (ELFMAG3 << (EI_MAG3 * 8))) +#else + ((ELFMAG0 << (EI_MAG3 * 8)) | + (ELFMAG1 << (EI_MAG2 * 8)) | + (ELFMAG2 << (EI_MAG1 * 8)) | + (ELFMAG3 << (EI_MAG0 * 8))) +#endif + ) + errstring = N_("invalid ELF header"); + else if (ehdr->e_ident[EI_CLASS] != ELFW(CLASS)) + /* This is not a fatal error. On architectures where + 32-bit and 64-bit binaries can be run this might + happen. */ + goto close_and_out; + else if (ehdr->e_ident[EI_DATA] != byteorder) + { + if (BYTE_ORDER == BIG_ENDIAN) + errstring = N_("ELF file data encoding not big-endian"); + else + errstring = N_("ELF file data encoding not little-endian"); + } + else if (ehdr->e_ident[EI_VERSION] != EV_CURRENT) + errstring + = N_("ELF file version ident does not match current one"); + /* XXX We should be able so set system specific versions which are + allowed here. */ + else if (!VALID_ELF_OSABI (ehdr->e_ident[EI_OSABI])) + errstring = N_("ELF file OS ABI invalid"); + else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION])) + errstring = N_("ELF file ABI version invalid"); + else + /* Otherwise we don't know what went wrong. */ + errstring = N_("internal error"); + + goto call_lose; + } + + if (__builtin_expect (ehdr->e_version, EV_CURRENT) != EV_CURRENT) + { + errstring = N_("ELF file version does not match current one"); + goto call_lose; + } + if (! __builtin_expect (elf_machine_matches_host (ehdr), 1)) + goto close_and_out; + else if (__builtin_expect (ehdr->e_phentsize, sizeof (ElfW(Phdr))) + != sizeof (ElfW(Phdr))) + { + errstring = N_("ELF file's phentsize not the expected size"); + goto call_lose; + } + else if (__builtin_expect (ehdr->e_type, ET_DYN) != ET_DYN + && __builtin_expect (ehdr->e_type, ET_EXEC) != ET_EXEC) + { + errstring = N_("only ET_DYN and ET_EXEC can be loaded"); + goto call_lose; + } + + maplength = ehdr->e_phnum * sizeof (ElfW(Phdr)); + if (ehdr->e_phoff + maplength <= fbp->len) + phdr = (void *) (fbp->buf + ehdr->e_phoff); + else + { + phdr = alloca (maplength); + lseek (fd, SEEK_SET, ehdr->e_phoff); + if (__libc_read (fd, (void *) phdr, maplength) != maplength) + { + read_error: + errval = errno; + errstring = N_("cannot read file data"); + goto call_lose; + } + } + + /* Check .note.ABI-tag if present. */ + for (ph = phdr; ph < &phdr[ehdr->e_phnum]; ++ph) + if (ph->p_type == PT_NOTE && ph->p_filesz == 32 && ph->p_align >= 4) + { + if (ph->p_offset + 32 <= fbp->len) + abi_note = (void *) (fbp->buf + ph->p_offset); + else + { + lseek (fd, SEEK_SET, ph->p_offset); + if (__libc_read (fd, (void *) abi_note_buf, 32) != 32) + goto read_error; + + abi_note = abi_note_buf; + } + + if (memcmp (abi_note, &expected_note, sizeof (expected_note))) + continue; + + osversion = (abi_note[5] & 0xff) * 65536 + + (abi_note[6] & 0xff) * 256 + + (abi_note[7] & 0xff); + if (abi_note[4] != __ABI_TAG_OS + || (_dl_osversion && _dl_osversion < osversion)) + { + close_and_out: + close (fd); + __set_errno (ENOENT); + fd = -1; + } + + break; + } + } + + return fd; +} + +/* Try to open NAME in one of the directories in *DIRSP. + Return the fd, or -1. If successful, fill in *REALNAME + with the malloc'd full directory name. If it turns out + that none of the directories in *DIRSP exists, *DIRSP is + replaced with (void *) -1, and the old value is free()d + if MAY_FREE_DIRS is true. */ + +static int +open_path (const char *name, size_t namelen, int preloaded, + struct r_search_path_struct *sps, char **realname, + struct filebuf *fbp) +{ + struct r_search_path_elem **dirs = sps->dirs; + char *buf; + int fd = -1; + const char *current_what = NULL; + int any = 0; + + buf = alloca (max_dirnamelen + max_capstrlen + namelen); + do + { + struct r_search_path_elem *this_dir = *dirs; + size_t buflen = 0; + size_t cnt; + char *edp; + int here_any = 0; + int err; + + /* If we are debugging the search for libraries print the path + now if it hasn't happened now. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0) + && current_what != this_dir->what) + { + current_what = this_dir->what; + print_search_path (dirs, current_what, this_dir->where); + } + + edp = (char *) (memcpy (buf, this_dir->dirname, this_dir->dirnamelen) + this_dir->dirnamelen); + for (cnt = 0; fd == -1 && cnt < ncapstr; ++cnt) + { + char *tmp; + /* Skip this directory if we know it does not exist. */ + if (this_dir->status[cnt] == nonexisting) + continue; + + tmp = memcpy (edp, capstr[cnt].str, capstr[cnt].len); + tmp += capstr[cnt].len; + + tmp = memcpy (tmp, name, namelen); + tmp += namelen; + buflen = ((char *) (tmp - buf)); + + /* Print name we try if this is wanted. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) + _dl_debug_printf (" trying file=%s\n", buf); + + fd = open_verify (buf, fbp); + if (this_dir->status[cnt] == unknown) + { + if (fd != -1) + this_dir->status[cnt] = existing; + else + { + /* We failed to open machine dependent library. Let's + test whether there is any directory at all. */ + struct stat64 st; + + buf[buflen - namelen - 1] = '\0'; + + if (stat64 (buf, &st) != 0 + || ! S_ISDIR (st.st_mode)) + /* The directory does not exist or it is no directory. */ + this_dir->status[cnt] = nonexisting; + else + this_dir->status[cnt] = existing; + } + } + + /* Remember whether we found any existing directory. */ + here_any |= this_dir->status[cnt] == existing; + + if (fd != -1 && __builtin_expect (preloaded, 0) + && 0) + { + /* This is an extra security effort to make sure nobody can + preload broken shared objects which are in the trusted + directories and so exploit the bugs. */ + struct stat64 st; + + if (fstat64 (fd, &st) != 0 + || (st.st_mode & S_ISUID) == 0) + { + /* The shared object cannot be tested for being SUID + or this bit is not set. In this case we must not + use this object. */ + close (fd); + fd = -1; + /* We simply ignore the file, signal this by setting + the error value which would have been set by `open'. */ + errno = ENOENT; + } + } + } + + if (fd != -1) + { + *realname = (char *) malloc (buflen); + if (*realname != NULL) + { + memcpy (*realname, buf, buflen); + return fd; + } + else + { + /* No memory for the name, we certainly won't be able + to load and link it. */ + close (fd); + return -1; + } + } + if (here_any && (err = errno) != ENOENT && err != EACCES) + /* The file exists and is readable, but something went wrong. */ + return -1; + + /* Remember whether we found anything. */ + any |= here_any; + } + while (*++dirs != NULL); + + /* Remove the whole path if none of the directories exists. */ + if (__builtin_expect (! any, 0)) + { + /* Paths which were allocated using the minimal malloc() in ld.so + must not be freed using the general free() in libc. */ + if (sps->malloced) + free (sps->dirs); + sps->dirs = (void *) -1; + } + + return -1; +} + +/* Map in the shared object file NAME. */ + +struct link_map * +internal_function +_dl_map_object (struct link_map *loader, const char *name, int preloaded, + int type, int trace_mode, int mode) +{ + int fd; + char *realname; + char *name_copy; + struct link_map *l; + struct filebuf fb; + + /* Look for this name among those already loaded. */ + for (l = _dl_loaded; l; l = l->l_next) + { + /* If the requested name matches the soname of a loaded object, + use that object. Elide this check for names that have not + yet been opened. */ + if (__builtin_expect (l->l_faked, 0) != 0) + continue; + if (!_dl_name_match_p (name, l)) + { + const char *soname; + + if (__builtin_expect (l->l_soname_added, 1) + || l->l_info[DT_SONAME] == NULL) + continue; + + soname = ((const char *) D_PTR (l, l_info[DT_STRTAB]) + + l->l_info[DT_SONAME]->d_un.d_val); + if (strcmp (name, soname) != 0) + continue; + + /* We have a match on a new name -- cache it. */ + add_name_to_object (l, soname); + l->l_soname_added = 1; + } + + /* We have a match. */ + return l; + } + + /* Display information if we are debugging. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0) && loader != NULL) + _dl_debug_printf ("\nfile=%s; needed by %s\n", name, + loader->l_name[0] ? loader->l_name : _dl_argv[0]); + + if (strchr (name, '/') == NULL) + { + /* Search for NAME in several places. */ + + size_t namelen = strlen (name) + 1; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) + _dl_debug_printf ("find library=%s; searching\n", name); + + fd = -1; + + /* When the object has the RUNPATH information we don't use any + RPATHs. */ + if (loader == NULL || loader->l_info[DT_RUNPATH] == NULL) + { + /* First try the DT_RPATH of the dependent object that caused NAME + to be loaded. Then that object's dependent, and on up. */ + for (l = loader; fd == -1 && l; l = l->l_loader) + { + if (l->l_rpath_dirs.dirs == NULL) + { + if (l->l_info[DT_RPATH] == NULL) + { + /* There is no path. */ + l->l_rpath_dirs.dirs = (void *) -1; + continue; + } + else + { + /* Make sure the cache information is available. */ + size_t ptrval = (D_PTR (l, l_info[DT_STRTAB]) + + l->l_info[DT_RPATH]->d_un.d_val); + decompose_rpath (&l->l_rpath_dirs, + (const char *) ptrval, l, "RPATH"); + } + } + + if (l->l_rpath_dirs.dirs != (void *) -1) + fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs, + &realname, &fb); + } + + /* If dynamically linked, try the DT_RPATH of the executable + itself. */ + l = _dl_loaded; + if (fd == -1 && l && l->l_type != lt_loaded && l != loader + && l->l_rpath_dirs.dirs != (void *) -1) + fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs, + &realname, &fb); + } + + /* Try the LD_LIBRARY_PATH environment variable. */ + if (fd == -1 && env_path_list.dirs != (void *) -1) + fd = open_path (name, namelen, preloaded, &env_path_list, + &realname, &fb); + + /* Look at the RUNPATH information for this binary. + + Note that this is no real loop. 'while' is used only to enable + us to use 'break' instead of a 'goto' to jump to the end. The + loop is always left after the first round. */ + while (fd == -1 && loader != NULL + && loader->l_runpath_dirs.dirs != (void *) -1) + { + if (loader->l_runpath_dirs.dirs == NULL) + { + if (loader->l_info[DT_RUNPATH] == NULL) + { + /* No RUNPATH. */ + loader->l_runpath_dirs.dirs = (void *) -1; + break; + } + else + { + /* Make sure the cache information is available. */ + size_t ptrval = (D_PTR (loader, l_info[DT_STRTAB]) + + loader->l_info[DT_RUNPATH]->d_un.d_val); + decompose_rpath (&loader->l_runpath_dirs, + (const char *) ptrval, loader, "RUNPATH"); + } + } + + if (loader->l_runpath_dirs.dirs != (void *) -1) + fd = open_path (name, namelen, preloaded, + &loader->l_runpath_dirs, &realname, &fb); + break; + } + + if (fd == -1 + && (__builtin_expect (! preloaded, 1) || ! 0)) + { + /* Check the list of libraries in the file /etc/ld.so.cache, + for compatibility with Linux's ldconfig program. */ + const char *cached = _dl_load_cache_lookup (name); + + if (cached != NULL) + { +#ifdef SHARED + l = loader ?: _dl_loaded; +#else + l = loader; +#endif + + /* If the loader has the DF_1_NODEFLIB flag set we must not + use a cache entry from any of these directories. */ + if ( +#ifndef SHARED + /* 'l' is always != NULL for dynamically linked objects. */ + l != NULL && +#endif + __builtin_expect (l->l_flags_1 & DF_1_NODEFLIB, 0)) + { + const char *dirp = system_dirs; + unsigned int cnt = 0; + + do + { + if (memcmp (cached, dirp, system_dirs_len[cnt]) == 0) + { + /* The prefix matches. Don't use the entry. */ + cached = NULL; + break; + } + + dirp += system_dirs_len[cnt] + 1; + ++cnt; + } + while (cnt < nsystem_dirs_len); + } + + if (cached != NULL) + { + fd = open_verify (cached, &fb); + if (__builtin_expect (fd != -1, 1)) + { + realname = local_strdup (cached); + if (realname == NULL) + { + close (fd); + fd = -1; + } + } + } + } + } + + /* Finally, try the default path. */ + if (fd == -1 + && ((l = loader ?: _dl_loaded) + /* 'l' is always != NULL for dynamically linked objects. */ +#ifdef SHARED + , +#else + == NULL || +#endif + __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) + && rtld_search_dirs.dirs != (void *) -1) + fd = open_path (name, namelen, preloaded, &rtld_search_dirs, + &realname, &fb); + + /* Add another newline when we a tracing the library loading. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) + _dl_debug_printf ("\n"); + } + else + { + /* The path may contain dynamic string tokens. */ + realname = (loader + ? expand_dynamic_string_token (loader, name) + : local_strdup (name)); + if (realname == NULL) + fd = -1; + else + { + fd = open_verify (realname, &fb); + if (__builtin_expect (fd, 0) == -1) + free (realname); + } + } + + if (__builtin_expect (fd, 0) == -1) + { + if (trace_mode) + { + /* We haven't found an appropriate library. But since we + are only interested in the list of libraries this isn't + so severe. Fake an entry with all the information we + have. */ + static const Elf_Symndx dummy_bucket = STN_UNDEF; + + /* Enter the new object in the list of loaded objects. */ + if ((name_copy = local_strdup (name)) == NULL + || (l = _dl_new_object (name_copy, name, type, loader)) == NULL) + _dl_signal_error (ENOMEM, name, NULL, + N_("cannot create shared object descriptor")); + /* Signal that this is a faked entry. */ + l->l_faked = 1; + /* Since the descriptor is initialized with zero we do not + have do this here. + l->l_reserved = 0; */ + l->l_buckets = &dummy_bucket; + l->l_nbuckets = 1; + l->l_relocated = 1; + + return l; + } + else + _dl_signal_error (errno, name, NULL, + N_("cannot open shared object file")); + } + + return _dl_map_object_from_fd (name, fd, &fb, realname, loader, type, mode); +} diff --git a/newlib/libc/sys/linux/dl/dl-lookup.c b/newlib/libc/sys/linux/dl/dl-lookup.c new file mode 100644 index 000000000..9fc296cf1 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-lookup.c @@ -0,0 +1,654 @@ +/* Look up a symbol in the loaded objects. + Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include "dl-hash.h" +#include +#include + +#include + +#define VERSTAG(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (tag)) + +/* We need this string more than once. */ +static const char undefined_msg[] = "undefined symbol: "; + + +struct sym_val + { + const ElfW(Sym) *s; + struct link_map *m; + }; + + +#define make_string(string, rest...) \ + ({ \ + const char *all[] = { string, ## rest }; \ + size_t len, cnt; \ + char *result, *cp; \ + \ + len = 1; \ + for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \ + len += strlen (all[cnt]); \ + \ + cp = result = alloca (len); \ + for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \ + { \ + cp = strcpy (cp, all[cnt]); \ + cp += strlen(all[cnt]); \ + } \ + \ + result; \ + }) + +/* Statistics function. */ +unsigned long int _dl_num_relocations; + + +/* We have two different situations when looking up a simple: with or + without versioning. gcc is not able to optimize a single function + definition serving for both purposes so we define two functions. */ +#define VERSIONED 0 +#include "do-lookup.h" + +#define VERSIONED 1 +#include "do-lookup.h" + + +/* Add extra dependency on MAP to UNDEF_MAP. */ +static int +internal_function +add_dependency (struct link_map *undef_map, struct link_map *map) +{ + struct link_map **list; + struct link_map *runp; + unsigned int act; + unsigned int i; + int result = 0; + + /* Avoid self-references. */ + if (undef_map == map) + return 0; + + /* Make sure nobody can unload the object while we are at it. */ +#ifdef HAVE_DD_LOCK + __lock_acquire(_dl_load_lock); +#endif + + + /* Determine whether UNDEF_MAP already has a reference to MAP. First + look in the normal dependencies. */ + if (undef_map->l_searchlist.r_list != NULL) + { + list = undef_map->l_initfini; + + for (i = 0; list[i] != NULL; ++i) + if (list[i] == map) + goto out; + } + + /* No normal dependency. See whether we already had to add it + to the special list of dynamic dependencies. */ + list = undef_map->l_reldeps; + act = undef_map->l_reldepsact; + + for (i = 0; i < act; ++i) + if (list[i] == map) + goto out; + + /* The object is not yet in the dependency list. Before we add + it make sure just one more time the object we are about to + reference is still available. There is a brief period in + which the object could have been removed since we found the + definition. */ + runp = _dl_loaded; + while (runp != NULL && runp != map) + runp = runp->l_next; + + if (runp != NULL) + { + /* The object is still available. Add the reference now. */ + if (__builtin_expect (act >= undef_map->l_reldepsmax, 0)) + { + /* Allocate more memory for the dependency list. Since this + can never happen during the startup phase we can use + `realloc'. */ + void *newp; + + undef_map->l_reldepsmax += 5; + newp = realloc (undef_map->l_reldeps, + undef_map->l_reldepsmax + * sizeof (struct link_map *)); + + if (__builtin_expect (newp != NULL, 1)) + undef_map->l_reldeps = (struct link_map **) newp; + else + /* Correct the addition. */ + undef_map->l_reldepsmax -= 5; + } + + /* If we didn't manage to allocate memory for the list this is + no fatal mistake. We simply increment the use counter of the + referenced object and don't record the dependencies. This + means this increment can never be reverted and the object + will never be unloaded. This is semantically the correct + behaviour. */ + if (__builtin_expect (act < undef_map->l_reldepsmax, 1)) + undef_map->l_reldeps[undef_map->l_reldepsact++] = map; + + if (map->l_searchlist.r_list != NULL) + /* And increment the counter in the referenced object. */ + ++map->l_opencount; + else + /* We have to bump the counts for all dependencies since so far + this object was only a normal or transitive dependency. + Now it might be closed with _dl_close() directly. */ + for (list = map->l_initfini; *list != NULL; ++list) + ++(*list)->l_opencount; + + /* Display information if we are debugging. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0)) + _dl_debug_printf ("\ +\nfile=%s; needed by %s (relocation dependency)\n\n", + map->l_name[0] ? map->l_name : _dl_argv[0], + undef_map->l_name[0] + ? undef_map->l_name : _dl_argv[0]); + } + else + /* Whoa, that was bad luck. We have to search again. */ + result = -1; + + out: + /* Release the lock. */ +#ifdef HAVE_DD_LOCK + __lock_release(_dl_load_lock); +#endif + + + return result; +} + +static int +internal_function +_dl_do_lookup (const char *undef_name, unsigned long int hash, + const ElfW(Sym) *ref, struct sym_val *result, + struct r_scope_elem *scope, size_t i, + struct link_map *skip, int type_class); +static int +internal_function +_dl_do_lookup_versioned (const char *undef_name, unsigned long int hash, + const ElfW(Sym) *ref, struct sym_val *result, + struct r_scope_elem *scope, size_t i, + const struct r_found_version *const version, + struct link_map *skip, int type_class); + + +/* Search loaded objects' symbol tables for a definition of the symbol + UNDEF_NAME. */ + +lookup_t +internal_function +_dl_lookup_symbol (const char *undef_name, struct link_map *undef_map, + const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[], + int type_class, int explicit) +{ + unsigned long int hash = _dl_elf_hash (undef_name); + struct sym_val current_value = { NULL, NULL }; + struct r_scope_elem **scope; + int protected; + + ++_dl_num_relocations; + + /* Search the relevant loaded objects for a definition. */ + for (scope = symbol_scope; *scope; ++scope) + if (do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, NULL, + type_class)) + { + /* We have to check whether this would bind UNDEF_MAP to an object + in the global scope which was dynamically loaded. In this case + we have to prevent the latter from being unloaded unless the + UNDEF_MAP object is also unloaded. */ + if (__builtin_expect (current_value.m->l_type == lt_loaded, 0) + /* Don't do this for explicit lookups as opposed to implicit + runtime lookups. */ + && ! explicit + /* Add UNDEF_MAP to the dependencies. */ + && add_dependency (undef_map, current_value.m) < 0) + /* Something went wrong. Perhaps the object we tried to reference + was just removed. Try finding another definition. */ + return _dl_lookup_symbol (undef_name, undef_map, ref, symbol_scope, + type_class, 0); + + break; + } + + if (__builtin_expect (current_value.s == NULL, 0)) + { + const char *reference_name = undef_map ? undef_map->l_name : NULL; + + if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) + /* We could find no value for a strong reference. */ + /* XXX We cannot translate the messages. */ + _dl_signal_cerror (0, (reference_name && reference_name[0] + ? reference_name + : (_dl_argv[0] ?: "
")), + N_("relocation error"), + make_string (undefined_msg, undef_name)); + *ref = NULL; + return 0; + } + + protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) + { + const char *reference_name = undef_map ? undef_map->l_name : NULL; + + _dl_debug_printf ("binding file %s to %s: %s symbol `%s'\n", + (reference_name && reference_name[0] + ? reference_name : (_dl_argv[0] ?: "
")), + current_value.m->l_name[0] + ? current_value.m->l_name : _dl_argv[0], + protected ? "protected" : "normal", undef_name); + } + + if (__builtin_expect (protected == 0, 1)) + { + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); + } + else + { + /* It is very tricky. We need to figure out what value to + return for the protected symbol */ + struct sym_val protected_value = { NULL, NULL }; + + for (scope = symbol_scope; *scope; ++scope) + if (_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope, + 0, NULL, ELF_RTYPE_CLASS_PLT)) + break; + + if (protected_value.s == NULL || protected_value.m == undef_map) + { + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); + } + + return LOOKUP_VALUE (undef_map); + } +} + + +/* This function is nearly the same as `_dl_lookup_symbol' but it + skips in the first list all objects until SKIP_MAP is found. I.e., + it only considers objects which were loaded after the described + object. If there are more search lists the object described by + SKIP_MAP is only skipped. */ +lookup_t +internal_function +_dl_lookup_symbol_skip (const char *undef_name, + struct link_map *undef_map, const ElfW(Sym) **ref, + struct r_scope_elem *symbol_scope[], + struct link_map *skip_map) +{ + const char *reference_name = undef_map ? undef_map->l_name : NULL; + const unsigned long int hash = _dl_elf_hash (undef_name); + struct sym_val current_value = { NULL, NULL }; + struct r_scope_elem **scope; + size_t i; + int protected; + + ++_dl_num_relocations; + + /* Search the relevant loaded objects for a definition. */ + scope = symbol_scope; + for (i = 0; (*scope)->r_list[i] != skip_map; ++i) + assert (i < (*scope)->r_nlist); + + if (! _dl_do_lookup (undef_name, hash, *ref, ¤t_value, *scope, i, + skip_map, 0)) + while (*++scope) + if (_dl_do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, + skip_map, 0)) + break; + + if (__builtin_expect (current_value.s == NULL, 0)) + { + *ref = NULL; + return 0; + } + + protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) + _dl_debug_printf ("binding file %s to %s: %s symbol `%s'\n", + (reference_name && reference_name[0] + ? reference_name : (_dl_argv[0] ?: "
")), + current_value.m->l_name[0] + ? current_value.m->l_name : _dl_argv[0], + protected ? "protected" : "normal", undef_name); + + if (__builtin_expect (protected == 0, 1)) + { + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); + } + else + { + /* It is very tricky. We need to figure out what value to + return for the protected symbol. */ + struct sym_val protected_value = { NULL, NULL }; + + if (i >= (*scope)->r_nlist + || !_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope, + i, skip_map, ELF_RTYPE_CLASS_PLT)) + while (*++scope) + if (_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope, + 0, skip_map, ELF_RTYPE_CLASS_PLT)) + break; + + if (protected_value.s == NULL || protected_value.m == undef_map) + { + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); + } + + return LOOKUP_VALUE (undef_map); + } +} + + +/* This function works like _dl_lookup_symbol but it takes an + additional arguement with the version number of the requested + symbol. + + XXX We'll see whether we need this separate function. */ +lookup_t +internal_function +_dl_lookup_versioned_symbol (const char *undef_name, + struct link_map *undef_map, const ElfW(Sym) **ref, + struct r_scope_elem *symbol_scope[], + const struct r_found_version *version, + int type_class, int explicit) +{ + unsigned long int hash = _dl_elf_hash (undef_name); + struct sym_val current_value = { NULL, NULL }; + struct r_scope_elem **scope; + int protected; + + ++_dl_num_relocations; + + /* Search the relevant loaded objects for a definition. */ + for (scope = symbol_scope; *scope; ++scope) + { + int res = do_lookup_versioned (undef_name, hash, *ref, ¤t_value, + *scope, 0, version, NULL, type_class); + if (res > 0) + { + /* We have to check whether this would bind UNDEF_MAP to an object + in the global scope which was dynamically loaded. In this case + we have to prevent the latter from being unloaded unless the + UNDEF_MAP object is also unloaded. */ + if (__builtin_expect (current_value.m->l_type == lt_loaded, 0) + /* Don't do this for explicit lookups as opposed to implicit + runtime lookups. */ + && ! explicit + /* Add UNDEF_MAP to the dependencies. */ + && add_dependency (undef_map, current_value.m) < 0) + /* Something went wrong. Perhaps the object we tried to reference + was just removed. Try finding another definition. */ + return _dl_lookup_versioned_symbol (undef_name, undef_map, ref, + symbol_scope, version, + type_class, 0); + + break; + } + + if (__builtin_expect (res, 0) < 0) + { + /* Oh, oh. The file named in the relocation entry does not + contain the needed symbol. */ + const char *reference_name = undef_map ? undef_map->l_name : NULL; + + /* XXX We cannot translate the message. */ + _dl_signal_cerror (0, (reference_name && reference_name[0] + ? reference_name + : (_dl_argv[0] ?: "
")), + N_("relocation error"), + make_string ("symbol ", undef_name, ", version ", + version->name, + " not defined in file ", + version->filename, + " with link time reference", + res == -2 + ? " (no version symbols)" : "")); + *ref = NULL; + return 0; + } + } + + if (__builtin_expect (current_value.s == NULL, 0)) + { + if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) + { + /* We could find no value for a strong reference. */ + const char *reference_name = undef_map ? undef_map->l_name : NULL; + + /* XXX We cannot translate the message. */ + _dl_signal_cerror (0, (reference_name && reference_name[0] + ? reference_name + : (_dl_argv[0] ?: "
")), NULL, + make_string (undefined_msg, undef_name, + ", version ", + version->name ?: NULL)); + } + *ref = NULL; + return 0; + } + + protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) + { + const char *reference_name = undef_map ? undef_map->l_name : NULL; + + _dl_debug_printf ("binding file %s to %s: %s symbol `%s' [%s]\n", + (reference_name && reference_name[0] + ? reference_name : (_dl_argv[0] ?: "
")), + current_value.m->l_name[0] + ? current_value.m->l_name : _dl_argv[0], + protected ? "protected" : "normal", + undef_name, version->name); + } + + if (__builtin_expect (protected == 0, 1)) + { + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); + } + else + { + /* It is very tricky. We need to figure out what value to + return for the protected symbol */ + struct sym_val protected_value = { NULL, NULL }; + + for (scope = symbol_scope; *scope; ++scope) + if (_dl_do_lookup_versioned (undef_name, hash, *ref, &protected_value, + *scope, 0, version, NULL, + ELF_RTYPE_CLASS_PLT)) + break; + + if (protected_value.s == NULL || protected_value.m == undef_map) + { + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); + } + + return LOOKUP_VALUE (undef_map); + } +} + + +/* Similar to _dl_lookup_symbol_skip but takes an additional argument + with the version we are looking for. */ +lookup_t +internal_function +_dl_lookup_versioned_symbol_skip (const char *undef_name, + struct link_map *undef_map, + const ElfW(Sym) **ref, + struct r_scope_elem *symbol_scope[], + const struct r_found_version *version, + struct link_map *skip_map) +{ + const char *reference_name = undef_map ? undef_map->l_name : NULL; + const unsigned long int hash = _dl_elf_hash (undef_name); + struct sym_val current_value = { NULL, NULL }; + struct r_scope_elem **scope; + size_t i; + int protected; + + ++_dl_num_relocations; + + /* Search the relevant loaded objects for a definition. */ + scope = symbol_scope; + for (i = 0; (*scope)->r_list[i] != skip_map; ++i) + assert (i < (*scope)->r_nlist); + + if (! _dl_do_lookup_versioned (undef_name, hash, *ref, ¤t_value, + *scope, i, version, skip_map, 0)) + while (*++scope) + if (_dl_do_lookup_versioned (undef_name, hash, *ref, ¤t_value, + *scope, 0, version, skip_map, 0)) + break; + + if (__builtin_expect (current_value.s == NULL, 0)) + { + if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) + { + /* We could find no value for a strong reference. */ + const size_t len = strlen (undef_name); + char buf[sizeof undefined_msg + len]; + char *tmp; + tmp = memcpy (buf, undefined_msg, sizeof undefined_msg - 1); + tmp += (sizeof undefined_msg - 1); + + memcpy (tmp, undef_name, len + 1); + + /* XXX We cannot translate the messages. */ + _dl_signal_cerror (0, (reference_name && reference_name[0] + ? reference_name + : (_dl_argv[0] ?: "
")), + NULL, buf); + } + *ref = NULL; + return 0; + } + + protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) + _dl_debug_printf ("binding file %s to %s: %s symbol `%s' [%s]\n", + (reference_name && reference_name[0] + ? reference_name : (_dl_argv[0] ?: "
")), + current_value.m->l_name[0] + ? current_value.m->l_name : _dl_argv[0], + protected ? "protected" : "normal", + undef_name, version->name); + + if (__builtin_expect (protected == 0, 1)) + { + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); + } + else + { + /* It is very tricky. We need to figure out what value to + return for the protected symbol */ + struct sym_val protected_value = { NULL, NULL }; + + if (i >= (*scope)->r_nlist + || !_dl_do_lookup_versioned (undef_name, hash, *ref, + &protected_value, *scope, i, version, + skip_map, ELF_RTYPE_CLASS_PLT)) + while (*++scope) + if (_dl_do_lookup_versioned (undef_name, hash, *ref, + &protected_value, *scope, 0, version, + skip_map, ELF_RTYPE_CLASS_PLT)) + break; + + if (protected_value.s == NULL || protected_value.m == undef_map) + { + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); + } + + return LOOKUP_VALUE (undef_map); + } +} + + +/* Cache the location of MAP's hash table. */ + +void +internal_function +_dl_setup_hash (struct link_map *map) +{ + Elf_Symndx *hash; + Elf_Symndx nchain; + + if (!map->l_info[DT_HASH]) + return; + hash = (void *)(map->l_addr + map->l_info[DT_HASH]->d_un.d_ptr); + + map->l_nbuckets = *hash++; + nchain = *hash++; + map->l_buckets = hash; + hash += map->l_nbuckets; + map->l_chain = hash; +} + +/* These are here so that we only inline do_lookup{,_versioned} in the common + case, not everywhere. */ +static int +internal_function +_dl_do_lookup (const char *undef_name, unsigned long int hash, + const ElfW(Sym) *ref, struct sym_val *result, + struct r_scope_elem *scope, size_t i, + struct link_map *skip, int type_class) +{ + return do_lookup (undef_name, hash, ref, result, scope, i, skip, + type_class); +} + +static int +internal_function +_dl_do_lookup_versioned (const char *undef_name, unsigned long int hash, + const ElfW(Sym) *ref, struct sym_val *result, + struct r_scope_elem *scope, size_t i, + const struct r_found_version *const version, + struct link_map *skip, int type_class) +{ + return do_lookup_versioned (undef_name, hash, ref, result, scope, i, + version, skip, type_class); +} diff --git a/newlib/libc/sys/linux/dl/dl-lookupcfg.h b/newlib/libc/sys/linux/dl/dl-lookupcfg.h new file mode 100644 index 000000000..810e8c7c6 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-lookupcfg.h @@ -0,0 +1,22 @@ +/* Configuration of lookup functions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Some platforms need more information from the symbol lookup function + than just the address. But this is not generally the case. */ +#undef DL_LOOKUP_RETURNS_MAP diff --git a/newlib/libc/sys/linux/dl/dl-minimal.c b/newlib/libc/sys/linux/dl/dl-minimal.c new file mode 100644 index 000000000..807bfad63 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-minimal.c @@ -0,0 +1,250 @@ +/* Minimal replacements for basic facilities used in the dynamic linker. + Copyright (C) 1995,96,97,98,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Minimal `malloc' allocator for use while loading shared libraries. + No block is ever freed. */ + +static void *alloc_ptr, *alloc_end, *alloc_last_block; + +/* Declarations of global functions. */ +extern void weak_function free (void *ptr); +extern void * weak_function realloc (void *ptr, size_t n); +extern unsigned long int weak_function __strtoul_internal +(const char *nptr, char **endptr, int base, int group); +extern unsigned long int weak_function strtoul (const char *nptr, + char **endptr, int base); + + +void * weak_function +malloc (size_t n) +{ +#ifdef MAP_ANON +#define _dl_zerofd (-1) +#else + extern int _dl_zerofd; + + if (_dl_zerofd == -1) + _dl_zerofd = _dl_sysdep_open_zero_fill (); +#define MAP_ANON 0 +#endif + + if (alloc_end == 0) + { + /* Consume any unused space in the last page of our data segment. */ + extern int _end; + alloc_ptr = &_end; + alloc_end = (void *) 0 + (((alloc_ptr - (void *) 0) + _dl_pagesize - 1) + & ~(_dl_pagesize - 1)); + } + + /* Make sure the allocation pointer is ideally aligned. */ + alloc_ptr = (void *) 0 + (((alloc_ptr - (void *) 0) + sizeof (double) - 1) + & ~(sizeof (double) - 1)); + + if (alloc_ptr + n >= alloc_end) + { + /* Insufficient space left; allocate another page. */ + caddr_t page; + size_t nup = (n + _dl_pagesize - 1) & ~(_dl_pagesize - 1); + page = __mmap (0, nup, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, _dl_zerofd, 0); + assert (page != MAP_FAILED); + if (page != alloc_end) + alloc_ptr = page; + alloc_end = page + nup; + } + + alloc_last_block = (void *) alloc_ptr; + alloc_ptr += n; + return alloc_last_block; +} + +/* We use this function occasionally since the real implementation may + be optimized when it can assume the memory it returns already is + set to NUL. */ +void * weak_function +calloc (size_t nmemb, size_t size) +{ + size_t total = nmemb * size; + void *result = malloc (total); + return memset (result, '\0', total); +} + +/* This will rarely be called. */ +void weak_function +free (void *ptr) +{ + /* We can free only the last block allocated. */ + if (ptr == alloc_last_block) + alloc_ptr = alloc_last_block; +} + +/* This is only called with the most recent block returned by malloc. */ +void * weak_function +realloc (void *ptr, size_t n) +{ + void *new; + if (ptr == NULL) + return malloc (n); + assert (ptr == alloc_last_block); + alloc_ptr = alloc_last_block; + new = malloc (n); + assert (new == ptr); + return new; +} + + +/* Define our own version of the internal function used by strerror. We + only provide the messages for some common errors. This avoids pulling + in the whole error list. */ + +char * weak_function +__strerror_r (int errnum, char *buf, size_t buflen) +{ + char *msg; + + switch (errnum) + { + case ENOMEM: + msg = (char *) "Cannot allocate memory"; + break; + case EINVAL: + msg = (char *) "Invalid argument"; + break; + case ENOENT: + msg = (char *) "No such file or directory"; + break; + case EPERM: + msg = (char *) "Operation not permitted"; + break; + case EIO: + msg = (char *) "Input/output error"; + break; + case EACCES: + msg = (char *) "Permission denied"; + break; + default: + /* No need to check buffer size, all calls in the dynamic linker + provide enough space. */ + msg = (char *) "Error"; + break; + } + + return msg; +} + +#ifndef NDEBUG + +/* Define (weakly) our own assert failure function which doesn't use stdio. + If we are linked into the user program (-ldl), the normal __assert_fail + defn can override this one. */ + +void weak_function +__assert_fail (const char *assertion, + const char *file, unsigned int line, const char *function) +{ + _dl_fatal_printf ("\ +Inconsistency detected by ld.so: %s: %u: %s%sAssertion `%s' failed!\n", + file, line, function ?: "", function ? ": " : "", + assertion); + +} + +void weak_function +__assert_perror_fail (int errnum, + const char *file, unsigned int line, + const char *function) +{ + char errbuf[64]; + _dl_fatal_printf ("\ +Inconsistency detected by ld.so: %s: %u: %s%sUnexpected error: %s\n", + file, line, function ?: "", function ? ": " : "", + __strerror_r (errnum, errbuf, sizeof (errbuf))); +} + +#endif + +unsigned long int weak_function +__strtoul_internal (const char *nptr, char **endptr, int base, int group) +{ + unsigned long int result = 0; + long int sign = 1; + + while (*nptr == ' ' || *nptr == '\t') + ++nptr; + + if (*nptr == '-') + { + sign = -1; + ++nptr; + } + else if (*nptr == '+') + ++nptr; + + if (*nptr < '0' || *nptr > '9') + { + if (endptr != NULL) + *endptr = (char *) nptr; + return 0UL; + } + + assert (base == 0); + base = 10; + if (*nptr == '0') + { + if (nptr[1] == 'x' || nptr[1] == 'X') + { + base = 16; + nptr += 2; + } + else + base = 8; + } + + while (*nptr >= '0' && *nptr <= '9') + { + unsigned long int digval = *nptr - '0'; + if (result > LONG_MAX / 10 + || (result == ULONG_MAX / 10 && digval > ULONG_MAX % 10)) + { + errno = ERANGE; + if (endptr != NULL) + *endptr = (char *) nptr; + return ULONG_MAX; + } + result *= base; + result += digval; + ++nptr; + } + + if (endptr != NULL) + *endptr = (char *) nptr; + return result * sign; +} diff --git a/newlib/libc/sys/linux/dl/dl-misc.c b/newlib/libc/sys/linux/dl/dl-misc.c new file mode 100644 index 000000000..1a4c297d5 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-misc.c @@ -0,0 +1,277 @@ +/* Miscellaneous support functions for dynamic linker + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef MAP_ANON +/* This is the only dl-sysdep.c function that is actually needed at run-time + by _dl_map_object. */ + +int +_dl_sysdep_open_zero_fill (void) +{ + return __open ("/dev/zero", O_RDONLY); +} +#endif + +/* Read the whole contents of FILE into new mmap'd space with given + protections. *SIZEP gets the size of the file. On error MAP_FAILED + is returned. */ + +void * +internal_function +_dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot) +{ + void *result = MAP_FAILED; + struct stat64 st; + int fd = __open (file, O_RDONLY); + if (fd >= 0) + { + if (fstat64 (fd, &st) >= 0) + { + *sizep = st.st_size; + + /* No need to map the file if it is empty. */ + if (*sizep != 0) + /* Map a copy of the file contents. */ + result = mmap (NULL, *sizep, prot, +#ifdef MAP_COPY + MAP_COPY +#else + MAP_PRIVATE +#endif +#ifdef MAP_FILE + | MAP_FILE +#endif + , fd, 0); + } + close (fd); + } + return result; +} + + +/* Descriptor to write debug messages to. */ +int _dl_debug_fd = 2; + + +/* Bare-bone printf implementation. This function only knows about + the formats and flags needed and can handle only up to 64 stripes in + the output. */ +static void +_dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg) +{ + const int niovmax = 64; + struct iovec iov[niovmax]; + int niov = 0; + pid_t pid = 0; + char pidbuf[7]; + + while (*fmt != '\0') + { + const char *startp = fmt; + + if (tag_p > 0) + { + /* Generate the tag line once. It consists of the PID and a + colon followed by a tab. */ + if (pid == 0) + { + char *p = "0"; + pid = __getpid (); + assert (pid >= 0 && pid < 100000); + while (p > pidbuf) + *--p = '0'; + pidbuf[5] = ':'; + pidbuf[6] = '\t'; + } + + /* Append to the output. */ + assert (niov < niovmax); + iov[niov].iov_len = 7; + iov[niov++].iov_base = pidbuf; + + /* No more tags until we see the next newline. */ + tag_p = -1; + } + + /* Skip everything except % and \n (if tags are needed). */ + while (*fmt != '\0' && *fmt != '%' && (! tag_p || *fmt != '\n')) + ++fmt; + + /* Append constant string. */ + assert (niov < niovmax); + if ((iov[niov].iov_len = fmt - startp) != 0) + iov[niov++].iov_base = (char *) startp; + + if (*fmt == '%') + { + /* It is a format specifier. */ + char fill = ' '; + int width = -1; +#if LONG_MAX != INT_MAX + int long_mod = 0; +#endif + + /* Recognize zero-digit fill flag. */ + if (*++fmt == '0') + { + fill = '0'; + ++fmt; + } + + /* See whether with comes from a parameter. Note that no other + way to specify the width is implemented. */ + if (*fmt == '*') + { + width = va_arg (arg, int); + ++fmt; + } + + /* Recognize the l modifier. It is only important on some + platforms where long and int have a different size. We + can use the same code for size_t. */ + if (*fmt == 'l' || *fmt == 'Z') + { +#if LONG_MAX != INT_MAX + long_mod = 1; +#endif + ++fmt; + } + + switch (*fmt) + { + /* Integer formatting. */ + case 'u': + case 'x': + { + /* We have to make a difference if long and int have a + different size. */ +#if LONG_MAX != INT_MAX + unsigned long int num = (long_mod + ? va_arg (arg, unsigned long int) + : va_arg (arg, unsigned int)); +#else + unsigned long int num = va_arg (arg, unsigned int); +#endif + /* We use alloca() to allocate the buffer with the most + pessimistic guess for the size. Using alloca() allows + having more than one integer formatting in a call. */ + char *buf = (char *) alloca (3 * sizeof (unsigned long int)); + char *endp = &buf[3 * sizeof (unsigned long int)]; + char *cp = "0"; + + /* Pad to the width the user specified. */ + if (width != -1) + while (endp - cp < width) + *--cp = fill; + + iov[niov].iov_base = cp; + iov[niov].iov_len = endp - cp; + ++niov; + } + break; + + case 's': + /* Get the string argument. */ + iov[niov].iov_base = va_arg (arg, char *); + iov[niov].iov_len = strlen (iov[niov].iov_base); + ++niov; + break; + + case '%': + iov[niov].iov_base = (void *) fmt; + iov[niov].iov_len = 1; + ++niov; + break; + + default: + assert (! "invalid format specifier"); + } + ++fmt; + } + else if (*fmt == '\n') + { + /* See whether we have to print a single newline character. */ + if (fmt == startp) + { + iov[niov].iov_base = (char *) startp; + iov[niov++].iov_len = 1; + } + else + /* No, just add it to the rest of the string. */ + ++iov[niov - 1].iov_len; + + /* Next line, print a tag again. */ + tag_p = 1; + ++fmt; + } + } + + /* Finally write the result. */ + writev (fd, iov, niov); +} + + +/* Write to debug file. */ +void +_dl_debug_printf (const char *fmt, ...) +{ + va_list arg; + + va_start (arg, fmt); + _dl_debug_vdprintf (_dl_debug_fd, 1, fmt, arg); + va_end (arg); +} + + +/* Write to debug file but don't start with a tag. */ +void +_dl_debug_printf_c (const char *fmt, ...) +{ + va_list arg; + + va_start (arg, fmt); + _dl_debug_vdprintf (_dl_debug_fd, -1, fmt, arg); + va_end (arg); +} + + +/* Write the given file descriptor. */ +void +_dl_dprintf (int fd, const char *fmt, ...) +{ + va_list arg; + + va_start (arg, fmt); + _dl_debug_vdprintf (fd, 0, fmt, arg); + va_end (arg); +} diff --git a/newlib/libc/sys/linux/dl/dl-object.c b/newlib/libc/sys/linux/dl/dl-object.c new file mode 100644 index 000000000..1e2049e25 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-object.c @@ -0,0 +1,163 @@ +/* Storage management for the chain of loaded shared objects. + Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + +#include + + +/* Allocate a `struct link_map' for a new object being loaded, + and enter it into the _dl_loaded list. */ + +struct link_map * +internal_function +_dl_new_object (char *realname, const char *libname, int type, + struct link_map *loader) +{ + struct link_map *l; + int idx; + size_t libname_len = strlen (libname) + 1; + struct link_map *new; + struct libname_list *newname; + + new = (struct link_map *) calloc (sizeof (*new) + sizeof (*newname) + + libname_len, 1); + if (new == NULL) + return NULL; + + new->l_libname = newname = (struct libname_list *) (new + 1); + newname->name = (char *) memcpy (newname + 1, libname, libname_len); + /* newname->next = NULL; We use calloc therefore not necessary. */ + newname->dont_free = 1; + + new->l_name = realname; + new->l_type = type; + new->l_loader = loader; + /* new->l_global = 0; We use calloc therefore not necessary. */ + + /* Use the 'l_scope_mem' array by default for the the 'l_scope' + information. If we need more entries we will allocate a large + array dynamically. */ + new->l_scope = new->l_scope_mem; + new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]); + + /* Counter for the scopes we have to handle. */ + idx = 0; + + if (_dl_loaded != NULL) + { + l = _dl_loaded; + while (l->l_next != NULL) + l = l->l_next; + new->l_prev = l; + /* new->l_next = NULL; Would be necessary but we use calloc. */ + l->l_next = new; + + /* Add the global scope. */ + new->l_scope[idx++] = &_dl_loaded->l_searchlist; + } + else + _dl_loaded = new; + ++_dl_nloaded; + + /* If we have no loader the new object acts as it. */ + if (loader == NULL) + loader = new; + else + /* Determine the local scope. */ + while (loader->l_loader != NULL) + loader = loader->l_loader; + + /* Insert the scope if it isn't the global scope we already added. */ + if (idx == 0 || &loader->l_searchlist != new->l_scope[0]) + new->l_scope[idx] = &loader->l_searchlist; + + new->l_local_scope[0] = &new->l_searchlist; + + /* Don't try to find the origin for the main map which has the name "". */ + if (realname[0] != '\0') + { + size_t realname_len = strlen (realname) + 1; + char *origin; + char *cp; + + if (realname[0] == '/') + { + /* It is an absolute path. Use it. But we have to make a + copy since we strip out the trailing slash. */ + cp = origin = (char *) malloc (realname_len); + if (origin == NULL) + { + origin = (char *) -1; + goto out; + } + } + else + { + size_t len = realname_len; + char *result = NULL; + + /* Get the current directory name. */ + origin = NULL; + do + { + len += 128; + origin = (char *) realloc (origin, len); + } + while (origin != NULL + && (result = getcwd (origin, len - realname_len)) == NULL + && errno == ERANGE); + + if (result == NULL) + { + /* We were not able to determine the current directory. + Note that free(origin) is OK if origin == NULL. */ + free (origin); + origin = (char *) -1; + goto out; + } + + /* Find the end of the path and see whether we have to add + a slash. */ + cp = memchr (origin, '\0', strlen(origin)); + if (cp[-1] != '/') + *cp++ = '/'; + } + + /* Add the real file name. */ + memcpy (cp, realname, realname_len); + + /* Now remove the filename and the slash. Leave the slash if it + the name is something like "/foo". */ + cp = strrchr (origin, '/'); + if (cp == origin) + origin[1] = '\0'; + else + *cp = '\0'; + + out: + new->l_origin = origin; + } + + return new; +} diff --git a/newlib/libc/sys/linux/dl/dl-open.c b/newlib/libc/sys/linux/dl/dl-open.c new file mode 100644 index 000000000..195361427 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-open.c @@ -0,0 +1,487 @@ +/* Load a shared object at runtime, relocate it, and run its initializer. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include /* Check whether MAP_COPY is defined. */ +#include +#include +#include + +#include +#include + + +extern ElfW(Addr) _dl_sysdep_start (void **start_argptr, + void (*dl_main) (const ElfW(Phdr) *phdr, + ElfW(Word) phnum, + ElfW(Addr) *user_entry)); +weak_extern (BP_SYM (_dl_sysdep_start)) + +/* This function is used to unload the cache file if necessary. */ +extern void _dl_unload_cache (void); + +int __libc_argc = 0; +char **__libc_argv = NULL; + +extern char **environ; + +extern int _dl_lazy; /* Do we do lazy relocations? */ + +/* Undefine the following for debugging. */ +/* #define SCOPE_DEBUG 1 */ +#ifdef SCOPE_DEBUG +static void show_scope (struct link_map *new); +#endif + +extern size_t _dl_platformlen; + +/* We must be carefull not to leave us in an inconsistent state. Thus we + catch any error and re-raise it after cleaning up. */ + +struct dl_open_args +{ + const char *file; + int mode; + const void *caller; + struct link_map *map; +}; + + +static int +add_to_global (struct link_map *new) +{ + struct link_map **new_global; + unsigned int to_add = 0; + unsigned int cnt; + + /* Count the objects we have to put in the global scope. */ + for (cnt = 0; cnt < new->l_searchlist.r_nlist; ++cnt) + if (new->l_searchlist.r_list[cnt]->l_global == 0) + ++to_add; + + /* The symbols of the new objects and its dependencies are to be + introduced into the global scope that will be used to resolve + references from other dynamically-loaded objects. + + The global scope is the searchlist in the main link map. We + extend this list if necessary. There is one problem though: + since this structure was allocated very early (before the libc + is loaded) the memory it uses is allocated by the malloc()-stub + in the ld.so. When we come here these functions are not used + anymore. Instead the malloc() implementation of the libc is + used. But this means the block from the main map cannot be used + in an realloc() call. Therefore we allocate a completely new + array the first time we have to add something to the locale scope. */ + + if (_dl_global_scope_alloc == 0) + { + /* This is the first dynamic object given global scope. */ + _dl_global_scope_alloc = _dl_main_searchlist->r_nlist + to_add + 8; + new_global = (struct link_map **) + malloc (_dl_global_scope_alloc * sizeof (struct link_map *)); + if (new_global == NULL) + { + _dl_global_scope_alloc = 0; + nomem: + _dl_signal_error (ENOMEM, new->l_libname->name, NULL, + N_("cannot extend global scope")); + return 1; + } + + /* Copy over the old entries. */ + memcpy (new_global, _dl_main_searchlist->r_list, + (_dl_main_searchlist->r_nlist * sizeof (struct link_map *))); + + _dl_main_searchlist->r_list = new_global; + } + else if (_dl_main_searchlist->r_nlist + to_add > _dl_global_scope_alloc) + { + /* We have to extend the existing array of link maps in the + main map. */ + new_global = (struct link_map **) + realloc (_dl_main_searchlist->r_list, + ((_dl_global_scope_alloc + to_add + 8) + * sizeof (struct link_map *))); + if (new_global == NULL) + goto nomem; + + _dl_global_scope_alloc += to_add + 8; + _dl_main_searchlist->r_list = new_global; + } + + /* Now add the new entries. */ + for (cnt = 0; cnt < new->l_searchlist.r_nlist; ++cnt) + { + struct link_map *map = new->l_searchlist.r_list[cnt]; + + if (map->l_global == 0) + { + map->l_global = 1; + _dl_main_searchlist->r_list[_dl_main_searchlist->r_nlist] = map; + ++_dl_main_searchlist->r_nlist; + } + } + + return 0; +} + + +static void +dl_open_worker (void *a) +{ + struct dl_open_args *args = a; + const char *file = args->file; + int mode = args->mode; + struct link_map *new, *l; + const char *dst; + int lazy; + unsigned int i; + + /* Maybe we have to expand a DST. */ + dst = strchr (file, '$'); + if (dst != NULL) + { + const void *caller = args->caller; + size_t len = strlen (file); + size_t required; + struct link_map *call_map; + char *new_file; + + /* We have to find out from which object the caller is calling. */ + call_map = NULL; + for (l = _dl_loaded; l; l = l->l_next) + if (caller >= (const void *) l->l_map_start + && caller < (const void *) l->l_map_end) + { + /* There must be exactly one DSO for the range of the virtual + memory. Otherwise something is really broken. */ + call_map = l; + break; + } + + if (call_map == NULL) + /* In this case we assume this is the main application. */ + call_map = _dl_loaded; + + /* Determine how much space we need. We have to allocate the + memory locally. */ + required = DL_DST_REQUIRED (call_map, file, len, _dl_dst_count (dst, 0)); + + /* Get space for the new file name. */ + new_file = (char *) alloca (required + 1); + + /* Generate the new file name. */ + DL_DST_SUBSTITUTE (call_map, file, new_file, 0); + + /* If the substitution failed don't try to load. */ + if (*new_file == '\0') + _dl_signal_error (0, "dlopen", NULL, + N_("empty dynamic string token substitution")); + + /* Now we have a new file name. */ + file = new_file; + } + + /* Load the named object. */ + args->map = new = _dl_map_object (NULL, file, 0, lt_loaded, 0, + mode); + + /* If the pointer returned is NULL this means the RTLD_NOLOAD flag is + set and the object is not already loaded. */ + if (new == NULL) + { + assert (mode & RTLD_NOLOAD); + return; + } + + /* It was already open. */ + if (new->l_searchlist.r_list != NULL) + { + /* Let the user know about the opencount. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0)) + _dl_debug_printf ("opening file=%s; opencount == %u\n\n", + new->l_name, new->l_opencount); + + /* If the user requested the object to be in the global namespace + but it is not so far, add it now. */ + if ((mode & RTLD_GLOBAL) && new->l_global == 0) + (void) add_to_global (new); + + /* Increment just the reference counter of the object. */ + ++new->l_opencount; + + return; + } + + /* Load that object's dependencies. */ + _dl_map_object_deps (new, NULL, 0, 0); + + /* So far, so good. Now check the versions. */ + for (i = 0; i < new->l_searchlist.r_nlist; ++i) + if (new->l_searchlist.r_list[i]->l_versions == NULL) + (void) _dl_check_map_versions (new->l_searchlist.r_list[i], 0, 0); + +#ifdef SCOPE_DEBUG + show_scope (new); +#endif + + /* Only do lazy relocation if `LD_BIND_NOW' is not set. */ + lazy = (mode & RTLD_BINDING_MASK) == RTLD_LAZY && _dl_lazy; + + /* Relocate the objects loaded. We do this in reverse order so that copy + relocs of earlier objects overwrite the data written by later objects. */ + + l = new; + while (l->l_next) + l = l->l_next; + while (1) + { + if (! l->l_relocated) + { +#if 0 +#ifdef SHARED + if (_dl_profile != NULL) + { + /* If this here is the shared object which we want to profile + make sure the profile is started. We can find out whether + this is necessary or not by observing the `_dl_profile_map' + variable. If was NULL but is not NULL afterwars we must + start the profiling. */ + struct link_map *old_profile_map = _dl_profile_map; + + _dl_relocate_object (l, l->l_scope, 1, 1); + + if (old_profile_map == NULL && _dl_profile_map != NULL) + /* We must prepare the profiling. */ + _dl_start_profile (_dl_profile_map, _dl_profile_output); + } + else +#endif +#endif + _dl_relocate_object (l, l->l_scope, lazy, 0); + } + + if (l == new) + break; + l = l->l_prev; + } + + /* Increment the open count for all dependencies. If the file is + not loaded as a dependency here add the search list of the newly + loaded object to the scope. */ + for (i = 0; i < new->l_searchlist.r_nlist; ++i) + if (++new->l_searchlist.r_list[i]->l_opencount > 1 + && new->l_searchlist.r_list[i]->l_type == lt_loaded) + { + struct link_map *imap = new->l_searchlist.r_list[i]; + struct r_scope_elem **runp = imap->l_scope; + size_t cnt = 0; + + while (*runp != NULL) + { + /* This can happen if imap was just loaded, but during + relocation had l_opencount bumped because of relocation + dependency. Avoid duplicates in l_scope. */ + if (__builtin_expect (*runp == &new->l_searchlist, 0)) + break; + + ++cnt; + ++runp; + } + + if (*runp != NULL) + /* Avoid duplicates. */ + continue; + + if (__builtin_expect (cnt + 1 >= imap->l_scope_max, 0)) + { + /* The 'r_scope' array is too small. Allocate a new one + dynamically. */ + struct r_scope_elem **newp; + size_t new_size = imap->l_scope_max * 2; + + if (imap->l_scope == imap->l_scope_mem) + { + newp = (struct r_scope_elem **) + malloc (new_size * sizeof (struct r_scope_elem *)); + if (newp == NULL) + _dl_signal_error (ENOMEM, "dlopen", NULL, + N_("cannot create scope list")); + imap->l_scope = memcpy (newp, imap->l_scope, + cnt * sizeof (imap->l_scope[0])); + } + else + { + newp = (struct r_scope_elem **) + realloc (imap->l_scope, + new_size * sizeof (struct r_scope_elem *)); + if (newp == NULL) + _dl_signal_error (ENOMEM, "dlopen", NULL, + N_("cannot create scope list")); + imap->l_scope = newp; + } + + imap->l_scope_max = new_size; + } + + imap->l_scope[cnt++] = &new->l_searchlist; + imap->l_scope[cnt] = NULL; + } + + /* Run the initializer functions of new objects. */ + _dl_init (new, __libc_argc, __libc_argv, environ); + + /* Now we can make the new map available in the global scope. */ + if (mode & RTLD_GLOBAL) + /* Move the object in the global namespace. */ + if (add_to_global (new) != 0) + /* It failed. */ + return; + + /* Mark the object as not deletable if the RTLD_NODELETE flags was + passed. */ + if (__builtin_expect (mode & RTLD_NODELETE, 0)) + new->l_flags_1 |= DF_1_NODELETE; + + /* Let the user know about the opencount. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0)) + _dl_debug_printf ("opening file=%s; opencount == %u\n\n", + new->l_name, new->l_opencount); +} + + +void * +internal_function +_dl_open (const char *file, int mode, const void *caller) +{ + struct dl_open_args args; + const char *objname; + const char *errstring; + int errcode; + + if ((mode & RTLD_BINDING_MASK) == 0) + /* One of the flags must be set. */ + _dl_signal_error (EINVAL, file, NULL, N_("invalid mode for dlopen()")); + + /* Make sure we are alone. */ +#ifdef HAVE_DD_LOCK + __lock_acquire_recursive(_dl_load_lock); +#endif + + args.file = file; + args.mode = mode; + args.caller = caller; + args.map = NULL; + errcode = _dl_catch_error (&objname, &errstring, dl_open_worker, &args); + +#ifndef MAP_COPY + /* We must munmap() the cache file. */ + _dl_unload_cache (); +#endif + + /* Release the lock. */ +#ifdef HAVE_DD_LOCK + __lock_release_recursive(_dl_load_lock); +#endif + + + if (errstring) + { + /* Some error occurred during loading. */ + char *local_errstring; + size_t len_errstring; + + /* Remove the object from memory. It may be in an inconsistent + state if relocation failed, for example. */ + if (args.map) + { + unsigned int i; + + /* Increment open counters for all objects since this has + not happened yet. */ + for (i = 0; i < args.map->l_searchlist.r_nlist; ++i) + ++args.map->l_searchlist.r_list[i]->l_opencount; + + _dl_close (args.map); + } + + /* Make a local copy of the error string so that we can release the + memory allocated for it. */ + len_errstring = strlen (errstring) + 1; + if (objname == errstring + len_errstring) + { + size_t total_len = len_errstring + strlen (objname) + 1; + local_errstring = alloca (total_len); + memcpy (local_errstring, errstring, total_len); + objname = local_errstring + len_errstring; + } + else + { + local_errstring = alloca (len_errstring); + memcpy (local_errstring, errstring, len_errstring); + } + + if (errstring != _dl_out_of_memory) + free ((char *) errstring); + + /* Reraise the error. */ + _dl_signal_error (errcode, objname, NULL, local_errstring); + } + +#ifndef SHARED + DL_STATIC_INIT (args.map); +#endif + + return args.map; +} + + +#ifdef SCOPE_DEBUG +#include + +static void +show_scope (struct link_map *new) +{ + int scope_cnt; + + for (scope_cnt = 0; new->l_scope[scope_cnt] != NULL; ++scope_cnt) + { + char numbuf[2]; + unsigned int cnt; + + numbuf[0] = '0' + scope_cnt; + numbuf[1] = '\0'; + _dl_printf ("scope %s:", numbuf); + + for (cnt = 0; cnt < new->l_scope[scope_cnt]->r_nlist; ++cnt) + if (*new->l_scope[scope_cnt]->r_list[cnt]->l_name) + _dl_printf (" %s", new->l_scope[scope_cnt]->r_list[cnt]->l_name); + else + _dl_printf ("
"); + + _dl_printf ("\n"); + } +} +#endif diff --git a/newlib/libc/sys/linux/dl/dl-osinfo.h b/newlib/libc/sys/linux/dl/dl-osinfo.h new file mode 100644 index 000000000..4976b3126 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-osinfo.h @@ -0,0 +1,108 @@ +/* Operating system specific code for generic dynamic loader functions. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include "kernel-features.h" + +#ifndef MIN +# define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + +#ifdef SHARED +/* This is the function used in the dynamic linker to print the fatal error + message. */ +static inline void +__attribute__ ((__noreturn__)) +dl_fatal (const char *str) +{ + _dl_dprintf (2, str); + _exit (1); +} +#endif + + +#define DL_SYSDEP_OSCHECK(FATAL) \ + do { \ + /* Test whether the kernel is new enough. This test is only \ + performed if the library is not compiled to run on all \ + kernels. */ \ + if (__LINUX_KERNEL_VERSION > 0) \ + { \ + char bufmem[64]; \ + char *buf = bufmem; \ + unsigned int version; \ + int parts; \ + char *cp; \ + struct utsname uts; \ + \ + /* Try the uname syscall */ \ + if (__uname (&uts)) \ + { \ + /* This was not successful. Now try reading the /proc \ + filesystem. */ \ + ssize_t reslen; \ + int fd = __open ("/proc/sys/kernel/osrelease", O_RDONLY); \ + if (fd == -1 \ + || (reslen = __read (fd, bufmem, sizeof (bufmem))) <= 0) \ + /* This also didn't work. We give up since we cannot \ + make sure the library can actually work. */ \ + FATAL ("FATAL: cannot determine library version\n"); \ + __close (fd); \ + buf[MIN (reslen, (ssize_t) sizeof (bufmem) - 1)] = '\0'; \ + } \ + else \ + buf = uts.release; \ + \ + /* Now convert it into a number. The string consists of at most \ + three parts. */ \ + version = 0; \ + parts = 0; \ + cp = buf; \ + while ((*cp >= '0') && (*cp <= '9')) \ + { \ + unsigned int here = *cp++ - '0'; \ + \ + while ((*cp >= '0') && (*cp <= '9')) \ + { \ + here *= 10; \ + here += *cp++ - '0'; \ + } \ + \ + ++parts; \ + version <<= 8; \ + version |= here; \ + \ + if (*cp++ != '.') \ + /* Another part following? */ \ + break; \ + } \ + \ + if (parts < 3) \ + version <<= 8 * (3 - parts); \ + \ + /* Now we can test with the required version. */ \ + if (version < __LINUX_KERNEL_VERSION) \ + /* Not sufficent. */ \ + FATAL ("FATAL: kernel too old\n"); \ + \ + _dl_osversion = version; \ + } \ + } while (0) diff --git a/newlib/libc/sys/linux/dl/dl-profile.c b/newlib/libc/sys/linux/dl/dl-profile.c new file mode 100644 index 000000000..52c533f5f --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-profile.c @@ -0,0 +1,539 @@ +/* Profiling of shared libraries. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + Based on the BSD mcount implementation. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* The LD_PROFILE feature has to be implemented different to the + normal profiling using the gmon/ functions. The problem is that an + arbitrary amount of processes simulataneously can be run using + profiling and all write the results in the same file. To provide + this mechanism one could implement a complicated mechanism to merge + the content of two profiling runs or one could extend the file + format to allow more than one data set. For the second solution we + would have the problem that the file can grow in size beyond any + limit and both solutions have the problem that the concurrency of + writing the results is a big problem. + + Another much simpler method is to use mmap to map the same file in + all using programs and modify the data in the mmap'ed area and so + also automatically on the disk. Using the MAP_SHARED option of + mmap(2) this can be done without big problems in more than one + file. + + This approach is very different from the normal profiling. We have + to use the profiling data in exactly the way they are expected to + be written to disk. But the normal format used by gprof is not usable + to do this. It is optimized for size. It writes the tags as single + bytes but this means that the following 32/64 bit values are + unaligned. + + Therefore we use a new format. This will look like this + + 0 1 2 3 <- byte is 32 bit word + 0000 g m o n + 0004 *version* <- GMON_SHOBJ_VERSION + 0008 00 00 00 00 + 000c 00 00 00 00 + 0010 00 00 00 00 + + 0014 *tag* <- GMON_TAG_TIME_HIST + 0018 ?? ?? ?? ?? + ?? ?? ?? ?? <- 32/64 bit LowPC + 0018+A ?? ?? ?? ?? + ?? ?? ?? ?? <- 32/64 bit HighPC + 0018+2*A *histsize* + 001c+2*A *profrate* + 0020+2*A s e c o + 0024+2*A n d s \0 + 0028+2*A \0 \0 \0 \0 + 002c+2*A \0 \0 \0 + 002f+2*A s + + 0030+2*A ?? ?? ?? ?? <- Count data + ... ... + 0030+2*A+K ?? ?? ?? ?? + + 0030+2*A+K *tag* <- GMON_TAG_CG_ARC + 0034+2*A+K *lastused* + 0038+2*A+K ?? ?? ?? ?? + ?? ?? ?? ?? <- FromPC#1 + 0038+3*A+K ?? ?? ?? ?? + ?? ?? ?? ?? <- ToPC#1 + 0038+4*A+K ?? ?? ?? ?? <- Count#1 + ... ... ... + 0038+(2*(CN-1)+2)*A+(CN-1)*4+K ?? ?? ?? ?? + ?? ?? ?? ?? <- FromPC#CGN + 0038+(2*(CN-1)+3)*A+(CN-1)*4+K ?? ?? ?? ?? + ?? ?? ?? ?? <- ToPC#CGN + 0038+(2*CN+2)*A+(CN-1)*4+K ?? ?? ?? ?? <- Count#CGN + + We put (for now?) no basic block information in the file since this would + introduce rase conditions among all the processes who want to write them. + + `K' is the number of count entries which is computed as + + textsize / HISTFRACTION + + `CG' in the above table is the number of call graph arcs. Normally, + the table is sparse and the profiling code writes out only the those + entries which are really used in the program run. But since we must + not extend this table (the profiling file) we'll keep them all here. + So CN can be executed in advance as + + MINARCS <= textsize*(ARCDENSITY/100) <= MAXARCS + + Now the remaining question is: how to build the data structures we can + work with from this data. We need the from set and must associate the + froms with all the associated tos. We will do this by constructing this + data structures at the program start. To do this we'll simply visit all + entries in the call graph table and add it to the appropriate list. */ + +extern int __profile_frequency (void); + +/* We define a special type to address the elements of the arc table. + This is basically the `gmon_cg_arc_record' format but it includes + the room for the tag and it uses real types. */ +struct here_cg_arc_record + { + uintptr_t from_pc; + uintptr_t self_pc; + uint32_t count; + } __attribute__ ((packed)); + +static struct here_cg_arc_record *data; + +/* Nonzero if profiling is under way. */ +static int running; + +/* This is the number of entry which have been incorporated in the toset. */ +static uint32_t narcs; +/* This is a pointer to the object representing the number of entries + currently in the mmaped file. At no point of time this has to be the + same as NARCS. If it is equal all entries from the file are in our + lists. */ +static volatile uint32_t *narcsp; + +static volatile uint16_t *kcount; +static size_t kcountsize; + +struct here_fromstruct + { + struct here_cg_arc_record volatile *here; + uint16_t link; + }; + +static volatile uint16_t *tos; + +static struct here_fromstruct *froms; +static uint32_t fromlimit; +static volatile uint32_t fromidx; + +static uintptr_t lowpc; +static size_t textsize; +static unsigned int hashfraction; +static unsigned int log_hashfraction; + + + +/* Set up profiling data to profile object desribed by MAP. The output + file is found (or created) in OUTPUT_DIR. */ +void +internal_function +_dl_start_profile (struct link_map *map, const char *output_dir) +{ + char *filename; + int fd; + struct stat64 st; + const ElfW(Phdr) *ph; + ElfW(Addr) mapstart = ~((ElfW(Addr)) 0); + ElfW(Addr) mapend = 0; + struct gmon_hdr gmon_hdr; + struct gmon_hist_hdr hist_hdr; + char *hist, *cp, *tmp; + size_t idx; + size_t tossize; + size_t fromssize; + uintptr_t highpc; + struct gmon_hdr *addr = NULL; + off_t expected_size; + /* See profil(2) where this is described. */ + int s_scale; +#define SCALE_1_TO_1 0x10000L + + /* Compute the size of the sections which contain program code. */ + for (ph = map->l_phdr; ph < &map->l_phdr[map->l_phnum]; ++ph) + if (ph->p_type == PT_LOAD && (ph->p_flags & PF_X)) + { + ElfW(Addr) start = (ph->p_vaddr & ~(_dl_pagesize - 1)); + ElfW(Addr) end = ((ph->p_vaddr + ph->p_memsz + _dl_pagesize - 1) + & ~(_dl_pagesize - 1)); + + if (start < mapstart) + mapstart = start; + if (end > mapend) + mapend = end; + } + + /* Now we can compute the size of the profiling data. This is done + with the same formulars as in `monstartup' (see gmon.c). */ + running = 0; + lowpc = ROUNDDOWN (mapstart + map->l_addr, + HISTFRACTION * sizeof (HISTCOUNTER)); + highpc = ROUNDUP (mapend + map->l_addr, + HISTFRACTION * sizeof (HISTCOUNTER)); + textsize = highpc - lowpc; + kcountsize = textsize / HISTFRACTION; + hashfraction = HASHFRACTION; + if ((HASHFRACTION & (HASHFRACTION - 1)) == 0) + /* If HASHFRACTION is a power of two, mcount can use shifting + instead of integer division. Precompute shift amount. */ + log_hashfraction = ffs (hashfraction * sizeof (*froms)) - 1; + else + log_hashfraction = -1; + tossize = textsize / HASHFRACTION; + fromlimit = textsize * ARCDENSITY / 100; + if (fromlimit < MINARCS) + fromlimit = MINARCS; + if (fromlimit > MAXARCS) + fromlimit = MAXARCS; + fromssize = fromlimit * sizeof (struct here_fromstruct); + + expected_size = (sizeof (struct gmon_hdr) + + 4 + sizeof (struct gmon_hist_hdr) + kcountsize + + 4 + 4 + fromssize * sizeof (struct here_cg_arc_record)); + + /* Create the gmon_hdr we expect or write. */ + memset (&gmon_hdr, '\0', sizeof (struct gmon_hdr)); + memcpy (&gmon_hdr.cookie[0], GMON_MAGIC, sizeof (gmon_hdr.cookie)); + *(int32_t *) gmon_hdr.version = GMON_SHOBJ_VERSION; + + /* Create the hist_hdr we expect or write. */ + *(char **) hist_hdr.low_pc = (char *) mapstart; + *(char **) hist_hdr.high_pc = (char *) mapend; + *(int32_t *) hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER); + *(int32_t *) hist_hdr.prof_rate = __profile_frequency (); + strncpy (hist_hdr.dimen, "seconds", sizeof (hist_hdr.dimen)); + hist_hdr.dimen_abbrev = 's'; + + /* First determine the output name. We write in the directory + OUTPUT_DIR and the name is composed from the shared objects + soname (or the file name) and the ending ".profile". */ + filename = (char *) alloca (strlen (output_dir) + 1 + strlen (_dl_profile) + + sizeof ".profile"); + cp = strcpy (filename, output_dir); + cp += strlen (output_dir); + *cp++ = '/'; + tmp = strcpy (cp, _dl_profile); + tmp += strlen (_dl_profile); + strcpy (tmp, ".profile"); + +#ifdef O_NOFOLLOW +# define EXTRA_FLAGS | O_NOFOLLOW +#else +# define EXTRA_FLAGS +#endif + fd = __open (filename, O_RDWR | O_CREAT EXTRA_FLAGS); + if (fd == -1) + { + /* We cannot write the profiling data so don't do anything. */ + char buf[400]; + _dl_error_printf ("%s: cannot open file: %s\n", filename, + __strerror_r (errno, buf, sizeof buf)); + return; + } + + if (fstat64 (fd, &st) < 0 || !S_ISREG (st.st_mode)) + { + /* Not stat'able or not a regular file => don't use it. */ + char buf[400]; + int errnum = errno; + __close (fd); + _dl_error_printf ("%s: cannot stat file: %s\n", filename, + __strerror_r (errnum, buf, sizeof buf)); + return; + } + + /* Test the size. If it does not match what we expect from the size + values in the map MAP we don't use it and warn the user. */ + if (st.st_size == 0) + { + /* We have to create the file. */ + char buf[_dl_pagesize]; + + memset (buf, '\0', _dl_pagesize); + + if (__lseek (fd, expected_size & ~(_dl_pagesize - 1), SEEK_SET) == -1) + { + char buf[400]; + int errnum; + cannot_create: + errnum = errno; + __close (fd); + _dl_error_printf ("%s: cannot create file: %s\n", filename, + __strerror_r (errnum, buf, sizeof buf)); + return; + } + + if (TEMP_FAILURE_RETRY (__libc_write (fd, buf, (expected_size + & (_dl_pagesize - 1)))) + < 0) + goto cannot_create; + } + else if (st.st_size != expected_size) + { + __close (fd); + wrong_format: + + if (addr != NULL) + __munmap ((void *) addr, expected_size); + + _dl_error_printf ("%s: file is no correct profile data file for `%s'\n", + filename, _dl_profile); + return; + } + + addr = (struct gmon_hdr *) __mmap (NULL, expected_size, PROT_READ|PROT_WRITE, + MAP_SHARED|MAP_FILE, fd, 0); + if (addr == (struct gmon_hdr *) MAP_FAILED) + { + char buf[400]; + int errnum = errno; + __close (fd); + _dl_error_printf ("%s: cannot map file: %s\n", filename, + __strerror_r (errnum, buf, sizeof buf)); + return; + } + + /* We don't need the file desriptor anymore. */ + __close (fd); + + /* Pointer to data after the header. */ + hist = (char *) (addr + 1); + kcount = (uint16_t *) ((char *) hist + sizeof (uint32_t) + + sizeof (struct gmon_hist_hdr)); + + /* Compute pointer to array of the arc information. */ + narcsp = (uint32_t *) ((char *) kcount + kcountsize + sizeof (uint32_t)); + data = (struct here_cg_arc_record *) ((char *) narcsp + sizeof (uint32_t)); + + if (st.st_size == 0) + { + /* Create the signature. */ + memcpy (addr, &gmon_hdr, sizeof (struct gmon_hdr)); + + *(uint32_t *) hist = GMON_TAG_TIME_HIST; + memcpy (hist + sizeof (uint32_t), &hist_hdr, + sizeof (struct gmon_hist_hdr)); + + narcsp[-1] = GMON_TAG_CG_ARC; + } + else + { + /* Test the signature in the file. */ + if (memcmp (addr, &gmon_hdr, sizeof (struct gmon_hdr)) != 0 + || *(uint32_t *) hist != GMON_TAG_TIME_HIST + || memcmp (hist + sizeof (uint32_t), &hist_hdr, + sizeof (struct gmon_hist_hdr)) != 0 + || narcsp[-1] != GMON_TAG_CG_ARC) + goto wrong_format; + } + + /* Allocate memory for the froms data and the pointer to the tos records. */ + tos = (uint16_t *) calloc (tossize + fromssize, 1); + if (tos == NULL) + { + __munmap ((void *) addr, expected_size); + _dl_fatal_printf ("Out of memory while initializing profiler\n"); + /* NOTREACHED */ + } + + froms = (struct here_fromstruct *) ((char *) tos + tossize); + fromidx = 0; + + /* Now we have to process all the arc count entries. BTW: it is + not critical whether the *NARCSP value changes meanwhile. Before + we enter a new entry in to toset we will check that everything is + available in TOS. This happens in _dl_mcount. + + Loading the entries in reverse order should help to get the most + frequently used entries at the front of the list. */ + for (idx = narcs = MIN (*narcsp, fromlimit); idx > 0; ) + { + size_t to_index; + size_t newfromidx; + --idx; + to_index = (data[idx].self_pc / (hashfraction * sizeof (*tos))); + newfromidx = fromidx++; + froms[newfromidx].here = &data[idx]; + froms[newfromidx].link = tos[to_index]; + tos[to_index] = newfromidx; + } + + /* Setup counting data. */ + if (kcountsize < highpc - lowpc) + { +#if 0 + s_scale = ((double) kcountsize / (highpc - lowpc)) * SCALE_1_TO_1; +#else + size_t range = highpc - lowpc; + size_t quot = range / kcountsize; + + if (quot >= SCALE_1_TO_1) + s_scale = 1; + else if (quot >= SCALE_1_TO_1 / 256) + s_scale = SCALE_1_TO_1 / quot; + else if (range > ULONG_MAX / 256) + s_scale = (SCALE_1_TO_1 * 256) / (range / (kcountsize / 256)); + else + s_scale = (SCALE_1_TO_1 * 256) / ((range * 256) / kcountsize); +#endif + } + else + s_scale = SCALE_1_TO_1; + + /* Start the profiler. */ + profil ((void *) kcount, kcountsize, lowpc, s_scale); + + /* Turn on profiling. */ + running = 1; +} + + +void +_dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc) +{ + volatile uint16_t *topcindex; + size_t i, fromindex; + struct here_fromstruct *fromp; + + if (! running) + return; + + /* Compute relative addresses. The shared object can be loaded at + any address. The value of frompc could be anything. We cannot + restrict it in any way, just set to a fixed value (0) in case it + is outside the allowed range. These calls show up as calls from + in the gprof output. */ + frompc -= lowpc; + if (frompc >= textsize) + frompc = 0; + selfpc -= lowpc; + if (selfpc >= textsize) + goto done; + + /* Getting here we now have to find out whether the location was + already used. If yes we are lucky and only have to increment a + counter (this also has to be atomic). If the entry is new things + are getting complicated... */ + + /* Avoid integer divide if possible. */ + if ((HASHFRACTION & (HASHFRACTION - 1)) == 0) + i = selfpc >> log_hashfraction; + else + i = selfpc / (hashfraction * sizeof (*tos)); + + topcindex = &tos[i]; + fromindex = *topcindex; + + if (fromindex == 0) + goto check_new_or_add; + + fromp = &froms[fromindex]; + + /* We have to look through the chain of arcs whether there is already + an entry for our arc. */ + while (fromp->here->from_pc != frompc) + { + if (fromp->link != 0) + do + fromp = &froms[fromp->link]; + while (fromp->link != 0 && fromp->here->from_pc != frompc); + + if (fromp->here->from_pc != frompc) + { + topcindex = &fromp->link; + + check_new_or_add: + /* Our entry is not among the entries we read so far from the + data file. Now see whether we have to update the list. */ + while (narcs != *narcsp && narcs < fromlimit) + { + size_t to_index; + size_t newfromidx; + to_index = (data[narcs].self_pc + / (hashfraction * sizeof (*tos))); + newfromidx = exchange_and_add (&fromidx, 1) + 1; + froms[newfromidx].here = &data[narcs]; + froms[newfromidx].link = tos[to_index]; + tos[to_index] = newfromidx; + atomic_add (&narcs, 1); + } + + /* If we still have no entry stop searching and insert. */ + if (*topcindex == 0) + { + uint32_t newarc = exchange_and_add (narcsp, 1); + + /* In rare cases it could happen that all entries in FROMS are + occupied. So we cannot count this anymore. */ + if (newarc >= fromlimit) + goto done; + + *topcindex = exchange_and_add (&fromidx, 1) + 1; + fromp = &froms[*topcindex]; + + fromp->here = &data[newarc]; + data[newarc].from_pc = frompc; + data[newarc].self_pc = selfpc; + data[newarc].count = 0; + fromp->link = 0; + atomic_add (&narcs, 1); + + break; + } + + fromp = &froms[*topcindex]; + } + else + /* Found in. */ + break; + } + + /* Increment the counter. */ + atomic_add (&fromp->here->count, 1); + + done: + ; +} diff --git a/newlib/libc/sys/linux/dl/dl-profstub.c b/newlib/libc/sys/linux/dl/dl-profstub.c new file mode 100644 index 000000000..41758864b --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-profstub.c @@ -0,0 +1,43 @@ +/* Helper definitions for profiling of shared libraries. + Copyright (C) 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + +/* This is the map for the shared object we profile. It is defined here + only because we test for this value being NULL or not. */ +extern struct link_map *_dl_profile_map; + + +void +_dl_mcount_wrapper (void *selfpc) +{ + _dl_mcount ((ElfW(Addr)) RETURN_ADDRESS (0), (ElfW(Addr)) selfpc); +} + + +void +_dl_mcount_wrapper_check (void *selfpc) +{ + if (_dl_profile_map != NULL) + _dl_mcount ((ElfW(Addr)) RETURN_ADDRESS (0), (ElfW(Addr)) selfpc); +} diff --git a/newlib/libc/sys/linux/dl/dl-reloc.c b/newlib/libc/sys/linux/dl/dl-reloc.c new file mode 100644 index 000000000..94163143e --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-reloc.c @@ -0,0 +1,213 @@ +/* Relocate a shared object and resolve its references to other loaded objects. + Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "dynamic-link.h" + +/* Statistics function. */ +unsigned long int _dl_num_cache_relocations; + + +void +_dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], + int lazy, int consider_profiling) +{ + struct textrels + { + caddr_t start; + size_t len; + int prot; + struct textrels *next; + } *textrels = NULL; + /* Initialize it to make the compiler happy. */ + const char *errstring = NULL; + + if (l->l_relocated) + return; + + /* If DT_BIND_NOW is set relocate all references in this object. We + do not do this if we are profiling, of course. */ + if (!consider_profiling + && __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0)) + lazy = 0; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_RELOC, 0)) + _dl_printf ("\nrelocation processing: %s%s\n", + l->l_name[0] ? l->l_name : _dl_argv[0], lazy ? " (lazy)" : ""); + + /* DT_TEXTREL is now in level 2 and might phase out at some time. + But we rewrite the DT_FLAGS entry to a DT_TEXTREL entry to make + testing easier and therefore it will be available at all time. */ + if (__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0)) + { + /* Bletch. We must make read-only segments writable + long enough to relocate them. */ + const ElfW(Phdr) *ph; + for (ph = l->l_phdr; ph < &l->l_phdr[l->l_phnum]; ++ph) + if (ph->p_type == PT_LOAD && (ph->p_flags & PF_W) == 0) + { + struct textrels *newp; + + newp = (struct textrels *) alloca (sizeof (*newp)); + newp->len = (((ph->p_vaddr + ph->p_memsz + _dl_pagesize - 1) + & ~(_dl_pagesize - 1)) + - (ph->p_vaddr & ~(_dl_pagesize - 1))); + newp->start = ((ph->p_vaddr & ~(_dl_pagesize - 1)) + + (caddr_t) l->l_addr); + + if (mprotect (newp->start, newp->len, PROT_READ|PROT_WRITE) < 0) + { + errstring = N_("cannot make segment writable for relocation"); + call_error: + _dl_signal_error (errno, l->l_name, NULL, errstring); + } + +#if (PF_R | PF_W | PF_X) == 7 && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7 + newp->prot = (PF_TO_PROT + >> ((ph->p_flags & (PF_R | PF_W | PF_X)) * 4)) & 0xf; +#else + newp->prot = 0; + if (ph->p_flags & PF_R) + newp->prot |= PROT_READ; + if (ph->p_flags & PF_W) + newp->prot |= PROT_WRITE; + if (ph->p_flags & PF_X) + newp->prot |= PROT_EXEC; +#endif + newp->next = textrels; + textrels = newp; + } + } + + { + /* Do the actual relocation of the object's GOT and other data. */ + + /* String table object symbols. */ + const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); + + /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */ +#define RESOLVE_MAP(ref, version, r_type) \ + (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL \ + ? ((__builtin_expect ((*ref) == l->l_lookup_cache.sym, 0) \ + && elf_machine_type_class (r_type) == l->l_lookup_cache.type_class) \ + ? (++_dl_num_cache_relocations, \ + (*ref) = l->l_lookup_cache.ret, \ + l->l_lookup_cache.value) \ + : ({ lookup_t _lr; \ + int _tc = elf_machine_type_class (r_type); \ + l->l_lookup_cache.type_class = _tc; \ + l->l_lookup_cache.sym = (*ref); \ + _lr = ((version) != NULL && (version)->hash != 0 \ + ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, \ + l, (ref), scope, \ + (version), _tc, 0) \ + : _dl_lookup_symbol (strtab + (*ref)->st_name, l, (ref), \ + scope, _tc, 0)); \ + l->l_lookup_cache.ret = (*ref); \ + l->l_lookup_cache.value = _lr; })) \ + : l) +#define RESOLVE(ref, version, r_type) \ + (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL \ + ? ((__builtin_expect ((*ref) == l->l_lookup_cache.sym, 0) \ + && elf_machine_type_class (r_type) == l->l_lookup_cache.type_class) \ + ? (++_dl_num_cache_relocations, \ + (*ref) = l->l_lookup_cache.ret, \ + l->l_lookup_cache.value) \ + : ({ lookup_t _lr; \ + int _tc = elf_machine_type_class (r_type); \ + l->l_lookup_cache.type_class = _tc; \ + l->l_lookup_cache.sym = (*ref); \ + _lr = ((version) != NULL && (version)->hash != 0 \ + ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, \ + l, (ref), scope, \ + (version), _tc, 0) \ + : _dl_lookup_symbol (strtab + (*ref)->st_name, l, (ref), \ + scope, _tc, 0)); \ + l->l_lookup_cache.ret = (*ref); \ + l->l_lookup_cache.value = _lr; })) \ + : l->l_addr) + +#include "dynamic-link.h" + + ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling); + + if (__builtin_expect (consider_profiling, 0)) + { + /* Allocate the array which will contain the already found + relocations. If the shared object lacks a PLT (for example + if it only contains lead function) the l_info[DT_PLTRELSZ] + will be NULL. */ + if (l->l_info[DT_PLTRELSZ] == NULL) + { + errstring = N_("%s: profiler found no PLTREL in object %s\n"); + fatal: + _dl_fatal_printf (errstring, + _dl_argv[0] ?: "", + l->l_name); + } + + l->l_reloc_result = + (ElfW(Addr) *) calloc (sizeof (ElfW(Addr)), + l->l_info[DT_PLTRELSZ]->d_un.d_val); + if (l->l_reloc_result == NULL) + { + errstring = N_("\ +%s: profiler out of memory shadowing PLTREL of %s\n"); + goto fatal; + } + } + } + + /* Mark the object so we know this work has been done. */ + l->l_relocated = 1; + + /* Undo the segment protection changes. */ + while (__builtin_expect (textrels != NULL, 0)) + { + if (mprotect (textrels->start, textrels->len, textrels->prot) < 0) + { + errstring = N_("cannot restore segment prot after reloc"); + goto call_error; + } + + textrels = textrels->next; + } +} + + +void +internal_function +_dl_reloc_bad_type (struct link_map *map, unsigned int type, int plt) +{ + /* XXX We cannot translate these messages. */ + static const char msg[2][32] = { "unexpected reloc type", + "unexpected PLT reloc type" }; + char msgbuf[sizeof (msg[0])]; + + strcpy (msgbuf, msg[plt]); + + _dl_signal_error (0, map->l_name, NULL, msgbuf); +} diff --git a/newlib/libc/sys/linux/dl/dl-runtime.c b/newlib/libc/sys/linux/dl/dl-runtime.c new file mode 100644 index 000000000..111acfb71 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-runtime.c @@ -0,0 +1,231 @@ +/* On-demand PLT fixup for shared objects. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include "dynamic-link.h" + +#define __attribute_used__ + +#if !defined ELF_MACHINE_NO_RELA || ELF_MACHINE_NO_REL +# define PLTREL ElfW(Rela) +#else +# define PLTREL ElfW(Rel) +#endif + +#ifndef VERSYMIDX +# define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym)) +#endif + + +/* This function is called through a special trampoline from the PLT the + first time each PLT entry is called. We must perform the relocation + specified in the PLT of the given shared object, and return the resolved + function address to the trampoline, which will restart the original call + to that address. Future calls will bounce directly from the PLT to the + function. */ + +#ifndef ELF_MACHINE_NO_PLT +static ElfW(Addr) __attribute_used__ +fixup ( +# ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS + ELF_MACHINE_RUNTIME_FIXUP_ARGS, +# endif + /* GKM FIXME: Fix trampoline to pass bounds so we can do + without the `__unbounded' qualifier. */ + struct link_map *__unbounded l, ElfW(Word) reloc_offset) +{ + const ElfW(Sym) *const symtab + = (const void *) D_PTR (l, l_info[DT_SYMTAB]); + const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); + + const PLTREL *const reloc + = (const void *) (D_PTR (l, l_info[DT_JMPREL]) + reloc_offset); + const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (reloc->r_info)]; + void *const rel_addr = (void *)(l->l_addr + reloc->r_offset); + lookup_t result; + ElfW(Addr) value; + + /* The use of `alloca' here looks ridiculous but it helps. The goal is + to prevent the function from being inlined and thus optimized out. + There is no official way to do this so we use this trick. gcc never + inlines functions which use `alloca'. */ + alloca (sizeof (int)); + + /* Sanity check that we're really looking at a PLT relocation. */ + assert (ELFW(R_TYPE)(reloc->r_info) == ELF_MACHINE_JMP_SLOT); + + /* Look up the target symbol. If the normal lookup rules are not + used don't look in the global scope. */ + if (__builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0) + { + switch (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL) + { + default: + { + const ElfW(Half) *vernum = + (const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]); + ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info)]; + const struct r_found_version *version = &l->l_versions[ndx]; + + if (version->hash != 0) + { + result = _dl_lookup_versioned_symbol (strtab + sym->st_name, + l, &sym, l->l_scope, + version, + ELF_RTYPE_CLASS_PLT, 0); + break; + } + } + case 0: + result = _dl_lookup_symbol (strtab + sym->st_name, l, &sym, + l->l_scope, ELF_RTYPE_CLASS_PLT, 0); + } + + /* Currently result contains the base load address (or link map) + of the object that defines sym. Now add in the symbol + offset. */ + value = (sym ? LOOKUP_VALUE_ADDRESS (result) + sym->st_value : 0); + } + else + { + /* We already found the symbol. The module (and therefore its load + address) is also known. */ + value = l->l_addr + sym->st_value; +#ifdef DL_LOOKUP_RETURNS_MAP + result = l; +#endif + } + + /* And now perhaps the relocation addend. */ + value = elf_machine_plt_value (l, reloc, value); + + /* Finally, fix up the plt itself. */ + if (__builtin_expect (_dl_bind_not, 0)) + return value; + + return elf_machine_fixup_plt (l, result, reloc, rel_addr, value); +} +#endif + +#if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__ + +static ElfW(Addr) __attribute_used__ +profile_fixup ( +#ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS + ELF_MACHINE_RUNTIME_FIXUP_ARGS, +#endif + struct link_map *l, ElfW(Word) reloc_offset, ElfW(Addr) retaddr) +{ + void (*mcount_fct) (ElfW(Addr), ElfW(Addr)) = _dl_mcount; + ElfW(Addr) *resultp; + lookup_t result; + ElfW(Addr) value; + + /* The use of `alloca' here looks ridiculous but it helps. The goal is + to prevent the function from being inlined, and thus optimized out. + There is no official way to do this so we use this trick. gcc never + inlines functions which use `alloca'. */ + alloca (sizeof (int)); + + /* This is the address in the array where we store the result of previous + relocations. */ + resultp = &l->l_reloc_result[reloc_offset / sizeof (PLTREL)]; + + value = *resultp; + if (value == 0) + { + /* This is the first time we have to relocate this object. */ + const ElfW(Sym) *const symtab + = (const void *) D_PTR (l, l_info[DT_SYMTAB]); + const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); + + const PLTREL *const reloc + = (const void *) (D_PTR (l, l_info[DT_JMPREL]) + reloc_offset); + const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (reloc->r_info)]; + + /* Sanity check that we're really looking at a PLT relocation. */ + assert (ELFW(R_TYPE)(reloc->r_info) == ELF_MACHINE_JMP_SLOT); + + /* Look up the target symbol. If the symbol is marked STV_PROTECTED + don't look in the global scope. */ + if (__builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0) + { + switch (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL) + { + default: + { + const ElfW(Half) *vernum = + (const void *) D_PTR (l,l_info[VERSYMIDX (DT_VERSYM)]); + ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info)]; + const struct r_found_version *version = &l->l_versions[ndx]; + + if (version->hash != 0) + { + result = _dl_lookup_versioned_symbol(strtab + sym->st_name, + l, &sym, l->l_scope, + version, + ELF_RTYPE_CLASS_PLT, + 0); + break; + } + } + case 0: + result = _dl_lookup_symbol (strtab + sym->st_name, l, &sym, + l->l_scope, ELF_RTYPE_CLASS_PLT, 0); + } + + /* Currently result contains the base load address (or link map) + of the object that defines sym. Now add in the symbol + offset. */ + value = (sym ? LOOKUP_VALUE_ADDRESS (result) + sym->st_value : 0); + } + else + { + /* We already found the symbol. The module (and therefore its load + address) is also known. */ + value = l->l_addr + sym->st_value; +#ifdef DL_LOOKUP_RETURNS_MAP + result = l; +#endif + } + /* And now perhaps the relocation addend. */ + value = elf_machine_plt_value (l, reloc, value); + + /* Store the result for later runs. */ + if (__builtin_expect (! _dl_bind_not, 1)) + *resultp = value; + } + + (*mcount_fct) (retaddr, value); + + return value; +} + +#endif /* PROF && ELF_MACHINE_NO_PLT */ + + +/* This macro is defined in dl-machine.h to define the entry point called + by the PLT. The `fixup' function above does the real work, but a little + more twiddling is needed to get the stack right and jump to the address + finally resolved. */ + +ELF_MACHINE_RUNTIME_TRAMPOLINE diff --git a/newlib/libc/sys/linux/dl/dl-support.c b/newlib/libc/sys/linux/dl/dl-support.c new file mode 100644 index 000000000..b7cb560a6 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-support.c @@ -0,0 +1,184 @@ +/* Support for dynamic linking code in static libc. + Copyright (C) 1996, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file defines some things that for the dynamic linker are defined in + rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char *__progname = "newlib"; +char **_dl_argv = &__progname; /* This is checked for some error messages. */ + +/* Name of the architecture. */ +const char *_dl_platform; +size_t _dl_platformlen; + +int _dl_debug_mask; +int _dl_lazy; +/* XXX I know about at least one case where we depend on the old weak + behavior (it has to do with librt). Until we get DSO groups implemented + we have to make this the default. Bummer. --drepper */ +#if 0 +int _dl_dynamic_weak; +#else +int _dl_dynamic_weak = 1; +#endif + +/* If nonzero print warnings about problematic situations. */ +int _dl_verbose; + +/* Structure to store information about search paths. */ +struct r_search_path *_dl_search_paths; + +/* We never do profiling. */ +const char *_dl_profile; + +/* Names of shared object for which the RUNPATHs and RPATHs should be + ignored. */ +const char *_dl_inhibit_rpath; + +/* The map for the object we will profile. */ +struct link_map *_dl_profile_map; + +/* This is the address of the last stack address ever used. */ +void *__libc_stack_end; + +/* Path where the binary is found. */ +const char *_dl_origin_path; + +/* Nonzero if runtime lookup should not update the .got/.plt. */ +int _dl_bind_not; + +/* Initially empty list of loaded objects. */ +struct link_map *_dl_loaded; +/* Number of object in the _dl_loaded list. */ +unsigned int _dl_nloaded; + +/* Fake scope. In dynamically linked binaries this is the scope of the + main application but here we don't have something like this. So + create a fake scope containing nothing. */ +struct r_scope_elem _dl_initial_searchlist; +/* Variable which can be used in lookup to process the global scope. */ +struct r_scope_elem *_dl_global_scope[2] = { &_dl_initial_searchlist, NULL }; +/* This is a global pointer to this structure which is public. It is + used by dlopen/dlclose to add and remove objects from what is regarded + to be the global scope. */ +struct r_scope_elem *_dl_main_searchlist = &_dl_initial_searchlist; + +/* Nonzero during startup. */ +int _dl_starting_up = 1; + +/* We expect less than a second for relocation. */ +#ifdef HP_SMALL_TIMING_AVAIL +# undef HP_TIMING_AVAIL +# define HP_TIMING_AVAIL HP_SMALL_TIMING_AVAIL +#endif + +/* Initial value of the CPU clock. */ +#ifndef HP_TIMING_NONAVAIL +hp_timing_t _dl_cpuclock_offset; +#endif + +/* During the program run we must not modify the global data of + loaded shared object simultanously in two threads. Therefore we + protect `_dl_open' and `_dl_close' in dl-close.c. + + This must be a recursive lock since the initializer function of + the loaded object might as well require a call to this function. + At this time it is not anymore a problem to modify the tables. */ +__LOCK_RECURSIVE_INIT (, _dl_load_lock) + + +#ifdef HAVE_AUX_VECTOR +extern int _dl_clktck; + +void +internal_function +_dl_aux_init (ElfW(auxv_t) *av) +{ + for (; av->a_type != AT_NULL; ++av) + switch (av->a_type) + { + case AT_PAGESZ: + _dl_pagesize = av->a_un.a_val; + break; + case AT_CLKTCK: + _dl_clktck = av->a_un.a_val; + break; + } +} +#endif + +void non_dynamic_init (void) __attribute__ ((unused)); + +void +non_dynamic_init (void) +{ + if (HP_TIMING_AVAIL) + HP_TIMING_NOW (_dl_cpuclock_offset); + + if (!_dl_pagesize) + _dl_pagesize = __getpagesize (); + + _dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1; + + /* Initialize the data structures for the search paths for shared + objects. */ + _dl_init_paths (getenv ("LD_LIBRARY_PATH")); + + _dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0'; + + _dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0'; + + _dl_dynamic_weak = *(getenv ("LD_DYNAMIC_WEAK") ?: "") == '\0'; + +#ifdef DL_PLATFORM_INIT + DL_PLATFORM_INIT; +#endif + + /* Now determine the length of the platform string. */ + if (_dl_platform != NULL) + _dl_platformlen = strlen (_dl_platform); +} +text_set_element (__libc_subinit, non_dynamic_init); + +const struct r_strlenpair * +internal_function +_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, + size_t *max_capstrlen) +{ + static struct r_strlenpair result; + static char buf[1]; + + result.str = buf; /* Does not really matter. */ + result.len = 0; + + *sz = 1; + return &result; +} diff --git a/newlib/libc/sys/linux/dl/dl-sym.c b/newlib/libc/sys/linux/dl/dl-sym.c new file mode 100644 index 000000000..85d084f7f --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-sym.c @@ -0,0 +1,158 @@ +/* Look up a symbol in a shared object loaded by `dlopen'. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +#include +#include +#include + +void * +internal_function +_dl_sym (void *handle, const char *name, void *who) +{ + const ElfW(Sym) *ref = NULL; + lookup_t result; + ElfW(Addr) caller = (ElfW(Addr)) who; + struct link_map *match; + struct link_map *l; + + /* If the address is not recognized the call comes from the main + program (we hope). */ + match = _dl_loaded; + + /* Find the highest-addressed object that CALLER is not below. */ + for (l = _dl_loaded; l != NULL; l = l->l_next) + if (caller >= l->l_map_start && caller < l->l_map_end) + { + /* There must be exactly one DSO for the range of the virtual + memory. Otherwise something is really broken. */ + match = l; + break; + } + + if (handle == RTLD_DEFAULT) + /* Search the global scope as seen in the caller object. */ + result = _dl_lookup_symbol (name, match, &ref, match->l_scope, 0, 0); + else + { + if (handle != RTLD_NEXT) + { + /* Search the scope of the given object. */ + struct link_map *map = handle; + + result = _dl_lookup_symbol (name, match, &ref, map->l_local_scope, + 0, 1); + } + else + { + if (__builtin_expect (match == _dl_loaded, 0)) + { + if (! _dl_loaded + || caller < _dl_loaded->l_map_start + || caller >= _dl_loaded->l_map_end) + _dl_signal_error (0, NULL, NULL, N_("\ +RTLD_NEXT used in code not dynamically loaded")); + } + + l = match; + while (l->l_loader != NULL) + l = l->l_loader; + + result = _dl_lookup_symbol_skip (name, l, &ref, l->l_local_scope, + match); + } + } + + if (ref != NULL) + return DL_SYMBOL_ADDRESS (result, ref); + + return NULL; +} + +void * +internal_function +_dl_vsym (void *handle, const char *name, const char *version, void *who) +{ + const ElfW(Sym) *ref = NULL; + struct r_found_version vers; + lookup_t result; + ElfW(Addr) caller = (ElfW(Addr)) who; + struct link_map *match; + struct link_map *l; + + /* Compute hash value to the version string. */ + vers.name = version; + vers.hidden = 1; + vers.hash = _dl_elf_hash (version); + /* We don't have a specific file where the symbol can be found. */ + vers.filename = NULL; + + /* If the address is not recognized the call comes from the main + program (we hope). */ + match = _dl_loaded; + + /* Find the highest-addressed object that CALLER is not below. */ + for (l = _dl_loaded; l != NULL; l = l->l_next) + if (caller >= l->l_map_start && caller < l->l_map_end) + { + /* There must be exactly one DSO for the range of the virtual + memory. Otherwise something is really broken. */ + match = l; + break; + } + + if (handle == RTLD_DEFAULT) + /* Search the global scope. */ + result = _dl_lookup_versioned_symbol (name, match, &ref, match->l_scope, + &vers, 0, 0); + else if (handle == RTLD_NEXT) + { + if (__builtin_expect (match == _dl_loaded, 0)) + { + if (! _dl_loaded + || caller < _dl_loaded->l_map_start + || caller >= _dl_loaded->l_map_end) + _dl_signal_error (0, NULL, NULL, N_("\ +RTLD_NEXT used in code not dynamically loaded")); + } + + l = match; + while (l->l_loader != NULL) + l = l->l_loader; + + result = _dl_lookup_versioned_symbol_skip (name, l, &ref, + l->l_local_scope, + &vers, match); + } + else + { + /* Search the scope of the given object. */ + struct link_map *map = handle; + result = _dl_lookup_versioned_symbol (name, map, &ref, + map->l_local_scope, &vers, 0, 1); + } + + if (ref != NULL) + return DL_SYMBOL_ADDRESS (result, ref); + + return NULL; +} diff --git a/newlib/libc/sys/linux/dl/dl-version.c b/newlib/libc/sys/linux/dl/dl-version.c new file mode 100644 index 000000000..eefbea7ec --- /dev/null +++ b/newlib/libc/sys/linux/dl/dl-version.c @@ -0,0 +1,385 @@ +/* Handle symbol and library versioning. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + +#include + + +#ifndef VERSYMIDX +# define VERSYMIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (tag)) +#endif + + +#define make_string(string, rest...) \ + ({ \ + const char *all[] = { string, ## rest }; \ + size_t len, cnt; \ + char *result, *cp; \ + \ + len = 1; \ + for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \ + len += strlen (all[cnt]); \ + \ + cp = result = alloca (len); \ + for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \ + { \ + cp = strcpy (cp, all[cnt]); \ + cp += strlen (all[cnt]); \ + } \ + \ + result; \ + }) + + +static inline struct link_map * +find_needed (const char *name, struct link_map *map) +{ + struct link_map *tmap; + unsigned int n; + + for (tmap = _dl_loaded; tmap != NULL; tmap = tmap->l_next) + if (_dl_name_match_p (name, tmap)) + return tmap; + + /* The required object is not in the global scope, look to see if it is + a dependency of the current object. */ + for (n = 0; n < map->l_searchlist.r_nlist; n++) + if (_dl_name_match_p (name, map->l_searchlist.r_list[n])) + return map->l_searchlist.r_list[n]; + + /* Should never happen. */ + return NULL; +} + + +static int +internal_function +match_symbol (const char *name, ElfW(Word) hash, const char *string, + struct link_map *map, int verbose, int weak) +{ + const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]); + ElfW(Addr) def_offset; + ElfW(Verdef) *def; + /* Initialize to make the compiler happy. */ + const char *errstring = NULL; + int result = 0; + + /* Display information about what we are doing while debugging. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_VERSIONS, 0)) + _dl_debug_printf ("\ +checking for version `%s' in file %s required by file %s\n", + string, map->l_name[0] ? map->l_name : _dl_argv[0], + name); + + if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0)) + { + /* The file has no symbol versioning. I.e., the dependent + object was linked against another version of this file. We + only print a message if verbose output is requested. */ + if (verbose) + { + /* XXX We cannot translate the messages. */ + errstring = make_string ("\ +no version information available (required by ", name, ")"); + goto call_cerror; + } + return 0; + } + + def_offset = map->l_info[VERSYMIDX (DT_VERDEF)]->d_un.d_ptr; + assert (def_offset != 0); + + def = (ElfW(Verdef) *) ((char *) map->l_addr + def_offset); + while (1) + { + /* Currently the version number of the definition entry is 1. + Make sure all we see is this version. */ + if (__builtin_expect (def->vd_version, 1) != 1) + { + char buf[20]; + buf[sizeof (buf) - 1] = '\0'; + /* XXX We cannot translate the message. */ + errstring = make_string ("unsupported version of Verdef record"); + result = 1; + goto call_cerror; + } + + /* Compare the hash values. */ + if (hash == def->vd_hash) + { + ElfW(Verdaux) *aux = (ElfW(Verdaux) *) ((char *) def + def->vd_aux); + + /* To be safe, compare the string as well. */ + if (__builtin_expect (strcmp (string, strtab + aux->vda_name), 0) + == 0) + /* Bingo! */ + return 0; + } + + /* If no more definitions we failed to find what we want. */ + if (def->vd_next == 0) + break; + + /* Next definition. */ + def = (ElfW(Verdef) *) ((char *) def + def->vd_next); + } + + /* Symbol not found. If it was a weak reference it is not fatal. */ + if (__builtin_expect (weak, 1)) + { + if (verbose) + { + /* XXX We cannot translate the message. */ + errstring = make_string ("weak version `", string, + "' not found (required by ", name, ")"); + goto call_cerror; + } + return 0; + } + + /* XXX We cannot translate the message. */ + errstring = make_string ("version `", string, "' not found (required by ", + name, ")"); + result = 1; + call_cerror: + _dl_signal_cerror (0, map->l_name[0] ? map->l_name : _dl_argv[0], NULL, + errstring); + return result; +} + + +int +internal_function +_dl_check_map_versions (struct link_map *map, int verbose, int trace_mode) +{ + int result = 0; + const char *strtab; + /* Pointer to section with needed versions. */ + ElfW(Dyn) *dyn; + /* Pointer to dynamic section with definitions. */ + ElfW(Dyn) *def; + /* We need to find out which is the highest version index used + in a dependecy. */ + unsigned int ndx_high = 0; + /* Initialize to make the compiler happy. */ + const char *errstring = NULL; + int errval = 0; + + /* If we don't have a string table, we must be ok. */ + if (map->l_info[DT_STRTAB] == NULL) + return 0; + strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]); + + dyn = map->l_info[VERSYMIDX (DT_VERNEED)]; + def = map->l_info[VERSYMIDX (DT_VERDEF)]; + + if (dyn != NULL) + { + /* This file requires special versions from its dependencies. */ + ElfW(Verneed) *ent = (ElfW(Verneed) *) (map->l_addr + dyn->d_un.d_ptr); + + /* Currently the version number of the needed entry is 1. + Make sure all we see is this version. */ + if (__builtin_expect (ent->vn_version, 1) != 1) + { + char buf[20]; + buf[sizeof (buf) - 1] = '\0'; + /* XXX We cannot translate the message. */ + errstring = make_string ("unsupported version of Verneed record\n"); + call_error: + _dl_signal_error (errval, (*map->l_name ? map->l_name : _dl_argv[0]), + NULL, errstring); + } + + while (1) + { + ElfW(Vernaux) *aux; + struct link_map *needed = find_needed (strtab + ent->vn_file, map); + + /* If NEEDED is NULL this means a dependency was not found + and no stub entry was created. This should never happen. */ + assert (needed != NULL); + + /* Make sure this is no stub we created because of a missing + dependency. */ + if (__builtin_expect (! trace_mode, 1) + || ! __builtin_expect (needed->l_faked, 0)) + { + /* NEEDED is the map for the file we need. Now look for the + dependency symbols. */ + aux = (ElfW(Vernaux) *) ((char *) ent + ent->vn_aux); + while (1) + { + /* Match the symbol. */ + result |= match_symbol ((*map->l_name + ? map->l_name : _dl_argv[0]), + aux->vna_hash, + strtab + aux->vna_name, + needed, verbose, + aux->vna_flags & VER_FLG_WEAK); + + /* Compare the version index. */ + if ((unsigned int) (aux->vna_other & 0x7fff) > ndx_high) + ndx_high = aux->vna_other & 0x7fff; + + if (aux->vna_next == 0) + /* No more symbols. */ + break; + + /* Next symbol. */ + aux = (ElfW(Vernaux) *) ((char *) aux + aux->vna_next); + } + } + + if (ent->vn_next == 0) + /* No more dependencies. */ + break; + + /* Next dependency. */ + ent = (ElfW(Verneed) *) ((char *) ent + ent->vn_next); + } + } + + /* We also must store the names of the defined versions. Determine + the maximum index here as well. + + XXX We could avoid the loop by just taking the number of definitions + as an upper bound of new indeces. */ + if (def != NULL) + { + ElfW(Verdef) *ent; + ent = (ElfW(Verdef) *) (map->l_addr + def->d_un.d_ptr); + while (1) + { + if ((unsigned int) (ent->vd_ndx & 0x7fff) > ndx_high) + ndx_high = ent->vd_ndx & 0x7fff; + + if (ent->vd_next == 0) + /* No more definitions. */ + break; + + ent = (ElfW(Verdef) *) ((char *) ent + ent->vd_next); + } + } + + if (ndx_high > 0) + { + /* Now we are ready to build the array with the version names + which can be indexed by the version index in the VERSYM + section. */ + map->l_versions = (struct r_found_version *) + calloc (ndx_high + 1, sizeof (*map->l_versions)); + if (__builtin_expect (map->l_versions == NULL, 0)) + { + errstring = N_("cannot allocate version reference table"); + errval = ENOMEM; + goto call_error; + } + + /* Store the number of available symbols. */ + map->l_nversions = ndx_high + 1; + + /* Compute the pointer to the version symbols. */ + map->l_versyms = (void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]); + + if (dyn != NULL) + { + ElfW(Verneed) *ent; + ent = (ElfW(Verneed) *) (map->l_addr + dyn->d_un.d_ptr); + while (1) + { + ElfW(Vernaux) *aux; + aux = (ElfW(Vernaux) *) ((char *) ent + ent->vn_aux); + while (1) + { + ElfW(Half) ndx = aux->vna_other & 0x7fff; + map->l_versions[ndx].hash = aux->vna_hash; + map->l_versions[ndx].hidden = aux->vna_other & 0x8000; + map->l_versions[ndx].name = &strtab[aux->vna_name]; + map->l_versions[ndx].filename = &strtab[ent->vn_file]; + + if (aux->vna_next == 0) + /* No more symbols. */ + break; + + /* Advance to next symbol. */ + aux = (ElfW(Vernaux) *) ((char *) aux + aux->vna_next); + } + + if (ent->vn_next == 0) + /* No more dependencies. */ + break; + + /* Advance to next dependency. */ + ent = (ElfW(Verneed) *) ((char *) ent + ent->vn_next); + } + } + + /* And insert the defined versions. */ + if (def != NULL) + { + ElfW(Verdef) *ent; + ent = (ElfW(Verdef) *) (map->l_addr + def->d_un.d_ptr); + while (1) + { + ElfW(Verdaux) *aux; + aux = (ElfW(Verdaux) *) ((char *) ent + ent->vd_aux); + + if ((ent->vd_flags & VER_FLG_BASE) == 0) + { + /* The name of the base version should not be + available for matching a versioned symbol. */ + ElfW(Half) ndx = ent->vd_ndx & 0x7fff; + map->l_versions[ndx].hash = ent->vd_hash; + map->l_versions[ndx].name = &strtab[aux->vda_name]; + map->l_versions[ndx].filename = NULL; + } + + if (ent->vd_next == 0) + /* No more definitions. */ + break; + + ent = (ElfW(Verdef) *) ((char *) ent + ent->vd_next); + } + } + } + + return result; +} + + +int +internal_function +_dl_check_all_versions (struct link_map *map, int verbose, int trace_mode) +{ + struct link_map *l; + int result = 0; + + for (l = map; l != NULL; l = l->l_next) + result |= ! l->l_faked && _dl_check_map_versions (l, verbose, trace_mode); + + return result; +} diff --git a/newlib/libc/sys/linux/dl/dlfcn.h b/newlib/libc/sys/linux/dl/dlfcn.h new file mode 100644 index 000000000..67ba73d5d --- /dev/null +++ b/newlib/libc/sys/linux/dl/dlfcn.h @@ -0,0 +1,84 @@ +/* User functions for run-time dynamic loading. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DLFCN_H +#define _DLFCN_H 1 + +#include + +/* Collect various system dependent definitions and declarations. */ +#include + + +/* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT + the run-time address of the symbol called NAME in the next shared + object is returned. The "next" relation is defined by the order + the shared objects were loaded. */ +# define RTLD_NEXT ((void *) -1l) + +/* If the first argument to `dlsym' or `dlvsym' is set to RTLD_DEFAULT + the run-time address of the symbol called NAME in the global scope + is returned. */ +# define RTLD_DEFAULT ((void *) 0) + + +__BEGIN_DECLS + +/* Open the shared object FILE and map it in; return a handle that can be + passed to `dlsym' to get symbol values from it. */ +extern void *dlopen (__const char *__file, int __mode) __THROW; + +/* Unmap and close a shared object opened by `dlopen'. + The handle cannot be used again after calling `dlclose'. */ +extern int dlclose (void *__handle) __THROW; + +/* Find the run-time address in the shared object HANDLE refers to + of the symbol called NAME. */ +extern void *dlsym (void *__restrict __handle, + __const char *__restrict __name) __THROW; + +/* Find the run-time address in the shared object HANDLE refers to + of the symbol called NAME with VERSION. */ +extern void *dlvsym (void *__restrict __handle, + __const char *__restrict __name, + __const char *__restrict __version) __THROW; + +/* When any of the above functions fails, call this function + to return a string describing the error. Each call resets + the error string so that a following call returns null. */ +extern char *dlerror (void) __THROW; + + +/* Structure containing information about object searched using + `dladdr'. */ +typedef struct +{ + __const char *dli_fname; /* File name of defining object. */ + void *dli_fbase; /* Load address of that object. */ + __const char *dli_sname; /* Name of nearest symbol. */ + void *dli_saddr; /* Exact value of nearest symbol. */ +} Dl_info; + +/* Fill in *INFO with the following information about ADDRESS. + Returns 0 iff no shared object's segments contain that address. */ +extern int dladdr (__const void *__address, Dl_info *__info) __THROW; + +__END_DECLS + +#endif /* dlfcn.h */ diff --git a/newlib/libc/sys/linux/dl/do-lookup.h b/newlib/libc/sys/linux/dl/do-lookup.h new file mode 100644 index 000000000..b9364b95d --- /dev/null +++ b/newlib/libc/sys/linux/dl/do-lookup.h @@ -0,0 +1,200 @@ +/* Look up a symbol in the loaded objects. + Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if VERSIONED +# define FCT do_lookup_versioned +# define ARG const struct r_found_version *const version, +#else +# define FCT do_lookup +# define ARG +#endif + +/* Inner part of the lookup functions. We return a value > 0 if we + found the symbol, the value 0 if nothing is found and < 0 if + something bad happened. */ +static inline int +FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref, + struct sym_val *result, struct r_scope_elem *scope, size_t i, ARG + struct link_map *skip, int type_class) +{ + struct link_map **list = scope->r_list; + size_t n = scope->r_nlist; + struct link_map *map; + + do + { + const ElfW(Sym) *symtab; + const char *strtab; + const ElfW(Half) *verstab; + Elf_Symndx symidx; + const ElfW(Sym) *sym; +#if ! VERSIONED + int num_versions = 0; + const ElfW(Sym) *versioned_sym = NULL; +#endif + + map = list[i]; + + /* Here come the extra test needed for `_dl_lookup_symbol_skip'. */ + if (skip != NULL && map == skip) + continue; + + /* Don't search the executable when resolving a copy reloc. */ + if ((type_class & ELF_RTYPE_CLASS_COPY) && map->l_type == lt_executable) + continue; + + /* Print some debugging info if wanted. */ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_SYMBOLS, 0)) + _dl_debug_printf ("symbol=%s; lookup in file=%s\n", undef_name, + map->l_name[0] ? map->l_name : _dl_argv[0]); + + symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]); + strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]); + verstab = map->l_versyms; + + /* Search the appropriate hash bucket in this object's symbol table + for a definition for the same symbol name. */ + for (symidx = map->l_buckets[hash % map->l_nbuckets]; + symidx != STN_UNDEF; + symidx = map->l_chain[symidx]) + { + sym = &symtab[symidx]; + + assert (ELF_RTYPE_CLASS_PLT == 1); + if (sym->st_value == 0 || /* No value. */ + /* ((type_class & ELF_RTYPE_CLASS_PLT) + && (sym->st_shndx == SHN_UNDEF)) */ + (type_class & (sym->st_shndx == SHN_UNDEF))) + continue; + + if (ELFW(ST_TYPE) (sym->st_info) > STT_FUNC) + /* Ignore all but STT_NOTYPE, STT_OBJECT and STT_FUNC entries + since these are no code/data definitions. */ + continue; + + if (sym != ref && strcmp (strtab + sym->st_name, undef_name)) + /* Not the symbol we are looking for. */ + continue; + +#if VERSIONED + if (__builtin_expect (verstab == NULL, 0)) + { + /* We need a versioned symbol but haven't found any. If + this is the object which is referenced in the verneed + entry it is a bug in the library since a symbol must + not simply disappear. + + It would also be a bug in the object since it means that + the list of required versions is incomplete and so the + tests in dl-version.c haven't found a problem.*/ + assert (version->filename == NULL + || ! _dl_name_match_p (version->filename, map)); + + /* Otherwise we accept the symbol. */ + } + else + { + /* We can match the version information or use the + default one if it is not hidden. */ + ElfW(Half) ndx = verstab[symidx] & 0x7fff; + if ((map->l_versions[ndx].hash != version->hash + || strcmp (map->l_versions[ndx].name, version->name)) + && (version->hidden || map->l_versions[ndx].hash + || (verstab[symidx] & 0x8000))) + /* It's not the version we want. */ + continue; + } +#else + /* No specific version is selected. When the object file + also does not define a version we have a match. + Otherwise we accept the default version, or in case there + is only one version defined, this one version. */ + if (verstab != NULL) + { + ElfW(Half) ndx = verstab[symidx] & 0x7fff; + if (ndx > 2) /* map->l_versions[ndx].hash != 0) */ + { + /* Don't accept hidden symbols. */ + if ((verstab[symidx] & 0x8000) == 0 && num_versions++ == 0) + /* No version so far. */ + versioned_sym = sym; + continue; + } + } +#endif + + /* There cannot be another entry for this symbol so stop here. */ + goto found_it; + } + + /* If we have seen exactly one versioned symbol while we are + looking for an unversioned symbol and the version is not the + default version we still accept this symbol since there are + no possible ambiguities. */ +#if VERSIONED + sym = NULL; +#else + sym = num_versions == 1 ? versioned_sym : NULL; +#endif + + if (sym != NULL) + { + found_it: + switch (ELFW(ST_BIND) (sym->st_info)) + { + case STB_WEAK: + /* Weak definition. Use this value if we don't find another. */ + if (__builtin_expect (_dl_dynamic_weak, 0)) + { + if (! result->s) + { + result->s = sym; + result->m = map; + } + break; + } + /* FALLTHROUGH */ + case STB_GLOBAL: + /* Global definition. Just what we need. */ + result->s = sym; + result->m = map; + return 1; + default: + /* Local symbols are ignored. */ + break; + } + } + +#if VERSIONED + /* If this current map is the one mentioned in the verneed entry + and we have not found a weak entry, it is a bug. */ + if (symidx == STN_UNDEF && version->filename != NULL + && __builtin_expect (_dl_name_match_p (version->filename, map), 0)) + return -1; +#endif + } + while (++i < n); + + /* We have not found anything until now. */ + return 0; +} + +#undef FCT +#undef ARG +#undef VERSIONED diff --git a/newlib/libc/sys/linux/dl/do-rel.h b/newlib/libc/sys/linux/dl/do-rel.h new file mode 100644 index 000000000..46202d704 --- /dev/null +++ b/newlib/libc/sys/linux/dl/do-rel.h @@ -0,0 +1,118 @@ +/* Do relocations for ELF dynamic linking. + Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file may be included twice, to define both + `elf_dynamic_do_rel' and `elf_dynamic_do_rela'. */ + +#include + +#ifdef DO_RELA +# define elf_dynamic_do_rel elf_dynamic_do_rela +# define RELCOUNT_IDX VERSYMIDX (DT_RELACOUNT) +# define Rel Rela +# define elf_machine_rel elf_machine_rela +# define elf_machine_rel_relative elf_machine_rela_relative +#else +# define RELCOUNT_IDX VERSYMIDX (DT_RELCOUNT) +#endif + +#ifndef VERSYMIDX +# define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym)) +#endif + +/* Perform the relocations in MAP on the running program image as specified + by RELTAG, SZTAG. If LAZY is nonzero, this is the first pass on PLT + relocations; they should be set up to call _dl_runtime_resolve, rather + than fully resolved now. */ + +static inline void +elf_dynamic_do_rel (struct link_map *map, + ElfW(Addr) reladdr, ElfW(Addr) relsize, + int lazy) +{ + const ElfW(Rel) *r = (const void *) reladdr; + const ElfW(Rel) *end = (const void *) (reladdr + relsize); + ElfW(Addr) l_addr = map->l_addr; + +#ifndef RTLD_BOOTSTRAP + /* We never bind lazily during ld.so bootstrap. Unfortunately gcc is + not clever enough to see through all the function calls to realize + that. */ + if (lazy) + { + /* Doing lazy PLT relocations; they need very little info. */ + for (; r < end; ++r) + elf_machine_lazy_rel (map, l_addr, r); + } + else +#endif + { + const ElfW(Sym) *const symtab = + (const void *) D_PTR (map, l_info[DT_SYMTAB]); + ElfW(Word) nrelative = (map->l_info[RELCOUNT_IDX] == NULL + ? 0 : map->l_info[RELCOUNT_IDX]->d_un.d_val); + const ElfW(Rel) *relative = r; + r = MIN (r + nrelative, end); + +#ifndef RTLD_BOOTSTRAP + /* This is defined in rtld.c, but nowhere in the static libc.a; make + the reference weak so static programs can still link. This + declaration cannot be done when compiling rtld.c (i.e. #ifdef + RTLD_BOOTSTRAP) because rtld.c contains the common defn for + _dl_rtld_map, which is incompatible with a weak decl in the same + file. */ + weak_extern (_dl_rtld_map); + if (map != &_dl_rtld_map) /* Already done in rtld itself. */ +# ifndef DO_RELA + /* Rela platforms get the offset from r_addend and this must + be copied in the relocation address. Therefore we can skip + the relative relocations only if this is for rel + relocations. */ + if (l_addr != 0) +# endif +#endif + for (; relative < r; ++relative) + elf_machine_rel_relative (l_addr, relative, + (void *) (l_addr + relative->r_offset)); + + if (map->l_info[VERSYMIDX (DT_VERSYM)]) + { + const ElfW(Half) *const version = + (const void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]); + + for (; r < end; ++r) + { + ElfW(Half) ndx = version[ELFW(R_SYM) (r->r_info)]; + elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)], + &map->l_versions[ndx], + (void *) (l_addr + r->r_offset)); + } + } + else + for (; r < end; ++r) + elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)], NULL, + (void *) (l_addr + r->r_offset)); + } +} + +#undef elf_dynamic_do_rel +#undef Rel +#undef elf_machine_rel +#undef elf_machine_rel_relative +#undef RELCOUNT_IDX diff --git a/newlib/libc/sys/linux/dl/dynamic-link.h b/newlib/libc/sys/linux/dl/dynamic-link.h new file mode 100644 index 000000000..a63fded89 --- /dev/null +++ b/newlib/libc/sys/linux/dl/dynamic-link.h @@ -0,0 +1,244 @@ +/* Inline functions for dynamic linking. + Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +#ifndef VERSYMIDX +# define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym)) +#endif + + +/* Global read-only variable defined in rtld.c which is nonzero if we + shall give more warning messages. */ +extern int _dl_verbose __attribute__ ((unused)); + + +/* Read the dynamic section at DYN and fill in INFO with indices DT_*. */ + +static inline void __attribute__ ((unused)) +elf_get_dynamic_info (struct link_map *l) +{ + ElfW(Dyn) *dyn = l->l_ld; + ElfW(Addr) l_addr; + ElfW(Dyn) **info; + + if (! dyn) + return; + + l_addr = l->l_addr; + info = l->l_info; + + while (dyn->d_tag != DT_NULL) + { + if (dyn->d_tag < DT_NUM) + info[dyn->d_tag] = dyn; + else if (dyn->d_tag >= DT_LOPROC && + dyn->d_tag < DT_LOPROC + DT_THISPROCNUM) + info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn; + else if ((Elf32_Word) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM) + info[VERSYMIDX (dyn->d_tag)] = dyn; + else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM) + info[DT_EXTRATAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM + + DT_VERSIONTAGNUM] = dyn; + else + assert (! "bad dynamic tag"); + ++dyn; + } +#ifndef DL_RO_DYN_SECTION + if (info[DT_PLTGOT] != NULL) + info[DT_PLTGOT]->d_un.d_ptr += l_addr; + if (info[DT_STRTAB] != NULL) + info[DT_STRTAB]->d_un.d_ptr += l_addr; + if (info[DT_SYMTAB] != NULL) + info[DT_SYMTAB]->d_un.d_ptr += l_addr; +# if ! ELF_MACHINE_NO_RELA + if (info[DT_RELA] != NULL) + { + assert (info[DT_RELAENT]->d_un.d_val == sizeof (ElfW(Rela))); + info[DT_RELA]->d_un.d_ptr += l_addr; + } +# endif +# if ! ELF_MACHINE_NO_REL + if (info[DT_REL] != NULL) + { + assert (info[DT_RELENT]->d_un.d_val == sizeof (ElfW(Rel))); + info[DT_REL]->d_un.d_ptr += l_addr; + } +# endif +#endif + if (info[DT_PLTREL] != NULL) + { +# if ELF_MACHINE_NO_RELA + assert (info[DT_PLTREL]->d_un.d_val == DT_REL); +# elif ELF_MACHINE_NO_REL + assert (info[DT_PLTREL]->d_un.d_val == DT_RELA); +# else + assert (info[DT_PLTREL]->d_un.d_val == DT_REL + || info[DT_PLTREL]->d_un.d_val == DT_RELA); +# endif + } +#ifndef DL_RO_DYN_SECTION + if (info[DT_JMPREL] != NULL) + info[DT_JMPREL]->d_un.d_ptr += l_addr; + if (info[VERSYMIDX (DT_VERSYM)] != NULL) + info[VERSYMIDX (DT_VERSYM)]->d_un.d_ptr += l_addr; +#endif + if (info[DT_FLAGS] != NULL) + { + /* Flags are used. Translate to the old form where available. + Since these l_info entries are only tested for NULL pointers it + is ok if they point to the DT_FLAGS entry. */ + ElfW(Word) flags = info[DT_FLAGS]->d_un.d_val; + if (flags & DF_SYMBOLIC) + info[DT_SYMBOLIC] = info[DT_FLAGS]; + if (flags & DF_TEXTREL) + info[DT_TEXTREL] = info[DT_FLAGS]; + if (flags & DF_BIND_NOW) + info[DT_BIND_NOW] = info[DT_FLAGS]; + } + if (info[VERSYMIDX (DT_FLAGS_1)] != NULL) + l->l_flags_1 = info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val; + if (info[DT_RUNPATH] != NULL) + /* If both RUNPATH and RPATH are given, the latter is ignored. */ + info[DT_RPATH] = NULL; +} + +#ifdef RESOLVE + +/* Get the definitions of `elf_dynamic_do_rel' and `elf_dynamic_do_rela'. + These functions are almost identical, so we use cpp magic to avoid + duplicating their code. It cannot be done in a more general function + because we must be able to completely inline. */ + +/* On some machines, notably SPARC, DT_REL* includes DT_JMPREL in its + range. Note that according to the ELF spec, this is completely legal! + But conditionally define things so that on machines we know this will + not happen we do something more optimal. */ + +# ifdef ELF_MACHINE_PLTREL_OVERLAP +# define _ELF_DYNAMIC_DO_RELOC(RELOC, reloc, map, do_lazy, test_rel) \ + do { \ + struct { ElfW(Addr) start, size; int lazy; } ranges[3]; \ + int ranges_index; \ + \ + ranges[0].lazy = ranges[2].lazy = 0; \ + ranges[1].lazy = 1; \ + ranges[0].size = ranges[1].size = ranges[2].size = 0; \ + \ + if ((map)->l_info[DT_##RELOC]) \ + { \ + ranges[0].start = D_PTR ((map), l_info[DT_##RELOC]); \ + ranges[0].size = (map)->l_info[DT_##RELOC##SZ]->d_un.d_val; \ + } \ + \ + if ((do_lazy) \ + && (map)->l_info[DT_PLTREL] \ + && (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \ + { \ + ranges[1].start = D_PTR ((map), l_info[DT_JMPREL]); \ + ranges[1].size = (map)->l_info[DT_PLTRELSZ]->d_un.d_val; \ + ranges[2].start = ranges[1].start + ranges[1].size; \ + ranges[2].size = ranges[0].start + ranges[0].size - ranges[2].start; \ + ranges[0].size = ranges[1].start - ranges[0].start; \ + } \ + \ + for (ranges_index = 0; ranges_index < 3; ++ranges_index) \ + elf_dynamic_do_##reloc ((map), \ + ranges[ranges_index].start, \ + ranges[ranges_index].size, \ + ranges[ranges_index].lazy); \ + } while (0) +# else +# define _ELF_DYNAMIC_DO_RELOC(RELOC, reloc, map, do_lazy, test_rel) \ + do { \ + struct { ElfW(Addr) start, size; int lazy; } ranges[2]; \ + int ranges_index; \ + ranges[0].lazy = 0; \ + ranges[0].size = ranges[1].size = 0; \ + ranges[0].start = 0; \ + \ + if ((map)->l_info[DT_##RELOC]) \ + { \ + ranges[0].start = D_PTR ((map), l_info[DT_##RELOC]); \ + ranges[0].size = (map)->l_info[DT_##RELOC##SZ]->d_un.d_val; \ + } \ + if ((map)->l_info[DT_PLTREL] \ + && (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \ + { \ + ElfW(Addr) start = D_PTR ((map), l_info[DT_JMPREL]); \ + \ + if ((do_lazy) \ + /* This test does not only detect whether the relocation \ + sections are in the right order, it also checks whether \ + there is a DT_REL/DT_RELA section. */ \ + || ranges[0].start + ranges[0].size != start) \ + { \ + ranges[1].start = start; \ + ranges[1].size = (map)->l_info[DT_PLTRELSZ]->d_un.d_val; \ + ranges[1].lazy = (do_lazy); \ + } \ + else \ + /* Combine processing the sections. */ \ + ranges[0].size += (map)->l_info[DT_PLTRELSZ]->d_un.d_val; \ + } \ + \ + for (ranges_index = 0; ranges_index < 2; ++ranges_index) \ + elf_dynamic_do_##reloc ((map), \ + ranges[ranges_index].start, \ + ranges[ranges_index].size, \ + ranges[ranges_index].lazy); \ + } while (0) +# endif + +# if ELF_MACHINE_NO_REL || ELF_MACHINE_NO_RELA +# define _ELF_CHECK_REL 0 +# else +# define _ELF_CHECK_REL 1 +# endif + +# if ! ELF_MACHINE_NO_REL +# include "do-rel.h" +# define ELF_DYNAMIC_DO_REL(map, lazy) \ + _ELF_DYNAMIC_DO_RELOC (REL, rel, map, lazy, _ELF_CHECK_REL) +# else +# define ELF_DYNAMIC_DO_REL(map, lazy) /* Nothing to do. */ +# endif + +# if ! ELF_MACHINE_NO_RELA +# define DO_RELA +# include "do-rel.h" +# define ELF_DYNAMIC_DO_RELA(map, lazy) \ + _ELF_DYNAMIC_DO_RELOC (RELA, rela, map, lazy, _ELF_CHECK_REL) +# else +# define ELF_DYNAMIC_DO_RELA(map, lazy) /* Nothing to do. */ +# endif + +/* This can't just be an inline function because GCC is too dumb + to inline functions containing inlines themselves. */ +# define ELF_DYNAMIC_RELOCATE(map, lazy, consider_profile) \ + do { \ + int edr_lazy = elf_machine_runtime_setup ((map), (lazy), \ + (consider_profile)); \ + ELF_DYNAMIC_DO_REL ((map), edr_lazy); \ + ELF_DYNAMIC_DO_RELA ((map), edr_lazy); \ + } while (0) + +#endif diff --git a/newlib/libc/sys/linux/dl/kernel-features.h b/newlib/libc/sys/linux/dl/kernel-features.h new file mode 100644 index 000000000..562a6c765 --- /dev/null +++ b/newlib/libc/sys/linux/dl/kernel-features.h @@ -0,0 +1,193 @@ +/* Set flags signalling availability of kernel features based on given + kernel version number. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file must not contain any C code. At least it must be protected + to allow using the file also in assembler files. */ + +#ifndef __LINUX_KERNEL_VERSION +/* We assume the worst; all kernels should be supported. */ +# define __LINUX_KERNEL_VERSION 0 +#endif + +/* We assume for __LINUX_KERNEL_VERSION the same encoding used in + linux/version.h. I.e., the major, minor, and subminor all get a + byte with the major number being in the highest byte. This means + we can do numeric comparisons. + + In the following we will define certain symbols depending on + whether the describes kernel feature is available in the kernel + version given by __LINUX_KERNEL_VERSION. We are not always exactly + recording the correct versions in which the features were + introduced. If somebody cares these values can afterwards be + corrected. Most of the numbers here are set corresponding to + 2.2.0. */ + +/* `getcwd' system call. */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_GETCWD_SYSCALL 1 +#endif + +/* Real-time signal became usable in 2.1.70. */ +#if __LINUX_KERNEL_VERSION >= 131398 +# define __ASSUME_REALTIME_SIGNALS 1 +#endif + +/* When were the `pread'/`pwrite' syscalls introduced? */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_PREAD_SYSCALL 1 +# define __ASSUME_PWRITE_SYSCALL 1 +#endif + +/* When was `poll' introduced? */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_POLL_SYSCALL 1 +#endif + +/* The `lchown' syscall was introduced in 2.1.80. */ +#if __LINUX_KERNEL_VERSION >= 131408 +# define __ASSUME_LCHOWN_SYSCALL 1 +#endif + +/* When did the `setresuid' sysall became available? */ +#if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__ +# define __ASSUME_SETRESUID_SYSCALL 1 +#endif + +/* The SIOCGIFNAME ioctl is available starting with 2.1.50. */ +#if __LINUX_KERNEL_VERSION >= 131408 +# define __ASSUME_SIOCGIFNAME 1 +#endif + +/* On x86 another `getrlimit' syscall was added in 2.3.25. */ +#if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__ +# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 +#endif + +/* On x86 the truncate64/ftruncate64 syscalls were introduced in 2.3.31. */ +#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ +# define __ASSUME_TRUNCATE64_SYSCALL 1 +#endif + +/* On x86 the mmap2 syscall was introduced in 2.3.31. */ +#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ +# define __ASSUME_MMAP2_SYSCALL 1 +#endif + +/* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */ +#if __LINUX_KERNEL_VERSION >= 131874 && defined __i386__ +# define __ASSUME_STAT64_SYSCALL 1 +#endif + +/* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64 + syscalls were introduced in 2.3.35. */ +#if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__) +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_MMAP2_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +#endif + +/* I know for sure that these are in 2.3.35 on powerpc. */ +#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 +#endif + +/* Linux 2.3.39 introduced 32bit UID/GIDs and IPC64. Some platforms had 32 + bit type all along. */ +#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__ +# define __ASSUME_32BITUIDS 1 +# ifndef __powerpc__ +# define __ASSUME_IPC64 1 +# endif +# ifdef __sparc__ +# define __ASSUME_SETRESUID_SYSCALL 1 +# endif +#endif + +/* Linux 2.4.0 on PPC introduced a correct IPC64. */ +#if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__ +# define __ASSUME_IPC64 1 +#endif + +/* We can use the LDTs for threading with Linux 2.3.99 and newer. */ +#if __LINUX_KERNEL_VERSION >= 131939 +# define __ASSUME_LDT_WORKS 1 +#endif + +/* The changed st_ino field appeared in 2.4.0-test6. But we cannot + distinguish this version from other 2.4.0 releases. Therefore play + save and assume it available is for 2.4.1 and up. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_ST_INO_64_BIT 1 +#endif + +/* To support locking of large files a new fcntl() syscall was introduced + in 2.4.0-test7. We test for 2.4.1 for the earliest version we know + the syscall is available. */ +#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __sparc__) +# define __ASSUME_FCNTL64 1 +#endif + +/* Arm got fcntl64 in 2.4.4, PowerPC and SH have it also in 2.4.4 (I + don't know when it got introduced). */ +#if __LINUX_KERNEL_VERSION >= 132100 \ + && (defined __arm__ || defined __powerpc__ || defined __sh__) +# define __ASSUME_FCNTL64 1 +#endif + +/* The getdents64 syscall was introduced in 2.4.0-test7. We test for + 2.4.1 for the earliest version we know the syscall is available. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_GETDENTS64_SYSCALL 1 +#endif + +/* When did O_DIRECTORY became available? Early in 2.3 but when? + Be safe, use 2.3.99. */ +#if __LINUX_KERNEL_VERSION >= 131939 +# define __ASSUME_O_DIRECTORY 1 +#endif + +/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes + up the page size information. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_AT_PAGESIZE 1 +#endif + +/* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way + and the mmap2 syscall made it into the official kernel. */ +#if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__ +# define __ASSUME_STD_AUXV 1 +# define __ASSUME_MMAP2_SYSCALL 1 +#endif + +/* There are an infinite number of PA-RISC kernel versions numbered + 2.4.0. But they've not really been released as such. We require + and expect the final version here. */ +#ifdef __hppa__ +# define __ASSUME_32BITUIDS 1 +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_MMAP2_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +# define __ASSUME_IPC64 1 +# define __ASSUME_ST_INO_64_BIT 1 +# define __ASSUME_FCNTL64 1 +# define __ASSUME_GETDENTS64_SYSCALL 1 +#endif diff --git a/newlib/libc/sys/linux/dl/ldsodefs.h b/newlib/libc/sys/linux/dl/ldsodefs.h new file mode 100644 index 000000000..f24e1136b --- /dev/null +++ b/newlib/libc/sys/linux/dl/ldsodefs.h @@ -0,0 +1,535 @@ +/* Run-time dynamic linker data structures for loaded ELF shared objects. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LDSODEFS_H +#define _LDSODEFS_H 1 + +#include + +#define __need_size_t +#define __need_NULL +#include +#include + +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +/* We use this macro to refer to ELF types independent of the native wordsize. + `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ +#define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type) + +#define internal_function +/* All references to the value of l_info[DT_PLTGOT], + l_info[DT_STRTAB], l_info[DT_SYMTAB], l_info[DT_RELA], + l_info[DT_REL], l_info[DT_JMPREL], and l_info[VERSYMIDX (DT_VERSYM)] + have to be accessed via the D_PTR macro. The macro is needed since for + most architectures the entry is already relocated - but for some not + and we need to relocate at access time. */ +#ifdef DL_RO_DYN_SECTION +# define D_PTR(map,i) (map->i->d_un.d_ptr + map->l_addr) +#else +# define D_PTR(map,i) map->i->d_un.d_ptr +#endif + +/* On some platforms more information than just the address of the symbol + is needed from the lookup functions. In this case we return the whole + link map. */ +#ifdef DL_LOOKUP_RETURNS_MAP +typedef struct link_map *lookup_t; +# define LOOKUP_VALUE(map) map +# define LOOKUP_VALUE_ADDRESS(map) (map ? map->l_addr : 0) +#else +typedef ElfW(Addr) lookup_t; +# define LOOKUP_VALUE(map) map->l_addr +# define LOOKUP_VALUE_ADDRESS(address) address +#endif + +/* on some architectures a pointer to a function is not just a pointer + to the actual code of the function but rather an architecture + specific descriptor. */ +#ifndef ELF_FUNCTION_PTR_IS_SPECIAL +# define DL_SYMBOL_ADDRESS(map, ref) \ + (void *) (LOOKUP_VALUE_ADDRESS (map) + ref->st_value) +# define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr)) +# define DL_DT_INIT_ADDRESS(map, start) (start) +# define DL_DT_FINI_ADDRESS(map, start) (start) +#endif + +/* Unmap a loaded object, called by _dl_close (). */ +#ifndef DL_UNMAP_IS_SPECIAL +# define DL_UNMAP(map) \ + __munmap ((void *) (map)->l_map_start, \ + (map)->l_map_end - (map)->l_map_start) +#endif + +/* By default we do not need special support to initialize DSOs loaded + by statically linked binaries. */ +#ifndef DL_STATIC_INIT +# define DL_STATIC_INIT(map) +#endif + +/* Reloc type classes as returned by elf_machine_type_class(). + ELF_RTYPE_CLASS_PLT means this reloc should not be satisfied by + some PLT symbol, ELF_RTYPE_CLASS_COPY means this reloc should not be + satisfied by any symbol in the executable. */ +#define ELF_RTYPE_CLASS_PLT 1 +#define ELF_RTYPE_CLASS_COPY 2 + +/* ELF uses the PF_x macros to specify the segment permissions, mmap + uses PROT_xxx. In most cases the three macros have the values 1, 2, + and 3 but not in a matching order. The following macros allows + converting from the PF_x values to PROT_xxx values. */ +#define PF_TO_PROT \ + ((PROT_READ << (PF_R * 4)) \ + | (PROT_WRITE << (PF_W * 4)) \ + | (PROT_EXEC << (PF_X * 4)) \ + | ((PROT_READ | PROT_WRITE) << ((PF_R | PF_W) * 4)) \ + | ((PROT_READ | PROT_EXEC) << ((PF_R | PF_X) * 4)) \ + | ((PROT_WRITE | PROT_EXEC) << (PF_W | PF_X) * 4) \ + | ((PROT_READ | PROT_WRITE | PROT_EXEC) << ((PF_R | PF_W | PF_X) * 4))) + + +/* For the version handling we need an array with only names and their + hash values. */ +struct r_found_version + { + const char *name; + ElfW(Word) hash; + + int hidden; + const char *filename; + }; + +/* We want to cache information about the searches for shared objects. */ + +enum r_dir_status { unknown, nonexisting, existing }; + +struct r_search_path_elem + { + /* This link is only used in the `all_dirs' member of `r_search_path'. */ + struct r_search_path_elem *next; + + /* Strings saying where the definition came from. */ + const char *what; + const char *where; + + /* Basename for this search path element. The string must end with + a slash character. */ + const char *dirname; + size_t dirnamelen; + + enum r_dir_status status[0]; + }; + +struct r_strlenpair + { + const char *str; + size_t len; + }; + + +/* A data structure for a simple single linked list of strings. */ +struct libname_list + { + const char *name; /* Name requested (before search). */ + struct libname_list *next; /* Link to next name for this object. */ + int dont_free; /* Flag whether this element should be freed + if the object is not entirely unloaded. */ + }; + + +/* Test whether given NAME matches any of the names of the given object. */ +static __inline int +__attribute__ ((unused)) +_dl_name_match_p (const char *__name, struct link_map *__map) +{ + int __found = strcmp (__name, __map->l_name) == 0; + struct libname_list *__runp = __map->l_libname; + + while (! __found && __runp != NULL) + if (strcmp (__name, __runp->name) == 0) + __found = 1; + else + __runp = __runp->next; + + return __found; +} + +/* Function used as argument for `_dl_receive_error' function. The + arguments are the error code, error string, and the objname the + error occurred in. */ +typedef void (*receiver_fct) (int, const char *, const char *); + +/* Internal functions of the run-time dynamic linker. + These can be accessed if you link again the dynamic linker + as a shared library, as in `-lld' or `/lib/ld.so' explicitly; + but are not normally of interest to user programs. + + The `-ldl' library functions in provide a simple + user interface to run-time dynamic linking. */ + + +/* Parameters passed to the dynamic linker. */ +extern char **_dl_argv; + +/* Cached value of `getpagesize ()'. */ +extern size_t _dl_pagesize; + +/* OS version. */ +extern unsigned int _dl_osversion; + +/* File descriptor referring to the zero-fill device. */ +extern int _dl_zerofd; + +/* Name of the shared object to be profiled (if any). */ +extern const char *_dl_profile; +/* Map of shared object to be profiled. */ +extern struct link_map *_dl_profile_map; +/* Filename of the output file. */ +extern const char *_dl_profile_output; + +/* If nonzero the appropriate debug information is printed. */ +extern int _dl_debug_mask; +#define DL_DEBUG_LIBS (1 << 0) +#define DL_DEBUG_IMPCALLS (1 << 1) +#define DL_DEBUG_BINDINGS (1 << 2) +#define DL_DEBUG_SYMBOLS (1 << 3) +#define DL_DEBUG_VERSIONS (1 << 4) +#define DL_DEBUG_RELOC (1 << 5) +#define DL_DEBUG_FILES (1 << 6) +#define DL_DEBUG_STATISTICS (1 << 7) +/* This one is used only internally. */ +#define DL_DEBUG_HELP (1 << 8) + +/* Expect cache ID. */ +extern int _dl_correct_cache_id; + +/* Mask for hardware capabilities that are available. */ +extern unsigned long int _dl_hwcap; + +/* Mask for important hardware capabilities we honour. */ +extern unsigned long int _dl_hwcap_mask; + +/* File descriptor to write debug messages to. */ +extern int _dl_debug_fd; + +/* Names of shared object for which the RPATH should be ignored. */ +extern const char *_dl_inhibit_rpath; + +/* Nonzero if references should be treated as weak during runtime linking. */ +extern int _dl_dynamic_weak; + +/* The array with message we print as a last resort. */ +extern const char _dl_out_of_memory[]; + +/* Nonzero if runtime lookups should not update the .got/.plt. */ +extern int _dl_bind_not; + +/* List of search directories. */ +extern struct r_search_path_elem *_dl_all_dirs; +extern struct r_search_path_elem *_dl_init_all_dirs; + +/* OS-dependent function to open the zero-fill device. */ +extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ + + +/* During the program run we must not modify the global data of + loaded shared object simultanously in two threads. Therefore we + protect `_dl_open' and `_dl_close' in dl-close.c. + + This must be a recursive lock since the initializer function of + the loaded object might as well require a call to this function. + At this time it is not anymore a problem to modify the tables. */ +__libc_lock_define_recursive (extern, _dl_load_lock) + + +/* Write message on the debug file descriptor. The parameters are + interpreted as for a `printf' call. All the lines start with a + tag showing the PID. */ +extern void _dl_debug_printf (const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); + +/* Write message on the debug file descriptor. The parameters are + interpreted as for a `printf' call. All the lines buf the first + start with a tag showing the PID. */ +extern void _dl_debug_printf_c (const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); + + +/* Write a message on the specified descriptor FD. The parameters are + interpreted as for a `printf' call. */ +extern void _dl_dprintf (int fd, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + +/* Write a message on the specified descriptor standard output. The + parameters are interpreted as for a `printf' call. */ +#define _dl_printf(fmt, args...) \ + _dl_dprintf (STDOUT_FILENO, fmt, ##args) + +/* Write a message on the specified descriptor standard error. The + parameters are interpreted as for a `printf' call. */ +#define _dl_error_printf(fmt, args...) \ + _dl_dprintf (STDERR_FILENO, fmt, ##args) + +/* Write a message on the specified descriptor standard error and exit + the program. The parameters are interpreted as for a `printf' call. */ +#define _dl_fatal_printf(fmt, args...) \ + do \ + { \ + _dl_dprintf (STDERR_FILENO, fmt, ##args); \ + _exit (127); \ + } \ + while (1) + + +/* This function is called by all the internal dynamic linker functions + when they encounter an error. ERRCODE is either an `errno' code or + zero; OBJECT is the name of the problematical shared object, or null if + it is a general problem; ERRSTRING is a string describing the specific + problem. */ +extern void _dl_signal_error (int errcode, const char *object, + const char *occurred, const char *errstring) + internal_function + __attribute__ ((__noreturn__)); + +/* Like _dl_signal_error, but may return when called in the context of + _dl_receive_error. */ +extern void _dl_signal_cerror (int errcode, const char *object, + const char *occation, const char *errstring) + internal_function; + +/* Call OPERATE, receiving errors from `dl_signal_cerror'. Unlike + `_dl_catch_error' the operation is resumed after the OPERATE + function returns. + ARGS is passed as argument to OPERATE. */ +extern void _dl_receive_error (receiver_fct fct, void (*operate) (void *), + void *args) + internal_function; + + +/* Open the shared object NAME and map in its segments. + LOADER's DT_RPATH is used in searching for NAME. + If the object is already opened, returns its existing map. + For preloaded shared objects PRELOADED is set to a non-zero + value to allow additional security checks. */ +extern struct link_map *_dl_map_object (struct link_map *loader, + const char *name, int preloaded, + int type, int trace_mode, int mode) + internal_function; + +/* Call _dl_map_object on the dependencies of MAP, and set up + MAP->l_searchlist. PRELOADS points to a vector of NPRELOADS previously + loaded objects that will be inserted into MAP->l_searchlist after MAP + but before its dependencies. */ +extern void _dl_map_object_deps (struct link_map *map, + struct link_map **preloads, + unsigned int npreloads, int trace_mode) + internal_function; + +/* Cache the locations of MAP's hash table. */ +extern void _dl_setup_hash (struct link_map *map) internal_function; + + +/* Search loaded objects' symbol tables for a definition of the symbol + referred to by UNDEF. *SYM is the symbol table entry containing the + reference; it is replaced with the defining symbol, and the base load + address of the defining object is returned. SYMBOL_SCOPE is a + null-terminated list of object scopes to search; each object's + l_searchlist (i.e. the segment of the dependency tree starting at that + object) is searched in turn. REFERENCE_NAME should name the object + containing the reference; it is used in error messages. + TYPE_CLASS describes the type of symbol we are looking for. */ +extern lookup_t _dl_lookup_symbol (const char *undef, + struct link_map *undef_map, + const ElfW(Sym) **sym, + struct r_scope_elem *symbol_scope[], + int type_class, int explicit) + internal_function; + +/* Lookup versioned symbol. */ +extern lookup_t _dl_lookup_versioned_symbol (const char *undef, + struct link_map *undef_map, + const ElfW(Sym) **sym, + struct r_scope_elem *symbol_scope[], + const struct r_found_version *version, + int type_class, int explicit) + internal_function; + +/* For handling RTLD_NEXT we must be able to skip shared objects. */ +extern lookup_t _dl_lookup_symbol_skip (const char *undef, + struct link_map *undef_map, + const ElfW(Sym) **sym, + struct r_scope_elem *symbol_scope[], + struct link_map *skip_this) + internal_function; + +/* For handling RTLD_NEXT with versioned symbols we must be able to + skip shared objects. */ +extern lookup_t _dl_lookup_versioned_symbol_skip (const char *undef, + struct link_map *undef_map, + const ElfW(Sym) **sym, + struct r_scope_elem *symbol_scope[], + const struct r_found_version *version, + struct link_map *skip_this) + internal_function; + +/* Look up symbol NAME in MAP's scope and return its run-time address. */ +extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name) + internal_function; + + +/* Structure describing the dynamic linker itself. */ +extern struct link_map _dl_rtld_map; +/* And a pointer to the map for the main map. */ +extern struct link_map *_dl_loaded; +/* Number of object in the _dl_loaded list. */ +extern unsigned int _dl_nloaded; +/* Array representing global scope. */ +extern struct r_scope_elem *_dl_global_scope[2]; +/* Direct pointer to the searchlist of the main object. */ +extern struct r_scope_elem *_dl_main_searchlist; +/* Copy of the content of `_dl_main_searchlist'. */ +extern struct r_scope_elem _dl_initial_searchlist; +/* This is zero at program start to signal that the global scope map is + allocated by rtld. Later it keeps the size of the map. It might be + reset if in _dl_close if the last global object is removed. */ +extern size_t _dl_global_scope_alloc; + +/* Allocate a `struct link_map' for a new object being loaded, + and enter it into the _dl_main_map list. */ +extern struct link_map *_dl_new_object (char *realname, const char *libname, + int type, struct link_map *loader) + internal_function; + +/* Relocate the given object (if it hasn't already been). + SCOPE is passed to _dl_lookup_symbol in symbol lookups. + If LAZY is nonzero, don't relocate its PLT. */ +extern void _dl_relocate_object (struct link_map *map, + struct r_scope_elem *scope[], + int lazy, int consider_profiling); + +/* Call _dl_signal_error with a message about an unhandled reloc type. + TYPE is the result of ELFW(R_TYPE) (r_info), i.e. an R__* value. + PLT is nonzero if this was a PLT reloc; it just affects the message. */ +extern void _dl_reloc_bad_type (struct link_map *map, + unsigned int type, int plt) + internal_function __attribute__ ((__noreturn__)); + +/* Check the version dependencies of all objects available through + MAP. If VERBOSE print some more diagnostics. */ +extern int _dl_check_all_versions (struct link_map *map, int verbose, + int trace_mode) + internal_function; + +/* Check the version dependencies for MAP. If VERBOSE print some more + diagnostics. */ +extern int _dl_check_map_versions (struct link_map *map, int verbose, + int trace_mode) + internal_function; + +/* Initialize the object in SCOPE by calling the constructors with + ARGC, ARGV, and ENV as the parameters. */ +extern void _dl_init (struct link_map *main_map, int argc, char **argv, + char **env) internal_function; + +/* Call the finalizer functions of all shared objects whose + initializer functions have completed. */ +extern void _dl_fini (void) internal_function; + +/* The dynamic linker calls this function before and having changing + any shared object mappings. The `r_state' member of `struct r_debug' + says what change is taking place. This function's address is + the value of the `r_brk' member. */ +extern void _dl_debug_state (void); + +/* Initialize `struct r_debug' if it has not already been done. The + argument is the run-time load address of the dynamic linker, to be put + in the `r_ldbase' member. Returns the address of the structure. */ +extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase) + internal_function; + +/* Initialize the basic data structure for the search paths. */ +extern void _dl_init_paths (const char *library_path) internal_function; + +/* Gather the information needed to install the profiling tables and start + the timers. */ +extern void _dl_start_profile (struct link_map *map, const char *output_dir) + internal_function; + +/* The actual functions used to keep book on the calls. */ +extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc); + +/* This function is simply a wrapper around the _dl_mcount function + which does not require a FROMPC parameter since this is the + calling function. */ +extern void _dl_mcount_wrapper (void *selfpc); + +/* Show the members of the auxiliary array passed up from the kernel. */ +extern void _dl_show_auxv (void) internal_function; + +/* Return all environment variables starting with `LD_', one after the + other. */ +extern char *_dl_next_ld_env_entry (char ***position) internal_function; + +/* Return an array with the names of the important hardware capabilities. */ +extern const struct r_strlenpair *_dl_important_hwcaps (const char *platform, + size_t paltform_len, + size_t *sz, + size_t *max_capstrlen) + internal_function; + +/* Look up NAME in ld.so.cache and return the file name stored there, + or null if none is found. */ +extern const char *_dl_load_cache_lookup (const char *name) + internal_function; + +/* If the system does not support MAP_COPY we cannot leave the file open + all the time since this would create problems when the file is replaced. + Therefore we provide this function to close the file and open it again + once needed. */ +extern void _dl_unload_cache (void); + +/* System-dependent function to read a file's whole contents in the + most convenient manner available. *SIZEP gets the size of the + file. On error MAP_FAILED is returned. */ +extern void *_dl_sysdep_read_whole_file (const char *file, size_t *sizep, + int prot) + internal_function; + +/* System-specific function to do initial startup for the dynamic linker. + After this, file access calls and getenv must work. This is responsible + for setting __libc_enable_secure if we need to be secure (e.g. setuid), + and for setting _dl_argc and _dl_argv, and then calling _dl_main. */ +extern ElfW(Addr) _dl_sysdep_start (void **start_argptr, + void (*dl_main) (const ElfW(Phdr) *phdr, + ElfW(Word) phnum, + ElfW(Addr) *user_entry)); + +extern void _dl_sysdep_start_cleanup (void) + internal_function; + + +__END_DECLS + +#endif /* ldsodefs.h */ diff --git a/newlib/libc/sys/linux/dl/libintl.h b/newlib/libc/sys/linux/dl/libintl.h new file mode 100644 index 000000000..839210dea --- /dev/null +++ b/newlib/libc/sys/linux/dl/libintl.h @@ -0,0 +1,2 @@ +#define N_(x) x + diff --git a/newlib/libc/sys/linux/dl/trusted-dirs.h b/newlib/libc/sys/linux/dl/trusted-dirs.h new file mode 100644 index 000000000..103d6e6bb --- /dev/null +++ b/newlib/libc/sys/linux/dl/trusted-dirs.h @@ -0,0 +1,7 @@ +#define SYSTEM_DIRS \ + "/usr/local/lib/" + +#define SYSTEM_DIRS_LEN \ + 15 + +#define SYSTEM_DIRS_MAX_LEN 15 diff --git a/newlib/libc/sys/linux/dl/unsecvars.h b/newlib/libc/sys/linux/dl/unsecvars.h new file mode 100644 index 000000000..efb951595 --- /dev/null +++ b/newlib/libc/sys/linux/dl/unsecvars.h @@ -0,0 +1,19 @@ +/* Environment variable to be removed for SUID programs. The names are + all stuffed in a single string which means they have to be terminated + with a '\0' explicitly. */ +#define UNSECURE_ENVVARS \ + "LD_PRELOAD\0" \ + "LD_LIBRARY_PATH\0" \ + "LD_ORIGIN_PATH\0" \ + "LD_DEBUG_OUTPUT\0" \ + "LD_PROFILE\0" \ + "GCONV_PATH\0" \ + "HOSTALIASES\0" \ + "LOCALDOMAIN\0" \ + "LOCPATH\0" \ + "MALLOC_TRACE\0" \ + "NLSPATH\0" \ + "RESOLV_HOST_CONF\0" \ + "RES_OPTIONS\0" \ + "TMPDIR\0" \ + "TZDIR\0" diff --git a/newlib/libc/sys/linux/gethostid.c b/newlib/libc/sys/linux/gethostid.c new file mode 100644 index 000000000..bf801c74a --- /dev/null +++ b/newlib/libc/sys/linux/gethostid.c @@ -0,0 +1,114 @@ +/* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + +#define HOSTIDFILE "/etc/hostid" +#define OLD_HOSTIDFILE "/etc/hostid" + +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 +# define OPEN __open64 +#else +# define OPEN __open +#endif + +#ifdef SET_PROCEDURE +int +sethostid (id) + long int id; +{ + int fd; + ssize_t written; + + /* Open file for writing. Everybody is allowed to read this file. */ + fd = OPEN (HOSTIDFILE, O_CREAT|O_WRONLY|O_TRUNC, 0644); + if (fd < 0) + return -1; + + written = __write (fd, &id, sizeof (id)); + + __close (fd); + + return written != sizeof (id) ? -1 : 0; +} + +#else +# include +# include +# include +# include + +long int +gethostid () +{ + char hostname[MAXHOSTNAMELEN + 1]; + size_t buflen; + char *buffer; + struct hostent hostbuf, *hp; + unsigned long int id; + struct in_addr in; + int herr; + int fd; + + /* First try to get the ID from a former invocation of sethostid. */ + fd = OPEN (HOSTIDFILE, O_RDONLY); + if (fd >= 0) + { + ssize_t n = __read (fd, &id, sizeof (id)); + + __close (fd); + + if (n == sizeof (id)) + return id; + } + + /* Getting from the file was not successful. An intelligent guess for + a unique number of a host is its IP address. Return this. */ + if (__gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0') + /* This also fails. Return and arbitrary value. */ + return 0; + + buflen = 1024; + buffer = alloca (buflen); + + /* To get the IP address we need to know the host name. */ + while (__gethostbyname_r (hostname, &hostbuf, buffer, buflen, &hp, &herr) + != 0 + || hp == NULL) + if (herr != NETDB_INTERNAL || errno != ERANGE) + return 0; + else + { + /* Enlarge buffer. */ + buflen *= 2; + buffer = alloca (buflen); + } + + in.s_addr = 0; + memcpy (&in, hp->h_addr, + (int) sizeof (in) < hp->h_length ? sizeof (in) : hp->h_length); + + /* For the return value to be not exactly the IP address we do some + bit fiddling. */ + return in.s_addr << 16 | in.s_addr >> 16; +} +#endif diff --git a/newlib/libc/sys/linux/iconv/Makefile.am b/newlib/libc/sys/linux/iconv/Makefile.am new file mode 100644 index 000000000..732644062 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/Makefile.am @@ -0,0 +1,27 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -DGCONV_DIR='"$(pkglibdir)"' -DGCONV_PATH='"$(pkglibdir)"' -I$(srcdir) -I$(srcdir)/.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +LIB_SOURCES = \ + iconv.h gconv.h \ + iconv_open.c iconv.c iconv_close.c \ + gconv_open.c gconv.c gconv_close.c \ + gconv_db.c gconv_dl.c gconv_conf.c gconv_builtin.c \ + gconv_simple.c gconv_trans.c gconv_cache.c + +libiconv_la_CFLAGS = +libiconv_la_LDFLAGS = -Xcompiler -nostdlib + +if USE_LIBTOOL +noinst_LTLIBRARIES = libiconv.la +libiconv_la_SOURCES = $(LIB_SOURCES) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(LIB_SOURCES) +noinst_DATA = +endif # USE_LIBTOOL + +include $(srcdir)/../../../../Makefile.shared diff --git a/newlib/libc/sys/linux/iconv/Makefile.in b/newlib/libc/sys/linux/iconv/Makefile.in new file mode 100644 index 000000000..a20b37805 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/Makefile.in @@ -0,0 +1,375 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LINUX_MACH_LIB = @LINUX_MACH_LIB@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +aext = @aext@ +libm_machine_dir = @libm_machine_dir@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -DGCONV_DIR='"$(pkglibdir)"' -DGCONV_PATH='"$(pkglibdir)"' -I$(srcdir) -I$(srcdir)/.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +LIB_SOURCES = \ + iconv.h gconv.h \ + iconv_open.c iconv.c iconv_close.c \ + gconv_open.c gconv.c gconv_close.c \ + gconv_db.c gconv_dl.c gconv_conf.c gconv_builtin.c \ + gconv_simple.c gconv_trans.c gconv_cache.c + + +libiconv_la_CFLAGS = +libiconv_la_LDFLAGS = -Xcompiler -nostdlib + +@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libiconv.la +@USE_LIBTOOL_TRUE@libiconv_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) +@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in +@USE_LIBTOOL_FALSE@noinst_DATA = +@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a +@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +lib_a_LIBADD = +@USE_LIBTOOL_FALSE@lib_a_OBJECTS = iconv_open.$(OBJEXT) iconv.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@iconv_close.$(OBJEXT) gconv_open.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@gconv.$(OBJEXT) gconv_close.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@gconv_db.$(OBJEXT) gconv_dl.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@gconv_conf.$(OBJEXT) gconv_builtin.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@gconv_simple.$(OBJEXT) gconv_trans.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@gconv_cache.$(OBJEXT) +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libiconv_la_LIBADD = +@USE_LIBTOOL_TRUE@libiconv_la_OBJECTS = iconv_open.lo iconv.lo \ +@USE_LIBTOOL_TRUE@iconv_close.lo gconv_open.lo gconv.lo gconv_close.lo \ +@USE_LIBTOOL_TRUE@gconv_db.lo gconv_dl.lo gconv_conf.lo \ +@USE_LIBTOOL_TRUE@gconv_builtin.lo gconv_simple.lo gconv_trans.lo \ +@USE_LIBTOOL_TRUE@gconv_cache.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(noinst_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(lib_a_SOURCES) $(libiconv_la_SOURCES) +OBJECTS = $(lib_a_OBJECTS) $(libiconv_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../Makefile.shared + cd $(top_srcdir) && $(AUTOMAKE) --cygnus iconv/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) + -rm -f lib.a + $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +mostlyclean-noinstLTLIBRARIES: + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + +distclean-noinstLTLIBRARIES: + +maintainer-clean-noinstLTLIBRARIES: + +libiconv.la: $(libiconv_la_OBJECTS) $(libiconv_la_DEPENDENCIES) + $(LINK) $(libiconv_la_LDFLAGS) $(libiconv_la_OBJECTS) $(libiconv_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = iconv + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ + clean-noinstLTLIBRARIES clean-tags clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstLIBRARIES distclean-compile \ + distclean-libtool distclean-noinstLTLIBRARIES \ + distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-noinstLTLIBRARIES \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ +distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ +maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-info-am install-info \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/libc/sys/linux/iconv/categories.def b/newlib/libc/sys/linux/iconv/categories.def new file mode 100644 index 000000000..257fac73a --- /dev/null +++ b/newlib/libc/sys/linux/iconv/categories.def @@ -0,0 +1,344 @@ +/* Definition of all available locale categories and their items. -*- C -*- + Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* These definitions are used by the locale-related files in the C library + and the programs `localedef' and `locale'. + + The general format of the descriptions is like this: + + DEFINE_CATEGORY (ID, name, ( items ), setlocale-postload) + + where items itself is an array of entries in the form + + { ID, name, standard, value-type, min, max } + + The usage of the load, check, output functions depends on the individual + program code which loads this file. + + The various value types for the items are `string', `stringarray', `byte' + `bytearray', and `word'. These cover all possible values in the current + locale definitions. `min' and `max' can be individually used again. */ + +#ifndef NO_POSTLOAD +#define NO_POSTLOAD NULL +#endif + +DEFINE_CATEGORY +( + LC_COLLATE, "LC_COLLATE", + ( + DEFINE_ELEMENT (_NL_COLLATE_NRULES, "collate-nrules", std, word) + DEFINE_ELEMENT (_NL_COLLATE_RULESETS, "collate-rulesets", std, string) + DEFINE_ELEMENT (_NL_COLLATE_TABLEMB, "collate-tablemb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_WEIGHTMB, "collate-weightmb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_EXTRAMB, "collate-extramb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_INDIRECTMB, "collate-indirectmb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_TABLEWC, "collate-tablewc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_WEIGHTWC, "collate-weightwc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_EXTRAWC, "collate-extrawc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_INDIRECTWC, "collate-indirectwc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_SYMB_HASH_SIZEMB, "collate-symb-hash-sizemb", std, word) + DEFINE_ELEMENT (_NL_COLLATE_SYMB_TABLEMB, "collate-symb-tablemb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_SYMB_EXTRAMB, "collate-symb-extramb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_COLLSEQMB, "collate-collseqmb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_COLLSEQWC, "collate-collseqwc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_CODESET, "collate-codeset", std, string) + ), NO_POSTLOAD) + + +/* The actual definition of ctype is meaningless here. It is hard coded in + the code because it has to be handled very specially. Only the names of + the functions and the value types are important. */ +DEFINE_CATEGORY +( + LC_CTYPE, "LC_CTYPE", + ( + DEFINE_ELEMENT (_NL_CTYPE_CLASS, "ctype-class", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TOUPPER, "ctype-toupper", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TOLOWER, "ctype-tolower", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_CLASS32, "ctype-class32", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, stringlist, 10, 32) + DEFINE_ELEMENT (_NL_CTYPE_MAP_NAMES, "ctype-map-names", std, stringlist, 2, 32) + DEFINE_ELEMENT (_NL_CTYPE_WIDTH, "ctype-width", std, bytearray) + DEFINE_ELEMENT (_NL_CTYPE_MB_CUR_MAX, "ctype-mb-cur-max", std, word) + DEFINE_ELEMENT (_NL_CTYPE_CODESET_NAME, "charmap", std, string) + DEFINE_ELEMENT (_NL_CTYPE_TOUPPER32, "ctype-toupper32", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TOLOWER32, "ctype-tolower32", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_CLASS_OFFSET, "ctype-class-offset", std, word) + DEFINE_ELEMENT (_NL_CTYPE_MAP_OFFSET, "ctype-map-offset", std, word) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS_MB_LEN, "ctype-indigits_mb-len", std, word) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS0_MB, "ctype-indigits0_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS1_MB, "ctype-indigits1_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS2_MB, "ctype-indigits2_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS3_MB, "ctype-indigits3_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS4_MB, "ctype-indigits4_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS5_MB, "ctype-indigits5_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS6_MB, "ctype-indigits6_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS7_MB, "ctype-indigits7_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS8_MB, "ctype-indigits8_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS9_MB, "ctype-indigits9_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS_WC_LEN, "ctype-indigits_wc-len", std, word) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS0_WC, "ctype-indigits0_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS1_WC, "ctype-indigits1_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS2_WC, "ctype-indigits2_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS3_WC, "ctype-indigits3_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS4_WC, "ctype-indigits4_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS5_WC, "ctype-indigits5_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS6_WC, "ctype-indigits6_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS7_WC, "ctype-indigits7_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS8_WC, "ctype-indigits8_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS9_WC, "ctype-indigits9_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT0_MB, "ctype-outdigit0_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT1_MB, "ctype-outdigit1_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT2_MB, "ctype-outdigit2_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT3_MB, "ctype-outdigit3_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT4_MB, "ctype-outdigit4_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT5_MB, "ctype-outdigit5_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT6_MB, "ctype-outdigit6_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT7_MB, "ctype-outdigit7_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT8_MB, "ctype-outdigit8_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT9_MB, "ctype-outdigit9_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT0_WC, "ctype-outdigit0_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT1_WC, "ctype-outdigit1_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT2_WC, "ctype-outdigit2_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT3_WC, "ctype-outdigit3_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT4_WC, "ctype-outdigit4_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT5_WC, "ctype-outdigit5_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT6_WC, "ctype-outdigit6_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT7_WC, "ctype-outdigit7_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT8_WC, "ctype-outdigit8_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT9_WC, "ctype-outdigit9_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_TAB_SIZE, "ctype-translit-tab-size", std, word) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_FROM_IDX, "ctype-translit-from-idx", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_FROM_TBL, "ctype-translit-from-tbl", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_TO_IDX, "ctype-translit-to-idx", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_TO_TBL, "ctype-translit-to-tbl", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN, "ctype-translit-default-missing-len", std, word) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_DEFAULT_MISSING, "ctype-translit-default-missing", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE_LEN, "ctype-translit-ignore-len", std, word) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE, "ctype-translit-ignore", std, string) + ), _nl_postload_ctype) + + +DEFINE_CATEGORY +( + LC_MONETARY, "LC_MONETARY", + ( + DEFINE_ELEMENT (INT_CURR_SYMBOL, "int_curr_symbol", std, string) + DEFINE_ELEMENT (CURRENCY_SYMBOL, "currency_symbol", std, string) + DEFINE_ELEMENT (MON_DECIMAL_POINT, "mon_decimal_point", std, string) + DEFINE_ELEMENT (MON_THOUSANDS_SEP, "mon_thousands_sep", std, string) + DEFINE_ELEMENT (MON_GROUPING, "mon_grouping", std, bytearray) + DEFINE_ELEMENT (POSITIVE_SIGN, "positive_sign", std, string) + DEFINE_ELEMENT (NEGATIVE_SIGN, "negative_sign", std, string) + DEFINE_ELEMENT (INT_FRAC_DIGITS, "int_frac_digits", std, byte) + DEFINE_ELEMENT (FRAC_DIGITS, "frac_digits", std, byte) + DEFINE_ELEMENT (P_CS_PRECEDES, "p_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (P_SEP_BY_SPACE, "p_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (N_CS_PRECEDES, "n_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (N_SEP_BY_SPACE, "n_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (P_SIGN_POSN, "p_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (N_SIGN_POSN, "n_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (__INT_P_CS_PRECEDES, "int_p_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (__INT_P_SEP_BY_SPACE, "int_p_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (__INT_N_CS_PRECEDES, "int_n_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (__INT_N_SEP_BY_SPACE, "int_n_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (__INT_P_SIGN_POSN, "int_p_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (__INT_N_SIGN_POSN, "int_n_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_CURR_SYMBOL, "duo_int_curr_symbol", std, string) + DEFINE_ELEMENT (_NL_MONETARY_DUO_CURRENCY_SYMBOL, "duo_currency_symbol", std, string) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_FRAC_DIGITS, "duo_int_frac_digits", std, byte) + DEFINE_ELEMENT (_NL_MONETARY_DUO_FRAC_DIGITS, "duo_frac_digits", std, byte) + DEFINE_ELEMENT (_NL_MONETARY_DUO_P_CS_PRECEDES, "duo_p_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (_NL_MONETARY_DUO_P_SEP_BY_SPACE, "duo_p_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (_NL_MONETARY_DUO_N_CS_PRECEDES, "duo_n_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (_NL_MONETARY_DUO_N_SEP_BY_SPACE, "duo_n_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_P_CS_PRECEDES, "duo_int_p_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_P_SEP_BY_SPACE, "duo_int_p_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_N_CS_PRECEDES, "duo_int_n_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_N_SEP_BY_SPACE, "duo_int_n_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (_NL_MONETARY_DUO_P_SIGN_POSN, "duo_p_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_DUO_N_SIGN_POSN, "duo_n_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_P_SIGN_POSN, "duo_int_p_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_N_SIGN_POSN, "duo_int_n_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_UNO_VALID_FROM, "uno_valid_from", std, word) + DEFINE_ELEMENT (_NL_MONETARY_UNO_VALID_TO, "uno_valid_to", std, word) + DEFINE_ELEMENT (_NL_MONETARY_DUO_VALID_FROM, "duo_valid_from", std, word) + DEFINE_ELEMENT (_NL_MONETARY_DUO_VALID_TO, "duo_valid_to", std, word) + DEFINE_ELEMENT (_NL_MONETARY_CONVERSION_RATE, "conversion_rate", std, wordarray, 2, 2) + DEFINE_ELEMENT (_NL_MONETARY_DECIMAL_POINT_WC, "monetary-decimal-point-wc", std, word) + DEFINE_ELEMENT (_NL_MONETARY_THOUSANDS_SEP_WC, "monetary-thousands-sep-wc", std, word) + DEFINE_ELEMENT (_NL_MONETARY_CODESET, "monetary-codeset", std, string) + ), NO_POSTLOAD) + + +DEFINE_CATEGORY +( + LC_NUMERIC, "LC_NUMERIC", + ( + DEFINE_ELEMENT (DECIMAL_POINT, "decimal_point", std, string) + DEFINE_ELEMENT (THOUSANDS_SEP, "thousands_sep", std, string) + DEFINE_ELEMENT (GROUPING, "grouping", std, bytearray) + DEFINE_ELEMENT (_NL_NUMERIC_DECIMAL_POINT_WC, "numeric-decimal-point-wc", std, word) + DEFINE_ELEMENT (_NL_NUMERIC_THOUSANDS_SEP_WC, "numeric-thousands-sep-wc", std, word) + DEFINE_ELEMENT (_NL_NUMERIC_CODESET, "numeric-codeset", std, string) + + ), NO_POSTLOAD) + + +DEFINE_CATEGORY +( + LC_TIME, "LC_TIME", + ( + DEFINE_ELEMENT (ABDAY_1, "abday", std, stringarray, 7, 7) + DEFINE_ELEMENT (DAY_1, "day", std, stringarray, 7, 7) + DEFINE_ELEMENT (ABMON_1, "abmon", std, stringarray, 12, 12) + DEFINE_ELEMENT (MON_1, "mon", std, stringarray, 12, 12) + DEFINE_ELEMENT (AM_STR, "am_pm", std, stringarray, 2, 2) + DEFINE_ELEMENT (D_T_FMT, "d_t_fmt", std, string) + DEFINE_ELEMENT (D_FMT, "d_fmt", std, string) + DEFINE_ELEMENT (T_FMT, "t_fmt", std, string) + DEFINE_ELEMENT (T_FMT_AMPM, "t_fmt_ampm", std, string) + DEFINE_ELEMENT (ERA, "era", opt, stringlist, 0, 100) + DEFINE_ELEMENT (ERA_YEAR, "era_year", opt, string) + DEFINE_ELEMENT (ERA_D_FMT, "era_d_fmt", opt, string) + DEFINE_ELEMENT (ALT_DIGITS, "alt_digits", opt, stringlist, 100, 100) + DEFINE_ELEMENT (ERA_D_T_FMT, "era_d_t_fmt", opt, string) + DEFINE_ELEMENT (ERA_T_FMT, "era_t_fmt", opt, string) + DEFINE_ELEMENT (_NL_TIME_ERA_NUM_ENTRIES, "time-era-num-entries", opt, word) + DEFINE_ELEMENT (_NL_TIME_ERA_ENTRIES, "time-era-entries", opt, string) + DEFINE_ELEMENT (_NL_WABDAY_1, "wide-abday", std, wstringarray, 7, 7) + DEFINE_ELEMENT (_NL_WDAY_1, "wide-day", std, wstringarray, 7, 7) + DEFINE_ELEMENT (_NL_WABMON_1, "wide-abmon", std, wstringarray, 12, 12) + DEFINE_ELEMENT (_NL_WMON_1, "wide-mon", std, wstringarray, 12, 12) + DEFINE_ELEMENT (_NL_WAM_STR, "wide-am_pm", std, wstringarray, 2, 2) + DEFINE_ELEMENT (_NL_WD_T_FMT, "wide-d_t_fmt", std, wstring) + DEFINE_ELEMENT (_NL_WD_FMT, "wide-d_fmt", std, wstring) + DEFINE_ELEMENT (_NL_WT_FMT, "wide-t_fmt", std, wstring) + DEFINE_ELEMENT (_NL_WT_FMT_AMPM, "wide-t_fmt_ampm", std, wstring) + DEFINE_ELEMENT (_NL_WERA_YEAR, "wide-era_year", opt, wstring) + DEFINE_ELEMENT (_NL_WERA_D_FMT, "wide-era_d_fmt", opt, wstring) + DEFINE_ELEMENT (_NL_WALT_DIGITS, "wide-alt_digits", opt, wstringlist, 1000, 100) + DEFINE_ELEMENT (_NL_WERA_D_T_FMT, "wide-era_d_t_fmt", opt, wstring) + DEFINE_ELEMENT (_NL_WERA_T_FMT, "wide-era_t_fmt", opt, wstring) + DEFINE_ELEMENT (_NL_TIME_WEEK_NDAYS, "week-ndays", std, byte) + DEFINE_ELEMENT (_NL_TIME_WEEK_1STDAY, "week-1stday", std, word) + DEFINE_ELEMENT (_NL_TIME_WEEK_1STWEEK, "week-1stweek", std, byte) + DEFINE_ELEMENT (_NL_TIME_FIRST_WEEKDAY, "first_weekday", std, byte) + DEFINE_ELEMENT (_NL_TIME_FIRST_WORKDAY, "first_workday", std, byte) + DEFINE_ELEMENT (_NL_TIME_CAL_DIRECTION, "cal_direction", std, byte) + DEFINE_ELEMENT (_NL_TIME_TIMEZONE, "timezone", std, string) + DEFINE_ELEMENT (_DATE_FMT, "date_fmt", opt, string) + DEFINE_ELEMENT (_NL_W_DATE_FMT, "wide-date_fmt", opt, wstring) + DEFINE_ELEMENT (_NL_TIME_CODESET, "time-codeset", std, string) + ), _nl_postload_time) + + +DEFINE_CATEGORY +( + LC_MESSAGES, "LC_MESSAGES", + ( + DEFINE_ELEMENT (YESEXPR, "yesexpr", std, string) + DEFINE_ELEMENT (NOEXPR, "noexpr", std, string) + DEFINE_ELEMENT (YESSTR, "yesstr", opt, string) + DEFINE_ELEMENT (NOSTR, "nostr", opt, string) + DEFINE_ELEMENT (_NL_MESSAGES_CODESET, "messages-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_PAPER, "LC_PAPER", + ( + DEFINE_ELEMENT (_NL_PAPER_HEIGHT, "height", std, word) + DEFINE_ELEMENT (_NL_PAPER_WIDTH, "width", std, word) + DEFINE_ELEMENT (_NL_PAPER_CODESET, "paper-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_NAME, "LC_NAME", + ( + DEFINE_ELEMENT (_NL_NAME_NAME_FMT, "name_fmt", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_GEN, "name_gen", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_MR, "name_mr", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_MRS, "name_mrs", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_MISS, "name_miss", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_MS, "name_ms", std, string) + DEFINE_ELEMENT (_NL_NAME_CODESET, "name-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_ADDRESS, "LC_ADDRESS", + ( + DEFINE_ELEMENT (_NL_ADDRESS_POSTAL_FMT, "postal_fmt", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_NAME, "country_name", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_POST, "country_post", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_AB2, "country_ab2", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_AB3, "country_ab3", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_CAR, "country_car", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_NUM, "country_num", std, word) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_ISBN, "country_isbn", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_LANG_NAME, "lang_name", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_LANG_AB, "lang_ab", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_LANG_TERM, "lang_term", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_LANG_LIB, "lang_lib", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_CODESET, "address-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_TELEPHONE, "LC_TELEPHONE", + ( + DEFINE_ELEMENT (_NL_TELEPHONE_TEL_INT_FMT, "tel_int_fmt", std, string) + DEFINE_ELEMENT (_NL_TELEPHONE_TEL_DOM_FMT, "tel_dom_fmt", std, string) + DEFINE_ELEMENT (_NL_TELEPHONE_INT_SELECT, "int_select", std, string) + DEFINE_ELEMENT (_NL_TELEPHONE_INT_PREFIX, "int_prefix", std, string) + DEFINE_ELEMENT (_NL_TELEPHONE_CODESET, "telephone-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_MEASUREMENT, "LC_MEASUREMENT", + ( + DEFINE_ELEMENT (_NL_MEASUREMENT_MEASUREMENT, "measurement", std, byte) + DEFINE_ELEMENT (_NL_MEASUREMENT_CODESET, "measurement-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_IDENTIFICATION, "LC_IDENTIFICATION", + ( + DEFINE_ELEMENT (_NL_IDENTIFICATION_TITLE, "title", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_SOURCE, "source", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_ADDRESS, "address", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_CONTACT, "contact", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_EMAIL, "email", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_TEL, "tel", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_FAX, "fax", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_LANGUAGE, "language", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_TERRITORY, "territory", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_AUDIENCE, "audience", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_APPLICATION, "applcation", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_ABBREVIATION, "abbreviation", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_REVISION, "revision", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_DATE, "date", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_CATEGORY, "category", std, stringarray, 13, 13) + DEFINE_ELEMENT (_NL_IDENTIFICATION_CODESET, "identification-codeset", std, string) + ), NO_POSTLOAD) diff --git a/newlib/libc/sys/linux/iconv/dummy-repertoire.c b/newlib/libc/sys/linux/iconv/dummy-repertoire.c new file mode 100644 index 000000000..a195460f9 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/dummy-repertoire.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* For iconv we don't have to handle repertoire maps. Provide dummy + definitions to allow the use of linereader.c unchanged. */ +#include + + +uint32_t +repertoire_find_value (const struct repertoire_t *repertoire, const char *name, + size_t len) +{ + return ILLEGAL_CHAR_VALUE; +} + + +const char * +repertoire_find_symbol (const struct repertoire_t *repertoire, uint32_t ucs) +{ + return NULL; +} diff --git a/newlib/libc/sys/linux/iconv/gconv.c b/newlib/libc/sys/linux/iconv/gconv.c new file mode 100644 index 000000000..b413e26c5 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv.c @@ -0,0 +1,73 @@ +/* Convert characters in input buffer using conversion descriptor to + output buffer. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + +int +internal_function +__gconv (__gconv_t cd, const unsigned char **inbuf, + const unsigned char *inbufend, unsigned char **outbuf, + unsigned char *outbufend, size_t *irreversible) +{ + size_t last_step; + int result; + + if (cd == (__gconv_t) -1L) + return __GCONV_ILLEGAL_DESCRIPTOR; + + last_step = cd->__nsteps - 1; + + assert (irreversible != NULL); + *irreversible = 0; + + cd->__data[last_step].__outbuf = outbuf != NULL ? *outbuf : NULL; + cd->__data[last_step].__outbufend = outbufend; + + if (inbuf == NULL || *inbuf == NULL) + /* We just flush. */ + result = cd->__steps->__fct (cd->__steps, cd->__data, NULL, NULL, NULL, + irreversible, + cd->__data[last_step].__outbuf == NULL ? 2 : 1, 0); + else + { + const unsigned char *last_start; + + assert (outbuf != NULL && *outbuf != NULL); + + do + { + last_start = *inbuf; + result = cd->__steps->__fct (cd->__steps, cd->__data, inbuf, inbufend, + NULL, irreversible, 0, 0); + } + while (result == __GCONV_EMPTY_INPUT && last_start != *inbuf + && *inbuf + cd->__steps->__min_needed_from <= inbufend); + } + + if (outbuf != NULL && *outbuf != NULL) + *outbuf = cd->__data[last_step].__outbuf; + + return result; +} diff --git a/newlib/libc/sys/linux/iconv/gconv_builtin.c b/newlib/libc/sys/linux/iconv/gconv_builtin.c new file mode 100644 index 000000000..45bd4e7e0 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_builtin.c @@ -0,0 +1,84 @@ +/* Table for builtin transformation mapping. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +#include + +#include + + +static struct builtin_map +{ + const char *name; + __gconv_fct fct; + + int min_needed_from; + int max_needed_from; + int min_needed_to; + int max_needed_to; + +} map[] = +{ +#define BUILTIN_TRANSFORMATION(From, To, Cost, Name, Fct, MinF, MaxF, \ + MinT, MaxT) \ + { \ + .name = Name, \ + .fct = Fct, \ + \ + .min_needed_from = MinF, \ + .max_needed_from = MaxF, \ + .min_needed_to = MinT, \ + .max_needed_to = MaxT \ + }, +#define BUILTIN_ALIAS(From, To) + +#include +}; + + +void +internal_function +__gconv_get_builtin_trans (const char *name, struct __gconv_step *step) +{ + size_t cnt; + + for (cnt = 0; cnt < sizeof (map) / sizeof (map[0]); ++cnt) + if (strcmp (name, map[cnt].name) == 0) + break; + + assert (cnt < sizeof (map) / sizeof (map[0])); + + step->__fct = map[cnt].fct; + step->__init_fct = NULL; + step->__end_fct = NULL; + step->__shlib_handle = NULL; + step->__modname = NULL; + + step->__min_needed_from = map[cnt].min_needed_from; + step->__max_needed_from = map[cnt].max_needed_from; + step->__min_needed_to = map[cnt].min_needed_to; + step->__max_needed_to = map[cnt].max_needed_to; + + /* None of the builtin converters handles stateful encoding. */ + step->__stateful = 0; +} diff --git a/newlib/libc/sys/linux/iconv/gconv_builtin.h b/newlib/libc/sys/linux/iconv/gconv_builtin.h new file mode 100644 index 000000000..1a9d8a80f --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_builtin.h @@ -0,0 +1,115 @@ +/* Builtin transformations. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +BUILTIN_ALIAS ("UCS4//", "ISO-10646/UCS4/") +BUILTIN_ALIAS ("UCS-4//", "ISO-10646/UCS4/") +BUILTIN_ALIAS ("UCS-4BE//", "ISO-10646/UCS4/") +BUILTIN_ALIAS ("CSUCS4//", "ISO-10646/UCS4/") +BUILTIN_ALIAS ("ISO-10646//", "ISO-10646/UCS4/") +BUILTIN_ALIAS ("10646-1:1993//", "ISO-10646/UCS4/") +BUILTIN_ALIAS ("10646-1:1993/UCS4/", "ISO-10646/UCS4/") +BUILTIN_ALIAS ("OSF00010104//", "ISO-10646/UCS4/") /* level 1 */ +BUILTIN_ALIAS ("OSF00010105//", "ISO-10646/UCS4/") /* level 2 */ +BUILTIN_ALIAS ("OSF00010106//", "ISO-10646/UCS4/") /* level 3 */ + +BUILTIN_TRANSFORMATION ("INTERNAL", "ISO-10646/UCS4/", 1, "=INTERNAL->ucs4", + __gconv_transform_internal_ucs4, 4, 4, 4, 4) +BUILTIN_TRANSFORMATION ("ISO-10646/UCS4/", "INTERNAL", 1, "=ucs4->INTERNAL", + __gconv_transform_ucs4_internal, 4, 4, 4, 4) + +BUILTIN_TRANSFORMATION ("INTERNAL", "UCS-4LE//", 1, "=INTERNAL->ucs4le", + __gconv_transform_internal_ucs4le, 4, 4, 4, 4) +BUILTIN_TRANSFORMATION ("UCS-4LE//", "INTERNAL", 1, "=ucs4le->INTERNAL", + __gconv_transform_ucs4le_internal, 4, 4, 4, 4) + +BUILTIN_ALIAS ("WCHAR_T//", "INTERNAL") + +BUILTIN_ALIAS ("UTF8//", "ISO-10646/UTF8/") +BUILTIN_ALIAS ("UTF-8//", "ISO-10646/UTF8/") +BUILTIN_ALIAS ("ISO-IR-193//", "ISO-10646/UTF8/") +BUILTIN_ALIAS ("OSF05010001//", "ISO-10646/UTF8/") +BUILTIN_ALIAS ("ISO-10646/UTF-8/", "ISO-10646/UTF8/") + +BUILTIN_TRANSFORMATION ("INTERNAL", "ISO-10646/UTF8/", 1, "=INTERNAL->utf8", + __gconv_transform_internal_utf8, 4, 4, 1, 6) + +BUILTIN_TRANSFORMATION ("ISO-10646/UTF8/", "INTERNAL", 1, "=utf8->INTERNAL", + __gconv_transform_utf8_internal, 1, 6, 4, 4) + +BUILTIN_ALIAS ("UCS2//", "ISO-10646/UCS2/") +BUILTIN_ALIAS ("UCS-2//", "ISO-10646/UCS2/") +BUILTIN_ALIAS ("OSF00010100//", "ISO-10646/UCS2/") /* level 1 */ +BUILTIN_ALIAS ("OSF00010101//", "ISO-10646/UCS2/") /* level 2 */ +BUILTIN_ALIAS ("OSF00010102//", "ISO-10646/UCS2/") /* level 3 */ + +BUILTIN_TRANSFORMATION ("ISO-10646/UCS2/", "INTERNAL", 1, "=ucs2->INTERNAL", + __gconv_transform_ucs2_internal, 2, 2, 4, 4) + +BUILTIN_TRANSFORMATION ("INTERNAL", "ISO-10646/UCS2/", 1, "=INTERNAL->ucs2", + __gconv_transform_internal_ucs2, 4, 4, 2, 2) + + +BUILTIN_ALIAS ("ANSI_X3.4//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("ISO-IR-6//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("ANSI_X3.4-1986//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("ISO_646.IRV:1991//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("ASCII//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("ISO646-US//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("US-ASCII//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("US//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("IBM367//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("CP367//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("CSASCII//", "ANSI_X3.4-1968//") +BUILTIN_ALIAS ("OSF00010020//", "ANSI_X3.4-1968//") + +BUILTIN_TRANSFORMATION ("ANSI_X3.4-1968//", "INTERNAL", 1, "=ascii->INTERNAL", + __gconv_transform_ascii_internal, 4, 4, 1, 1) + +BUILTIN_TRANSFORMATION ("INTERNAL", "ANSI_X3.4-1968//", 1, "=INTERNAL->ascii", + __gconv_transform_internal_ascii, 4, 4, 1, 1) + + +#if BYTE_ORDER == BIG_ENDIAN +BUILTIN_ALIAS ("UNICODEBIG//", "ISO-10646/UCS2/") +BUILTIN_ALIAS ("UCS-2BE//", "ISO-10646/UCS2/") + +BUILTIN_ALIAS ("UCS-2LE//", "UNICODELITTLE//") + +BUILTIN_TRANSFORMATION ("UNICODELITTLE//", "INTERNAL", 1, + "=ucs2reverse->INTERNAL", + __gconv_transform_ucs2reverse_internal, 2, 2, 4, 4) + +BUILTIN_TRANSFORMATION ("INTERNAL", "UNICODELITTLE//", 1, + "=INTERNAL->ucs2reverse", + __gconv_transform_internal_ucs2reverse, 4, 4, 2, 2) +#else +BUILTIN_ALIAS ("UNICODELITTLE//", "ISO-10646/UCS2/") +BUILTIN_ALIAS ("UCS-2LE//", "ISO-10646/UCS2/") + +BUILTIN_ALIAS ("UCS-2BE//", "UNICODEBIG//") + +BUILTIN_TRANSFORMATION ("UNICODEBIG//", "INTERNAL", 1, + "=ucs2reverse->INTERNAL", + __gconv_transform_ucs2reverse_internal, 2, 2, 4, 4) + +BUILTIN_TRANSFORMATION ("INTERNAL", "UNICODEBIG//", 1, + "=INTERNAL->ucs2reverse", + __gconv_transform_internal_ucs2reverse, 4, 4, 2, 2) +#endif diff --git a/newlib/libc/sys/linux/iconv/gconv_cache.c b/newlib/libc/sys/linux/iconv/gconv_cache.c new file mode 100644 index 000000000..c887be970 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_cache.c @@ -0,0 +1,459 @@ +/* Cache handling for iconv modules. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "hash-string.h" + +void *__gconv_cache; +static size_t cache_size; +static int cache_malloced; + + +int +internal_function +__gconv_load_cache (void) +{ + int fd; + struct stat64 st; + struct gconvcache_header *header; + + /* We cannot use the cache if the GCONV_PATH environment variable is + set. */ + __gconv_path_envvar = getenv ("GCONV_PATH"); + if (__gconv_path_envvar != NULL) + return -1; + + /* See whether the cache file exists. */ + fd = open (GCONV_MODULES_CACHE, O_RDONLY); + if (__builtin_expect (fd, 0) == -1) + /* Not available. */ + return -1; + +#ifdef _POSIX_ASYNC_IO + /* Get information about the file. */ + if (__builtin_expect (fstat64 (fd, &st), 0) < 0 + /* We do not have to start looking at the file if it cannot contain + at least the cache header. */ + || st.st_size < sizeof (struct gconvcache_header)) + { +#endif + close_and_exit: + close (fd); + return -1; +#ifdef _POSIX_ASYNC_IO + } +#endif + + /* Make the file content available. */ + cache_size = st.st_size; +#ifdef _POSIX_MAPPED_FILES + __gconv_cache = mmap (NULL, cache_size, PROT_READ, MAP_SHARED, fd, 0); + if (__builtin_expect (__gconv_cache == MAP_FAILED, 0)) +#endif + { + size_t already_read; + + __gconv_cache = malloc (cache_size); + if (__gconv_cache == NULL) + goto close_and_exit; + + already_read = 0; + do + { + ssize_t n = read (fd, (char *) __gconv_cache + already_read, + cache_size - already_read); + if (__builtin_expect (n, 0) == -1) + { + free (__gconv_cache); + __gconv_cache = NULL; + goto close_and_exit; + } + + already_read += n; + } + while (already_read < cache_size); + + cache_malloced = 1; + } + + /* We don't need the file descriptor anymore. */ + close (fd); + + /* Check the consistency. */ + header = (struct gconvcache_header *) __gconv_cache; + if (__builtin_expect (header->magic, GCONVCACHE_MAGIC) != GCONVCACHE_MAGIC + || __builtin_expect (header->string_offset >= cache_size, 0) + || __builtin_expect (header->hash_offset >= cache_size, 0) + || __builtin_expect (header->hash_size == 0, 0) + || __builtin_expect ((header->hash_offset + + header->hash_size * sizeof (struct hash_entry)) + > cache_size, 0) + || __builtin_expect (header->module_offset >= cache_size, 0) + || __builtin_expect (header->otherconv_offset > cache_size, 0)) + { + if (cache_malloced) + { + free (__gconv_cache); + cache_malloced = 0; + } +#ifdef _POSIX_MAPPED_FILES + else + __munmap (__gconv_cache, cache_size); +#endif + __gconv_cache = NULL; + + return -1; + } + + /* That worked. */ + return 0; +} + + +static int +internal_function +find_module_idx (const char *str, size_t *idxp) +{ + unsigned int idx; + unsigned int hval; + unsigned int hval2; + const struct gconvcache_header *header; + const char *strtab; + const struct hash_entry *hashtab; + unsigned int limit; + + header = (const struct gconvcache_header *) __gconv_cache; + strtab = (char *) __gconv_cache + header->string_offset; + hashtab = (struct hash_entry *) ((char *) __gconv_cache + + header->hash_offset); + + hval = hash_string (str); + idx = hval % header->hash_size; + hval2 = 1 + hval % (header->hash_size - 2); + + limit = cache_size - header->string_offset; + while (hashtab[idx].string_offset != 0) + if (hashtab[idx].string_offset < limit + && strcmp (str, strtab + hashtab[idx].string_offset) == 0) + { + *idxp = hashtab[idx].module_idx; + return 0; + } + else + if ((idx += hval2) >= header->hash_size) + idx -= header->hash_size; + + /* Nothing found. */ + return -1; +} + + +#ifndef STATIC_GCONV +static int +internal_function +find_module (const char *directory, const char *filename, + struct __gconv_step *result) +{ + size_t dirlen = strlen (directory); + size_t fnamelen = strlen (filename) + 1; + char fullname[dirlen + fnamelen]; + int status = __GCONV_NOCONV; + char *tmp; + + tmp = mempcpy (fullname, directory, dirlen); + tmp += dirlen; + memcpy (tmp, filename, fnamelen); + + result->__shlib_handle = __gconv_find_shlib (fullname); + if (result->__shlib_handle != NULL) + { + status = __GCONV_OK; + + result->__modname = NULL; + result->__fct = result->__shlib_handle->fct; + result->__init_fct = result->__shlib_handle->init_fct; + result->__end_fct = result->__shlib_handle->end_fct; + + result->__data = NULL; + if (result->__init_fct != NULL) + status = result->__init_fct (result); + } + + return status; +} +#endif + + +int +internal_function +__gconv_compare_alias_cache (const char *name1, const char *name2, int *result) +{ + size_t name1_idx; + size_t name2_idx; + + if (__gconv_cache == NULL) + return -1; + + if (find_module_idx (name1, &name1_idx) != 0 + || find_module_idx (name2, &name2_idx) != 0) + *result = strcmp (name1, name2); + else + *result = (int) (name1_idx - name2_idx); + + return 0; +} + + +int +internal_function +__gconv_lookup_cache (const char *toset, const char *fromset, + struct __gconv_step **handle, size_t *nsteps, int flags) +{ + const struct gconvcache_header *header; + const char *strtab; + size_t fromidx; + size_t toidx; + const struct module_entry *modtab; + const struct module_entry *from_module; + const struct module_entry *to_module; + struct __gconv_step *result; + + if (__gconv_cache == NULL) + /* We have no cache available. */ + return __GCONV_NODB; + + header = (const struct gconvcache_header *) __gconv_cache; + strtab = (char *) __gconv_cache + header->string_offset; + modtab = (const struct module_entry *) ((char *) __gconv_cache + + header->module_offset); + + if (find_module_idx (fromset, &fromidx) != 0 + || (header->module_offset + (fromidx + 1) * sizeof (struct module_entry) + > cache_size)) + return __GCONV_NOCONV; + from_module = &modtab[fromidx]; + + if (find_module_idx (toset, &toidx) != 0 + || (header->module_offset + (toidx + 1) * sizeof (struct module_entry) + > cache_size)) + return __GCONV_NOCONV; + to_module = &modtab[toidx]; + + /* Avoid copy-only transformations if the user requests. */ + if (__builtin_expect (flags & GCONV_AVOID_NOCONV, 0) && fromidx == toidx) + return __GCONV_NOCONV; + + /* If there are special conversions available examine them first. */ + if (fromidx != 0 && toidx != 0 + && __builtin_expect (from_module->extra_offset, 0) != 0) + { + /* Search through the list to see whether there is a module + matching the destination character set. */ + const struct extra_entry *extra; + + /* Note the -1. This is due to the offset added in iconvconfig. + See there for more explanations. */ + extra = (const struct extra_entry *) ((char *) __gconv_cache + + header->otherconv_offset + + from_module->extra_offset - 1); + while (extra->module_cnt != 0 + && extra->module[extra->module_cnt - 1].outname_offset != toidx) + extra = (const struct extra_entry *) ((char *) extra + + sizeof (struct extra_entry) + + (extra->module_cnt + * sizeof (struct extra_entry_module))); + + if (extra->module_cnt != 0) + { + /* Use the extra module. First determine how many steps. */ + char *fromname; + int idx; + + *nsteps = extra->module_cnt; + *handle = result = + (struct __gconv_step *) malloc (extra->module_cnt + * sizeof (struct __gconv_step)); + if (result == NULL) + return __GCONV_NOMEM; + + fromname = (char *) strtab + from_module->canonname_offset; + idx = 0; + do + { + result[idx].__from_name = fromname; + fromname = result[idx].__to_name = + (char *) strtab + modtab[extra->module[idx].outname_offset].canonname_offset; + + result[idx].__counter = 1; + result[idx].__data = NULL; + +#ifndef STATIC_GCONV + if (strtab[extra->module[idx].dir_offset] != '\0') + { + /* Load the module, return handle for it. */ + int res; + + res = find_module (strtab + extra->module[idx].dir_offset, + strtab + extra->module[idx].name_offset, + &result[idx]); + if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK) + { + /* Something went wrong. */ + free (result); + goto try_internal; + } + } + else +#endif + /* It's a builtin transformation. */ + __gconv_get_builtin_trans (strtab + + extra->module[idx].name_offset, + &result[idx]); + + } + while (++idx < extra->module_cnt); + + return __GCONV_OK; + } + } + + try_internal: + /* See whether we can convert via the INTERNAL charset. */ + if ((fromidx != 0 && __builtin_expect (from_module->fromname_offset, 1) == 0) + || (toidx != 0 && __builtin_expect (to_module->toname_offset, 1) == 0) + || (fromidx == 0 && toidx == 0)) + /* Not possible. Nothing we can do. */ + return __GCONV_NOCONV; + + /* We will use up to two modules. Always allocate room for two. */ + result = (struct __gconv_step *) malloc (2 * sizeof (struct __gconv_step)); + if (result == NULL) + return __GCONV_NOMEM; + + *handle = result; + *nsteps = 0; + + /* Generate data structure for conversion to INTERNAL. */ + if (fromidx != 0) + { + result[0].__from_name = (char *) strtab + from_module->canonname_offset; + result[0].__to_name = (char *) "INTERNAL"; + + result[0].__counter = 1; + result[0].__data = NULL; + +#ifndef STATIC_GCONV + if (strtab[from_module->todir_offset] != '\0') + { + /* Load the module, return handle for it. */ + int res = find_module (strtab + from_module->todir_offset, + strtab + from_module->toname_offset, + &result[0]); + if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK) + { + /* Something went wrong. */ + free (result); + return res; + } + } + else +#endif + /* It's a builtin transformation. */ + __gconv_get_builtin_trans (strtab + from_module->toname_offset, + &result[0]); + + ++*nsteps; + } + + /* Generate data structure for conversion from INTERNAL. */ + if (toidx != 0) + { + int idx = *nsteps; + + result[idx].__from_name = (char *) "INTERNAL"; + result[idx].__to_name = (char *) strtab + to_module->canonname_offset; + + result[idx].__counter = 1; + result[idx].__data = NULL; + +#ifndef STATIC_GCONV + if (strtab[to_module->fromdir_offset] != '\0') + { + /* Load the module, return handle for it. */ + int res = find_module (strtab + to_module->fromdir_offset, + strtab + to_module->fromname_offset, + &result[idx]); + if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK) + { + /* Something went wrong. */ + if (idx != 0) + __gconv_release_step (&result[0]); + free (result); + return res; + } + } + else +#endif + /* It's a builtin transformation. */ + __gconv_get_builtin_trans (strtab + to_module->fromname_offset, + &result[idx]); + + ++*nsteps; + } + + return __GCONV_OK; +} + + +/* Free memory allocated for the transformation record. */ +void +internal_function +__gconv_release_cache (struct __gconv_step *steps, size_t nsteps) +{ + if (__gconv_cache != NULL) + /* The only thing we have to deallocate is the record with the + steps. */ + free (steps); +} + + +/* Free all resources if necessary. */ +static void __attribute__ ((unused)) +free_mem (void) +{ + if (cache_malloced) + free (__gconv_cache); +#ifdef _POSIX_MAPPED_FILES + else + __munmap (__gconv_cache, cache_size); +#endif +} + +text_set_element (__libc_subfreeres, free_mem); diff --git a/newlib/libc/sys/linux/iconv/gconv_charset.h b/newlib/libc/sys/linux/iconv/gconv_charset.h new file mode 100644 index 000000000..706669825 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_charset.h @@ -0,0 +1,73 @@ +/* Charset name normalization. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +static inline void +strip (char *wp, const char *s) +{ + int slash_count = 0; + char old_locale[20], *old_locale_p; + + /* Set locale to default C locale. */ + old_locale_p = setlocale(LC_ALL, "C"); + strncpy(old_locale, old_locale_p, 20); + while (*s != '\0') + { + if (isalnum (*s) + || *s == '_' || *s == '-' || *s == '.') + *wp++ = toupper (*s); + else if (*s == '/') + { + if (++slash_count == 3) + break; + *wp++ = '/'; + } + ++s; + } + + while (slash_count++ < 2) + *wp++ = '/'; + + *wp = '\0'; + setlocale(LC_ALL, old_locale); +} + + +static char * __attribute__ ((unused)) +upstr (char *dst, const char *str) +{ + char *cp = dst; + char old_locale[20], *old_locale_p; + /* Set locale to default C locale. */ + old_locale_p = setlocale(LC_ALL, "C"); + strncpy(old_locale, old_locale_p, 20); + while ((*cp++ = toupper (*str++)) != '\0') + /* nothing */; + setlocale(LC_ALL, old_locale); + return dst; +} + + +/* If NAME is an codeset alias expand it. */ +extern int __gconv_compare_alias (const char *name1, const char *name2) + internal_function; diff --git a/newlib/libc/sys/linux/iconv/gconv_close.c b/newlib/libc/sys/linux/iconv/gconv_close.c new file mode 100644 index 000000000..cc0ecd650 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_close.c @@ -0,0 +1,65 @@ +/* Release any resource associated with given conversion descriptor. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include + + +int +internal_function +__gconv_close (__gconv_t cd) +{ + struct __gconv_step *srunp; + struct __gconv_step_data *drunp; + size_t nsteps; + + /* Free all resources by calling destructor functions and release + the implementations. */ + srunp = cd->__steps; + nsteps = cd->__nsteps; + drunp = cd->__data; + do + { + struct __gconv_trans_data *transp; + + transp = drunp->__trans; + while (transp != NULL) + { + struct __gconv_trans_data *curp = transp; + transp = transp->__next; + + if (__builtin_expect (curp->__trans_end_fct != NULL, 0)) + curp->__trans_end_fct (curp->__data); + + free (curp); + } + + if (!(drunp->__flags & __GCONV_IS_LAST) && drunp->__outbuf != NULL) + free (drunp->__outbuf); + } + while (!((drunp++)->__flags & __GCONV_IS_LAST)); + + /* Free the data allocated for the descriptor. */ + free (cd); + + /* Close the participating modules. */ + return __gconv_close_transform (srunp, nsteps); +} diff --git a/newlib/libc/sys/linux/iconv/gconv_conf.c b/newlib/libc/sys/linux/iconv/gconv_conf.c new file mode 100644 index 000000000..c714102a3 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_conf.c @@ -0,0 +1,680 @@ +/* Handle configuration data. + Copyright (C) 1997,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* This is the default path where we look for module lists. */ +static const char default_gconv_path[] = GCONV_PATH; + +/* The path elements, as determined by the __gconv_get_path function. + All path elements end in a slash. */ +struct path_elem *__gconv_path_elem; +/* Maximum length of a single path element in __gconv_path_elem. */ +size_t __gconv_max_path_elem_len; + +/* We use the following struct if we couldn't allocate memory. */ +static const struct path_elem empty_path_elem; + +/* Name of the file containing the module information in the directories + along the path. */ +static const char gconv_conf_filename[] = "gconv-modules"; + +/* Filename extension for the modules. */ +#ifndef MODULE_EXT +# define MODULE_EXT ".so" +#endif +static const char gconv_module_ext[] = MODULE_EXT; + +/* We have a few builtin transformations. */ +static struct gconv_module builtin_modules[] = +{ +#define BUILTIN_TRANSFORMATION(From, To, Cost, Name, Fct, MinF, MaxF, \ + MinT, MaxT) \ + { \ + from_string: From, \ + to_string: To, \ + cost_hi: Cost, \ + cost_lo: INT_MAX, \ + module_name: Name \ + }, +#define BUILTIN_ALIAS(From, To) + +#include "gconv_builtin.h" +}; + +#undef BUILTIN_TRANSFORMATION +#undef BUILTIN_ALIAS + +static const char *builtin_aliases[] = +{ +#define BUILTIN_TRANSFORMATION(From, To, Cost, Name, Fct, MinF, MaxF, \ + MinT, MaxT) +#define BUILTIN_ALIAS(From, To) From " " To, + +#include "gconv_builtin.h" +}; + +#ifdef USE_IN_LIBIO +# include +# define __getdelim(line, len, c, fp) _IO_getdelim (line, len, c, fp) +#endif + + +/* Value of the GCONV_PATH environment variable. */ +const char *__gconv_path_envvar; + + +/* Test whether there is already a matching module known. */ +static int +internal_function +detect_conflict (const char *alias) +{ + struct gconv_module *node = __gconv_modules_db; + + while (node != NULL) + { + int cmpres = strcmp (alias, node->from_string); + + if (cmpres == 0) + /* We have a conflict. */ + return 1; + else if (cmpres < 0) + node = node->left; + else + node = node->right; + } + + return node != NULL; +} + + +/* Add new alias. */ +static inline void +add_alias (char *rp, void *modules) +{ + /* We now expect two more string. The strings are normalized + (converted to UPPER case) and strored in the alias database. */ + struct gconv_alias *new_alias; + char *from, *to, *wp; + char old_locale[20], *old_locale_p; + + /* Set locale to default C locale. */ + old_locale_p = setlocale(LC_ALL, "C"); + strncpy(old_locale, old_locale_p, 20); + + while (isspace (*rp)) + ++rp; + from = wp = rp; + while (*rp != '\0' && !isspace (*rp)) + *wp++ = toupper (*rp++); + if (*rp == '\0') + { + setlocale(LC_ALL, old_locale); + /* There is no `to' string on the line. Ignore it. */ + return; + } + *wp++ = '\0'; + to = ++rp; + while (isspace (*rp)) + ++rp; + while (*rp != '\0' && !isspace (*rp)) + *wp++ = toupper (*rp++); + if (to == wp) + { + setlocale(LC_ALL, old_locale); + /* No `to' string, ignore the line. */ + return; + } + *wp++ = '\0'; + + /* Test whether this alias conflicts with any available module. */ + if (detect_conflict (from)) + { + setlocale(LC_ALL, old_locale); + /* It does conflict, don't add the alias. */ + return; + } + + new_alias = (struct gconv_alias *) malloc (sizeof (struct gconv_alias) + (wp - from)); + if (new_alias != NULL) + { + void **inserted; + + new_alias->fromname = memcpy ((char *) new_alias + + sizeof (struct gconv_alias), + from, wp - from); + new_alias->toname = new_alias->fromname + (to - from); + + inserted = (void **) tsearch (new_alias, &__gconv_alias_db, + __gconv_alias_compare); + if (inserted == NULL || *inserted != new_alias) + /* Something went wrong, free this entry. */ + free (new_alias); + } + setlocale(LC_ALL, old_locale); +} + + +/* Insert a data structure for a new module in the search tree. */ +static inline void +internal_function +insert_module (struct gconv_module *newp, int tobefreed) +{ + struct gconv_module **rootp = &__gconv_modules_db; + + while (*rootp != NULL) + { + struct gconv_module *root = *rootp; + int cmpres; + + cmpres = strcmp (newp->from_string, root->from_string); + if (cmpres == 0) + { + /* Both strings are identical. Insert the string at the + end of the `same' list if it is not already there. */ + while (strcmp (newp->from_string, root->from_string) != 0 + || strcmp (newp->to_string, root->to_string) != 0) + { + rootp = &root->same; + root = *rootp; + if (root == NULL) + break; + } + + if (root != NULL) + { + /* This is a no new conversion. But maybe the cost is + better. */ + if (newp->cost_hi < root->cost_hi + || (newp->cost_hi == root->cost_hi + && newp->cost_lo < root->cost_lo)) + { + newp->left = root->left; + newp->right = root->right; + newp->same = root->same; + *rootp = newp; + + free (root); + } + else if (tobefreed) + free (newp); + return; + } + + break; + } + else if (cmpres < 0) + rootp = &root->left; + else + rootp = &root->right; + } + + /* Plug in the new node here. */ + *rootp = newp; +} + + +/* Add new module. */ +static void +internal_function +add_module (char *rp, const char *directory, size_t dir_len, void **modules, + size_t *nmodules, int modcounter) +{ + /* We expect now + 1. `from' name + 2. `to' name + 3. filename of the module + 4. an optional cost value + */ + struct gconv_alias fake_alias; + struct gconv_module *new_module; + char *from, *to, *module, *wp; + int need_ext; + int cost_hi; + char old_locale[20], *old_locale_p; + char *old; + size_t len; + char *new; + + /* Set locale to default C locale. */ + old_locale_p = setlocale(LC_ALL, "C"); + strncpy(old_locale, old_locale_p, 20); + + while (isspace (*rp)) + ++rp; + from = rp; + while (*rp != '\0' && !isspace (*rp)) + { + *rp = toupper (*rp); + ++rp; + } + if (*rp == '\0') + { + setlocale(LC_ALL, old_locale); + return; + } + *rp++ = '\0'; + to = wp = rp; + while (isspace (*rp)) + { + setlocale(LC_ALL, old_locale); + ++rp; + } + while (*rp != '\0' && !isspace (*rp)) + *wp++ = toupper (*rp++); + if (*rp == '\0') + { + setlocale(LC_ALL, old_locale); + return; + } + *wp++ = '\0'; + do + ++rp; + while (isspace (*rp)); + module = wp; + while (*rp != '\0' && !isspace (*rp)) + *wp++ = *rp++; + if (*rp == '\0') + { + /* There is no cost, use one by default. */ + *wp++ = '\0'; + cost_hi = 1; + } + else + { + /* There might be a cost value. */ + char *endp; + + *wp++ = '\0'; + cost_hi = strtol (rp, &endp, 10); + if (rp == endp || cost_hi < 1) + /* No useful information. */ + cost_hi = 1; + } + + if (module[0] == '\0') + { + setlocale(LC_ALL, old_locale); + /* No module name given. */ + return; + } + if (module[0] == '/') + dir_len = 0; + + /* See whether we must add the ending. */ + need_ext = 0; + if (wp - module < (ptrdiff_t) sizeof (gconv_module_ext) + || memcmp (wp - sizeof (gconv_module_ext), gconv_module_ext, + sizeof (gconv_module_ext)) != 0) + /* We must add the module extension. */ + need_ext = sizeof (gconv_module_ext) - 1; + + /* See whether we have already an alias with this name defined. */ + old = from; + len = strnlen (old, to - from); + new = (char *) alloca (len + 1); + new[len] = '\0'; + fake_alias.fromname = (char *) memcpy (new, old, len); + + if (tfind (&fake_alias, &__gconv_alias_db, __gconv_alias_compare) != NULL) + { + setlocale(LC_ALL, old_locale); + /* This module duplicates an alias. */ + return; + } + + new_module = (struct gconv_module *) calloc (1, + sizeof (struct gconv_module) + + (wp - from) + + dir_len + need_ext); + if (new_module != NULL) + { + char *tmp; + + new_module->from_string = tmp = (char *) (new_module + 1); + tmp = memcpy (tmp, from, to - from); + tmp += (to - from); + + new_module->to_string = tmp; + tmp = memcpy (tmp, to, module - to); + tmp += (module - to); + + new_module->cost_hi = cost_hi; + new_module->cost_lo = modcounter; + + new_module->module_name = tmp; + + if (dir_len != 0) + { + tmp = memcpy (tmp, directory, dir_len); + tmp += dir_len; + } + + tmp = memcpy (tmp, module, wp - module); + tmp += (wp - module); + + if (need_ext) + memcpy (tmp - 1, gconv_module_ext, sizeof (gconv_module_ext)); + + /* Now insert the new module data structure in our search tree. */ + insert_module (new_module, 1); + } + setlocale(LC_ALL, old_locale); +} + + +/* Read the next configuration file. */ +static void +internal_function +read_conf_file (const char *filename, const char *directory, size_t dir_len, + void **modules, size_t *nmodules) +{ + FILE *fp = fopen (filename, "r"); + char *line = NULL; + size_t line_len = 0; + static int modcounter; + char old_locale[20], *old_locale_p; + + /* Don't complain if a file is not present or readable, simply silently + ignore it. */ + if (fp == NULL) + return; + + /* Set locale to default C locale. */ + old_locale_p = setlocale(LC_ALL, "C"); + strncpy(old_locale, old_locale_p, 20); + + /* Process the known entries of the file. Comments start with `#' and + end with the end of the line. Empty lines are ignored. */ + while (!feof (fp)) + { + char *rp, *endp, *word; + ssize_t n = __getdelim (&line, &line_len, '\n', fp); + if (n < 0) + /* An error occurred. */ + break; + + rp = line; + /* Terminate the line (excluding comments or newline) by an NUL byte + to simplify the following code. */ + endp = strchr (rp, '#'); + if (endp != NULL) + *endp = '\0'; + else + if (rp[n - 1] == '\n') + rp[n - 1] = '\0'; + + while (isspace (*rp)) + ++rp; + + /* If this is an empty line go on with the next one. */ + if (rp == endp) + continue; + + word = rp; + while (*rp != '\0' && !isspace (*rp)) + ++rp; + + if (rp - word == sizeof ("alias") - 1 + && memcmp (word, "alias", sizeof ("alias") - 1) == 0) + add_alias (rp, *modules); + else if (rp - word == sizeof ("module") - 1 + && memcmp (word, "module", sizeof ("module") - 1) == 0) + add_module (rp, directory, dir_len, modules, nmodules, modcounter++); + /* else */ + /* Otherwise ignore the line. */ + } + + free (line); + + fclose (fp); + + setlocale(LC_ALL, old_locale); +} + + +/* Determine the directories we are looking for data in. */ +void +__gconv_get_path (void) +{ + struct path_elem *result; + __LOCK_INIT(static, path_lock); + +#ifdef HAVE_DD_LOCK + __lock_acquire(path_lock); +#endif + + /* Make sure there wasn't a second thread doing it already. */ + result = (struct path_elem *) __gconv_path_elem; + if (result == NULL) + { + /* Determine the complete path first. */ + char *gconv_path; + size_t gconv_path_len; + char *elem; + char *oldp; + char *cp; + int nelems; + char *cwd; + size_t cwdlen; + + if (__gconv_path_envvar == NULL) + { + char * old = default_gconv_path; + size_t len = strlen (old) + 1; + char *new = (char *) alloca (len); + + /* No user-defined path. Make a modifiable copy of the + default path. */ + gconv_path = (char *) memcpy (new, old, len); + gconv_path_len = sizeof (default_gconv_path); + cwd = NULL; + cwdlen = 0; + } + else + { + /* Append the default path to the user-defined path. */ + size_t user_len = strlen (__gconv_path_envvar); + char *tmp; + + gconv_path_len = user_len + 1 + sizeof (default_gconv_path); + gconv_path = alloca (gconv_path_len); + tmp = memcpy (gconv_path, __gconv_path_envvar, + user_len); + tmp += user_len; + memcpy (tmp, ":", 1); + tmp += 1; + memcpy (tmp, + default_gconv_path, sizeof (default_gconv_path)); + + cwd = getcwd (NULL, 0); + cwdlen = strlen (cwd); + } + assert (default_gconv_path[0] == '/'); + + /* In a first pass we calculate the number of elements. */ + oldp = NULL; + cp = strchr (gconv_path, ':'); + nelems = 1; + while (cp != NULL) + { + if (cp != oldp + 1) + ++nelems; + oldp = cp; + cp = strchr (cp + 1, ':'); + } + + /* Allocate the memory for the result. */ + result = (struct path_elem *) malloc ((nelems + 1) + * sizeof (struct path_elem) + + gconv_path_len + nelems + + (nelems - 1) * (cwdlen + 1)); + if (result != NULL) + { + char *strspace = (char *) &result[nelems + 1]; + int n = 0; + + /* Separate the individual parts. */ + __gconv_max_path_elem_len = 0; + elem = strtok_r (gconv_path, ":", &gconv_path); + assert (elem != NULL); + do + { + result[n].name = strspace; + if (elem[0] != '/') + { + assert (cwd != NULL); + strspace = memcpy (strspace, cwd, cwdlen); + strspace += cwdlen; + *strspace++ = '/'; + } + strspace = strcpy (strspace, elem); + while(*strspace != '\0') strspace++; + + if (strspace[-1] != '/') + *strspace++ = '/'; + + result[n].len = strspace - result[n].name; + if (result[n].len > __gconv_max_path_elem_len) + __gconv_max_path_elem_len = result[n].len; + + *strspace++ = '\0'; + ++n; + } + while ((elem = strtok_r (NULL, ":", &gconv_path)) != NULL); + + result[n].name = NULL; + result[n].len = 0; + } + + __gconv_path_elem = result ?: (struct path_elem *) &empty_path_elem; + + if (cwd != NULL) + free (cwd); + } + +#ifdef HAVE_DD_LOCK + __lock_release(path_lock); +#endif +} + + +/* Read all configuration files found in the user-specified and the default + path. */ +void +__gconv_read_conf (void) +{ + void *modules = NULL; + size_t nmodules = 0; + int save_errno = errno; + size_t cnt; + char *filename; + char *tmp; + const char *elem; + size_t elem_len; + + /* First see whether we should use the cache. */ + if (__gconv_load_cache () == 0) + { + /* Yes, we are done. */ + __set_errno (save_errno); + return; + } + +#ifndef STATIC_GCONV + /* Find out where we have to look. */ + if (__gconv_path_elem == NULL) + __gconv_get_path (); + + for (cnt = 0; __gconv_path_elem[cnt].name != NULL; ++cnt) + { + elem = __gconv_path_elem[cnt].name; + elem_len = __gconv_path_elem[cnt].len; + + /* No slash needs to be inserted between elem and gconv_conf_filename; + elem already ends in a slash. */ + filename = alloca (elem_len + sizeof (gconv_conf_filename)); + tmp = memcpy (filename, elem, elem_len); + tmp += elem_len; + memcpy (tmp, gconv_conf_filename, sizeof (gconv_conf_filename)); + + /* Read the next configuration file. */ + read_conf_file (filename, elem, elem_len, &modules, &nmodules); + } +#endif + + /* Add the internal modules. */ + for (cnt = 0; cnt < sizeof (builtin_modules) / sizeof (builtin_modules[0]); + ++cnt) + { + struct gconv_alias fake_alias; + + fake_alias.fromname = (char *) builtin_modules[cnt].from_string; + + if (tfind (&fake_alias, &__gconv_alias_db, __gconv_alias_compare) + != NULL) + /* It'll conflict so don't add it. */ + continue; + + insert_module (&builtin_modules[cnt], 0); + } + + /* Add aliases for builtin conversions. */ + cnt = sizeof (builtin_aliases) / sizeof (builtin_aliases[0]); + while (cnt > 0) + { + char * old = builtin_aliases[--cnt]; + size_t len = strlen (old) + 1; + char *new = (char *) alloca (len); + char *copy = (char *) memcpy (new, old, len); + + add_alias (copy, modules); + } + + /* Restore the error number. */ + __set_errno (save_errno); +} + + + +/* Free all resources if necessary. */ +static void __attribute__ ((unused)) +free_mem (void) +{ + if (__gconv_path_elem != NULL && __gconv_path_elem != &empty_path_elem) + free ((void *) __gconv_path_elem); +} + +text_set_element (__libc_subfreeres, free_mem); diff --git a/newlib/libc/sys/linux/iconv/gconv_db.c b/newlib/libc/sys/linux/iconv/gconv_db.c new file mode 100644 index 000000000..749995ee3 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_db.c @@ -0,0 +1,803 @@ +/* Provide access to the collection of available transformation modules. + Copyright (C) 1997,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +/* Simple data structure for alias mapping. We have two names, `from' + and `to'. */ +void *__gconv_alias_db; + +/* Array with available modules. */ +struct gconv_module *__gconv_modules_db; + +/* We modify global data. */ +__LOCK_INIT(static, lock); + + +/* Function for searching alias. */ +int +__gconv_alias_compare (const void *p1, const void *p2) +{ + const struct gconv_alias *s1 = (const struct gconv_alias *) p1; + const struct gconv_alias *s2 = (const struct gconv_alias *) p2; + return strcmp (s1->fromname, s2->fromname); +} + + +/* To search for a derivation we create a list of intermediate steps. + Each element contains a pointer to the element which precedes it + in the derivation order. */ +struct derivation_step +{ + const char *result_set; + size_t result_set_len; + int cost_lo; + int cost_hi; + struct gconv_module *code; + struct derivation_step *last; + struct derivation_step *next; +}; + +#define NEW_STEP(result, hi, lo, module, last_mod) \ + ({ struct derivation_step *newp = alloca (sizeof (struct derivation_step)); \ + newp->result_set = result; \ + newp->result_set_len = strlen (result); \ + newp->cost_hi = hi; \ + newp->cost_lo = lo; \ + newp->code = module; \ + newp->last = last_mod; \ + newp->next = NULL; \ + newp; }) + + +/* If a specific transformation is used more than once we should not need + to start looking for it again. Instead cache each successful result. */ +struct known_derivation +{ + const char *from; + const char *to; + struct __gconv_step *steps; + size_t nsteps; +}; + +/* Compare function for database of found derivations. */ +static int +derivation_compare (const void *p1, const void *p2) +{ + const struct known_derivation *s1 = (const struct known_derivation *) p1; + const struct known_derivation *s2 = (const struct known_derivation *) p2; + int result; + + result = strcmp (s1->from, s2->from); + if (result == 0) + result = strcmp (s1->to, s2->to); + return result; +} + +/* The search tree for known derivations. */ +static void *known_derivations; + +/* Look up whether given transformation was already requested before. */ +static int +internal_function +derivation_lookup (const char *fromset, const char *toset, + struct __gconv_step **handle, size_t *nsteps) +{ + struct known_derivation key = { fromset, toset, NULL, 0 }; + struct known_derivation **result; + + result = tfind (&key, &known_derivations, derivation_compare); + + if (result == NULL) + return __GCONV_NOCONV; + + *handle = (*result)->steps; + *nsteps = (*result)->nsteps; + + /* Please note that we return GCONV_OK even if the last search for + this transformation was unsuccessful. */ + return __GCONV_OK; +} + +/* Add new derivation to list of known ones. */ +static void +internal_function +add_derivation (const char *fromset, const char *toset, + struct __gconv_step *handle, size_t nsteps) +{ + struct known_derivation *new_deriv; + size_t fromset_len = strlen (fromset) + 1; + size_t toset_len = strlen (toset) + 1; + + new_deriv = (struct known_derivation *) + malloc (sizeof (struct known_derivation) + fromset_len + toset_len); + if (new_deriv != NULL) + { + char *tmp; + new_deriv->from = (char *) (new_deriv + 1); + tmp = memcpy (new_deriv + 1, fromset, fromset_len); + tmp += fromset_len; + + new_deriv->to = memcpy (tmp, + toset, toset_len); + + new_deriv->steps = handle; + new_deriv->nsteps = nsteps; + + if (tsearch (new_deriv, &known_derivations, derivation_compare) + == NULL) + /* There is some kind of memory allocation problem. */ + free (new_deriv); + } + /* Please note that we don't complain if the allocation failed. This + is not tragically but in case we use the memory debugging facilities + not all memory will be freed. */ +} + +static void +free_derivation (void *p) +{ + struct known_derivation *deriv = (struct known_derivation *) p; + size_t cnt; + + for (cnt = 0; cnt < deriv->nsteps; ++cnt) + if (deriv->steps[cnt].__counter > 0 + && deriv->steps[cnt].__end_fct != NULL) + deriv->steps[cnt].__end_fct (&deriv->steps[cnt]); + + /* Free the name strings. */ + free ((char *) deriv->steps[0].__from_name); + free ((char *) deriv->steps[deriv->nsteps - 1].__to_name); + + free ((struct __gconv_step *) deriv->steps); + free (deriv); +} + + +/* Decrement the reference count for a single step in a steps array. */ +void +internal_function +__gconv_release_step (struct __gconv_step *step) +{ + if (--step->__counter == 0) + { + /* Call the destructor. */ + if (step->__end_fct != NULL) + step->__end_fct (step); + +#ifndef STATIC_GCONV + /* Skip builtin modules; they are not reference counted. */ + if (step->__shlib_handle != NULL) + { + /* Release the loaded module. */ + __gconv_release_shlib (step->__shlib_handle); + step->__shlib_handle = NULL; + } +#endif + } +} + +static int +internal_function +gen_steps (struct derivation_step *best, const char *toset, + const char *fromset, struct __gconv_step **handle, size_t *nsteps) +{ + size_t step_cnt = 0; + struct __gconv_step *result; + struct derivation_step *current; + int status = __GCONV_NOMEM; + + /* First determine number of steps. */ + for (current = best; current->last != NULL; current = current->last) + ++step_cnt; + + result = (struct __gconv_step *) malloc (sizeof (struct __gconv_step) + * step_cnt); + if (result != NULL) + { + int failed = 0; + + status = __GCONV_OK; + *nsteps = step_cnt; + current = best; + while (step_cnt-- > 0) + { + result[step_cnt].__from_name = (step_cnt == 0 + ? strdup (fromset) + : (char *)current->last->result_set); + result[step_cnt].__to_name = (step_cnt + 1 == *nsteps + ? strdup (current->result_set) + : result[step_cnt + 1].__from_name); + + result[step_cnt].__counter = 1; + result[step_cnt].__data = NULL; + +#ifndef STATIC_GCONV + if (current->code->module_name[0] == '/') + { + /* Load the module, return handle for it. */ + struct __gconv_loaded_object *shlib_handle = + __gconv_find_shlib (current->code->module_name); + + if (shlib_handle == NULL) + { + failed = 1; + break; + } + + result[step_cnt].__shlib_handle = shlib_handle; + result[step_cnt].__modname = shlib_handle->name; + result[step_cnt].__fct = shlib_handle->fct; + result[step_cnt].__init_fct = shlib_handle->init_fct; + result[step_cnt].__end_fct = shlib_handle->end_fct; + + /* Call the init function. */ + if (result[step_cnt].__init_fct != NULL) + { + status = result[step_cnt].__init_fct (&result[step_cnt]); + + if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK) + { + failed = 1; + /* Make sure we unload this modules. */ + --step_cnt; + result[step_cnt].__end_fct = NULL; + break; + } + } + } + else +#endif + /* It's a builtin transformation. */ + __gconv_get_builtin_trans (current->code->module_name, + &result[step_cnt]); + + current = current->last; + } + + if (__builtin_expect (failed, 0) != 0) + { + /* Something went wrong while initializing the modules. */ + while (++step_cnt < *nsteps) + __gconv_release_step (&result[step_cnt]); + free (result); + *nsteps = 0; + *handle = NULL; + if (status == __GCONV_OK) + status = __GCONV_NOCONV; + } + else + *handle = result; + } + else + { + *nsteps = 0; + *handle = NULL; + } + + return status; +} + + +#ifndef STATIC_GCONV +static int +internal_function +increment_counter (struct __gconv_step *steps, size_t nsteps) +{ + /* Increment the user counter. */ + size_t cnt = nsteps; + int result = __GCONV_OK; + + while (cnt-- > 0) + { + struct __gconv_step *step = &steps[cnt]; + + if (step->__counter++ == 0) + { + /* Skip builtin modules. */ + if (step->__modname != NULL) + { + /* Reopen a previously used module. */ + step->__shlib_handle = __gconv_find_shlib (step->__modname); + if (step->__shlib_handle == NULL) + { + /* Oops, this is the second time we use this module + (after unloading) and this time loading failed!? */ + --step->__counter; + while (++cnt < nsteps) + __gconv_release_step (&steps[cnt]); + result = __GCONV_NOCONV; + break; + } + + /* The function addresses defined by the module may + have changed. */ + step->__fct = step->__shlib_handle->fct; + step->__init_fct = step->__shlib_handle->init_fct; + step->__end_fct = step->__shlib_handle->end_fct; + } + + if (step->__init_fct != NULL) + step->__init_fct (step); + } + } + return result; +} +#endif + + +/* The main function: find a possible derivation from the `fromset' (either + the given name or the alias) to the `toset' (again with alias). */ +static int +internal_function +find_derivation (const char *toset, const char *toset_expand, + const char *fromset, const char *fromset_expand, + struct __gconv_step **handle, size_t *nsteps) +{ + struct derivation_step *first, *current, **lastp, *solution = NULL; + int best_cost_hi = INT_MAX; + int best_cost_lo = INT_MAX; + int result; + + /* Look whether an earlier call to `find_derivation' has already + computed a possible derivation. If so, return it immediately. */ + result = derivation_lookup (fromset_expand ?: fromset, toset_expand ?: toset, + handle, nsteps); + if (result == __GCONV_OK) + { +#ifndef STATIC_GCONV + result = increment_counter (*handle, *nsteps); +#endif + return result; + } + + /* The task is to find a sequence of transformations, backed by the + existing modules - whether builtin or dynamically loadable -, + starting at `fromset' (or `fromset_expand') and ending at `toset' + (or `toset_expand'), and with minimal cost. + + For computer scientists, this is a shortest path search in the + graph where the nodes are all possible charsets and the edges are + the transformations listed in __gconv_modules_db. + + For now we use a simple algorithm with quadratic runtime behaviour. + A breadth-first search, starting at `fromset' and `fromset_expand'. + The list starting at `first' contains all nodes that have been + visited up to now, in the order in which they have been visited -- + excluding the goal nodes `toset' and `toset_expand' which get + managed in the list starting at `solution'. + `current' walks through the list starting at `first' and looks + which nodes are reachable from the current node, adding them to + the end of the list [`first' or `solution' respectively] (if + they are visited the first time) or updating them in place (if + they have have already been visited). + In each node of either list, cost_lo and cost_hi contain the + minimum cost over any paths found up to now, starting at `fromset' + or `fromset_expand', ending at that node. best_cost_lo and + best_cost_hi represent the minimum over the elements of the + `solution' list. */ + + if (fromset_expand != NULL) + { + first = NEW_STEP (fromset_expand, 0, 0, NULL, NULL); + first->next = NEW_STEP (fromset, 0, 0, NULL, NULL); + lastp = &first->next->next; + } + else + { + first = NEW_STEP (fromset, 0, 0, NULL, NULL); + lastp = &first->next; + } + + for (current = first; current != NULL; current = current->next) + { + /* Now match all the available module specifications against the + current charset name. If any of them matches check whether + we already have a derivation for this charset. If yes, use the + one with the lower costs. Otherwise add the new charset at the + end. + + The module database is organized in a tree form which allows + searching for prefixes. So we search for the first entry with a + matching prefix and any other matching entry can be found from + this place. */ + struct gconv_module *node; + + /* Maybe it is not necessary anymore to look for a solution for + this entry since the cost is already as high (or higher) as + the cost for the best solution so far. */ + if (current->cost_hi > best_cost_hi + || (current->cost_hi == best_cost_hi + && current->cost_lo >= best_cost_lo)) + continue; + + node = __gconv_modules_db; + while (node != NULL) + { + int cmpres = strcmp (current->result_set, node->from_string); + if (cmpres == 0) + { + /* Walk through the list of modules with this prefix and + try to match the name. */ + struct gconv_module *runp; + + /* Check all the modules with this prefix. */ + runp = node; + do + { + const char *result_set = (strcmp (runp->to_string, "-") == 0 + ? (toset_expand ?: toset) + : runp->to_string); + int cost_hi = runp->cost_hi + current->cost_hi; + int cost_lo = runp->cost_lo + current->cost_lo; + struct derivation_step *step; + + /* We managed to find a derivation. First see whether + we have reached one of the goal nodes. */ + if (strcmp (result_set, toset) == 0 + || (toset_expand != NULL + && strcmp (result_set, toset_expand) == 0)) + { + /* Append to the `solution' list if there + is no entry with this name. */ + for (step = solution; step != NULL; step = step->next) + if (strcmp (result_set, step->result_set) == 0) + break; + + if (step == NULL) + { + step = NEW_STEP (result_set, + cost_hi, cost_lo, + runp, current); + step->next = solution; + solution = step; + } + else if (step->cost_hi > cost_hi + || (step->cost_hi == cost_hi + && step->cost_lo > cost_lo)) + { + /* A better path was found for the node, + on the `solution' list. */ + step->code = runp; + step->last = current; + step->cost_hi = cost_hi; + step->cost_lo = cost_lo; + } + + /* Update best_cost accordingly. */ + if (cost_hi < best_cost_hi + || (cost_hi == best_cost_hi + && cost_lo < best_cost_lo)) + { + best_cost_hi = cost_hi; + best_cost_lo = cost_lo; + } + } + else if (cost_hi < best_cost_hi + || (cost_hi == best_cost_hi + && cost_lo < best_cost_lo)) + { + /* Append at the end of the `first' list if there + is no entry with this name. */ + for (step = first; step != NULL; step = step->next) + if (strcmp (result_set, step->result_set) == 0) + break; + + if (step == NULL) + { + *lastp = NEW_STEP (result_set, + cost_hi, cost_lo, + runp, current); + lastp = &(*lastp)->next; + } + else if (step->cost_hi > cost_hi + || (step->cost_hi == cost_hi + && step->cost_lo > cost_lo)) + { + /* A better path was found for the node, + on the `first' list. */ + step->code = runp; + step->last = current; + + /* Update the cost for all steps. */ + for (step = first; step != NULL; + step = step->next) + /* But don't update the start nodes. */ + if (step->code != NULL) + { + struct derivation_step *back; + int hi, lo; + + hi = step->code->cost_hi; + lo = step->code->cost_lo; + + for (back = step->last; back->code != NULL; + back = back->last) + { + hi += back->code->cost_hi; + lo += back->code->cost_lo; + } + + step->cost_hi = hi; + step->cost_lo = lo; + } + + /* Likewise for the nodes on the solution list. + Also update best_cost accordingly. */ + for (step = solution; step != NULL; + step = step->next) + { + step->cost_hi = (step->code->cost_hi + + step->last->cost_hi); + step->cost_lo = (step->code->cost_lo + + step->last->cost_lo); + + if (step->cost_hi < best_cost_hi + || (step->cost_hi == best_cost_hi + && step->cost_lo < best_cost_lo)) + { + best_cost_hi = step->cost_hi; + best_cost_lo = step->cost_lo; + } + } + } + } + + runp = runp->same; + } + while (runp != NULL); + + break; + } + else if (cmpres < 0) + node = node->left; + else + node = node->right; + } + } + + if (solution != NULL) + { + /* We really found a way to do the transformation. */ + + /* Choose the best solution. This is easy because we know that + the solution list has at most length 2 (one for every possible + goal node). */ + if (solution->next != NULL) + { + struct derivation_step *solution2 = solution->next; + + if (solution2->cost_hi < solution->cost_hi + || (solution2->cost_hi == solution->cost_hi + && solution2->cost_lo < solution->cost_lo)) + solution = solution2; + } + + /* Now build a data structure describing the transformation steps. */ + result = gen_steps (solution, toset_expand ?: toset, + fromset_expand ?: fromset, handle, nsteps); + } + else + { + /* We haven't found a transformation. Clear the result values. */ + *handle = NULL; + *nsteps = 0; + } + + /* Add result in any case to list of known derivations. */ + add_derivation (fromset_expand ?: fromset, toset_expand ?: toset, + *handle, *nsteps); + + return result; +} + + +/* Control of initialization. */ +__libc_once_define (static, once); + + +static const char * +do_lookup_alias (const char *name) +{ + struct gconv_alias key; + struct gconv_alias **found; + + key.fromname = (char *) name; + found = tfind (&key, &__gconv_alias_db, __gconv_alias_compare); + return found != NULL ? (*found)->toname : NULL; +} + + +int +internal_function +__gconv_compare_alias (const char *name1, const char *name2) +{ + int result; + + /* Ensure that the configuration data is read. */ + __libc_once (once, __gconv_read_conf); + + if (__gconv_compare_alias_cache (name1, name2, &result) != 0) + result = strcmp (do_lookup_alias (name1) ?: name1, + do_lookup_alias (name2) ?: name2); + + return result; +} + + +int +internal_function +__gconv_find_transform (const char *toset, const char *fromset, + struct __gconv_step **handle, size_t *nsteps, + int flags) +{ + const char *fromset_expand; + const char *toset_expand; + int result; + + /* Ensure that the configuration data is read. */ + __libc_once (once, __gconv_read_conf); + + /* Acquire the lock. */ +#ifdef HAVE_DD_LOCK + __lock_acquire(lock); +#endif + + result = __gconv_lookup_cache (toset, fromset, handle, nsteps, flags); + if (result != __GCONV_NODB) + { + /* We have a cache and could resolve the request, successful or not. */ +#ifdef HAVE_DD_LOCK + __lock_release(lock); +#endif + + return result; + } + + /* If we don't have a module database return with an error. */ + if (__gconv_modules_db == NULL) + { +#ifdef HAVE_DD_LOCK + __lock_release(lock); +#endif + + return __GCONV_NOCONV; + } + + /* See whether the names are aliases. */ + fromset_expand = do_lookup_alias (fromset); + toset_expand = do_lookup_alias (toset); + + if (__builtin_expect (flags & GCONV_AVOID_NOCONV, 0) + /* We are not supposed to create a pseudo transformation (means + copying) when the input and output character set are the same. */ + && (strcmp (toset, fromset) == 0 + || (toset_expand != NULL && strcmp (toset_expand, fromset) == 0) + || (fromset_expand != NULL + && (strcmp (toset, fromset_expand) == 0 + || (toset_expand != NULL + && strcmp (toset_expand, fromset_expand) == 0))))) + { + /* Both character sets are the same. */ +#ifdef HAVE_DD_LOCK + __lock_release(lock); +#endif + + return __GCONV_NOCONV; + } + + result = find_derivation (toset, toset_expand, fromset, fromset_expand, + handle, nsteps); + + /* Release the lock. */ +#ifdef HAVE_DD_LOCK + __lock_release(lock); +#endif + + + /* The following code is necessary since `find_derivation' will return + GCONV_OK even when no derivation was found but the same request + was processed before. I.e., negative results will also be cached. */ + return (result == __GCONV_OK + ? (*handle == NULL ? __GCONV_NOCONV : __GCONV_OK) + : result); +} + + +/* Release the entries of the modules list. */ +int +internal_function +__gconv_close_transform (struct __gconv_step *steps, size_t nsteps) +{ + int result = __GCONV_OK; + size_t cnt; + + /* Acquire the lock. */ +#ifdef HAVE_DD_LOCK + __lock_acquire(lock); +#endif + + +#ifndef STATIC_GCONV + cnt = nsteps; + while (cnt-- > 0) + __gconv_release_step (&steps[cnt]); +#endif + + /* If we use the cache we free a bit more since we don't keep any + transformation records around, they are cheap enough to + recreate. */ + __gconv_release_cache (steps, nsteps); + + /* Release the lock. */ +#ifdef HAVE_DD_LOCK + __lock_release(lock); +#endif + + + return result; +} + + +/* Free the modules mentioned. */ +static void +internal_function +free_modules_db (struct gconv_module *node) +{ + if (node->left != NULL) + free_modules_db (node->left); + if (node->right != NULL) + free_modules_db (node->right); + do + { + struct gconv_module *act = node; + node = node->same; + if (act->module_name[0] == '/') + free (act); + } + while (node != NULL); +} + + +/* Free all resources if necessary. */ +static void __attribute__ ((unused)) +free_mem (void) +{ + if (__gconv_alias_db != NULL) + tdestroy (__gconv_alias_db, free); + + if (__gconv_modules_db != NULL) + free_modules_db (__gconv_modules_db); + + if (known_derivations != NULL) + tdestroy (known_derivations, free_derivation); +} + +text_set_element (__libc_subfreeres, free_mem); diff --git a/newlib/libc/sys/linux/iconv/gconv_dl.c b/newlib/libc/sys/linux/iconv/gconv_dl.c new file mode 100644 index 000000000..ee725149f --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_dl.c @@ -0,0 +1,237 @@ +/* Handle loading/unloading of shared object for transformation. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +#ifdef DEBUG +/* For debugging purposes. */ +static void print_all (void); +#endif + + +/* This is a tuning parameter. If a transformation module is not used + anymore it gets not immediately unloaded. Instead we wait a certain + number of load attempts for further modules. If none of the + subsequent load attempts name the same object it finally gets unloaded. + Otherwise it is still available which hopefully is the frequent case. + The following number is the number of unloading attempts we wait + before unloading. */ +#define TRIES_BEFORE_UNLOAD 2 + +/* Array of loaded objects. This is shared by all threads so we have + to use semaphores to access it. */ +static void *loaded; + +/* Comparison function for searching `loaded_object' tree. */ +static int +known_compare (const void *p1, const void *p2) +{ + const struct __gconv_loaded_object *s1 = + (const struct __gconv_loaded_object *) p1; + const struct __gconv_loaded_object *s2 = + (const struct __gconv_loaded_object *) p2; + + return strcmp (s1->name, s2->name); +} + +/* Open the gconv database if necessary. A non-negative return value + means success. */ +struct __gconv_loaded_object * +internal_function +__gconv_find_shlib (const char *name) +{ + struct __gconv_loaded_object *found; + void *keyp; + + + + /* Search the tree of shared objects previously requested. Data in + the tree are `loaded_object' structures, whose first member is a + `const char *', the lookup key. The search returns a pointer to + the tree node structure; the first member of the is a pointer to + our structure (i.e. what will be a `loaded_object'); since the + first member of that is the lookup key string, &FCT_NAME is close + enough to a pointer to our structure to use as a lookup key that + will be passed to `known_compare' (above). */ + + keyp = tfind (&name, &loaded, known_compare); + if (keyp == NULL) + { + /* This name was not known before. */ + size_t namelen = strlen (name) + 1; + + found = malloc (sizeof (struct __gconv_loaded_object) + namelen); + if (found != NULL) + { + /* Point the tree node at this new structure. */ + found->name = (char *) memcpy (found + 1, name, namelen); + found->counter = -TRIES_BEFORE_UNLOAD - 1; + found->handle = NULL; + + if (__builtin_expect (tsearch (found, &loaded, known_compare) + == NULL, 0)) + { + /* Something went wrong while inserting the entry. */ + free (found); + found = NULL; + } + } + } + else + found = *(struct __gconv_loaded_object **) keyp; + + /* Try to load the shared object if the usage count is 0. This + implies that if the shared object is not loadable, the handle is + NULL and the usage count > 0. */ + if (found != NULL) + { + if (found->counter < -TRIES_BEFORE_UNLOAD) + { + assert (found->handle == NULL); + found->handle = __libc_dlopen (found->name); + if (found->handle != NULL) + { + found->fct = __libc_dlsym (found->handle, "gconv"); + if (found->fct == NULL) + { + /* Argh, no conversion function. There is something + wrong here. */ + __gconv_release_shlib (found); + found = NULL; + } + else + { + found->init_fct = __libc_dlsym (found->handle, "gconv_init"); + found->end_fct = __libc_dlsym (found->handle, "gconv_end"); + + /* We have succeeded in loading the shared object. */ + found->counter = 1; + } + } + else + /* Error while loading the shared object. */ + found = NULL; + } + else if (found->handle != NULL) + found->counter = MAX (found->counter + 1, 1); + } + + return found; +} + + +/* This is very ugly but the tsearch functions provide no way to pass + information to the walker function. So we use a global variable. + It is MT safe since we use a lock. */ +static struct __gconv_loaded_object *release_handle; + +static void +do_release_shlib (void *nodep, VISIT value, int level) +{ + struct __gconv_loaded_object *obj = *(struct __gconv_loaded_object **) nodep; + + + + if (value != preorder && value != leaf) + return; + + if (obj == release_handle) + { + /* This is the object we want to unload. Now decrement the + reference counter. */ + assert (obj->counter > 0); + --obj->counter; + } + else if (obj->counter <= 0 && obj->counter >= -TRIES_BEFORE_UNLOAD + && --obj->counter < -TRIES_BEFORE_UNLOAD && obj->handle != NULL) + { + /* Unload the shared object. */ + __libc_dlclose (obj->handle); + obj->handle = NULL; + } +} + + +/* Notify system that a shared object is not longer needed. */ +void +internal_function +__gconv_release_shlib (struct __gconv_loaded_object *handle) +{ + /* Urgh, this is ugly but we have no other possibility. */ + release_handle = handle; + + /* Process all entries. Please note that we also visit entries + with release counts <= 0. This way we can finally unload them + if necessary. */ + twalk (loaded, (void *) do_release_shlib); +} + + +/* We run this if we debug the memory allocation. */ +static void +do_release_all (void *nodep) +{ + struct __gconv_loaded_object *obj = (struct __gconv_loaded_object *) nodep; + + + /* Unload the shared object. */ + if (obj->handle != NULL) + __libc_dlclose (obj->handle); + + free (obj); +} + +static void __attribute__ ((unused)) +free_mem (void) +{ + tdestroy (loaded, do_release_all); +} +text_set_element (__libc_subfreeres, free_mem); + + +#ifdef DEBUG +static void +do_print (const void *nodep, VISIT value, int level) +{ + struct __gconv_loaded_object *obj = *(struct __gconv_loaded_object **) nodep; + + printf ("%10s: \"%s\", %d\n", + value == leaf ? "leaf" : + value == preorder ? "preorder" : + value == postorder ? "postorder" : "endorder", + obj->name, obj->counter); +} + +static void +print_all (void) +{ + __twalk (loaded, do_print); +} +#endif diff --git a/newlib/libc/sys/linux/iconv/gconv_int.h b/newlib/libc/sys/linux/iconv/gconv_int.h new file mode 100644 index 000000000..bcd50a2c6 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_int.h @@ -0,0 +1,288 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _GCONV_INT_H +#define _GCONV_INT_H 1 + +#include "gconv.h" +#include + +__BEGIN_DECLS + + +/* Type to represent search path. */ +struct path_elem +{ + const char *name; + size_t len; +}; + +/* Variable with search path for `gconv' implementation. */ +extern struct path_elem *__gconv_path_elem; +/* Maximum length of a single path element. */ +extern size_t __gconv_max_path_elem_len; + + +/* Structure for alias definition. Simply two strings. */ +struct gconv_alias +{ + char *fromname; + char *toname; +}; + + +/* How many character should be conveted in one call? */ +#define GCONV_NCHAR_GOAL 8160 + + +/* Structure describing one loaded shared object. This normally are + objects to perform conversation but as a special case the db shared + object is also handled. */ +struct __gconv_loaded_object +{ + /* Name of the object. It must be the first structure element. */ + const char *name; + + /* Reference counter for the db functionality. If no conversion is + needed we unload the db library. */ + int counter; + + /* The handle for the shared object. */ + void *handle; + + /* Pointer to the functions the module defines. */ + __gconv_fct fct; + __gconv_init_fct init_fct; + __gconv_end_fct end_fct; +}; + + +/* Description for an available conversion module. */ +struct gconv_module +{ + const char *from_string; + const char *to_string; + + int cost_hi; + int cost_lo; + + const char *module_name; + + struct gconv_module *left; /* Prefix smaller. */ + struct gconv_module *same; /* List of entries with identical prefix. */ + struct gconv_module *right; /* Prefix larger. */ +}; + + +/* Internal data structure to represent transliteration module. */ +struct trans_struct +{ + const char *name; + struct trans_struct *next; + + const char **csnames; + size_t ncsnames; + __gconv_trans_fct trans_fct; + __gconv_trans_context_fct trans_context_fct; + __gconv_trans_init_fct trans_init_fct; + __gconv_trans_end_fct trans_end_fct; +}; + + +/* Flags for `gconv_open'. */ +enum +{ + GCONV_AVOID_NOCONV = 1 << 0 +}; + + +/* Global variables. */ + +/* Database of alias names. */ +extern void *__gconv_alias_db; + +/* Array with available modules. */ +extern size_t __gconv_nmodules; +extern struct gconv_module *__gconv_modules_db; + +/* Value of the GCONV_PATH environment variable. */ +extern const char *__gconv_path_envvar; + + +/* The gconv functions expects the name to be in upper case and complete, + including the trailing slashes if necessary. */ +#define norm_add_slashes(str,suffix) \ + ({ \ + const char *cp = (str); \ + char *result; \ + char *tmp; \ + size_t cnt = 0; \ + size_t suffix_len = (suffix) == NULL ? 0 : strlen (suffix); \ + \ + while (*cp != '\0') \ + if (*cp++ == '/') \ + ++cnt; \ + \ + tmp = result = alloca (cp - (str) + 3 + suffix_len); \ + cp = (str); \ + while (*cp != '\0') \ + *tmp++ = __toupper_l (*cp++, &_nl_C_locobj); \ + if (cnt < 2) \ + { \ + *tmp++ = '/'; \ + if (cnt < 1) \ + { \ + *tmp++ = '/'; \ + if (suffix != NULL) \ + { \ + tmp = memcpy (tmp, suffix, suffix_len); \ + tmp += suffix_len; \ + } \ + } \ + } \ + *tmp = '\0'; \ + result; \ + }) + + +/* Return in *HANDLE decriptor for transformation from FROMSET to TOSET. */ +extern int __gconv_open (const char *toset, const char *fromset, + __gconv_t *handle, int flags) + internal_function; + +/* Free resources associated with transformation descriptor CD. */ +extern int __gconv_close (__gconv_t cd) + internal_function; + +/* Transform at most *INBYTESLEFT bytes from buffer starting at *INBUF + according to rules described by CD and place up to *OUTBYTESLEFT + bytes in buffer starting at *OUTBUF. Return number of non-identical + conversions in *IRREVERSIBLE if this pointer is not null. */ +extern int __gconv (__gconv_t cd, const unsigned char **inbuf, + const unsigned char *inbufend, unsigned char **outbuf, + unsigned char *outbufend, size_t *irreversible) + internal_function; + +/* Return in *HANDLE a pointer to an array with *NSTEPS elements describing + the single steps necessary for transformation from FROMSET to TOSET. */ +extern int __gconv_find_transform (const char *toset, const char *fromset, + struct __gconv_step **handle, + size_t *nsteps, int flags) + internal_function; + +/* Search for transformation in cache data. */ +extern int __gconv_lookup_cache (const char *toset, const char *fromset, + struct __gconv_step **handle, size_t *nsteps, + int flags) + internal_function; + +/* Compare the two name for whether they are after alias expansion the + same. This function uses the cache and fails if none is + loaded. */ +extern int __gconv_compare_alias_cache (const char *name1, const char *name2, + int *result) internal_function; + +/* Free data associated with a step's structure. */ +extern void __gconv_release_step (struct __gconv_step *step) + internal_function; + +/* Read all the configuration data and cache it. */ +extern void __gconv_read_conf (void); + +/* Try to read module cache file. */ +extern int __gconv_load_cache (void) internal_function; + +/* Determine the directories we are looking in. */ +extern void __gconv_get_path (void); + +/* Comparison function to search alias. */ +extern int __gconv_alias_compare (const void *p1, const void *p2); + +/* Clear reference to transformation step implementations which might + cause the code to be unloaded. */ +extern int __gconv_close_transform (struct __gconv_step *steps, + size_t nsteps) + internal_function; + +/* Free all resources allocated for the transformation record when + using the cache. */ +extern void __gconv_release_cache (struct __gconv_step *steps, size_t nsteps) + internal_function; + +/* Load shared object named by NAME. If already loaded increment reference + count. */ +extern struct __gconv_loaded_object *__gconv_find_shlib (const char *name) + internal_function; + +/* Release shared object. If no further reference is available unload + the object. */ +extern void __gconv_release_shlib (struct __gconv_loaded_object *handle) + internal_function; + +/* Fill STEP with information about builtin module with NAME. */ +extern void __gconv_get_builtin_trans (const char *name, + struct __gconv_step *step) + internal_function; + +/* Try to load transliteration step module. */ +extern int __gconv_translit_find (struct trans_struct *trans) + internal_function; + +/* Transliteration using the locale's data. */ +extern int __gconv_transliterate (struct __gconv_step *step, + struct __gconv_step_data *step_data, + void *trans_data, + __const unsigned char *inbufstart, + __const unsigned char **inbufp, + __const unsigned char *inbufend, + unsigned char **outbufstart, + size_t *irreversible); + + +/* Builtin transformations. */ +#ifdef _LIBC +# define __BUILTIN_TRANS(Name) \ + extern int Name (struct __gconv_step *step, \ + struct __gconv_step_data *data, \ + const unsigned char **inbuf, \ + const unsigned char *inbufend, \ + unsigned char **outbufstart, size_t *irreversible, \ + int do_flush, int consume_incomplete) + +__BUILTIN_TRANS (__gconv_transform_ascii_internal); +__BUILTIN_TRANS (__gconv_transform_internal_ascii); +__BUILTIN_TRANS (__gconv_transform_utf8_internal); +__BUILTIN_TRANS (__gconv_transform_internal_utf8); +__BUILTIN_TRANS (__gconv_transform_ucs2_internal); +__BUILTIN_TRANS (__gconv_transform_internal_ucs2); +__BUILTIN_TRANS (__gconv_transform_ucs2reverse_internal); +__BUILTIN_TRANS (__gconv_transform_internal_ucs2reverse); +__BUILTIN_TRANS (__gconv_transform_internal_ucs4); +__BUILTIN_TRANS (__gconv_transform_ucs4_internal); +__BUILTIN_TRANS (__gconv_transform_internal_ucs4le); +__BUILTIN_TRANS (__gconv_transform_ucs4le_internal); +__BUILTIN_TRANS (__gconv_transform_internal_utf16); +__BUILTIN_TRANS (__gconv_transform_utf16_internal); +# undef __BUITLIN_TRANS + +#endif + +__END_DECLS + +#endif /* gconv_int.h */ diff --git a/newlib/libc/sys/linux/iconv/gconv_open.c b/newlib/libc/sys/linux/iconv/gconv_open.c new file mode 100644 index 000000000..5c10d601e --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_open.c @@ -0,0 +1,326 @@ +/* Find matching transformation algorithms and initialize steps. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + +#include + +int +internal_function +__gconv_open (const char *toset, const char *fromset, __gconv_t *handle, + int flags) +{ + struct __gconv_step *steps; + size_t nsteps; + __gconv_t result = NULL; + size_t cnt = 0; + int res; + int conv_flags = 0; + const char *errhand; + const char *ignore; + struct trans_struct *trans = NULL; + char old_locale[20], *old_locale_p; + char *old, *new; + size_t len; + + /* Find out whether any error handling method is specified. */ + errhand = strchr (toset, '/'); + if (errhand != NULL) + errhand = strchr (errhand + 1, '/'); + if (__builtin_expect (errhand != NULL, 1)) + { + if (*++errhand == '\0') + errhand = NULL; + else + { + /* Make copy without the error handling description. */ + char *newtoset = (char *) alloca (errhand - toset + 1); + char *tok; + char *ptr; + + newtoset[errhand - toset] = '\0'; + toset = memcpy (newtoset, toset, errhand - toset); + + /* Find the appropriate transliteration handlers. */ + old = (char *)(errhand); + len = strlen (old) + 1; + new = (char *) alloca (len); + tok = (char *) memcpy (new, old, len); + + tok = strtok_r (tok, ",", &ptr); + + /* Set locale to default C locale. */ + old_locale_p = setlocale(LC_ALL, "C"); + strncpy(old_locale, old_locale_p, 20); + + while (tok != NULL) + { + if (strcasecmp (tok, "TRANSLIT") == 0) + { + /* It's the builtin transliteration handling. We only + support it for working on the internal encoding. */ + static const char *internal_trans_names[1] = { "INTERNAL" }; + struct trans_struct *lastp = NULL; + struct trans_struct *runp; + + for (runp = trans; runp != NULL; runp = runp->next) + if (runp->trans_fct == __gconv_transliterate) + break; + else + lastp = runp; + + if (runp == NULL) + { + struct trans_struct *newp; + + newp = (struct trans_struct *) alloca (sizeof (*newp)); + memset (newp, '\0', sizeof (*newp)); + + /* We leave the `name' field zero to signal that + this is an internal transliteration step. */ + newp->csnames = internal_trans_names; + newp->ncsnames = 1; + newp->trans_fct = __gconv_transliterate; + + if (lastp == NULL) + trans = newp; + else + lastp->next = newp; + } + } + else if (strcasecmp (tok, "IGNORE") == 0) + /* Set the flag to ignore all errors. */ + conv_flags |= __GCONV_IGNORE_ERRORS; + else + { + /* `tok' is possibly a module name. We'll see later + whether we can find it. But first see that we do + not already a module of this name. */ + struct trans_struct *lastp = NULL; + struct trans_struct *runp; + + for (runp = trans; runp != NULL; runp = runp->next) + if (runp->name != NULL + && strcasecmp (tok, runp->name) == 0) + break; + else + lastp = runp; + + if (runp == NULL) + { + struct trans_struct *newp; + + newp = (struct trans_struct *) alloca (sizeof (*newp)); + memset (newp, '\0', sizeof (*newp)); + newp->name = tok; + + if (lastp == NULL) + trans = newp; + else + lastp->next = newp; + } + } + + tok = strtok_r (NULL, ",", &ptr); + } + } + } + + /* For the source character set we ignore the error handler specification. + XXX Is this really always the best? */ + ignore = strchr (fromset, '/'); + if (ignore != NULL && (ignore = strchr (ignore + 1, '/')) != NULL + && *++ignore != '\0') + { + char *newfromset = (char *) alloca (ignore - fromset + 1); + + newfromset[ignore - fromset] = '\0'; + fromset = memcpy (newfromset, fromset, ignore - fromset); + } + + res = __gconv_find_transform (toset, fromset, &steps, &nsteps, flags); + if (res == __GCONV_OK) + { + /* Find the modules. */ + struct trans_struct *lastp = NULL; + struct trans_struct *runp; + + for (runp = trans; runp != NULL; runp = runp->next) + { + if (runp->name == NULL + || __builtin_expect (__gconv_translit_find (runp), 0) == 0) + lastp = runp; + else + /* This means we haven't found the module. Remove it. */ + (lastp == NULL ? trans : lastp->next) = runp->next; + } + + /* Allocate room for handle. */ + result = (__gconv_t) malloc (sizeof (struct __gconv_info) + + (nsteps + * sizeof (struct __gconv_step_data))); + if (result == NULL) + res = __GCONV_NOMEM; + else + { + size_t n; + + /* Remember the list of steps. */ + result->__steps = steps; + result->__nsteps = nsteps; + + /* Clear the array for the step data. */ + memset (result->__data, '\0', + nsteps * sizeof (struct __gconv_step_data)); + + /* Call all initialization functions for the transformation + step implementations. */ + for (cnt = 0; cnt < nsteps; ++cnt) + { + size_t size; + + /* Would have to be done if we would not clear the whole + array above. */ +#if 0 + /* Reset the counter. */ + result->__data[cnt].__invocation_counter = 0; + + /* It's a regular use. */ + result->__data[cnt].__internal_use = 0; +#endif + + /* We use the `mbstate_t' member in DATA. */ + result->__data[cnt].__statep = &result->__data[cnt].__state; + + /* Now see whether we can use any of the transliteration + modules for this step. */ + for (runp = trans; runp != NULL; runp = runp->next) + for (n = 0; n < runp->ncsnames; ++n) + if (strcasecmp (steps[cnt].__from_name, runp->csnames[n]) == 0) + { + void *data = NULL; + + /* Match! Now try the initializer. */ + if (runp->trans_init_fct == NULL + || (runp->trans_init_fct (&data, + steps[cnt].__to_name) + == __GCONV_OK)) + { + /* Append at the end of the list. */ + struct __gconv_trans_data *newp; + struct __gconv_trans_data **lastp; + + newp = (struct __gconv_trans_data *) + malloc (sizeof (struct __gconv_trans_data)); + if (newp == NULL) + { + res = __GCONV_NOMEM; + goto bail; + } + + newp->__trans_fct = runp->trans_fct; + newp->__trans_context_fct = runp->trans_context_fct; + newp->__trans_end_fct = runp->trans_end_fct; + newp->__data = data; + newp->__next = NULL; + + lastp = &result->__data[cnt].__trans; + while (*lastp != NULL) + lastp = &(*lastp)->__next; + + *lastp = newp; + } + break; + } + + /* If this is the last step we must not allocate an + output buffer. */ + if (cnt < nsteps - 1) + { + result->__data[cnt].__flags = conv_flags; + + /* Allocate the buffer. */ + size = (GCONV_NCHAR_GOAL * steps[cnt].__max_needed_to); + + result->__data[cnt].__outbuf = (char *) malloc (size); + if (result->__data[cnt].__outbuf == NULL) + { + res = __GCONV_NOMEM; + goto bail; + } + + result->__data[cnt].__outbufend = + result->__data[cnt].__outbuf + size; + } + else + { + /* Handle the last entry. */ + result->__data[cnt].__flags = conv_flags | __GCONV_IS_LAST; + + break; + } + } + } + + if (res != __GCONV_OK) + { + /* Something went wrong. Free all the resources. */ + int serrno; + bail: + serrno = errno; + + if (result != NULL) + { + while (cnt-- > 0) + { + struct __gconv_trans_data *transp; + + transp = result->__data[cnt].__trans; + while (transp != NULL) + { + struct __gconv_trans_data *curp = transp; + transp = transp->__next; + + if (__builtin_expect (curp->__trans_end_fct != NULL, 0)) + curp->__trans_end_fct (curp->__data); + + free (curp); + } + + free (result->__data[cnt].__outbuf); + } + + free (result); + result = NULL; + } + + __gconv_close_transform (steps, nsteps); + + __set_errno (serrno); + } + } + + *handle = result; + setlocale(LC_ALL, old_locale); + return res; +} diff --git a/newlib/libc/sys/linux/iconv/gconv_simple.c b/newlib/libc/sys/linux/iconv/gconv_simple.c new file mode 100644 index 000000000..a4a99ea81 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_simple.c @@ -0,0 +1,1327 @@ +/* Simple transformations functions. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUILTIN_ALIAS(s1, s2) /* nothing */ +#define BUILTIN_TRANSFORMATION(From, To, Cost, Name, Fct, MinF, MaxF, \ + MinT, MaxT) \ + extern int Fct (struct __gconv_step *, struct __gconv_step_data *, \ + __const unsigned char **, __const unsigned char *, \ + unsigned char **, size_t *, int, int); +#include "gconv_builtin.h" + + +#ifndef EILSEQ +# define EILSEQ EINVAL +#endif + + +/* Transform from the internal, UCS4-like format, to UCS4. The + difference between the internal ucs4 format and the real UCS4 + format is, if any, the endianess. The Unicode/ISO 10646 says that + unless some higher protocol specifies it differently, the byte + order is big endian.*/ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP internal_ucs4_loop +#define TO_LOOP internal_ucs4_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_internal_ucs4 + + +static inline int +internal_ucs4_loop (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; + int result; + +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Sigh, we have to do some real work. */ + size_t cnt; + + for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4) + *((uint32_t *) outptr)++ = bswap_32 (*(const uint32_t *) inptr); + + *inptrp = inptr; + *outptrp = outptr; +#elif __BYTE_ORDER == __BIG_ENDIAN + /* Simply copy the data. */ + *inptrp = inptr + n_convert * 4; + *outptrp = memcpy (outptr, inptr, n_convert * 4); + *outptrp += n_convert * 4; +#else +# error "This endianess is not supported." +#endif + + /* Determine the status. */ + if (*inptrp == inend) + result = __GCONV_EMPTY_INPUT; + else if (*outptrp + 4 > outend) + result = __GCONV_FULL_OUTPUT; + else + result = __GCONV_INCOMPLETE_INPUT; + + return result; +} + +#ifndef _STRING_ARCH_unaligned +static inline int +internal_ucs4_loop_unaligned (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; + int result; + +# if __BYTE_ORDER == __LITTLE_ENDIAN + /* Sigh, we have to do some real work. */ + size_t cnt; + + for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4, outptr += 4) + { + outptr[0] = inptr[3]; + outptr[1] = inptr[2]; + outptr[2] = inptr[1]; + outptr[3] = inptr[0]; + } + + *inptrp = inptr; + *outptrp = outptr; +# elif __BYTE_ORDER == __BIG_ENDIAN + /* Simply copy the data. */ + *inptrp = inptr + n_convert * 4; + *outptrp = memcpy (outptr, inptr, n_convert * 4); + *outptrp += n_convert * 4; +# else +# error "This endianess is not supported." +# endif + + /* Determine the status. */ + if (*inptrp == inend) + result = __GCONV_EMPTY_INPUT; + else if (*outptrp + 4 > outend) + result = __GCONV_FULL_OUTPUT; + else + result = __GCONV_INCOMPLETE_INPUT; + + return result; +} +#endif + + +static inline int +internal_ucs4_loop_single (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + mbstate_t *state = step_data->__statep; + size_t cnt = state->__count & 7; + + while (*inptrp < inend && cnt < 4) + state->__value.__wchb[cnt++] = *(*inptrp)++; + + if (__builtin_expect (cnt < 4, 0)) + { + /* Still not enough bytes. Store the ones in the input buffer. */ + state->__count &= ~7; + state->__count |= cnt; + + return __GCONV_INCOMPLETE_INPUT; + } + +#if __BYTE_ORDER == __LITTLE_ENDIAN + (*outptrp)[0] = state->__value.__wchb[3]; + (*outptrp)[1] = state->__value.__wchb[2]; + (*outptrp)[2] = state->__value.__wchb[1]; + (*outptrp)[3] = state->__value.__wchb[0]; + + *outptrp += 4; +#elif __BYTE_ORDER == __BIG_ENDIAN + /* XXX unaligned */ + *(*((uint32_t **) outptrp)++) = state->__value.__wch; +#else +# error "This endianess is not supported." +#endif + + /* Clear the state buffer. */ + state->__count &= ~7; + + return __GCONV_OK; +} + +#include + + +/* Transform from UCS4 to the internal, UCS4-like format. Unlike + for the other direction we have to check for correct values here. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP ucs4_internal_loop +#define TO_LOOP ucs4_internal_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_ucs4_internal + + +static inline int +ucs4_internal_loop (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + int flags = step_data->__flags; + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; + int result; + size_t cnt; + + for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4) + { + uint32_t inval; + +#if __BYTE_ORDER == __LITTLE_ENDIAN + inval = bswap_32 (*(const uint32_t *) inptr); +#else + inval = *(const uint32_t *) inptr; +#endif + + if (__builtin_expect (inval > 0x7fffffff, 0)) + { + /* The value is too large. We don't try transliteration here since + this is not an error because of the lack of possibilities to + represent the result. This is a genuine bug in the input since + UCS4 does not allow such values. */ + if (irreversible == NULL) + /* We are transliterating, don't try to correct anything. */ + return __GCONV_ILLEGAL_INPUT; + + if (flags & __GCONV_IGNORE_ERRORS) + { + /* Just ignore this character. */ + ++*irreversible; + continue; + } + + *inptrp = inptr; + *outptrp = outptr; + return __GCONV_ILLEGAL_INPUT; + } + + *((uint32_t *) outptr)++ = inval; + } + + *inptrp = inptr; + *outptrp = outptr; + + /* Determine the status. */ + if (*inptrp == inend) + result = __GCONV_EMPTY_INPUT; + else if (*outptrp + 4 > outend) + result = __GCONV_FULL_OUTPUT; + else + result = __GCONV_INCOMPLETE_INPUT; + + return result; +} + +#ifndef _STRING_ARCH_unaligned +static inline int +ucs4_internal_loop_unaligned (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + int flags = step_data->__flags; + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; + int result; + size_t cnt; + + for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4) + { + if (__builtin_expect (inptr[0] > 0x80, 0)) + { + /* The value is too large. We don't try transliteration here since + this is not an error because of the lack of possibilities to + represent the result. This is a genuine bug in the input since + UCS4 does not allow such values. */ + if (irreversible == NULL) + /* We are transliterating, don't try to correct anything. */ + return __GCONV_ILLEGAL_INPUT; + + if (flags & __GCONV_IGNORE_ERRORS) + { + /* Just ignore this character. */ + ++*irreversible; + continue; + } + + *inptrp = inptr; + *outptrp = outptr; + return __GCONV_ILLEGAL_INPUT; + } + +# if __BYTE_ORDER == __LITTLE_ENDIAN + outptr[3] = inptr[0]; + outptr[2] = inptr[1]; + outptr[1] = inptr[2]; + outptr[0] = inptr[3]; +# else + outptr[0] = inptr[0]; + outptr[1] = inptr[1]; + outptr[2] = inptr[2]; + outptr[3] = inptr[3]; +# endif + outptr += 4; + } + + *inptrp = inptr; + *outptrp = outptr; + + /* Determine the status. */ + if (*inptrp == inend) + result = __GCONV_EMPTY_INPUT; + else if (*outptrp + 4 > outend) + result = __GCONV_FULL_OUTPUT; + else + result = __GCONV_INCOMPLETE_INPUT; + + return result; +} +#endif + + +static inline int +ucs4_internal_loop_single (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + mbstate_t *state = step_data->__statep; + int flags = step_data->__flags; + size_t cnt = state->__count & 7; + + while (*inptrp < inend && cnt < 4) + state->__value.__wchb[cnt++] = *(*inptrp)++; + + if (__builtin_expect (cnt < 4, 0)) + { + /* Still not enough bytes. Store the ones in the input buffer. */ + state->__count &= ~7; + state->__count |= cnt; + + return __GCONV_INCOMPLETE_INPUT; + } + + if (__builtin_expect (((unsigned char *) state->__value.__wchb)[0] > 0x80, + 0)) + { + /* The value is too large. We don't try transliteration here since + this is not an error because of the lack of possibilities to + represent the result. This is a genuine bug in the input since + UCS4 does not allow such values. */ + if (!(flags & __GCONV_IGNORE_ERRORS)) + { + *inptrp -= cnt - (state->__count & 7); + return __GCONV_ILLEGAL_INPUT; + } + } + else + { +#if __BYTE_ORDER == __LITTLE_ENDIAN + (*outptrp)[0] = state->__value.__wchb[3]; + (*outptrp)[1] = state->__value.__wchb[2]; + (*outptrp)[2] = state->__value.__wchb[1]; + (*outptrp)[3] = state->__value.__wchb[0]; +#elif __BYTE_ORDER == __BIG_ENDIAN + (*outptrp)[0] = state->__value.__wchb[0]; + (*outptrp)[1] = state->__value.__wchb[1]; + (*outptrp)[2] = state->__value.__wchb[2]; + (*outptrp)[3] = state->__value.__wchb[3]; +#endif + + *outptrp += 4; + } + + /* Clear the state buffer. */ + state->__count &= ~7; + + return __GCONV_OK; +} + +#include + + +/* Similarly for the little endian form. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP internal_ucs4le_loop +#define TO_LOOP internal_ucs4le_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_internal_ucs4le + + +static inline int +internal_ucs4le_loop (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; + int result; + +#if __BYTE_ORDER == __BIG_ENDIAN + /* Sigh, we have to do some real work. */ + size_t cnt; + + for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4) + *((uint32_t *) outptr)++ = bswap_32 (*(const uint32_t *) inptr); + + *inptrp = inptr; + *outptrp = outptr; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + /* Simply copy the data. */ + *inptrp = inptr + n_convert * 4; + *outptrp = memcpy (outptr, inptr, n_convert * 4); + *outptrp += n_convert * 4; +#else +# error "This endianess is not supported." +#endif + + /* Determine the status. */ + if (*inptrp == inend) + result = __GCONV_EMPTY_INPUT; + else if (*outptrp + 4 > outend) + result = __GCONV_FULL_OUTPUT; + else + result = __GCONV_INCOMPLETE_INPUT; + + return result; +} + +#ifndef _STRING_ARCH_unaligned +static inline int +internal_ucs4le_loop_unaligned (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; + int result; + +# if __BYTE_ORDER == __BIG_ENDIAN + /* Sigh, we have to do some real work. */ + size_t cnt; + + for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4, outptr += 4) + { + outptr[0] = inptr[3]; + outptr[1] = inptr[2]; + outptr[2] = inptr[1]; + outptr[3] = inptr[0]; + } + + *inptrp = inptr; + *outptrp = outptr; +# elif __BYTE_ORDER == __LITTLE_ENDIAN + /* Simply copy the data. */ + *inptrp = inptr + n_convert * 4; + *outptrp = memcpy (outptr, inptr, n_convert * 4); + *outptrp += n_convert * 4; +# else +# error "This endianess is not supported." +# endif + + /* Determine the status. */ + if (*inptrp + 4 > inend) + result = __GCONV_EMPTY_INPUT; + else if (*outptrp + 4 > outend) + result = __GCONV_FULL_OUTPUT; + else + result = __GCONV_INCOMPLETE_INPUT; + + return result; +} +#endif + + +static inline int +internal_ucs4le_loop_single (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + mbstate_t *state = step_data->__statep; + size_t cnt = state->__count & 7; + + while (*inptrp < inend && cnt < 4) + state->__value.__wchb[cnt++] = *(*inptrp)++; + + if (__builtin_expect (cnt < 4, 0)) + { + /* Still not enough bytes. Store the ones in the input buffer. */ + state->__count &= ~7; + state->__count |= cnt; + + return __GCONV_INCOMPLETE_INPUT; + } + +#if __BYTE_ORDER == __BIG_ENDIAN + (*outptrp)[0] = state->__value.__wchb[3]; + (*outptrp)[1] = state->__value.__wchb[2]; + (*outptrp)[2] = state->__value.__wchb[1]; + (*outptrp)[3] = state->__value.__wchb[0]; + + *outptrp += 4; +#else + /* XXX unaligned */ + *(*((uint32_t **) outptrp)++) = state->__value.__wch; +#endif + + /* Clear the state buffer. */ + state->__count &= ~7; + + return __GCONV_OK; +} + +#include + + +/* And finally from UCS4-LE to the internal encoding. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP ucs4le_internal_loop +#define TO_LOOP ucs4le_internal_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_ucs4le_internal + + +static inline int +ucs4le_internal_loop (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + int flags = step_data->__flags; + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; + int result; + size_t cnt; + + for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4) + { + uint32_t inval; + +#if __BYTE_ORDER == __BIG_ENDIAN + inval = bswap_32 (*(const uint32_t *) inptr); +#else + inval = *(const uint32_t *) inptr; +#endif + + if (__builtin_expect (inval > 0x7fffffff, 0)) + { + /* The value is too large. We don't try transliteration here since + this is not an error because of the lack of possibilities to + represent the result. This is a genuine bug in the input since + UCS4 does not allow such values. */ + if (irreversible == NULL) + /* We are transliterating, don't try to correct anything. */ + return __GCONV_ILLEGAL_INPUT; + + if (flags & __GCONV_IGNORE_ERRORS) + { + /* Just ignore this character. */ + ++*irreversible; + continue; + } + + return __GCONV_ILLEGAL_INPUT; + } + + *((uint32_t *) outptr)++ = inval; + } + + *inptrp = inptr; + *outptrp = outptr; + + /* Determine the status. */ + if (*inptrp == inend) + result = __GCONV_EMPTY_INPUT; + else if (*outptrp + 4 > outend) + result = __GCONV_FULL_OUTPUT; + else + result = __GCONV_INCOMPLETE_INPUT; + + return result; +} + +#ifndef _STRING_ARCH_unaligned +static inline int +ucs4le_internal_loop_unaligned (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + int flags = step_data->__flags; + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; + int result; + size_t cnt; + + for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4) + { + if (__builtin_expect (inptr[3] > 0x80, 0)) + { + /* The value is too large. We don't try transliteration here since + this is not an error because of the lack of possibilities to + represent the result. This is a genuine bug in the input since + UCS4 does not allow such values. */ + if (irreversible == NULL) + /* We are transliterating, don't try to correct anything. */ + return __GCONV_ILLEGAL_INPUT; + + if (flags & __GCONV_IGNORE_ERRORS) + { + /* Just ignore this character. */ + ++*irreversible; + continue; + } + + *inptrp = inptr; + *outptrp = outptr; + return __GCONV_ILLEGAL_INPUT; + } + +# if __BYTE_ORDER == __BIG_ENDIAN + outptr[3] = inptr[0]; + outptr[2] = inptr[1]; + outptr[1] = inptr[2]; + outptr[0] = inptr[3]; +# else + outptr[0] = inptr[0]; + outptr[1] = inptr[1]; + outptr[2] = inptr[2]; + outptr[3] = inptr[3]; +# endif + + outptr += 4; + } + + *inptrp = inptr; + *outptrp = outptr; + + /* Determine the status. */ + if (*inptrp == inend) + result = __GCONV_EMPTY_INPUT; + else if (*outptrp + 4 > outend) + result = __GCONV_FULL_OUTPUT; + else + result = __GCONV_INCOMPLETE_INPUT; + + return result; +} +#endif + + +static inline int +ucs4le_internal_loop_single (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible) +{ + mbstate_t *state = step_data->__statep; + int flags = step_data->__flags; + size_t cnt = state->__count & 7; + + while (*inptrp < inend && cnt < 4) + state->__value.__wchb[cnt++] = *(*inptrp)++; + + if (__builtin_expect (cnt < 4, 0)) + { + /* Still not enough bytes. Store the ones in the input buffer. */ + state->__count &= ~7; + state->__count |= cnt; + + return __GCONV_INCOMPLETE_INPUT; + } + + if (__builtin_expect (((unsigned char *) state->__value.__wchb)[3] > 0x80, + 0)) + { + /* The value is too large. We don't try transliteration here since + this is not an error because of the lack of possibilities to + represent the result. This is a genuine bug in the input since + UCS4 does not allow such values. */ + if (!(flags & __GCONV_IGNORE_ERRORS)) + return __GCONV_ILLEGAL_INPUT; + } + else + { +#if __BYTE_ORDER == __BIG_ENDIAN + (*outptrp)[0] = state->__value.__wchb[3]; + (*outptrp)[1] = state->__value.__wchb[2]; + (*outptrp)[2] = state->__value.__wchb[1]; + (*outptrp)[3] = state->__value.__wchb[0]; +#elif __BYTE_ORDER == __BIG_ENDIAN + (*outptrp)[0] = state->__value.__wchb[0]; + (*outptrp)[1] = state->__value.__wchb[1]; + (*outptrp)[2] = state->__value.__wchb[2]; + (*outptrp)[3] = state->__value.__wchb[3]; +#endif + + *outptrp += 4; + } + + /* Clear the state buffer. */ + state->__count &= ~7; + + return __GCONV_OK; +} + +#include + + +/* Convert from ISO 646-IRV to the internal (UCS4-like) format. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 1 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP ascii_internal_loop +#define TO_LOOP ascii_internal_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_ascii_internal +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + if (__builtin_expect (*inptr > '\x7f', 0)) \ + { \ + /* The value is too large. We don't try transliteration here since \ + this is not an error because of the lack of possibilities to \ + represent the result. This is a genuine bug in the input since \ + ASCII does not allow such values. */ \ + if (! ignore_errors_p ()) \ + { \ + /* This is no correct ANSI_X3.4-1968 character. */ \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + ++*irreversible; \ + ++inptr; \ + } \ + else \ + /* It's an one byte sequence. */ \ + *((uint32_t *) outptr)++ = *inptr++; \ + } +#define LOOP_NEED_FLAGS +#include +#include + + +/* Convert from the internal (UCS4-like) format to ISO 646-IRV. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 1 +#define FROM_DIRECTION 1 +#define FROM_LOOP internal_ascii_loop +#define TO_LOOP internal_ascii_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_internal_ascii +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + if (__builtin_expect (*((const uint32_t *) inptr) > 0x7f, 0)) \ + { \ + UNICODE_TAG_HANDLER (*((const uint32_t *) inptr), 4); \ + STANDARD_ERR_HANDLER (4); \ + } \ + else \ + /* It's an one byte sequence. */ \ + *outptr++ = *((const uint32_t *) inptr)++; \ + } +#define LOOP_NEED_FLAGS +#include +#include + + +/* Convert from the internal (UCS4-like) format to UTF-8. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 1 +#define MAX_NEEDED_TO 6 +#define FROM_DIRECTION 1 +#define FROM_LOOP internal_utf8_loop +#define TO_LOOP internal_utf8_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_internal_utf8 +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define MAX_NEEDED_OUTPUT MAX_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint32_t wc = *((const uint32_t *) inptr); \ + \ + if (wc < 0x80) \ + /* It's an one byte sequence. */ \ + *outptr++ = (unsigned char) wc; \ + else if (__builtin_expect (wc <= 0x7fffffff, 1)) \ + { \ + size_t step; \ + char *start; \ + \ + for (step = 2; step < 6; ++step) \ + if ((wc & (~(uint32_t)0 << (5 * step + 1))) == 0) \ + break; \ + \ + if (__builtin_expect (outptr + step > outend, 0)) \ + { \ + /* Too long. */ \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + \ + start = outptr; \ + *outptr = (unsigned char) (~0xff >> step); \ + outptr += step; \ + --step; \ + do \ + { \ + start[step] = 0x80 | (wc & 0x3f); \ + wc >>= 6; \ + } \ + while (--step > 0); \ + start[0] |= wc; \ + } \ + else \ + { \ + STANDARD_ERR_HANDLER (4); \ + } \ + \ + inptr += 4; \ + } +#define LOOP_NEED_FLAGS +#include +#include + + +/* Convert from UTF-8 to the internal (UCS4-like) format. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 1 +#define MAX_NEEDED_FROM 6 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP utf8_internal_loop +#define TO_LOOP utf8_internal_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_utf8_internal +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MAX_NEEDED_INPUT MAX_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint32_t ch; \ + uint32_t cnt; \ + uint32_t i; \ + \ + /* Next input byte. */ \ + ch = *inptr; \ + \ + if (ch < 0x80) \ + { \ + /* One byte sequence. */ \ + cnt = 1; \ + ++inptr; \ + } \ + else \ + { \ + if (ch >= 0xc2 && ch < 0xe0) \ + { \ + /* We expect two bytes. The first byte cannot be 0xc0 or 0xc1, \ + otherwise the wide character could have been represented \ + using a single byte. */ \ + cnt = 2; \ + ch &= 0x1f; \ + } \ + else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \ + { \ + /* We expect three bytes. */ \ + cnt = 3; \ + ch &= 0x0f; \ + } \ + else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \ + { \ + /* We expect four bytes. */ \ + cnt = 4; \ + ch &= 0x07; \ + } \ + else if (__builtin_expect ((ch & 0xfc) == 0xf8, 1)) \ + { \ + /* We expect five bytes. */ \ + cnt = 5; \ + ch &= 0x03; \ + } \ + else if (__builtin_expect ((ch & 0xfe) == 0xfc, 1)) \ + { \ + /* We expect six bytes. */ \ + cnt = 6; \ + ch &= 0x01; \ + } \ + else \ + { \ + int skipped; \ + \ + if (! ignore_errors_p ()) \ + { \ + /* This is an illegal encoding. */ \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + /* Search the end of this ill-formed UTF-8 character. This \ + is the next byte with (x & 0xc0) != 0x80. */ \ + skipped = 0; \ + do \ + { \ + ++inptr; \ + ++skipped; \ + } \ + while (inptr < inend && (*inptr & 0xc0) == 0x80 && skipped < 5); \ + \ + continue; \ + } \ + \ + if (__builtin_expect (inptr + cnt > inend, 0)) \ + { \ + /* We don't have enough input. But before we report that check \ + that all the bytes are correct. */ \ + for (i = 1; inptr + i < inend; ++i) \ + if ((inptr[i] & 0xc0) != 0x80) \ + break; \ + \ + if (__builtin_expect (inptr + i == inend, 1)) \ + { \ + result = __GCONV_INCOMPLETE_INPUT; \ + break; \ + } \ + \ + if (ignore_errors_p ()) \ + { \ + /* Ignore it. */ \ + inptr += i; \ + ++*irreversible; \ + continue; \ + } \ + \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + /* Read the possible remaining bytes. */ \ + for (i = 1; i < cnt; ++i) \ + { \ + uint32_t byte = inptr[i]; \ + \ + if ((byte & 0xc0) != 0x80) \ + /* This is an illegal encoding. */ \ + break; \ + \ + ch <<= 6; \ + ch |= byte & 0x3f; \ + } \ + \ + /* If i < cnt, some trail byte was not >= 0x80, < 0xc0. \ + If cnt > 2 and ch < 2^(5*cnt-4), the wide character ch could \ + have been represented with fewer than cnt bytes. */ \ + if (i < cnt || (cnt > 2 && (ch >> (5 * cnt - 4)) == 0)) \ + { \ + /* This is an illegal encoding. */ \ + if (ignore_errors_p ()) \ + { \ + inptr += i; \ + ++*irreversible; \ + continue; \ + } \ + \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + \ + inptr += cnt; \ + } \ + \ + /* Now adjust the pointers and store the result. */ \ + *((uint32_t *) outptr)++ = ch; \ + } +#define LOOP_NEED_FLAGS + +#define STORE_REST \ + { \ + /* We store the remaining bytes while converting them into the UCS4 \ + format. We can assume that the first byte in the buffer is \ + correct and that it requires a larger number of bytes than there \ + are in the input buffer. */ \ + wint_t ch = **inptrp; \ + size_t cnt; \ + \ + state->__count = inend - *inptrp; \ + \ + if (ch >= 0xc2 && ch < 0xe0) \ + { \ + /* We expect two bytes. The first byte cannot be 0xc0 or \ + 0xc1, otherwise the wide character could have been \ + represented using a single byte. */ \ + cnt = 2; \ + ch &= 0x1f; \ + } \ + else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \ + { \ + /* We expect three bytes. */ \ + cnt = 3; \ + ch &= 0x0f; \ + } \ + else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \ + { \ + /* We expect four bytes. */ \ + cnt = 4; \ + ch &= 0x07; \ + } \ + else if (__builtin_expect ((ch & 0xfc) == 0xf8, 1)) \ + { \ + /* We expect five bytes. */ \ + cnt = 5; \ + ch &= 0x03; \ + } \ + else \ + { \ + /* We expect six bytes. */ \ + cnt = 6; \ + ch &= 0x01; \ + } \ + \ + /* The first byte is already consumed. */ \ + --cnt; \ + while (++(*inptrp) < inend) \ + { \ + ch <<= 6; \ + ch |= **inptrp & 0x3f; \ + --cnt; \ + } \ + \ + /* Shift for the so far missing bytes. */ \ + ch <<= cnt * 6; \ + \ + /* Store the value. */ \ + state->__value.__wch = ch; \ + } + +#define UNPACK_BYTES \ + { \ + wint_t wch = state->__value.__wch; \ + size_t ntotal; \ + inlen = state->__count; \ + \ + if (state->__value.__wch <= 0x7ff) \ + { \ + bytebuf[0] = 0xc0; \ + ntotal = 2; \ + } \ + else if (__builtin_expect (state->__value.__wch <= 0xffff, 1)) \ + { \ + bytebuf[0] = 0xe0; \ + ntotal = 3; \ + } \ + else if (__builtin_expect (state->__value.__wch < 0x1fffff, 1)) \ + { \ + bytebuf[0] = 0xf0; \ + ntotal = 4; \ + } \ + else if (__builtin_expect (state->__value.__wch < 0x3ffffff, 1)) \ + { \ + bytebuf[0] = 0xf8; \ + ntotal = 5; \ + } \ + else \ + { \ + bytebuf[0] = 0xfc; \ + ntotal = 6; \ + } \ + \ + do \ + { \ + if (--ntotal < inlen) \ + bytebuf[ntotal] = 0x80 | (wch & 0x3f); \ + wch >>= 6; \ + } \ + while (ntotal > 1); \ + \ + bytebuf[0] |= wch; \ + } + +#include +#include + + +/* Convert from UCS2 to the internal (UCS4-like) format. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 2 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP ucs2_internal_loop +#define TO_LOOP ucs2_internal_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_ucs2_internal +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint16_t u1 = *((const uint16_t *) inptr); \ + \ + if (__builtin_expect (u1 >= 0xd800 && u1 < 0xe000, 0)) \ + { \ + /* Surrogate characters in UCS-2 input are not valid. Reject \ + them. (Catching this here is not security relevant.) */ \ + if (! ignore_errors_p ()) \ + { \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + inptr += 2; \ + ++*irreversible; \ + continue; \ + } \ + \ + *((uint32_t *) outptr)++ = u1; \ + inptr += 2; \ + } +#define LOOP_NEED_FLAGS +#include +#include + + +/* Convert from the internal (UCS4-like) format to UCS2. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 2 +#define FROM_DIRECTION 1 +#define FROM_LOOP internal_ucs2_loop +#define TO_LOOP internal_ucs2_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_internal_ucs2 +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint32_t val = *((const uint32_t *) inptr); \ + \ + if (__builtin_expect (val >= 0x10000, 0)) \ + { \ + UNICODE_TAG_HANDLER (val, 4); \ + STANDARD_ERR_HANDLER (4); \ + } \ + else if (__builtin_expect (val >= 0xd800 && val < 0xe000, 0)) \ + { \ + /* Surrogate characters in UCS-4 input are not valid. \ + We must catch this, because the UCS-2 output might be \ + interpreted as UTF-16 by other programs. If we let \ + surrogates pass through, attackers could make a security \ + hole exploit by synthesizing any desired plane 1-16 \ + character. */ \ + if (! ignore_errors_p ()) \ + { \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + inptr += 4; \ + ++*irreversible; \ + continue; \ + } \ + else \ + { \ + *((uint16_t *) outptr)++ = val; \ + inptr += 4; \ + } \ + } +#define LOOP_NEED_FLAGS +#include +#include + + +/* Convert from UCS2 in other endianness to the internal (UCS4-like) format. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 2 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP ucs2reverse_internal_loop +#define TO_LOOP ucs2reverse_internal_loop/* This is not used.*/ +#define FUNCTION_NAME __gconv_transform_ucs2reverse_internal +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint16_t u1 = bswap_16 (*((const uint16_t *) inptr)); \ + \ + if (__builtin_expect (u1 >= 0xd800 && u1 < 0xe000, 0)) \ + { \ + /* Surrogate characters in UCS-2 input are not valid. Reject \ + them. (Catching this here is not security relevant.) */ \ + if (! ignore_errors_p ()) \ + { \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + inptr += 2; \ + ++*irreversible; \ + continue; \ + } \ + \ + *((uint32_t *) outptr)++ = u1; \ + inptr += 2; \ + } +#define LOOP_NEED_FLAGS +#include +#include + + +/* Convert from the internal (UCS4-like) format to UCS2 in other endianness. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 2 +#define FROM_DIRECTION 1 +#define FROM_LOOP internal_ucs2reverse_loop +#define TO_LOOP internal_ucs2reverse_loop/* This is not used.*/ +#define FUNCTION_NAME __gconv_transform_internal_ucs2reverse +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint32_t val = *((const uint32_t *) inptr); \ + if (__builtin_expect (val >= 0x10000, 0)) \ + { \ + UNICODE_TAG_HANDLER (val, 4); \ + STANDARD_ERR_HANDLER (4); \ + } \ + else if (__builtin_expect (val >= 0xd800 && val < 0xe000, 0)) \ + { \ + /* Surrogate characters in UCS-4 input are not valid. \ + We must catch this, because the UCS-2 output might be \ + interpreted as UTF-16 by other programs. If we let \ + surrogates pass through, attackers could make a security \ + hole exploit by synthesizing any desired plane 1-16 \ + character. */ \ + if (! ignore_errors_p ()) \ + { \ + result = __GCONV_ILLEGAL_INPUT; \ + break; \ + } \ + inptr += 4; \ + ++*irreversible; \ + continue; \ + } \ + else \ + { \ + *((uint16_t *) outptr)++ = bswap_16 (val); \ + inptr += 4; \ + } \ + } +#define LOOP_NEED_FLAGS +#include +#include diff --git a/newlib/libc/sys/linux/iconv/gconv_trans.c b/newlib/libc/sys/linux/iconv/gconv_trans.c new file mode 100644 index 000000000..dcc1004e1 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/gconv_trans.c @@ -0,0 +1,230 @@ +/* Transliteration using the locale's data. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gconv_int.h" +#include "localeinfo.h" + +int +__gconv_transliterate (struct __gconv_step *step, + struct __gconv_step_data *step_data, + void *trans_data __attribute__ ((unused)), + const unsigned char *inbufstart, + const unsigned char **inbufp, + const unsigned char *inbufend, + unsigned char **outbufstart, size_t *irreversible) +{ + return 0; +} + + +/* Structure to represent results of found (or not) transliteration + modules. */ +struct known_trans +{ + /* This structure must remain the first member. */ + struct trans_struct info; + + char *fname; + void *handle; + int open_count; +}; + + +/* Tree with results of previous calls to __gconv_translit_find. */ +static void *search_tree; + +/* We modify global data. */ +__LOCK_INIT(static, lock); + +/* Compare two transliteration entries. */ +static int +trans_compare (const void *p1, const void *p2) +{ + const struct known_trans *s1 = (const struct known_trans *) p1; + const struct known_trans *s2 = (const struct known_trans *) p2; + + return strcmp (s1->info.name, s2->info.name); +} + + +/* Open (maybe reopen) the module named in the struct. Get the function + and data structure pointers we need. */ +static int +open_translit (struct known_trans *trans) +{ + __gconv_trans_query_fct queryfct; + + trans->handle = __libc_dlopen (trans->fname); + if (trans->handle == NULL) + /* Not available. */ + return 1; + + /* Find the required symbol. */ + queryfct = __libc_dlsym (trans->handle, "gconv_trans_context"); + if (queryfct == NULL) + { + /* We cannot live with that. */ + close_and_out: + __libc_dlclose (trans->handle); + trans->handle = NULL; + return 1; + } + + /* Get the context. */ + if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames) + != 0) + goto close_and_out; + + /* Of course we also have to have the actual function. */ + trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans"); + if (trans->info.trans_fct == NULL) + goto close_and_out; + + /* Now the optional functions. */ + trans->info.trans_init_fct = + __libc_dlsym (trans->handle, "gconv_trans_init"); + trans->info.trans_context_fct = + __libc_dlsym (trans->handle, "gconv_trans_context"); + trans->info.trans_end_fct = + __libc_dlsym (trans->handle, "gconv_trans_end"); + + trans->open_count = 1; + + return 0; +} + + +int +internal_function +__gconv_translit_find (struct trans_struct *trans) +{ + struct known_trans **found; + const struct path_elem *runp; + int res = 1; + + /* We have to have a name. */ + assert (trans->name != NULL); + + /* Acquire the lock. */ +#ifdef HAVE_DD_LOCK + __lock_acquire(lock); +#endif + + /* See whether we know this module already. */ + found = tfind (trans, &search_tree, trans_compare); + if (found != NULL) + { + /* Is this module available? */ + if ((*found)->handle != NULL) + { + /* Maybe we have to reopen the file. */ + if ((*found)->handle != (void *) -1) + /* The object is not unloaded. */ + res = 0; + else if (open_translit (*found) == 0) + { + /* Copy the data. */ + *trans = (*found)->info; + (*found)->open_count++; + res = 0; + } + } + } + else + { + size_t name_len = strlen (trans->name) + 1; + int need_so = 0; + struct known_trans *newp; + + /* We have to continue looking for the module. */ + if (__gconv_path_elem == NULL) + __gconv_get_path (); + + /* See whether we have to append .so. */ + if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0) + need_so = 1; + + /* Create a new entry. */ + newp = (struct known_trans *) malloc (sizeof (struct known_trans) + + (__gconv_max_path_elem_len + + name_len + 3) + + name_len); + if (newp != NULL) + { + char *cp; + + /* Clear the struct. */ + memset (newp, '\0', sizeof (struct known_trans)); + + /* Store a copy of the module name. */ + newp->info.name = cp = (char *) (newp + 1); + cp = memcpy (cp, trans->name, name_len); + cp += name_len; + + newp->fname = cp; + + /* Search in all the directories. */ + for (runp = __gconv_path_elem; runp->name != NULL; ++runp) + { + strcpy ((char *) newp->fname, runp->name); + while(newp->fname != '\0') newp->fname++; + + cp = memcpy (newp->fname, + trans->name, name_len); + cp += name_len; + if (need_so) + memcpy (cp, ".so", sizeof (".so")); + + if (open_translit (newp) == 0) + { + /* We found a module. */ + res = 0; + break; + } + } + + if (res) + newp->fname = NULL; + + /* In any case we'll add the entry to our search tree. */ + if (tsearch (newp, &search_tree, trans_compare) == NULL) + { + /* Yickes, this should not happen. Unload the object. */ + res = 1; + /* XXX unload here. */ + } + } + } + +#ifdef HAVE_DD_LOCK + __lock_release(lock); +#endif + + return res; +} diff --git a/newlib/libc/sys/linux/iconv/hash-string.h b/newlib/libc/sys/linux/iconv/hash-string.h new file mode 100644 index 000000000..ae4bcfb3e --- /dev/null +++ b/newlib/libc/sys/linux/iconv/hash-string.h @@ -0,0 +1,60 @@ +/* Implements a string hashing function. + Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +#endif + +/* We assume to have `unsigned long int' value with at least 32 bits. */ +#define HASHWORDBITS 32 + + +/* Defines the so called `hashpjw' function by P.J. Weinberger + [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, + 1986, 1987 Bell Telephone Laboratories, Inc.] */ +static unsigned long int hash_string PARAMS ((const char *__str_param)); + +static inline unsigned long int +hash_string (str_param) + const char *str_param; +{ + unsigned long int hval, g; + const char *str = str_param; + + /* Compute the hash value for the given string. */ + hval = 0; + while (*str != '\0') + { + hval <<= 4; + hval += (unsigned long int) *str++; + g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4)); + if (g != 0) + { + hval ^= g >> (HASHWORDBITS - 8); + hval ^= g; + } + } + return hval; +} diff --git a/newlib/libc/sys/linux/iconv/iconv.c b/newlib/libc/sys/linux/iconv/iconv.c new file mode 100644 index 000000000..d0f5528f5 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/iconv.c @@ -0,0 +1,96 @@ +/* Convert characters in input buffer using conversion descriptor to + output buffer. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include /* for NULL */ +#include +#include + +#include + +#include + + +size_t +iconv (iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, + size_t *outbytesleft) +{ + __gconv_t gcd = (__gconv_t) cd; + char *outstart = outbuf ? *outbuf : NULL; + size_t irreversible; + int result; + + if (__builtin_expect (inbuf == NULL || *inbuf == NULL, 0)) + { + if (outbuf == NULL || *outbuf == NULL) + result = __gconv (gcd, NULL, NULL, NULL, NULL, &irreversible); + else + result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf, + (unsigned char *) (outstart + *outbytesleft), + &irreversible); + } + else + { + const char *instart = *inbuf; + + result = __gconv (gcd, (const unsigned char **) inbuf, + (const unsigned char *) (*inbuf + *inbytesleft), + (unsigned char **) outbuf, + (unsigned char *) (*outbuf + *outbytesleft), + &irreversible); + + *inbytesleft -= *inbuf - instart; + } + if (outstart != NULL) + *outbytesleft -= *outbuf - outstart; + + switch (__builtin_expect (result, __GCONV_OK)) + { + case __GCONV_ILLEGAL_DESCRIPTOR: + __set_errno (EBADF); + irreversible = (size_t) -1L; + break; + + case __GCONV_ILLEGAL_INPUT: + __set_errno (EILSEQ); + irreversible = (size_t) -1L; + break; + + case __GCONV_FULL_OUTPUT: + __set_errno (E2BIG); + irreversible = (size_t) -1L; + break; + + case __GCONV_INCOMPLETE_INPUT: + __set_errno (EINVAL); + irreversible = (size_t) -1L; + break; + + case __GCONV_EMPTY_INPUT: + case __GCONV_OK: + /* Nothing. */ + break; + + default: + assert (!"Nothing like this should happen"); + } + + return irreversible; +} diff --git a/newlib/libc/sys/linux/iconv/iconv.h b/newlib/libc/sys/linux/iconv/iconv.h new file mode 100644 index 000000000..5a795dc5d --- /dev/null +++ b/newlib/libc/sys/linux/iconv/iconv.h @@ -0,0 +1,51 @@ +/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ICONV_H +#define _ICONV_H 1 + +#include +#define __need_size_t +#include + + +__BEGIN_DECLS + +/* Identifier for conversion method from one codeset to another. */ +typedef void *iconv_t; + + +/* Allocate descriptor for code conversion from codeset FROMCODE to + codeset TOCODE. */ +extern iconv_t iconv_open (__const char *__tocode, __const char *__fromcode) + __THROW; + +/* Convert at most *INBYTESLEFT bytes from *INBUF according to the + code conversion algorithm specified by CD and place up to + *OUTBYTESLEFT bytes in buffer at *OUTBUF. */ +extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, + size_t *__restrict __inbytesleft, + char **__restrict __outbuf, + size_t *__restrict __outbytesleft); + +/* Free resources allocated for descriptor CD for code conversion. */ +extern int iconv_close (iconv_t __cd) __THROW; + +__END_DECLS + +#endif /* iconv.h */ diff --git a/newlib/libc/sys/linux/iconv/iconv_charmap.c b/newlib/libc/sys/linux/iconv/iconv_charmap.c new file mode 100644 index 000000000..141c8eca2 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/iconv_charmap.c @@ -0,0 +1,563 @@ +/* Convert using charmaps and possibly iconv(). + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "iconv_prog.h" + + +/* Prototypes for a few program-wide used functions. */ +extern void *xmalloc (size_t __n); +extern void *xcalloc (size_t __n, size_t __s); + + +struct convtable +{ + int term[256 / 8]; + union + { + struct convtable *sub; + struct charseq *out; + } val[256]; +}; + + +static inline struct convtable * +allocate_table (void) +{ + return (struct convtable *) xcalloc (1, sizeof (struct convtable)); +} + + +static inline int +is_term (struct convtable *tbl, unsigned int idx) +{ + return tbl->term[idx / 8] & (1 << (idx % 8)); +} + + +static inline void +clear_term (struct convtable *tbl, unsigned int idx) +{ + tbl->term[idx / 8] &= ~(1 << (idx % 8)); +} + + +static inline void +set_term (struct convtable *tbl, unsigned int idx) +{ + tbl->term[idx / 8] |= 1 << (idx % 8); +} + + +/* Generate the conversion table. */ +static struct convtable *use_from_charmap (struct charmap_t *from_charmap, + const char *to_code); +static struct convtable *use_to_charmap (const char *from_code, + struct charmap_t *to_charmap); +static struct convtable *use_both_charmaps (struct charmap_t *from_charmap, + struct charmap_t *to_charmap); + +/* Prototypes for the functions doing the actual work. */ +static int process_block (struct convtable *tbl, char *addr, size_t len, + FILE *output); +static int process_fd (struct convtable *tbl, int fd, FILE *output); +static int process_file (struct convtable *tbl, FILE *input, FILE *output); + + +int +charmap_conversion (const char *from_code, struct charmap_t *from_charmap, + const char *to_code, struct charmap_t *to_charmap, + int argc, int remaining, char *argv[], FILE *output) +{ + struct convtable *cvtbl; + int status = EXIT_SUCCESS; + + /* We have three different cases to handle: + + - both, from_charmap and to_charmap, are available. This means we + can assume that the symbolic names match and use them to create + the mapping. + + - only from_charmap is available. In this case we can only hope that + the symbolic names used are of the form in which case we + can use a UCS4->"to_code" iconv() conversion for the second step. + + - only to_charmap is available. This is similar, only that we would + use iconv() for the "to_code"->UCS4 conversion. + + We first create a table which maps input bytes into output bytes. + Once this is done we can handle all three of the cases above + equally. */ + if (from_charmap != NULL) + { + if (to_charmap == NULL) + cvtbl = use_from_charmap (from_charmap, to_code); + else + cvtbl = use_both_charmaps (from_charmap, to_charmap); + } + else + { + assert (to_charmap != NULL); + cvtbl = use_to_charmap (from_code, to_charmap); + } + + /* If we couldn't generate a table stop now. */ + if (cvtbl == NULL) + return EXIT_FAILURE; + + /* We can now start the conversion. */ + if (remaining == argc) + { + if (process_file (cvtbl, stdin, output) != 0) + status = EXIT_FAILURE; + } + else + do + { + struct stat st; + char *addr; + int fd; + + if (verbose) + printf ("%s:\n", argv[remaining]); + if (strcmp (argv[remaining], "-") == 0) + fd = 0; + else + { + fd = open (argv[remaining], O_RDONLY); + + if (fd == -1) + { + error (0, errno, _("cannot open input file `%s'"), + argv[remaining]); + status = EXIT_FAILURE; + continue; + } + } + +#ifdef _POSIX_MAPPED_FILES + /* We have possibilities for reading the input file. First try + to mmap() it since this will provide the fastest solution. */ + if (fstat (fd, &st) == 0 + && ((addr = mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE, + fd, 0)) != MAP_FAILED)) + { + /* Yes, we can use mmap(). The descriptor is not needed + anymore. */ + if (close (fd) != 0) + error (EXIT_FAILURE, errno, + _("error while closing input `%s'"), argv[remaining]); + + if (process_block (cvtbl, addr, st.st_size, output) < 0) + { + /* Something went wrong. */ + status = EXIT_FAILURE; + + /* We don't need the input data anymore. */ + munmap ((void *) addr, st.st_size); + + /* We cannot go on with producing output since it might + lead to problem because the last output might leave + the output stream in an undefined state. */ + break; + } + + /* We don't need the input data anymore. */ + munmap ((void *) addr, st.st_size); + } + else +#endif /* _POSIX_MAPPED_FILES */ + { + /* Read the file in pieces. */ + if (process_fd (cvtbl, fd, output) != 0) + { + /* Something went wrong. */ + status = EXIT_FAILURE; + + /* We don't need the input file anymore. */ + close (fd); + + /* We cannot go on with producing output since it might + lead to problem because the last output might leave + the output stream in an undefined state. */ + break; + } + + /* Now close the file. */ + close (fd); + } + } + while (++remaining < argc); + + /* All done. */ + return status; +} + + +static void +add_bytes (struct convtable *tbl, struct charseq *in, struct charseq *out) +{ + int n = 0; + unsigned int byte; + + assert (in->nbytes > 0); + + byte = ((unsigned char *) in->bytes)[n]; + while (n + 1 < in->nbytes) + { + if (is_term (tbl, byte) || tbl->val[byte].sub == NULL) + { + /* Note that we simply ignore a definition for a byte sequence + which is also the prefix for a longer one. */ + clear_term (tbl, byte); + tbl->val[byte].sub = + (struct convtable *) xcalloc (1, sizeof (struct convtable)); + } + + tbl = tbl->val[byte].sub; + + byte = ((unsigned char *) in->bytes)[++n]; + } + + /* Only add the new sequence if there is none yet and the byte sequence + is not part of an even longer one. */ + if (! is_term (tbl, byte) && tbl->val[byte].sub == NULL) + { + set_term (tbl, byte); + tbl->val[byte].out = out; + } +} + + +static struct convtable * +use_from_charmap (struct charmap_t *from_charmap, const char *to_code) +{ + /* We iterate over all entries in the from_charmap and for those which + have a known UCS4 representation we use an iconv() call to determine + the mapping to the to_code charset. */ + struct convtable *rettbl; + iconv_t cd; + void *ptr = NULL; + const void *key; + size_t keylen; + void *data; + + cd = iconv_open (to_code, "WCHAR_T"); + if (cd == (iconv_t) -1) + /* We cannot do anything. */ + return NULL; + + rettbl = allocate_table (); + + while (iterate_table (&from_charmap->char_table, &ptr, &key, &keylen, &data) + >= 0) + { + struct charseq *in = (struct charseq *) data; + + if (in->ucs4 != UNINITIALIZED_CHAR_VALUE) + { + /* There is a chance. Try the iconv module. */ + wchar_t inbuf[1] = { in->ucs4 }; + unsigned char outbuf[64]; + char *inptr = (char *) inbuf; + size_t inlen = sizeof (inbuf); + char *outptr = (char *) outbuf; + size_t outlen = sizeof (outbuf); + + (void) iconv (cd, &inptr, &inlen, &outptr, &outlen); + + if (outptr != (char *) outbuf) + { + /* We got some output. Good, use it. */ + struct charseq *newp; + + outlen = sizeof (outbuf) - outlen; + assert ((char *) outbuf + outlen == outptr); + + newp = (struct charseq *) xmalloc (sizeof (struct charseq) + + outlen); + newp->name = in->name; + newp->ucs4 = in->ucs4; + newp->nbytes = outlen; + memcpy (newp->bytes, outbuf, outlen); + + add_bytes (rettbl, in, newp); + } + + /* Clear any possible state left behind. */ + (void) iconv (cd, NULL, NULL, NULL, NULL); + } + } + + iconv_close (cd); + + return rettbl; +} + + +static struct convtable * +use_to_charmap (const char *from_code, struct charmap_t *to_charmap) +{ + /* We iterate over all entries in the to_charmap and for those which + have a known UCS4 representation we use an iconv() call to determine + the mapping to the from_code charset. */ + struct convtable *rettbl; + iconv_t cd; + void *ptr = NULL; + const void *key; + size_t keylen; + void *data; + + /* Note that the conversion we use here is the reverse direction. Without + exhaustive search we cannot figure out which input yields the UCS4 + character we are looking for. Therefore we determine it the other + way round. */ + cd = iconv_open (from_code, "WCHAR_T"); + if (cd == (iconv_t) -1) + /* We cannot do anything. */ + return NULL; + + rettbl = allocate_table (); + + while (iterate_table (&to_charmap->char_table, &ptr, &key, &keylen, &data) + >= 0) + { + struct charseq *out = (struct charseq *) data; + + if (out->ucs4 != UNINITIALIZED_CHAR_VALUE) + { + /* There is a chance. Try the iconv module. */ + wchar_t inbuf[1] = { out->ucs4 }; + unsigned char outbuf[64]; + char *inptr = (char *) inbuf; + size_t inlen = sizeof (inbuf); + char *outptr = (char *) outbuf; + size_t outlen = sizeof (outbuf); + + (void) iconv (cd, &inptr, &inlen, &outptr, &outlen); + + if (outptr != (char *) outbuf) + { + /* We got some output. Good, use it. */ + struct charseq *newp; + + outlen = sizeof (outbuf) - outlen; + assert ((char *) outbuf + outlen == outptr); + + newp = (struct charseq *) xmalloc (sizeof (struct charseq) + + outlen); + newp->name = out->name; + newp->ucs4 = out->ucs4; + newp->nbytes = outlen; + memcpy (newp->bytes, outbuf, outlen); + + add_bytes (rettbl, newp, out); + } + + /* Clear any possible state left behind. */ + (void) iconv (cd, NULL, NULL, NULL, NULL); + } + } + + iconv_close (cd); + + return rettbl; +} + + +static struct convtable * +use_both_charmaps (struct charmap_t *from_charmap, + struct charmap_t *to_charmap) +{ + /* In this case we iterate over all the entries in the from_charmap, + determine the internal name, and find an appropriate entry in the + to_charmap (if it exists). */ + struct convtable *rettbl = allocate_table (); + void *ptr = NULL; + const void *key; + size_t keylen; + void *data; + + while (iterate_table (&from_charmap->char_table, &ptr, &key, &keylen, &data) + >= 0) + { + struct charseq *in = (struct charseq *) data; + struct charseq *out = charmap_find_value (to_charmap, key, keylen); + + if (out != NULL) + add_bytes (rettbl, in, out); + } + + return rettbl; +} + + +static int +process_block (struct convtable *tbl, char *addr, size_t len, FILE *output) +{ + size_t n = 0; + + while (n < len) + { + struct convtable *cur = tbl; + unsigned char *curp = (unsigned char *) addr; + unsigned int byte = *curp; + int cnt; + struct charseq *out; + + while (! is_term (cur, byte)) + if (cur->val[byte].sub == NULL) + { + /* This is a invalid sequence. Skip the first byte if we are + ignoring errors. Otherwise punt. */ + if (! omit_invalid) + { + error (0, 0, _("illegal input sequence at position %Zd"), n); + return -1; + } + + n -= curp - (unsigned char *) addr; + + byte = *(curp = (unsigned char *) ++addr); + if (++n >= len) + /* All converted. */ + return 0; + + cur = tbl; + } + else + { + cur = cur->val[byte].sub; + + if (++n >= len) + { + error (0, 0, _("\ +incomplete character or shift sequence at end of buffer")); + return -1; + } + + byte = *++curp; + } + + /* We found a final byte. Write the output bytes. */ + out = cur->val[byte].out; + for (cnt = 0; cnt < out->nbytes; ++cnt) + fputc_unlocked (out->bytes[cnt], output); + + addr = (char *) curp + 1; + ++n; + } + + return 0; +} + + +static int +process_fd (struct convtable *tbl, int fd, FILE *output) +{ + /* we have a problem with reading from a desriptor since we must not + provide the iconv() function an incomplete character or shift + sequence at the end of the buffer. Since we have to deal with + arbitrary encodings we must read the whole text in a buffer and + process it in one step. */ + static char *inbuf = NULL; + static size_t maxlen = 0; + char *inptr = NULL; + size_t actlen = 0; + + while (actlen < maxlen) + { + ssize_t n = read (fd, inptr, maxlen - actlen); + + if (n == 0) + /* No more text to read. */ + break; + + if (n == -1) + { + /* Error while reading. */ + error (0, errno, _("error while reading the input")); + return -1; + } + + inptr += n; + actlen += n; + } + + if (actlen == maxlen) + while (1) + { + ssize_t n; + + /* Increase the buffer. */ + maxlen += 32768; + inbuf = realloc (inbuf, maxlen); + if (inbuf == NULL) + error (0, errno, _("unable to allocate buffer for input")); + inptr = inbuf + actlen; + + do + { + n = read (fd, inptr, maxlen - actlen); + + if (n == 0) + /* No more text to read. */ + break; + + if (n == -1) + { + /* Error while reading. */ + error (0, errno, _("error while reading the input")); + return -1; + } + + inptr += n; + actlen += n; + } + while (actlen < maxlen); + + if (n == 0) + /* Break again so we leave both loops. */ + break; + } + + /* Now we have all the input in the buffer. Process it in one run. */ + return process_block (tbl, inbuf, actlen, output); +} + + +static int +process_file (struct convtable *tbl, FILE *input, FILE *output) +{ + /* This should be safe since we use this function only for `stdin' and + we haven't read anything so far. */ + return process_fd (tbl, fileno (input), output); +} diff --git a/newlib/libc/sys/linux/iconv/iconv_close.c b/newlib/libc/sys/linux/iconv/iconv_close.c new file mode 100644 index 000000000..038acc69e --- /dev/null +++ b/newlib/libc/sys/linux/iconv/iconv_close.c @@ -0,0 +1,37 @@ +/* Release any resource associated with given conversion descriptor. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#include + + +int +iconv_close (iconv_t cd) +{ + if (__builtin_expect (cd == (iconv_t *) -1L, 0)) + { + __set_errno (EBADF); + return -1; + } + + return __gconv_close ((__gconv_t) cd) ? -1 : 0; +} diff --git a/newlib/libc/sys/linux/iconv/iconv_open.c b/newlib/libc/sys/linux/iconv/iconv_open.c new file mode 100644 index 000000000..ac44af80c --- /dev/null +++ b/newlib/libc/sys/linux/iconv/iconv_open.c @@ -0,0 +1,65 @@ +/* Get descriptor for character set conversion. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + +#include +#include "gconv_charset.h" + + +iconv_t +iconv_open (const char *tocode, const char *fromcode) +{ + char *tocode_conv; + char *fromcode_conv; + size_t tocode_len; + size_t fromcode_len; + __gconv_t cd; + int res; + + /* Normalize the name. We remove all characters beside alpha-numeric, + '_', '-', '/', and '.'. */ + tocode_len = strlen (tocode); + tocode_conv = alloca (tocode_len + 3); + strip (tocode_conv, tocode); + tocode = tocode_conv[2] == '\0' ? upstr (tocode_conv, tocode) : tocode_conv; + + fromcode_len = strlen (fromcode); + fromcode_conv = alloca (fromcode_len + 3); + strip (fromcode_conv, fromcode); + fromcode = (fromcode_conv[2] == '\0' + ? upstr (fromcode_conv, fromcode) : fromcode_conv); + + res = __gconv_open (tocode, fromcode, &cd, 0); + + if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK) + { + /* We must set the error number according to the specs. */ + if (res == __GCONV_NOCONV || res == __GCONV_NODB) + __set_errno (EINVAL); + + return (iconv_t) -1; + } + + return (iconv_t) cd; +} diff --git a/newlib/libc/sys/linux/iconv/iconvconfig.c b/newlib/libc/sys/linux/iconv/iconvconfig.c new file mode 100644 index 000000000..8ad6c93e2 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/iconvconfig.c @@ -0,0 +1,1176 @@ +/* Generate fastloading iconv module configuration files. + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "iconvconfig.h" + +/* Get libc version number. */ +#include "../version.h" + +#define PACKAGE _libc_intl_domainname + + +/* The hashing function we use. */ +#include "../intl/hash-string.h" + + +/* Types used. */ +struct module +{ + char *fromname; + struct Strent *fromname_strent; + char *filename; + struct Strent *filename_strent; + const char *directory; + struct Strent *directory_strent; + struct module *next; + int cost; + struct Strent *toname_strent; + char toname[0]; +}; + +struct alias +{ + char *fromname; + struct Strent *froment; + struct module *module; + struct Strent *toent; + char toname[0]; +}; + +struct name +{ + const char *name; + struct Strent *strent; + int module_idx; + uint32_t hashval; +}; + +struct name_info +{ + const char *canonical_name; + struct Strent *canonical_strent; + + struct module *from_internal; + struct module *to_internal; + + struct other_conv_list + { + int dest_idx; + struct other_conv + { + gidx_t module_idx; + struct module *module; + struct other_conv *next; + } other_conv; + struct other_conv_list *next; + } *other_conv_list; +}; + + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + +/* Short description of program. */ +static const char doc[] = N_("\ +Create fastloading iconv module configuration file."); + +/* Strings for arguments in help texts. */ +static const char args_doc[] = N_("[DIR...]"); + +/* Function to print some extra text in the help message. */ +static char *more_help (int key, const char *text, void *input); + +/* Data structure to communicate with argp functions. */ +static struct argp argp = +{ + NULL, NULL, args_doc, doc, NULL, more_help +}; + + +/* The function doing the actual work. */ +static int handle_dir (const char *dir); + +/* Add all known builtin conversions and aliases. */ +static void add_builtins (void); + +/* Create list of all aliases without circular aliases. */ +static void get_aliases (void); + +/* Create list of all modules. */ +static void get_modules (void); + +/* Get list of all the names and thereby indexing them. */ +static void generate_name_list (void); + +/* Collect information about all the names. */ +static void generate_name_info (void); + +/* Write the output file. */ +static int write_output (void); + + +/* Search tree of the modules we know. */ +static void *modules; + +/* Search tree of the aliases we know. */ +static void *aliases; + +/* Search tree for name to index mapping. */ +static void *names; + +/* Number of names we know about. */ +static int nnames; + +/* List of all aliases. */ +static struct alias **alias_list; +static size_t nalias_list; +static size_t nalias_list_max; + +/* List of all modules. */ +static struct module **module_list; +static size_t nmodule_list; +static size_t nmodule_list_max; + +/* Names and information about them. */ +static struct name_info *name_info; +static size_t nname_info; + +/* Number of translations not from or to INTERNAL. */ +static size_t nextra_modules; + + +/* Names and aliases for the builtin transformations. */ +static struct +{ + const char *from; + const char *to; +} builtin_alias[] = + { +#define BUILTIN_ALIAS(alias, real) \ + { .from = alias, .to = real }, +#define BUILTIN_TRANSFORMATION(From, To, Cost, Name, Fct, MinF, MaxF, \ + MinT, MaxT) +#include + }; +#undef BUILTIN_ALIAS +#undef BUILTIN_TRANSFORMATION +#define nbuiltin_alias (sizeof (builtin_alias) / sizeof (builtin_alias[0])) + +static struct +{ + const char *from; + const char *to; + const char *module; + int cost; +} builtin_trans[] = + { +#define BUILTIN_ALIAS(alias, real) +#define BUILTIN_TRANSFORMATION(From, To, Cost, Name, Fct, MinF, MaxF, \ + MinT, MaxT) \ + { .from = From, .to = To, .module = Name, .cost = Cost }, +#include + }; +#define nbuiltin_trans (sizeof (builtin_trans) / sizeof (builtin_trans[0])) + + +/* Filename extension for the modules. */ +#ifndef MODULE_EXT +# define MODULE_EXT ".so" +#endif +static const char gconv_module_ext[] = MODULE_EXT; + + +extern void *xmalloc (size_t n) __attribute_malloc__; +extern void *xcalloc (size_t n, size_t m) __attribute_malloc__; +extern void *xrealloc (void *p, size_t n); + + +/* C string table handling. */ +struct Strtab; +struct Strent; + +/* Create new C string table object in memory. */ +extern struct Strtab *strtabinit (void); + +/* Free resources allocated for C string table ST. */ +extern void strtabfree (struct Strtab *st); + +/* Add string STR (length LEN is != 0) to C string table ST. */ +extern struct Strent *strtabadd (struct Strtab *st, const char *str, + size_t len); + +/* Finalize string table ST and store size in *SIZE and return a pointer. */ +extern void *strtabfinalize (struct Strtab *st, size_t *size); + +/* Get offset in string table for string associated with SE. */ +extern size_t strtaboffset (struct Strent *se); + +/* String table we construct. */ +static struct Strtab *strtab; + + + +int +main (int argc, char *argv[]) +{ + int remaining; + int status = 0; + char *path; + char *tp; + const char *old = GCONV_PATH; + size_t len = strlen (old) + 1; + char *new = alloca(len); + + /* Enable memory use testing. */ + /* mcheck_pedantic (NULL); */ + mtrace (); + + /* Set locale via LC_ALL. */ + setlocale (LC_ALL, ""); + + /* Set the text message domain. */ + textdomain (_libc_intl_domainname); + + /* Parse and process arguments. */ + argp_parse (&argp, argc, argv, 0, &remaining, NULL); + + /* Initialize the string table. */ + strtab = strtabinit (); + + /* Handle all directories mentioned. */ + while (remaining < argc) + status |= handle_dir (argv[remaining++]); + + /* In any case also handle the standard directory. */ + path = memcpy (new, old, len); + tp = strtok (path, ":"); + while (tp != NULL) + { + status |= handle_dir (tp); + + tp = strtok (NULL, ":"); + } + + /* Add the builtin transformations and aliases without overwriting + anything. */ + add_builtins (); + + /* Store aliases in an array. */ + get_aliases (); + + /* Get list of all modules. */ + get_modules (); + + /* Generate list of all the names we know to handle in some way. */ + generate_name_list (); + + /* Now we know all the names we will handle, collect information + about them. */ + generate_name_info (); + + /* Write the output file, but only if we haven't seen any error. */ + if (status == 0) + status = write_output (); + else + error (1, 0, _("no output file produced because warning were issued")); + + return status; +} + + +static char * +more_help (int key, const char *text, void *input) +{ + switch (key) + { + case ARGP_KEY_HELP_EXTRA: + /* We print some extra information. */ + return strdup (gettext ("\ +Report bugs using the `glibcbug' script to .\n")); + default: + break; + } + return (char *) text; +} + + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state) +{ + fprintf (stream, "iconvconfig (GNU %s) %s\n", PACKAGE, VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Free Software Foundation, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2002"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} + + +static int +alias_compare (const void *p1, const void *p2) +{ + const struct alias *a1 = (const struct alias *) p1; + const struct alias *a2 = (const struct alias *) p2; + + return strcmp (a1->fromname, a2->fromname); +} + + +static void +new_alias (const char *fromname, size_t fromlen, const char *toname, + size_t tolen) +{ + struct alias *newp; + void **inserted; + + newp = (struct alias *) xmalloc (sizeof (struct alias) + fromlen + tolen); + + newp->fromname = memcpy (newp->toname, toname, tolen); + newp->fromname += tolen; + memcpy (newp->fromname, fromname, fromlen); + newp->module = NULL; + + inserted = (void **) tsearch (newp, &aliases, alias_compare); + if (inserted == NULL) + error (EXIT_FAILURE, errno, gettext ("while inserting in search tree")); + if (*inserted != newp) + /* Something went wrong, free this entry. */ + free (newp); + else + { + newp->froment = strtabadd (strtab, newp->fromname, fromlen); + newp->toent = strtabadd (strtab, newp->toname, tolen); + } +} + + +/* Add new alias. */ +static void +add_alias (char *rp) +{ + /* We now expect two more string. The strings are normalized + (converted to UPPER case) and strored in the alias database. */ + char *from; + char *to; + char *wp; + + while (isspace (*rp)) + ++rp; + from = wp = rp; + while (*rp != '\0' && !isspace (*rp)) + *wp++ = toupper (*rp++); + if (*rp == '\0') + /* There is no `to' string on the line. Ignore it. */ + return; + *wp++ = '\0'; + to = ++rp; + while (isspace (*rp)) + ++rp; + while (*rp != '\0' && !isspace (*rp)) + *wp++ = toupper (*rp++); + if (to == wp) + /* No `to' string, ignore the line. */ + return; + *wp++ = '\0'; + + assert (strlen (from) + 1 == to - from); + assert (strlen (to) + 1 == wp - to); + + new_alias (from, to - from, to, wp - to); +} + + +static void +append_alias (const void *nodep, VISIT value, int level) +{ + if (value != leaf && value != postorder) + return; + + if (nalias_list_max == nalias_list) + { + nalias_list_max += 50; + alias_list = (struct alias **) xrealloc (alias_list, + (nalias_list_max + * sizeof (struct alias *))); + } + + alias_list[nalias_list++] = *(struct alias **) nodep; +} + + +static void +get_aliases (void) +{ + twalk (aliases, append_alias); +} + + +static int +module_compare (const void *p1, const void *p2) +{ + const struct module *m1 = (const struct module *) p1; + const struct module *m2 = (const struct module *) p2; + int result; + + result = strcmp (m1->fromname, m2->fromname); + if (result == 0) + result = strcmp (m1->toname, m2->toname); + + return result; +} + + +/* Create new module record. */ +static void +new_module (const char *fromname, size_t fromlen, const char *toname, + size_t tolen, const char *directory, + const char *filename, size_t filelen, int cost, size_t need_ext) +{ + struct module *new_module; + size_t dirlen = strlen (directory) + 1; + char *tmp; + void **inserted; + + new_module = (struct module *) xmalloc (sizeof (struct module) + + fromlen + tolen + filelen + + need_ext); + + new_module->fromname = memcpy (new_module->toname, toname, tolen); + new_module->fromname += tolen; + + new_module->filename = memcpy (new_module->fromname, fromname, fromlen); + new_module->filename += fromlen; + + new_module->cost = cost; + new_module->next = NULL; + + tmp = memcpy (new_module->filename, filename, filelen); + tmp += filelen; + + if (need_ext) + { + memcpy (tmp - 1, gconv_module_ext, need_ext + 1); + filelen += need_ext; + } + new_module->directory = directory; + + /* Now insert the new module data structure in our search tree. */ + inserted = (void **) tsearch (new_module, &modules, module_compare); + if (inserted == NULL) + error (EXIT_FAILURE, errno, "while inserting in search tree"); + if (*inserted != new_module) + free (new_module); + else + { + new_module->fromname_strent = strtabadd (strtab, new_module->fromname, + fromlen); + new_module->toname_strent = strtabadd (strtab, new_module->toname, + tolen); + new_module->filename_strent = strtabadd (strtab, new_module->filename, + filelen); + new_module->directory_strent = strtabadd (strtab, directory, dirlen); + } +} + + +/* Add new module. */ +static void +internal_function +add_module (char *rp, const char *directory) +{ + /* We expect now + 1. `from' name + 2. `to' name + 3. filename of the module + 4. an optional cost value + */ + char *from; + char *to; + char *module; + char *wp; + int need_ext; + int cost; + + while (isspace (*rp)) + ++rp; + from = rp; + while (*rp != '\0' && !isspace (*rp)) + { + *rp = toupper (*rp); + ++rp; + } + if (*rp == '\0') + return; + *rp++ = '\0'; + to = wp = rp; + while (isspace (*rp)) + ++rp; + while (*rp != '\0' && !isspace (*rp)) + *wp++ = toupper (*rp++); + if (*rp == '\0') + return; + *wp++ = '\0'; + do + ++rp; + while (isspace (*rp)); + module = wp; + while (*rp != '\0' && !isspace (*rp)) + *wp++ = *rp++; + if (*rp == '\0') + { + /* There is no cost, use one by default. */ + *wp++ = '\0'; + cost = 1; + } + else + { + /* There might be a cost value. */ + char *endp; + + *wp++ = '\0'; + cost = strtol (rp, &endp, 10); + if (rp == endp || cost < 1) + /* No useful information. */ + cost = 1; + } + + if (module[0] == '\0') + /* No module name given. */ + return; + + /* See whether we must add the ending. */ + need_ext = 0; + if (wp - module < sizeof (gconv_module_ext) + || memcmp (wp - sizeof (gconv_module_ext), gconv_module_ext, + sizeof (gconv_module_ext)) != 0) + /* We must add the module extension. */ + need_ext = sizeof (gconv_module_ext) - 1; + + assert (strlen (from) + 1 == to - from); + assert (strlen (to) + 1 == module - to); + assert (strlen (module) + 1 == wp - module); + + new_module (from, to - from, to, module - to, directory, module, wp - module, + cost, need_ext); +} + + +/* Read the config file and add the data for this directory to that. */ +static int +handle_dir (const char *dir) +{ + char *infile; + FILE *fp; + char *line = NULL; + size_t linelen = 0; + size_t dirlen = strlen (dir); + char *tmp; + + if (dir[dirlen - 1] != '/') + { + char *newp = (char *) xmalloc (dirlen + 2); + dir = memcpy (newp, dir, dirlen); + newp[dirlen++] = '/'; + newp[dirlen] = '\0'; + } + + infile = (char *) alloca (dirlen + sizeof "gconv-modules"); + tmp = mempcpy (infile, dir, dirlen); + tmp += dirlen; + strcpy (tmp, "gconv-modules"); + + fp = fopen (infile, "r"); + if (fp == NULL) + { + error (0, errno, "cannot open `%s'", infile); + return 1; + } + + /* No threads present. */ + __fsetlocking (fp, FSETLOCKING_BYCALLER); + + while (!feof_unlocked (fp)) + { + char *rp, *endp, *word; + ssize_t n = __getdelim (&line, &linelen, '\n', fp); + + if (n < 0) + /* An error occurred. */ + break; + + rp = line; + /* Terminate the line (excluding comments or newline) with a NUL + byte to simplify the following code. */ + endp = strchr (rp, '#'); + if (endp != NULL) + *endp = '\0'; + else + if (rp[n - 1] == '\n') + rp[n - 1] = '\0'; + + while (isspace (*rp)) + ++rp; + + /* If this is an empty line go on with the next one. */ + if (rp == endp) + continue; + + word = rp; + while (*rp != '\0' && !isspace (*rp)) + ++rp; + + if (rp - word == sizeof ("alias") - 1 + && memcmp (word, "alias", sizeof ("alias") - 1) == 0) + add_alias (rp); + else if (rp - word == sizeof ("module") - 1 + && memcmp (word, "module", sizeof ("module") - 1) == 0) + add_module (rp, dir); + /* else */ + /* Otherwise ignore the line. */ + } + + free (line); + + fclose (fp); + + return 0; +} + + +static void +append_module (const void *nodep, VISIT value, int level) +{ + struct module *mo; + + if (value != leaf && value != postorder) + return; + + mo = *(struct module **) nodep; + + if (nmodule_list > 0 + && strcmp (module_list[nmodule_list - 1]->fromname, mo->fromname) == 0) + { + /* Same name. */ + mo->next = module_list[nmodule_list - 1]; + module_list[nmodule_list - 1] = mo; + + return; + } + + if (nmodule_list_max == nmodule_list) + { + nmodule_list_max += 50; + module_list = (struct module **) xrealloc (module_list, + (nmodule_list_max + * sizeof (struct module *))); + } + + module_list[nmodule_list++] = mo; +} + + +static void +get_modules (void) +{ + twalk (modules, append_module); +} + + +static void +add_builtins (void) +{ + size_t cnt; + + /* Add all aliases. */ + for (cnt = 0; cnt < nbuiltin_alias; ++cnt) + new_alias (builtin_alias[cnt].from, + strlen (builtin_alias[cnt].from) + 1, + builtin_alias[cnt].to, + strlen (builtin_alias[cnt].to) + 1); + + /* add the builtin transformations. */ + for (cnt = 0; cnt < nbuiltin_trans; ++cnt) + new_module (builtin_trans[cnt].from, + strlen (builtin_trans[cnt].from) + 1, + builtin_trans[cnt].to, + strlen (builtin_trans[cnt].to) + 1, + "", builtin_trans[cnt].module, + strlen (builtin_trans[cnt].module) + 1, + builtin_trans[cnt].cost, 0); +} + + +static int +name_compare (const void *p1, const void *p2) +{ + const struct name *n1 = (const struct name *) p1; + const struct name *n2 = (const struct name *) p2; + + return strcmp (n1->name, n2->name); +} + + +static struct name * +new_name (const char *str, struct Strent *strent) +{ + struct name *newp = (struct name *) xmalloc (sizeof (struct name)); + + newp->name = str; + newp->strent = strent; + newp->module_idx = -1; + newp->hashval = hash_string (str); + + ++nnames; + + return newp; +} + + +static void +generate_name_list (void) +{ + size_t i; + + /* A name we always need. */ + tsearch (new_name ("INTERNAL", strtabadd (strtab, "INTERNAL", + sizeof ("INTERNAL"))), + &names, name_compare); + + for (i = 0; i < nmodule_list; ++i) + { + struct module *runp; + + if (strcmp (module_list[i]->fromname, "INTERNAL") != 0) + tsearch (new_name (module_list[i]->fromname, + module_list[i]->fromname_strent), + &names, name_compare); + + for (runp = module_list[i]; runp != NULL; runp = runp->next) + if (strcmp (runp->toname, "INTERNAL") != 0) + tsearch (new_name (runp->toname, runp->toname_strent), + &names, name_compare); + } +} + + +static int +name_to_module_idx (const char *name, int add) +{ + struct name **res; + struct name fake_name = { .name = name }; + int idx; + + res = (struct name **) tfind (&fake_name, &names, name_compare); + if (res == NULL) + abort (); + + idx = (*res)->module_idx; + if (idx == -1 && add) + /* No module index assigned yet. */ + idx = (*res)->module_idx = nname_info++; + + return idx; +} + + +static void +generate_name_info (void) +{ + size_t i; + int idx; + + name_info = (struct name_info *) xcalloc (nmodule_list + 1, + sizeof (struct name_info)); + + /* First add a special entry for the INTERNAL name. This must have + index zero. */ + idx = name_to_module_idx ("INTERNAL", 1); + name_info[0].canonical_name = "INTERNAL"; + name_info[0].canonical_strent = strtabadd (strtab, "INTERNAL", + sizeof ("INTERNAL")); + assert (nname_info == 1); + + for (i = 0; i < nmodule_list; ++i) + { + struct module *runp; + + for (runp = module_list[i]; runp != NULL; runp = runp->next) + if (strcmp (runp->fromname, "INTERNAL") == 0) + { + idx = name_to_module_idx (runp->toname, 1); + name_info[idx].from_internal = runp; + assert (name_info[idx].canonical_name == NULL + || strcmp (name_info[idx].canonical_name, + runp->toname) == 0); + name_info[idx].canonical_name = runp->toname; + name_info[idx].canonical_strent = runp->toname_strent; + } + else if (strcmp (runp->toname, "INTERNAL") == 0) + { + idx = name_to_module_idx (runp->fromname, 1); + name_info[idx].to_internal = runp; + assert (name_info[idx].canonical_name == NULL + || strcmp (name_info[idx].canonical_name, + runp->fromname) == 0); + name_info[idx].canonical_name = runp->fromname; + name_info[idx].canonical_strent = runp->fromname_strent; + } + else + { + /* This is a transformation not to or from the INTERNAL + encoding. */ + int from_idx = name_to_module_idx (runp->fromname, 1); + int to_idx = name_to_module_idx (runp->toname, 1); + struct other_conv_list *newp; + + newp = (struct other_conv_list *) + xmalloc (sizeof (struct other_conv_list)); + newp->other_conv.module_idx = to_idx; + newp->other_conv.module = runp; + newp->other_conv.next = NULL; /* XXX Allow multiple module sequence */ + newp->dest_idx = to_idx; + newp->next = name_info[from_idx].other_conv_list; + name_info[from_idx].other_conv_list = newp; + assert (name_info[from_idx].canonical_name == NULL + || strcmp (name_info[from_idx].canonical_name, + runp->fromname) == 0); + name_info[from_idx].canonical_name = runp->fromname; + name_info[from_idx].canonical_strent = runp->fromname_strent; + + ++nextra_modules; + } + } + + /* Now add the module index information for all the aliases. */ + for (i = 0; i < nalias_list; ++i) + { + struct name fake_name = { .name = alias_list[i]->toname }; + struct name **tonamep; + + tonamep = (struct name **) tfind (&fake_name, &names, name_compare); + if (tonamep != NULL) + { + struct name *newp = new_name (alias_list[i]->fromname, + alias_list[i]->froment); + newp->module_idx = (*tonamep)->module_idx; + tsearch (newp, &names, name_compare); + } + } +} + + +static int +is_prime (unsigned long int candidate) +{ + /* No even number and none less than 10 will be passed here. */ + unsigned long int divn = 3; + unsigned long int sq = divn * divn; + + while (sq < candidate && candidate % divn != 0) + { + ++divn; + sq += 4 * divn; + ++divn; + } + + return candidate % divn != 0; +} + + +static uint32_t +next_prime (uint32_t seed) +{ + /* Make it definitely odd. */ + seed |= 1; + + while (!is_prime (seed)) + seed += 2; + + return seed; +} + + +/* Format of the output file. + + Offset Length Description + 0000 4 Magic header bytes + 0004 4 Offset of string table (stoff) + 0008 4 Offset of name hashing table (hoff) + 000C 4 Hashing table size (hsize) + 0010 4 Offset of module table (moff) + 0014 4 Offset of other conversion module table (ooff) + + stoff ??? String table + + hoff 8*hsize Array of tuples + string table offset + module index + + moff ??? Array of tuples + canonical name offset + from-internal module dir name offset + from-internal module name off + to-internal module dir name offset + to-internal module name offset + offset into other conversion table + + ooff ??? One or more of + number of steps/modules + one or more of tuple + canonical name offset for output + module dir name offset + module name offset + (following last entry with step count 0) +*/ +static int +write_output (void) +{ + int fd; + char *string_table; + size_t string_table_size; + struct gconvcache_header header; + struct hash_entry *hash_table; + size_t hash_size; + struct module_entry *module_table; + char *extra_table; + char *cur_extra_table; + size_t n; + int idx; + struct iovec iov[6]; + static const gidx_t null_word; + size_t total; + char tmpfname[sizeof (GCONV_MODULES_CACHE) + strlen (".XXXXXX")]; + + /* Function to insert the names. */ + static void name_insert (const void *nodep, VISIT value, int level) + { + struct name *name; + unsigned int idx; + unsigned int hval2; + + if (value != leaf && value != postorder) + return; + + name = *(struct name **) nodep; + idx = name->hashval % hash_size; + hval2 = 1 + name->hashval % (hash_size - 2); + + while (hash_table[idx].string_offset != 0) + if ((idx += hval2) >= hash_size) + idx -= hash_size; + + hash_table[idx].string_offset = strtaboffset (name->strent); + + assert (name->module_idx != -1); + hash_table[idx].module_idx = name->module_idx; + } + + /* Open the output file. */ + strcpy (stpcpy (tmpfname, GCONV_MODULES_CACHE), ".XXXXXX"); + fd = mkstemp (tmpfname); + if (fd == -1) + return 1; + + /* Create the string table. */ + string_table = strtabfinalize (strtab, &string_table_size); + + /* Create the hashing table. We know how many strings we have. + Creating a perfect hash table is not reasonable here. Therefore + we use open hashing and a table size which is the next prime 40% + larger than the number of strings. */ + hash_size = next_prime (nnames * 1.4); + hash_table = (struct hash_entry *) xcalloc (hash_size, + sizeof (struct hash_entry)); + /* Fill the hash table. */ + twalk (names, name_insert); + + /* Create the section for the module list. */ + module_table = (struct module_entry *) xcalloc (sizeof (struct module_entry), + nname_info); + + /* Allocate memory for the non-INTERNAL conversions. The allocated + memory can be more than is actually needed. */ + extra_table = (char *) xcalloc (sizeof (struct extra_entry) + + sizeof (gidx_t) + + sizeof (struct extra_entry_module), + nextra_modules); + cur_extra_table = extra_table; + + /* Fill in the module information. */ + for (n = 0; n < nname_info; ++n) + { + module_table[n].canonname_offset = + strtaboffset (name_info[n].canonical_strent); + + if (name_info[n].from_internal == NULL) + { + module_table[n].fromdir_offset = 0; + module_table[n].fromname_offset = 0; + } + else + { + module_table[n].fromdir_offset = + strtaboffset (name_info[n].from_internal->directory_strent); + module_table[n].fromname_offset = + strtaboffset (name_info[n].from_internal->filename_strent); + } + + if (name_info[n].to_internal == NULL) + { + module_table[n].todir_offset = 0; + module_table[n].toname_offset = 0; + } + else + { + module_table[n].todir_offset = + strtaboffset (name_info[n].to_internal->directory_strent); + module_table[n].toname_offset = + strtaboffset (name_info[n].to_internal->filename_strent); + } + + if (name_info[n].other_conv_list != NULL) + { + struct other_conv_list *other = name_info[n].other_conv_list; + + /* Store the reference. We add 1 to distinguish the entry + at offset zero from the case where no extra modules are + available. The file reader has to account for the + offset. */ + module_table[n].extra_offset = 1 + cur_extra_table - extra_table; + + do + { + struct other_conv *runp; + struct extra_entry *extra; + + /* Allocate new entry. */ + extra = (struct extra_entry *) cur_extra_table; + cur_extra_table += sizeof (struct extra_entry); + extra->module_cnt = 0; + + runp = &other->other_conv; + do + { + cur_extra_table += sizeof (struct extra_entry_module); + extra->module[extra->module_cnt].outname_offset = + runp->next == NULL + ? other->dest_idx : runp->next->module_idx; + extra->module[extra->module_cnt].dir_offset = + strtaboffset (runp->module->directory_strent); + extra->module[extra->module_cnt].name_offset = + strtaboffset (runp->module->filename_strent); + ++extra->module_cnt; + + runp = runp->next; + } + while (runp != NULL); + + other = other->next; + } + while (other != NULL); + + /* Final module_cnt is zero. */ + *((gidx_t *) cur_extra_table) = 0; + cur_extra_table += sizeof (gidx_t); + } + } + + header.magic = GCONVCACHE_MAGIC; + + iov[0].iov_base = &header; + iov[0].iov_len = sizeof (struct gconvcache_header); + total = iov[0].iov_len; + + header.string_offset = total; + iov[1].iov_base = string_table; + iov[1].iov_len = string_table_size; + total += iov[1].iov_len; + + idx = 2; + if ((string_table_size & (sizeof (gidx_t) - 1)) != 0) + { + iov[2].iov_base = (void *) &null_word; + iov[2].iov_len = (sizeof (gidx_t) + - (string_table_size & (sizeof (gidx_t) - 1))); + total += iov[2].iov_len; + ++idx; + } + + header.hash_offset = total; + header.hash_size = hash_size; + iov[idx].iov_base = hash_table; + iov[idx].iov_len = hash_size * sizeof (struct hash_entry); + total += iov[idx].iov_len; + ++idx; + + header.module_offset = total; + iov[idx].iov_base = module_table; + iov[idx].iov_len = nname_info * sizeof (struct module_entry); + total += iov[idx].iov_len; + ++idx; + + assert (cur_extra_table - extra_table + <= ((sizeof (struct extra_entry) + sizeof (gidx_t) + + sizeof (struct extra_entry_module)) + * nextra_modules)); + header.otherconv_offset = total; + iov[idx].iov_base = extra_table; + iov[idx].iov_len = cur_extra_table - extra_table; + total += iov[idx].iov_len; + ++idx; + + if (TEMP_FAILURE_RETRY (writev (fd, iov, idx)) != total + /* The file was created with mode 0600. Make it world-readable. */ + || fchmod (fd, 0644) != 0 + /* Rename the file, possibly replacing an old one. */ + || rename (tmpfname, GCONV_MODULES_CACHE) != 0) + { + int save_errno = errno; + close (fd); + unlink (tmpfname); + error (EXIT_FAILURE, save_errno, + gettext ("cannot generate output file")); + } + + close (fd); + + return 0; +} diff --git a/newlib/libc/sys/linux/iconv/iconvconfig.h b/newlib/libc/sys/linux/iconv/iconvconfig.h new file mode 100644 index 000000000..c52ceaefe --- /dev/null +++ b/newlib/libc/sys/linux/iconv/iconvconfig.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +typedef uint16_t gidx_t; + + +struct gconvcache_header +{ + uint32_t magic; + gidx_t string_offset; + gidx_t hash_offset; + gidx_t hash_size; + gidx_t module_offset; + gidx_t otherconv_offset; +}; + +struct hash_entry +{ + gidx_t string_offset; + gidx_t module_idx; +}; + +struct module_entry +{ + gidx_t canonname_offset; + gidx_t fromdir_offset; + gidx_t fromname_offset; + gidx_t todir_offset; + gidx_t toname_offset; + gidx_t extra_offset; +}; + +struct extra_entry +{ + gidx_t module_cnt; + struct extra_entry_module + { + gidx_t outname_offset; + gidx_t dir_offset; + gidx_t name_offset; + } module[0]; +}; + + +#define GCONVCACHE_MAGIC 0x20010324 + + +#define GCONV_MODULES_CACHE GCONV_DIR "/gconv-modules.cache" diff --git a/newlib/libc/sys/linux/iconv/loadinfo.h b/newlib/libc/sys/linux/iconv/loadinfo.h new file mode 100644 index 000000000..1de6cfd24 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/loadinfo.h @@ -0,0 +1,100 @@ +/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LOADINFO_H +#define _LOADINFO_H 1 + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef internal_function +# define internal_function +#endif + +/* Tell the compiler when a conditional or integer expression is + almost always true or almost always false. */ +#ifndef HAVE_BUILTIN_EXPECT +# define __builtin_expect(expr, val) (expr) +#endif + +/* Encoding of locale name parts. */ +#define CEN_REVISION 1 +#define CEN_SPONSOR 2 +#define CEN_SPECIAL 4 +#define XPG_NORM_CODESET 8 +#define XPG_CODESET 16 +#define TERRITORY 32 +#define CEN_AUDIENCE 64 +#define XPG_MODIFIER 128 + +#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) +#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) + + +struct loaded_l10nfile +{ + const char *filename; + int decided; + + const void *data; + + struct loaded_l10nfile *next; + struct loaded_l10nfile *successor[1]; +}; + + +/* Normalize codeset name. There is no standard for the codeset + names. Normalization allows the user to use any of the common + names. The return value is dynamically allocated and has to be + freed by the caller. */ +extern const char *_nl_normalize_codeset PARAMS ((const char *codeset, + size_t name_len)); + +extern struct loaded_l10nfile * +_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, + const char *dirlist, size_t dirlist_len, int mask, + const char *language, const char *territory, + const char *codeset, + const char *normalized_codeset, + const char *modifier, const char *special, + const char *sponsor, const char *revision, + const char *filename, int do_allocate)); + + +extern const char *_nl_expand_alias PARAMS ((const char *name)); + +/* normalized_codeset is dynamically allocated and has to be freed by + the caller. */ +extern int _nl_explode_name PARAMS ((char *name, const char **language, + const char **modifier, + const char **territory, + const char **codeset, + const char **normalized_codeset, + const char **special, + const char **sponsor, + const char **revision)); + +extern char *_nl_find_language PARAMS ((const char *name)); + +#endif /* loadinfo.h */ diff --git a/newlib/libc/sys/linux/iconv/localeinfo.h b/newlib/libc/sys/linux/iconv/localeinfo.h new file mode 100644 index 000000000..026463ffb --- /dev/null +++ b/newlib/libc/sys/linux/iconv/localeinfo.h @@ -0,0 +1,209 @@ +/* Declarations for internal libc locale interfaces + Copyright (C) 1995, 96, 97, 98, 99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LOCALEINFO_H +#define _LOCALEINFO_H 1 + +#include +#include +#include +#include +#include +#include + +/* This has to be changed whenever a new locale is defined. */ +#define __LC_LAST 13 + +#include "loadinfo.h" /* For loaded_l10nfile definition. */ + +/* Magic number at the beginning of a locale data file for CATEGORY. */ +#define LIMAGIC(category) ((unsigned int) (0x20000828 ^ (category))) + +/* Two special weight constants for the collation data. */ +#define IGNORE_CHAR 2 + +/* We use a special value for the usage counter in `locale_data' to + signal that this data must never be removed anymore. */ +#define MAX_USAGE_COUNT (UINT_MAX - 1) +#define UNDELETABLE UINT_MAX + +/* Structure describing locale data in core for a category. */ +struct locale_data +{ + const char *name; + const char *filedata; /* Region mapping the file data. */ + off_t filesize; /* Size of the file (and the region). */ + int mmaped; /* If nonzero the data is mmaped. */ + + unsigned int usage_count; /* Counter for users. */ + + int use_translit; /* Nonzero if the mb*towv*() and wc*tomb() + functions should use transliteration. */ + const char *options; /* Extra options from the locale name, + not used in the path to the locale data. */ + + unsigned int nstrings; /* Number of strings below. */ + union locale_data_value + { + const uint32_t *wstr; + const char *string; + unsigned int word; + } + values __flexarr; /* Items, usually pointers into `filedata'. */ +}; + +/* We know three kinds of collation sorting rules. */ +enum coll_sort_rule +{ + illegal_0__, + sort_forward, + sort_backward, + illegal_3__, + sort_position, + sort_forward_position, + sort_backward_position, + sort_mask +}; + +/* We can map the types of the entries into a few categories. */ +enum value_type +{ + none, + string, + stringarray, + byte, + bytearray, + word, + stringlist, + wordarray, + wstring, + wstringarray, + wstringlist +}; + + +/* Definitions for `era' information from LC_TIME. */ +#define ERA_NAME_FORMAT_MEMBERS 4 +#define ERA_M_NAME 0 +#define ERA_M_FORMAT 1 +#define ERA_W_NAME 2 +#define ERA_W_FORMAT 3 + + +/* Structure to access `era' information from LC_TIME. */ +struct era_entry +{ + uint32_t direction; /* Contains '+' or '-'. */ + int32_t offset; + int32_t start_date[3]; + int32_t stop_date[3]; + const char *era_name; + const char *era_format; + const wchar_t *era_wname; + const wchar_t *era_wformat; + int absolute_direction; + /* absolute direction: + +1 indicates that year number is higher in the future. (like A.D.) + -1 indicates that year number is higher in the past. (like B.C.) */ +}; + + +/* LC_CTYPE specific: + Hardwired indices for standard wide character translation mappings. */ +enum +{ + __TOW_toupper = 0, + __TOW_tolower = 1 +}; + + +/* LC_CTYPE specific: + Access a wide character class with a single character index. + _ISCTYPE (c, desc) = iswctype (btowc (c), desc). + c must be an `unsigned char'. desc must be a nonzero wctype_t. */ +#define _ISCTYPE(c, desc) \ + (((((const uint32_t *) (desc)) - 8)[(c) >> 5] >> ((c) & 0x1f)) & 1) + + +/* For each category declare the variable for the current locale data. */ +#define DEFINE_CATEGORY(category, category_name, items, a) \ +extern struct locale_data *_nl_current_##category; +#include "categories.def" +#undef DEFINE_CATEGORY + +extern const char *const _nl_category_names[__LC_LAST]; +extern const size_t _nl_category_name_sizes[__LC_LAST]; +extern struct locale_data * *const _nl_current[__LC_LAST]; + +/* Extract the current CATEGORY locale's string for ITEM. */ +#define _NL_CURRENT(category, item) \ + (_nl_current_##category->values[_NL_ITEM_INDEX (item)].string) + +/* Extract the current CATEGORY locale's string for ITEM. */ +#define _NL_CURRENT_WSTR(category, item) \ + ((wchar_t *) (_nl_current_##category->values[_NL_ITEM_INDEX (item)].wstr)) + +/* Extract the current CATEGORY locale's word for ITEM. */ +#define _NL_CURRENT_WORD(category, item) \ + (_nl_current_##category->values[_NL_ITEM_INDEX (item)].word) + +/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */ +#define _NL_CURRENT_DEFINE(category) \ + extern struct locale_data _nl_C_##category; \ + struct locale_data *_nl_current_##category = &_nl_C_##category + +/* Load the locale data for CATEGORY from the file specified by *NAME. + If *NAME is "", use environment variables as specified by POSIX, + and fill in *NAME with the actual name used. The directories + listed in LOCALE_PATH are searched for the locale files. */ +extern struct locale_data *_nl_find_locale (const char *locale_path, + size_t locale_path_len, + int category, const char **name); + +/* Try to load the file described by FILE. */ +extern void _nl_load_locale (struct loaded_l10nfile *file, int category); + +/* Free all resource. */ +extern void _nl_unload_locale (struct locale_data *locale); + +/* Free the locale and give back all memory if the usage count is one. */ +extern void _nl_remove_locale (int locale, struct locale_data *data); + + +/* Return `era' entry which corresponds to TP. Used in strftime. */ +extern struct era_entry *_nl_get_era_entry (const struct tm *tp); + +/* Return `era' cnt'th entry . Used in strptime. */ +extern struct era_entry *_nl_select_era_entry (int cnt); + +/* Return `alt_digit' which corresponds to NUMBER. Used in strftime. */ +extern const char *_nl_get_alt_digit (unsigned int number); + +/* Similar, but now for wide characters. */ +extern const wchar_t *_nl_get_walt_digit (unsigned int number); + +/* Parse string as alternative digit and return numeric value. */ +extern int _nl_parse_alt_digit (const char **strp); + +/* Postload processing. */ +extern void _nl_postload_ctype (void); +extern void _nl_postload_time (void); + + +#endif /* localeinfo.h */ diff --git a/newlib/libc/sys/linux/iconv/loop.c b/newlib/libc/sys/linux/iconv/loop.c new file mode 100644 index 000000000..7d3bf472d --- /dev/null +++ b/newlib/libc/sys/linux/iconv/loop.c @@ -0,0 +1,450 @@ +/* Conversion loop frame work. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file provides a frame for the reader loop in all conversion modules. + The actual code must (of course) be provided in the actual module source + code but certain actions can be written down generically, with some + customization options which are these: + + MIN_NEEDED_INPUT minimal number of input bytes needed for the next + conversion. + MIN_NEEDED_OUTPUT minimal number of bytes produced by the next round + of conversion. + + MAX_NEEDED_INPUT you guess it, this is the maximal number of input + bytes needed. It defaults to MIN_NEEDED_INPUT + MAX_NEEDED_OUTPUT likewise for output bytes. + + LOOPFCT name of the function created. If not specified + the name is `loop' but this prevents the use + of multiple functions in the same file. + + BODY this is supposed to expand to the body of the loop. + The user must provide this. + + EXTRA_LOOP_DECLS extra arguments passed from converion loop call. + + INIT_PARAMS code to define and initialize variables from params. + UPDATE_PARAMS code to store result in params. +*/ + +#include +#include +#include +#include +#include +#include +#include /* For MIN. */ +#define __need_size_t +#include + + +/* We have to provide support for machines which are not able to handled + unaligned memory accesses. Some of the character encodings have + representations with a fixed width of 2 or 4 bytes. But if we cannot + access unaligned memory we still have to read byte-wise. */ +#undef FCTNAME2 +#if defined _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED +/* We can handle unaligned memory access. */ +# define get16(addr) *((__const uint16_t *) (addr)) +# define get32(addr) *((__const uint32_t *) (addr)) + +/* We need no special support for writing values either. */ +# define put16(addr, val) *((uint16_t *) (addr)) = (val) +# define put32(addr, val) *((uint32_t *) (addr)) = (val) + +# define FCTNAME2(name) name +#else +/* Distinguish between big endian and little endian. */ +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define get16(addr) \ + (((__const unsigned char *) (addr))[1] << 8 \ + | ((__const unsigned char *) (addr))[0]) +# define get32(addr) \ + (((((__const unsigned char *) (addr))[3] << 8 \ + | ((__const unsigned char *) (addr))[2]) << 8 \ + | ((__const unsigned char *) (addr))[1]) << 8 \ + | ((__const unsigned char *) (addr))[0]) + +# define put16(addr, val) \ + ({ uint16_t __val = (val); \ + ((unsigned char *) (addr))[0] = __val; \ + ((unsigned char *) (addr))[1] = __val >> 8; \ + (void) 0; }) +# define put32(addr, val) \ + ({ uint32_t __val = (val); \ + ((unsigned char *) (addr))[0] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[1] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[2] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[3] = __val; \ + (void) 0; }) +# else +# define get16(addr) \ + (((__const unsigned char *) (addr))[0] << 8 \ + | ((__const unsigned char *) (addr))[1]) +# define get32(addr) \ + (((((__const unsigned char *) (addr))[0] << 8 \ + | ((__const unsigned char *) (addr))[1]) << 8 \ + | ((__const unsigned char *) (addr))[2]) << 8 \ + | ((__const unsigned char *) (addr))[3]) + +# define put16(addr, val) \ + ({ uint16_t __val = (val); \ + ((unsigned char *) (addr))[1] = __val; \ + ((unsigned char *) (addr))[0] = __val >> 8; \ + (void) 0; }) +# define put32(addr, val) \ + ({ uint32_t __val = (val); \ + ((unsigned char *) (addr))[3] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[2] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[1] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[0] = __val; \ + (void) 0; }) +# endif + +# define FCTNAME2(name) name##_unaligned +#endif +#define FCTNAME(name) FCTNAME2(name) + + +/* We need at least one byte for the next round. */ +#ifndef MIN_NEEDED_INPUT +# error "MIN_NEEDED_INPUT definition missing" +#endif + +/* Let's see how many bytes we produce. */ +#ifndef MAX_NEEDED_INPUT +# define MAX_NEEDED_INPUT MIN_NEEDED_INPUT +#endif + +/* We produce at least one byte in the next round. */ +#ifndef MIN_NEEDED_OUTPUT +# error "MIN_NEEDED_OUTPUT definition missing" +#endif + +/* Let's see how many bytes we produce. */ +#ifndef MAX_NEEDED_OUTPUT +# define MAX_NEEDED_OUTPUT MIN_NEEDED_OUTPUT +#endif + +/* Default name for the function. */ +#ifndef LOOPFCT +# define LOOPFCT loop +#endif + +/* Make sure we have a loop body. */ +#ifndef BODY +# error "Definition of BODY missing for function" LOOPFCT +#endif + + +/* If no arguments have to passed to the loop function define the macro + as empty. */ +#ifndef EXTRA_LOOP_DECLS +# define EXTRA_LOOP_DECLS +#endif + + +/* To make it easier for the writers of the modules, we define a macro + to test whether we have to ignore errors. */ +#define ignore_errors_p() \ + (irreversible != NULL && (flags & __GCONV_IGNORE_ERRORS)) + + +/* Error handling with transliteration/transcription function use and + ignoring of errors. Note that we cannot use the do while (0) trick + since `break' and `continue' must reach certain points. */ +#define STANDARD_ERR_HANDLER(Incr) \ + { \ + struct __gconv_trans_data *trans; \ + \ + result = __GCONV_ILLEGAL_INPUT; \ + \ + if (irreversible == NULL) \ + /* This means we are in call from __gconv_transliterate. In this \ + case we are not doing any error recovery outself. */ \ + break; \ + \ + /* First try the transliteration methods. */ \ + for (trans = step_data->__trans; trans != NULL; trans = trans->__next) \ + { \ + result = trans->__trans_fct (step, step_data, trans->__data, *inptrp, \ + &inptr, inend, &outptr, irreversible); \ + if (result != __GCONV_ILLEGAL_INPUT) \ + break; \ + } \ + /* If any of them recognized the input continue with the loop. */ \ + if (result != __GCONV_ILLEGAL_INPUT) \ + continue; \ + \ + /* Next see whether we have to ignore the error. If not, stop. */ \ + if (! ignore_errors_p ()) \ + break; \ + \ + /* When we come here it means we ignore the character. */ \ + ++*irreversible; \ + inptr += Incr; \ + continue; \ + } + + +/* Handling of Unicode 3.1 TAG characters. Unicode recommends + "If language codes are not relevant to the particular processing + operation, then they should be ignored." + This macro is usually called right before STANDARD_ERR_HANDLER (Incr). */ +#define UNICODE_TAG_HANDLER(Character, Incr) \ + { \ + /* TAG characters are those in the range U+E0000..U+E007F. */ \ + if (((Character) >> 7) == (0xe0000 >> 7)) \ + { \ + inptr += Incr; \ + continue; \ + } \ + } + + +/* The function returns the status, as defined in gconv.h. */ +static inline int +FCTNAME (LOOPFCT) (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, const unsigned char *inend, + unsigned char **outptrp, const unsigned char *outend, + size_t *irreversible EXTRA_LOOP_DECLS) +{ +#ifdef LOOP_NEED_STATE + mbstate_t *state = step_data->__statep; +#endif +#ifdef LOOP_NEED_FLAGS + int flags = step_data->__flags; +#endif +#ifdef LOOP_NEED_DATA + void *data = step->__data; +#endif + int result = __GCONV_EMPTY_INPUT; + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + +#ifdef INIT_PARAMS + INIT_PARAMS; +#endif + + while (inptr != inend) + { + /* `if' cases for MIN_NEEDED_OUTPUT ==/!= 1 is made to help the + compiler generating better code. They will be optimized away + since MIN_NEEDED_OUTPUT is always a constant. */ + if ((MIN_NEEDED_OUTPUT != 1 + && __builtin_expect (outptr + MIN_NEEDED_OUTPUT > outend, 0)) + || (MIN_NEEDED_OUTPUT == 1 + && __builtin_expect (outptr >= outend, 0))) + { + /* Overflow in the output buffer. */ + result = __GCONV_FULL_OUTPUT; + break; + } + if (MIN_NEEDED_INPUT > 1 + && __builtin_expect (inptr + MIN_NEEDED_INPUT > inend, 0)) + { + /* We don't have enough input for another complete input + character. */ + result = __GCONV_INCOMPLETE_INPUT; + break; + } + + /* Here comes the body the user provides. It can stop with + RESULT set to GCONV_INCOMPLETE_INPUT (if the size of the + input characters vary in size), GCONV_ILLEGAL_INPUT, or + GCONV_FULL_OUTPUT (if the output characters vary in size). */ + BODY + } + + /* Update the pointers pointed to by the parameters. */ + *inptrp = inptr; + *outptrp = outptr; +#ifdef UPDATE_PARAMS + UPDATE_PARAMS; +#endif + + return result; +} + + +/* Include the file a second time to define the function to handle + unaligned access. */ +#if !defined DEFINE_UNALIGNED && !defined _STRING_ARCH_unaligned \ + && MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \ + && MIN_NEEDED_TO != 1 && MAX_NEEDED_TO % MIN_NEEDED_TO == 0 +# undef get16 +# undef get32 +# undef put16 +# undef put32 +# undef unaligned + +# define DEFINE_UNALIGNED +# include "loop.c" +# undef DEFINE_UNALIGNED +#endif + + +#if MAX_NEEDED_INPUT > 1 +# define SINGLE(fct) SINGLE2 (fct) +# define SINGLE2(fct) fct##_single +static inline int +SINGLE(LOOPFCT) (struct __gconv_step *step, + struct __gconv_step_data *step_data, + const unsigned char **inptrp, const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + size_t *irreversible EXTRA_LOOP_DECLS) +{ + mbstate_t *state = step_data->__statep; +#ifdef LOOP_NEED_FLAGS + int flags = step_data->__flags; +#endif +#ifdef LOOP_NEED_DATA + void *data = step->__data; +#endif + int result = __GCONV_OK; + unsigned char bytebuf[MAX_NEEDED_INPUT]; + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t inlen; + +#ifdef INIT_PARAMS + INIT_PARAMS; +#endif + +#ifdef UNPACK_BYTES + UNPACK_BYTES +#else + /* Add the bytes from the state to the input buffer. */ + for (inlen = 0; inlen < (size_t) (state->__count & 7); ++inlen) + bytebuf[inlen] = state->__value.__wchb[inlen]; +#endif + + /* Are there enough bytes in the input buffer? */ + if (__builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0)) + { + *inptrp = inend; +#ifdef STORE_REST + inptr = bytebuf; + inptrp = &inptr; + inend = &bytebuf[inlen]; + + STORE_REST +#else + /* We don't have enough input for another complete input + character. */ + while (inptr < inend) + state->__value.__wchb[inlen++] = *inptr++; +#endif + + return __GCONV_INCOMPLETE_INPUT; + } + + /* Enough space in output buffer. */ + if ((MIN_NEEDED_OUTPUT != 1 && outptr + MIN_NEEDED_OUTPUT > outend) + || (MIN_NEEDED_OUTPUT == 1 && outptr >= outend)) + /* Overflow in the output buffer. */ + return __GCONV_FULL_OUTPUT; + + /* Now add characters from the normal input buffer. */ + do + bytebuf[inlen++] = *inptr++; + while (inlen < MAX_NEEDED_INPUT && inptr < inend); + + inptr = bytebuf; + inend = &bytebuf[inlen]; + + do + { + BODY + } + while (0); + + /* Now we either have produced an output character and consumed all the + bytes from the state and at least one more, or the character is still + incomplete, or we have some other error (like illegal input character, + no space in output buffer). */ + if (__builtin_expect (inptr != bytebuf, 1)) + { + /* We found a new character. */ + assert (inptr - bytebuf > (state->__count & 7)); + + *inptrp += inptr - bytebuf - (state->__count & 7); + *outptrp = outptr; + + result = __GCONV_OK; + + /* Clear the state buffer. */ + state->__count &= ~7; + } + else if (result == __GCONV_INCOMPLETE_INPUT) + { + /* This can only happen if we have less than MAX_NEEDED_INPUT bytes + available. */ + assert (inend != &bytebuf[MAX_NEEDED_INPUT]); + + *inptrp += inend - bytebuf - (state->__count & 7); +#ifdef STORE_REST + inptrp = &inptr; + + STORE_REST +#else + /* We don't have enough input for another complete input + character. */ + while (inptr < inend) + state->__value.__wchb[inlen++] = *inptr++; +#endif + } + + return result; +} +# undef SINGLE +# undef SINGLE2 +#endif + + +/* We remove the macro definitions so that we can include this file again + for the definition of another function. */ +#undef MIN_NEEDED_INPUT +#undef MAX_NEEDED_INPUT +#undef MIN_NEEDED_OUTPUT +#undef MAX_NEEDED_OUTPUT +#undef LOOPFCT +#undef BODY +#undef LOOPFCT +#undef EXTRA_LOOP_DECLS +#undef INIT_PARAMS +#undef UPDATE_PARAMS +#undef UNPACK_BYTES +#undef LOOP_NEED_STATE +#undef LOOP_NEED_FLAGS +#undef LOOP_NEED_DATA +#undef get16 +#undef get32 +#undef put16 +#undef put32 +#undef unaligned diff --git a/newlib/libc/sys/linux/iconv/skeleton.c b/newlib/libc/sys/linux/iconv/skeleton.c new file mode 100644 index 000000000..cde8533c5 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/skeleton.c @@ -0,0 +1,696 @@ +/* Skeleton for a conversion module. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file can be included to provide definitions of several things + many modules have in common. It can be customized using the following + macros: + + DEFINE_INIT define the default initializer. This requires the + following symbol to be defined. + + CHARSET_NAME string with official name of the coded character + set (in all-caps) + + DEFINE_FINI define the default destructor function. + + MIN_NEEDED_FROM minimal number of bytes needed for the from-charset. + MIN_NEEDED_TO likewise for the to-charset. + + MAX_NEEDED_FROM maximal number of bytes needed for the from-charset. + This macro is optional, it defaults to MIN_NEEDED_FROM. + MAX_NEEDED_TO likewise for the to-charset. + + DEFINE_DIRECTION_OBJECTS + two objects will be defined to be used when the + `gconv' function must only distinguish two + directions. This is implied by DEFINE_INIT. + If this macro is not defined the following + macro must be available. + + FROM_DIRECTION this macro is supposed to return a value != 0 + if we convert from the current character set, + otherwise it return 0. + + EMIT_SHIFT_TO_INIT this symbol is optional. If it is defined it + defines some code which writes out a sequence + of characters which bring the current state into + the initial state. + + FROM_LOOP name of the function implementing the conversion + from the current characters. + TO_LOOP likewise for the other direction + + ONE_DIRECTION optional. If defined to 1, only one conversion + direction is defined instead of two. In this + case, FROM_DIRECTION should be defined to 1, and + FROM_LOOP and TO_LOOP should have the same value. + + SAVE_RESET_STATE in case of an error we must reset the state for + the rerun so this macro must be defined for + stateful encodings. It takes an argument which + is nonzero when saving. + + RESET_INPUT_BUFFER If the input character sets allow this the macro + can be defined to reset the input buffer pointers + to cover only those characters up to the error. + + FUNCTION_NAME if not set the conversion function is named `gconv'. + + PREPARE_LOOP optional code preparing the conversion loop. Can + contain variable definitions. + END_LOOP also optional, may be used to store information + + EXTRA_LOOP_ARGS optional macro specifying extra arguments passed + to loop function. + */ + +#include +#include +#include +#define __need_size_t +#define __need_NULL +#include + +#include + +#ifndef STATIC_GCONV +# include +#endif + +# define DL_CALL_FCT(fct, args) fct args + +/* The direction objects. */ +#if DEFINE_DIRECTION_OBJECTS || DEFINE_INIT +static int from_object; +static int to_object; + +# ifndef FROM_DIRECTION +# define FROM_DIRECTION (step->__data == &from_object) +# endif +#else +# ifndef FROM_DIRECTION +# error "FROM_DIRECTION must be provided if direction objects are not used" +# endif +#endif + + +/* How many bytes are needed at most for the from-charset. */ +#ifndef MAX_NEEDED_FROM +# define MAX_NEEDED_FROM MIN_NEEDED_FROM +#endif + +/* Same for the to-charset. */ +#ifndef MAX_NEEDED_TO +# define MAX_NEEDED_TO MIN_NEEDED_TO +#endif + + +/* Define macros which can access unaligned buffers. These macros are + supposed to be used only in code outside the inner loops. For the inner + loops we have other definitions which allow optimized access. */ +#ifdef _STRING_ARCH_unaligned +/* We can handle unaligned memory access. */ +# define get16u(addr) *((__const uint16_t *) (addr)) +# define get32u(addr) *((__const uint32_t *) (addr)) + +/* We need no special support for writing values either. */ +# define put16u(addr, val) *((uint16_t *) (addr)) = (val) +# define put32u(addr, val) *((uint32_t *) (addr)) = (val) +#else +/* Distinguish between big endian and little endian. */ +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define get16u(addr) \ + (((__const unsigned char *) (addr))[1] << 8 \ + | ((__const unsigned char *) (addr))[0]) +# define get32u(addr) \ + (((((__const unsigned char *) (addr))[3] << 8 \ + | ((__const unsigned char *) (addr))[2]) << 8 \ + | ((__const unsigned char *) (addr))[1]) << 8 \ + | ((__const unsigned char *) (addr))[0]) + +# define put16u(addr, val) \ + ({ uint16_t __val = (val); \ + ((unsigned char *) (addr))[0] = __val; \ + ((unsigned char *) (addr))[1] = __val >> 8; \ + (void) 0; }) +# define put32u(addr, val) \ + ({ uint32_t __val = (val); \ + ((unsigned char *) (addr))[0] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[1] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[2] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[3] = __val; \ + (void) 0; }) +# else +# define get16u(addr) \ + (((__const unsigned char *) (addr))[0] << 8 \ + | ((__const unsigned char *) (addr))[1]) +# define get32u(addr) \ + (((((__const unsigned char *) (addr))[0] << 8 \ + | ((__const unsigned char *) (addr))[1]) << 8 \ + | ((__const unsigned char *) (addr))[2]) << 8 \ + | ((__const unsigned char *) (addr))[3]) + +# define put16u(addr, val) \ + ({ uint16_t __val = (val); \ + ((unsigned char *) (addr))[1] = __val; \ + ((unsigned char *) (addr))[0] = __val >> 8; \ + (void) 0; }) +# define put32u(addr, val) \ + ({ uint32_t __val = (val); \ + ((unsigned char *) (addr))[3] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[2] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[1] = __val; \ + __val >>= 8; \ + ((unsigned char *) (addr))[0] = __val; \ + (void) 0; }) +# endif +#endif + + +/* For conversions from a fixed width character set to another fixed width + character set we can define RESET_INPUT_BUFFER in a very fast way. */ +#if !defined RESET_INPUT_BUFFER && !defined SAVE_RESET_STATE +# if MIN_NEEDED_FROM == MAX_NEEDED_FROM && MIN_NEEDED_TO == MAX_NEEDED_TO +/* We have to use these `if's here since the compiler cannot know that + (outbuf - outerr) is always divisible by MIN_NEEDED_TO. */ +# define RESET_INPUT_BUFFER \ + if (MIN_NEEDED_FROM % MIN_NEEDED_TO == 0) \ + *inptrp -= (outbuf - outerr) * (MIN_NEEDED_FROM / MIN_NEEDED_TO); \ + else if (MIN_NEEDED_TO % MIN_NEEDED_FROM == 0) \ + *inptrp -= (outbuf - outerr) / (MIN_NEEDED_TO / MIN_NEEDED_FROM); \ + else \ + *inptrp -= ((outbuf - outerr) / MIN_NEEDED_TO) * MIN_NEEDED_FROM +# endif +#endif + + +/* The default init function. It simply matches the name and initializes + the step data to point to one of the objects above. */ +#if DEFINE_INIT +# ifndef CHARSET_NAME +# error "CHARSET_NAME not defined" +# endif + +extern int gconv_init (struct __gconv_step *step); +int +gconv_init (struct __gconv_step *step) +{ + /* Determine which direction. */ + if (strcmp (step->__from_name, CHARSET_NAME) == 0) + { + step->__data = &from_object; + + step->__min_needed_from = MIN_NEEDED_FROM; + step->__max_needed_from = MAX_NEEDED_FROM; + step->__min_needed_to = MIN_NEEDED_TO; + step->__max_needed_to = MAX_NEEDED_TO; + } + else if (__builtin_expect (strcmp (step->__to_name, CHARSET_NAME), 0) == 0) + { + step->__data = &to_object; + + step->__min_needed_from = MIN_NEEDED_TO; + step->__max_needed_from = MAX_NEEDED_TO; + step->__min_needed_to = MIN_NEEDED_FROM; + step->__max_needed_to = MAX_NEEDED_FROM; + } + else + return __GCONV_NOCONV; + +#ifdef SAVE_RESET_STATE + step->__stateful = 1; +#else + step->__stateful = 0; +#endif + + return __GCONV_OK; +} +#endif + + +/* The default destructor function does nothing in the moment and so + we don't define it at all. But we still provide the macro just in + case we need it some day. */ +#if DEFINE_FINI +#endif + + +/* If no arguments have to passed to the loop function define the macro + as empty. */ +#ifndef EXTRA_LOOP_ARGS +# define EXTRA_LOOP_ARGS +#endif + + +/* This is the actual conversion function. */ +#ifndef FUNCTION_NAME +# define FUNCTION_NAME gconv +#endif + +/* The macros are used to access the function to convert single characters. */ +#define SINGLE(fct) SINGLE2 (fct) +#define SINGLE2(fct) fct##_single + + +extern int FUNCTION_NAME (struct __gconv_step *step, + struct __gconv_step_data *data, + const unsigned char **inptrp, + const unsigned char *inend, + unsigned char **outbufstart, size_t *irreversible, + int do_flush, int consume_incomplete); +int +FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data, + const unsigned char **inptrp, const unsigned char *inend, + unsigned char **outbufstart, size_t *irreversible, int do_flush, + int consume_incomplete) +{ + struct __gconv_step *next_step = step + 1; + struct __gconv_step_data *next_data = data + 1; + __gconv_fct fct; + int status; + + fct = (data->__flags & __GCONV_IS_LAST) ? NULL : next_step->__fct; + + /* If the function is called with no input this means we have to reset + to the initial state. The possibly partly converted input is + dropped. */ + if (__builtin_expect (do_flush, 0)) + { + /* This should never happen during error handling. */ + assert (outbufstart == NULL); + + status = __GCONV_OK; + +#ifdef EMIT_SHIFT_TO_INIT + if (do_flush == 1) + { + /* We preserve the initial values of the pointer variables. */ + unsigned char *outbuf = data->__outbuf; + unsigned char *outstart = outbuf; + unsigned char *outend = data->__outbufend; + +# ifdef PREPARE_LOOP + PREPARE_LOOP +# endif + +# ifdef SAVE_RESET_STATE + SAVE_RESET_STATE (1); +# endif + + /* Emit the escape sequence to reset the state. */ + EMIT_SHIFT_TO_INIT; + + /* Call the steps down the chain if there are any but only if we + successfully emitted the escape sequence. This should only + fail if the output buffer is full. If the input is invalid + it should be discarded since the user wants to start from a + clean state. */ + if (status == __GCONV_OK) + { + if (data->__flags & __GCONV_IS_LAST) + /* Store information about how many bytes are available. */ + data->__outbuf = outbuf; + else + { + /* Write out all output which was produced. */ + if (outbuf > outstart) + { + const unsigned char *outerr = outstart; + int result; + + result = DL_CALL_FCT (fct, (next_step, next_data, + &outerr, outbuf, NULL, + irreversible, 0, + consume_incomplete)); + + if (result != __GCONV_EMPTY_INPUT) + { + if (__builtin_expect (outerr != outbuf, 0)) + { + /* We have a problem. Undo the conversion. */ + outbuf = outstart; + + /* Restore the state. */ +# ifdef SAVE_RESET_STATE + SAVE_RESET_STATE (0); +# endif + } + + /* Change the status. */ + status = result; + } + } + + if (status == __GCONV_OK) + /* Now flush the remaining steps. */ + status = DL_CALL_FCT (fct, (next_step, next_data, NULL, + NULL, NULL, irreversible, 1, + consume_incomplete)); + } + } + } + else +#endif + { + /* Clear the state object. There might be bytes in there from + previous calls with CONSUME_INCOMPLETE == 1. But don't emit + escape sequences. */ + memset (data->__statep, '\0', sizeof (*data->__statep)); + + if (! (data->__flags & __GCONV_IS_LAST)) + /* Now flush the remaining steps. */ + status = DL_CALL_FCT (fct, (next_step, next_data, NULL, NULL, + NULL, irreversible, do_flush, + consume_incomplete)); + } + } + else + { + /* We preserve the initial values of the pointer variables. */ + const unsigned char *inptr = *inptrp; + unsigned char *outbuf = (__builtin_expect (outbufstart == NULL, 1) + ? data->__outbuf : *outbufstart); + unsigned char *outend = data->__outbufend; + unsigned char *outstart; + /* This variable is used to count the number of characters we + actually converted. */ + size_t lirreversible = 0; + size_t *lirreversiblep = irreversible ? &lirreversible : NULL; +#if defined _STRING_ARCH_unaligned \ + || MIN_NEEDED_FROM == 1 || MAX_NEEDED_FROM % MIN_NEEDED_FROM != 0 \ + || MIN_NEEDED_TO == 1 || MAX_NEEDED_TO % MIN_NEEDED_TO != 0 +# define unaligned 0 +#else + int unaligned; +# define GEN_unaligned(name) GEN_unaligned2 (name) +# define GEN_unaligned2(name) name##_unaligned +#endif + +#ifdef PREPARE_LOOP + PREPARE_LOOP +#endif + +#if MAX_NEEDED_FROM > 1 || MAX_NEEDED_TO > 1 + /* If the function is used to implement the mb*towc*() or wc*tomb*() + functions we must test whether any bytes from the last call are + stored in the `state' object. */ + if (((MAX_NEEDED_FROM > 1 && MAX_NEEDED_TO > 1) + || (MAX_NEEDED_FROM > 1 && FROM_DIRECTION) + || (MAX_NEEDED_TO > 1 && !FROM_DIRECTION)) + && consume_incomplete && (data->__statep->__count & 7) != 0) + { + /* Yep, we have some bytes left over. Process them now. + But this must not happen while we are called from an + error handler. */ + assert (outbufstart == NULL); + +# if MAX_NEEDED_FROM > 1 + if (MAX_NEEDED_TO == 1 || FROM_DIRECTION) + status = SINGLE(FROM_LOOP) (step, data, inptrp, inend, &outbuf, + outend, lirreversiblep + EXTRA_LOOP_ARGS); +# endif +# if MAX_NEEDED_FROM > 1 && MAX_NEEDED_TO > 1 && !ONE_DIRECTION + else +# endif +# if MAX_NEEDED_TO > 1 && !ONE_DIRECTION + status = SINGLE(TO_LOOP) (step, data, inptrp, inend, &outbuf, + outend, lirreversiblep EXTRA_LOOP_ARGS); +# endif + + if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK) + return status; + } +#endif + +#if !defined _STRING_ARCH_unaligned \ + && MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \ + && MIN_NEEDED_TO != 1 && MAX_NEEDED_TO % MIN_NEEDED_TO == 0 + /* The following assumes that encodings, which have a variable length + what might unalign a buffer even though it is a aligned in the + beginning, either don't have the minimal number of bytes as a divisor + of the maximum length or have a minimum length of 1. This is true + for all known and supported encodings. */ + unaligned = ((FROM_DIRECTION + && ((uintptr_t) inptr % MIN_NEEDED_FROM != 0 + || ((data->__flags & __GCONV_IS_LAST) + && (uintptr_t) outbuf % MIN_NEEDED_TO != 0))) + || (!FROM_DIRECTION + && (((data->__flags & __GCONV_IS_LAST) + && (uintptr_t) outbuf % MIN_NEEDED_FROM != 0) + || (uintptr_t) inptr % MIN_NEEDED_TO != 0))); +#endif + + while (1) + { + struct __gconv_trans_data *trans; + + /* Remember the start value for this round. */ + inptr = *inptrp; + /* The outbuf buffer is empty. */ + outstart = outbuf; + +#ifdef SAVE_RESET_STATE + SAVE_RESET_STATE (1); +#endif + + if (__builtin_expect (!unaligned, 1)) + { + if (FROM_DIRECTION) + /* Run the conversion loop. */ + status = FROM_LOOP (step, data, inptrp, inend, &outbuf, outend, + lirreversiblep EXTRA_LOOP_ARGS); + else + /* Run the conversion loop. */ + status = TO_LOOP (step, data, inptrp, inend, &outbuf, outend, + lirreversiblep EXTRA_LOOP_ARGS); + } +#if !defined _STRING_ARCH_unaligned \ + && MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \ + && MIN_NEEDED_TO != 1 && MAX_NEEDED_TO % MIN_NEEDED_TO == 0 + else + { + if (FROM_DIRECTION) + /* Run the conversion loop. */ + status = GEN_unaligned (FROM_LOOP) (step, data, inptrp, inend, + &outbuf, outend, + lirreversiblep + EXTRA_LOOP_ARGS); + else + /* Run the conversion loop. */ + status = GEN_unaligned (TO_LOOP) (step, data, inptrp, inend, + &outbuf, outend, + lirreversiblep + EXTRA_LOOP_ARGS); + } +#endif + + /* If we were called as part of an error handling module we + don't do anything else here. */ + if (__builtin_expect (outbufstart != NULL, 0)) + { + *outbufstart = outbuf; + return status; + } + + /* Give the transliteration module the chance to store the + original text and the result in case it needs a context. */ + for (trans = data->__trans; trans != NULL; trans = trans->__next) + if (trans->__trans_context_fct != NULL) + DL_CALL_FCT (trans->__trans_context_fct, + (trans->__data, inptr, *inptrp, outstart, outbuf)); + + /* We finished one use of the loops. */ + ++data->__invocation_counter; + + /* If this is the last step leave the loop, there is nothing + we can do. */ + if (__builtin_expect (data->__flags & __GCONV_IS_LAST, 0)) + { + /* Store information about how many bytes are available. */ + data->__outbuf = outbuf; + + /* Remember how many non-identical characters we + converted in a irreversible way. */ + *irreversible += lirreversible; + + break; + } + + /* Write out all output which was produced. */ + if (__builtin_expect (outbuf > outstart, 1)) + { + const unsigned char *outerr = data->__outbuf; + int result; + + result = DL_CALL_FCT (fct, (next_step, next_data, &outerr, + outbuf, NULL, irreversible, 0, + consume_incomplete)); + + if (result != __GCONV_EMPTY_INPUT) + { + if (__builtin_expect (outerr != outbuf, 0)) + { +#ifdef RESET_INPUT_BUFFER + RESET_INPUT_BUFFER; +#else + /* We have a problem with the in on of the functions + below. Undo the conversion upto the error point. */ + size_t nstatus; + + /* Reload the pointers. */ + *inptrp = inptr; + outbuf = outstart; + + /* Restore the state. */ +# ifdef SAVE_RESET_STATE + SAVE_RESET_STATE (0); +# endif + + if (__builtin_expect (!unaligned, 1)) + { + if (FROM_DIRECTION) + /* Run the conversion loop. */ + nstatus = FROM_LOOP (step, data, inptrp, inend, + &outbuf, outerr, + lirreversiblep + EXTRA_LOOP_ARGS); + else + /* Run the conversion loop. */ + nstatus = TO_LOOP (step, data, inptrp, inend, + &outbuf, outerr, + lirreversiblep + EXTRA_LOOP_ARGS); + } +# if !defined _STRING_ARCH_unaligned \ + && MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \ + && MIN_NEEDED_TO != 1 && MAX_NEEDED_TO % MIN_NEEDED_TO == 0 + else + { + if (FROM_DIRECTION) + /* Run the conversion loop. */ + nstatus = GEN_unaligned (FROM_LOOP) (step, data, + inptrp, inend, + &outbuf, + outerr, + lirreversiblep + EXTRA_LOOP_ARGS); + else + /* Run the conversion loop. */ + nstatus = GEN_unaligned (TO_LOOP) (step, data, + inptrp, inend, + &outbuf, outerr, + lirreversiblep + EXTRA_LOOP_ARGS); + } +# endif + + /* We must run out of output buffer space in this + rerun. */ + assert (outbuf == outerr); + assert (nstatus == __GCONV_FULL_OUTPUT); + + /* If we haven't consumed a single byte decrement + the invocation counter. */ + if (__builtin_expect (outbuf == outstart, 0)) + --data->__invocation_counter; +#endif /* reset input buffer */ + } + + /* Change the status. */ + status = result; + } + else + /* All the output is consumed, we can make another run + if everything was ok. */ + if (status == __GCONV_FULL_OUTPUT) + { + status = __GCONV_OK; + outbuf = data->__outbuf; + } + } + + if (status != __GCONV_OK) + break; + + /* Reset the output buffer pointer for the next round. */ + outbuf = data->__outbuf; + } + +#ifdef END_LOOP + END_LOOP +#endif + + /* If we are supposed to consume all character store now all of the + remaining characters in the `state' object. */ +#if MAX_NEEDED_FROM > 1 || MAX_NEEDED_TO > 1 + if (((MAX_NEEDED_FROM > 1 && MAX_NEEDED_TO > 1) + || (MAX_NEEDED_FROM > 1 && FROM_DIRECTION) + || (MAX_NEEDED_TO > 1 && !FROM_DIRECTION)) + && __builtin_expect (consume_incomplete, 0) + && status == __GCONV_INCOMPLETE_INPUT) + { +# ifdef STORE_REST + mbstate_t *state = data->__statep; + + STORE_REST +# else + size_t cnt; + + /* Make sure the remaining bytes fit into the state objects + buffer. */ + assert (inend - *inptrp < 4); + + for (cnt = 0; *inptrp < inend; ++cnt) + data->__statep->__value.__wchb[cnt] = *(*inptrp)++; + data->__statep->__count &= ~7; + data->__statep->__count |= cnt; +# endif + } +#endif + } + + return status; +} + +#undef DEFINE_INIT +#undef CHARSET_NAME +#undef DEFINE_FINI +#undef MIN_NEEDED_FROM +#undef MIN_NEEDED_TO +#undef MAX_NEEDED_FROM +#undef MAX_NEEDED_TO +#undef DEFINE_DIRECTION_OBJECTS +#undef FROM_DIRECTION +#undef EMIT_SHIFT_TO_INIT +#undef FROM_LOOP +#undef TO_LOOP +#undef SAVE_RESET_STATE +#undef RESET_INPUT_BUFFER +#undef FUNCTION_NAME +#undef PREPARE_LOOP +#undef END_LOOP +#undef ONE_DIRECTION +#undef STORE_REST diff --git a/newlib/libc/sys/linux/iconv/strtab.c b/newlib/libc/sys/linux/iconv/strtab.c new file mode 100644 index 000000000..0f5e2b632 --- /dev/null +++ b/newlib/libc/sys/linux/iconv/strtab.c @@ -0,0 +1,341 @@ +/* C string table handling. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Written by Ulrich Drepper , 2000. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + + +struct Strent +{ + const char *string; + size_t len; + struct Strent *next; + struct Strent *left; + struct Strent *right; + size_t offset; + char reverse[0]; +}; + + +struct memoryblock +{ + struct memoryblock *next; + char memory[0]; +}; + + +struct Strtab +{ + struct Strent *root; + struct memoryblock *memory; + char *backp; + size_t left; + size_t total; + + struct Strent null; +}; + + +/* Cache for the pagesize. We correct this value a bit so that `malloc' + is not allocating more than a page. */ +static size_t ps; + + +extern void *xmalloc (size_t n) __attribute_malloc__; + +/* Prototypes for our functions that are used from iconvconfig.c. If + you change these, change also iconvconfig.c. */ +/* Create new C string table object in memory. */ +extern struct Strtab *strtabinit (void); + +/* Free resources allocated for C string table ST. */ +extern void strtabfree (struct Strtab *st); + +/* Add string STR (length LEN is != 0) to C string table ST. */ +extern struct Strent *strtabadd (struct Strtab *st, const char *str, + size_t len); + +/* Finalize string table ST and store size in *SIZE and return a pointer. */ +extern void *strtabfinalize (struct Strtab *st, size_t *size); + +/* Get offset in string table for string associated with SE. */ +extern size_t strtaboffset (struct Strent *se); + + +struct Strtab * +strtabinit (void) +{ + struct Strtab *ret; + + if (ps == 0) + { + ps = sysconf (_SC_PAGESIZE) - 2 * sizeof (void *); + assert (sizeof (struct memoryblock) < ps); + } + + ret = (struct Strtab *) calloc (1, sizeof (struct Strtab)); + if (ret != NULL) + { + ret->null.len = 1; + ret->null.string = ""; + } + return ret; +} + + +static void +morememory (struct Strtab *st, size_t len) +{ + struct memoryblock *newmem; + + if (len < ps) + len = ps; + newmem = (struct memoryblock *) malloc (len); + if (newmem == NULL) + abort (); + + newmem->next = st->memory; + st->memory = newmem; + st->backp = newmem->memory; + st->left = len - offsetof (struct memoryblock, memory); +} + + +void +strtabfree (struct Strtab *st) +{ + struct memoryblock *mb = st->memory; + + while (mb != NULL) + { + void *old = mb; + mb = mb->next; + free (old); + } + + free (st); +} + + +static struct Strent * +newstring (struct Strtab *st, const char *str, size_t len) +{ + struct Strent *newstr; + size_t align; + int i; + + /* Compute the amount of padding needed to make the structure aligned. */ + align = ((__alignof__ (struct Strent) + - (((uintptr_t) st->backp) + & (__alignof__ (struct Strent) - 1))) + & (__alignof__ (struct Strent) - 1)); + + /* Make sure there is enough room in the memory block. */ + if (st->left < align + sizeof (struct Strent) + len) + { + morememory (st, sizeof (struct Strent) + len); + align = 0; + } + + /* Create the reserved string. */ + newstr = (struct Strent *) (st->backp + align); + newstr->string = str; + newstr->len = len; + newstr->next = NULL; + newstr->left = NULL; + newstr->right = NULL; + newstr->offset = 0; + for (i = len - 2; i >= 0; --i) + newstr->reverse[i] = str[len - 2 - i]; + newstr->reverse[len - 1] = '\0'; + st->backp += align + sizeof (struct Strent) + len; + st->left -= align + sizeof (struct Strent) + len; + + return newstr; +} + + +/* XXX This function should definitely be rewritten to use a balancing + tree algorith (AVL, red-black trees). For now a simple, correct + implementation is enough. */ +static struct Strent ** +searchstring (struct Strent **sep, struct Strent *newstr) +{ + int cmpres; + + /* More strings? */ + if (*sep == NULL) + { + *sep = newstr; + return sep; + } + + /* Compare the strings. */ + cmpres = memcmp ((*sep)->reverse, newstr->reverse, + MIN ((*sep)->len, newstr->len) - 1); + if (cmpres == 0) + /* We found a matching string. */ + return sep; + else if (cmpres > 0) + return searchstring (&(*sep)->left, newstr); + else + return searchstring (&(*sep)->right, newstr); +} + + +/* Add new string. The actual string is assumed to be permanent. */ +struct Strent * +strtabadd (struct Strtab *st, const char *str, size_t len) +{ + struct Strent *newstr; + struct Strent **sep; + + /* Compute the string length if the caller doesn't know it. */ + if (len == 0) + len = strlen (str) + 1; + + /* Make sure all "" strings get offset 0. */ + if (len == 1) + return &st->null; + + /* Allocate memory for the new string and its associated information. */ + newstr = newstring (st, str, len); + + /* Search in the array for the place to insert the string. If there + is no string with matching prefix and no string with matching + leading substring, create a new entry. */ + sep = searchstring (&st->root, newstr); + if (*sep != newstr) + { + /* This is not the same entry. This means we have a prefix match. */ + if ((*sep)->len > newstr->len) + { + struct Strent *subs; + + for (subs = (*sep)->next; subs; subs = subs->next) + if (subs->len == newstr->len) + { + /* We have an exact match with a substring. Free the memory + we allocated. */ + st->left += st->backp - (char *) newstr; + st->backp = (char *) newstr; + + return subs; + } + + /* We have a new substring. This means we don't need the reverse + string of this entry anymore. */ + st->backp -= newstr->len; + st->left += newstr->len; + + newstr->next = (*sep)->next; + (*sep)->next = newstr; + } + else if ((*sep)->len != newstr->len) + { + /* When we get here it means that the string we are about to + add has a common prefix with a string we already have but + it is longer. In this case we have to put it first. */ + st->total += newstr->len - (*sep)->len; + newstr->next = *sep; + newstr->left = (*sep)->left; + newstr->right = (*sep)->right; + *sep = newstr; + } + else + { + /* We have an exact match. Free the memory we allocated. */ + st->left += st->backp - (char *) newstr; + st->backp = (char *) newstr; + + newstr = *sep; + } + } + else + st->total += newstr->len; + + return newstr; +} + + +static void +copystrings (struct Strent *nodep, char **freep, size_t *offsetp) +{ + struct Strent *subs; + + if (nodep->left != NULL) + copystrings (nodep->left, freep, offsetp); + + /* Process the current node. */ + nodep->offset = *offsetp; + *freep = (char *) memcpy (*freep, nodep->string, nodep->len); + *freep += nodep->len; + *offsetp += nodep->len; + + for (subs = nodep->next; subs != NULL; subs = subs->next) + { + assert (subs->len < nodep->len); + subs->offset = nodep->offset + nodep->len - subs->len; + } + + if (nodep->right != NULL) + copystrings (nodep->right, freep, offsetp); +} + + +void * +strtabfinalize (struct Strtab *st, size_t *size) +{ + size_t copylen; + char *endp; + char *retval; + + /* Fill in the information. */ + endp = retval = (char *) xmalloc (st->total + 1); + + /* Always put an empty string at the beginning so that a zero offset + can mean error. */ + *endp++ = '\0'; + + /* Now run through the tree and add all the string while also updating + the offset members of the elfstrent records. */ + copylen = 1; + copystrings (st->root, &endp, ©len); + assert (copylen == st->total + 1); + assert (endp = retval + st->total + 1); + *size = copylen; + + return retval; +} + + +size_t +strtaboffset (struct Strent *se) +{ + return se->offset; +} diff --git a/newlib/libc/sys/linux/include/arpa/ftp.h b/newlib/libc/sys/linux/include/arpa/ftp.h new file mode 100644 index 000000000..9a3648854 --- /dev/null +++ b/newlib/libc/sys/linux/include/arpa/ftp.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ftp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_FTP_H_ +#define _ARPA_FTP_H_ + +/* Definitions for FTP; see RFC-765. */ + +/* + * Reply codes. + */ +#define PRELIM 1 /* positive preliminary */ +#define COMPLETE 2 /* positive completion */ +#define CONTINUE 3 /* positive intermediate */ +#define TRANSIENT 4 /* transient negative completion */ +#define ERROR 5 /* permanent negative completion */ + +/* + * Type codes + */ +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +#ifdef FTP_NAMES +char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; +#endif + +/* + * Form codes + */ +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ +#ifdef FTP_NAMES +char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; +#endif + +/* + * Structure codes + */ +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ +#ifdef FTP_NAMES +char *strunames[] = {"0", "File", "Record", "Page" }; +#endif + +/* + * Mode types + */ +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ +#ifdef FTP_NAMES +char *modenames[] = {"0", "Stream", "Block", "Compressed" }; +#endif + +/* + * Record Tokens + */ +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +#endif /* !_FTP_H_ */ diff --git a/newlib/libc/sys/linux/include/arpa/inet.h b/newlib/libc/sys/linux/include/arpa/inet.h new file mode 100644 index 000000000..82bcf356d --- /dev/null +++ b/newlib/libc/sys/linux/include/arpa/inet.h @@ -0,0 +1,156 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * @(#)inet.h 8.1 (Berkeley) 6/2/93 + * From: Id: inet.h,v 8.5 1997/01/29 08:48:09 vixie Exp $ + * $FreeBSD: src/include/arpa/inet.h,v 1.22 2002/04/10 10:51:53 mike Exp $ + */ + +#ifndef _ARPA_INET_H_ +#define _ARPA_INET_H_ + +/* External definitions for functions in inet(3), addr2ascii(3) */ + +#include +#include +#include + +/* Required for byteorder(3) functions. */ +#include + +#define INET_ADDRSTRLEN 16 +#define INET6_ADDRSTRLEN 46 + +#ifndef _UINT16_T_DECLARED +typedef __uint16_t uint16_t; +#define _UINT16_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _IN_ADDR_T_DECLARED +typedef uint32_t in_addr_t; +#define _IN_ADDR_T_DECLARED +#endif + +#ifndef _IN_PORT_T_DECLARED +typedef uint16_t in_port_t; +#define _IN_PORT_T_DECLARED +#endif + +#ifndef _POSIX_SOURCE +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif +#endif /* !_POSIX_SOURCE */ + +/* + * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by + * POSIX.1-2001. + */ + + +#ifndef __socklen_t_defined +typedef unsigned int socklen_t; +#define __socklen_t_defined 1 +#endif + +#ifdef _BSD_SOCKLEN_T_ +typedef _BSD_SOCKLEN_T_ socklen_t; +#undef _BSD_SOCKLEN_T_ +#endif + +#ifndef _STRUCT_IN_ADDR_DECLARED +struct in_addr { + in_addr_t s_addr; +}; +#define _STRUCT_IN_ADDR_DECLARED +#endif + +#define inet_addr __inet_addr +#define inet_aton __inet_aton +#define inet_lnaof __inet_lnaof +#define inet_makeaddr __inet_makeaddr +#define inet_neta __inet_neta +#define inet_netof __inet_netof +#define inet_network __inet_network +#define inet_net_ntop __inet_net_ntop +#define inet_net_pton __inet_net_pton +#define inet_ntoa __inet_ntoa +#define inet_pton __inet_pton +#define inet_ntop __inet_ntop +#define inet_nsap_addr __inet_nsap_addr +#define inet_nsap_ntoa __inet_nsap_ntoa + +__BEGIN_DECLS +in_addr_t inet_addr(const char *); +char *inet_ntoa(struct in_addr); +const char *inet_ntop(int, const void *, char *, socklen_t); +int inet_pton(int, const char *, void *); + +int ascii2addr(int, const char *, void *); +char *addr2ascii(int, const void *, int, char *); +int inet_aton(const char *, struct in_addr *); +in_addr_t inet_lnaof(struct in_addr); +struct in_addr inet_makeaddr(in_addr_t, in_addr_t); +char * inet_neta(in_addr_t, char *, size_t); +in_addr_t inet_netof(struct in_addr); +in_addr_t inet_network(const char *); +char *inet_net_ntop(int, const void *, int, char *, size_t); +int inet_net_pton(int, const char *, void *, size_t); +unsigned inet_nsap_addr(const char *, unsigned char *, int); +char *inet_nsap_ntoa(int, const unsigned char *, char *); +__END_DECLS + +#endif /* !_ARPA_INET_H_ */ diff --git a/newlib/libc/sys/linux/include/arpa/nameser.h b/newlib/libc/sys/linux/include/arpa/nameser.h new file mode 100644 index 000000000..8735b8bd3 --- /dev/null +++ b/newlib/libc/sys/linux/include/arpa/nameser.h @@ -0,0 +1,449 @@ +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * From: Id: nameser.h,v 8.16 1998/02/06 00:35:58 halley Exp + * $FreeBSD: src/include/arpa/nameser.h,v 1.16 2002/03/23 17:24:55 imp Exp $ + */ + +#ifndef _ARPA_NAMESER_H_ +#define _ARPA_NAMESER_H_ + +#define BIND_4_COMPAT + +#include +#include + +/* + * revision information. this is the release date in YYYYMMDD format. + * it can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__NAMESER > 19931104)". do not + * compare for equality; rather, use it to determine whether your libnameser.a + * is new enough to contain a certain feature. + */ + +/* XXXRTH I made this bigger than __BIND in 4.9.5 T6B */ +#define __NAMESER 19961001 /* New interface version stamp. */ + +/* + * Define constants based on RFC 883, RFC 1034, RFC 1035 + */ +#define NS_PACKETSZ 512 /* maximum packet size */ +#define NS_MAXDNAME 1025 /* maximum domain name */ +#define NS_MAXCDNAME 255 /* maximum compressed domain name */ +#define NS_MAXLABEL 63 /* maximum length of domain label */ +#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */ +#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */ +#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */ +#define NS_INADDRSZ 4 /* IPv4 T_A */ +#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ +#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ +#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ + +/* + * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord() + * in synch with it. + */ +typedef enum __ns_sect { + ns_s_qd = 0, /* Query: Question. */ + ns_s_zn = 0, /* Update: Zone. */ + ns_s_an = 1, /* Query: Answer. */ + ns_s_pr = 1, /* Update: Prerequisites. */ + ns_s_ns = 2, /* Query: Name servers. */ + ns_s_ud = 2, /* Update: Update. */ + ns_s_ar = 3, /* Query|Update: Additional records. */ + ns_s_max = 4 +} ns_sect; + +/* + * This is a message handle. It is caller allocated and has no dynamic data. + * This structure is intended to be opaque to all but ns_parse.c, thus the + * leading _'s on the member names. Use the accessor functions, not the _'s. + */ +typedef struct __ns_msg { + const u_char *_msg, *_eom; + u_int16_t _id, _flags, _counts[ns_s_max]; + const u_char *_sections[ns_s_max]; + ns_sect _sect; + int _rrnum; + const u_char *_ptr; +} ns_msg; + +/* Private data structure - do not use from outside library. */ +struct _ns_flagdata { int mask, shift; }; +extern struct _ns_flagdata _ns_flagdata[]; + +/* Accessor macros - this is part of the public interface. */ +#define ns_msg_getflag(handle, flag) ( \ + ((handle)._flags & _ns_flagdata[flag].mask) \ + >> _ns_flagdata[flag].shift \ + ) +#define ns_msg_id(handle) ((handle)._id + 0) +#define ns_msg_base(handle) ((handle)._msg + 0) +#define ns_msg_end(handle) ((handle)._eom + 0) +#define ns_msg_size(handle) ((handle)._eom - (handle)._msg) +#define ns_msg_count(handle, section) ((handle)._counts[section] + 0) + +/* + * This is a parsed record. It is caller allocated and has no dynamic data. + */ +typedef struct __ns_rr { + char name[NS_MAXDNAME]; /* XXX need to malloc */ + u_int16_t type; + u_int16_t rr_class; + u_int32_t ttl; + u_int16_t rdlength; + const u_char *rdata; +} ns_rr; + +/* Accessor macros - this is part of the public interface. */ +#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") +#define ns_rr_type(rr) ((rr).type + 0) +#define ns_rr_class(rr) ((rr).rr_class + 0) +#define ns_rr_ttl(rr) ((rr).ttl + 0) +#define ns_rr_rdlen(rr) ((rr).rdlength + 0) +#define ns_rr_rdata(rr) ((rr).rdata + 0) + +/* + * These don't have to be in the same order as in the packet flags word, + * and they can even overlap in some cases, but they will need to be kept + * in synch with ns_parse.c:ns_flagdata[]. + */ +typedef enum __ns_flag { + ns_f_qr, /* Question/Response. */ + ns_f_opcode, /* Operation code. */ + ns_f_aa, /* Authoritative Answer. */ + ns_f_tc, /* Truncation occurred. */ + ns_f_rd, /* Recursion Desired. */ + ns_f_ra, /* Recursion Available. */ + ns_f_z, /* MBZ. */ + ns_f_ad, /* Authentic Data (DNSSEC). */ + ns_f_cd, /* Checking Disabled (DNSSEC). */ + ns_f_rcode, /* Response code. */ + ns_f_max +} ns_flag; + +/* + * Currently defined opcodes. + */ +typedef enum __ns_opcode { + ns_o_query = 0, /* Standard query. */ + ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ + ns_o_status = 2, /* Name server status query (unsupported). */ + /* Opcode 3 is undefined/reserved. */ + ns_o_notify = 4, /* Zone change notification. */ + ns_o_update = 5, /* Zone update message. */ + ns_o_max = 6 +} ns_opcode; + +/* + * Currently defined response codes. + */ +typedef enum __ns_rcode { + ns_r_noerror = 0, /* No error occurred. */ + ns_r_formerr = 1, /* Format error. */ + ns_r_servfail = 2, /* Server failure. */ + ns_r_nxdomain = 3, /* Name error. */ + ns_r_notimpl = 4, /* Unimplemented. */ + ns_r_refused = 5, /* Operation refused. */ + /* these are for BIND_UPDATE */ + ns_r_yxdomain = 6, /* Name exists */ + ns_r_yxrrset = 7, /* RRset exists */ + ns_r_nxrrset = 8, /* RRset does not exist */ + ns_r_notauth = 9, /* Not authoritative for zone */ + ns_r_notzone = 10, /* Zone of record different from zone section */ + ns_r_max = 11 +} ns_rcode; + +/* BIND_UPDATE */ +typedef enum __ns_update_operation { + ns_uop_delete = 0, + ns_uop_add = 1, + ns_uop_max = 2 +} ns_update_operation; + +/* + * This RR-like structure is particular to UPDATE. + */ +struct ns_updrec { + struct ns_updrec *r_prev; /* prev record */ + struct ns_updrec *r_next; /* next record */ + u_int8_t r_section; /* ZONE/PREREQUISITE/UPDATE */ + char * r_dname; /* owner of the RR */ + u_int16_t r_class; /* class number */ + u_int16_t r_type; /* type number */ + u_int32_t r_ttl; /* time to live */ + u_char * r_data; /* rdata fields as text string */ + u_int16_t r_size; /* size of r_data field */ + int r_opcode; /* type of operation */ + /* following fields for private use by the resolver/server routines */ + struct ns_updrec *r_grpnext; /* next record when grouped */ + struct databuf *r_dp; /* databuf to process */ + struct databuf *r_deldp; /* databuf's deleted/overwritten */ + u_int16_t r_zone; /* zone number on server */ +}; +typedef struct ns_updrec ns_updrec; + +/* + * Currently defined type values for resources and queries. + */ +typedef enum __ns_type { + ns_t_a = 1, /* Host address. */ + ns_t_ns = 2, /* Authoritative server. */ + ns_t_md = 3, /* Mail destination. */ + ns_t_mf = 4, /* Mail forwarder. */ + ns_t_cname = 5, /* Canonical name. */ + ns_t_soa = 6, /* Start of authority zone. */ + ns_t_mb = 7, /* Mailbox domain name. */ + ns_t_mg = 8, /* Mail group member. */ + ns_t_mr = 9, /* Mail rename name. */ + ns_t_null = 10, /* Null resource record. */ + ns_t_wks = 11, /* Well known service. */ + ns_t_ptr = 12, /* Domain name pointer. */ + ns_t_hinfo = 13, /* Host information. */ + ns_t_minfo = 14, /* Mailbox information. */ + ns_t_mx = 15, /* Mail routing information. */ + ns_t_txt = 16, /* Text strings. */ + ns_t_rp = 17, /* Responsible person. */ + ns_t_afsdb = 18, /* AFS cell database. */ + ns_t_x25 = 19, /* X_25 calling address. */ + ns_t_isdn = 20, /* ISDN calling address. */ + ns_t_rt = 21, /* Router. */ + ns_t_nsap = 22, /* NSAP address. */ + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ + ns_t_sig = 24, /* Security signature. */ + ns_t_key = 25, /* Security key. */ + ns_t_px = 26, /* X.400 mail mapping. */ + ns_t_gpos = 27, /* Geographical position (withdrawn). */ + ns_t_aaaa = 28, /* Ip6 Address. */ + ns_t_loc = 29, /* Location Information. */ + ns_t_nxt = 30, /* Next domain (security). */ + ns_t_eid = 31, /* Endpoint identifier. */ + ns_t_nimloc = 32, /* Nimrod Locator. */ + ns_t_srv = 33, /* Server Selection. */ + ns_t_atma = 34, /* ATM Address */ + ns_t_naptr = 35, /* Naming Authority PoinTeR */ + ns_t_opt = 41, /* OPT pseudo-RR, RFC2761 */ + /* Query type values which do not appear in resource records. */ + ns_t_ixfr = 251, /* Incremental zone transfer. */ + ns_t_axfr = 252, /* Transfer zone of authority. */ + ns_t_mailb = 253, /* Transfer mailbox records. */ + ns_t_maila = 254, /* Transfer mail agent records. */ + ns_t_any = 255, /* Wildcard match. */ + ns_t_max = 65536 +} ns_type; + +/* + * Values for class field + */ +typedef enum __ns_class { + ns_c_in = 1, /* Internet. */ + /* Class 2 unallocated/unsupported. */ + ns_c_chaos = 3, /* MIT Chaos-net. */ + ns_c_hs = 4, /* MIT Hesiod. */ + /* Query class values which do not appear in resource records */ + ns_c_none = 254, /* for prereq. sections in update requests */ + ns_c_any = 255, /* Wildcard match. */ + ns_c_max = 65536 +} ns_class; + +/* + * Flags field of the KEY RR rdata + */ +#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */ +#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */ +#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */ +#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */ +#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */ +/* The type bits can also be interpreted independently, as single bits: */ +#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */ +#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */ +#define NS_KEY_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */ +#define NS_KEY_RESERVED3 0x1000 /* reserved - must be zero */ +#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */ +#define NS_KEY_USERACCOUNT 0x0400 /* key is assoc. with a user acct */ +#define NS_KEY_ENTITY 0x0200 /* key is assoc. with entity eg host */ +#define NS_KEY_ZONEKEY 0x0100 /* key is zone key */ +#define NS_KEY_IPSEC 0x0080 /* key is for IPSEC (host or user)*/ +#define NS_KEY_EMAIL 0x0040 /* key is for email (MIME security) */ +#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */ +#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */ +#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */ + +#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED3 | \ + NS_KEY_RESERVED4 | \ + NS_KEY_RESERVED10 | \ + NS_KEY_RESERVED11 ) + +/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ +#define NS_ALG_MD5RSA 1 /* MD5 with RSA */ +#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */ +#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */ + +/* Signatures */ +#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */ +#define NS_MD5RSA_MAX_BITS 2552 + /* Total of binary mod and exp */ +#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3) + /* Max length of text sig block */ +#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4) + +/* Offsets into SIG record rdata to find various values */ +#define NS_SIG_TYPE 0 /* Type flags */ +#define NS_SIG_ALG 2 /* Algorithm */ +#define NS_SIG_LABELS 3 /* How many labels in name */ +#define NS_SIG_OTTL 4 /* Original TTL */ +#define NS_SIG_EXPIR 8 /* Expiration time */ +#define NS_SIG_SIGNED 12 /* Signature time */ +#define NS_SIG_FOOT 16 /* Key footprint */ +#define NS_SIG_SIGNER 18 /* Domain name of who signed it */ + +/* How RR types are represented as bit-flags in NXT records */ +#define NS_NXT_BITS 8 +#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS))) + + +/* + * Inline versions of get/put short/long. Pointer is advanced. + */ +#define NS_GET16(s, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((u_int16_t)t_cp[0] << 8) \ + | ((u_int16_t)t_cp[1]) \ + ; \ + (cp) += NS_INT16SZ; \ +} + +#define NS_GET32(l, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (l) = ((u_int32_t)t_cp[0] << 24) \ + | ((u_int32_t)t_cp[1] << 16) \ + | ((u_int32_t)t_cp[2] << 8) \ + | ((u_int32_t)t_cp[3]) \ + ; \ + (cp) += NS_INT32SZ; \ +} + +#define NS_PUT16(s, cp) { \ + register u_int16_t t_s = (u_int16_t)(s); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += NS_INT16SZ; \ +} + +#define NS_PUT32(l, cp) { \ + register u_int32_t t_l = (u_int32_t)(l); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += NS_INT32SZ; \ +} + +/* + * ANSI C identifier hiding. + */ +#define ns_get16 __ns_get16 +#define ns_get32 __ns_get32 +#define ns_put16 __ns_put16 +#define ns_put32 __ns_put32 +#define ns_initparse __ns_initparse +#define ns_parserr __ns_parserr +#define ns_sprintrr __ns_sprintrr +#define ns_sprintrrf __ns_sprintrrf +#define ns_format_ttl __ns_format_ttl +#define ns_parse_ttl __ns_parse_ttl +#define ns_name_ntop __ns_name_ntop +#define ns_name_pton __ns_name_pton +#define ns_name_unpack __ns_name_unpack +#define ns_name_pack __ns_name_pack +#define ns_name_compress __ns_name_compress +#define ns_name_uncompress __ns_name_uncompress + +__BEGIN_DECLS +u_int ns_get16(const u_char *); +u_long ns_get32(const u_char *); +void ns_put16(u_int, u_char *); +void ns_put32(u_long, u_char *); +int ns_initparse(const u_char *, int, ns_msg *); +int ns_parserr(ns_msg *, ns_sect, int, ns_rr *); +int ns_sprintrr(const ns_msg *, const ns_rr *, + const char *, const char *, char *, size_t); +int ns_sprintrrf(const u_char *, size_t, const char *, + ns_class, ns_type, u_long, const u_char *, + size_t, const char *, const char *, + char *, size_t); +int ns_format_ttl(u_long, char *, size_t); +int ns_parse_ttl(const char *, u_long *); +int ns_name_ntop(const u_char *, char *, size_t); +int ns_name_pton(const char *, u_char *, size_t); +int ns_name_unpack(const u_char *, const u_char *, + const u_char *, u_char *, size_t); +int ns_name_pack(const u_char *, u_char *, int, + const u_char **, const u_char **); +int ns_name_uncompress(const u_char *, const u_char *, + const u_char *, char *, size_t); +int ns_name_compress(const char *, u_char *, size_t, + const u_char **, const u_char **); +int ns_name_skip(const u_char **, const u_char *); +__END_DECLS + +#ifdef BIND_4_COMPAT +#include +#endif + +#endif /* !_ARPA_NAMESER_H_ */ diff --git a/newlib/libc/sys/linux/include/arpa/nameser_compat.h b/newlib/libc/sys/linux/include/arpa/nameser_compat.h new file mode 100644 index 000000000..bbdea8979 --- /dev/null +++ b/newlib/libc/sys/linux/include/arpa/nameser_compat.h @@ -0,0 +1,182 @@ +/* Copyright (c) 1983, 1989 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * from nameser.h 8.1 (Berkeley) 6/2/93 + * From: Id: nameser_compat.h,v 8.9 1998/03/20 23:25:10 halley Exp + * $FreeBSD: src/include/arpa/nameser_compat.h,v 1.3 2001/06/10 20:25:22 ume Exp $ + */ + +#ifndef _ARPA_NAMESER_COMPAT_ +#define _ARPA_NAMESER_COMPAT_ + +#define __BIND 19950621 /* (DEAD) interface version stamp. */ + +#include +#include + +#if !defined(BYTE_ORDER) || \ + (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ + BYTE_ORDER != PDP_ENDIAN) + /* you must determine what the correct bit order is for + * your compiler - the next line is an intentional error + * which will force your compiles to bomb until you fix + * the above macros. + */ + error "Undefined or invalid BYTE_ORDER"; +#endif + +/* + * Structure for query header. The order of the fields is machine- and + * compiler-dependent, depending on the byte/bit order and the layout + * of bit fields. We use bit fields only in int variables, as this + * is all ANSI requires. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + unsigned id :16; /* query identification number */ +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + unsigned rd :1; /* recursion desired */ + unsigned tc :1; /* truncated message */ + unsigned aa :1; /* authoritive answer */ + unsigned opcode :4; /* purpose of message */ + unsigned qr :1; /* response flag */ + /* fields in fourth byte */ + unsigned rcode :4; /* response code */ + unsigned cd: 1; /* checking disabled by resolver */ + unsigned ad: 1; /* authentic data from named */ + unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned ra :1; /* recursion available */ +#endif + /* remaining bytes */ + unsigned qdcount :16; /* number of question entries */ + unsigned ancount :16; /* number of answer entries */ + unsigned nscount :16; /* number of authority entries */ + unsigned arcount :16; /* number of resource entries */ +} HEADER; + +#define PACKETSZ NS_PACKETSZ +#define MAXDNAME NS_MAXDNAME +#define MAXCDNAME NS_MAXCDNAME +#define MAXLABEL NS_MAXLABEL +#define HFIXEDSZ NS_HFIXEDSZ +#define QFIXEDSZ NS_QFIXEDSZ +#define RRFIXEDSZ NS_RRFIXEDSZ +#define INT32SZ NS_INT32SZ +#define INT16SZ NS_INT16SZ +#define INADDRSZ NS_INADDRSZ +#define IN6ADDRSZ NS_IN6ADDRSZ +#define INDIR_MASK NS_CMPRSFLGS +#define NAMESERVER_PORT NS_DEFAULTPORT + +#define S_ZONE ns_s_zn +#define S_PREREQ ns_s_pr +#define S_UPDATE ns_s_ud +#define S_ADDT ns_s_ar + +#define QUERY ns_o_query +#define IQUERY ns_o_iquery +#define STATUS ns_o_status +#define NS_NOTIFY_OP ns_o_notify +#define NS_UPDATE_OP ns_o_update + +#define NOERROR ns_r_noerror +#define FORMERR ns_r_formerr +#define SERVFAIL ns_r_servfail +#define NXDOMAIN ns_r_nxdomain +#define NOTIMP ns_r_notimpl +#define REFUSED ns_r_refused +#define YXDOMAIN ns_r_yxdomain +#define YXRRSET ns_r_yxrrset +#define NXRRSET ns_r_nxrrset +#define NOTAUTH ns_r_notauth +#define NOTZONE ns_r_notzone + +#define DELETE ns_uop_delete +#define ADD ns_uop_add + +#define T_A ns_t_a +#define T_NS ns_t_ns +#define T_MD ns_t_md +#define T_MF ns_t_mf +#define T_CNAME ns_t_cname +#define T_SOA ns_t_soa +#define T_MB ns_t_mb +#define T_MG ns_t_mg +#define T_MR ns_t_mr +#define T_NULL ns_t_null +#define T_WKS ns_t_wks +#define T_PTR ns_t_ptr +#define T_HINFO ns_t_hinfo +#define T_MINFO ns_t_minfo +#define T_MX ns_t_mx +#define T_TXT ns_t_txt +#define T_RP ns_t_rp +#define T_AFSDB ns_t_afsdb +#define T_X25 ns_t_x25 +#define T_ISDN ns_t_isdn +#define T_RT ns_t_rt +#define T_NSAP ns_t_nsap +#define T_NSAP_PTR ns_t_nsap_ptr +#define T_SIG ns_t_sig +#define T_KEY ns_t_key +#define T_PX ns_t_px +#define T_GPOS ns_t_gpos +#define T_AAAA ns_t_aaaa +#define T_LOC ns_t_loc +#define T_NXT ns_t_nxt +#define T_EID ns_t_eid +#define T_NIMLOC ns_t_nimloc +#define T_SRV ns_t_srv +#define T_ATMA ns_t_atma +#define T_NAPTR ns_t_naptr +#define T_OPT ns_t_opt +#define T_IXFR ns_t_ixfr +#define T_AXFR ns_t_axfr +#define T_MAILB ns_t_mailb +#define T_MAILA ns_t_maila +#define T_ANY ns_t_any + +#define C_IN ns_c_in +#define C_CHAOS ns_c_chaos +#define C_HS ns_c_hs +/* BIND_UPDATE */ +#define C_NONE ns_c_none +#define C_ANY ns_c_any + +#define GETSHORT NS_GET16 +#define GETLONG NS_GET32 +#define PUTSHORT NS_PUT16 +#define PUTLONG NS_PUT32 + +#endif /* _ARPA_NAMESER_COMPAT_ */ diff --git a/newlib/libc/sys/linux/include/arpa/telnet.h b/newlib/libc/sys/linux/include/arpa/telnet.h new file mode 100644 index 000000000..70e7ea822 --- /dev/null +++ b/newlib/libc/sys/linux/include/arpa/telnet.h @@ -0,0 +1,342 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)telnet.h 8.2 (Berkeley) 12/15/93 + * $FreeBSD: src/include/arpa/telnet.h,v 1.8 2001/12/03 12:41:18 markm Exp $ + */ + +#ifndef _ARPA_TELNET_H_ +#define _ARPA_TELNET_H_ + +/* + * Definitions for the TELNET protocol. + */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ +#define ABORT 238 /* Abort process */ +#define SUSP 237 /* Suspend process */ +#define xEOF 236 /* End of file: EOF is already used... */ + +#define SYNCH 242 /* for telfunc calls */ + +#ifdef TELCMDS +const char *telcmds[] = { + "EOF", "SUSP", "ABORT", "EOR", + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", + 0 +}; +#else +extern char *telcmds[]; +#endif + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ + (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +/* telnet options */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TUID 26 /* TACACS user identification */ +#define TELOPT_OUTMRK 27 /* output marking */ +#define TELOPT_TTYLOC 28 /* terminal location number */ +#define TELOPT_3270REGIME 29 /* 3270 regime */ +#define TELOPT_X3PAD 30 /* X.3 PAD */ +#define TELOPT_NAWS 31 /* window size */ +#define TELOPT_TSPEED 32 /* terminal speed */ +#define TELOPT_LFLOW 33 /* remote flow control */ +#define TELOPT_LINEMODE 34 /* Linemode option */ +#define TELOPT_XDISPLOC 35 /* X Display Location */ +#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ +#define TELOPT_AUTHENTICATION 37/* Authenticate */ +#define TELOPT_ENCRYPT 38 /* Encryption option */ +#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + + +#define NTELOPTS (1+TELOPT_NEW_ENVIRON) +#ifdef TELOPTS +const char *telopts[NTELOPTS+1] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", + "ENCRYPT", "NEW-ENVIRON", + 0 +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +/* sub-option qualifiers */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ + +#define LFLOW_OFF 0 /* Disable remote flow control */ +#define LFLOW_ON 1 /* Enable remote flow control */ +#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ +#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ + +/* + * LINEMODE suboptions + */ + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +/* Not part of protocol, but needed to simplify things... */ +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 +#define SLC_MCL 19 +#define SLC_MCR 20 +#define SLC_MCWL 21 +#define SLC_MCWR 22 +#define SLC_MCBOL 23 +#define SLC_MCEOL 24 +#define SLC_INSRT 25 +#define SLC_OVER 26 +#define SLC_ECR 27 +#define SLC_EWR 28 +#define SLC_EBOL 29 +#define SLC_EEOL 30 + +#define NSLC 30 + +/* + * For backwards compatibility, we define SLC_NAMES to be the + * list of names if SLC_NAMES is not defined. + */ +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \ + "MCL", "MCR", "MCWL", "MCWR", "MCBOL", \ + "MCEOL", "INSRT", "OVER", "ECR", "EWR", \ + "EBOL", "EEOL", \ + 0 + +#ifdef SLC_NAMES +const char *slc_names[] = { + SLC_NAMELIST +}; +#else +extern char *slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +/* + * AUTHENTICATION suboptions + */ + +/* + * Who is authenticating who ... + */ +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ +#define AUTH_WHO_SERVER 1 /* Server authenticating client */ +#define AUTH_WHO_MASK 1 + +/* + * amount of authentication done + */ +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_SRA 6 +#define AUTHTYPE_CNT 7 + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +const char *authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", NULL, "SRA", + 0 +}; +#else +extern char *authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +/* + * ENCRYPTion suboptions + */ +#define ENCRYPT_IS 0 /* I pick encryption type ... */ +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ +#define ENCRYPT_REPLY 2 /* Initial setup response */ +#define ENCRYPT_START 3 /* Am starting to send encrypted */ +#define ENCRYPT_END 4 /* Am ending encrypted */ +#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ +#define ENCRYPT_REQEND 6 /* Request you end encrypting */ +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +const char *encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0 +}; +const char *enctype_names[] = { + "ANY", "DES_CFB64", "DES_OFB64", + 0 +}; +#else +extern char *encrypt_names[]; +extern char *enctype_names[]; +#endif + + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +#endif /* !_TELNET_H_ */ diff --git a/newlib/libc/sys/linux/include/arpa/tftp.h b/newlib/libc/sys/linux/include/arpa/tftp.h new file mode 100644 index 000000000..1de4dd48a --- /dev/null +++ b/newlib/libc/sys/linux/include/arpa/tftp.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tftp.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/arpa/tftp.h,v 1.5 2001/09/27 20:50:14 obrien Exp $ + */ + +#ifndef _ARPA_TFTP_H_ +#define _ARPA_TFTP_H_ + +/* + * Trivial File Transfer Protocol (IEN-133) + */ +#define SEGSIZE 512 /* data segment size */ + +/* + * Packet types. + */ +#define RRQ 01 /* read request */ +#define WRQ 02 /* write request */ +#define DATA 03 /* data packet */ +#define ACK 04 /* acknowledgement */ +#define ERROR 05 /* error code */ +#define OACK 06 /* option acknowledgement */ + +struct tftphdr { + unsigned short th_opcode; /* packet type */ + union { + unsigned short tu_block; /* block # */ + unsigned short tu_code; /* error code */ + char tu_stuff[1]; /* request packet stuff */ + } th_u; + char th_data[1]; /* data or error string */ +}; + +#define th_block th_u.tu_block +#define th_code th_u.tu_code +#define th_stuff th_u.tu_stuff +#define th_msg th_data + +/* + * Error codes. + */ +#define EUNDEF 0 /* not defined */ +#define ENOTFOUND 1 /* file not found */ +#define EACCESS 2 /* access violation */ +#define ENOSPACE 3 /* disk full or allocation exceeded */ +#define EBADOP 4 /* illegal TFTP operation */ +#define EBADID 5 /* unknown transfer ID */ +#define EEXISTS 6 /* file already exists */ +#define ENOUSER 7 /* no such user */ +#define EOPTNEG 8 /* option negotiation failed */ + +#endif /* !_TFTP_H_ */ diff --git a/newlib/libc/sys/linux/include/dl-hash.h b/newlib/libc/sys/linux/include/dl-hash.h new file mode 100644 index 000000000..e0f7a4944 --- /dev/null +++ b/newlib/libc/sys/linux/include/dl-hash.h @@ -0,0 +1,74 @@ +/* Compute hash value for given string according to ELF standard. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DL_HASH_H +#define _DL_HASH_H 1 + + +/* This is the hashing function specified by the ELF ABI. In the + first five operations no overflow is possible so we optimized it a + bit. */ +static inline unsigned int +_dl_elf_hash (const unsigned char *name) +{ + unsigned long int hash = 0; + if (*name != '\0') + { + hash = *name++; + if (*name != '\0') + { + hash = (hash << 4) + *name++; + if (*name != '\0') + { + hash = (hash << 4) + *name++; + if (*name != '\0') + { + hash = (hash << 4) + *name++; + if (*name != '\0') + { + hash = (hash << 4) + *name++; + while (*name != '\0') + { + unsigned long int hi; + hash = (hash << 4) + *name++; + hi = hash & 0xf0000000; + + /* The algorithm specified in the ELF ABI is as + follows: + + if (hi != 0) + hash ^= hi >> 24; + + hash &= ~hi; + + But the following is equivalent and a lot + faster, especially on modern processors. */ + + hash ^= hi; + hash ^= hi >> 24; + } + } + } + } + } + } + return hash; +} + +#endif /* dl-hash.h */ diff --git a/newlib/libc/sys/linux/include/dlfcn.h b/newlib/libc/sys/linux/include/dlfcn.h new file mode 100644 index 000000000..75d7526b0 --- /dev/null +++ b/newlib/libc/sys/linux/include/dlfcn.h @@ -0,0 +1,65 @@ +#ifndef _DLFCN_H +#include
+ +#define internal_function + +/* Internally used flag. */ +#define __RTLD_DLOPEN 0x80000000 +#define __RTLD_SPROF 0x40000000 + +/* Now define the internal interfaces. */ +extern void *__dlvsym (void *__handle, __const char *__name, + __const char *__version); + +extern void *__libc_dlopen (__const char *__name); +extern void *__libc_dlsym (void *__map, __const char *__name); +extern int __libc_dlclose (void *__map); + +/* Locate shared object containing the given address. */ +extern int _dl_addr (const void *address, Dl_info *info) + internal_function; + +/* Open the shared object NAME, relocate it, and run its initializer if it + hasn't already been run. MODE is as for `dlopen' (see ). If + the object is already opened, returns its existing map. */ +extern void *_dl_open (const char *name, int mode, const void *caller) + internal_function; + +/* Close an object previously opened by _dl_open. */ +extern void _dl_close (void *map) + internal_function; + +/* Look up NAME in shared object HANDLE (which may be RTLD_DEFAULT or + RTLD_NEXT). WHO is the calling function, for RTLD_NEXT. Returns + the symbol value, which may be NULL. */ +extern void *_dl_sym (void *handle, const char *name, void *who) + internal_function; + +/* Look up version VERSION of symbol NAME in shared object HANDLE + (which may be RTLD_DEFAULT or RTLD_NEXT). WHO is the calling + function, for RTLD_NEXT. Returns the symbol value, which may be + NULL. */ +extern void *_dl_vsym (void *handle, const char *name, const char *version, + void *who) + internal_function; + +/* Call OPERATE, catching errors from `dl_signal_error'. If there is no + error, *ERRSTRING is set to null. If there is an error, *ERRSTRING is + set to a string constructed from the strings passed to _dl_signal_error, + and the error code passed is the return value and *OBJNAME is set to + the object name which experienced the problems. ERRSTRING if nonzero + points to a malloc'ed string which the caller has to free after use. + ARGS is passed as argument to OPERATE. */ +extern int _dl_catch_error (const char **objname, const char **errstring, + void (*operate) (void *), + void *args) + internal_function; + +/* Helper function for functions. Runs the OPERATE function via + _dl_catch_error. Returns zero for success, nonzero for failure; and + arranges for `dlerror' to return the error details. + ARGS is passed as argument to OPERATE. */ +extern int _dlerror_run (void (*operate) (void *), void *args) + internal_function; + +#endif diff --git a/newlib/libc/sys/linux/include/fnmatch.h b/newlib/libc/sys/linux/include/fnmatch.h new file mode 100644 index 000000000..c038bf77f --- /dev/null +++ b/newlib/libc/sys/linux/include/fnmatch.h @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/fnmatch.h,v 1.10 2002/03/23 17:24:53 imp Exp $ + * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _FNMATCH_H_ +#define _FNMATCH_H_ + +#define FNM_NOMATCH 1 /* Match failed. */ + +#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ +#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ +#define FNM_PERIOD 0x04 /* Period must be matched by period. */ + +#if defined(_GNU_SOURCE) || !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ +#define FNM_CASEFOLD 0x10 /* Case insensitive search. */ +#define FNM_IGNORECASE FNM_CASEFOLD +#define FNM_FILE_NAME FNM_PATHNAME +#endif + +#include + +__BEGIN_DECLS +int fnmatch(const char *, const char *, int); +__END_DECLS + +#endif /* !_FNMATCH_H_ */ diff --git a/newlib/libc/sys/linux/include/gconv.h b/newlib/libc/sys/linux/include/gconv.h new file mode 100644 index 000000000..64df45bf5 --- /dev/null +++ b/newlib/libc/sys/linux/include/gconv.h @@ -0,0 +1,175 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This header provides no interface for a user to the internals of + the gconv implementation in the libc. Therefore there is no use + for these definitions beside for writing additional gconv modules. */ + +#ifndef _GCONV_H +#define _GCONV_H 1 + +#include +#define __need_mbstate_t +#include +#define __need_size_t +#define __need_wchar_t +#include + +/* ISO 10646 value used to signal invalid value. */ +#define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd) + +/* Error codes for gconv functions. */ +enum +{ + __GCONV_OK = 0, + __GCONV_NOCONV, + __GCONV_NODB, + __GCONV_NOMEM, + + __GCONV_EMPTY_INPUT, + __GCONV_FULL_OUTPUT, + __GCONV_ILLEGAL_INPUT, + __GCONV_INCOMPLETE_INPUT, + + __GCONV_ILLEGAL_DESCRIPTOR, + __GCONV_INTERNAL_ERROR +}; + + +/* Flags the `__gconv_open' function can set. */ +enum +{ + __GCONV_IS_LAST = 0x0001, + __GCONV_IGNORE_ERRORS = 0x0002 +}; + + +/* Forward declarations. */ +struct __gconv_step; +struct __gconv_step_data; +struct __gconv_loaded_object; +struct __gconv_trans_data; + + +/* Type of a conversion function. */ +typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *, + __const unsigned char **, __const unsigned char *, + unsigned char **, size_t *, int, int); + +/* Constructor and destructor for local data for conversion step. */ +typedef int (*__gconv_init_fct) (struct __gconv_step *); +typedef void (*__gconv_end_fct) (struct __gconv_step *); + + +/* Type of a transliteration/transscription function. */ +typedef int (*__gconv_trans_fct) (struct __gconv_step *, + struct __gconv_step_data *, void *, + __const unsigned char *, + __const unsigned char **, + __const unsigned char *, unsigned char **, + size_t *); + +/* Function to call to provide transliteration module with context. */ +typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *, + __const unsigned char *, + unsigned char *, unsigned char *); + +/* Function to query module about supported encoded character sets. */ +typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***, + size_t *); + +/* Constructor and destructor for local data for transliteration. */ +typedef int (*__gconv_trans_init_fct) (void **, const char *); +typedef void (*__gconv_trans_end_fct) (void *); + +struct __gconv_trans_data +{ + /* Transliteration/Transscription function. */ + __gconv_trans_fct __trans_fct; + __gconv_trans_context_fct __trans_context_fct; + __gconv_trans_end_fct __trans_end_fct; + void *__data; + struct __gconv_trans_data *__next; +}; + + +/* Description of a conversion step. */ +struct __gconv_step +{ + struct __gconv_loaded_object *__shlib_handle; + __const char *__modname; + + int __counter; + + char *__from_name; + char *__to_name; + + __gconv_fct __fct; + __gconv_init_fct __init_fct; + __gconv_end_fct __end_fct; + + /* Information about the number of bytes needed or produced in this + step. This helps optimizing the buffer sizes. */ + int __min_needed_from; + int __max_needed_from; + int __min_needed_to; + int __max_needed_to; + + /* Flag whether this is a stateful encoding or not. */ + int __stateful; + + void *__data; /* Pointer to step-local data. */ +}; + +/* Additional data for steps in use of conversion descriptor. This is + allocated by the `init' function. */ +struct __gconv_step_data +{ + unsigned char *__outbuf; /* Output buffer for this step. */ + unsigned char *__outbufend; /* Address of first byte after the output + buffer. */ + + /* Is this the last module in the chain. */ + int __flags; + + /* Counter for number of invocations of the module function for this + descriptor. */ + int __invocation_counter; + + /* Flag whether this is an internal use of the module (in the mb*towc* + and wc*tomb* functions) or regular with iconv(3). */ + int __internal_use; + + mbstate_t *__statep; + mbstate_t __state; /* This element must not be used directly by + any module; always use STATEP! */ + + /* Transliteration information. */ + struct __gconv_trans_data *__trans; +}; + + +/* Combine conversion step description with data. */ +typedef struct __gconv_info +{ + size_t __nsteps; + struct __gconv_step *__steps; + __extension__ struct __gconv_step_data __data __flexarr; +} *__gconv_t; + +#endif /* gconv.h */ diff --git a/newlib/libc/sys/linux/include/glob.h b/newlib/libc/sys/linux/include/glob.h new file mode 100644 index 000000000..6e038476d --- /dev/null +++ b/newlib/libc/sys/linux/include/glob.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Guido van Rossum. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)glob.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/glob.h,v 1.6 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _GLOB_H_ +#define _GLOB_H_ + +#include + +struct stat; +typedef struct { + int gl_pathc; /* Count of total paths so far. */ + int gl_matchc; /* Count of paths matching pattern. */ + int gl_offs; /* Reserved at beginning of gl_pathv. */ + int gl_flags; /* Copy of flags parameter to glob. */ + char **gl_pathv; /* List of paths matching pattern. */ + /* Copy of errfunc parameter to glob. */ + int (*gl_errfunc)(const char *, int); + + /* + * Alternate filesystem access methods for glob; replacement + * versions of closedir(3), readdir(3), opendir(3), stat(2) + * and lstat(2). + */ + void (*gl_closedir)(void *); + struct dirent *(*gl_readdir)(void *); + void *(*gl_opendir)(const char *); + int (*gl_lstat)(const char *, struct stat *); + int (*gl_stat)(const char *, struct stat *); +} glob_t; + +#define GLOB_APPEND 0x0001 /* Append to output from previous call. */ +#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ +#define GLOB_ERR 0x0004 /* Return on error. */ +#define GLOB_MARK 0x0008 /* Append / to matching directories. */ +#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ +#define GLOB_NOSORT 0x0020 /* Don't sort. */ + +#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ +#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ +#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ +#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ +#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ +#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ +#define GLOB_LIMIT 0x1000 /* limit number of returned paths */ + +/* backwards compatibility, this is the old name for this option */ +#define GLOB_MAXPATH GLOB_LIMIT + +#define GLOB_NOSPACE (-1) /* Malloc call failed. */ +#define GLOB_ABEND (-2) /* Unignored error. */ + +__BEGIN_DECLS +int glob(const char *, int, int (*)(const char *, int), glob_t *); +void globfree(glob_t *); +__END_DECLS + +#endif /* !_GLOB_H_ */ diff --git a/newlib/libc/sys/linux/include/hesiod.h b/newlib/libc/sys/linux/include/hesiod.h new file mode 100644 index 000000000..c7dbeee33 --- /dev/null +++ b/newlib/libc/sys/linux/include/hesiod.h @@ -0,0 +1,98 @@ +/* $NetBSD: hesiod.h,v 1.3 1999/01/24 23:53:18 lukem Exp $ */ +/* $FreeBSD: src/include/hesiod.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */ + + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef _HESIOD_H_ +#define _HESIOD_H_ + + /* Application-visible indication that we have the new interfaces */ + +#define HESIOD_INTERFACES + + /* Configuration information. */ + +#ifndef _PATH_HESIOD_CONF /* Configuration file. */ +#define _PATH_HESIOD_CONF "/etc/hesiod.conf" +#endif + +#define DEF_RHS "" /* Defaults if HESIOD_CONF */ +#define DEF_LHS "" /* file is not present. */ + + /* Error codes (for backwards compatibility) */ + +#define HES_ER_UNINIT -1 /* uninitialized */ +#define HES_ER_OK 0 /* no error */ +#define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */ +#define HES_ER_CONFIG 2 /* local problem (no config file?) */ +#define HES_ER_NET 3 /* network problem */ + + /* Declaration of routines */ + +#include + +__BEGIN_DECLS +int hesiod_init(void **); +char **hesiod_resolve(void *, const char *, const char *); +void hesiod_free_list(void *, char **); +char *hesiod_to_bind(void *, const char *, const char *); +void hesiod_end(void *); + + /* backwards compatibility */ +int hes_init(void); +char *hes_to_bind(const char *, const char *); +char **hes_resolve(const char *, const char *); +int hes_error(void); +void hes_free(char **); +__END_DECLS + +#endif /* ! _HESIOD_H_ */ diff --git a/newlib/libc/sys/linux/include/ifaddrs.h b/newlib/libc/sys/linux/include/ifaddrs.h new file mode 100644 index 000000000..aad6c6839 --- /dev/null +++ b/newlib/libc/sys/linux/include/ifaddrs.h @@ -0,0 +1,56 @@ +/* $FreeBSD: src/include/ifaddrs.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */ + +/* + * Copyright (c) 1995, 1999 + * Berkeley Software Design, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp + */ + +#ifndef _IFADDRS_H_ +#define _IFADDRS_H_ + +struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; + u_int ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + struct sockaddr *ifa_dstaddr; + void *ifa_data; +}; + +/* + * This may have been defined in . Note that if is + * to be included it must be included before this header file. + */ +#ifndef ifa_broadaddr +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ +#endif + +#include + +__BEGIN_DECLS +extern int getifaddrs(struct ifaddrs **); +extern void freeifaddrs(struct ifaddrs *); +__END_DECLS + +#endif diff --git a/newlib/libc/sys/linux/include/libc_private.h b/newlib/libc/sys/linux/include/libc_private.h new file mode 100644 index 000000000..af7df8c8b --- /dev/null +++ b/newlib/libc/sys/linux/include/libc_private.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1998 John Birrell . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by John Birrell. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/include/libc_private.h,v 1.5 2002/03/29 22:43:42 markm Exp $ + * + * Private definitions for libc, libc_r and libpthread. + * + */ + +#ifndef _LIBC_PRIVATE_H_ +#define _LIBC_PRIVATE_H_ + +/* + * This global flag is non-zero when a process has created one + * or more threads. It is used to avoid calling locking functions + * when they are not required. + */ +extern int __isthreaded; + +/* + * File lock contention is difficult to diagnose without knowing + * where locks were set. Allow a debug library to be built which + * records the source file and line number of each lock call. + */ +#ifdef _FLOCK_DEBUG +#define _FLOCKFILE(x) _flockfile_debug(x, __FILE__, __LINE__) +#else +#define _FLOCKFILE(x) _flockfile(x) +#endif + +/* + * Macros for locking and unlocking FILEs. These test if the + * process is threaded to avoid locking when not required. + */ +#define FLOCKFILE(fp) if (__isthreaded) _FLOCKFILE(fp) +#define FUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp) + +/* + * This is a pointer in the C run-time startup code. It is used + * by getprogname() and setprogname(). + */ +extern const char *__progname; + +#endif /* _LIBC_PRIVATE_H_ */ diff --git a/newlib/libc/sys/linux/include/link.h b/newlib/libc/sys/linux/include/link.h new file mode 100644 index 000000000..424fb2952 --- /dev/null +++ b/newlib/libc/sys/linux/include/link.h @@ -0,0 +1,269 @@ +/* Data structure for communication from the run-time dynamic linker for + loaded ELF shared objects. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LINK_H +#define _LINK_H 1 + +#include +#include +#include +#include + +#define DT_THISPROCNUM 0 +/* We use this macro to refer to ELF types independent of the native wordsize. + `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ +#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type) +#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) +#define _ElfW_1(e,w,t) e##w##t + +#include /* Defines __ELF_NATIVE_CLASS. */ +#include +#include + +/* Rendezvous structure used by the run-time dynamic linker to communicate + details of shared object loading to the debugger. If the executable's + dynamic section has a DT_DEBUG element, the run-time linker sets that + element's value to the address where this structure can be found. */ + +struct r_debug + { + int r_version; /* Version number for this protocol. */ + + struct link_map *r_map; /* Head of the chain of loaded objects. */ + + /* This is the address of a function internal to the run-time linker, + that will always be called when the linker begins to map in a + library or unmap it, and again when the mapping change is complete. + The debugger can set a breakpoint at this address if it wants to + notice shared object mapping changes. */ + ElfW(Addr) r_brk; + enum + { + /* This state value describes the mapping change taking place when + the `r_brk' address is called. */ + RT_CONSISTENT, /* Mapping change is complete. */ + RT_ADD, /* Beginning to add a new object. */ + RT_DELETE /* Beginning to remove an object mapping. */ + } r_state; + + ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */ + }; + +/* This is the instance of that structure used by the dynamic linker. */ +extern struct r_debug _r_debug; + +/* This symbol refers to the "dynamic structure" in the `.dynamic' section + of whatever module refers to `_DYNAMIC'. So, to find its own + `struct r_debug', a program could do: + for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) + if (dyn->d_tag == DT_DEBUG) + r_debug = (struct r_debug *) dyn->d_un.d_ptr; + */ +extern ElfW(Dyn) _DYNAMIC[]; + + +/* Some internal data structures of the dynamic linker used in the + linker map. We only provide forward declarations. */ +struct libname_list; +struct r_found_version; +struct r_search_path_elem; + +/* Forward declaration. */ +struct link_map; + +/* Structure to describe a single list of scope elements. The lookup + functions get passed an array of pointers to such structures. */ +struct r_scope_elem +{ + /* Array of maps for the scope. */ + struct link_map **r_list; + /* Number of entries in the scope. */ + unsigned int r_nlist; +}; + + +/* Structure to record search path and allocation mechanism. */ +struct r_search_path_struct + { + struct r_search_path_elem **dirs; + int malloced; + }; + + +/* Structure describing a loaded shared object. The `l_next' and `l_prev' + members form a chain of all the shared objects loaded at startup. + + These data structures exist in space used by the run-time dynamic linker; + modifying them may have disastrous results. + + This data structure might change in future, if necessary. User-level + programs must avoid defining objects of this type. */ + +struct link_map + { + /* These first few members are part of the protocol with the debugger. + This is the same format used in SVR4. */ + + ElfW(Addr) l_addr; /* Base address shared object is loaded at. */ + char *l_name; /* Absolute file name object was found in. */ + ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ + struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ + + /* All following members are internal to the dynamic linker. + They may change without notice. */ + + struct libname_list *l_libname; + /* Indexed pointers to dynamic section. + [0,DT_NUM) are indexed by the processor-independent tags. + [DT_NUM,DT_NUM+DT_THISPROCNUM) are indexed by the tag minus DT_LOPROC. + [DT_NUM+DT_THISPROCNUM,DT_NUM+DT_THISPROCNUM+DT_EXTRANUM) are indexed + by DT_EXTRATAGIDX(tagvalue) and + [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM, + DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM) + are indexed by DT_EXTRATAGIDX(tagvalue) (see ). */ + + ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + + DT_EXTRANUM]; + const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */ + ElfW(Addr) l_entry; /* Entry point location. */ + ElfW(Half) l_phnum; /* Number of program header entries. */ + ElfW(Half) l_ldnum; /* Number of dynamic segment entries. */ + + /* Array of DT_NEEDED dependencies and their dependencies, in + dependency order for symbol lookup (with and without + duplicates). There is no entry before the dependencies have + been loaded. */ + struct r_scope_elem l_searchlist; + + /* We need a special searchlist to process objects marked with + DT_SYMBOLIC. */ + struct r_scope_elem l_symbolic_searchlist; + + /* Dependent object that first caused this object to be loaded. */ + struct link_map *l_loader; + + /* Symbol hash table. */ + Elf_Symndx l_nbuckets; + const Elf_Symndx *l_buckets, *l_chain; + + unsigned int l_opencount; /* Reference count for dlopen/dlclose. */ + enum /* Where this object came from. */ + { + lt_executable, /* The main executable program. */ + lt_library, /* Library needed by main executable. */ + lt_loaded /* Extra run-time loaded shared object. */ + } l_type:2; + unsigned int l_relocated:1; /* Nonzero if object's relocations done. */ + unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */ + unsigned int l_global:1; /* Nonzero if object in _dl_global_scope. */ + unsigned int l_reserved:2; /* Reserved for internal use. */ + unsigned int l_phdr_allocated:1; /* Nonzero if the data structure pointed + to by `l_phdr' is allocated. */ + unsigned int l_soname_added:1; /* Nonzero if the SONAME is for sure in + the l_libname list. */ + unsigned int l_faked:1; /* Nonzero if this is a faked descriptor + without associated file. */ + + /* Array with version names. */ + unsigned int l_nversions; + struct r_found_version *l_versions; + + /* Collected information about own RPATH directories. */ + struct r_search_path_struct l_rpath_dirs; + + /* Collected results of relocation while profiling. */ + ElfW(Addr) *l_reloc_result; + + /* Pointer to the version information if available. */ + ElfW(Versym) *l_versyms; + + /* String specifying the path where this object was found. */ + const char *l_origin; + + /* Start and finish of memory map for this object. l_map_start + need not be the same as l_addr. */ + ElfW(Addr) l_map_start, l_map_end; + + /* Default array for 'l_scope'. */ + struct r_scope_elem *l_scope_mem[4]; + /* Size of array allocated for 'l_scope'. */ + size_t l_scope_max; + /* This is an array defining the lookup scope for this link map. + There are at most three different scope lists. */ + struct r_scope_elem **l_scope; + + /* A similar array, this time only with the local scope. This is + used occasionally. */ + struct r_scope_elem *l_local_scope[2]; + + /* This information is kept to check for sure whether a shared + object is the same as one already loaded. */ + dev_t l_dev; + ino64_t l_ino; + + /* Collected information about own RUNPATH directories. */ + struct r_search_path_struct l_runpath_dirs; + + /* List of object in order of the init and fini calls. */ + struct link_map **l_initfini; + + /* List of the dependencies introduced through symbol binding. */ + unsigned int l_reldepsmax; + unsigned int l_reldepsact; + struct link_map **l_reldeps; + + /* Various flag words. */ + ElfW(Word) l_feature_1; + ElfW(Word) l_flags_1; + + /* Temporarily used in `dl_close'. */ + unsigned int l_idx; + + struct link_map_machine l_mach; + + struct + { + const ElfW(Sym) *sym; + int type_class; +#ifdef DL_LOOKUP_RETURNS_MAP + struct link_map *value; +#else + ElfW(Addr) value; +#endif + const ElfW(Sym) *ret; + } l_lookup_cache; + }; + +struct dl_phdr_info + { + ElfW(Addr) dlpi_addr; + const char *dlpi_name; + const ElfW(Phdr) *dlpi_phdr; + ElfW(Half) dlpi_phnum; + }; + +extern int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size, void *data), + void *data); +extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size, void *data), + void *data); + +#endif /* link.h */ diff --git a/newlib/libc/sys/linux/include/namespace.h b/newlib/libc/sys/linux/include/namespace.h new file mode 100644 index 000000000..159b8e33c --- /dev/null +++ b/newlib/libc/sys/linux/include/namespace.h @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2001 Daniel Eischen . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/include/namespace.h,v 1.9 2002/03/29 22:43:42 markm Exp $ + */ + +#ifndef _NAMESPACE_H_ +#define _NAMESPACE_H_ + +/* + * Adjust names so that headers declare "hidden" names. + */ + +/* + * ISO C (C90) section. Most names in libc aren't in ISO C, so they + * should be here. Most aren't here... + */ +#define err _err +#define warn _warn + +/* + * Prototypes for syscalls/functions that need to be overridden + * in libc_r/libpthread. + */ +#define accept _accept +#define __acl_aclcheck_fd ___acl_aclcheck_fd +#define __acl_delete_fd ___acl_delete_fd +#define __acl_get_fd ___acl_get_fd +#define __acl_set_fd ___acl_set_fd +#define bind _bind +#define __cap_get_fd ___cap_get_fd +#define __cap_set_fd ___cap_set_fd +#define close _close +#define connect _connect +#define dup _dup +#define dup2 _dup2 +#define execve _execve +#define fcntl _fcntl +/*#define flock _flock */ +#define fstat _fstat +#define fstatfs _fstatfs +#define fsync _fsync +#define getdirentries _getdirentries +#define getlogin _getlogin +#define getpeername _getpeername +#define getprogname _getprogname +#define getsockname _getsockname +#define getsockopt _getsockopt +#define ioctl _ioctl +/* #define kevent _kevent */ +#define listen _listen +#define nanosleep _nanosleep +#define open _open +#define poll _poll +#define pthread_cond_signal _pthread_cond_signal +#define pthread_cond_wait _pthread_cond_wait +#define pthread_cond_init _pthread_cond_init +#define pthread_exit _pthread_exit +#define pthread_getspecific _pthread_getspecific +#define pthread_key_create _pthread_key_create +#define pthread_key_delete _pthread_key_delete +#define pthread_main_np _pthread_main_np +#define pthread_mutex_destroy _pthread_mutex_destroy +#define pthread_mutex_init _pthread_mutex_init +#define pthread_mutex_lock _pthread_mutex_lock +#define pthread_mutex_trylock _pthread_mutex_trylock +#define pthread_mutex_unlock _pthread_mutex_unlock +#define pthread_mutexattr_init _pthread_mutexattr_init +#define pthread_mutexattr_destroy _pthread_mutexattr_destroy +#define pthread_mutexattr_settype _pthread_mutexattr_settype +#define pthread_once _pthread_once +#define pthread_rwlock_init _pthread_rwlock_init +#define pthread_rwlock_rdlock _pthread_rwlock_rdlock +#define pthread_rwlock_wrlock _pthread_rwlock_wrlock +#define pthread_rwlock_unlock _pthread_rwlock_unlock +#define pthread_self _pthread_self +#define pthread_setspecific _pthread_setspecific +#define pthread_sigmask _pthread_sigmask +#define read _read +#define readv _readv +#define recvfrom _recvfrom +#define recvmsg _recvmsg +#define select _select +#define sendmsg _sendmsg +#define sendto _sendto +#define setsockopt _setsockopt +/*#define sigaction _sigaction*/ +#define sigprocmask _sigprocmask +#define sigsuspend _sigsuspend +#define socket _socket +#define socketpair _socketpair +#define wait4 _wait4 +#define write _write +#define writev _writev + + +/* + * Other hidden syscalls/functions that libc_r needs to override + * but are not used internally by libc. + * + * XXX - When modifying libc to use one of the following, remove + * the prototype from below and place it in the list above. + */ +#if 0 +#define creat _creat +#define fchflags _fchflags +#define fchmod _fchmod +#define fpathconf _fpathconf +#define msync _msync +#define nfssvc _nfssvc +#define pause _pause +#define pthread_rwlock_destroy _pthread_rwlock_destroy +#define pthread_rwlock_tryrdlock _pthread_rwlock_tryrdlock +#define pthread_rwlock_trywrlock _pthread_rwlock_trywrlock +#define pthread_rwlockattr_init _pthread_rwlockattr_init +#define pthread_rwlockattr_destroy _pthread_rwlockattr_destroy +#define sched_yield _sched_yield +#define sendfile _sendfile +#define shutdown _shutdown +#define sigaltstack _sigaltstack +#define sigpending _sigpending +#define sigreturn _sigreturn +#define sigsetmask _sigsetmask +#define sleep _sleep +#define system _system +#define tcdrain _tcdrain +#define wait _wait +#define waitpid _waitpid +#endif + +#endif /* _NAMESPACE_H_ */ diff --git a/newlib/libc/sys/linux/include/net/bpf.h b/newlib/libc/sys/linux/include/net/bpf.h new file mode 100644 index 000000000..1f4a8be2b --- /dev/null +++ b/newlib/libc/sys/linux/include/net/bpf.h @@ -0,0 +1,326 @@ +/* + * Copyright (c) 1990, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpf.h 8.1 (Berkeley) 6/10/93 + * @(#)bpf.h 1.34 (LBL) 6/16/96 + * + * $FreeBSD: src/sys/net/bpf.h,v 1.25 2002/03/19 21:54:16 alfred Exp $ + */ + +#ifndef _NET_BPF_H_ +#define _NET_BPF_H_ + +/* BSD style release date */ +#define BPF_RELEASE 199606 + +typedef int32_t bpf_int32; +typedef u_int32_t bpf_u_int32; + +/* + * Alignment macros. BPF_WORDALIGN rounds up to the next + * even multiple of BPF_ALIGNMENT. + */ +#define BPF_ALIGNMENT sizeof(long) +#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) + +#define BPF_MAXINSNS 512 +#define BPF_MAXBUFSIZE 0x80000 +#define BPF_MINBUFSIZE 32 + +/* + * Structure for BIOCSETF. + */ +struct bpf_program { + u_int bf_len; + struct bpf_insn *bf_insns; +}; + +/* + * Struct returned by BIOCGSTATS. + */ +struct bpf_stat { + u_int bs_recv; /* number of packets received */ + u_int bs_drop; /* number of packets dropped */ +}; + +/* + * Struct return by BIOCVERSION. This represents the version number of + * the filter language described by the instruction encodings below. + * bpf understands a program iff kernel_major == filter_major && + * kernel_minor >= filter_minor, that is, if the value returned by the + * running kernel has the same major number and a minor number equal + * equal to or less than the filter being downloaded. Otherwise, the + * results are undefined, meaning an error may be returned or packets + * may be accepted haphazardly. + * It has nothing to do with the source code version. + */ +struct bpf_version { + u_short bv_major; + u_short bv_minor; +}; +/* Current version number of filter architecture. */ +#define BPF_MAJOR_VERSION 1 +#define BPF_MINOR_VERSION 1 + +#define BIOCGBLEN _IOR('B',102, u_int) +#define BIOCSBLEN _IOWR('B',102, u_int) +#define BIOCSETF _IOW('B',103, struct bpf_program) +#define BIOCFLUSH _IO('B',104) +#define BIOCPROMISC _IO('B',105) +#define BIOCGDLT _IOR('B',106, u_int) +#define BIOCGETIF _IOR('B',107, struct ifreq) +#define BIOCSETIF _IOW('B',108, struct ifreq) +#define BIOCSRTIMEOUT _IOW('B',109, struct timeval) +#define BIOCGRTIMEOUT _IOR('B',110, struct timeval) +#define BIOCGSTATS _IOR('B',111, struct bpf_stat) +#define BIOCIMMEDIATE _IOW('B',112, u_int) +#define BIOCVERSION _IOR('B',113, struct bpf_version) +#define BIOCGRSIG _IOR('B',114, u_int) +#define BIOCSRSIG _IOW('B',115, u_int) +#define BIOCGHDRCMPLT _IOR('B',116, u_int) +#define BIOCSHDRCMPLT _IOW('B',117, u_int) +#define BIOCGSEESENT _IOR('B',118, u_int) +#define BIOCSSEESENT _IOW('B',119, u_int) + +/* + * Structure prepended to each packet. + */ +struct bpf_hdr { + struct timeval bh_tstamp; /* time stamp */ + bpf_u_int32 bh_caplen; /* length of captured portion */ + bpf_u_int32 bh_datalen; /* original length of packet */ + u_short bh_hdrlen; /* length of bpf header (this struct + plus alignment padding) */ +}; +/* + * Because the structure above is not a multiple of 4 bytes, some compilers + * will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work. + * Only the kernel needs to know about it; applications use bh_hdrlen. + */ +#ifdef _KERNEL +#define SIZEOF_BPF_HDR (sizeof(struct bpf_hdr) <= 20 ? 18 : \ + sizeof(struct bpf_hdr)) +#endif + +/* + * Data-link level type codes. + */ +#define DLT_NULL 0 /* no link-layer encapsulation */ +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#define DLT_CHAOS 5 /* Chaos */ +#define DLT_IEEE802 6 /* IEEE 802 Networks */ +#define DLT_ARCNET 7 /* ARCNET */ +#define DLT_SLIP 8 /* Serial Line IP */ +#define DLT_PPP 9 /* Point-to-point Protocol */ +#define DLT_FDDI 10 /* FDDI */ +#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ +#define DLT_RAW 12 /* raw IP */ + +/* + * These are values from BSD/OS's "bpf.h". + * These are not the same as the values from the traditional libpcap + * "bpf.h"; however, these values shouldn't be generated by any + * OS other than BSD/OS, so the correct values to use here are the + * BSD/OS values. + * + * Platforms that have already assigned these values to other + * DLT_ codes, however, should give these codes the values + * from that platform, so that programs that use these codes will + * continue to compile - even though they won't correctly read + * files of these types. + */ +#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ + +#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ + +/* + * This value is defined by NetBSD; other platforms should refrain from + * using it for other purposes, so that NetBSD savefiles with a link + * type of 50 can be read as this type on all platforms. + */ +#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ + +/* + * This value was defined by libpcap 0.5; platforms that have defined + * it with a different value should define it here with that value - + * a link type of 104 in a save file will be mapped to DLT_C_HDLC, + * whatever value that happens to be, so programs will correctly + * handle files with that link type regardless of the value of + * DLT_C_HDLC. + * + * The name DLT_C_HDLC was used by BSD/OS; we use that name for source + * compatibility with programs written for BSD/OS. + * + * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, + * for source compatibility with programs written for libpcap 0.5. + */ +#define DLT_C_HDLC 104 /* Cisco HDLC */ +#define DLT_CHDLC DLT_C_HDLC + +/* + * Reserved for future use. + * Do not pick other numerical value for these unless you have also + * picked up the tcpdump.org top-of-CVS-tree version of "savefile.c", + * which will arrange that capture files for these DLT_ types have + * the same "network" value on all platforms, regardless of what + * value is chosen for their DLT_ type (thus allowing captures made + * on one platform to be read on other platforms, even if the two + * platforms don't use the same numerical values for all DLT_ types). + */ +#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ + +/* + * Values between 106 and 107 are used in capture file headers as + * link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ new types. + */ + +/* + * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except + * that the AF_ type in the link-layer header is in network byte order. + * + * OpenBSD defines it as 12, but that collides with DLT_RAW, so we + * define it as 108 here. If OpenBSD picks up this file, it should + * define DLT_LOOP as 12 in its version, as per the comment above - + * and should not use 108 for any purpose. + */ +#define DLT_LOOP 108 + +/* + * Values between 109 and 112 are used in capture file headers as + * link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ new types. + */ + +/* + * This is for Linux cooked sockets. + */ +#define DLT_LINUX_SLL 113 + +/* + * The instruction encodings. + */ +/* instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +#define BPF_TXA 0x80 + +/* + * The instruction data structure. + */ +struct bpf_insn { + u_short code; + u_char jt; + u_char jf; + bpf_u_int32 k; +}; + +/* + * Macros for insn array initializers. + */ +#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } +#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } + +#ifdef _KERNEL +int bpf_validate(const struct bpf_insn *, int); +void bpf_tap(struct ifnet *, u_char *, u_int); +void bpf_mtap(struct ifnet *, struct mbuf *); +void bpfattach(struct ifnet *, u_int, u_int); +void bpfdetach(struct ifnet *); + +void bpfilterattach(int); +u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); +#endif + +/* + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). + */ +#define BPF_MEMWORDS 16 + +#endif diff --git a/newlib/libc/sys/linux/include/net/bpf_compat.h b/newlib/libc/sys/linux/include/net/bpf_compat.h new file mode 100644 index 000000000..31cd06904 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/bpf_compat.h @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpf_compat.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/bpf_compat.h,v 1.8 2000/12/27 22:20:13 bmilekic Exp $ + */ + +#ifndef _NET_BPF_COMPAT_H_ +#define _NET_BPF_COMPAT_H_ + +/* + * Some hacks for compatibility across SunOS and 4.4BSD. We emulate malloc + * and free with mbuf clusters. We store a pointer to the mbuf in the first + * word of the mbuf and return 8 bytes passed the start of data (for double + * word alignment). We cannot just use offsets because clusters are not at + * a fixed offset from the associated mbuf. Sorry for this kludge. + */ +#define malloc(size, type, canwait) bpf_alloc(size, canwait) +#define free(cp, type) m_free(*(struct mbuf **)(cp - 8)) +#define M_WAITOK M_TRYWAIT +#define M_NOWAIT M_DONTWAIT + +/* This mapping works for our purposes. */ +#define ERESTART EINTR + +#endif diff --git a/newlib/libc/sys/linux/include/net/bpfdesc.h b/newlib/libc/sys/linux/include/net/bpfdesc.h new file mode 100644 index 000000000..ec0c8fc95 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/bpfdesc.h @@ -0,0 +1,120 @@ +/* + * Copyright (c) 1990, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpfdesc.h 8.1 (Berkeley) 6/10/93 + * + * $FreeBSD: src/sys/net/bpfdesc.h,v 1.19 2001/12/14 22:17:54 jdp Exp $ + */ + +#ifndef _NET_BPFDESC_H_ +#define _NET_BPFDESC_H_ + +#include +#include + +/* + * Descriptor associated with each open bpf file. + */ +struct bpf_d { + struct bpf_d *bd_next; /* Linked list of descriptors */ + /* + * Buffer slots: two mbuf clusters buffer the incoming packets. + * The model has three slots. Sbuf is always occupied. + * sbuf (store) - Receive interrupt puts packets here. + * hbuf (hold) - When sbuf is full, put cluster here and + * wakeup read (replace sbuf with fbuf). + * fbuf (free) - When read is done, put cluster here. + * On receiving, if sbuf is full and fbuf is 0, packet is dropped. + */ + caddr_t bd_sbuf; /* store slot */ + caddr_t bd_hbuf; /* hold slot */ + caddr_t bd_fbuf; /* free slot */ + int bd_slen; /* current length of store buffer */ + int bd_hlen; /* current length of hold buffer */ + + int bd_bufsize; /* absolute length of buffers */ + + struct bpf_if * bd_bif; /* interface descriptor */ + u_long bd_rtout; /* Read timeout in 'ticks' */ + struct bpf_insn *bd_filter; /* filter code */ + u_long bd_rcount; /* number of packets received */ + u_long bd_dcount; /* number of packets dropped */ + + u_char bd_promisc; /* true if listening promiscuously */ + u_char bd_state; /* idle, waiting, or timed out */ + u_char bd_immediate; /* true to return on packet arrival */ + int bd_hdrcmplt; /* false to fill in src lladdr automatically */ + int bd_seesent; /* true if bpf should see sent packets */ + int bd_async; /* non-zero if packet reception should generate signal */ + int bd_sig; /* signal to send upon packet reception */ + struct sigio * bd_sigio; /* information for async I/O */ +#if BSD < 199103 + u_char bd_selcoll; /* true if selects collide */ + int bd_timedout; + struct thread * bd_selthread; /* process that last selected us */ +#else + u_char bd_pad; /* explicit alignment */ + struct selinfo bd_sel; /* bsd select info */ +#endif + struct mtx bd_mtx; /* mutex for this descriptor */ + struct callout bd_callout; /* for BPF timeouts with select */ +}; + +/* Values for bd_state */ +#define BPF_IDLE 0 /* no select in progress */ +#define BPF_WAITING 1 /* waiting for read timeout in select */ +#define BPF_TIMED_OUT 2 /* read timeout has expired in select */ + +#define BPFD_LOCK(bd) mtx_lock(&(bd)->bd_mtx) +#define BPFD_UNLOCK(bd) mtx_unlock(&(bd)->bd_mtx) + +/* + * Descriptor associated with each attached hardware interface. + */ +struct bpf_if { + struct bpf_if *bif_next; /* list of all interfaces */ + struct bpf_d *bif_dlist; /* descriptor list */ + u_int bif_dlt; /* link layer type */ + u_int bif_hdrlen; /* length of header (with padding) */ + struct ifnet *bif_ifp; /* corresponding interface */ + struct mtx bif_mtx; /* mutex for interface */ +}; + +#define BPFIF_LOCK(bif) mtx_lock(&(bif)->bif_mtx) +#define BPFIF_UNLOCK(bif) mtx_unlock(&(bif)->bif_mtx) + +#endif diff --git a/newlib/libc/sys/linux/include/net/bridge.h b/newlib/libc/sys/linux/include/net/bridge.h new file mode 100644 index 000000000..a90f2747b --- /dev/null +++ b/newlib/libc/sys/linux/include/net/bridge.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1998-2002 Luigi Rizzo + * + * Work partly supported by: Cisco Systems, Inc. - NSITE lab, RTP, NC + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/net/bridge.h,v 1.11 2002/02/15 05:11:11 luigi Exp $ + */ + +extern int do_bridge; + +/* + * We need additional per-interface info for the bridge, which is + * stored in a struct bdg_softc. The ifp2sc[] array provides a pointer + * to this struct using the if_index as a mapping key. + * bdg_softc has a backpointer to the struct ifnet, the bridge + * flags, and a cluster (bridging occurs only between port of the + * same cluster). + */ + +struct cluster_softc; /* opaque here, defined in bridge.c */ + +struct bdg_softc { + struct ifnet *ifp ; + /* also ((struct arpcom *)ifp)->ac_enaddr is the eth. addr */ + int flags ; +#define IFF_BDG_PROMISC 0x0001 /* set promisc mode on this if. */ +#define IFF_MUTE 0x0002 /* mute this if for bridging. */ +#define IFF_USED 0x0004 /* use this if for bridging. */ + struct cluster_softc *cluster; +} ; + +extern struct bdg_softc *ifp2sc; + +#define BDG_USED(ifp) (ifp2sc[ifp->if_index].flags & IFF_USED) +/* + * BDG_ACTIVE(ifp) does all checks to see if bridging is enabled, loaded, + * and used on a given interface. + */ +#define BDG_ACTIVE(ifp) (do_bridge && BDG_LOADED && BDG_USED(ifp)) + +/* + * The following constants are not legal ifnet pointers, and are used + * as return values from the classifier, bridge_dst_lookup(). + * The same values are used as index in the statistics arrays, + * with BDG_FORWARD replacing specifically forwarded packets. + * + * These constants are here because they are used in 'netstat' + * to show bridge statistics. + */ +#define BDG_BCAST ( (struct ifnet *)1 ) +#define BDG_MCAST ( (struct ifnet *)2 ) +#define BDG_LOCAL ( (struct ifnet *)3 ) +#define BDG_DROP ( (struct ifnet *)4 ) +#define BDG_UNKNOWN ( (struct ifnet *)5 ) +#define BDG_IN ( (struct ifnet *)7 ) +#define BDG_OUT ( (struct ifnet *)8 ) +#define BDG_FORWARD ( (struct ifnet *)9 ) + +/* + * Statistics are passed up with the sysctl interface, "netstat -p bdg" + * reads them. PF_BDG defines the 'bridge' protocol family. + */ + +#define PF_BDG 3 /* XXX superhack */ + +#define STAT_MAX (int)BDG_FORWARD +struct bdg_port_stat { + char name[16]; + u_long collisions; + u_long p_in[STAT_MAX+1]; +} ; + +/* XXX this should be made dynamic */ +#define BDG_MAX_PORTS 128 +struct bdg_stats { + struct bdg_port_stat s[BDG_MAX_PORTS]; +} ; + + +#define BDG_STAT(ifp, type) bdg_stats.s[ifp->if_index].p_in[(uintptr_t)type]++ + +#ifdef _KERNEL +typedef struct ifnet *bridge_in_t(struct ifnet *, struct ether_header *); +/* bdg_forward frees the mbuf if necessary, returning null */ +typedef struct mbuf *bdg_forward_t(struct mbuf *, struct ether_header *const, + struct ifnet *); +typedef void bdgtakeifaces_t(void); +extern bridge_in_t *bridge_in_ptr; +extern bdg_forward_t *bdg_forward_ptr; +extern bdgtakeifaces_t *bdgtakeifaces_ptr; + +#define BDG_LOADED (bdgtakeifaces_ptr != NULL) +#endif /* KERNEL */ diff --git a/newlib/libc/sys/linux/include/net/ethernet.h b/newlib/libc/sys/linux/include/net/ethernet.h new file mode 100644 index 000000000..6b1d1c9be --- /dev/null +++ b/newlib/libc/sys/linux/include/net/ethernet.h @@ -0,0 +1,134 @@ +/* + * Fundamental constants relating to ethernet. + * + * $FreeBSD: src/sys/net/ethernet.h,v 1.20 2002/04/04 05:42:09 luigi Exp $ + * + */ + +#ifndef _NET_ETHERNET_H_ +#define _NET_ETHERNET_H_ + +/* + * The number of bytes in an ethernet (MAC) address. + */ +#define ETHER_ADDR_LEN 6 + +/* + * The number of bytes in the type field. + */ +#define ETHER_TYPE_LEN 2 + +/* + * The number of bytes in the trailing CRC field. + */ +#define ETHER_CRC_LEN 4 + +/* + * The length of the combined header. + */ +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) + +/* + * The minimum packet length. + */ +#define ETHER_MIN_LEN 64 + +/* + * The maximum packet length. + */ +#define ETHER_MAX_LEN 1518 + +/* + * A macro to validate a length with + */ +#define ETHER_IS_VALID_LEN(foo) \ + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + u_char ether_dhost[ETHER_ADDR_LEN]; + u_char ether_shost[ETHER_ADDR_LEN]; + u_short ether_type; +}; + +/* + * Structure of a 48-bit Ethernet address. + */ +struct ether_addr { + u_char octet[ETHER_ADDR_LEN]; +}; + +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ +#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ +#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ +#define ETHERTYPE_IPV6 0x86dd /* IPv6 */ +#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ +/* XXX - add more useful types here */ + +/* + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed + * by an ETHER type (as given above) and then the (variable-length) header. + */ +#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) +#define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) + +#ifdef _KERNEL + +/* + * For device drivers to specify whether they support BPF or not + */ +#define ETHER_BPF_UNSUPPORTED 0 +#define ETHER_BPF_SUPPORTED 1 + +struct ifnet; +struct mbuf; + +extern void (*ng_ether_input_p)(struct ifnet *ifp, + struct mbuf **mp, struct ether_header *eh); +extern void (*ng_ether_input_orphan_p)(struct ifnet *ifp, + struct mbuf *m, struct ether_header *eh); +extern int (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp); +extern void (*ng_ether_attach_p)(struct ifnet *ifp); +extern void (*ng_ether_detach_p)(struct ifnet *ifp); + +extern int (*vlan_input_p)(struct ether_header *eh, struct mbuf *m); +extern int (*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m, + u_int16_t t); + +#define VLAN_INPUT_TAG(eh, m, t) do { \ + /* XXX: lock */ \ + if (vlan_input_tag_p != NULL) \ + (*vlan_input_tag_p)(eh, m, t); \ + else { \ + (m)->m_pkthdr.rcvif->if_noproto++; \ + m_freem(m); \ + } \ + /* XXX: unlock */ \ +} while (0) + +#else /* _KERNEL */ + +#include + +/* + * Ethernet address conversion/parsing routines. + */ +__BEGIN_DECLS +struct ether_addr *ether_aton(const char *); +int ether_hostton(const char *, struct ether_addr *); +int ether_line(const char *, struct ether_addr *, char *); +char *ether_ntoa(const struct ether_addr *); +int ether_ntohost(char *, const struct ether_addr *); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif /* !_NET_ETHERNET_H_ */ diff --git a/newlib/libc/sys/linux/include/net/fddi.h b/newlib/libc/sys/linux/include/net/fddi.h new file mode 100644 index 000000000..e9a3b55fa --- /dev/null +++ b/newlib/libc/sys/linux/include/net/fddi.h @@ -0,0 +1,106 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_fddi.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/fddi.h,v 1.12 2002/03/29 11:22:22 mdodd Exp $ + */ + +#ifndef _NETINET_IF_FDDI_H_ +#define _NETINET_IF_FDDI_H_ + +#define FDDIIPMTU 4352 +#define FDDIMTU 4470 +#define FDDIMIN 3 + +#define FDDIFC_C 0x80 /* 0b10000000 */ +#define FDDIFC_L 0x40 /* 0b01000000 */ +#define FDDIFC_F 0x30 /* 0b00110000 */ +#define FDDIFC_Z 0x0F /* 0b00001111 */ +#define FDDIFC_CLFF 0xF0 /* Class/Length/Format bits */ +#define FDDIFC_ZZZZ 0x0F /* Control bits */ + +/* + * FDDI Frame Control values. (48-bit addressing only). + */ +#define FDDIFC_VOID 0x40 /* Void frame */ +#define FDDIFC_NRT 0x80 /* Nonrestricted token */ +#define FDDIFC_RT 0xc0 /* Restricted token */ +#define FDDIFC_MAC_BEACON 0xc2 /* MAC Beacon frame */ +#define FDDIFC_MAC_CLAIM 0xc3 /* MAC Claim frame */ +#define FDDIFC_LLC_ASYNC 0x50 +#define FDDIFC_LLC_PRIO0 0 +#define FDDIFC_LLC_PRIO1 1 +#define FDDIFC_LLC_PRIO2 2 +#define FDDIFC_LLC_PRIO3 3 +#define FDDIFC_LLC_PRIO4 4 +#define FDDIFC_LLC_PRIO5 5 +#define FDDIFC_LLC_PRIO6 6 +#define FDDIFC_LLC_PRIO7 7 +#define FDDIFC_LLC_SYNC 0xd0 +#define FDDIFC_IMP_ASYNC 0x60 /* Implementor Async. */ +#define FDDIFC_IMP_SYNC 0xe0 /* Implementor Synch. */ +#define FDDIFC_SMT 0x40 +#define FDDIFC_SMT_INFO 0x41 /* SMT Info */ +#define FDDIFC_SMT_NSA 0x4F /* SMT Next station adrs */ +#define FDDIFC_MAC 0xc0 /* MAC frame */ + +#define FDDI_ADDR_LEN 6 +#define FDDI_HDR_LEN (sizeof(struct fddi_header)) + +/* + * Structure of an 100Mb/s FDDI header. + */ +struct fddi_header { + u_char fddi_fc; + u_char fddi_dhost[FDDI_ADDR_LEN]; + u_char fddi_shost[FDDI_ADDR_LEN]; +}; + +#if defined(_KERNEL) +#define fddi_ipmulticast_min ether_ipmulticast_min +#define fddi_ipmulticast_max ether_ipmulticast_max +#define fddi_addmulti ether_addmulti +#define fddi_delmulti ether_delmulti +#define fddi_sprintf ether_sprintf + +#define FDDI_BPF_UNSUPPORTED 0 +#define FDDI_BPF_SUPPORTED 1 + +void fddi_ifattach(struct ifnet *, int); +void fddi_ifdetach(struct ifnet *, int); +void fddi_input(struct ifnet *, struct fddi_header *, struct mbuf *); +int fddi_ioctl(struct ifnet *, int, caddr_t); + +#endif /* _KERNEL */ +#endif /* _NET_FDDI_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if.h b/newlib/libc/sys/linux/include/net/if.h new file mode 100644 index 000000000..bf021e6f9 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if.h @@ -0,0 +1,341 @@ +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if.h,v 1.71 2002/03/19 21:54:16 alfred Exp $ + */ + +#ifndef _NET_IF_H_ +#define _NET_IF_H_ + +#include + +/* + * does not depend on on most other systems. This + * helps userland compatibility. (struct timeval ifi_lastchange) + */ +#ifndef _KERNEL +#include +#endif + +struct ifnet; + +/* + * Length of interface external name, including terminating '\0'. + * Note: this is the same size as a generic device's external name. + */ +#define IFNAMSIZ 16 +#define IF_NAMESIZE IFNAMSIZ +#define IF_MAXUNIT 0x7fff /* ifp->if_unit is only 15 bits */ + +/* + * Structure describing a `cloning' interface. + */ +struct if_clone { + LIST_ENTRY(if_clone) ifc_list; /* on list of cloners */ + const char *ifc_name; /* name of device, e.g. `gif' */ + size_t ifc_namelen; /* length of name */ + int ifc_maxunit; /* maximum unit number */ + unsigned char *ifc_units; /* bitmap to handle units */ + int ifc_bmlen; /* bitmap length */ + + int (*ifc_create)(struct if_clone *, int); + int (*ifc_destroy)(struct ifnet *); +}; + +#define IF_CLONE_INITIALIZER(name, create, destroy, maxunit) \ + { { 0 }, name, sizeof(name) - 1, maxunit, NULL, 0, create, destroy } + +/* + * Structure used to query names of interface cloners. + */ + +struct if_clonereq { + int ifcr_total; /* total cloners (out) */ + int ifcr_count; /* room for this many in user buffer */ + char *ifcr_buffer; /* buffer for cloner names */ +}; + +/* + * Structure describing information about an interface + * which may be of interest to management entities. + */ +struct if_data { + /* generic interface information */ + u_char ifi_type; /* ethernet, tokenring, etc */ + u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ + u_char ifi_addrlen; /* media address length */ + u_char ifi_hdrlen; /* media header length */ + u_char ifi_recvquota; /* polling quota for receive intrs */ + u_char ifi_xmitquota; /* polling quota for xmit intrs */ + u_long ifi_mtu; /* maximum transmission unit */ + u_long ifi_metric; /* routing metric (external only) */ + u_long ifi_baudrate; /* linespeed */ + /* volatile statistics */ + u_long ifi_ipackets; /* packets received on interface */ + u_long ifi_ierrors; /* input errors on interface */ + u_long ifi_opackets; /* packets sent on interface */ + u_long ifi_oerrors; /* output errors on interface */ + u_long ifi_collisions; /* collisions on csma interfaces */ + u_long ifi_ibytes; /* total number of octets received */ + u_long ifi_obytes; /* total number of octets sent */ + u_long ifi_imcasts; /* packets received via multicast */ + u_long ifi_omcasts; /* packets sent via multicast */ + u_long ifi_iqdrops; /* dropped on input, this interface */ + u_long ifi_noproto; /* destined for unsupported protocol */ + u_long ifi_hwassist; /* HW offload capabilities */ + u_long ifi_unused; /* XXX was ifi_xmittiming */ + struct timeval ifi_lastchange; /* time of last administrative change */ +}; + +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_SMART 0x20 /* interface manages own routes */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_NOARP 0x80 /* no address resolution protocol */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ +#define IFF_OACTIVE 0x400 /* transmission in progress */ +#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ +#define IFF_LINK0 0x1000 /* per link layer defined bit */ +#define IFF_LINK1 0x2000 /* per link layer defined bit */ +#define IFF_LINK2 0x4000 /* per link layer defined bit */ +#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ +#define IFF_MULTICAST 0x8000 /* supports multicast */ + +/* + * The following flag(s) ought to go in if_flags, but we cannot change + * struct ifnet because of binary compatibility, so we store them in + * if_ipending, which is not used so far. + * If possible, make sure the value is not conflicting with other + * IFF flags, so we have an easier time when we want to merge them. + */ +#define IFF_POLLING 0x10000 /* Interface is in polling mode. */ + +/* flags set internally only: */ +#define IFF_CANTCHANGE \ + (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ + IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART) + +/* Capabilities that interfaces can advertise. */ +#define IFCAP_RXCSUM 0x0001 /* can offload checksum on RX */ +#define IFCAP_TXCSUM 0x0002 /* can offload checksum on TX */ +#define IFCAP_NETCONS 0x0004 /* can be a network console */ + +#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) + +#define IFQ_MAXLEN 50 +#define IFNET_SLOWHZ 1 /* granularity is 1 second */ + +/* + * Message format for use in obtaining information about interfaces + * from getkerninfo and the routing socket + */ +struct if_msghdr { + u_short ifm_msglen; /* to skip over non-understood messages */ + u_char ifm_version; /* future binary compatibility */ + u_char ifm_type; /* message type */ + int ifm_addrs; /* like rtm_addrs */ + int ifm_flags; /* value of if_flags */ + u_short ifm_index; /* index for associated ifp */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* + * Message format for use in obtaining information about interface addresses + * from getkerninfo and the routing socket + */ +struct ifa_msghdr { + u_short ifam_msglen; /* to skip over non-understood messages */ + u_char ifam_version; /* future binary compatibility */ + u_char ifam_type; /* message type */ + int ifam_addrs; /* like rtm_addrs */ + int ifam_flags; /* value of ifa_flags */ + u_short ifam_index; /* index for associated ifp */ + int ifam_metric; /* value of ifa_metric */ +}; + +/* + * Message format for use in obtaining information about multicast addresses + * from the routing socket + */ +struct ifma_msghdr { + u_short ifmam_msglen; /* to skip over non-understood messages */ + u_char ifmam_version; /* future binary compatibility */ + u_char ifmam_type; /* message type */ + int ifmam_addrs; /* like rtm_addrs */ + int ifmam_flags; /* value of ifa_flags */ + u_short ifmam_index; /* index for associated ifp */ +}; + +/* + * Message format announcing the arrival or departure of a network interface. + */ +struct if_announcemsghdr { + u_short ifan_msglen; /* to skip over non-understood messages */ + u_char ifan_version; /* future binary compatibility */ + u_char ifan_type; /* message type */ + u_short ifan_index; /* index for associated ifp */ + char ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + u_short ifan_what; /* what type of announcement */ +}; + +#define IFAN_ARRIVAL 0 /* interface arrival */ +#define IFAN_DEPARTURE 1 /* interface departure */ + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct ifreq { + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + short ifru_flags[2]; + short ifru_index; + int ifru_metric; + int ifru_mtu; + int ifru_phys; + int ifru_media; + caddr_t ifru_data; + int ifru_cap[2]; + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_flags ifr_ifru.ifru_flags[0] /* flags */ +#define ifr_prevflags ifr_ifru.ifru_flags[1] /* flags */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ +#define ifr_media ifr_ifru.ifru_media /* physical media */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ +#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ +#define ifr_index ifr_ifru.ifru_index /* interface index */ +}; + +struct ifaliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr ifra_addr; + struct sockaddr ifra_broadaddr; + struct sockaddr ifra_mask; +}; + +struct ifmediareq { + char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + int ifm_current; /* current media options */ + int ifm_mask; /* don't care mask */ + int ifm_status; /* media status */ + int ifm_active; /* active options */ + int ifm_count; /* # entries in ifm_ulist array */ + int *ifm_ulist; /* media words */ +}; + +/* + * Structure used to retrieve aux status data from interfaces. + * Kernel suppliers to this interface should respect the formatting + * needed by ifconfig(8): each line starts with a TAB and ends with + * a newline. The canonical example to copy and paste is in if_tun.c. + */ + +#define IFSTATMAX 800 /* 10 lines of text */ +struct ifstat { + char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + char ascii[IFSTATMAX + 1]; +}; + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct ifconf { + int ifc_len; /* size of associated buffer */ + union { + caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + + +/* + * Structure for SIOC[AGD]LIFADDR + */ +struct if_laddrreq { + char iflr_name[IFNAMSIZ]; + u_int flags; +#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ + u_int prefixlen; /* in/out */ + struct sockaddr_storage addr; /* in/out */ + struct sockaddr_storage dstaddr; /* out */ +}; + +#ifdef _KERNEL +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_IFADDR); +MALLOC_DECLARE(M_IFMADDR); +#endif +#endif + +#ifndef _KERNEL +struct if_nameindex { + u_int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "le0", ... */ +}; + +__BEGIN_DECLS +u_int if_nametoindex(const char *); +char *if_indextoname(u_int, char *); +struct if_nameindex *if_nameindex(void); +void if_freenameindex(struct if_nameindex *); +__END_DECLS +#endif + +#ifdef _KERNEL +struct thread; + +/* XXX - this should go away soon. */ +#include +#endif + +#endif /* !_NET_IF_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_arc.h b/newlib/libc/sys/linux/include/net/if_arc.h new file mode 100644 index 000000000..03db7f54a --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_arc.h @@ -0,0 +1,148 @@ +/* $NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp $ */ +/* $FreeBSD: src/sys/net/if_arc.h,v 1.3 2002/03/19 21:54:16 alfred Exp $ */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp + * @(#)if_ether.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NET_IF_ARC_H_ +#define _NET_IF_ARC_H_ + +/* + * Arcnet address - 1 octets + * don't know who uses this. + */ +struct arc_addr { + u_int8_t arc_addr_octet[1]; +} __attribute__((__packed__)); + +/* + * Structure of a 2.5MB/s Arcnet header. + * as given to interface code. + */ +struct arc_header { + u_int8_t arc_shost; + u_int8_t arc_dhost; + u_int8_t arc_type; + /* + * only present for newstyle encoding with LL fragmentation. + * Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead. + */ + u_int8_t arc_flag; + u_int16_t arc_seqid; + + /* + * only present in exception packets (arc_flag == 0xff) + */ + u_int8_t arc_type2; /* same as arc_type */ + u_int8_t arc_flag2; /* real flag value */ + u_int16_t arc_seqid2; /* real seqid value */ +} __attribute__((__packed__)); + +#define ARC_ADDR_LEN 1 + +#define ARC_HDRLEN 3 +#define ARC_HDRNEWLEN 6 +#define ARC_HDRNEWLEN_EXC 10 + +/* these lengths are data link layer length - 2*ARC_ADDR_LEN */ +#define ARC_MIN_LEN 1 +#define ARC_MIN_FORBID_LEN 254 +#define ARC_MAX_FORBID_LEN 256 +#define ARC_MAX_LEN 508 + + +/* RFC 1051 */ +#define ARCTYPE_IP_OLD 240 /* IP protocol */ +#define ARCTYPE_ARP_OLD 241 /* address resolution protocol */ + +/* RFC 1201 */ +#define ARCTYPE_IP 212 /* IP protocol */ +#define ARCTYPE_ARP 213 /* address resolution protocol */ +#define ARCTYPE_REVARP 214 /* reverse addr resolution protocol */ + +#define ARCTYPE_ATALK 221 /* Appletalk */ +#define ARCTYPE_BANIAN 247 /* Banyan Vines */ +#define ARCTYPE_IPX 250 /* Novell IPX */ + +#define ARCTYPE_INET6 0xc4 /* IPng */ +#define ARCTYPE_DIAGNOSE 0x80 /* as per ANSI/ATA 878.1 */ + +#define ARCMTU 507 +#define ARCMIN 0 + +#define ARC_PHDS_MAXMTU 60480 + +struct arccom { + struct ifnet ac_if; /* network-visible interface */ + + u_int16_t ac_seqid; /* seq. id used by PHDS encap. */ + + u_int8_t arc_shost; + u_int8_t arc_dhost; + u_int8_t arc_type; + + u_int8_t dummy0; + u_int16_t dummy1; + int sflag, fsflag, rsflag; + struct mbuf *curr_frag; + + struct ac_frag { + u_int8_t af_maxflag; /* from first packet */ + u_int8_t af_lastseen; /* last split flag seen */ + u_int16_t af_seqid; + struct mbuf *af_packet; + } ac_fragtab[256]; /* indexed by sender ll address */ +}; + +#ifdef _KERNEL +extern u_int8_t arcbroadcastaddr; +extern int arc_ipmtu; /* XXX new ip only, no RFC 1051! */ + +void arc_ifattach(struct ifnet *, u_int8_t); +void arc_ifdetach(struct ifnet *); +void arc_storelladdr(struct ifnet *, u_int8_t); +char *arc_sprintf(u_int8_t *); +int arc_isphds(int); +void arc_input(struct ifnet *, struct mbuf *); +int arc_output(struct ifnet *, struct mbuf *, + struct sockaddr *, struct rtentry *); +int arc_ioctl(struct ifnet *, int, caddr_t); + +void arc_frag_init(struct ifnet *); +struct mbuf * arc_frag_next(struct ifnet *); +#endif + +#endif /* _NET_IF_ARC_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_arp.h b/newlib/libc/sys/linux/include/net/if_arp.h new file mode 100644 index 000000000..bdcacbc4d --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_arp.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_arp.h,v 1.16 2001/10/14 20:17:52 fjoe Exp $ + */ + +#ifndef _NET_IF_ARP_H_ +#define _NET_IF_ARP_H_ + +/* + * Address Resolution Protocol. + * + * See RFC 826 for protocol description. ARP packets are variable + * in size; the arphdr structure defines the fixed-length portion. + * Protocol type values are the same as those for 10 Mb/s Ethernet. + * It is followed by the variable-sized fields ar_sha, arp_spa, + * arp_tha and arp_tpa in that order, according to the lengths + * specified. Field names used correspond to RFC 826. + */ +struct arphdr { + u_short ar_hrd; /* format of hardware address */ +#define ARPHRD_ETHER 1 /* ethernet hardware format */ +#define ARPHRD_IEEE802 6 /* token-ring hardware format */ +#define ARPHRD_ARCNET 7 /* arcnet hardware format */ +#define ARPHRD_FRELAY 15 /* frame relay hardware format */ + u_short ar_pro; /* format of protocol address */ + u_char ar_hln; /* length of hardware address */ + u_char ar_pln; /* length of protocol address */ + u_short ar_op; /* one of: */ +#define ARPOP_REQUEST 1 /* request to resolve address */ +#define ARPOP_REPLY 2 /* response to previous request */ +#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ +#define ARPOP_REVREPLY 4 /* response giving protocol address */ +#define ARPOP_INVREQUEST 8 /* request to identify peer */ +#define ARPOP_INVREPLY 9 /* response identifying peer */ +/* + * The remaining fields are variable in size, + * according to the sizes above. + */ +#ifdef COMMENT_ONLY + u_char ar_sha[]; /* sender hardware address */ + u_char ar_spa[]; /* sender protocol address */ + u_char ar_tha[]; /* target hardware address */ + u_char ar_tpa[]; /* target protocol address */ +#endif +}; + +#define ar_sha(ap) (((caddr_t)((ap)+1)) + 0) +#define ar_spa(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln) +#define ar_tha(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln + (ap)->ar_pln) +#define ar_tpa(ap) (((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln) + +#define arphdr_len2(ar_hln, ar_pln) \ + (sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln)) +#define arphdr_len(ap) (arphdr_len2((ap)->ar_hln, (ap)->ar_pln)) + +/* + * ARP ioctl request + */ +struct arpreq { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ +}; +/* arp_flags and at_flags field values */ +#define ATF_INUSE 0x01 /* entry in use */ +#define ATF_COM 0x02 /* completed entry (enaddr valid) */ +#define ATF_PERM 0x04 /* permanent entry */ +#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ +#define ATF_USETRAILERS 0x10 /* has requested trailers */ + +#ifdef _KERNEL +/* + * Structure shared between the ethernet driver modules and + * the address resolution code. For example, each ec_softc or il_softc + * begins with this structure. + */ +struct arpcom { + /* + * The ifnet struct _must_ be at the head of this structure. + */ + struct ifnet ac_if; /* network-visible interface */ + u_char ac_enaddr[6]; /* ethernet hardware address */ + int ac_multicnt; /* length of ac_multiaddrs list */ + void *ac_netgraph; /* ng_ether(4) netgraph node info */ +}; + +extern u_char etherbroadcastaddr[6]; +#endif + +#endif /* !_NET_IF_ARP_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_atm.h b/newlib/libc/sys/linux/include/net/if_atm.h new file mode 100644 index 000000000..c9ff107c0 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_atm.h @@ -0,0 +1,107 @@ +/* $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $ */ +/* $FreeBSD: src/sys/net/if_atm.h,v 1.5 2002/03/19 21:54:16 alfred Exp $ */ + +/* + * + * Copyright (c) 1996 Charles D. Cranor and Washington University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Charles D. Cranor and + * Washington University. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * net/if_atm.h + */ + +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) +#define RTALLOC1(A,B) rtalloc1((A),(B)) +#elif defined(__FreeBSD__) +#define RTALLOC1(A,B) rtalloc1((A),(B),0UL) +#endif + +/* + * pseudo header for packet transmission + */ +struct atm_pseudohdr { + u_int8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */ +}; + +#define ATM_PH_FLAGS(X) ((X)->atm_ph[0]) +#define ATM_PH_VPI(X) ((X)->atm_ph[1]) +#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3])) +#define ATM_PH_SETVCI(X,V) { \ + (X)->atm_ph[2] = ((V) >> 8) & 0xff; \ + (X)->atm_ph[3] = ((V) & 0xff); \ +} + +#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */ +#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */ + +#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */ +#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */ + +#define ATMMTU 9180 /* ATM MTU size for IP */ + /* XXX: could be 9188 with LLC/SNAP according + to comer */ + +/* user's ioctl hook for raw atm mode */ +#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */ + +/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */ +struct atm_pseudoioctl { + struct atm_pseudohdr aph; + void *rxhand; +}; +#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */ +#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */ + + +/* + * XXX forget all the garbage in if_llc.h and do it the easy way + */ + +#define ATMLLC_HDR "\252\252\3\0\0\0" +struct atmllc { + u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */ + u_int8_t type[2]; /* "ethernet" type */ +}; + +/* ATM_LLC macros: note type code in host byte order */ +#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1])) +#define ATM_LLC_SETTYPE(X,V) { \ + (X)->type[1] = ((V) >> 8) & 0xff; \ + (X)->type[0] = ((V) & 0xff); \ +} + +#ifdef _KERNEL +void atm_ifattach(struct ifnet *); +void atm_input(struct ifnet *, struct atm_pseudohdr *, + struct mbuf *, void *); +int atm_output(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); +#endif + diff --git a/newlib/libc/sys/linux/include/net/if_dl.h b/newlib/libc/sys/linux/include/net/if_dl.h new file mode 100644 index 000000000..2c1467196 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_dl.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_dl.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_dl.h,v 1.12 2002/05/07 22:14:06 kbyanc Exp $ + */ + +#ifndef _NET_IF_DL_H_ +#define _NET_IF_DL_H_ + +/* + * A Link-Level Sockaddr may specify the interface in one of two + * ways: either by means of a system-provided index number (computed + * anew and possibly differently on every reboot), or by a human-readable + * string such as "il0" (for managerial convenience). + * + * Census taking actions, such as something akin to SIOCGCONF would return + * both the index and the human name. + * + * High volume transactions (such as giving a link-level ``from'' address + * in a recvfrom or recvmsg call) may be likely only to provide the indexed + * form, (which requires fewer copy operations and less space). + * + * The form and interpretation of the link-level address is purely a matter + * of convention between the device driver and its consumers; however, it is + * expected that all drivers for an interface of a given if_type will agree. + */ + +/* + * Structure of a Link-Level sockaddr: + */ +struct sockaddr_dl { + u_char sdl_len; /* Total length of sockaddr */ + u_char sdl_family; /* AF_LINK */ + u_short sdl_index; /* if != 0, system given index for interface */ + u_char sdl_type; /* interface type */ + u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */ + u_char sdl_alen; /* link level address length */ + u_char sdl_slen; /* link layer selector length */ + char sdl_data[46]; /* minimum work area, can be larger; + contains both if name and ll address */ +}; + +#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) + +#ifndef _KERNEL + +#include + +__BEGIN_DECLS +void link_addr(const char *, struct sockaddr_dl *); +char *link_ntoa(const struct sockaddr_dl *); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif diff --git a/newlib/libc/sys/linux/include/net/if_gif.h b/newlib/libc/sys/linux/include/net/if_gif.h new file mode 100644 index 000000000..4cffb0872 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_gif.h @@ -0,0 +1,92 @@ +/* $FreeBSD: src/sys/net/if_gif.h,v 1.11 2002/03/24 09:34:04 bde Exp $ */ +/* $KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * if_gif.h + */ + +#ifndef _NET_IF_GIF_H_ +#define _NET_IF_GIF_H_ + + +#ifdef _KERNEL +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +/* xxx sigh, why route have struct route instead of pointer? */ + +struct encaptab; + +extern void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, + int af); +extern void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, + int af); +extern int (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp); +extern void (*ng_gif_attach_p)(struct ifnet *ifp); +extern void (*ng_gif_detach_p)(struct ifnet *ifp); + +struct gif_softc { + struct ifnet gif_if; /* common area - must be at the top */ + struct sockaddr *gif_psrc; /* Physical src addr */ + struct sockaddr *gif_pdst; /* Physical dst addr */ + union { + struct route gifscr_ro; /* xxx */ +#ifdef INET6 + struct route_in6 gifscr_ro6; /* xxx */ +#endif + } gifsc_gifscr; + int gif_flags; + const struct encaptab *encap_cookie4; + const struct encaptab *encap_cookie6; + void *gif_netgraph; /* ng_gif(4) netgraph node info */ + LIST_ENTRY(gif_softc) gif_link; /* all gif's are linked */ +}; + +#define gif_ro gifsc_gifscr.gifscr_ro +#ifdef INET6 +#define gif_ro6 gifsc_gifscr.gifscr_ro6 +#endif + +#define GIF_MTU (1280) /* Default MTU */ +#define GIF_MTU_MIN (1280) /* Minimum MTU */ +#define GIF_MTU_MAX (8192) /* Maximum MTU */ + +/* Prototypes */ +void gif_input(struct mbuf *, int, struct ifnet *); +int gif_output(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); +int gif_ioctl(struct ifnet *, u_long, caddr_t); + +#endif /* _KERNEL */ + +#endif /* _NET_IF_GIF_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_ieee80211.h b/newlib/libc/sys/linux/include/net/if_ieee80211.h new file mode 100644 index 000000000..0757f9d43 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_ieee80211.h @@ -0,0 +1,273 @@ +/* $NetBSD: if_ieee80211.h,v 1.5 2000/07/21 04:47:40 onoe Exp $ */ +/* $FreeBSD: src/sys/net/if_ieee80211.h,v 1.6 2002/04/11 05:43:10 imp Exp $ */ + +#ifndef _NET_IF_IEEE80211_H_ +#define _NET_IF_IEEE80211_H_ + +/* + * generic definitions for IEEE 802.11 frames + */ +struct ieee80211_frame { + u_int8_t i_fc[2]; + u_int8_t i_dur[2]; + u_int8_t i_addr1[ETHER_ADDR_LEN]; + u_int8_t i_addr2[ETHER_ADDR_LEN]; + u_int8_t i_addr3[ETHER_ADDR_LEN]; + u_int8_t i_seq[2]; + /* possibly followed by addr4[ETHER_ADDR_LEN]; */ +}; + +#define IEEE80211_FC0_VERSION_MASK 0x03 +#define IEEE80211_FC0_VERSION_0 0x00 +#define IEEE80211_FC0_TYPE_MASK 0x0c +#define IEEE80211_FC0_TYPE_MGT 0x00 +#define IEEE80211_FC0_TYPE_CTL 0x04 +#define IEEE80211_FC0_TYPE_DATA 0x08 + +#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 +/* for TYPE_MGT */ +#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 +#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 +#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 +#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 +#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 +#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 +#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 +#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 +#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 +#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 +#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 +/* for TYPE_CTL */ +#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 +#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 +#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 +#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 +#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 +#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 +/* for TYPE_DATA (bit combination) */ +#define IEEE80211_FC0_SUBTYPE_DATA 0x00 +#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 +#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 +#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 +#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 +#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 +#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 +#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 + +#define IEEE80211_FC1_DIR_MASK 0x03 +#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ +#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ +#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ +#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ + +#define IEEE80211_FC1_MORE_FRAG 0x04 +#define IEEE80211_FC1_RETRY 0x08 +#define IEEE80211_FC1_PWR_MGT 0x10 +#define IEEE80211_FC1_MORE_DATA 0x20 +#define IEEE80211_FC1_WEP 0x40 +#define IEEE80211_FC1_ORDER 0x80 + +#define IEEE80211_NWID_LEN 32 + +/* + * BEACON management packets + * + * octect timestamp[8] + * octect beacon interval[2] + * octect capability information[2] + * information element + * octect elemid + * octect length + * octect information[length[ + */ +typedef u_int8_t * ieee80211_mgt_beacon_t; + +#define IEEE80211_BEACON_INTERVAL(beacon) \ + (beacon[8] + (beacon[9] << 8)) +#define IEEE80211_BEACON_CAPABILITY(beacon) \ + (beacon[10] + (beacon[11] << 8)) + +#define IEEE80211_CAPINFO_ESS 0x01 +#define IEEE80211_CAPINFO_IBSS 0x02 +#define IEEE80211_CAPINFO_CF_POLLABLE 0x04 +#define IEEE80211_CAPINFO_CF_POLLREQ 0x08 +#define IEEE80211_CAPINFO_PRIVACY 0x10 + + +/* + * Management information elements + */ +struct ieee80211_information { + char ssid[IEEE80211_NWID_LEN+1]; + struct rates { + u_int8_t *p; + } rates; + struct fh { + u_int16_t dwell; + u_int8_t set; + u_int8_t pattern; + u_int8_t index; + } fh; + struct ds { + u_int8_t channel; + } ds; + struct cf { + u_int8_t count; + u_int8_t period; + u_int8_t maxdur[2]; + u_int8_t dur[2]; + } cf; + struct tim { + u_int8_t count; + u_int8_t period; + u_int8_t bitctl; + /* u_int8_t pvt[251]; The driver never needs to use this */ + } tim; + struct ibss { + u_int16_t atim; + } ibss; + struct challenge { + u_int8_t *p; + u_int8_t len; + } challenge; +}; + +#define IEEE80211_ELEMID_SSID 0 +#define IEEE80211_ELEMID_RATES 1 +#define IEEE80211_ELEMID_FHPARMS 2 +#define IEEE80211_ELEMID_DSPARMS 3 +#define IEEE80211_ELEMID_CFPARMS 4 +#define IEEE80211_ELEMID_TIM 5 +#define IEEE80211_ELEMID_IBSSPARMS 6 +#define IEEE80211_ELEMID_CHALLENGE 16 + +/* + * AUTH management packets + * + * octect algo[2] + * octect seq[2] + * octect status[2] + * octect chal.id + * octect chal.length + * octect chal.text[253] + */ +typedef u_int8_t * ieee80211_mgt_auth_t; + +#define IEEE80211_AUTH_ALGORITHM(auth) \ + (auth[0] + (auth[1] << 8)) +#define IEEE80211_AUTH_TRANSACTION(auth) \ + (auth[2] + (auth[3] << 8)) +#define IEEE80211_AUTH_STATUS(auth) \ + (auth[4] + (auth[5] << 8)) + +#define IEEE80211_AUTH_ALG_OPEN 0x0000 +#define IEEE80211_AUTH_ALG_SHARED 0x0001 + +#define IEEE80211_AUTH_OPEN_REQUEST 1 +#define IEEE80211_AUTH_OPEN_RESPONSE 2 + +#define IEEE80211_AUTH_SHARED_REQUEST 1 +#define IEEE80211_AUTH_SHARED_CHALLENGE 2 +#define IEEE80211_AUTH_SHARED_RESPONSE 3 +#define IEEE80211_AUTH_SHARED_PASS 4 + +/* + * Reason codes + * + * Unlisted codes are reserved + */ +#define IEEE80211_REASON_UNSPECIFIED 1 +#define IEEE80211_REASON_AUTH_EXPIRE 2 +#define IEEE80211_REASON_AUTH_LEAVE 3 +#define IEEE80211_REASON_ASSOC_EXPIRE 4 +#define IEEE80211_REASON_ASSOC_TOOMANY 5 +#define IEEE80211_REASON_NOT_AUTHED 6 +#define IEEE80211_REASON_NOT_ASSOCED 7 +#define IEEE80211_REASON_ASSOC_LEAVE 8 +#define IEEE80211_REASON_ASSOC_NOT_AUTHED 9 + +/* + * Status code + * + * Unlisted codes are reserved + */ +#define IEEE80211_STATUS_SUCCESS 0x0000 +#define IEEE80211_STATUS_UNSPECIFIED 1 +#define IEEE80211_STATUS_CAPINFO 10 +#define IEEE80211_STATUS_NOT_ASSOCED 11 +#define IEEE80211_STATUS_OTHER 12 +#define IEEE80211_STATUS_ALG 13 +#define IEEE80211_STATUS_SEQUENCE 14 +#define IEEE80211_STATUS_CHALLENGE 15 +#define IEEE80211_STATUS_TIMEOUT 16 +#define IEEE80211_STATUS_TOO_MANY_STATIONS 17 +#define IEEE80211_STATUS_RATES 18 + +#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ +#define IEEE80211_WEP_IVLEN 3 /* 24bit */ +#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ +#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ +#define IEEE80211_WEP_NKID 4 /* number of key ids */ + +/* nwid is pointed at by ifr.ifr_data */ +struct ieee80211_nwid { + u_int8_t i_len; + u_int8_t i_nwid[IEEE80211_NWID_LEN]; +}; + +#define SIOCS80211NWID _IOWR('i', 230, struct ifreq) +#define SIOCG80211NWID _IOWR('i', 231, struct ifreq) + +/* the first member must be matched with struct ifreq */ +struct ieee80211_nwkey { + char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ + int i_wepon; /* wep enabled flag */ + int i_defkid; /* default encrypt key id */ + struct { + int i_keylen; + u_int8_t *i_keydat; + } i_key[IEEE80211_WEP_NKID]; +}; +#define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey) +#define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey) + +#define IEEE80211_WEP_NOSUP -1 +#define IEEE80211_WEP_OFF 0 +#define IEEE80211_WEP_ON 1 +#define IEEE80211_WEP_MIXED 2 + +#define IEEE80211_AUTH_NONE 0 +#define IEEE80211_AUTH_OPEN 1 +#define IEEE80211_AUTH_SHARED 2 + +#define IEEE80211_POWERSAVE_NOSUP -1 +#define IEEE80211_POWERSAVE_OFF 0 +#define IEEE80211_POWERSAVE_CAM 1 +#define IEEE80211_POWERSAVE_PSP 2 +#define IEEE80211_POWERSAVE_PSP_CAM 3 +#define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM + +/* the first member must be matched with struct ifreq */ +struct ieee80211req { + char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ + u_int16_t i_type; /* req type */ + int16_t i_val; /* Index or simple value */ + int16_t i_len; /* Index or simple value */ + void *i_data; /* Extra data */ +}; +#define SIOCS80211 _IOW('i', 234, struct ieee80211req) +#define SIOCG80211 _IOWR('i', 235, struct ieee80211req) + +#define IEEE80211_IOC_SSID 1 +#define IEEE80211_IOC_NUMSSIDS 2 +#define IEEE80211_IOC_WEP 3 +#define IEEE80211_IOC_WEPKEY 4 +#define IEEE80211_IOC_NUMWEPKEYS 5 +#define IEEE80211_IOC_WEPTXKEY 6 +#define IEEE80211_IOC_AUTHMODE 7 +#define IEEE80211_IOC_STATIONNAME 8 +#define IEEE80211_IOC_CHANNEL 9 +#define IEEE80211_IOC_POWERSAVE 10 +#define IEEE80211_IOC_POWERSAVESLEEP 11 + +#endif /* !_NET_IF_IEEE80211_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_llc.h b/newlib/libc/sys/linux/include/net/if_llc.h new file mode 100644 index 000000000..ec2b75b31 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_llc.h @@ -0,0 +1,160 @@ +/* $NetBSD: if_llc.h,v 1.12 1999/11/19 20:41:19 thorpej Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_llc.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_llc.h,v 1.8 2002/03/29 06:58:45 mdodd Exp $ + */ + +#ifndef _NET_IF_LLC_H_ +#define _NET_IF_LLC_H_ + +/* + * IEEE 802.2 Link Level Control headers, for use in conjunction with + * 802.{3,4,5} media access control methods. + * + * Headers here do not use bit fields due to shortcommings in many + * compilers. + */ + +struct llc { + u_int8_t llc_dsap; + u_int8_t llc_ssap; + union { + struct { + u_int8_t control; + u_int8_t format_id; + u_int8_t class; + u_int8_t window_x2; + } type_u __attribute__((__packed__)); + struct { + u_int8_t num_snd_x2; + u_int8_t num_rcv_x2; + } type_i __attribute__((__packed__)); + struct { + u_int8_t control; + u_int8_t num_rcv_x2; + } type_s __attribute__((__packed__)); + struct { + u_int8_t control; + /* + * We cannot put the following fields in a structure because + * the structure rounding might cause padding. + */ + u_int8_t frmr_rej_pdu0; + u_int8_t frmr_rej_pdu1; + u_int8_t frmr_control; + u_int8_t frmr_control_ext; + u_int8_t frmr_cause; + } type_frmr __attribute__((__packed__)); + struct { + u_int8_t control; + u_int8_t org_code[3]; + u_int16_t ether_type; + } type_snap __attribute__((__packed__)); + struct { + u_int8_t control; + u_int8_t control_ext; + } type_raw __attribute__((__packed__)); + } llc_un /* XXX __attribute__((__packed__)) ??? */; +} __attribute__((__packed__)); + +struct frmrinfo { + u_int8_t frmr_rej_pdu0; + u_int8_t frmr_rej_pdu1; + u_int8_t frmr_control; + u_int8_t frmr_control_ext; + u_int8_t frmr_cause; +} __attribute__((__packed__)); + +#define llc_control llc_un.type_u.control +#define llc_control_ext llc_un.type_raw.control_ext +#define llc_fid llc_un.type_u.format_id +#define llc_class llc_un.type_u.class +#define llc_window llc_un.type_u.window_x2 +#define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0 +#define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0 +#define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1 +#define llc_frmr_control llc_un.type_frmr.frmr_control +#define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext +#define llc_frmr_cause llc_un.type_frmr.frmr_cause +#define llc_snap llc_un.type_snap + +/* + * Don't use sizeof(struct llc_un) for LLC header sizes + */ +#define LLC_ISFRAMELEN 4 +#define LLC_UFRAMELEN 3 +#define LLC_FRMRLEN 7 +#define LLC_SNAPFRAMELEN 8 + +/* + * Unnumbered LLC format commands + */ +#define LLC_UI 0x3 +#define LLC_UI_P 0x13 +#define LLC_DISC 0x43 +#define LLC_DISC_P 0x53 +#define LLC_UA 0x63 +#define LLC_UA_P 0x73 +#define LLC_TEST 0xe3 +#define LLC_TEST_P 0xf3 +#define LLC_FRMR 0x87 +#define LLC_FRMR_P 0x97 +#define LLC_DM 0x0f +#define LLC_DM_P 0x1f +#define LLC_XID 0xaf +#define LLC_XID_P 0xbf +#define LLC_SABME 0x6f +#define LLC_SABME_P 0x7f + +/* + * Supervisory LLC commands + */ +#define LLC_RR 0x01 +#define LLC_RNR 0x05 +#define LLC_REJ 0x09 + +/* + * Info format - dummy only + */ +#define LLC_INFO 0x00 + +/* + * ISO PDTR 10178 contains among others + */ +#define LLC_X25_LSAP 0x7e +#define LLC_SNAP_LSAP 0xaa +#define LLC_ISO_LSAP 0xfe + +#endif /* _NET_IF_LLC_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_media.h b/newlib/libc/sys/linux/include/net/if_media.h new file mode 100644 index 000000000..80599bdc0 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_media.h @@ -0,0 +1,409 @@ +/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ +/* $FreeBSD: src/sys/net/if_media.h,v 1.17 2002/05/07 18:16:39 imp Exp $ */ + +/* + * Copyright (c) 1997 + * Jonathan Stone and Jason R. Thorpe. All rights reserved. + * + * This software is derived from information provided by Matt Thomas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jonathan Stone + * and Jason R. Thorpe for the NetBSD Project. + * 4. The names of the authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NET_IF_MEDIA_H_ +#define _NET_IF_MEDIA_H_ + +/* + * Prototypes and definitions for BSD/OS-compatible network interface + * media selection. + * + * Where it is safe to do so, this code strays slightly from the BSD/OS + * design. Software which uses the API (device drivers, basically) + * shouldn't notice any difference. + * + * Many thanks to Matt Thomas for providing the information necessary + * to implement this interface. + */ + +#ifdef _KERNEL + +#include + +/* + * Driver callbacks for media status and change requests. + */ +typedef int (*ifm_change_cb_t)(struct ifnet *ifp); +typedef void (*ifm_stat_cb_t)(struct ifnet *ifp, struct ifmediareq *req); + +/* + * In-kernel representation of a single supported media type. + */ +struct ifmedia_entry { + LIST_ENTRY(ifmedia_entry) ifm_list; + int ifm_media; /* description of this media attachment */ + int ifm_data; /* for driver-specific use */ + void *ifm_aux; /* for driver-specific use */ +}; + +/* + * One of these goes into a network interface's softc structure. + * It is used to keep general media state. + */ +struct ifmedia { + int ifm_mask; /* mask of changes we don't care about */ + int ifm_media; /* current user-set media word */ + struct ifmedia_entry *ifm_cur; /* currently selected media */ + LIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */ + ifm_change_cb_t ifm_change; /* media change driver callback */ + ifm_stat_cb_t ifm_status; /* media status driver callback */ +}; + +/* Initialize an interface's struct if_media field. */ +void ifmedia_init(struct ifmedia *ifm, int dontcare_mask, + ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback); + +/* Remove all mediums from a struct ifmedia. */ +void ifmedia_removeall( struct ifmedia *ifm); + +/* Add one supported medium to a struct ifmedia. */ +void ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux); + +/* Add an array (of ifmedia_entry) media to a struct ifmedia. */ +void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp, + int count); + +/* Set default media type on initialization. */ +void ifmedia_set(struct ifmedia *ifm, int mword); + +/* Common ioctl function for getting/setting media, called by driver. */ +int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, + struct ifmedia *ifm, u_long cmd); + +#endif /*_KERNEL */ + +/* + * if_media Options word: + * Bits Use + * ---- ------- + * 0-4 Media variant + * 5-7 Media type + * 8-15 Type specific options + * 16-19 RFU + * 20-27 Shared (global) options + * 28-31 Instance + */ + +/* + * Ethernet + */ +#define IFM_ETHER 0x00000020 +#define IFM_10_T 3 /* 10BaseT - RJ45 */ +#define IFM_10_2 4 /* 10Base2 - Thinnet */ +#define IFM_10_5 5 /* 10Base5 - AUI */ +#define IFM_100_TX 6 /* 100BaseTX - RJ45 */ +#define IFM_100_FX 7 /* 100BaseFX - Fiber */ +#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ +#define IFM_100_VG 9 /* 100VG-AnyLAN */ +#define IFM_100_T2 10 /* 100BaseT2 */ +#define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ +#define IFM_10_STP 12 /* 10BaseT over shielded TP */ +#define IFM_10_FL 13 /* 10BaseFL - Fiber */ +#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ +#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ +#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ +#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ +/* note 31 is the max! */ + +#define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ + +/* + * Token ring + */ +#define IFM_TOKEN 0x00000040 +#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ +#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ +#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ +#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ +#define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */ +#define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */ +#define IFM_TOK_ETR 0x00000200 /* Early token release */ +#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ +#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ +#define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */ +#define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */ +#define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */ + +/* + * FDDI + */ +#define IFM_FDDI 0x00000060 +#define IFM_FDDI_SMF 3 /* Single-mode fiber */ +#define IFM_FDDI_MMF 4 /* Multi-mode fiber */ +#define IFM_FDDI_UTP 5 /* CDDI / UTP */ +#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ + +/* + * IEEE 802.11 Wireless + */ +#define IFM_IEEE80211 0x00000080 +#define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ +#define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ +#define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */ +#define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */ +#define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */ +#define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */ +#define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ +#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ +#define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ +#define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */ +#define IFM_IEEE80211_IBSSMASTER 0x00000800 /* Operate as an IBSS master */ + +/* + * Shared media sub-types + */ +#define IFM_AUTO 0 /* Autoselect best media */ +#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ +#define IFM_NONE 2 /* Deselect all media */ + +/* + * Shared options + */ +#define IFM_FDX 0x00100000 /* Force full duplex */ +#define IFM_HDX 0x00200000 /* Force half duplex */ +#define IFM_FLAG0 0x01000000 /* Driver defined flag */ +#define IFM_FLAG1 0x02000000 /* Driver defined flag */ +#define IFM_FLAG2 0x04000000 /* Driver defined flag */ +#define IFM_LOOP 0x08000000 /* Put hardware in loopback */ + +/* + * Masks + */ +#define IFM_NMASK 0x000000e0 /* Network type */ +#define IFM_TMASK 0x0000001f /* Media sub-type */ +#define IFM_IMASK 0xf0000000 /* Instance */ +#define IFM_ISHIFT 28 /* Instance shift */ +#define IFM_OMASK 0x0000ff00 /* Type specific options */ +#define IFM_GMASK 0x0ff00000 /* Global options */ + +/* + * Status bits + */ +#define IFM_AVALID 0x00000001 /* Active bit valid */ +#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ + +/* + * Macros to extract various bits of information from the media word. + */ +#define IFM_TYPE(x) ((x) & IFM_NMASK) +#define IFM_SUBTYPE(x) ((x) & IFM_TMASK) +#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) +#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) +#define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) + +#define IFM_INST_MAX IFM_INST(IFM_IMASK) + +/* + * Macro to create a media word. + */ +#define IFM_MAKEWORD(type, subtype, options, instance) \ + ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) + +/* + * NetBSD extension not defined in the BSDI API. This is used in various + * places to get the canonical description for a given type/subtype. + * + * NOTE: all but the top-level type descriptions must contain NO whitespace! + * Otherwise, parsing these in ifconfig(8) would be a nightmare. + */ +struct ifmedia_description { + int ifmt_word; /* word value; may be masked */ + const char *ifmt_string; /* description */ +}; + +#define IFM_TYPE_DESCRIPTIONS { \ + { IFM_ETHER, "Ethernet" }, \ + { IFM_TOKEN, "Token ring" }, \ + { IFM_FDDI, "FDDI" }, \ + { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ + { IFM_10_T, "10baseT/UTP" }, \ + { IFM_10_2, "10base2/BNC" }, \ + { IFM_10_5, "10base5/AUI" }, \ + { IFM_100_TX, "100baseTX" }, \ + { IFM_100_FX, "100baseFX" }, \ + { IFM_100_T4, "100baseT4" }, \ + { IFM_100_VG, "100baseVG" }, \ + { IFM_100_T2, "100baseT2" }, \ + { IFM_10_STP, "10baseSTP" }, \ + { IFM_10_FL, "10baseFL" }, \ + { IFM_1000_SX, "1000baseSX" }, \ + { IFM_1000_LX, "1000baseLX" }, \ + { IFM_1000_CX, "1000baseCX" }, \ + { IFM_1000_T, "1000baseTX" }, \ + { IFM_1000_T, "1000baseT" }, \ + { IFM_HPNA_1, "homePNA" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_ALIASES { \ + { IFM_10_T, "UTP" }, \ + { IFM_10_T, "10UTP" }, \ + { IFM_10_2, "BNC" }, \ + { IFM_10_2, "10BNC" }, \ + { IFM_10_5, "AUI" }, \ + { IFM_10_5, "10AUI" }, \ + { IFM_100_TX, "100TX" }, \ + { IFM_100_T4, "100T4" }, \ + { IFM_100_VG, "100VG" }, \ + { IFM_100_T2, "100T2" }, \ + { IFM_10_STP, "10STP" }, \ + { IFM_10_FL, "10FL" }, \ + { IFM_1000_SX, "1000SX" }, \ + { IFM_1000_LX, "1000LX" }, \ + { IFM_1000_CX, "1000CX" }, \ + { IFM_1000_T, "1000TX" }, \ + { IFM_1000_T, "1000T" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ + { IFM_TOK_STP4, "DB9/4Mbit" }, \ + { IFM_TOK_STP16, "DB9/16Mbit" }, \ + { IFM_TOK_UTP4, "UTP/4Mbit" }, \ + { IFM_TOK_UTP16, "UTP/16Mbit" }, \ + { IFM_TOK_STP100, "STP/100Mbit" }, \ + { IFM_TOK_UTP100, "UTP/100Mbit" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_ALIASES { \ + { IFM_TOK_STP4, "4STP" }, \ + { IFM_TOK_STP16, "16STP" }, \ + { IFM_TOK_UTP4, "4UTP" }, \ + { IFM_TOK_UTP16, "16UTP" }, \ + { IFM_TOK_STP100, "100STP" }, \ + { IFM_TOK_UTP100, "100UTP" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ + { IFM_TOK_ETR, "EarlyTokenRelease" }, \ + { IFM_TOK_SRCRT, "SourceRouting" }, \ + { IFM_TOK_ALLR, "AllRoutes" }, \ + { IFM_TOK_DTR, "Dedicated" }, \ + { IFM_TOK_CLASSIC,"Classic" }, \ + { IFM_TOK_AUTO, " " }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ + { IFM_FDDI_SMF, "Single-mode" }, \ + { IFM_FDDI_MMF, "Multi-mode" }, \ + { IFM_FDDI_UTP, "UTP" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_ALIASES { \ + { IFM_FDDI_SMF, "SMF" }, \ + { IFM_FDDI_MMF, "MMF" }, \ + { IFM_FDDI_UTP, "CDDI" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ + { IFM_FDDI_DA, "Dual-attach" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ + { IFM_IEEE80211_FH1, "FH/1Mbps" }, \ + { IFM_IEEE80211_FH2, "FH/2Mbps" }, \ + { IFM_IEEE80211_DS1, "DS/1Mbps" }, \ + { IFM_IEEE80211_DS2, "DS/2Mbps" }, \ + { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \ + { IFM_IEEE80211_DS11, "DS/11Mbps" }, \ + { IFM_IEEE80211_DS22, "DS/22Mbps" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_ALIASES { \ + { IFM_IEEE80211_FH1, "FH1" }, \ + { IFM_IEEE80211_FH2, "FH2" }, \ + { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \ + { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \ + { IFM_IEEE80211_DS1, "DS1" }, \ + { IFM_IEEE80211_DS2, "DS2" }, \ + { IFM_IEEE80211_DS5, "DS5.5" }, \ + { IFM_IEEE80211_DS11, "DS11" }, \ + { IFM_IEEE80211_DS22, "DS22" }, \ + { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \ + { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \ + { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \ + { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \ + { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ + { IFM_IEEE80211_ADHOC, "adhoc" }, \ + { IFM_IEEE80211_HOSTAP, "hostap" }, \ + { IFM_IEEE80211_IBSS, "ibss" }, \ + { IFM_IEEE80211_IBSSMASTER, "ibss-master" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ + { IFM_AUTO, "autoselect" }, \ + { IFM_MANUAL, "manual" }, \ + { IFM_NONE, "none" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_SHARED_ALIASES { \ + { IFM_AUTO, "auto" }, \ + { 0, NULL }, \ +} + +#define IFM_SHARED_OPTION_DESCRIPTIONS { \ + { IFM_FDX, "full-duplex" }, \ + { IFM_HDX, "half-duplex" }, \ + { IFM_FLAG0, "flag0" }, \ + { IFM_FLAG1, "flag1" }, \ + { IFM_FLAG2, "flag2" }, \ + { IFM_LOOP, "hw-loopback" }, \ + { 0, NULL }, \ +} + +#endif /* _NET_IF_MEDIA_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_mib.h b/newlib/libc/sys/linux/include/net/if_mib.h new file mode 100644 index 000000000..b1a7bcfd5 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_mib.h @@ -0,0 +1,170 @@ +/* + * Copyright 1996 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/net/if_mib.h,v 1.6 1999/08/28 00:48:19 peter Exp $ + */ + +#ifndef _NET_IF_MIB_H +#define _NET_IF_MIB_H 1 + +struct ifmibdata { + char ifmd_name[IFNAMSIZ]; /* name of interface */ + int ifmd_pcount; /* number of promiscuous listeners */ + int ifmd_flags; /* interface flags */ + int ifmd_snd_len; /* instantaneous length of send queue */ + int ifmd_snd_maxlen; /* maximum length of send queue */ + int ifmd_snd_drops; /* number of drops in send queue */ + int ifmd_filler[4]; /* for future expansion */ + struct if_data ifmd_data; /* generic information and statistics */ +}; + +/* + * sysctl MIB tags at the net.link.generic level + */ +#define IFMIB_SYSTEM 1 /* non-interface-specific */ +#define IFMIB_IFDATA 2 /* per-interface data table */ + +/* + * MIB tags for the various net.link.generic.ifdata tables + */ +#define IFDATA_GENERAL 1 /* generic stats for all kinds of ifaces */ +#define IFDATA_LINKSPECIFIC 2 /* specific to the type of interface */ + +/* + * MIB tags at the net.link.generic.system level + */ +#define IFMIB_IFCOUNT 1 /* number of interfaces configured */ + +/* + * MIB tags as the net.link level + * All of the other values are IFT_* names defined in if_types.h. + */ +#define NETLINK_GENERIC 0 /* functions not specific to a type of iface */ + +/* + * The reason why the IFDATA_LINKSPECIFIC stuff is not under the + * net.link. branches is twofold: + * 1) It's easier to code this way, and doesn't require duplication. + * 2) The fourth level under net.link. is ; that is to say, + * the net.link. tree instruments the adaptation layers between + * and a particular protocol family (e.g., net.link.ether.inet + * instruments ARP). This does not really leave room for anything else + * that needs to have a well-known number. + */ + +/* + * Link-specific MIB structures for various link types. + */ + +/* For IFT_ETHER, IFT_ISO88023, and IFT_STARLAN, as used by RFC 1650 */ +struct ifmib_iso_8802_3 { + u_int32_t dot3StatsAlignmentErrors; + u_int32_t dot3StatsFCSErrors; + u_int32_t dot3StatsSingleCollisionFrames; + u_int32_t dot3StatsMultipleCollisionFrames; + u_int32_t dot3StatsSQETestErrors; + u_int32_t dot3StatsDeferredTransmissions; + u_int32_t dot3StatsLateCollisions; + u_int32_t dot3StatsExcessiveCollisions; + u_int32_t dot3StatsInternalMacTransmitErrors; + u_int32_t dot3StatsCarrierSenseErrors; + u_int32_t dot3StatsFrameTooLongs; + u_int32_t dot3StatsInternalMacReceiveErrors; + u_int32_t dot3StatsEtherChipSet; + /* Matt Thomas wants this one, not included in RFC 1650: */ + u_int32_t dot3StatsMissedFrames; + + u_int32_t dot3StatsCollFrequencies[16]; /* NB: index origin */ + + u_int32_t dot3Compliance; +#define DOT3COMPLIANCE_STATS 1 +#define DOT3COMPLIANCE_COLLS 2 +}; + +/* + * Chipset identifiers are normally part of the vendor's enterprise MIB. + * However, we don't want to be trying to represent arbitrary-length + * OBJECT IDENTIFIERs here (ick!), and the right value is not necessarily + * obvious to the driver implementor. So, we define our own identification + * mechanism here, and let the agent writer deal with the translation. + */ +#define DOT3CHIPSET_VENDOR(x) ((x) >> 16) +#define DOT3CHIPSET_PART(x) ((x) & 0xffff) +#define DOT3CHIPSET(v,p) (((v) << 16) + ((p) & 0xffff)) + +/* Driver writers! Add your vendors here! */ +enum dot3Vendors { + dot3VendorAMD = 1, + dot3VendorIntel = 2, + dot3VendorNational = 4, + dot3VendorFujitsu = 5, + dot3VendorDigital = 6, + dot3VendorWesternDigital = 7 +}; + +/* Driver writers! Add your chipsets here! */ +enum { + dot3ChipSetAMD7990 = 1, + dot3ChipSetAMD79900 = 2, + dot3ChipSetAMD79C940 = 3 +}; + +enum { + dot3ChipSetIntel82586 = 1, + dot3ChipSetIntel82596 = 2, + dot3ChipSetIntel82557 = 3 +}; + +enum { + dot3ChipSetNational8390 = 1, + dot3ChipSetNationalSonic = 2 +}; + +enum { + dot3ChipSetFujitsu86950 = 1 +}; + +enum { + dot3ChipSetDigitalDC21040 = 1, + dot3ChipSetDigitalDC21140 = 2, + dot3ChipSetDigitalDC21041 = 3, + dot3ChipSetDigitalDC21140A = 4, + dot3ChipSetDigitalDC21142 = 5 +}; + +enum { + dot3ChipSetWesternDigital83C690 = 1, + dot3ChipSetWesternDigital83C790 = 2 +}; +/* END of Ethernet-link MIB stuff */ + +/* + * Put other types of interface MIBs here, or in interface-specific + * header files if convenient ones already exist. + */ +#endif /* _NET_IF_MIB_H */ diff --git a/newlib/libc/sys/linux/include/net/if_ppp.h b/newlib/libc/sys/linux/include/net/if_ppp.h new file mode 100644 index 000000000..0d4b6078f --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_ppp.h @@ -0,0 +1,137 @@ +/* + * if_ppp.h - Point-to-Point Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $FreeBSD: src/sys/net/if_ppp.h,v 1.14 1999/08/28 00:48:20 peter Exp $ + */ + +#ifndef _IF_PPP_H_ +#define _IF_PPP_H_ + +/* XXX this used to be self-contained. */ +#include +#include + +/* + * Packet sizes + */ +#define PPP_MTU 1500 /* Default MTU (size of Info field) */ +#define PPP_MAXMRU 65000 /* Largest MRU we allow */ +#define PPP_MAXMTU 16384 /* Largest MTU we allow */ + +/* + * Bit definitions for flags. + */ +#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ +#define SC_COMP_AC 0x00000002 /* header compression (output) */ +#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ +#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ +#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ +#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ +#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ +#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ +#define SC_DEBUG 0x00010000 /* enable debug messages */ +#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ +#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ +#define SC_LOG_RAWIN 0x00080000 /* log all chars received */ +#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ +#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ +#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ +#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ +#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ +#define SC_MASK 0x0fff00ff /* bits that user can change */ + +/* + * State bits in sc_flags, not changeable by user. + */ +#define SC_TIMEOUT 0x00000400 /* timeout is currently pending */ +#define SC_VJ_RESET 0x00000800 /* need to reset VJ decomp */ +#define SC_COMP_RUN 0x00001000 /* compressor has been initiated */ +#define SC_DECOMP_RUN 0x00002000 /* decompressor has been initiated */ +#define SC_DC_ERROR 0x00004000 /* non-fatal decomp error detected */ +#define SC_DC_FERROR 0x00008000 /* fatal decomp error detected */ +#define SC_TBUSY 0x10000000 /* xmitter doesn't need a packet yet */ +#define SC_PKTLOST 0x20000000 /* have lost or dropped a packet */ +#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ +#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ + +/* + * Ioctl definitions. + */ + +struct npioctl { + int protocol; /* PPP procotol, e.g. PPP_IP */ + enum NPmode mode; +}; + +/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ +struct ppp_option_data { + u_char *ptr; + u_int length; + int transmit; +}; + +struct ifpppstatsreq { + char ifr_name[IFNAMSIZ]; + struct ppp_stats stats; +}; + +struct ifpppcstatsreq { + char ifr_name[IFNAMSIZ]; + struct ppp_comp_stats stats; +}; + +/* + * Ioctl definitions. + */ + +#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ +#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ +#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ +#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ +#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ +#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ +#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ +#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ +#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ +#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ +#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ +#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ +#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ +#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) +#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ +#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ +#define PPPIOCGIDLE _IOR('t', 74, struct ppp_idle) /* get idle time */ +#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */ +#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */ + +/* PPPIOC[GS]MTU are alternatives to SIOC[GS]IFMTU, used under Ultrix */ +#define PPPIOCGMTU _IOR('t', 73, int) /* get interface MTU */ +#define PPPIOCSMTU _IOW('t', 72, int) /* set interface MTU */ + +/* + * These two are interface ioctls so that pppstats can do them on + * a socket without having to open the serial device. + */ +#define SIOCGPPPSTATS _IOWR('i', 123, struct ifpppstatsreq) +#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq) + +#if !defined(ifr_mtu) +#define ifr_mtu ifr_ifru.ifru_metric +#endif + +#endif /* _IF_PPP_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_pppvar.h b/newlib/libc/sys/linux/include/net/if_pppvar.h new file mode 100644 index 000000000..b4380f4ec --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_pppvar.h @@ -0,0 +1,109 @@ +/* + * if_pppvar.h - private structures and declarations for PPP. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $FreeBSD: src/sys/net/if_pppvar.h,v 1.19 2002/03/24 09:34:04 bde Exp $ + */ + +/* + * Supported network protocols. These values are used for + * indexing sc_npmode. + */ +#define NP_IP 0 /* Internet Protocol */ +#define NUM_NP 1 /* Number of NPs. */ + +/* + * Structure describing each ppp unit. + */ +struct ppp_softc { + struct ifnet sc_if; /* network-visible interface */ +/*hi*/ u_int sc_flags; /* control/status bits; see if_ppp.h */ + struct callout_handle sc_ch; /* Used for scheduling timeouts */ + void *sc_devp; /* pointer to device-dep structure */ + void (*sc_start)(struct ppp_softc *); /* start output proc */ + void (*sc_ctlp)(struct ppp_softc *); /* rcvd control pkt */ + void (*sc_relinq)(struct ppp_softc *); /* relinquish ifunit */ + void (*sc_setmtu)(struct ppp_softc *); /* set mtu */ + short sc_mru; /* max receive unit */ + pid_t sc_xfer; /* used in transferring unit */ +/*hi*/ struct ifqueue sc_rawq; /* received packets */ +/*net*/ struct ifqueue sc_inq; /* queue of input packets for daemon */ +/*net*/ struct ifqueue sc_fastq; /* interactive output packet q */ + struct mbuf *sc_npqueue; /* output packets not to be sent yet */ + struct mbuf **sc_npqtail; /* ptr to last next ptr in npqueue */ + struct pppstat sc_stats; /* count of bytes/pkts sent/rcvd */ + enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */ + struct compressor *sc_xcomp; /* transmit compressor */ + void *sc_xc_state; /* transmit compressor state */ + struct compressor *sc_rcomp; /* receive decompressor */ + void *sc_rc_state; /* receive decompressor state */ + time_t sc_last_sent; /* time (secs) last NP pkt sent */ + time_t sc_last_recv; /* time (secs) last NP pkt rcvd */ +#ifdef PPP_FILTER + struct bpf_program sc_pass_filt; /* filter for packets to pass */ + struct bpf_program sc_active_filt; /* filter for "non-idle" packets */ +#endif /* PPP_FILTER */ +#ifdef VJC + struct slcompress *sc_comp; /* vjc control buffer */ +#endif + + /* Device-dependent part for async lines. */ + ext_accm sc_asyncmap; /* async control character map */ + u_long sc_rasyncmap; /* receive async control char map */ + struct mbuf *sc_outm; /* mbuf chain currently being output */ + struct mbuf *sc_m; /* pointer to input mbuf chain */ + struct mbuf *sc_mc; /* pointer to current input mbuf */ + char *sc_mp; /* ptr to next char in input mbuf */ + short sc_ilen; /* length of input packet so far */ + u_short sc_fcs; /* FCS so far (input) */ + u_short sc_outfcs; /* FCS so far for output packet */ + u_char sc_rawin[16]; /* chars as received */ + int sc_rawin_count; /* # in sc_rawin */ +}; + +struct ppp_softc *pppalloc(pid_t pid); +void pppdealloc(struct ppp_softc *sc); +int pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag, + struct thread *td); +int pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, + struct rtentry *rtp); +void ppp_restart(struct ppp_softc *sc); +void ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost); +struct mbuf *ppp_dequeue(struct ppp_softc *sc); diff --git a/newlib/libc/sys/linux/include/net/if_slvar.h b/newlib/libc/sys/linux/include/net/if_slvar.h new file mode 100644 index 000000000..5f7008909 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_slvar.h @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_slvar.h 8.3 (Berkeley) 2/1/94 + * + * $FreeBSD: src/sys/net/if_slvar.h,v 1.21 2001/10/27 20:31:24 dillon Exp $ + */ + +#ifndef _NET_IF_SLVAR_H_ +#define _NET_IF_SLVAR_H_ + +#include + +/* + * Definitions for SLIP interface data structures + * + * (This exists so programs like slstats can get at the definition + * of sl_softc.) + */ +struct sl_softc { + struct ifnet sc_if; /* network-visible interface */ + struct ifqueue sc_fastq; /* interactive output queue */ + struct tty *sc_ttyp; /* pointer to tty structure */ + struct mbuf *sc_mbuf; /* pointer to mbuf containing buffer */ + u_char *sc_mp; /* pointer to next available buf char */ + u_char *sc_ep; /* pointer to last available buf char */ + u_char *sc_buf; /* input buffer */ + u_int sc_flags; /* see below */ + u_int sc_escape; /* =1 if last char input was FRAME_ESCAPE */ + time_t sc_lasttime; /* last time a char arrived */ + long sc_abortcount; /* number of abort escape chars */ + time_t sc_starttime; /* time of first abort in window */ + u_int sc_keepalive; /* time to decide link hang */ + u_int sc_outfill; /* time to send FRAME_END when output idle */ + /* + * Handles for scheduling outfill and + * keepalive timeouts. + */ + struct callout_handle sc_ofhandle; + struct callout_handle sc_kahandle; + struct slcompress sc_comp; /* tcp compression data */ + LIST_ENTRY(sl_softc) sl_next; + u_char *bpfbuf; /* hang buffer for bpf here */ +}; + +/* internal flags */ +#define SC_ERROR 0x0001 /* had an input error */ +#define SC_OUTWAIT 0x0002 /* waiting for output fill */ +#define SC_KEEPALIVE 0x0004 /* input keepalive */ + +/* visible flags */ +#define SC_COMPRESS IFF_LINK0 /* compress TCP traffic */ +#define SC_NOICMP IFF_LINK1 /* suppress ICMP traffic */ +#define SC_AUTOCOMP IFF_LINK2 /* auto-enable TCP compression */ + + +#endif diff --git a/newlib/libc/sys/linux/include/net/if_sppp.h b/newlib/libc/sys/linux/include/net/if_sppp.h new file mode 100644 index 000000000..182651c1f --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_sppp.h @@ -0,0 +1,215 @@ +/* + * Defines for synchronous PPP/Cisco link level subroutines. + * + * Copyright (C) 1994 Cronyx Ltd. + * Author: Serge Vakulenko, + * + * Heavily revamped to conform to RFC 1661. + * Copyright (C) 1997, Joerg Wunsch. + * + * This software is distributed with NO WARRANTIES, not even the implied + * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Authors grant any other persons or organizations permission to use + * or modify this software as long as this message is kept with the software, + * all derivative works or modified versions. + * + * From: Version 2.0, Fri Oct 6 20:39:21 MSK 1995 + * + * $FreeBSD: src/sys/net/if_sppp.h,v 1.24 2001/12/30 20:42:29 joerg Exp $ + */ + +#ifndef _NET_IF_SPPP_H_ +#define _NET_IF_SPPP_H_ 1 + +#define IDX_LCP 0 /* idx into state table */ + +struct slcp { + u_long opts; /* LCP options to send (bitfield) */ + u_long magic; /* local magic number */ + u_long mru; /* our max receive unit */ + u_long their_mru; /* their max receive unit */ + u_long protos; /* bitmask of protos that are started */ + u_char echoid; /* id of last keepalive echo request */ + /* restart max values, see RFC 1661 */ + int timeout; + int max_terminate; + int max_configure; + int max_failure; +}; + +#define IDX_IPCP 1 /* idx into state table */ +#define IDX_IPV6CP 2 /* idx into state table */ + +struct sipcp { + u_long opts; /* IPCP options to send (bitfield) */ + u_int flags; +#define IPCP_HISADDR_SEEN 1 /* have seen his address already */ +#define IPCP_MYADDR_DYN 2 /* my address is dynamically assigned */ +#define IPCP_MYADDR_SEEN 4 /* have seen his address already */ +#ifdef notdef +#define IPV6CP_MYIFID_DYN 8 /* my ifid is dynamically assigned */ +#endif +#define IPV6CP_MYIFID_SEEN 0x10 /* have seen his ifid already */ +#define IPCP_VJ 0x20 /* can use VJ compression */ + int max_state; /* VJ: Max-Slot-Id */ + int compress_cid; /* VJ: Comp-Slot-Id */ +}; + +#define AUTHNAMELEN 64 +#define AUTHKEYLEN 16 + +struct sauth { + u_short proto; /* authentication protocol to use */ + u_short flags; +#define AUTHFLAG_NOCALLOUT 1 /* do not require authentication on */ + /* callouts */ +#define AUTHFLAG_NORECHALLENGE 2 /* do not re-challenge CHAP */ + u_char name[AUTHNAMELEN]; /* system identification name */ + u_char secret[AUTHKEYLEN]; /* secret password */ + u_char challenge[AUTHKEYLEN]; /* random challenge */ +}; + +#define IDX_PAP 3 +#define IDX_CHAP 4 + +#define IDX_COUNT (IDX_CHAP + 1) /* bump this when adding cp's! */ + +/* + * Don't change the order of this. Ordering the phases this way allows + * for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to + * know whether LCP is up. + */ +enum ppp_phase { + PHASE_DEAD, PHASE_ESTABLISH, PHASE_TERMINATE, + PHASE_AUTHENTICATE, PHASE_NETWORK +}; + +#define PP_MTU 1500 /* default/minimal MRU */ +#define PP_MAX_MRU 2048 /* maximal MRU we want to negotiate */ + +/* + * This is a cut down struct sppp (see below) that can easily be + * exported to/ imported from userland without the need to include + * dozens of kernel-internal header files. It is used by the + * SPPPIO[GS]DEFS ioctl commands below. + */ +struct sppp_parms { + enum ppp_phase pp_phase; /* phase we're currently in */ + int enable_vj; /* VJ header compression enabled */ + int enable_ipv6; /* + * Enable IPv6 negotiations -- only + * needed since each IPv4 i/f auto- + * matically gets an IPv6 address + * assigned, so we can't use this as + * a decision. + */ + struct slcp lcp; /* LCP params */ + struct sipcp ipcp; /* IPCP params */ + struct sipcp ipv6cp; /* IPv6CP params */ + struct sauth myauth; /* auth params, i'm peer */ + struct sauth hisauth; /* auth params, i'm authenticator */ +}; + +/* + * Definitions to pass struct sppp_parms data down into the kernel + * using the SIOC[SG]IFGENERIC ioctl interface. + * + * In order to use this, create a struct spppreq, fill in the cmd + * field with SPPPIOGDEFS, and put the address of this structure into + * the ifr_data portion of a struct ifreq. Pass this struct to a + * SIOCGIFGENERIC ioctl. Then replace the cmd field by SPPPIOSDEFS, + * modify the defs field as desired, and pass the struct ifreq now + * to a SIOCSIFGENERIC ioctl. + */ + +#define SPPPIOGDEFS ((caddr_t)(('S' << 24) + (1 << 16) +\ + sizeof(struct sppp_parms))) +#define SPPPIOSDEFS ((caddr_t)(('S' << 24) + (2 << 16) +\ + sizeof(struct sppp_parms))) + +struct spppreq { + int cmd; + struct sppp_parms defs; +}; + +#ifdef _KERNEL +struct sppp { + /* NB: pp_if _must_ be first */ + struct ifnet pp_if; /* network interface data */ + struct ifqueue pp_fastq; /* fast output queue */ + struct ifqueue pp_cpq; /* PPP control protocol queue */ + struct sppp *pp_next; /* next interface in keepalive list */ + u_int pp_mode; /* major protocol modes (cisco/ppp/...) */ + u_int pp_flags; /* sub modes */ + u_short pp_alivecnt; /* keepalive packets counter */ + u_short pp_loopcnt; /* loopback detection counter */ + u_long pp_seq[IDX_COUNT]; /* local sequence number */ + u_long pp_rseq[IDX_COUNT]; /* remote sequence number */ + enum ppp_phase pp_phase; /* phase we're currently in */ + int state[IDX_COUNT]; /* state machine */ + u_char confid[IDX_COUNT]; /* id of last configuration request */ + int rst_counter[IDX_COUNT]; /* restart counter */ + int fail_counter[IDX_COUNT]; /* negotiation failure counter */ + int confflags; /* administrative configuration flags */ +#define CONF_ENABLE_VJ 0x01 /* VJ header compression enabled */ +#define CONF_ENABLE_IPV6 0x02 /* IPv6 administratively enabled */ + time_t pp_last_recv; /* time last packet has been received */ + time_t pp_last_sent; /* time last packet has been sent */ + struct callout_handle ch[IDX_COUNT]; /* per-proto and if callouts */ + struct callout_handle pap_my_to_ch; /* PAP needs one more... */ + struct slcp lcp; /* LCP params */ + struct sipcp ipcp; /* IPCP params */ + struct sipcp ipv6cp; /* IPv6CP params */ + struct sauth myauth; /* auth params, i'm peer */ + struct sauth hisauth; /* auth params, i'm authenticator */ + struct slcompress *pp_comp; /* for VJ compression */ + /* + * These functions are filled in by sppp_attach(), and are + * expected to be used by the lower layer (hardware) drivers + * in order to communicate the (un)availability of the + * communication link. Lower layer drivers that are always + * ready to communicate (like hardware HDLC) can shortcut + * pp_up from pp_tls, and pp_down from pp_tlf. + */ + void (*pp_up)(struct sppp *sp); + void (*pp_down)(struct sppp *sp); + /* + * These functions need to be filled in by the lower layer + * (hardware) drivers if they request notification from the + * PPP layer whether the link is actually required. They + * correspond to the tls and tlf actions. + */ + void (*pp_tls)(struct sppp *sp); + void (*pp_tlf)(struct sppp *sp); + /* + * These (optional) functions may be filled by the hardware + * driver if any notification of established connections + * (currently: IPCP up) is desired (pp_con) or any internal + * state change of the interface state machine should be + * signaled for monitoring purposes (pp_chg). + */ + void (*pp_con)(struct sppp *sp); + void (*pp_chg)(struct sppp *sp, int new_state); + /* These two fields are for use by the lower layer */ + void *pp_lowerp; + int pp_loweri; +}; + +/* bits for pp_flags */ +#define PP_KEEPALIVE 0x01 /* use keepalive protocol */ + /* 0x04 was PP_TIMO */ +#define PP_CALLIN 0x08 /* we are being called */ +#define PP_NEEDAUTH 0x10 /* remote requested authentication */ + +void sppp_attach (struct ifnet *ifp); +void sppp_detach (struct ifnet *ifp); +void sppp_input (struct ifnet *ifp, struct mbuf *m); +int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); +struct mbuf *sppp_dequeue (struct ifnet *ifp); +struct mbuf *sppp_pick(struct ifnet *ifp); +int sppp_isempty (struct ifnet *ifp); +void sppp_flush (struct ifnet *ifp); +#endif + +#endif /* _NET_IF_SPPP_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_stf.h b/newlib/libc/sys/linux/include/net/if_stf.h new file mode 100644 index 000000000..3dbc61a0d --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_stf.h @@ -0,0 +1,38 @@ +/* $FreeBSD: src/sys/net/if_stf.h,v 1.4 2002/04/19 04:46:21 suz Exp $ */ +/* $KAME: if_stf.h,v 1.5 2001/10/12 10:09:17 keiichi Exp $ */ + +/* + * Copyright (C) 2000 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NET_IF_STF_H_ +#define _NET_IF_STF_H_ + +void in_stf_input(struct mbuf *, int); + +#endif /* _NET_IF_STF_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_tap.h b/newlib/libc/sys/linux/include/net/if_tap.h new file mode 100644 index 000000000..14a4a8fd3 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_tap.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 1999-2000 by Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * BASED ON: + * ------------------------------------------------------------------------- + * + * Copyright (c) 1988, Julian Onions + * Nottingham University 1987. + */ + +/* + * $FreeBSD: src/sys/net/if_tap.h,v 1.1 2000/07/20 17:01:10 nsayer Exp $ + * $Id$ + */ + +#ifndef _NET_IF_TAP_H_ +#define _NET_IF_TAP_H_ + +/* refer to if_tapvar.h for the softc stuff */ + +/* maximum receive packet size (hard limit) */ +#define TAPMRU 16384 + +struct tapinfo { + int baudrate; /* linespeed */ + short mtu; /* maximum transmission unit */ + u_char type; /* ethernet, tokenring, etc. */ + u_char dummy; /* place holder */ +}; + +/* ioctl's for get/set debug */ +#define TAPSDEBUG _IOW('t', 90, int) +#define TAPGDEBUG _IOR('t', 89, int) +#define TAPSIFINFO _IOW('t', 91, struct tapinfo) +#define TAPGIFINFO _IOR('t', 92, struct tapinfo) + +/* VMware ioctl's */ +#define VMIO_SIOCSIFFLAGS _IO('V', 0) +#define VMIO_SIOCSKEEP _IO('V', 1) +#define VMIO_SIOCSIFBR _IO('V', 2) +#define VMIO_SIOCSLADRF _IO('V', 3) + +/* XXX -- unimplemented */ +#define VMIO_SIOCSETMACADDR _IO('V', 4) + +/* XXX -- not used? */ +#define VMIO_SIOCPORT _IO('V', 5) +#define VMIO_SIOCBRIDGE _IO('V', 6) +#define VMIO_SIOCNETIF _IO('V', 7) + +#endif /* !_NET_IF_TAP_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_tapvar.h b/newlib/libc/sys/linux/include/net/if_tapvar.h new file mode 100644 index 000000000..d131f085f --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_tapvar.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 1999-2000 by Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * BASED ON: + * ------------------------------------------------------------------------- + * + * Copyright (c) 1998 Brian Somers + * All rights reserved. + * + * Copyright (c) 1988, Julian Onions + * Nottingham University 1987. + */ + +/* + * $FreeBSD: src/sys/net/if_tapvar.h,v 1.4 2001/09/05 01:06:21 brooks Exp $ + * $Id$ + */ + +#ifndef _NET_IF_TAPVAR_H_ +#define _NET_IF_TAPVAR_H_ + +struct tap_softc { + struct arpcom arpcom; /* ethernet common data */ +#define tap_if arpcom.ac_if + struct resource *tap_unit; /* unit */ + + u_short tap_flags; /* misc flags */ +#define TAP_OPEN (1 << 0) +#define TAP_INITED (1 << 1) +#define TAP_RWAIT (1 << 2) +#define TAP_ASYNC (1 << 3) +#define TAP_READY (TAP_OPEN|TAP_INITED) +#define TAP_VMNET (1 << 4) + + u_int8_t ether_addr[ETHER_ADDR_LEN]; /* ether addr of the remote side */ + + pid_t tap_pid; /* PID of process to open */ + struct sigio *tap_sigio; /* information for async I/O */ + struct selinfo tap_rsel; /* read select */ + + SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ +}; + +#endif /* !_NET_IF_TAPVAR_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_tun.h b/newlib/libc/sys/linux/include/net/if_tun.h new file mode 100644 index 000000000..ed98e43fd --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_tun.h @@ -0,0 +1,48 @@ +/* $NetBSD: if_tun.h,v 1.5 1994/06/29 06:36:27 cgd Exp $ */ + +/* + * Copyright (c) 1988, Julian Onions + * Nottingham University 1987. + * + * This source may be freely distributed, however I would be interested + * in any changes that are made. + * + * This driver takes packets off the IP i/f and hands them up to a + * user process to have its wicked way with. This driver has it's + * roots in a similar driver written by Phil Cockcroft (formerly) at + * UCL. This driver is based much more on read/write/select mode of + * operation though. + * + * $FreeBSD: src/sys/net/if_tun.h,v 1.17 2000/01/23 01:47:12 brian Exp $ + */ + +#ifndef _NET_IF_TUN_H_ +#define _NET_IF_TUN_H_ + +/* Refer to if_tunvar.h for the softc stuff */ + +/* Maximum transmit packet size (default) */ +#define TUNMTU 1500 + +/* Maximum receive packet size (hard limit) */ +#define TUNMRU 16384 + +struct tuninfo { + int baudrate; /* linespeed */ + short mtu; /* maximum transmission unit */ + u_char type; /* ethernet, tokenring, etc. */ + u_char dummy; /* place holder */ +}; + +/* ioctl's for get/set debug */ +#define TUNSDEBUG _IOW('t', 90, int) +#define TUNGDEBUG _IOR('t', 89, int) +#define TUNSIFINFO _IOW('t', 91, struct tuninfo) +#define TUNGIFINFO _IOR('t', 92, struct tuninfo) +#define TUNSLMODE _IOW('t', 93, int) +#define TUNSIFMODE _IOW('t', 94, int) +#define TUNSIFPID _IO('t', 95) +#define TUNSIFHEAD _IOW('t', 96, int) +#define TUNGIFHEAD _IOR('t', 97, int) + +#endif /* !_NET_IF_TUN_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_tunvar.h b/newlib/libc/sys/linux/include/net/if_tunvar.h new file mode 100644 index 000000000..b85a25f71 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_tunvar.h @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 1998 Brian Somers + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/net/if_tunvar.h,v 1.9 2001/06/01 15:51:10 brian Exp $ + */ + +#ifndef _NET_IF_TUNVAR_H_ +#define _NET_IF_TUNVAR_H_ + +struct tun_softc { + u_short tun_flags; /* misc flags */ +#define TUN_OPEN 0x0001 +#define TUN_INITED 0x0002 +#define TUN_RCOLL 0x0004 +#define TUN_IASET 0x0008 +#define TUN_DSTADDR 0x0010 +#define TUN_LMODE 0x0020 +#define TUN_RWAIT 0x0040 +#define TUN_ASYNC 0x0080 +#define TUN_IFHEAD 0x0100 + +#define TUN_READY (TUN_OPEN | TUN_INITED) + + pid_t tun_pid; /* PID of process to open */ + struct ifnet tun_if; /* the interface */ + struct sigio *tun_sigio; /* information for async I/O */ + struct selinfo tun_rsel; /* read select */ + struct selinfo tun_wsel; /* write select (not used) */ + + struct tun_softc *next; /* Next softc in list */ + struct resource *r_unit; /* resource allocated for this unit */ +}; + +#endif /* !_NET_IF_TUNVAR_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_types.h b/newlib/libc/sys/linux/include/net/if_types.h new file mode 100644 index 000000000..e24d18875 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_types.h @@ -0,0 +1,251 @@ +/* + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_types.h 8.3 (Berkeley) 4/28/95 + * $FreeBSD: src/sys/net/if_types.h,v 1.13 2001/04/04 14:18:57 yar Exp $ + * $NetBSD: if_types.h,v 1.16 2000/04/19 06:30:53 itojun Exp $ + */ + +#ifndef _NET_IF_TYPES_H_ +#define _NET_IF_TYPES_H_ + +/* + * Interface types for benefit of parsing media address headers. + * This list is derived from the SNMP list of ifTypes, originally + * documented in RFC1573, now maintained as: + * + * ftp.isi.edu/in-notes/iana/assignments/smi-numbers + */ + +#define IFT_OTHER 0x1 /* none of the following */ +#define IFT_1822 0x2 /* old-style arpanet imp */ +#define IFT_HDH1822 0x3 /* HDH arpanet imp */ +#define IFT_X25DDN 0x4 /* x25 to imp */ +#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */ +#define IFT_ETHER 0x6 /* Ethernet CSMA/CD */ +#define IFT_ISO88023 0x7 /* CMSA/CD */ +#define IFT_ISO88024 0x8 /* Token Bus */ +#define IFT_ISO88025 0x9 /* Token Ring */ +#define IFT_ISO88026 0xa /* MAN */ +#define IFT_STARLAN 0xb +#define IFT_P10 0xc /* Proteon 10MBit ring */ +#define IFT_P80 0xd /* Proteon 80MBit ring */ +#define IFT_HY 0xe /* Hyperchannel */ +#define IFT_FDDI 0xf +#define IFT_LAPB 0x10 +#define IFT_SDLC 0x11 +#define IFT_T1 0x12 +#define IFT_CEPT 0x13 /* E1 - european T1 */ +#define IFT_ISDNBASIC 0x14 +#define IFT_ISDNPRIMARY 0x15 +#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */ +#define IFT_PPP 0x17 /* RFC 1331 */ +#define IFT_LOOP 0x18 /* loopback */ +#define IFT_EON 0x19 /* ISO over IP */ +#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */ +#define IFT_NSIP 0x1b /* XNS over IP */ +#define IFT_SLIP 0x1c /* IP over generic TTY */ +#define IFT_ULTRA 0x1d /* Ultra Technologies */ +#define IFT_DS3 0x1e /* Generic T3 */ +#define IFT_SIP 0x1f /* SMDS */ +#define IFT_FRELAY 0x20 /* Frame Relay DTE only */ +#define IFT_RS232 0x21 +#define IFT_PARA 0x22 /* parallel-port */ +#define IFT_ARCNET 0x23 +#define IFT_ARCNETPLUS 0x24 +#define IFT_ATM 0x25 /* ATM cells */ +#define IFT_MIOX25 0x26 +#define IFT_SONET 0x27 /* SONET or SDH */ +#define IFT_X25PLE 0x28 +#define IFT_ISO88022LLC 0x29 +#define IFT_LOCALTALK 0x2a +#define IFT_SMDSDXI 0x2b +#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */ +#define IFT_V35 0x2d +#define IFT_HSSI 0x2e +#define IFT_HIPPI 0x2f +#define IFT_MODEM 0x30 /* Generic Modem */ +#define IFT_AAL5 0x31 /* AAL5 over ATM */ +#define IFT_SONETPATH 0x32 +#define IFT_SONETVT 0x33 +#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */ +#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */ +#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */ +#define IFT_IEEE80212 0x37 /* 100BaseVG */ +#define IFT_FIBRECHANNEL 0x38 /* Fibre Channel */ +#define IFT_HIPPIINTERFACE 0x39 /* HIPPI interfaces */ +#define IFT_FRAMERELAYINTERCONNECT 0x3a /* Obsolete, use either 0x20 or 0x2c */ +#define IFT_AFLANE8023 0x3b /* ATM Emulated LAN for 802.3 */ +#define IFT_AFLANE8025 0x3c /* ATM Emulated LAN for 802.5 */ +#define IFT_CCTEMUL 0x3d /* ATM Emulated circuit */ +#define IFT_FASTETHER 0x3e /* Fast Ethernet (100BaseT) */ +#define IFT_ISDN 0x3f /* ISDN and X.25 */ +#define IFT_V11 0x40 /* CCITT V.11/X.21 */ +#define IFT_V36 0x41 /* CCITT V.36 */ +#define IFT_G703AT64K 0x42 /* CCITT G703 at 64Kbps */ +#define IFT_G703AT2MB 0x43 /* Obsolete see DS1-MIB */ +#define IFT_QLLC 0x44 /* SNA QLLC */ +#define IFT_FASTETHERFX 0x45 /* Fast Ethernet (100BaseFX) */ +#define IFT_CHANNEL 0x46 /* channel */ +#define IFT_IEEE80211 0x47 /* radio spread spectrum */ +#define IFT_IBM370PARCHAN 0x48 /* IBM System 360/370 OEMI Channel */ +#define IFT_ESCON 0x49 /* IBM Enterprise Systems Connection */ +#define IFT_DLSW 0x4a /* Data Link Switching */ +#define IFT_ISDNS 0x4b /* ISDN S/T interface */ +#define IFT_ISDNU 0x4c /* ISDN U interface */ +#define IFT_LAPD 0x4d /* Link Access Protocol D */ +#define IFT_IPSWITCH 0x4e /* IP Switching Objects */ +#define IFT_RSRB 0x4f /* Remote Source Route Bridging */ +#define IFT_ATMLOGICAL 0x50 /* ATM Logical Port */ +#define IFT_DS0 0x51 /* Digital Signal Level 0 */ +#define IFT_DS0BUNDLE 0x52 /* group of ds0s on the same ds1 */ +#define IFT_BSC 0x53 /* Bisynchronous Protocol */ +#define IFT_ASYNC 0x54 /* Asynchronous Protocol */ +#define IFT_CNR 0x55 /* Combat Net Radio */ +#define IFT_ISO88025DTR 0x56 /* ISO 802.5r DTR */ +#define IFT_EPLRS 0x57 /* Ext Pos Loc Report Sys */ +#define IFT_ARAP 0x58 /* Appletalk Remote Access Protocol */ +#define IFT_PROPCNLS 0x59 /* Proprietary Connectionless Protocol*/ +#define IFT_HOSTPAD 0x5a /* CCITT-ITU X.29 PAD Protocol */ +#define IFT_TERMPAD 0x5b /* CCITT-ITU X.3 PAD Facility */ +#define IFT_FRAMERELAYMPI 0x5c /* Multiproto Interconnect over FR */ +#define IFT_X213 0x5d /* CCITT-ITU X213 */ +#define IFT_ADSL 0x5e /* Asymmetric Digital Subscriber Loop */ +#define IFT_RADSL 0x5f /* Rate-Adapt. Digital Subscriber Loop*/ +#define IFT_SDSL 0x60 /* Symmetric Digital Subscriber Loop */ +#define IFT_VDSL 0x61 /* Very H-Speed Digital Subscrib. Loop*/ +#define IFT_ISO88025CRFPINT 0x62 /* ISO 802.5 CRFP */ +#define IFT_MYRINET 0x63 /* Myricom Myrinet */ +#define IFT_VOICEEM 0x64 /* voice recEive and transMit */ +#define IFT_VOICEFXO 0x65 /* voice Foreign Exchange Office */ +#define IFT_VOICEFXS 0x66 /* voice Foreign Exchange Station */ +#define IFT_VOICEENCAP 0x67 /* voice encapsulation */ +#define IFT_VOICEOVERIP 0x68 /* voice over IP encapsulation */ +#define IFT_ATMDXI 0x69 /* ATM DXI */ +#define IFT_ATMFUNI 0x6a /* ATM FUNI */ +#define IFT_ATMIMA 0x6b /* ATM IMA */ +#define IFT_PPPMULTILINKBUNDLE 0x6c /* PPP Multilink Bundle */ +#define IFT_IPOVERCDLC 0x6d /* IBM ipOverCdlc */ +#define IFT_IPOVERCLAW 0x6e /* IBM Common Link Access to Workstn */ +#define IFT_STACKTOSTACK 0x6f /* IBM stackToStack */ +#define IFT_VIRTUALIPADDRESS 0x70 /* IBM VIPA */ +#define IFT_MPC 0x71 /* IBM multi-protocol channel support */ +#define IFT_IPOVERATM 0x72 /* IBM ipOverAtm */ +#define IFT_ISO88025FIBER 0x73 /* ISO 802.5j Fiber Token Ring */ +#define IFT_TDLC 0x74 /* IBM twinaxial data link control */ +#define IFT_GIGABITETHERNET 0x75 /* Gigabit Ethernet */ +#define IFT_HDLC 0x76 /* HDLC */ +#define IFT_LAPF 0x77 /* LAP F */ +#define IFT_V37 0x78 /* V.37 */ +#define IFT_X25MLP 0x79 /* Multi-Link Protocol */ +#define IFT_X25HUNTGROUP 0x7a /* X25 Hunt Group */ +#define IFT_TRANSPHDLC 0x7b /* Transp HDLC */ +#define IFT_INTERLEAVE 0x7c /* Interleave channel */ +#define IFT_FAST 0x7d /* Fast channel */ +#define IFT_IP 0x7e /* IP (for APPN HPR in IP networks) */ +#define IFT_DOCSCABLEMACLAYER 0x7f /* CATV Mac Layer */ +#define IFT_DOCSCABLEDOWNSTREAM 0x80 /* CATV Downstream interface */ +#define IFT_DOCSCABLEUPSTREAM 0x81 /* CATV Upstream interface */ +#define IFT_A12MPPSWITCH 0x82 /* Avalon Parallel Processor */ +#define IFT_TUNNEL 0x83 /* Encapsulation interface */ +#define IFT_COFFEE 0x84 /* coffee pot */ +#define IFT_CES 0x85 /* Circiut Emulation Service */ +#define IFT_ATMSUBINTERFACE 0x86 /* (x) ATM Sub Interface */ +#define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */ +#define IFT_L3IPVLAN 0x88 /* Layer 3 Virtual LAN - IP Protocol */ +#define IFT_L3IPXVLAN 0x89 /* Layer 3 Virtual LAN - IPX Prot. */ +#define IFT_DIGITALPOWERLINE 0x8a /* IP over Power Lines */ +#define IFT_MEDIAMAILOVERIP 0x8b /* (xxx) Multimedia Mail over IP */ +#define IFT_DTM 0x8c /* Dynamic synchronous Transfer Mode */ +#define IFT_DCN 0x8d /* Data Communications Network */ +#define IFT_IPFORWARD 0x8e /* IP Forwarding Interface */ +#define IFT_MSDSL 0x8f /* Multi-rate Symmetric DSL */ +#define IFT_IEEE1394 0x90 /* IEEE1394 High Performance SerialBus*/ +#define IFT_IFGSN 0x91 /* HIPPI-6400 */ +#define IFT_DVBRCCMACLAYER 0x92 /* DVB-RCC MAC Layer */ +#define IFT_DVBRCCDOWNSTREAM 0x93 /* DVB-RCC Downstream Channel */ +#define IFT_DVBRCCUPSTREAM 0x94 /* DVB-RCC Upstream Channel */ +#define IFT_ATMVIRTUAL 0x95 /* ATM Virtual Interface */ +#define IFT_MPLSTUNNEL 0x96 /* MPLS Tunnel Virtual Interface */ +#define IFT_SRP 0x97 /* Spatial Reuse Protocol */ +#define IFT_VOICEOVERATM 0x98 /* Voice over ATM */ +#define IFT_VOICEOVERFRAMERELAY 0x99 /* Voice Over Frame Relay */ +#define IFT_IDSL 0x9a /* Digital Subscriber Loop over ISDN */ +#define IFT_COMPOSITELINK 0x9b /* Avici Composite Link Interface */ +#define IFT_SS7SIGLINK 0x9c /* SS7 Signaling Link */ +#define IFT_PROPWIRELESSP2P 0x9d /* Prop. P2P wireless interface */ +#define IFT_FRFORWARD 0x9e /* Frame forward Interface */ +#define IFT_RFC1483 0x9f /* Multiprotocol over ATM AAL5 */ +#define IFT_USB 0xa0 /* USB Interface */ +#define IFT_IEEE8023ADLAG 0xa1 /* IEEE 802.3ad Link Aggregate*/ +#define IFT_BGPPOLICYACCOUNTING 0xa2 /* BGP Policy Accounting */ +#define IFT_FRF16MFRBUNDLE 0xa3 /* FRF.16 Multilik Frame Relay*/ +#define IFT_H323GATEKEEPER 0xa4 /* H323 Gatekeeper */ +#define IFT_H323PROXY 0xa5 /* H323 Voice and Video Proxy */ +#define IFT_MPLS 0xa6 /* MPLS */ +#define IFT_MFSIGLINK 0xa7 /* Multi-frequency signaling link */ +#define IFT_HDSL2 0xa8 /* High Bit-Rate DSL, 2nd gen. */ +#define IFT_SHDSL 0xa9 /* Multirate HDSL2 */ +#define IFT_DS1FDL 0xaa /* Facility Data Link (4Kbps) on a DS1*/ +#define IFT_POS 0xab /* Packet over SONET/SDH Interface */ +#define IFT_DVBASILN 0xac /* DVB-ASI Input */ +#define IFT_DVBASIOUT 0xad /* DVB-ASI Output */ +#define IFT_PLC 0xae /* Power Line Communications */ +#define IFT_NFAS 0xaf /* Non-Facility Associated Signaling */ +#define IFT_TR008 0xb0 /* TROO8 */ +#define IFT_GR303RDT 0xb1 /* Remote Digital Terminal */ +#define IFT_GR303IDT 0xb2 /* Integrated Digital Terminal */ +#define IFT_ISUP 0xb3 /* ISUP */ +#define IFT_PROPDOCSWIRELESSMACLAYER 0xb4 /* prop/Wireless MAC Layer */ +#define IFT_PROPDOCSWIRELESSDOWNSTREAM 0xb5 /* prop/Wireless Downstream */ +#define IFT_PROPDOCSWIRELESSUPSTREAM 0xb6 /* prop/Wireless Upstream */ +#define IFT_HIPERLAN2 0xb7 /* HIPERLAN Type 2 Radio Interface */ +#define IFT_PROPBWAP2MP 0xb8 /* PropBroadbandWirelessAccess P2MP*/ +#define IFT_SONETOVERHEADCHANNEL 0xb9 /* SONET Overhead Channel */ +#define IFT_DIGITALWRAPPEROVERHEADCHANNEL 0xba /* Digital Wrapper Overhead */ +#define IFT_AAL2 0xbb /* ATM adaptation layer 2 */ +#define IFT_RADIOMAC 0xbc /* MAC layer over radio links */ +#define IFT_ATMRADIO 0xbd /* ATM over radio links */ +#define IFT_IMT 0xbe /* Inter-Machine Trunks */ +#define IFT_MVL 0xbf /* Multiple Virtual Lines DSL */ +#define IFT_REACHDSL 0xc0 /* Long Reach DSL */ +#define IFT_FRDLCIENDPT 0xc1 /* Frame Relay DLCI End Point */ +#define IFT_ATMVCIENDPT 0xc2 /* ATM VCI End Point */ +#define IFT_OPTICALCHANNEL 0xc3 /* Optical Channel */ +#define IFT_OPTICALTRANSPORT 0xc4 /* Optical Transport */ + +/* not based on IANA assignments */ +#define IFT_GIF 0xf0 +#define IFT_PVC 0xf1 +#define IFT_FAITH 0xf2 +#define IFT_STF 0xf3 +#endif /* !_NET_IF_TYPES_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_var.h b/newlib/libc/sys/linux/include/net/if_var.h new file mode 100644 index 000000000..cc53626ba --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_var.h @@ -0,0 +1,469 @@ +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From: @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_var.h,v 1.46 2002/05/07 18:11:55 imp Exp $ + */ + +#ifndef _NET_IF_VAR_H_ +#define _NET_IF_VAR_H_ + +/* + * Structures defining a network interface, providing a packet + * transport mechanism (ala level 0 of the PUP protocols). + * + * Each interface accepts output datagrams of a specified maximum + * length, and provides higher level routines with input datagrams + * received from its medium. + * + * Output occurs when the routine if_output is called, with three parameters: + * (*ifp->if_output)(ifp, m, dst, rt) + * Here m is the mbuf chain to be sent and dst is the destination address. + * The output routine encapsulates the supplied datagram if necessary, + * and then transmits it on its medium. + * + * On input, each interface unwraps the data received by it, and either + * places it on the input queue of a internetwork datagram routine + * and posts the associated software interrupt, or passes the datagram to a raw + * packet input routine. + * + * Routines exist for locating interfaces by their addresses + * or for locating a interface on a certain network, as well as more general + * routing and gateway routines maintaining information used to locate + * interfaces. These routines live in the files if.c and route.c + */ + +#ifdef __STDC__ +/* + * Forward structure declarations for function prototypes [sic]. + */ +struct mbuf; +struct thread; +struct rtentry; +struct rt_addrinfo; +struct socket; +struct ether_header; +#endif + +#include /* get TAILQ macros */ + +#ifdef _KERNEL +#include +#include /* XXX */ +#endif /* _KERNEL */ +#include /* XXX */ +#include /* XXX */ +#include /* XXX */ + +TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ +TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ +TAILQ_HEAD(ifprefixhead, ifprefix); +TAILQ_HEAD(ifmultihead, ifmultiaddr); + +/* + * Structure defining a queue for a network interface. + */ +struct ifqueue { + struct mbuf *ifq_head; + struct mbuf *ifq_tail; + int ifq_len; + int ifq_maxlen; + int ifq_drops; + struct mtx ifq_mtx; +}; + +/* + * Structure defining a network interface. + * + * (Would like to call this struct ``if'', but C isn't PL/1.) + */ + +/* + * NB: For FreeBSD, it is assumed that each NIC driver's softc starts with + * one of these structures, typically held within an arpcom structure. + * + * struct _softc { + * struct arpcom { + * struct ifnet ac_if; + * ... + * } ; + * ... + * }; + * + * The assumption is used in a number of places, including many + * files in sys/net, device drivers, and sys/dev/mii.c:miibus_attach(). + * + * Unfortunately devices' softc are opaque, so we depend on this layout + * to locate the struct ifnet from the softc in the generic code. + * + */ +struct ifnet { + void *if_softc; /* pointer to driver state */ + char *if_name; /* name, e.g. ``en'' or ``lo'' */ + TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ + struct ifaddrhead if_addrhead; /* linked list of addresses per if */ + struct klist if_klist; /* events attached to this if */ + int if_pcount; /* number of promiscuous listeners */ + struct bpf_if *if_bpf; /* packet filter structure */ + u_short if_index; /* numeric abbreviation for this if */ + short if_unit; /* sub-unit for lower level driver */ + short if_timer; /* time 'til if_watchdog called */ + short if_flags; /* up/down, broadcast, etc. */ + int if_capabilities; /* interface capabilities */ + int if_capenable; /* enabled features */ + int if_ipending; /* interrupts pending */ + void *if_linkmib; /* link-type-specific MIB data */ + size_t if_linkmiblen; /* length of above data */ + struct if_data if_data; + struct ifmultihead if_multiaddrs; /* multicast addresses configured */ + int if_amcount; /* number of all-multicast requests */ +/* procedure handles */ + int (*if_output) /* output routine (enqueue) */ + (struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); + void (*if_start) /* initiate output routine */ + (struct ifnet *); + int (*if_done) /* output complete routine */ + (struct ifnet *); /* (XXX not used; fake prototype) */ + int (*if_ioctl) /* ioctl routine */ + (struct ifnet *, u_long, caddr_t); + void (*if_watchdog) /* timer routine */ + (struct ifnet *); + int (*if_poll_recv) /* polled receive routine */ + (struct ifnet *, int *); + int (*if_poll_xmit) /* polled transmit routine */ + (struct ifnet *, int *); + void (*if_poll_intren) /* polled interrupt reenable routine */ + (struct ifnet *); + void (*if_poll_slowinput) /* input routine for slow devices */ + (struct ifnet *, struct mbuf *); + void (*if_init) /* Init routine */ + (void *); + int (*if_resolvemulti) /* validate/resolve multicast */ + (struct ifnet *, struct sockaddr **, struct sockaddr *); + struct ifqueue if_snd; /* output queue */ + struct ifqueue *if_poll_slowq; /* input queue for slow devices */ + struct ifprefixhead if_prefixhead; /* list of prefixes per if */ + u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ +}; + +typedef void if_init_f_t(void *); + +#define if_mtu if_data.ifi_mtu +#define if_type if_data.ifi_type +#define if_physical if_data.ifi_physical +#define if_addrlen if_data.ifi_addrlen +#define if_hdrlen if_data.ifi_hdrlen +#define if_metric if_data.ifi_metric +#define if_baudrate if_data.ifi_baudrate +#define if_hwassist if_data.ifi_hwassist +#define if_ipackets if_data.ifi_ipackets +#define if_ierrors if_data.ifi_ierrors +#define if_opackets if_data.ifi_opackets +#define if_oerrors if_data.ifi_oerrors +#define if_collisions if_data.ifi_collisions +#define if_ibytes if_data.ifi_ibytes +#define if_obytes if_data.ifi_obytes +#define if_imcasts if_data.ifi_imcasts +#define if_omcasts if_data.ifi_omcasts +#define if_iqdrops if_data.ifi_iqdrops +#define if_noproto if_data.ifi_noproto +#define if_lastchange if_data.ifi_lastchange +#define if_recvquota if_data.ifi_recvquota +#define if_xmitquota if_data.ifi_xmitquota +#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0) + +/* for compatibility with other BSDs */ +#define if_addrlist if_addrhead +#define if_list if_link + +/* + * Bit values in if_ipending + */ +#define IFI_RECV 1 /* I want to receive */ +#define IFI_XMIT 2 /* I want to transmit */ + +/* + * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) + * are queues of messages stored on ifqueue structures + * (defined above). Entries are added to and deleted from these structures + * by these macros, which should be called with ipl raised to splimp(). + */ +#define IF_LOCK(ifq) mtx_lock(&(ifq)->ifq_mtx) +#define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx) +#define _IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) +#define _IF_DROP(ifq) ((ifq)->ifq_drops++) +#define _IF_QLEN(ifq) ((ifq)->ifq_len) + +#define _IF_ENQUEUE(ifq, m) do { \ + (m)->m_nextpkt = NULL; \ + if ((ifq)->ifq_tail == NULL) \ + (ifq)->ifq_head = m; \ + else \ + (ifq)->ifq_tail->m_nextpkt = m; \ + (ifq)->ifq_tail = m; \ + (ifq)->ifq_len++; \ +} while (0) + +#define IF_ENQUEUE(ifq, m) do { \ + IF_LOCK(ifq); \ + _IF_ENQUEUE(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define _IF_PREPEND(ifq, m) do { \ + (m)->m_nextpkt = (ifq)->ifq_head; \ + if ((ifq)->ifq_tail == NULL) \ + (ifq)->ifq_tail = (m); \ + (ifq)->ifq_head = (m); \ + (ifq)->ifq_len++; \ +} while (0) + +#define IF_PREPEND(ifq, m) do { \ + IF_LOCK(ifq); \ + _IF_PREPEND(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define _IF_DEQUEUE(ifq, m) do { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ + (ifq)->ifq_tail = NULL; \ + (m)->m_nextpkt = NULL; \ + (ifq)->ifq_len--; \ + } \ +} while (0) + +#define IF_DEQUEUE(ifq, m) do { \ + IF_LOCK(ifq); \ + _IF_DEQUEUE(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define IF_DRAIN(ifq) do { \ + struct mbuf *m; \ + IF_LOCK(ifq); \ + for (;;) { \ + _IF_DEQUEUE(ifq, m); \ + if (m == NULL) \ + break; \ + m_freem(m); \ + } \ + IF_UNLOCK(ifq); \ +} while (0) + +#ifdef _KERNEL +#define IF_HANDOFF(ifq, m, ifp) if_handoff(ifq, m, ifp, 0) +#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) if_handoff(ifq, m, ifp, adj) + +static __inline int +if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust) +{ + int active = 0; + + IF_LOCK(ifq); + if (_IF_QFULL(ifq)) { + _IF_DROP(ifq); + IF_UNLOCK(ifq); + m_freem(m); + return (0); + } + if (ifp != NULL) { + ifp->if_obytes += m->m_pkthdr.len + adjust; + if (m->m_flags & M_MCAST) + ifp->if_omcasts++; + active = ifp->if_flags & IFF_OACTIVE; + } + _IF_ENQUEUE(ifq, m); + IF_UNLOCK(ifq); + if (ifp != NULL && !active) + (*ifp->if_start)(ifp); + return (1); +} + +/* + * 72 was chosen below because it is the size of a TCP/IP + * header (40) + the minimum mss (32). + */ +#define IF_MINMTU 72 +#define IF_MAXMTU 65535 + +#endif /* _KERNEL */ + +/* + * The ifaddr structure contains information about one address + * of an interface. They are maintained by the different address families, + * are allocated and attached when an address is set, and are linked + * together so all addresses for an interface can be located. + */ +struct ifaddr { + struct sockaddr *ifa_addr; /* address of interface */ + struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ + struct sockaddr *ifa_netmask; /* used to determine subnet */ + struct if_data if_data; /* not all members are meaningful */ + struct ifnet *ifa_ifp; /* back-pointer to interface */ + TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ + void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ + (int, struct rtentry *, struct rt_addrinfo *); + u_short ifa_flags; /* mostly rt_flags for cloning */ + u_int ifa_refcnt; /* references to this structure */ + int ifa_metric; /* cost of going out this interface */ +#ifdef notdef + struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */ +#endif + int (*ifa_claim_addr) /* check if an addr goes to this if */ + (struct ifaddr *, struct sockaddr *); + +}; +#define IFA_ROUTE RTF_UP /* route installed */ + +/* for compatibility with other BSDs */ +#define ifa_list ifa_link + +/* + * The prefix structure contains information about one prefix + * of an interface. They are maintained by the different address families, + * are allocated and attached when an prefix or an address is set, + * and are linked together so all prefixes for an interface can be located. + */ +struct ifprefix { + struct sockaddr *ifpr_prefix; /* prefix of interface */ + struct ifnet *ifpr_ifp; /* back-pointer to interface */ + TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */ + u_char ifpr_plen; /* prefix length in bits */ + u_char ifpr_type; /* protocol dependent prefix type */ +}; + +/* + * Multicast address structure. This is analogous to the ifaddr + * structure except that it keeps track of multicast addresses. + * Also, the reference count here is a count of requests for this + * address, not a count of pointers to this structure. + */ +struct ifmultiaddr { + TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ + struct sockaddr *ifma_addr; /* address this membership is for */ + struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ + struct ifnet *ifma_ifp; /* back-pointer to interface */ + u_int ifma_refcount; /* reference count */ + void *ifma_protospec; /* protocol-specific state, if any */ +}; + +#ifdef _KERNEL +#define IFAFREE(ifa) \ + do { \ + if ((ifa)->ifa_refcnt <= 0) \ + ifafree(ifa); \ + else \ + (ifa)->ifa_refcnt--; \ + } while (0) + +struct ifindex_entry { + struct ifnet *ife_ifnet; + struct ifaddr *ife_ifnet_addr; + dev_t ife_dev; +}; + +#define ifnet_byindex(idx) ifindex_table[(idx)].ife_ifnet +#define ifaddr_byindex(idx) ifindex_table[(idx)].ife_ifnet_addr +#define ifdev_byindex(idx) ifindex_table[(idx)].ife_dev + +extern struct ifnethead ifnet; +extern struct ifindex_entry *ifindex_table; +extern int ifqmaxlen; +extern struct ifnet *loif; /* first loopback interface */ +extern int if_index; + +void ether_ifattach(struct ifnet *, int); +void ether_ifdetach(struct ifnet *, int); +void ether_input(struct ifnet *, struct ether_header *, struct mbuf *); +void ether_demux(struct ifnet *, struct ether_header *, struct mbuf *); +int ether_output(struct ifnet *, + struct mbuf *, struct sockaddr *, struct rtentry *); +int ether_output_frame(struct ifnet *, struct mbuf *); +int ether_ioctl(struct ifnet *, int, caddr_t); + +int if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **); +int if_allmulti(struct ifnet *, int); +void if_attach(struct ifnet *); +int if_delmulti(struct ifnet *, struct sockaddr *); +void if_detach(struct ifnet *); +void if_down(struct ifnet *); +void if_route(struct ifnet *, int flag, int fam); +int if_setlladdr(struct ifnet *, const u_char *, int); +void if_unroute(struct ifnet *, int flag, int fam); +void if_up(struct ifnet *); +/*void ifinit(void);*/ /* declared in systm.h for main() */ +int ifioctl(struct socket *, u_long, caddr_t, struct thread *); +int ifpromisc(struct ifnet *, int); +struct ifnet *ifunit(const char *); +struct ifnet *if_withname(struct sockaddr *); + +int if_poll_recv_slow(struct ifnet *ifp, int *quotap); +void if_poll_xmit_slow(struct ifnet *ifp, int *quotap); +void if_poll_throttle(void); +void if_poll_unthrottle(void *); +void if_poll_init(void); +void if_poll(void); + +struct ifaddr *ifa_ifwithaddr(struct sockaddr *); +struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *); +struct ifaddr *ifa_ifwithnet(struct sockaddr *); +struct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *); +struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *); +void ifafree(struct ifaddr *); + +struct ifmultiaddr *ifmaof_ifpforaddr(struct sockaddr *, struct ifnet *); +int if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen); + +void if_clone_attach(struct if_clone *); +void if_clone_detach(struct if_clone *); + +int if_clone_create(char *, int); +int if_clone_destroy(const char *); + +#define IF_LLADDR(ifp) \ + LLADDR((struct sockaddr_dl *) ifaddr_byindex((ifp)->if_index)->ifa_addr) + +#ifdef DEVICE_POLLING +enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS, POLL_DEREGISTER }; + +typedef void poll_handler_t(struct ifnet *ifp, enum poll_cmd cmd, int count); +int ether_poll_register(poll_handler_t *h, struct ifnet *ifp); +int ether_poll_deregister(struct ifnet *ifp); +#endif /* DEVICE_POLLING */ + +#endif /* _KERNEL */ + +#endif /* !_NET_IF_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_vlan_var.h b/newlib/libc/sys/linux/include/net/if_vlan_var.h new file mode 100644 index 000000000..249543b66 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_vlan_var.h @@ -0,0 +1,82 @@ +/* + * Copyright 1998 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/net/if_vlan_var.h,v 1.11 2002/03/11 09:26:07 mux Exp $ + */ + +#ifndef _NET_IF_VLAN_VAR_H_ +#define _NET_IF_VLAN_VAR_H_ 1 + +#ifdef _KERNEL +struct vlan_mc_entry { + struct ether_addr mc_addr; + SLIST_ENTRY(vlan_mc_entry) mc_entries; +}; + +struct ifvlan { + struct arpcom ifv_ac; /* make this an interface */ + struct ifnet *ifv_p; /* parent inteface of this vlan */ + struct ifv_linkmib { + int ifvm_parent; + u_int16_t ifvm_proto; /* encapsulation ethertype */ + u_int16_t ifvm_tag; /* tag to apply on packets leaving if */ + } ifv_mib; + SLIST_HEAD(__vlan_mchead, vlan_mc_entry) vlan_mc_listhead; + LIST_ENTRY(ifvlan) ifv_list; +}; +#define ifv_if ifv_ac.ac_if +#define ifv_tag ifv_mib.ifvm_tag +#endif /* _KERNEL */ + +struct ether_vlan_header { + u_char evl_dhost[ETHER_ADDR_LEN]; + u_char evl_shost[ETHER_ADDR_LEN]; + u_int16_t evl_encap_proto; + u_int16_t evl_tag; + u_int16_t evl_proto; +}; + +#define EVL_VLANOFTAG(tag) ((tag) & 4095) +#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7) +#define EVL_ENCAPLEN 4 /* length in octets of encapsulation */ + +/* sysctl(3) tags, for compatibility purposes */ +#define VLANCTL_PROTO 1 +#define VLANCTL_MAX 2 + +/* + * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls. + */ +struct vlanreq { + char vlr_parent[IFNAMSIZ]; + u_short vlr_tag; +}; +#define SIOCSETVLAN SIOCSIFGENERIC +#define SIOCGETVLAN SIOCGIFGENERIC + +#endif /* _NET_IF_VLAN_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/net/intrq.h b/newlib/libc/sys/linux/include/net/intrq.h new file mode 100644 index 000000000..68e2e4afe --- /dev/null +++ b/newlib/libc/sys/linux/include/net/intrq.h @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2000 Brian Somers + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/net/intrq.h,v 1.4 2002/03/19 21:54:18 alfred Exp $ + */ + +#ifndef _NET_INTRQ_H_ +#define _NET_INTRQ_H_ + +#ifdef _KERNEL +extern int atintrq1_present; +extern int atintrq2_present; +extern int atmintrq_present; +extern int ipintrq_present; +extern int ip6intrq_present; +extern int ipxintrq_present; +extern int natmintrq_present; +extern int nsintrq_present; + +extern int family_enqueue(sa_family_t, struct mbuf *); +#endif + +#endif /* _NET_INTRQ_H_ */ diff --git a/newlib/libc/sys/linux/include/net/iso88025.h b/newlib/libc/sys/linux/include/net/iso88025.h new file mode 100644 index 000000000..898fc1c3d --- /dev/null +++ b/newlib/libc/sys/linux/include/net/iso88025.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 1998, Larry Lile + * All rights reserved. + * + * For latest sources and information on this driver, please + * go to http://anarchy.stdio.com. + * + * Questions, comments or suggestions should be directed to + * Larry Lile . + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/net/iso88025.h,v 1.7 2002/05/08 01:08:26 kbyanc Exp $ + * + * Information gathered from tokenring@freebsd, /sys/net/ethernet.h and + * the Mach token ring driver. + */ + +/* + * Fundamental constants relating to iso 802.5 + */ + +#ifndef _NET_ISO88025_H_ +#define _NET_ISO88025_H_ + +/* + * General ISO 802.5 definitions + */ +#define ISO88025_ADDR_LEN 6 +#define ISO88025_HDR_LEN (ISO88025_CF_LEN + (ISO88025_ADDR_LEN * 2)) +#define ISO88025_CF_LEN 2 +#define RCF_LEN 2 +#define RIF_MAX_RD 14 +#define RIF_MAX_LEN 16 + +#define TR_AC 0x10 +#define TR_LLC_FRAME 0x40 + +#define TR_4MBPS 4000000 +#define TR_16MBPS 16000000 +#define TR_100MBPS 100000000 + +/* + * Source routing + */ +#define TR_RII 0x80 +#define TR_RCF_BCST_MASK 0xe000 +#define TR_RCF_LEN_MASK 0x1f00 +#define TR_RCF_DIR 0x0080 +#define TR_RCF_LF_MASK 0x0070 + +#define TR_RCF_RIFLEN(x) ((ntohs(x) & TR_RCF_LEN_MASK) >> 8) + +/* + * Minimum and maximum packet payload lengths. + */ +#define ISO88025_MIN_LEN 0 +#define ISO88025_MAX_LEN_4 4464 +#define ISO88025_MAX_LEN_16 17960 +#define ISO88025_MAX_LEN ISO88025_MAX_LEN_16 + +/* + * A macro to validate a length with + */ +#define ISO88025_IS_VALID_LEN(foo) \ + ((foo) >= ISO88025_MIN_LEN && (foo) <= ISO88025_MAX_LEN) + +/* + * ISO 802.5 physical header + */ +struct iso88025_header { + u_int8_t ac; /* access control field */ + u_int8_t fc; /* frame control field */ + u_int8_t iso88025_dhost[ISO88025_ADDR_LEN]; /* destination address */ + u_int8_t iso88025_shost[ISO88025_ADDR_LEN]; /* source address */ + u_int16_t rcf; /* route control field */ + u_int16_t rd[RIF_MAX_RD]; /* routing designators */ +} __attribute__ ((__packed__)); + +struct iso88025_rif { + u_int16_t rcf; /* route control field */ + u_int16_t rd[RIF_MAX_RD]; /* routing designators */ +} __attribute__ ((__packed__)); + +struct iso88025_sockaddr_data { + u_char ether_dhost[ISO88025_ADDR_LEN]; + u_char ether_shost[ISO88025_ADDR_LEN]; + u_char ac; + u_char fc; +}; + +struct iso88025_sockaddr_dl_data { + u_short trld_rcf; + u_short *trld_route[RIF_MAX_LEN]; +}; + +#define ISO88025_MIN(a, b) (((a)<(b))?(a):(b)) +#define SDL_ISO88025(s) ((struct iso88025_sockaddr_dl_data *) \ + ((s)->sdl_data + \ + ISO88025_MIN((s)->sdl_nlen + (s)->sdl_alen + \ + (s)->sdl_slen, 12))) + +/* + * Structure of a 48-bit iso 802.5 address. + * ( We could also add the 16 bit addresses as a union) + */ +struct iso88025_addr { + u_char octet[ISO88025_ADDR_LEN]; +}; + +#define ISO88025_MAX_MTU 18000 +#define ISO88025_DEFAULT_MTU 1500 +#define senderr(e) { error = (e); goto bad;} + +void iso88025_ifattach (struct ifnet *); +void iso88025_ifdetach (struct ifnet *, int); +int iso88025_ioctl (struct ifnet *, int , caddr_t ); +int iso88025_output (struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); +void iso88025_input (struct ifnet *, struct iso88025_header *, + struct mbuf *); + +#endif diff --git a/newlib/libc/sys/linux/include/net/net_osdep.h b/newlib/libc/sys/linux/include/net/net_osdep.h new file mode 100644 index 000000000..19c4b1a4a --- /dev/null +++ b/newlib/libc/sys/linux/include/net/net_osdep.h @@ -0,0 +1,343 @@ +/* $FreeBSD: src/sys/net/net_osdep.h,v 1.8 2002/04/19 04:46:21 suz Exp $ */ +/* $KAME: net_osdep.h,v 1.68 2001/12/21 08:14:58 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * glue for kernel code programming differences. + */ + +/* + * OS dependencies: + * - ioctl + * FreeBSD 3 and later warn when sys/ioctl.h is included in a kernel source + * file. For socket ioctl, we are suggested to use sys/sockio.h. + * + * - RTFREE() + * bsdi does not escape this macro using do-clause, so it is recommended + * to escape the macro explicitly. + * e.g. + * if (rt) { + * RTFREE(rt); + * } + * + * - whether the IPv4 input routine convert the byte order of some fileds + * of the IP header (x: convert to the host byte order, s: strip the header + * length for possible reassembly) + * ip_len ip_id ip_off + * bsdi3: xs x x + * bsdi4: xs x + * freebsd[23]: xs x x + * freebsd4: xs x + * NetBSD: x x + * OpenBSD: xs x x + * + * - ifa_ifwithaf() + * bsdi[34], netbsd, and openbsd define it in sys/net/if.c + * freebsd (all versions) does not have it. + * + * - struct rt_addrinfo + * bsdi4, netbsd 1.5R and beyond: rti_addrs, rti_info[], rti_flags, rti_ifa, + * rti_ifp, and rti_rtm. + * others: rti_addrs and rti_info[] only. + * + * - ifa->ifa_rtrequest + * bsdi4, netbsd 1.5R and beyond: rt_addrinfo * + * others: sockaddr * (note that sys/net/route.c:rtrequest() has an unsafe + * typecast code, from 4.3BSD-reno) + * + * - side effects of rtrequest{,1}(RTM_DELETE) + * BSDI[34]: delete all cloned routes underneath the route. + * FreeBSD[234]: delete all protocol-cloned routes underneath the route. + * note that cloned routes from an interface direct route + * still remain. + * NetBSD: 1.5 have no side effects. KAME/netbsd15, and post-1.5R, have + * the same effects as of BSDI. + * OpenBSD: have no side effects. KAME/openbsd has the same effects as + * of BSDI (the change is not merged - yet). + * + * - privileged process + * NetBSD, FreeBSD 3 + * struct proc *p; + * if (p && !suser(p->p_ucred, &p->p_acflag)) + * privileged; + * FreeBSD 4 + * struct proc *p; + * if (p && !suser(p)) + * privileged; + * FreeBSD 5 + * struct thread *td; + * if (suser(td)) + * privileged; + * OpenBSD, BSDI [34], FreeBSD 2 + * struct socket *so; + * if (so->so_state & SS_PRIV) + * privileged; + * - foo_control + * NetBSD, FreeBSD 3 + * needs to give struct proc * as argument + * OpenBSD, BSDI [34], FreeBSD 2 + * do not need struct proc * + * + * - bpf: + * OpenBSD, NetBSD 1.5, BSDI [34] + * need caddr_t * (= if_bpf **) and struct ifnet * + * FreeBSD 2, FreeBSD 3, NetBSD post-1.5N + * need only struct ifnet * as argument + * + * - struct ifnet + * use queue.h? member names if name + * --- --- --- + * FreeBSD 2 no old standard if_name+unit + * FreeBSD 3 yes strange if_name+unit + * OpenBSD yes standard if_xname + * NetBSD yes standard if_xname + * BSDI [34] no old standard if_name+unit + * + * - usrreq + * NetBSD, OpenBSD, BSDI [34], FreeBSD 2 + * single function with PRU_xx, arguments are mbuf + * FreeBSD 3 + * separates functions, non-mbuf arguments + * + * - {set,get}sockopt + * NetBSD, OpenBSD, BSDI [34], FreeBSD 2 + * manipulation based on mbuf + * FreeBSD 3 + * non-mbuf manipulation using sooptcopy{in,out}() + * + * - timeout() and untimeout() + * NetBSD 1.4.x, OpenBSD, BSDI [34], FreeBSD 2 + * timeout() is a void function + * FreeBSD 3 + * timeout() is non-void, must keep returned value for untimeout() + * callout_xx is also available (sys/callout.h) + * NetBSD 1.5 + * timeout() is obsoleted, use callout_xx (sys/callout.h) + * OpenBSD 2.8 + * timeout_{add,set,del} is encouraged (sys/timeout.h) + * + * - kernel internal time structure + * FreeBSD 2, NetBSD, OpenBSD, BSD/OS + * mono_time.tv_u?sec, time.tv_u?sec + * FreeBSD [34] + * time_second + * if you need portability, #ifdef out FreeBSD[34], or use microtime(&tv) + * then touch tv.tv_sec (note: microtime is an expensive operation). + * + * - sysctl + * NetBSD, OpenBSD + * foo_sysctl() + * BSDI [34] + * foo_sysctl() but with different style. sysctl_int_arr() takes + * care of most of the cases. + * FreeBSD + * linker hack. however, there are freebsd version differences + * (how wonderful!). + * on FreeBSD[23] function arg #define includes paren. + * int foo SYSCTL_HANDLER_ARGS; + * on FreeBSD4, function arg #define does not include paren. + * int foo(SYSCTL_HANDLER_ARGS); + * on some versions, forward reference to the tree is okay. + * on some versions, you need SYSCTL_DECL(). you need things + * like this. + * #ifdef SYSCTL_DECL + * SYSCTL_DECL(net_inet_ip6); + * #endif + * it is hard to share functions between freebsd and non-freebsd. + * + * - if_ioctl + * NetBSD, FreeBSD 3, BSDI [34] + * 2nd argument is u_long cmd + * FreeBSD 2 + * 2nd argument is int cmd + * + * - if attach routines + * NetBSD + * void xxattach(int); + * FreeBSD 2, FreeBSD 3 + * void xxattach(void *); + * PSEUDO_SET(xxattach, if_xx); + * + * - ovbcopy() + * in NetBSD 1.4 or later, ovbcopy() is not supplied in the kernel. + * we have updated sys/systm.h to include declaration. + * + * - splnet() + * NetBSD 1.4 or later requires splsoftnet(). + * other operating systems use splnet(). + * + * - splimp() + * NetBSD-current (2001/4/13): use splnet() in network, splvm() in vm. + * other operating systems: use splimp(). + * + * - dtom() + * NEVER USE IT! + * + * - struct ifnet for loopback interface + * BSDI3: struct ifnet loif; + * BSDI4: struct ifnet *loifp; + * NetBSD, OpenBSD 2.8, FreeBSD2: struct ifnet loif[NLOOP]; + * OpenBSD 2.9: struct ifnet *lo0ifp; + * + * odd thing is that many of them refers loif as ifnet *loif, + * not loif[NLOOP], from outside of if_loop.c. + * + * - number of bpf pseudo devices + * others: bpfilter.h, NBPFILTER + * FreeBSD4: bpf.h, NBPF + * solution: + * #if defined(__FreeBSD__) && __FreeBSD__ >= 4 + * #include "bpf.h" + * #define NBPFILTER NBPF + * #else + * #include "bpfilter.h" + * #endif + * + * - protosw for IPv4 (sys/netinet) + * FreeBSD4: struct ipprotosw in netinet/ipprotosw.h + * others: struct protosw in sys/protosw.h + * + * - protosw in general. + * NetBSD 1.5 has extra member for ipfilter (netbsd-current dropped + * it so it will go away in 1.6). + * NetBSD 1.5 requires PR_LISTEN flag bit with protocols that permit + * listen/accept (like tcp). + * + * - header files with defopt (opt_xx.h) + * FreeBSD3: opt_{inet,ipsec,ip6fw,altq}.h + * FreeBSD4: opt_{inet,inet6,ipsec,ip6fw,altq}.h + * NetBSD: opt_{inet,ipsec,altq}.h + * others: does not use defopt + * + * - IN_MULTICAST/IN_CLASS[A-D] macro. + * OpenBSD and NetBSD: net endian (kernel) or host endian (userland) + * others: always host endian + * + * - (m->m_flags & M_EXT) != 0 does *not* mean that the max data length of + * the mbuf == MCLBYTES. + * + * - sys/kern/uipc_mbuf.c:m_dup() + * freebsd[34]: copies the whole mbuf chain. + * netbsd: similar arg with m_copym(). + * others: no m_dup(). + * + * - ifa_refcnt (struct ifaddr) management (IFAREF/IFAFREE). + * NetBSD 1.5: always use IFAREF whenever reference gets added. + * always use IFAFREE whenever reference gets freed. + * IFAFREE frees ifaddr when ifa_refcnt reaches 0. + * others: do not increase refcnt for ifp->if_addrlist and in_ifaddr. + * use IFAFREE once when ifaddr is disconnected from + * ifp->if_addrlist and in_ifaddr. IFAFREE frees ifaddr when + * ifa_refcnt goes negative. in KAME environment, IFAREF is + * provided as a compatibility wrapper (use it instead of + * ifa_refcnt++ to reduce #ifdef). + * + * - ifnet.if_lastchange + * freebsd, bsdi, netbsd-current (jun 14 2001-), + * openbsd-current (jun 15 2001-): updated only when IFF_UP changes. + * (RFC1573 ifLastChange interpretation) + * netbsd151, openbsd29: updated whenever packets go through the interface. + * (4.4BSD interpretation) + * + * - kernel compilation options ("options HOGE" in kernel config file) + * freebsd4: sys/conf/options has to have mapping between option + * and a header file (opt_hoge.h). + * netbsd: by default, -DHOGE will go into + * sys/arch/foo/compile/BAR/Makefile. + * if you define mapping in sys/conf/files, you can create + * a header file like opt_hoge.h to help make dependencies. + * bsdi/openbsd: always use -DHOGE in Makefile. there's no need/way + * to have opt_hoge.h. + * + * therefore, opt_hoge.h is mandatory on freebsd4 only. + * + * - MALLOC() macro + * Use it only if the size of the allocation is constant. + * When we do NOT collect statistics about kernel memory usage, the result + * of macro expansion contains a large set of condition branches. If the + * size is not constant, compilation optimization cannot be applied, and + * a bunch of the large branch will be embedded in the kernel code. + * + * - M_COPY_PKTHDR + * openbsd30: M_COPY_PKTHDR is deprecated. use M_MOVE_PKTHDR or + * M_DUP_PKTHDR, depending on how you want to handle m_tag. + * others: M_COPY_PKTHDR is available as usual. + */ + +#ifndef __NET_NET_OSDEP_H_DEFINED_ +#define __NET_NET_OSDEP_H_DEFINED_ +#ifdef _KERNEL + +struct ifnet; +extern const char *if_name(struct ifnet *); + +#define HAVE_OLD_BPF + +#define ifa_list ifa_link +#define if_addrlist if_addrhead +#define if_list if_link + +/* sys/net/if.h */ +#define IFAREF(ifa) do { ++(ifa)->ifa_refcnt; } while (0) + +#define WITH_CONVERT_AND_STRIP_IP_LEN + +#if 1 /* at this moment, all OSes do this */ +#define WITH_CONVERT_IP_OFF +#endif + +/* + * Deprecated. + */ +#include +#define PSEUDO_SET(sym, name) \ + static int name ## _modevent(module_t mod, int type, void *data) \ + { \ + void (*initfunc)(void *) = (void (*)(void *))data; \ + switch (type) { \ + case MOD_LOAD: \ + /* printf(#name " module load\n"); */ \ + initfunc(NULL); \ + break; \ + case MOD_UNLOAD: \ + printf(#name " module unload - not possible for this module type\n"); \ + return EINVAL; \ + } \ + return 0; \ + } \ + static moduledata_t name ## _mod = { \ + #name, \ + name ## _modevent, \ + (void *)sym \ + }; \ + DECLARE_MODULE(name, name ## _mod, SI_SUB_PSEUDO, SI_ORDER_ANY) + +#endif /*_KERNEL*/ +#endif /*__NET_NET_OSDEP_H_DEFINED_ */ diff --git a/newlib/libc/sys/linux/include/net/netisr.h b/newlib/libc/sys/linux/include/net/netisr.h new file mode 100644 index 000000000..717e77bf2 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/netisr.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 1980, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)netisr.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/netisr.h,v 1.26 2002/03/19 21:54:18 alfred Exp $ + */ + +#ifndef _NET_NETISR_H_ +#define _NET_NETISR_H_ + +/* + * The networking code runs off software interrupts. + * + * You can switch into the network by doing splnet() and return by splx(). + * The software interrupt level for the network is higher than the software + * level for the clock (so you can enter the network in routines called + * at timeout time). + */ + +/* + * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status + * word which is used to de-multiplex a single software + * interrupt used for scheduling the network code to calls + * on the lowest level routine of each protocol. + */ +#define NETISR_POLL 0 /* polling callback, must be first */ +#define NETISR_IP 2 /* same as AF_INET */ +#define NETISR_NS 6 /* same as AF_NS */ +#define NETISR_ATALK 16 /* same as AF_APPLETALK */ +#define NETISR_ARP 18 /* same as AF_LINK */ +#define NETISR_IPX 23 /* same as AF_IPX */ +#define NETISR_USB 25 /* USB soft interrupt */ +#define NETISR_PPP 27 /* PPP soft interrupt */ +#define NETISR_IPV6 28 /* same as AF_INET6 */ +#define NETISR_NATM 29 /* same as AF_NATM */ +#define NETISR_ATM 30 /* same as AF_ATM */ +#define NETISR_NETGRAPH 31 /* same as AF_NETGRAPH */ + + +#ifndef LOCORE +#ifdef _KERNEL + +void legacy_setsoftnet(void); + +extern volatile unsigned int netisr; /* scheduling bits for network */ +extern void (*netisrs[32])(void); +#define schednetisr(anisr) do { \ + atomic_set_rel_int(&netisr, 1 << (anisr)); \ + legacy_setsoftnet(); \ +} while (0) + +typedef void netisr_t(void); + +int register_netisr(int, netisr_t *); +int unregister_netisr(int); + +#endif +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/net/pfil.h b/newlib/libc/sys/linux/include/net/pfil.h new file mode 100644 index 000000000..48ed4b779 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/pfil.h @@ -0,0 +1,80 @@ +/* $FreeBSD: src/sys/net/pfil.h,v 1.9 2002/03/24 09:34:04 bde Exp $ */ + +/* + * Copyright (c) 1996 Matthew R. Green + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NET_PFIL_H_ +#define _NET_PFIL_H_ + +#include + +struct mbuf; +struct ifnet; + +/* + * The packet filter hooks are designed for anything to call them to + * possibly intercept the packet. + */ +struct packet_filter_hook { + TAILQ_ENTRY(packet_filter_hook) pfil_link; + int (*pfil_func)(void *, int, struct ifnet *, int, struct mbuf **); + int pfil_flags; +}; + +#define PFIL_IN 0x00000001 +#define PFIL_OUT 0x00000002 +#define PFIL_WAITOK 0x00000004 +#define PFIL_ALL (PFIL_IN|PFIL_OUT) + +typedef TAILQ_HEAD(pfil_list, packet_filter_hook) pfil_list_t; + +struct pfil_head { + pfil_list_t ph_in; + pfil_list_t ph_out; + int ph_init; +}; + +struct packet_filter_hook *pfil_hook_get(int, struct pfil_head *); +int pfil_add_hook(int (*func)(void *, int, + struct ifnet *, int, struct mbuf **), int, struct pfil_head *); +int pfil_remove_hook(int (*func)(void *, int, + struct ifnet *, int, struct mbuf **), int, struct pfil_head *); + +/* XXX */ +#if defined(_KERNEL) && !defined(KLD_MODULE) +#include "opt_ipfilter.h" +#endif + +#if IPFILTER > 0 +#ifdef PFIL_HOOKS +#undef PFIL_HOOKS +#endif +#define PFIL_HOOKS +#endif /* IPFILTER */ + +#endif /* _NET_PFIL_H_ */ diff --git a/newlib/libc/sys/linux/include/net/pfkeyv2.h b/newlib/libc/sys/linux/include/net/pfkeyv2.h new file mode 100644 index 000000000..229ef716c --- /dev/null +++ b/newlib/libc/sys/linux/include/net/pfkeyv2.h @@ -0,0 +1,392 @@ +/* $FreeBSD: src/sys/net/pfkeyv2.h,v 1.7 2001/08/06 19:39:59 ume Exp $ */ +/* $KAME: pfkeyv2.h,v 1.26 2001/06/27 10:49:49 sakane Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This file has been derived rfc 2367, + * And added some flags of SADB_KEY_FLAGS_ as SADB_X_EXT_. + * sakane@ydc.co.jp + */ + +#ifndef _NET_PFKEYV2_H_ +#define _NET_PFKEYV2_H_ + +/* +This file defines structures and symbols for the PF_KEY Version 2 +key management interface. It was written at the U.S. Naval Research +Laboratory. This file is in the public domain. The authors ask that +you leave this credit intact on any copies of this file. +*/ +#ifndef __PFKEY_V2_H +#define __PFKEY_V2_H 1 + +#define PF_KEY_V2 2 +#define PFKEYV2_REVISION 199806L + +#define SADB_RESERVED 0 +#define SADB_GETSPI 1 +#define SADB_UPDATE 2 +#define SADB_ADD 3 +#define SADB_DELETE 4 +#define SADB_GET 5 +#define SADB_ACQUIRE 6 +#define SADB_REGISTER 7 +#define SADB_EXPIRE 8 +#define SADB_FLUSH 9 +#define SADB_DUMP 10 +#define SADB_X_PROMISC 11 +#define SADB_X_PCHANGE 12 + +#define SADB_X_SPDUPDATE 13 +#define SADB_X_SPDADD 14 +#define SADB_X_SPDDELETE 15 /* by policy index */ +#define SADB_X_SPDGET 16 +#define SADB_X_SPDACQUIRE 17 +#define SADB_X_SPDDUMP 18 +#define SADB_X_SPDFLUSH 19 +#define SADB_X_SPDSETIDX 20 +#define SADB_X_SPDEXPIRE 21 +#define SADB_X_SPDDELETE2 22 /* by policy id */ +#define SADB_MAX 22 + +struct sadb_msg { + u_int8_t sadb_msg_version; + u_int8_t sadb_msg_type; + u_int8_t sadb_msg_errno; + u_int8_t sadb_msg_satype; + u_int16_t sadb_msg_len; + u_int16_t sadb_msg_reserved; + u_int32_t sadb_msg_seq; + u_int32_t sadb_msg_pid; +}; + +struct sadb_ext { + u_int16_t sadb_ext_len; + u_int16_t sadb_ext_type; +}; + +struct sadb_sa { + u_int16_t sadb_sa_len; + u_int16_t sadb_sa_exttype; + u_int32_t sadb_sa_spi; + u_int8_t sadb_sa_replay; + u_int8_t sadb_sa_state; + u_int8_t sadb_sa_auth; + u_int8_t sadb_sa_encrypt; + u_int32_t sadb_sa_flags; +}; + +struct sadb_lifetime { + u_int16_t sadb_lifetime_len; + u_int16_t sadb_lifetime_exttype; + u_int32_t sadb_lifetime_allocations; + u_int64_t sadb_lifetime_bytes; + u_int64_t sadb_lifetime_addtime; + u_int64_t sadb_lifetime_usetime; +}; + +struct sadb_address { + u_int16_t sadb_address_len; + u_int16_t sadb_address_exttype; + u_int8_t sadb_address_proto; + u_int8_t sadb_address_prefixlen; + u_int16_t sadb_address_reserved; +}; + +struct sadb_key { + u_int16_t sadb_key_len; + u_int16_t sadb_key_exttype; + u_int16_t sadb_key_bits; + u_int16_t sadb_key_reserved; +}; + +struct sadb_ident { + u_int16_t sadb_ident_len; + u_int16_t sadb_ident_exttype; + u_int16_t sadb_ident_type; + u_int16_t sadb_ident_reserved; + u_int64_t sadb_ident_id; +}; + +struct sadb_sens { + u_int16_t sadb_sens_len; + u_int16_t sadb_sens_exttype; + u_int32_t sadb_sens_dpd; + u_int8_t sadb_sens_sens_level; + u_int8_t sadb_sens_sens_len; + u_int8_t sadb_sens_integ_level; + u_int8_t sadb_sens_integ_len; + u_int32_t sadb_sens_reserved; +}; + +struct sadb_prop { + u_int16_t sadb_prop_len; + u_int16_t sadb_prop_exttype; + u_int8_t sadb_prop_replay; + u_int8_t sadb_prop_reserved[3]; +}; + +struct sadb_comb { + u_int8_t sadb_comb_auth; + u_int8_t sadb_comb_encrypt; + u_int16_t sadb_comb_flags; + u_int16_t sadb_comb_auth_minbits; + u_int16_t sadb_comb_auth_maxbits; + u_int16_t sadb_comb_encrypt_minbits; + u_int16_t sadb_comb_encrypt_maxbits; + u_int32_t sadb_comb_reserved; + u_int32_t sadb_comb_soft_allocations; + u_int32_t sadb_comb_hard_allocations; + u_int64_t sadb_comb_soft_bytes; + u_int64_t sadb_comb_hard_bytes; + u_int64_t sadb_comb_soft_addtime; + u_int64_t sadb_comb_hard_addtime; + u_int64_t sadb_comb_soft_usetime; + u_int64_t sadb_comb_hard_usetime; +}; + +struct sadb_supported { + u_int16_t sadb_supported_len; + u_int16_t sadb_supported_exttype; + u_int32_t sadb_supported_reserved; +}; + +struct sadb_alg { + u_int8_t sadb_alg_id; + u_int8_t sadb_alg_ivlen; + u_int16_t sadb_alg_minbits; + u_int16_t sadb_alg_maxbits; + u_int16_t sadb_alg_reserved; +}; + +struct sadb_spirange { + u_int16_t sadb_spirange_len; + u_int16_t sadb_spirange_exttype; + u_int32_t sadb_spirange_min; + u_int32_t sadb_spirange_max; + u_int32_t sadb_spirange_reserved; +}; + +struct sadb_x_kmprivate { + u_int16_t sadb_x_kmprivate_len; + u_int16_t sadb_x_kmprivate_exttype; + u_int32_t sadb_x_kmprivate_reserved; +}; + +/* + * XXX Additional SA Extension. + * mode: tunnel or transport + * reqid: to make SA unique nevertheless the address pair of SA are same. + * Mainly it's for VPN. + */ +struct sadb_x_sa2 { + u_int16_t sadb_x_sa2_len; + u_int16_t sadb_x_sa2_exttype; + u_int8_t sadb_x_sa2_mode; + u_int8_t sadb_x_sa2_reserved1; + u_int16_t sadb_x_sa2_reserved2; + u_int32_t sadb_x_sa2_sequence; + u_int32_t sadb_x_sa2_reqid; +}; + +/* XXX Policy Extension */ +/* sizeof(struct sadb_x_policy) == 16 */ +struct sadb_x_policy { + u_int16_t sadb_x_policy_len; + u_int16_t sadb_x_policy_exttype; + u_int16_t sadb_x_policy_type; /* See policy type of ipsec.h */ + u_int8_t sadb_x_policy_dir; /* direction, see ipsec.h */ + u_int8_t sadb_x_policy_reserved; + u_int32_t sadb_x_policy_id; + u_int32_t sadb_x_policy_reserved2; +}; +/* + * When policy_type == IPSEC, it is followed by some of + * the ipsec policy request. + * [total length of ipsec policy requests] + * = (sadb_x_policy_len * sizeof(uint64_t) - sizeof(struct sadb_x_policy)) + */ + +/* XXX IPsec Policy Request Extension */ +/* + * This structure is aligned 8 bytes. + */ +struct sadb_x_ipsecrequest { + u_int16_t sadb_x_ipsecrequest_len; /* structure length aligned to 8 bytes. + * This value is true length of bytes. + * Not in units of 64 bits. */ + u_int16_t sadb_x_ipsecrequest_proto; /* See ipsec.h */ + u_int8_t sadb_x_ipsecrequest_mode; /* See IPSEC_MODE_XX in ipsec.h. */ + u_int8_t sadb_x_ipsecrequest_level; /* See IPSEC_LEVEL_XX in ipsec.h */ + u_int16_t sadb_x_ipsecrequest_reqid; /* See ipsec.h */ + + /* + * followed by source IP address of SA, and immediately followed by + * destination IP address of SA. These encoded into two of sockaddr + * structure without any padding. Must set each sa_len exactly. + * Each of length of the sockaddr structure are not aligned to 64bits, + * but sum of x_request and addresses is aligned to 64bits. + */ +}; + +#define SADB_EXT_RESERVED 0 +#define SADB_EXT_SA 1 +#define SADB_EXT_LIFETIME_CURRENT 2 +#define SADB_EXT_LIFETIME_HARD 3 +#define SADB_EXT_LIFETIME_SOFT 4 +#define SADB_EXT_ADDRESS_SRC 5 +#define SADB_EXT_ADDRESS_DST 6 +#define SADB_EXT_ADDRESS_PROXY 7 +#define SADB_EXT_KEY_AUTH 8 +#define SADB_EXT_KEY_ENCRYPT 9 +#define SADB_EXT_IDENTITY_SRC 10 +#define SADB_EXT_IDENTITY_DST 11 +#define SADB_EXT_SENSITIVITY 12 +#define SADB_EXT_PROPOSAL 13 +#define SADB_EXT_SUPPORTED_AUTH 14 +#define SADB_EXT_SUPPORTED_ENCRYPT 15 +#define SADB_EXT_SPIRANGE 16 +#define SADB_X_EXT_KMPRIVATE 17 +#define SADB_X_EXT_POLICY 18 +#define SADB_X_EXT_SA2 19 +#define SADB_EXT_MAX 19 + +#define SADB_SATYPE_UNSPEC 0 +#define SADB_SATYPE_AH 2 +#define SADB_SATYPE_ESP 3 +#define SADB_SATYPE_RSVP 5 +#define SADB_SATYPE_OSPFV2 6 +#define SADB_SATYPE_RIPV2 7 +#define SADB_SATYPE_MIP 8 +#define SADB_X_SATYPE_IPCOMP 9 +#define SADB_X_SATYPE_POLICY 10 +#define SADB_SATYPE_MAX 11 + +#define SADB_SASTATE_LARVAL 0 +#define SADB_SASTATE_MATURE 1 +#define SADB_SASTATE_DYING 2 +#define SADB_SASTATE_DEAD 3 +#define SADB_SASTATE_MAX 3 + +#define SADB_SAFLAGS_PFS 1 + +/* RFC2367 numbers - meets RFC2407 */ +#define SADB_AALG_NONE 0 +#define SADB_AALG_MD5HMAC 1 /*2*/ +#define SADB_AALG_SHA1HMAC 2 /*3*/ +#define SADB_AALG_MAX 8 +/* private allocations - based on RFC2407/IANA assignment */ +#define SADB_X_AALG_SHA2_256 6 /*5*/ +#define SADB_X_AALG_SHA2_384 7 /*6*/ +#define SADB_X_AALG_SHA2_512 8 /*7*/ +/* private allocations should use 249-255 (RFC2407) */ +#define SADB_X_AALG_MD5 3 /*249*/ /* Keyed MD5 */ +#define SADB_X_AALG_SHA 4 /*250*/ /* Keyed SHA */ +#define SADB_X_AALG_NULL 5 /*251*/ /* null authentication */ + +/* RFC2367 numbers - meets RFC2407 */ +#define SADB_EALG_NONE 0 +#define SADB_EALG_DESCBC 1 /*2*/ +#define SADB_EALG_3DESCBC 2 /*3*/ +#define SADB_EALG_NULL 3 /*11*/ +#define SADB_EALG_MAX 12 +/* private allocations - based on RFC2407/IANA assignment */ +#define SADB_X_EALG_CAST128CBC 5 /*6*/ +#define SADB_X_EALG_BLOWFISHCBC 4 /*7*/ +#define SADB_X_EALG_RIJNDAELCBC 12 +#define SADB_X_EALG_AES 12 +/* private allocations should use 249-255 (RFC2407) */ + +#if 1 /*nonstandard */ +#define SADB_X_CALG_NONE 0 +#define SADB_X_CALG_OUI 1 +#define SADB_X_CALG_DEFLATE 2 +#define SADB_X_CALG_LZS 3 +#define SADB_X_CALG_MAX 4 +#endif + +#define SADB_IDENTTYPE_RESERVED 0 +#define SADB_IDENTTYPE_PREFIX 1 +#define SADB_IDENTTYPE_FQDN 2 +#define SADB_IDENTTYPE_USERFQDN 3 +#define SADB_X_IDENTTYPE_ADDR 4 +#define SADB_IDENTTYPE_MAX 4 + +/* `flags' in sadb_sa structure holds followings */ +#define SADB_X_EXT_NONE 0x0000 /* i.e. new format. */ +#define SADB_X_EXT_OLD 0x0001 /* old format. */ + +#define SADB_X_EXT_IV4B 0x0010 /* IV length of 4 bytes in use */ +#define SADB_X_EXT_DERIV 0x0020 /* DES derived */ +#define SADB_X_EXT_CYCSEQ 0x0040 /* allowing to cyclic sequence. */ + + /* three of followings are exclusive flags each them */ +#define SADB_X_EXT_PSEQ 0x0000 /* sequencial padding for ESP */ +#define SADB_X_EXT_PRAND 0x0100 /* random padding for ESP */ +#define SADB_X_EXT_PZERO 0x0200 /* zero padding for ESP */ +#define SADB_X_EXT_PMASK 0x0300 /* mask for padding flag */ + +#if 1 +#define SADB_X_EXT_RAWCPI 0x0080 /* use well known CPI (IPComp) */ +#endif + +#define SADB_KEY_FLAGS_MAX 0x0fff + +/* SPI size for PF_KEYv2 */ +#define PFKEY_SPI_SIZE sizeof(u_int32_t) + +/* Identifier for menber of lifetime structure */ +#define SADB_X_LIFETIME_ALLOCATIONS 0 +#define SADB_X_LIFETIME_BYTES 1 +#define SADB_X_LIFETIME_ADDTIME 2 +#define SADB_X_LIFETIME_USETIME 3 + +/* The rate for SOFT lifetime against HARD one. */ +#define PFKEY_SOFT_LIFETIME_RATE 80 + +/* Utilities */ +#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1))) +#define PFKEY_EXTLEN(msg) \ + PFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len) +#define PFKEY_ADDR_PREFIX(ext) \ + (((struct sadb_address *)(ext))->sadb_address_prefixlen) +#define PFKEY_ADDR_PROTO(ext) \ + (((struct sadb_address *)(ext))->sadb_address_proto) +#define PFKEY_ADDR_SADDR(ext) \ + ((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address))) + +/* in 64bits */ +#define PFKEY_UNUNIT64(a) ((a) << 3) +#define PFKEY_UNIT64(a) ((a) >> 3) + +#endif /* __PFKEY_V2_H */ + +#endif /* _NET_PFKEYV2_H_ */ diff --git a/newlib/libc/sys/linux/include/net/ppp_comp.h b/newlib/libc/sys/linux/include/net/ppp_comp.h new file mode 100644 index 000000000..9f63329f5 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/ppp_comp.h @@ -0,0 +1,151 @@ +/* + * ppp_comp.h - Definitions for doing PPP packet compression. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + * + * $FreeBSD: src/sys/net/ppp_comp.h,v 1.11 2002/03/24 09:34:04 bde Exp $ + */ + +#ifndef _NET_PPP_COMP_H +#define _NET_PPP_COMP_H + +/* + * Structure giving methods for compression/decompression. + */ +#ifdef PACKETPTR +struct compressor { + int compress_proto; /* CCP compression protocol number */ + + /* Allocate space for a compressor (transmit side) */ + void *(*comp_alloc)(u_char *options, int opt_len); + /* Free space used by a compressor */ + void (*comp_free)(void *state); + /* Initialize a compressor */ + int (*comp_init)(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int debug); + /* Reset a compressor */ + void (*comp_reset)(void *state); + /* Compress a packet */ + int (*compress)(void *state, PACKETPTR *mret, PACKETPTR mp, + int orig_len, int max_len); + /* Return compression statistics */ + void (*comp_stat)(void *state, struct compstat *stats); + + /* Allocate space for a decompressor (receive side) */ + void *(*decomp_alloc)(u_char *options, int opt_len); + /* Free space used by a decompressor */ + void (*decomp_free)(void *state); + /* Initialize a decompressor */ + int (*decomp_init)(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug); + /* Reset a decompressor */ + void (*decomp_reset)(void *state); + /* Decompress a packet. */ + int (*decompress)(void *state, PACKETPTR mp, PACKETPTR *dmpp); + /* Update state for an incompressible packet received */ + void (*incomp)(void *state, PACKETPTR mp); + /* Return decompression statistics */ + void (*decomp_stat)(void *state, struct compstat *stats); +}; +#endif /* PACKETPTR */ + +/* + * Return values for decompress routine. + * We need to make these distinctions so that we can disable certain + * useful functionality, namely sending a CCP reset-request as a result + * of an error detected after decompression. This is to avoid infringing + * a patent held by Motorola. + * Don't you just lurve software patents. + */ +#define DECOMP_OK 0 /* everything went OK */ +#define DECOMP_ERROR 1 /* error detected before decomp. */ +#define DECOMP_FATALERROR 2 /* error detected after decomp. */ + +/* + * CCP codes. + */ +#define CCP_CONFREQ 1 +#define CCP_CONFACK 2 +#define CCP_TERMREQ 5 +#define CCP_TERMACK 6 +#define CCP_RESETREQ 14 +#define CCP_RESETACK 15 + +/* + * Max # bytes for a CCP option + */ +#define CCP_MAX_OPTION_LENGTH 32 + +/* + * Parts of a CCP packet. + */ +#define CCP_CODE(dp) ((dp)[0]) +#define CCP_ID(dp) ((dp)[1]) +#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) +#define CCP_HDRLEN 4 + +#define CCP_OPT_CODE(dp) ((dp)[0]) +#define CCP_OPT_LENGTH(dp) ((dp)[1]) +#define CCP_OPT_MINLEN 2 + +/* + * Definitions for BSD-Compress. + */ +#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ +#define CILEN_BSD_COMPRESS 3 /* length of config. option */ + +/* Macros for handling the 3rd byte of the BSD-Compress config option. */ +#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ +#define BSD_VERSION(x) ((x) >> 5) /* version of option format */ +#define BSD_CURRENT_VERSION 1 /* current version number */ +#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) + +#define BSD_MIN_BITS 9 /* smallest code size supported */ +#define BSD_MAX_BITS 15 /* largest code size supported */ + +/* + * Definitions for Deflate. + */ +#define CI_DEFLATE 26 /* config option for Deflate */ +#define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */ +#define CILEN_DEFLATE 4 /* length of its config option */ + +#define DEFLATE_MIN_SIZE 8 +#define DEFLATE_MAX_SIZE 15 +#define DEFLATE_METHOD_VAL 8 +#define DEFLATE_SIZE(x) (((x) >> 4) + DEFLATE_MIN_SIZE) +#define DEFLATE_METHOD(x) ((x) & 0x0F) +#define DEFLATE_MAKE_OPT(w) ((((w) - DEFLATE_MIN_SIZE) << 4) \ + + DEFLATE_METHOD_VAL) +#define DEFLATE_CHK_SEQUENCE 0 + +/* + * Definitions for other, as yet unsupported, compression methods. + */ +#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ +#define CILEN_PREDICTOR_1 2 /* length of its config option */ +#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ +#define CILEN_PREDICTOR_2 2 /* length of its config option */ + +#endif /* _NET_PPP_COMP_H */ diff --git a/newlib/libc/sys/linux/include/net/ppp_defs.h b/newlib/libc/sys/linux/include/net/ppp_defs.h new file mode 100644 index 000000000..11a3fef1d --- /dev/null +++ b/newlib/libc/sys/linux/include/net/ppp_defs.h @@ -0,0 +1,157 @@ +/* + * ppp_defs.h - PPP definitions. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + * + * $FreeBSD: src/sys/net/ppp_defs.h,v 1.7 2001/06/11 12:38:58 ume Exp $ + */ + +#ifndef _PPP_DEFS_H_ +#define _PPP_DEFS_H_ + +/* + * The basic PPP frame. + */ +#define PPP_HDRLEN 4 /* octets for standard ppp header */ +#define PPP_FCSLEN 2 /* octets for FCS */ +#define PPP_MRU 1500 /* default MRU = max length of info field */ + +#define PPP_ADDRESS(p) (((u_char *)(p))[0]) +#define PPP_CONTROL(p) (((u_char *)(p))[1]) +#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3]) + +/* + * Significant octet values. + */ +#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ +#define PPP_UI 0x03 /* Unnumbered Information */ +#define PPP_FLAG 0x7e /* Flag Sequence */ +#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ +#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ + +/* + * Protocol field values. + */ +#define PPP_IP 0x21 /* Internet Protocol */ +#define PPP_XNS 0x25 /* Xerox NS */ +#define PPP_AT 0x29 /* AppleTalk Protocol */ +#define PPP_IPX 0x2b /* IPX Datagram (RFC1552) */ +#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ +#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ +#define PPP_COMP 0xfd /* compressed packet */ +#define PPP_IPCP 0x8021 /* IP Control Protocol */ +#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ +#define PPP_IPXCP 0x802b /* IPX Control Protocol (RFC1552) */ +#define PPP_CCP 0x80fd /* Compression Control Protocol */ +#define PPP_LCP 0xc021 /* Link Control Protocol */ +#define PPP_PAP 0xc023 /* Password Authentication Protocol */ +#define PPP_LQR 0xc025 /* Link Quality Report protocol */ +#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ +#define PPP_CBCP 0xc029 /* Callback Control Protocol */ +#define PPP_IPV6 0x57 /* Internet Protocol version 6*/ +#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ + +/* + * Values for FCS calculations. + */ +#define PPP_INITFCS 0xffff /* Initial FCS value */ +#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ +#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) + +/* + * Extended asyncmap - allows any character to be escaped. + */ +typedef u_int32_t ext_accm[8]; + +/* + * What to do with network protocol (NP) packets. + */ +enum NPmode { + NPMODE_PASS, /* pass the packet through */ + NPMODE_DROP, /* silently drop the packet */ + NPMODE_ERROR, /* return an error */ + NPMODE_QUEUE /* save it up for later. */ +}; + +/* + * Statistics. + */ +struct pppstat { + unsigned int ppp_ibytes; /* bytes received */ + unsigned int ppp_ipackets; /* packets received */ + unsigned int ppp_ierrors; /* receive errors */ + unsigned int ppp_obytes; /* bytes sent */ + unsigned int ppp_opackets; /* packets sent */ + unsigned int ppp_oerrors; /* transmit errors */ +}; + +struct vjstat { + unsigned int vjs_packets; /* outbound packets */ + unsigned int vjs_compressed; /* outbound compressed packets */ + unsigned int vjs_searches; /* searches for connection state */ + unsigned int vjs_misses; /* times couldn't find conn. state */ + unsigned int vjs_uncompressedin; /* inbound uncompressed packets */ + unsigned int vjs_compressedin; /* inbound compressed packets */ + unsigned int vjs_errorin; /* inbound unknown type packets */ + unsigned int vjs_tossed; /* inbound packets tossed because of error */ +}; + +struct ppp_stats { + struct pppstat p; /* basic PPP statistics */ + struct vjstat vj; /* VJ header compression statistics */ +}; + +struct compstat { + unsigned int unc_bytes; /* total uncompressed bytes */ + unsigned int unc_packets; /* total uncompressed packets */ + unsigned int comp_bytes; /* compressed bytes */ + unsigned int comp_packets; /* compressed packets */ + unsigned int inc_bytes; /* incompressible bytes */ + unsigned int inc_packets; /* incompressible packets */ + unsigned int ratio; /* recent compression ratio << 8 */ +}; + +struct ppp_comp_stats { + struct compstat c; /* packet compression statistics */ + struct compstat d; /* packet decompression statistics */ +}; + +/* + * The following structure records the time in seconds since + * the last NP packet was sent or received. + */ +struct ppp_idle { + time_t xmit_idle; /* time since last NP packet sent */ + time_t recv_idle; /* time since last NP packet received */ +}; + +#ifndef __P +#ifdef __STDC__ +#define __P(x) x +#else +#define __P(x) () +#endif +#endif + +#endif /* _PPP_DEFS_H_ */ diff --git a/newlib/libc/sys/linux/include/net/radix.h b/newlib/libc/sys/linux/include/net/radix.h new file mode 100644 index 000000000..7f1984e96 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/radix.h @@ -0,0 +1,170 @@ +/* + * Copyright (c) 1988, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)radix.h 8.2 (Berkeley) 10/31/94 + * $FreeBSD: src/sys/net/radix.h,v 1.18 2002/03/19 21:54:18 alfred Exp $ + */ + +#ifndef _RADIX_H_ +#define _RADIX_H_ + +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_RTABLE); +#endif + +/* + * Radix search tree node layout. + */ + +struct radix_node { + struct radix_mask *rn_mklist; /* list of masks contained in subtree */ + struct radix_node *rn_parent; /* parent */ + short rn_bit; /* bit offset; -1-index(netmask) */ + char rn_bmask; /* node: mask for bit test*/ + u_char rn_flags; /* enumerated next */ +#define RNF_NORMAL 1 /* leaf contains normal route */ +#define RNF_ROOT 2 /* leaf is root leaf for tree */ +#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ + union { + struct { /* leaf only data: */ + caddr_t rn_Key; /* object of search */ + caddr_t rn_Mask; /* netmask, if present */ + struct radix_node *rn_Dupedkey; + } rn_leaf; + struct { /* node only data: */ + int rn_Off; /* where to start compare */ + struct radix_node *rn_L;/* progeny */ + struct radix_node *rn_R;/* progeny */ + } rn_node; + } rn_u; +#ifdef RN_DEBUG + int rn_info; + struct radix_node *rn_twin; + struct radix_node *rn_ybro; +#endif +}; + +#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey +#define rn_key rn_u.rn_leaf.rn_Key +#define rn_mask rn_u.rn_leaf.rn_Mask +#define rn_offset rn_u.rn_node.rn_Off +#define rn_left rn_u.rn_node.rn_L +#define rn_right rn_u.rn_node.rn_R + +/* + * Annotations to tree concerning potential routes applying to subtrees. + */ + +struct radix_mask { + short rm_bit; /* bit offset; -1-index(netmask) */ + char rm_unused; /* cf. rn_bmask */ + u_char rm_flags; /* cf. rn_flags */ + struct radix_mask *rm_mklist; /* more masks to try */ + union { + caddr_t rmu_mask; /* the mask */ + struct radix_node *rmu_leaf; /* for normal routes */ + } rm_rmu; + int rm_refs; /* # of references to this struct */ +}; + +#define rm_mask rm_rmu.rmu_mask +#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ + +#define MKGet(m) {\ + if (rn_mkfreelist) {\ + m = rn_mkfreelist; \ + rn_mkfreelist = (m)->rm_mklist; \ + } else \ + R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\ + +#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);} + +typedef int walktree_f_t(struct radix_node *, void *); + +struct radix_node_head { + struct radix_node *rnh_treetop; + int rnh_addrsize; /* permit, but not require fixed keys */ + int rnh_pktsize; /* permit, but not require fixed keys */ + struct radix_node *(*rnh_addaddr) /* add based on sockaddr */ + (void *v, void *mask, + struct radix_node_head *head, struct radix_node nodes[]); + struct radix_node *(*rnh_addpkt) /* add based on packet hdr */ + (void *v, void *mask, + struct radix_node_head *head, struct radix_node nodes[]); + struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */ + (void *v, void *mask, struct radix_node_head *head); + struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */ + (void *v, void *mask, struct radix_node_head *head); + struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */ + (void *v, struct radix_node_head *head); + struct radix_node *(*rnh_lookup) /* locate based on sockaddr */ + (void *v, void *mask, struct radix_node_head *head); + struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */ + (void *v, struct radix_node_head *head); + int (*rnh_walktree) /* traverse tree */ + (struct radix_node_head *head, walktree_f_t *f, void *w); + int (*rnh_walktree_from) /* traverse tree below a */ + (struct radix_node_head *head, void *a, void *m, + walktree_f_t *f, void *w); + void (*rnh_close) /* do something when the last ref drops */ + (struct radix_node *rn, struct radix_node_head *head); + struct radix_node rnh_nodes[3]; /* empty tree for common case */ +}; + +#ifndef _KERNEL +#define Bcmp(a, b, n) bcmp(((char *)(a)), ((char *)(b)), (n)) +#define Bcopy(a, b, n) bcopy(((char *)(a)), ((char *)(b)), (unsigned)(n)) +#define Bzero(p, n) bzero((char *)(p), (int)(n)); +#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n))) +#define Free(p) free((char *)p); +#else +#define Bcmp(a, b, n) bcmp(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) +#define Bcopy(a, b, n) bcopy(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) +#define Bzero(p, n) bzero((caddr_t)(p), (unsigned)(n)); +#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_DONTWAIT)) +#define Free(p) free((caddr_t)p, M_RTABLE); +#endif /* _KERNEL */ + +void rn_init(void); +int rn_inithead(void **, int); +int rn_refines(void *, void *); +struct radix_node + *rn_addmask(void *, int, int), + *rn_addroute (void *, void *, struct radix_node_head *, + struct radix_node [2]), + *rn_delete(void *, void *, struct radix_node_head *), + *rn_lookup (void *v_arg, void *m_arg, + struct radix_node_head *head), + *rn_match(void *, struct radix_node_head *); + + +#endif /* _RADIX_H_ */ diff --git a/newlib/libc/sys/linux/include/net/raw_cb.h b/newlib/libc/sys/linux/include/net/raw_cb.h new file mode 100644 index 000000000..d17712d30 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/raw_cb.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1980, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)raw_cb.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/raw_cb.h,v 1.16 2002/03/19 21:54:18 alfred Exp $ + */ + +#ifndef _NET_RAW_CB_H_ +#define _NET_RAW_CB_H_ + +#include + +/* + * Raw protocol interface control block. Used + * to tie a socket to the generic raw interface. + */ +struct rawcb { + LIST_ENTRY(rawcb) list; + struct socket *rcb_socket; /* back pointer to socket */ + struct sockaddr *rcb_faddr; /* destination address */ + struct sockaddr *rcb_laddr; /* socket's address */ + struct sockproto rcb_proto; /* protocol family, protocol */ +}; + +#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb) + +/* + * Nominal space allocated to a raw socket. + */ +#define RAWSNDQ 8192 +#define RAWRCVQ 8192 + +#ifdef _KERNEL +extern LIST_HEAD(rawcb_list_head, rawcb) rawcb_list; + +/* protosw entries */ +pr_ctlinput_t raw_ctlinput; +pr_init_t raw_init; + +/* usrreq entries */ +int raw_attach(struct socket *, int); +void raw_detach(struct rawcb *); +void raw_disconnect(struct rawcb *); + +#if 0 /* what the ??? */ +pr_input_t raw_input; +#else +void raw_input(struct mbuf *, + struct sockproto *, struct sockaddr *, struct sockaddr *); +#endif + +extern struct pr_usrreqs raw_usrreqs; +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/net/route.h b/newlib/libc/sys/linux/include/net/route.h new file mode 100644 index 000000000..c60bf3537 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/route.h @@ -0,0 +1,301 @@ +/* + * Copyright (c) 1980, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)route.h 8.4 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/net/route.h,v 1.45 2002/03/24 09:34:04 bde Exp $ + */ + +#ifndef _NET_ROUTE_H_ +#define _NET_ROUTE_H_ + +/* + * Kernel resident routing tables. + * + * The routing tables are initialized when interface addresses + * are set by making entries for all directly connected interfaces. + */ + +/* + * A route consists of a destination address and a reference + * to a routing entry. These are often held by protocols + * in their control blocks, e.g. inpcb. + */ +struct route { + struct rtentry *ro_rt; + struct sockaddr ro_dst; +}; + +/* + * These numbers are used by reliable protocols for determining + * retransmission behavior and are included in the routing structure. + */ +struct rt_metrics { + u_long rmx_locks; /* Kernel must leave these values alone */ + u_long rmx_mtu; /* MTU for this path */ + u_long rmx_hopcount; /* max hops expected */ + u_long rmx_expire; /* lifetime for route, e.g. redirect */ + u_long rmx_recvpipe; /* inbound delay-bandwidth product */ + u_long rmx_sendpipe; /* outbound delay-bandwidth product */ + u_long rmx_ssthresh; /* outbound gateway buffer limit */ + u_long rmx_rtt; /* estimated round trip time */ + u_long rmx_rttvar; /* estimated rtt variance */ + u_long rmx_pksent; /* packets sent using this route */ + u_long rmx_filler[4]; /* will be used for T/TCP later */ +}; + +/* + * rmx_rtt and rmx_rttvar are stored as microseconds; + * RTTTOPRHZ(rtt) converts to a value suitable for use + * by a protocol slowtimo counter. + */ +#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ +#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) + +/* + * XXX kernel function pointer `rt_output' is visible to applications. + */ +struct mbuf; + +/* + * We distinguish between routes to hosts and routes to networks, + * preferring the former if available. For each route we infer + * the interface to use from the gateway address supplied when + * the route was entered. Routes that forward packets through + * gateways are marked so that the output routines know to address the + * gateway rather than the ultimate destination. + */ +#ifndef RNF_NORMAL +#include +#endif +struct rtentry { + struct radix_node rt_nodes[2]; /* tree glue, and other values */ +#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key)) +#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask)) + struct sockaddr *rt_gateway; /* value */ + long rt_refcnt; /* # held references */ + u_long rt_flags; /* up/down?, host/net */ + struct ifnet *rt_ifp; /* the answer: interface to use */ + struct ifaddr *rt_ifa; /* the answer: interface to use */ + struct sockaddr *rt_genmask; /* for generation of cloned routes */ + caddr_t rt_llinfo; /* pointer to link level info cache */ + struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */ + struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ + int (*rt_output)(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); + /* output routine for this (rt,if) */ + struct rtentry *rt_parent; /* cloning parent of this route */ + void *rt_filler2; /* more filler */ +}; + +/* + * Following structure necessary for 4.3 compatibility; + * We should eventually move it to a compat file. + */ +struct ortentry { + u_long rt_hash; /* to speed lookups */ + struct sockaddr rt_dst; /* key */ + struct sockaddr rt_gateway; /* value */ + short rt_flags; /* up/down?, host/net */ + short rt_refcnt; /* # held references */ + u_long rt_use; /* raw # packets forwarded */ + struct ifnet *rt_ifp; /* the answer: interface to use */ +}; + +#define rt_use rt_rmx.rmx_pksent + +#define RTF_UP 0x1 /* route usable */ +#define RTF_GATEWAY 0x2 /* destination is a gateway */ +#define RTF_HOST 0x4 /* host entry (net otherwise) */ +#define RTF_REJECT 0x8 /* host or net unreachable */ +#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ +#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ +#define RTF_DONE 0x40 /* message confirmed */ +/* 0x80 unused, was RTF_DELCLONE */ +#define RTF_CLONING 0x100 /* generate new routes on use */ +#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ +#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */ +#define RTF_STATIC 0x800 /* manually added */ +#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ +#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ +#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ + +#define RTF_PRCLONING 0x10000 /* protocol requires cloning */ +#define RTF_WASCLONED 0x20000 /* route generated through cloning */ +#define RTF_PROTO3 0x40000 /* protocol specific routing flag */ +/* 0x80000 unused */ +#define RTF_PINNED 0x100000 /* future use */ +#define RTF_LOCAL 0x200000 /* route represents a local address */ +#define RTF_BROADCAST 0x400000 /* route represents a bcast address */ +#define RTF_MULTICAST 0x800000 /* route represents a mcast address */ + /* 0x1000000 and up unassigned */ + +/* + * Routing statistics. + */ +struct rtstat { + short rts_badredirect; /* bogus redirect calls */ + short rts_dynamic; /* routes created by redirects */ + short rts_newgateway; /* routes modified by redirects */ + short rts_unreach; /* lookups which failed */ + short rts_wildcard; /* lookups satisfied by a wildcard */ +}; +/* + * Structures for routing messages. + */ +struct rt_msghdr { + u_short rtm_msglen; /* to skip over non-understood messages */ + u_char rtm_version; /* future binary compatibility */ + u_char rtm_type; /* message type */ + u_short rtm_index; /* index for associated ifp */ + int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ + int rtm_addrs; /* bitmask identifying sockaddrs in msg */ + pid_t rtm_pid; /* identify sender */ + int rtm_seq; /* for sender to identify action */ + int rtm_errno; /* why failed */ + int rtm_use; /* from rtentry */ + u_long rtm_inits; /* which metrics we are initializing */ + struct rt_metrics rtm_rmx; /* metrics themselves */ +}; + +#define RTM_VERSION 5 /* Up the ante and ignore older versions */ + +/* + * Message types. + */ +#define RTM_ADD 0x1 /* Add Route */ +#define RTM_DELETE 0x2 /* Delete Route */ +#define RTM_CHANGE 0x3 /* Change Metrics or flags */ +#define RTM_GET 0x4 /* Report Metrics */ +#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ +#define RTM_REDIRECT 0x6 /* Told to use different route */ +#define RTM_MISS 0x7 /* Lookup failed on this address */ +#define RTM_LOCK 0x8 /* fix specified metrics */ +#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ +#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ +#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ +#define RTM_NEWADDR 0xc /* address being added to iface */ +#define RTM_DELADDR 0xd /* address being removed from iface */ +#define RTM_IFINFO 0xe /* iface going up/down etc. */ +#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */ +#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */ +#define RTM_IFANNOUNCE 0x11 /* iface arrival/departure */ + +/* + * Bitmask values for rtm_inits and rmx_locks. + */ +#define RTV_MTU 0x1 /* init or lock _mtu */ +#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ +#define RTV_EXPIRE 0x4 /* init or lock _expire */ +#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ +#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ +#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ +#define RTV_RTT 0x40 /* init or lock _rtt */ +#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ + +/* + * Bitmask values for rtm_addrs. + */ +#define RTA_DST 0x1 /* destination sockaddr present */ +#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ +#define RTA_NETMASK 0x4 /* netmask sockaddr present */ +#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ +#define RTA_IFP 0x10 /* interface name sockaddr present */ +#define RTA_IFA 0x20 /* interface addr sockaddr present */ +#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ +#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ + +/* + * Index offsets for sockaddr array for alternate internal encoding. + */ +#define RTAX_DST 0 /* destination sockaddr present */ +#define RTAX_GATEWAY 1 /* gateway sockaddr present */ +#define RTAX_NETMASK 2 /* netmask sockaddr present */ +#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ +#define RTAX_IFP 4 /* interface name sockaddr present */ +#define RTAX_IFA 5 /* interface addr sockaddr present */ +#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ +#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ +#define RTAX_MAX 8 /* size of array to allocate */ + +struct rt_addrinfo { + int rti_addrs; + struct sockaddr *rti_info[RTAX_MAX]; + int rti_flags; + struct ifaddr *rti_ifa; + struct ifnet *rti_ifp; +}; + +struct route_cb { + int ip_count; + int ip6_count; + int ipx_count; + int ns_count; + int any_count; +}; + +#ifdef _KERNEL +#define RTFREE(rt) \ + do { \ + if ((rt)->rt_refcnt <= 1) \ + rtfree(rt); \ + else \ + (rt)->rt_refcnt--; \ + } while (0) + +extern struct route_cb route_cb; +extern struct radix_node_head *rt_tables[AF_MAX+1]; + +struct ifmultiaddr; + +void route_init(void); +int rt_getifa(struct rt_addrinfo *); +void rt_ifannouncemsg(struct ifnet *, int); +void rt_ifmsg(struct ifnet *); +void rt_missmsg(int, struct rt_addrinfo *, int, int); +void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); +void rt_newmaddrmsg(int, struct ifmultiaddr *); +int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); +void rtalloc(struct route *); +void rtalloc_ign(struct route *, u_long); +struct rtentry * + rtalloc1(struct sockaddr *, int, u_long); +void rtfree(struct rtentry *); +int rtinit(struct ifaddr *, int, int); +int rtioctl(u_long, caddr_t); +void rtredirect(struct sockaddr *, struct sockaddr *, + struct sockaddr *, int, struct sockaddr *, struct rtentry **); +int rtrequest(int, struct sockaddr *, + struct sockaddr *, struct sockaddr *, int, struct rtentry **); +int rtrequest1(int, struct rt_addrinfo *, struct rtentry **); +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/net/slcompress.h b/newlib/libc/sys/linux/include/net/slcompress.h new file mode 100644 index 000000000..a054246bc --- /dev/null +++ b/newlib/libc/sys/linux/include/net/slcompress.h @@ -0,0 +1,161 @@ +/* + * Definitions for tcp compression routines. + * + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: + * - Initial distribution. + * $FreeBSD: src/sys/net/slcompress.h,v 1.17 2002/03/19 21:54:18 alfred Exp $ + */ + +#ifndef _NET_SLCOMPRESS_H_ +#define _NET_SLCOMPRESS_H_ + +#define MAX_STATES 16 /* must be > 2 and < 256 */ +#define MAX_HDR 128 + +/* + * Compressed packet format: + * + * The first octet contains the packet type (top 3 bits), TCP + * 'push' bit, and flags that indicate which of the 4 TCP sequence + * numbers have changed (bottom 5 bits). The next octet is a + * conversation number that associates a saved IP/TCP header with + * the compressed packet. The next two octets are the TCP checksum + * from the original datagram. The next 0 to 15 octets are + * sequence number changes, one change per bit set in the header + * (there may be no changes and there are two special cases where + * the receiver implicitly knows what changed -- see below). + * + * There are 5 numbers which can change (they are always inserted + * in the following order): TCP urgent pointer, window, + * acknowledgement, sequence number and IP ID. (The urgent pointer + * is different from the others in that its value is sent, not the + * change in value.) Since typical use of SLIP links is biased + * toward small packets (see comments on MTU/MSS below), changes + * use a variable length coding with one octet for numbers in the + * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the + * range 256 - 65535 or 0. (If the change in sequence number or + * ack is more than 65535, an uncompressed packet is sent.) + */ + +/* + * Packet types (must not conflict with IP protocol version) + * + * The top nibble of the first octet is the packet type. There are + * three possible types: IP (not proto TCP or tcp with one of the + * control flags set); uncompressed TCP (a normal IP/TCP packet but + * with the 8-bit protocol field replaced by an 8-bit connection id -- + * this type of packet syncs the sender & receiver); and compressed + * TCP (described above). + * + * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and + * is logically part of the 4-bit "changes" field that follows. Top + * three bits are actual packet type. For backward compatibility + * and in the interest of conserving bits, numbers are chosen so the + * IP protocol version number (4) which normally appears in this nibble + * means "IP packet". + */ + +/* packet types */ +#define TYPE_IP 0x40 +#define TYPE_UNCOMPRESSED_TCP 0x70 +#define TYPE_COMPRESSED_TCP 0x80 +#define TYPE_ERROR 0x00 + +/* Bits in first octet of compressed packet */ +#define NEW_C 0x40 /* flag bits for what changed in a packet */ +#define NEW_I 0x20 +#define NEW_S 0x08 +#define NEW_A 0x04 +#define NEW_W 0x02 +#define NEW_U 0x01 + +/* reserved, special-case values of above */ +#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ +#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ +#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) + +#define TCP_PUSH_BIT 0x10 + + +/* + * "state" data for each active tcp conversation on the wire. This is + * basically a copy of the entire IP/TCP header from the last packet + * we saw from the conversation together with a small identifier + * the transmit & receive ends of the line use to locate saved header. + */ +struct cstate { + struct cstate *cs_next; /* next most recently used cstate (xmit only) */ + u_int16_t cs_hlen; /* size of hdr (receive only) */ + u_char cs_id; /* connection # associated with this state */ + u_char cs_filler; + union { + char csu_hdr[MAX_HDR]; + struct ip csu_ip; /* ip/tcp hdr from most recent packet */ + } slcs_u; +}; +#define cs_ip slcs_u.csu_ip +#define cs_hdr slcs_u.csu_hdr + +/* + * all the state data for one serial line (we need one of these + * per line). + */ +struct slcompress { + struct cstate *last_cs; /* most recently used tstate */ + u_char last_recv; /* last rcvd conn. id */ + u_char last_xmit; /* last sent conn. id */ + u_int16_t flags; +#ifndef SL_NO_STATS + int sls_packets; /* outbound packets */ + int sls_compressed; /* outbound compressed packets */ + int sls_searches; /* searches for connection state */ + int sls_misses; /* times couldn't find conn. state */ + int sls_uncompressedin; /* inbound uncompressed packets */ + int sls_compressedin; /* inbound compressed packets */ + int sls_errorin; /* inbound unknown type packets */ + int sls_tossed; /* inbound packets tossed because of error */ +#endif + struct cstate tstate[MAX_STATES]; /* xmit connection states */ + struct cstate rstate[MAX_STATES]; /* receive connection states */ +}; +/* flag values */ +#define SLF_TOSS 1 /* tossing rcvd frames because of input err */ + +void sl_compress_init(struct slcompress *, int); +u_int sl_compress_tcp(struct mbuf *, struct ip *, struct slcompress *, int); +int sl_uncompress_tcp(u_char **, int, u_int, struct slcompress *); +int sl_uncompress_tcp_core(u_char *, int, int, u_int, + struct slcompress *, u_char **, u_int *); + +#endif /* !_NET_SLCOMPRESS_H_ */ diff --git a/newlib/libc/sys/linux/include/net/slip.h b/newlib/libc/sys/linux/include/net/slip.h new file mode 100644 index 000000000..595b935a1 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/slip.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)slip.h 8.1 (Berkeley) 2/12/94 + * $FreeBSD: src/sys/net/slip.h,v 1.9 1999/08/28 00:48:29 peter Exp $ + */ + +#ifndef _NET_SLIP_H_ +#define _NET_SLIP_H_ + +/* Ioctls operating on SLIP ttys. */ +#define SLIOCGUNIT _IOR('t', 88, int) /* get slip unit number */ +#define SLIOCSKEEPAL _IOW('t', 84, int) /* set keepalive */ +#define SLIOCSOUTFILL _IOW('t', 83, int) /* set out fill time */ +#define SLIOCGKEEPAL _IOR('t', 82, int) /* get keepalive time */ +#define SLIOCGOUTFILL _IOR('t', 81, int) /* get out fill time */ +#define SLIOCSUNIT _IOW('t', 80, int) /* set slip unit number */ + +/* + * Definitions of the pseudo-link-level header attached to slip + * packets grabbed by the packet filter (bpf) traffic monitor. + */ +#define SLIP_HDRLEN 16 /* BPF SLIP header length */ + +/* Offsets into BPF SLIP header. */ +#define SLX_DIR 0 /* direction; see below */ +#define SLX_CHDR 1 /* compressed header data */ +#define CHDR_LEN 15 /* length of compressed header data */ + +#define SLIPDIR_IN 0 /* incoming */ +#define SLIPDIR_OUT 1 /* outgoing */ + +#endif /* !_NET_SLIP_H */ diff --git a/newlib/libc/sys/linux/include/net/zlib.h b/newlib/libc/sys/linux/include/net/zlib.h new file mode 100644 index 000000000..c2d32be1f --- /dev/null +++ b/newlib/libc/sys/linux/include/net/zlib.h @@ -0,0 +1,1013 @@ +/* $FreeBSD: src/sys/net/zlib.h,v 1.7 1999/12/29 04:38:38 peter Exp $ */ + +/* + * This file is derived from zlib.h and zconf.h from the zlib-1.0.4 + * distribution by Jean-loup Gailly and Mark Adler, with some additions + * by Paul Mackerras to aid in implementing Deflate compression and + * decompression for PPP packets. + */ + +/* + * ==FILEVERSION 971127== + * + * This marker is used by the Linux installation script to determine + * whether an up-to-date version of this file is already installed. + */ + + +/* +++ zlib.h */ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.0.4, Jul 24th, 1996. + + Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + gzip@prep.ai.mit.edu madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef _ZLIB_H +#define _ZLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* +++ zconf.h */ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-1996 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* From: zconf.h,v 1.20 1996/07/02 15:09:28 me Exp $ */ + +#ifndef _ZCONF_H +#define _ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateReset z_inflateReset +# define compress z_compress +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table + +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +# define WIN32 +#endif +#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) +# ifndef __32BIT__ +# define __32BIT__ +# endif +#endif +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#if defined(MSDOS) && !defined(__32BIT__) +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) +# define STDC +#endif +#if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC) +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2 */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + 1 << (windowBits+2) + 1 << (memLevel+9) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR __far +# else +# define FAR far +# endif +#endif +#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) +# ifndef __32BIT__ +# define SMALL_MEDIUM +# define FAR __far +# endif +#endif +#ifndef FAR +# define FAR +#endif + +typedef unsigned char Byte; /* 8 bits */ +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#if defined(__BORLANDC__) && defined(SMALL_MEDIUM) + /* Borland C/C++ ignores FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + + +/* Compile with -DZLIB_DLL for Windows DLL support */ +#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL) +# include +# define EXPORT WINAPI +#else +# define EXPORT +#endif + +#endif /* _ZCONF_H */ +/* --- zconf.h */ + +#define ZLIB_VERSION "1.0.4P" + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms may be added later and will have the same + stream interface. + + For compression the application must provide the output buffer and + may optionally provide the input buffer for optimization. For decompression, + the application must provide the input buffer and may optionally provide + the output buffer for optimization. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The library does not install any signal handler. It is recommended to + add at least a handler for SIGSEGV when decompressing; the library checks + the consistency of the input data whenever possible but may go nuts + for some forms of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + const char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: ascii or binary */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_PACKET_FLUSH 2 +#define Z_SYNC_FLUSH 3 +#define Z_FULL_FLUSH 4 +#define Z_FINISH 5 +/* Allowed flush values; see deflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_ASCII 1 +#define Z_UNKNOWN 2 +/* Possible values of the data_type field */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +extern const char * EXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +extern int EXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +extern int EXPORT deflate OF((z_streamp strm, int flush)); +/* + Performs one or both of the following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression + block is terminated and flushed to the output buffer so that the + decompressor can get all input data available so far. For method 9, a future + variant on method 8, the current block will be flushed but not terminated. + Z_SYNC_FLUSH has the same effect as partial flush except that the compressed + output is byte aligned (the compressor can clear its internal bit buffer) + and the current block is always terminated; this can be useful if the + compressor has to be restarted from scratch after an interruption (in which + case the internal state of the compressor may be lost). + If flush is set to Z_FULL_FLUSH, the compression block is terminated, a + special marker is output and the compression dictionary is discarded; this + is useful to allow the decompressor to synchronize if one compressed block + has been damaged (see inflateSync below). Flushing degrades compression and + so should be used only when necessary. Using Z_FULL_FLUSH too often can + seriously degrade the compression. If deflate returns with avail_out == 0, + this function must be called again with the same value of the flush + parameter and more output space (updated avail_out), until the flush is + complete (deflate returns with non-zero avail_out). + + If the parameter flush is set to Z_PACKET_FLUSH, the compression + block is terminated, and a zero-length stored block is output, + omitting the length bytes (the effect of this is that the 3-bit type + code 000 for a stored block is output, and the output is then + byte-aligned). This is designed for use at the end of a PPP packet. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + 0.1% larger than avail_in plus 12 bytes. If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() may update data_type if it can make a good guess about + the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible. +*/ + + +extern int EXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +extern int EXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, inflateInit updates them to use default + allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_VERSION_ERROR if the zlib library version is incompatible + with the version assumed by the caller. msg is set to null if there is no + error message. inflateInit does not perform any decompression: this will be + done by inflate(). +*/ + +#if defined(__FreeBSD__) && defined(_KERNEL) +#define inflate inflate_ppp /* FreeBSD already has an inflate :-( */ +#endif + +extern int EXPORT inflate OF((z_streamp strm, int flush)); +/* + Performs one or both of the following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + If the parameter flush is set to Z_PARTIAL_FLUSH or Z_PACKET_FLUSH, + inflate flushes as much output as possible to the output buffer. The + flushing behavior of inflate is not specified for values of the flush + parameter other than Z_PARTIAL_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the + current implementation actually flushes as much output as possible + anyway. For Z_PACKET_FLUSH, inflate checks that once all the input data + has been consumed, it is expecting to see the length field of a stored + block; if not, it returns Z_DATA_ERROR. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster routine + may be used for the single inflate() call. + + inflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if the end of the + compressed data has been reached and all uncompressed output has been + produced, Z_NEED_DICT if a preset dictionary is needed at this point (see + inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted, + Z_STREAM_ERROR if the stream structure was inconsistent (for example if + next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in + the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the + application may then call inflateSync to look for a good compression block. + In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the + dictionary chosen by the compressor. +*/ + + +extern int EXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +extern int EXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. (Method 9 will allow a 64K history buffer and + partial block flushes.) + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library (the value 16 will be allowed for method 9). Larger + values of this parameter result in better compression at the expense of + memory usage. The default value is 15 if deflateInit is used instead. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match). Filtered data consists mostly of small values with a + somewhat random distribution. In this case, the compression algorithm is + tuned to compress them better. The effect of Z_FILTERED is to force more + Huffman coding and less string matching; it is somewhat intermediate + between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects + the compression ratio but not the correctness of the compressed output even + if it is not set appropriately. + + If next_in is not null, the library will use this buffer to hold also + some history information; the buffer must either hold the entire input + data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in + is null, the library will allocate its own history buffer (and leave next_in + null). next_out need not be provided here but must be provided by the + application for the next call of deflate(). + + If the history buffer is provided by the application, next_in must + must never be changed by the application since the compressor maintains + information inside this buffer from call to call; the application + must provide more input only by increasing avail_in. next_in is always + reset by the library in this case. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was + not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as + an invalid method). msg is set to null if there is no error message. + deflateInit2 does not perform any compression: this will be done by + deflate(). +*/ + +extern int EXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary (history buffer) from the given + byte sequence without producing any compressed output. This function must + be called immediately after deflateInit or deflateInit2, before any call + of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and + can be predicted with good accuracy; the data can then be compressed better + than with the default empty dictionary. In this version of the library, + only the last 32K bytes of the dictionary are used. + Upon return of this function, strm->adler is set to the Adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state + is inconsistent (for example if deflate has already been called for this + stream). deflateSetDictionary does not perform any compression: this will + be done by deflate(). +*/ + +extern int EXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. If + the source stream is using an application-supplied history buffer, a new + buffer is allocated for the destination stream. The compressed output + buffer is always application-supplied. It's the responsibility of the + application to provide the correct values of next_out and avail_out for the + next call of deflate. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +extern int EXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy)); +/* + Dynamically update the compression level and compression strategy. + This can be used to switch between compression and straight copy of + the input data, or to switch to a different kind of input data requiring + a different strategy. If the compression level is changed, the input + available so far is compressed with the old level (and may be flushed); + the new level will take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +extern int EXPORT deflateOutputPending OF((z_streamp strm)); +/* + Returns the number of bytes of output which are immediately + available from the compressor (i.e. without any further input + or flush). +*/ + +/* +extern int EXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with more compression options. The + fields next_out, zalloc, zfree and opaque must be initialized before by + the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library (the value 16 will be allowed soon). The + default value is 15 if inflateInit is used instead. If a compressed stream + with a larger window size is given as input, inflate() will return with + the error code Z_DATA_ERROR instead of trying to allocate a larger window. + + If next_out is not null, the library will use this buffer for the history + buffer; the buffer must either be large enough to hold the entire output + data, or have at least 1< + +#define NETCONFIG "/etc/netconfig" +#define NETPATH "NETPATH" + +struct netconfig { + char *nc_netid; /* Network ID */ + unsigned long nc_semantics; /* Semantics (see below) */ + unsigned long nc_flag; /* Flags (see below) */ + char *nc_protofmly; /* Protocol family */ + char *nc_proto; /* Protocol name */ + char *nc_device; /* Network device pathname */ + unsigned long nc_nlookups; /* Number of directory lookup libs */ + char **nc_lookups; /* Names of the libraries */ + unsigned long nc_unused[9]; /* reserved */ +}; + +typedef struct { + struct netconfig **nc_head; + struct netconfig **nc_curr; +} NCONF_HANDLE; + +/* + * nc_semantics values + */ +#define NC_TPI_CLTS 1 +#define NC_TPI_COTS 2 +#define NC_TPI_COTS_ORD 3 +#define NC_TPI_RAW 4 + +/* + * nc_flag values + */ +#define NC_NOFLAG 0x00 +#define NC_VISIBLE 0x01 +#define NC_BROADCAST 0x02 + +/* + * nc_protofmly values + */ +#define NC_NOPROTOFMLY "-" +#define NC_LOOPBACK "loopback" +#define NC_INET "inet" +#define NC_INET6 "inet6" +#define NC_IMPLINK "implink" +#define NC_PUP "pup" +#define NC_CHAOS "chaos" +#define NC_NS "ns" +#define NC_NBS "nbs" +#define NC_ECMA "ecma" +#define NC_DATAKIT "datakit" +#define NC_CCITT "ccitt" +#define NC_SNA "sna" +#define NC_DECNET "decnet" +#define NC_DLI "dli" +#define NC_LAT "lat" +#define NC_HYLINK "hylink" +#define NC_APPLETALK "appletalk" +#define NC_NIT "nit" +#define NC_IEEE802 "ieee802" +#define NC_OSI "osi" +#define NC_X25 "x25" +#define NC_OSINET "osinet" +#define NC_GOSIP "gosip" + +/* + * nc_proto values + */ +#define NC_NOPROTO "-" +#define NC_TCP "tcp" +#define NC_UDP "udp" +#define NC_ICMP "icmp" + +__BEGIN_DECLS +void *setnetconfig(void); +struct netconfig *getnetconfig(void *); +struct netconfig *getnetconfigent(const char *); +void freenetconfigent(struct netconfig *); +int endnetconfig(void *); + +void *setnetpath(void); +struct netconfig *getnetpath(void *); +int endnetpath(void *); + +void nc_perror(const char *); +char *nc_sperror(void); +__END_DECLS + +#endif /* _NETCONFIG_H_ */ diff --git a/newlib/libc/sys/linux/include/netdb.h b/newlib/libc/sys/linux/include/netdb.h new file mode 100644 index 000000000..e92b269e2 --- /dev/null +++ b/newlib/libc/sys/linux/include/netdb.h @@ -0,0 +1,277 @@ +/*- + * Copyright (c) 1980, 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* + * @(#)netdb.h 8.1 (Berkeley) 6/2/93 + * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ + * $FreeBSD: src/include/netdb.h,v 1.23 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _NETDB_H_ +#define _NETDB_H_ + +#include +#include +#include +#include + +#ifndef __socklen_t_defined +typedef unsigned int socklen_t; +#define __socklen_t_defined 1 +#endif + +#ifdef _BSD_SOCKLEN_T_ +typedef _BSD_SOCKLEN_T_ socklen_t; +#undef _BSD_SOCKLEN_T_ +#endif + +#ifndef _PATH_HEQUIV +# define _PATH_HEQUIV "/etc/hosts.equiv" +#endif +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" + +extern int h_errno; + +#define MAXALIASES 35 + /* For now, only support one return address. */ +#define MAXADDRS 2 +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ + char *h_addr; /* address, for backward compatibility */ + /* private data, for re-entrancy */ + char *__host_addrs[MAXADDRS]; + char *__host_aliases[MAXALIASES]; + unsigned int __host_addr[4]; +}; + +/* + * Assumption here is that a network number + * fits in an unsigned long -- probably a poor one. + */ +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net address type */ + unsigned long n_net; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; + +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in extern int h_errno). + */ + +#define NETDB_INTERNAL -1 /* see errno */ +#define NETDB_SUCCESS 0 /* no problem */ +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +/* + * Error return codes from getaddrinfo() + */ +#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NODATA 7 /* no address associated with hostname */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 +#define EAI_MAX 14 + +/* + * Flag values for getaddrinfo() + */ +#define AI_PASSIVE 0x00000001 /* get address to use bind() */ +#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ +#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ +/* valid flags for addrinfo */ +#define AI_MASK \ + (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG) + +#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ +#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ +#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ +#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ +/* special recommended flags for getipnodebyname */ +#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) + +/* + * Constants for getnameinfo() + */ +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 + +/* + * Flag values for getnameinfo() + */ +#define NI_NOFQDN 0x00000001 +#define NI_NUMERICHOST 0x00000002 +#define NI_NAMEREQD 0x00000004 +#define NI_NUMERICSERV 0x00000008 +#define NI_DGRAM 0x00000010 +#define NI_WITHSCOPEID 0x00000020 + +/* + * Scope delimit character + */ +#define SCOPE_DELIMITER '%' + +__BEGIN_DECLS +void endhostent(void); +void endhostent_r(FILE **, int *); +void endnetent(void); +void endnetgrent(void); +void endprotoent(void); +void endservent(void); +void freehostent(struct hostent *); +struct hostent *gethostbyaddr(const char *, int, int); +struct hostent *gethostbyname(const char *); +struct hostent *gethostbyname2(const char *, int); +struct hostent *gethostent(void); +int gethostent_r(struct hostent *, char *, int, int *, FILE **); +struct hostent *getipnodebyaddr(const void *, size_t, int, int *); +struct hostent *getipnodebyname(const char *, int, int, int *); +struct netent *getnetbyaddr(unsigned long, int); +struct netent *getnetbyname(const char *); +struct netent *getnetent(void); +int getnetgrent(char **, char **, char **); +struct protoent *getprotobyname(const char *); +struct protoent *getprotobynumber(int); +struct protoent *getprotoent(void); +struct servent *getservbyname(const char *, const char *); +struct servent *getservbyport(int, const char *); +struct servent *getservent(void); +void herror(const char *); +__const char *hstrerror(int); +int innetgr(const char *, const char *, const char *, const char *); +void sethostent(int); +void sethostent_r(int, FILE **, int *); +/* void sethostfile(const char *); */ +void setnetent(int); +void setprotoent(int); +int getaddrinfo(const char *, const char *, + const struct addrinfo *, struct addrinfo **); +int getnameinfo(const struct sockaddr *, socklen_t, char *, + size_t, char *, size_t, int); +void freeaddrinfo(struct addrinfo *); +char *gai_strerror(int); +void setnetgrent(const char *); +void setservent(int); + +/* + * PRIVATE functions specific to the FreeBSD implementation + */ + +/* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */ +void _sethosthtent(int); +void _sethosthtent_r(int, FILE **, int *); +void _endhosthtent(void); +void _endhosthtent_r(FILE **, int *); +void _sethostdnsent(int); +void _endhostdnsent(void); +void _setnethtent(int); +void _endnethtent(void); +void _setnetdnsent(int); +void _endnetdnsent(void); +struct hostent * _gethostbynisname(const char *, int); +struct hostent * _gethostbynisaddr(const char *, int, int); +void _map_v4v6_address(const char *, char *); +void _map_v4v6_hostent(struct hostent *, char **, int *); +__END_DECLS + +#endif /* !_NETDB_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/icmp6.h b/newlib/libc/sys/linux/include/netinet/icmp6.h new file mode 100644 index 000000000..915efda64 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/icmp6.h @@ -0,0 +1,740 @@ +/* $FreeBSD: src/sys/netinet/icmp6.h,v 1.8 2002/05/06 16:28:25 ume Exp $ */ +/* $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_ICMP6_H_ +#define _NETINET_ICMP6_H_ + +#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) + - sizeof(struct icmp6_hdr) */ + +struct icmp6_hdr { + u_int8_t icmp6_type; /* type field */ + u_int8_t icmp6_code; /* code field */ + u_int16_t icmp6_cksum; /* checksum field */ + union { + u_int32_t icmp6_un_data32[1]; /* type-specific field */ + u_int16_t icmp6_un_data16[2]; /* type-specific field */ + u_int8_t icmp6_un_data8[4]; /* type-specific field */ + } icmp6_dataun; +} __attribute__((__packed__)); + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] /* parameter prob */ +#define icmp6_mtu icmp6_data32[0] /* packet too big */ +#define icmp6_id icmp6_data16[0] /* echo request/reply */ +#define icmp6_seq icmp6_data16[1] /* echo request/reply */ +#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ + +#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ +#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ +#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ +#define ICMP6_PARAM_PROB 4 /* ip6 header bad */ + +#define ICMP6_ECHO_REQUEST 128 /* echo service */ +#define ICMP6_ECHO_REPLY 129 /* echo reply */ +#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ +#define MLD_LISTENER_QUERY 130 /* multicast listener query */ +#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ +#define MLD_LISTENER_REPORT 131 /* multicast listener report */ +#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ +#define MLD_LISTENER_DONE 132 /* multicast listener done */ + +#ifndef _KERNEL +/* the followings are for backward compatibility to old KAME apps. */ +#define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY +#define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT +#define MLD6_LISTENER_DONE MLD_LISTENER_DONE +#endif + +#define ND_ROUTER_SOLICIT 133 /* router solicitation */ +#define ND_ROUTER_ADVERT 134 /* router advertisment */ +#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ +#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */ +#define ND_REDIRECT 137 /* redirect */ + +#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ + +#define ICMP6_WRUREQUEST 139 /* who are you request */ +#define ICMP6_WRUREPLY 140 /* who are you reply */ +#define ICMP6_FQDN_QUERY 139 /* FQDN query */ +#define ICMP6_FQDN_REPLY 140 /* FQDN reply */ +#define ICMP6_NI_QUERY 139 /* node information request */ +#define ICMP6_NI_REPLY 140 /* node information reply */ + +/* The definitions below are experimental. TBA */ +#define MLD_MTRACE_RESP 200 /* mtrace resp (to sender) */ +#define MLD_MTRACE 201 /* mtrace messages */ + +#define ICMP6_HADISCOV_REQUEST 202 /* XXX To be defined */ +#define ICMP6_HADISCOV_REPLY 203 /* XXX To be defined */ + +#ifndef _KERNEL +#define MLD6_MTRACE_RESP MLD_MTRACE_RESP +#define MLD6_MTRACE MLD_MTRACE +#endif + +#define ICMP6_MAXTYPE 203 + +#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ +#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ +#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ +#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ +#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ +#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ + +#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ + +#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ +#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ +#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ + +#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ + +#define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ +#define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ +#define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ + +#define ICMP6_NI_SUCCESS 0 /* node information successful reply */ +#define ICMP6_NI_REFUSED 1 /* node information request is refused */ +#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ + +#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ +#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ +#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ + +/* Used in kernel only */ +#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ +#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ + +/* + * Multicast Listener Discovery + */ +struct mld_hdr { + struct icmp6_hdr mld_icmp6_hdr; + struct in6_addr mld_addr; /* multicast address */ +} __attribute__((__packed__)); + +/* definitions to provide backward compatibility to old KAME applications */ +#ifndef _KERNEL +#define mld6_hdr mld_hdr +#define mld6_type mld_type +#define mld6_code mld_code +#define mld6_cksum mld_cksum +#define mld6_maxdelay mld_maxdelay +#define mld6_reserved mld_reserved +#define mld6_addr mld_addr +#endif + +/* shortcut macro definitions */ +#define mld_type mld_icmp6_hdr.icmp6_type +#define mld_code mld_icmp6_hdr.icmp6_code +#define mld_cksum mld_icmp6_hdr.icmp6_cksum +#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] +#define mld_reserved mld_icmp6_hdr.icmp6_data16[1] + +/* + * Neighbor Discovery + */ + +struct nd_router_solicit { /* router solicitation */ + struct icmp6_hdr nd_rs_hdr; + /* could be followed by options */ +} __attribute__((__packed__)); + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert { /* router advertisement */ + struct icmp6_hdr nd_ra_hdr; + u_int32_t nd_ra_reachable; /* reachable time */ + u_int32_t nd_ra_retransmit; /* retransmit timer */ + /* could be followed by options */ +} __attribute__((__packed__)); + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define ND_RA_FLAG_HA 0x20 + +/* + * Router preference values based on draft-draves-ipngwg-router-selection-01. + * These are non-standard definitions. + */ +#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ + +#define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ +#define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ +#define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ +#define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ + +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit { /* neighbor solicitation */ + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; /*target address */ + /* could be followed by options */ +} __attribute__((__packed__)); + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert { /* neighbor advertisement */ + struct icmp6_hdr nd_na_hdr; + struct in6_addr nd_na_target; /* target address */ + /* could be followed by options */ +} __attribute__((__packed__)); + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if BYTE_ORDER == BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#else +#if BYTE_ORDER == LITTLE_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80 +#define ND_NA_FLAG_SOLICITED 0x40 +#define ND_NA_FLAG_OVERRIDE 0x20 +#endif +#endif + +struct nd_redirect { /* redirect */ + struct icmp6_hdr nd_rd_hdr; + struct in6_addr nd_rd_target; /* target address */ + struct in6_addr nd_rd_dst; /* destination address */ + /* could be followed by options */ +} __attribute__((__packed__)); + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct nd_opt_hdr { /* Neighbor discovery option header */ + u_int8_t nd_opt_type; + u_int8_t nd_opt_len; + /* followed by option specific data*/ +} __attribute__((__packed__)); + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 + +#define ND_OPT_ROUTE_INFO 200 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */ + +struct nd_opt_prefix_info { /* prefix information */ + u_int8_t nd_opt_pi_type; + u_int8_t nd_opt_pi_len; + u_int8_t nd_opt_pi_prefix_len; + u_int8_t nd_opt_pi_flags_reserved; + u_int32_t nd_opt_pi_valid_time; + u_int32_t nd_opt_pi_preferred_time; + u_int32_t nd_opt_pi_reserved2; + struct in6_addr nd_opt_pi_prefix; +} __attribute__((__packed__)); + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 + +struct nd_opt_rd_hdr { /* redirected header */ + u_int8_t nd_opt_rh_type; + u_int8_t nd_opt_rh_len; + u_int16_t nd_opt_rh_reserved1; + u_int32_t nd_opt_rh_reserved2; + /* followed by IP header and data */ +} __attribute__((__packed__)); + +struct nd_opt_mtu { /* MTU option */ + u_int8_t nd_opt_mtu_type; + u_int8_t nd_opt_mtu_len; + u_int16_t nd_opt_mtu_reserved; + u_int32_t nd_opt_mtu_mtu; +} __attribute__((__packed__)); + +struct nd_opt_route_info { /* route info */ + u_int8_t nd_opt_rti_type; + u_int8_t nd_opt_rti_len; + u_int8_t nd_opt_rti_prefixlen; + u_int8_t nd_opt_rti_flags; + u_int32_t nd_opt_rti_lifetime; + /* prefix follows */ +} __attribute__((__packed__)); + +/* + * icmp6 namelookup + */ + +struct icmp6_namelookup { + struct icmp6_hdr icmp6_nl_hdr; + u_int8_t icmp6_nl_nonce[8]; + int32_t icmp6_nl_ttl; +#if 0 + u_int8_t icmp6_nl_len; + u_int8_t icmp6_nl_name[3]; +#endif + /* could be followed by options */ +} __attribute__((__packed__)); + +/* + * icmp6 node information + */ +struct icmp6_nodeinfo { + struct icmp6_hdr icmp6_ni_hdr; + u_int8_t icmp6_ni_nonce[8]; + /* could be followed by reply data */ +} __attribute__((__packed__)); + +#define ni_type icmp6_ni_hdr.icmp6_type +#define ni_code icmp6_ni_hdr.icmp6_code +#define ni_cksum icmp6_ni_hdr.icmp6_cksum +#define ni_qtype icmp6_ni_hdr.icmp6_data16[0] +#define ni_flags icmp6_ni_hdr.icmp6_data16[1] + +#define NI_QTYPE_NOOP 0 /* NOOP */ +#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ +#define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ +#define NI_QTYPE_DNSNAME 2 /* DNS Name */ +#define NI_QTYPE_NODEADDR 3 /* Node Addresses */ +#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ + +#if BYTE_ORDER == BIG_ENDIAN +#define NI_SUPTYPE_FLAG_COMPRESS 0x1 +#define NI_FQDN_FLAG_VALIDTTL 0x1 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define NI_SUPTYPE_FLAG_COMPRESS 0x0100 +#define NI_FQDN_FLAG_VALIDTTL 0x0100 +#endif + +#ifdef NAME_LOOKUPS_04 +#if BYTE_ORDER == BIG_ENDIAN +#define NI_NODEADDR_FLAG_LINKLOCAL 0x1 +#define NI_NODEADDR_FLAG_SITELOCAL 0x2 +#define NI_NODEADDR_FLAG_GLOBAL 0x4 +#define NI_NODEADDR_FLAG_ALL 0x8 +#define NI_NODEADDR_FLAG_TRUNCATE 0x10 +#define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */ +#elif BYTE_ORDER == LITTLE_ENDIAN +#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100 +#define NI_NODEADDR_FLAG_SITELOCAL 0x0200 +#define NI_NODEADDR_FLAG_GLOBAL 0x0400 +#define NI_NODEADDR_FLAG_ALL 0x0800 +#define NI_NODEADDR_FLAG_TRUNCATE 0x1000 +#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */ +#endif +#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */ +#if BYTE_ORDER == BIG_ENDIAN +#define NI_NODEADDR_FLAG_TRUNCATE 0x1 +#define NI_NODEADDR_FLAG_ALL 0x2 +#define NI_NODEADDR_FLAG_COMPAT 0x4 +#define NI_NODEADDR_FLAG_LINKLOCAL 0x8 +#define NI_NODEADDR_FLAG_SITELOCAL 0x10 +#define NI_NODEADDR_FLAG_GLOBAL 0x20 +#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */ +#elif BYTE_ORDER == LITTLE_ENDIAN +#define NI_NODEADDR_FLAG_TRUNCATE 0x0100 +#define NI_NODEADDR_FLAG_ALL 0x0200 +#define NI_NODEADDR_FLAG_COMPAT 0x0400 +#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 +#define NI_NODEADDR_FLAG_SITELOCAL 0x1000 +#define NI_NODEADDR_FLAG_GLOBAL 0x2000 +#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ +#endif +#endif + +struct ni_reply_fqdn { + u_int32_t ni_fqdn_ttl; /* TTL */ + u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ + u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ +} __attribute__((__packed__)); + +/* + * Router Renumbering. as router-renum-08.txt + */ +struct icmp6_router_renum { /* router renumbering header */ + struct icmp6_hdr rr_hdr; + u_int8_t rr_segnum; + u_int8_t rr_flags; + u_int16_t rr_maxdelay; + u_int32_t rr_reserved; +} __attribute__((__packed__)); + +#define ICMP6_RR_FLAGS_TEST 0x80 +#define ICMP6_RR_FLAGS_REQRESULT 0x40 +#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 +#define ICMP6_RR_FLAGS_SPECSITE 0x10 +#define ICMP6_RR_FLAGS_PREVDONE 0x08 + +#define rr_type rr_hdr.icmp6_type +#define rr_code rr_hdr.icmp6_code +#define rr_cksum rr_hdr.icmp6_cksum +#define rr_seqnum rr_hdr.icmp6_data32[0] + +struct rr_pco_match { /* match prefix part */ + u_int8_t rpm_code; + u_int8_t rpm_len; + u_int8_t rpm_ordinal; + u_int8_t rpm_matchlen; + u_int8_t rpm_minlen; + u_int8_t rpm_maxlen; + u_int16_t rpm_reserved; + struct in6_addr rpm_prefix; +} __attribute__((__packed__)); + +#define RPM_PCO_ADD 1 +#define RPM_PCO_CHANGE 2 +#define RPM_PCO_SETGLOBAL 3 +#define RPM_PCO_MAX 4 + +struct rr_pco_use { /* use prefix part */ + u_int8_t rpu_uselen; + u_int8_t rpu_keeplen; + u_int8_t rpu_ramask; + u_int8_t rpu_raflags; + u_int32_t rpu_vltime; + u_int32_t rpu_pltime; + u_int32_t rpu_flags; + struct in6_addr rpu_prefix; +} __attribute__((__packed__)); +#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 +#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 + +#if BYTE_ORDER == BIG_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 +#endif + +struct rr_result { /* router renumbering result message */ + u_int16_t rrr_flags; + u_int8_t rrr_ordinal; + u_int8_t rrr_matchedlen; + u_int32_t rrr_ifid; + struct in6_addr rrr_prefix; +} __attribute__((__packed__)); +#if BYTE_ORDER == BIG_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 +#endif + +/* + * icmp6 filter structures. + */ + +struct icmp6_filter { + u_int32_t icmp6_filt[8]; +}; + +#ifdef _KERNEL +#define ICMP6_FILTER_SETPASSALL(filterp) \ +do { \ + int i; u_char *p; \ + p = (u_char *)filterp; \ + for (i = 0; i < sizeof(struct icmp6_filter); i++) \ + p[i] = 0xff; \ +} while (0) +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + bzero(filterp, sizeof(struct icmp6_filter)) +#else /* _KERNEL */ +#define ICMP6_FILTER_SETPASSALL(filterp) \ + memset(filterp, 0xff, sizeof(struct icmp6_filter)) +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + memset(filterp, 0x00, sizeof(struct icmp6_filter)) +#endif /* _KERNEL */ + +#define ICMP6_FILTER_SETPASS(type, filterp) \ + (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) +#define ICMP6_FILTER_SETBLOCK(type, filterp) \ + (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) +#define ICMP6_FILTER_WILLPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) +#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) + +/* + * Variables related to this implementation + * of the internet control message protocol version 6. + */ +struct icmp6errstat { + u_quad_t icp6errs_dst_unreach_noroute; + u_quad_t icp6errs_dst_unreach_admin; + u_quad_t icp6errs_dst_unreach_beyondscope; + u_quad_t icp6errs_dst_unreach_addr; + u_quad_t icp6errs_dst_unreach_noport; + u_quad_t icp6errs_packet_too_big; + u_quad_t icp6errs_time_exceed_transit; + u_quad_t icp6errs_time_exceed_reassembly; + u_quad_t icp6errs_paramprob_header; + u_quad_t icp6errs_paramprob_nextheader; + u_quad_t icp6errs_paramprob_option; + u_quad_t icp6errs_redirect; /* we regard redirect as an error here */ + u_quad_t icp6errs_unknown; +}; + +struct icmp6stat { +/* statistics related to icmp6 packets generated */ + u_quad_t icp6s_error; /* # of calls to icmp6_error */ + u_quad_t icp6s_canterror; /* no error 'cuz old was icmp */ + u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */ + u_quad_t icp6s_outhist[256]; +/* statistics related to input message processed */ + u_quad_t icp6s_badcode; /* icmp6_code out of range */ + u_quad_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */ + u_quad_t icp6s_checksum; /* bad checksum */ + u_quad_t icp6s_badlen; /* calculated bound mismatch */ + /* + * number of responses: this member is inherited from netinet code, but + * for netinet6 code, it is already available in icp6s_outhist[]. + */ + u_quad_t icp6s_reflect; + u_quad_t icp6s_inhist[256]; + u_quad_t icp6s_nd_toomanyopt; /* too many ND options */ + struct icmp6errstat icp6s_outerrhist; +#define icp6s_odst_unreach_noroute \ + icp6s_outerrhist.icp6errs_dst_unreach_noroute +#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin +#define icp6s_odst_unreach_beyondscope \ + icp6s_outerrhist.icp6errs_dst_unreach_beyondscope +#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr +#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport +#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big +#define icp6s_otime_exceed_transit \ + icp6s_outerrhist.icp6errs_time_exceed_transit +#define icp6s_otime_exceed_reassembly \ + icp6s_outerrhist.icp6errs_time_exceed_reassembly +#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header +#define icp6s_oparamprob_nextheader \ + icp6s_outerrhist.icp6errs_paramprob_nextheader +#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option +#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect +#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown + u_quad_t icp6s_pmtuchg; /* path MTU changes */ + u_quad_t icp6s_nd_badopt; /* bad ND options */ + u_quad_t icp6s_badns; /* bad neighbor solicitation */ + u_quad_t icp6s_badna; /* bad neighbor advertisement */ + u_quad_t icp6s_badrs; /* bad router advertisement */ + u_quad_t icp6s_badra; /* bad router advertisement */ + u_quad_t icp6s_badredirect; /* bad redirect message */ +}; + +/* + * Names for ICMP sysctl objects + */ +#define ICMPV6CTL_STATS 1 +#define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */ +#define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */ +#if 0 /*obsoleted*/ +#define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */ +#endif +#define ICMPV6CTL_ND6_PRUNE 6 +#define ICMPV6CTL_ND6_DELAY 8 +#define ICMPV6CTL_ND6_UMAXTRIES 9 +#define ICMPV6CTL_ND6_MMAXTRIES 10 +#define ICMPV6CTL_ND6_USELOOPBACK 11 +/*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */ +#define ICMPV6CTL_NODEINFO 13 +#define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */ +#define ICMPV6CTL_ND6_MAXNUDHINT 15 +#define ICMPV6CTL_MTUDISC_HIWAT 16 +#define ICMPV6CTL_MTUDISC_LOWAT 17 +#define ICMPV6CTL_ND6_DEBUG 18 +#define ICMPV6CTL_ND6_DRLIST 19 +#define ICMPV6CTL_ND6_PRLIST 20 +#define ICMPV6CTL_MAXID 21 + +#define ICMPV6CTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ + { "rediraccept", CTLTYPE_INT }, \ + { "redirtimeout", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "nd6_prune", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "nd6_delay", CTLTYPE_INT }, \ + { "nd6_umaxtries", CTLTYPE_INT }, \ + { "nd6_mmaxtries", CTLTYPE_INT }, \ + { "nd6_useloopback", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "nodeinfo", CTLTYPE_INT }, \ + { "errppslimit", CTLTYPE_INT }, \ + { "nd6_maxnudhint", CTLTYPE_INT }, \ + { "mtudisc_hiwat", CTLTYPE_INT }, \ + { "mtudisc_lowat", CTLTYPE_INT }, \ + { "nd6_debug", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ +} + +#define RTF_PROBEMTU RTF_PROTO1 + +#ifdef _KERNEL +# ifdef __STDC__ +struct rtentry; +struct rttimer; +struct in6_multi; +# endif +void icmp6_init(void); +void icmp6_paramerror(struct mbuf *, int); +void icmp6_error(struct mbuf *, int, int, int); +int icmp6_input(struct mbuf **, int *, int); +void icmp6_fasttimo(void); +void icmp6_reflect(struct mbuf *, size_t); +void icmp6_prepare(struct mbuf *); +void icmp6_redirect_input(struct mbuf *, int); +void icmp6_redirect_output(struct mbuf *, struct rtentry *); + +struct ip6ctlparam; +void icmp6_mtudisc_update(struct ip6ctlparam *, int); + +/* XXX: is this the right place for these macros? */ +#define icmp6_ifstat_inc(ifp, tag) \ +do { \ + if ((ifp) && (ifp)->if_index <= if_index \ + && (ifp)->if_index < icmp6_ifstatmax \ + && icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) { \ + icmp6_ifstat[(ifp)->if_index]->tag++; \ + } \ +} while (0) + +#define icmp6_ifoutstat_inc(ifp, type, code) \ +do { \ + icmp6_ifstat_inc(ifp, ifs6_out_msg); \ + if (type < ICMP6_INFOMSG_MASK) \ + icmp6_ifstat_inc(ifp, ifs6_out_error); \ + switch(type) { \ + case ICMP6_DST_UNREACH: \ + icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \ + if (code == ICMP6_DST_UNREACH_ADMIN) \ + icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \ + break; \ + case ICMP6_PACKET_TOO_BIG: \ + icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \ + break; \ + case ICMP6_TIME_EXCEEDED: \ + icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \ + break; \ + case ICMP6_PARAM_PROB: \ + icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \ + break; \ + case ICMP6_ECHO_REQUEST: \ + icmp6_ifstat_inc(ifp, ifs6_out_echo); \ + break; \ + case ICMP6_ECHO_REPLY: \ + icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \ + break; \ + case MLD_LISTENER_QUERY: \ + icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \ + break; \ + case MLD_LISTENER_REPORT: \ + icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \ + break; \ + case MLD_LISTENER_DONE: \ + icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \ + break; \ + case ND_ROUTER_SOLICIT: \ + icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \ + break; \ + case ND_ROUTER_ADVERT: \ + icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \ + break; \ + case ND_NEIGHBOR_SOLICIT: \ + icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \ + break; \ + case ND_NEIGHBOR_ADVERT: \ + icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \ + break; \ + case ND_REDIRECT: \ + icmp6_ifstat_inc(ifp, ifs6_out_redirect); \ + break; \ + } \ +} while (0) + +extern int icmp6_rediraccept; /* accept/process redirects */ +extern int icmp6_redirtimeout; /* cache time for redirect routes */ +#endif /* _KERNEL */ + +#endif /* not _NETINET_ICMP6_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/icmp_var.h b/newlib/libc/sys/linux/include/netinet/icmp_var.h new file mode 100644 index 000000000..79ce146db --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/icmp_var.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)icmp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/icmp_var.h,v 1.21 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_ICMP_VAR_H_ +#define _NETINET_ICMP_VAR_H_ + + +/* + * Variables related to this implementation + * of the internet control message protocol. + */ +struct icmpstat { +/* statistics related to icmp packets generated */ + u_long icps_error; /* # of calls to icmp_error */ + u_long icps_oldshort; /* no error 'cuz old ip too short */ + u_long icps_oldicmp; /* no error 'cuz old was icmp */ + u_long icps_outhist[ICMP_MAXTYPE + 1]; +/* statistics related to input messages processed */ + u_long icps_badcode; /* icmp_code out of range */ + u_long icps_tooshort; /* packet < ICMP_MINLEN */ + u_long icps_checksum; /* bad checksum */ + u_long icps_badlen; /* calculated bound mismatch */ + u_long icps_reflect; /* number of responses */ + u_long icps_inhist[ICMP_MAXTYPE + 1]; + u_long icps_bmcastecho; /* b/mcast echo requests dropped */ + u_long icps_bmcasttstamp; /* b/mcast tstamp requests dropped */ + u_long icps_badaddr; /* bad return address */ + u_long icps_noroute; /* no route back */ +}; + +/* + * Names for ICMP sysctl objects + */ +#define ICMPCTL_MASKREPL 1 /* allow replies to netmask requests */ +#define ICMPCTL_STATS 2 /* statistics (read-only) */ +#define ICMPCTL_ICMPLIM 3 +#define ICMPCTL_MAXID 4 + +#define ICMPCTL_NAMES { \ + { 0, 0 }, \ + { "maskrepl", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "icmplim", CTLTYPE_INT }, \ +} + +#ifdef _KERNEL +SYSCTL_DECL(_net_inet_icmp); +extern int badport_bandlim(int); +#define BANDLIM_UNLIMITED -1 +#define BANDLIM_ICMP_UNREACH 0 +#define BANDLIM_ICMP_ECHO 1 +#define BANDLIM_ICMP_TSTAMP 2 +#define BANDLIM_RST_CLOSEDPORT 3 /* No connection, and no listeners */ +#define BANDLIM_RST_OPENPORT 4 /* No connection, listener */ +#define BANDLIM_MAX 4 +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/if_atm.h b/newlib/libc/sys/linux/include/netinet/if_atm.h new file mode 100644 index 000000000..04ce13ea2 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/if_atm.h @@ -0,0 +1,47 @@ +/* $FreeBSD: src/sys/netinet/if_atm.h,v 1.5 2002/03/19 21:25:46 alfred Exp $ */ +/* $NetBSD: if_atm.h,v 1.2 1996/07/03 17:17:17 chuck Exp $ */ + +/* + * + * Copyright (c) 1996 Charles D. Cranor and Washington University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Charles D. Cranor and + * Washington University. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * if_atm.h + */ + +struct atm_pseudohdr; +struct mbuf; +struct rtentry; +struct sockaddr; + +void atm_rtrequest(int, struct rtentry *, struct rt_addrinfo *); +int atmresolve(struct rtentry *, struct mbuf *, struct sockaddr *, + struct atm_pseudohdr *); diff --git a/newlib/libc/sys/linux/include/netinet/if_ether.h b/newlib/libc/sys/linux/include/netinet/if_ether.h new file mode 100644 index 000000000..ec65a3e58 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/if_ether.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 + * $FreeBSD: src/sys/netinet/if_ether.h,v 1.27 2002/03/24 10:19:10 bde Exp $ + */ + +#ifndef _NETINET_IF_ETHER_H_ +#define _NETINET_IF_ETHER_H_ + +#include +#include + +/* + * Macro to map an IP multicast address to an Ethernet multicast address. + * The high-order 25 bits of the Ethernet address are statically assigned, + * and the low-order 23 bits are taken from the low end of the IP address. + */ +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ + /* struct in_addr *ipaddr; */ \ + /* u_char enaddr[ETHER_ADDR_LEN]; */ \ +{ \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((u_char *)ipaddr)[2]; \ + (enaddr)[5] = ((u_char *)ipaddr)[3]; \ +} +/* + * Macro to map an IP6 multicast address to an Ethernet multicast address. + * The high-order 16 bits of the Ethernet address are statically assigned, + * and the low-order 32 bits are taken from the low end of the IP6 address. + */ +#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \ +/* struct in6_addr *ip6addr; */ \ +/* u_char enaddr[ETHER_ADDR_LEN]; */ \ +{ \ + (enaddr)[0] = 0x33; \ + (enaddr)[1] = 0x33; \ + (enaddr)[2] = ((u_char *)ip6addr)[12]; \ + (enaddr)[3] = ((u_char *)ip6addr)[13]; \ + (enaddr)[4] = ((u_char *)ip6addr)[14]; \ + (enaddr)[5] = ((u_char *)ip6addr)[15]; \ +} + +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_char arp_sha[ETHER_ADDR_LEN]; /* sender hardware address */ + u_char arp_spa[4]; /* sender protocol address */ + u_char arp_tha[ETHER_ADDR_LEN]; /* target hardware address */ + u_char arp_tpa[4]; /* target protocol address */ +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +struct sockaddr_inarp { + u_char sin_len; + u_char sin_family; + u_short sin_port; + struct in_addr sin_addr; + struct in_addr sin_srcaddr; + u_short sin_tos; + u_short sin_other; +#define SIN_PROXY 1 +}; +/* + * IP and ethernet specific routing flags + */ +#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */ +#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */ + +#ifdef _KERNEL +extern u_char ether_ipmulticast_min[ETHER_ADDR_LEN]; +extern u_char ether_ipmulticast_max[ETHER_ADDR_LEN]; +extern struct ifqueue arpintrq; + +int arpresolve(struct ifnet *, struct rtentry *, struct mbuf *, + struct sockaddr *, u_char *, struct rtentry *); +void arp_ifinit(struct ifnet *, struct ifaddr *); +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/igmp.h b/newlib/libc/sys/linux/include/netinet/igmp.h new file mode 100644 index 000000000..448265abf --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/igmp.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)igmp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/igmp.h,v 1.10 1999/08/28 00:49:15 peter Exp $ + */ + +#ifndef _NETINET_IGMP_H_ +#define _NETINET_IGMP_H_ + +/* + * Internet Group Management Protocol (IGMP) definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST Revision: 3.5.1.2 + */ + +/* + * IGMP packet format. + */ +struct igmp { + u_char igmp_type; /* version & type of IGMP message */ + u_char igmp_code; /* subtype for routing msgs */ + u_short igmp_cksum; /* IP-style checksum */ + struct in_addr igmp_group; /* group address being reported */ +}; /* (zero for queries) */ + +#define IGMP_MINLEN 8 + +/* + * Message types, including version number. + */ +#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ + +#define IGMP_DVMRP 0x13 /* DVMRP routing message */ +#define IGMP_PIM 0x14 /* PIM routing message */ + +#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/ +#define IGMP_MTRACE 0x1f /* mcast traceroute messages */ + +#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ + /* query (in seconds) according */ + /* to RFC1112 */ + + +#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */ + /* specifies time in 10th of seconds*/ + +/* + * The following four defininitions are for backwards compatibility. + * They should be removed as soon as all applications are updated to + * use the new constant names. + */ +#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY +#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP + +#endif /* _NETINET_IGMP_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/igmp_var.h b/newlib/libc/sys/linux/include/netinet/igmp_var.h new file mode 100644 index 000000000..1cb6570f8 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/igmp_var.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 + * $FreeBSD: src/sys/netinet/igmp_var.h,v 1.19 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_IGMP_VAR_H_ +#define _NETINET_IGMP_VAR_H_ + +/* + * Internet Group Management Protocol (IGMP), + * implementation-specific definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST Revision: 3.5.1.3 + */ + +struct igmpstat { + u_int igps_rcv_total; /* total IGMP messages received */ + u_int igps_rcv_tooshort; /* received with too few bytes */ + u_int igps_rcv_badsum; /* received with bad checksum */ + u_int igps_rcv_queries; /* received membership queries */ + u_int igps_rcv_badqueries; /* received invalid queries */ + u_int igps_rcv_reports; /* received membership reports */ + u_int igps_rcv_badreports; /* received invalid reports */ + u_int igps_rcv_ourreports; /* received reports for our groups */ + u_int igps_snd_reports; /* sent membership reports */ +}; + +#ifdef _KERNEL +#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1) + +/* + * States for IGMPv2's leave processing + */ +#define IGMP_OTHERMEMBER 0 +#define IGMP_IREPORTEDLAST 1 + +/* + * We must remember what version the subnet's querier is. + * We conveniently use the IGMP message type for the proper + * membership report to keep this state. + */ +#define IGMP_V1_ROUTER IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_V2_ROUTER IGMP_V2_MEMBERSHIP_REPORT + +/* + * Revert to new router if we haven't heard from an old router in + * this amount of time. + */ +#define IGMP_AGE_THRESHOLD 540 + +void igmp_init(void); +void igmp_input(struct mbuf *, int); +void igmp_joingroup(struct in_multi *); +void igmp_leavegroup(struct in_multi *); +void igmp_fasttimo(void); +void igmp_slowtimo(void); + +SYSCTL_DECL(_net_inet_igmp); + +#endif + +/* + * Names for IGMP sysctl objects + */ +#define IGMPCTL_STATS 1 /* statistics (read-only) */ +#define IGMPCTL_MAXID 2 + +#define IGMPCTL_NAMES { \ + { 0, 0 }, \ + { "stats", CTLTYPE_STRUCT }, \ +} +#endif diff --git a/newlib/libc/sys/linux/include/netinet/in.h b/newlib/libc/sys/linux/include/netinet/in.h new file mode 100644 index 000000000..19bc3f1bc --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/in.h @@ -0,0 +1,569 @@ +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + * $FreeBSD: src/sys/netinet/in.h,v 1.68 2002/04/24 01:26:11 mike Exp $ + */ + +#ifndef _NETINET_IN_H_ +#define _NETINET_IN_H_ + +#include +#include +#include +#include + +/* Protocols common to RFC 1700, POSIX, and X/Open. */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_UDP 17 /* user datagram protocol */ + +#define INADDR_ANY (u_int32_t)0x00000000 +#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */ + +#ifndef _UINT8_T_DECLARED +typedef __uint8_t uint8_t; +#define _UINT8_T_DECLARED +#endif + +#ifndef _UINT16_T_DECLARED +typedef __uint16_t uint16_t; +#define _UINT16_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _IN_ADDR_T_DECLARED +typedef uint32_t in_addr_t; +#define _IN_ADDR_T_DECLARED +#endif + +#ifndef _IN_PORT_T_DECLARED +typedef uint16_t in_port_t; +#define _IN_PORT_T_DECLARED +#endif + +typedef unsigned short sa_family_t; + +#ifdef _BSD_SA_FAMILY_T_ +typedef _BSD_SA_FAMILY_T_ sa_family_t; +#undef _BSD_SA_FAMILY_T_ +#endif + +/* Internet address (a structure for historical reasons). */ +#ifndef _STRUCT_IN_ADDR_DECLARED +struct in_addr { + in_addr_t s_addr; +}; +#define _STRUCT_IN_ADDR_DECLARED +#endif + +/* Socket address, internet style. */ +struct sockaddr_in { + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +#if __POSIX_VISIBLE >= 200112 +#define IPPROTO_RAW 255 /* raw IP packet */ +#define INET_ADDRSTRLEN 16 +#endif + +#define __BSD_VISIBLE 1 +#if __BSD_VISIBLE +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981, and numerous additions. + */ + +/* + * Protocols (RFC 1700) + */ +#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ +#define IPPROTO_IGMP 2 /* group mgmt protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_IPV4 4 /* IPv4 encapsulation */ +#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */ +#define IPPROTO_ST 7 /* Stream protocol II */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PIGP 9 /* private interior gateway */ +#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */ +#define IPPROTO_NVPII 11 /* network voice protocol*/ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_ARGUS 13 /* Argus */ +#define IPPROTO_EMCON 14 /* EMCON */ +#define IPPROTO_XNET 15 /* Cross Net Debugger */ +#define IPPROTO_CHAOS 16 /* Chaos*/ +#define IPPROTO_MUX 18 /* Multiplexing */ +#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */ +#define IPPROTO_HMP 20 /* Host Monitoring */ +#define IPPROTO_PRM 21 /* Packet Radio Measurement */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_TRUNK1 23 /* Trunk-1 */ +#define IPPROTO_TRUNK2 24 /* Trunk-2 */ +#define IPPROTO_LEAF1 25 /* Leaf-1 */ +#define IPPROTO_LEAF2 26 /* Leaf-2 */ +#define IPPROTO_RDP 27 /* Reliable Data */ +#define IPPROTO_IRTP 28 /* Reliable Transaction */ +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ +#define IPPROTO_BLT 30 /* Bulk Data Transfer */ +#define IPPROTO_NSP 31 /* Network Services */ +#define IPPROTO_INP 32 /* Merit Internodal */ +#define IPPROTO_SEP 33 /* Sequential Exchange */ +#define IPPROTO_3PC 34 /* Third Party Connect */ +#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */ +#define IPPROTO_XTP 36 /* XTP */ +#define IPPROTO_DDP 37 /* Datagram Delivery */ +#define IPPROTO_CMTP 38 /* Control Message Transport */ +#define IPPROTO_TPXX 39 /* TP++ Transport */ +#define IPPROTO_IL 40 /* IL transport protocol */ +#define IPPROTO_IPV6 41 /* IP6 header */ +#define IPPROTO_SDRP 42 /* Source Demand Routing */ +#define IPPROTO_ROUTING 43 /* IP6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ +#define IPPROTO_IDRP 45 /* InterDomain Routing*/ +#define IPPROTO_RSVP 46 /* resource reservation */ +#define IPPROTO_GRE 47 /* General Routing Encap. */ +#define IPPROTO_MHRP 48 /* Mobile Host Routing */ +#define IPPROTO_BHA 49 /* BHA */ +#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */ +#define IPPROTO_AH 51 /* IP6 Auth Header */ +#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */ +#define IPPROTO_SWIPE 53 /* IP with encryption */ +#define IPPROTO_NHRP 54 /* Next Hop Resolution */ +#define IPPROTO_MOBILE 55 /* IP Mobility */ +#define IPPROTO_TLSP 56 /* Transport Layer Security */ +#define IPPROTO_SKIP 57 /* SKIP */ +#define IPPROTO_ICMPV6 58 /* ICMP6 */ +#define IPPROTO_NONE 59 /* IP6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IP6 destination option */ +#define IPPROTO_AHIP 61 /* any host internal protocol */ +#define IPPROTO_CFTP 62 /* CFTP */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */ +#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */ +#define IPPROTO_RVD 66 /* Remote Virtual Disk */ +#define IPPROTO_IPPC 67 /* Pluribus Packet Core */ +#define IPPROTO_ADFS 68 /* Any distributed FS */ +#define IPPROTO_SATMON 69 /* Satnet Monitoring */ +#define IPPROTO_VISA 70 /* VISA Protocol */ +#define IPPROTO_IPCV 71 /* Packet Core Utility */ +#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */ +#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */ +#define IPPROTO_WSN 74 /* Wang Span Network */ +#define IPPROTO_PVP 75 /* Packet Video Protocol */ +#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */ +#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */ +#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */ +#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */ +#define IPPROTO_EON 80 /* ISO cnlp */ +#define IPPROTO_VMTP 81 /* VMTP */ +#define IPPROTO_SVMTP 82 /* Secure VMTP */ +#define IPPROTO_VINES 83 /* Banyon VINES */ +#define IPPROTO_TTP 84 /* TTP */ +#define IPPROTO_IGP 85 /* NSFNET-IGP */ +#define IPPROTO_DGP 86 /* dissimilar gateway prot. */ +#define IPPROTO_TCF 87 /* TCF */ +#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */ +#define IPPROTO_OSPFIGP 89 /* OSPFIGP */ +#define IPPROTO_SRPC 90 /* Strite RPC protocol */ +#define IPPROTO_LARP 91 /* Locus Address Resoloution */ +#define IPPROTO_MTP 92 /* Multicast Transport */ +#define IPPROTO_AX25 93 /* AX.25 Frames */ +#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */ +#define IPPROTO_MICP 95 /* Mobile Int.ing control */ +#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */ +#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */ +#define IPPROTO_ENCAP 98 /* encapsulation header */ +#define IPPROTO_APES 99 /* any private encr. scheme */ +#define IPPROTO_GMTP 100 /* GMTP*/ +#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */ +/* 101-254: Partly Unassigned */ +#define IPPROTO_PIM 103 /* Protocol Independent Mcast */ +#define IPPROTO_PGM 113 /* PGM */ +/* 255: Reserved */ +/* BSD Private, local use, namespace incursion */ +#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */ +#define IPPROTO_MAX 256 + +/* last return value of *_input(), meaning "all job for this pkt is done". */ +#define IPPROTO_DONE 257 + +/* + * Local port number conventions: + * + * When a user does a bind(2) or connect(2) with a port number of zero, + * a non-conflicting local port address is chosen. + * The default range is IPPORT_HIFIRSTAUTO through + * IPPORT_HILASTAUTO, although that is settable by sysctl. + * + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this + * default assignment range. + * + * The value IP_PORTRANGE_DEFAULT causes the default behavior. + * + * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers + * into the "high" range. These are reserved for client outbound connections + * which do not want to be filtered by any firewalls. Note that by default + * this is the same as IP_PORTRANGE_DEFAULT. + * + * The value IP_PORTRANGE_LOW changes the range to the "low" are + * that is (by convention) restricted to privileged processes. This + * convention is based on "vouchsafe" principles only. It is only secure + * if you trust the remote host to restrict these ports. + * + * The default range of ports and the high range can be changed by + * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) + * + * Changing those values has bad security implications if you are + * using a a stateless firewall that is allowing packets outside of that + * range in order to allow transparent outgoing connections. + * + * Such a firewall configuration will generally depend on the use of these + * default values. If you change them, you may find your Security + * Administrator looking for you with a heavy object. + * + * For a slightly more orthodox text view on this: + * + * ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers + * + * port numbers are divided into three ranges: + * + * 0 - 1023 Well Known Ports + * 1024 - 49151 Registered Ports + * 49152 - 65535 Dynamic and/or Private Ports + * + */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). (IP_PORTRANGE_LOW) + */ +#define IPPORT_RESERVED 1024 + +/* + * Default local port range, used by both IP_PORTRANGE_DEFAULT + * and IP_PORTRANGE_HIGH. + */ +#define IPPORT_HIFIRSTAUTO 49152 +#define IPPORT_HILASTAUTO 65535 + +/* + * Scanning for a free reserved port return a value below IPPORT_RESERVED, + * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was + * 512, but that conflicts with some well-known-services that firewalls may + * have a fit if we use. + */ +#define IPPORT_RESERVEDSTART 600 + +#define IPPORT_MAX 65535 + +#ifndef _UINT8_T_DECLARED +typedef __uint8_t uint8_t; +#define _UINT8_T_DECLARED +#endif + +#ifndef _UINT16_T_DECLARED +typedef __uint16_t uint16_t; +#define _UINT16_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _IN_ADDR_T_DECLARED +typedef uint32_t in_addr_t; +#define _IN_ADDR_T_DECLARED +#endif + +#ifndef _IN_PORT_T_DECLARED +typedef uint16_t in_port_t; +#define _IN_PORT_T_DECLARED +#endif + +#ifdef _BSD_SA_FAMILY_T_ +typedef _BSD_SA_FAMILY_T_ sa_family_t; +#undef _BSD_SA_FAMILY_T_ +#endif + +/* + * Internet address (a structure for historical reasons) + */ +#ifndef _STRUCT_IN_ADDR_DECLARED +struct in_addr { + in_addr_t s_addr; +}; +#define _STRUCT_IN_ADDR_DECLARED +#endif + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_LOOPBACK (u_int32_t)0x7f000001 +#ifndef _KERNEL +#define INADDR_NONE 0xffffffff /* -1 return */ +#endif + +#define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001 /* 224.0.0.1 */ +#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */ +#define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Options for use with [gs]etsockopt at the IP level. + * First word of comment is data type; bool is stored in int. + */ +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ +#define IP_HDRINCL 2 /* int; header is included with data */ +#define IP_TOS 3 /* int; IP type of service and preced. */ +#define IP_TTL 4 /* int; IP time to live */ +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ +#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ +#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ +#define IP_RSVP_ON 15 /* enable RSVP in kernel */ +#define IP_RSVP_OFF 16 /* disable RSVP in kernel */ +#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ +#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ +#define IP_PORTRANGE 19 /* int; range to choose for unspec port */ +#define IP_RECVIF 20 /* bool; receive reception if w/dgram */ +/* for IPSEC */ +#define IP_IPSEC_POLICY 21 /* int; set/get security policy */ +#define IP_FAITH 22 /* bool; accept FAITH'ed connections */ + +#define IP_FW_ADD 50 /* add a firewall rule to chain */ +#define IP_FW_DEL 51 /* delete a firewall rule from chain */ +#define IP_FW_FLUSH 52 /* flush firewall rule chain */ +#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */ +#define IP_FW_GET 54 /* get entire firewall rule chain */ +#define IP_FW_RESETLOG 55 /* reset logging counters */ + +#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */ +#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */ +#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */ +#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */ + +/* + * Defaults and limits for options + */ +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ +#define IP_MAX_MEMBERSHIPS 20 /* per socket */ + +/* + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +/* + * Argument for IP_PORTRANGE: + * - which range to search when port is unspecified at bind() or connect() + */ +#define IP_PORTRANGE_DEFAULT 0 /* default range */ +#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ +#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ + +/* + * Definitions for inet sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */ + +#define CTL_IPPROTO_NAMES { \ + { "ip", CTLTYPE_NODE }, \ + { "icmp", CTLTYPE_NODE }, \ + { "igmp", CTLTYPE_NODE }, \ + { "ggp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "tcp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { "egp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pup", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "udp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "idp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "ipsec", CTLTYPE_NODE }, \ +} + +/* + * Names for IP sysctl objects + */ +#define IPCTL_FORWARDING 1 /* act as router */ +#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ +#define IPCTL_DEFTTL 3 /* default TTL */ +#ifdef notyet +#define IPCTL_DEFMTU 4 /* default MTU */ +#endif +#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ +#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ +#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ +#define IPCTL_SOURCEROUTE 8 /* may perform source routes */ +#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */ +#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */ +#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */ +#define IPCTL_STATS 12 /* ipstat structure */ +#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */ +#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */ +#define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */ +#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */ +#define IPCTL_MAXID 17 + +#define IPCTL_NAMES { \ + { 0, 0 }, \ + { "forwarding", CTLTYPE_INT }, \ + { "redirect", CTLTYPE_INT }, \ + { "ttl", CTLTYPE_INT }, \ + { "mtu", CTLTYPE_INT }, \ + { "rtexpire", CTLTYPE_INT }, \ + { "rtminexpire", CTLTYPE_INT }, \ + { "rtmaxcache", CTLTYPE_INT }, \ + { "sourceroute", CTLTYPE_INT }, \ + { "directed-broadcast", CTLTYPE_INT }, \ + { "intr-queue-maxlen", CTLTYPE_INT }, \ + { "intr-queue-drops", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "accept_sourceroute", CTLTYPE_INT }, \ + { "fastforwarding", CTLTYPE_INT }, \ +} + +#endif /* __BSD_VISIBLE */ + +#ifdef _KERNEL + +struct ifnet; struct mbuf; /* forward declarations for Standard C */ + +int in_broadcast(struct in_addr, struct ifnet *); +int in_canforward(struct in_addr); +int in_localaddr(struct in_addr); +char *inet_ntoa(struct in_addr); /* in libkern */ +char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ + +#define satosin(sa) ((struct sockaddr_in *)(sa)) +#define sintosa(sin) ((struct sockaddr *)(sin)) +#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) + +#endif /* _KERNEL */ + +/* INET6 stuff */ +#define __KAME_NETINET_IN_H_INCLUDED_ +#include +#undef __KAME_NETINET_IN_H_INCLUDED_ + +#endif /* !_NETINET_IN_H_*/ diff --git a/newlib/libc/sys/linux/include/netinet/in_gif.h b/newlib/libc/sys/linux/include/netinet/in_gif.h new file mode 100644 index 000000000..cf5392009 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/in_gif.h @@ -0,0 +1,42 @@ +/* $FreeBSD: src/sys/netinet/in_gif.h,v 1.8 2002/03/19 21:25:46 alfred Exp $ */ +/* $KAME: in_gif.h,v 1.5 2000/04/14 08:36:02 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET_IN_GIF_H_ +#define _NETINET_IN_GIF_H_ + +#define GIF_TTL 30 + +void in_gif_input(struct mbuf *, int off); +int in_gif_output(struct ifnet *, int, struct mbuf *, struct rtentry *); +int gif_encapcheck4(const struct mbuf *, int, int, void *); + +#endif /*_NETINET_IN_GIF_H_*/ diff --git a/newlib/libc/sys/linux/include/netinet/in_pcb.h b/newlib/libc/sys/linux/include/netinet/in_pcb.h new file mode 100644 index 000000000..50ddd273c --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/in_pcb.h @@ -0,0 +1,335 @@ +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.48 2002/04/09 20:04:10 jhb Exp $ + */ + +#ifndef _NETINET_IN_PCB_H_ +#define _NETINET_IN_PCB_H_ + +#include + +#include +#include /* for IPSEC */ +#include + +#define in6pcb inpcb /* for KAME src sync over BSD*'s */ +#define in6p_sp inp_sp /* for KAME src sync over BSD*'s */ + +/* + * Common structure pcb for internet protocol implementation. + * Here are stored pointers to local and foreign host table + * entries, local and foreign socket numbers, and pointers + * up (to a socket structure) and down (to a protocol-specific) + * control block. + */ +LIST_HEAD(inpcbhead, inpcb); +LIST_HEAD(inpcbporthead, inpcbport); +typedef u_quad_t inp_gen_t; + +/* + * PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet. + * So, AF_INET6 null laddr is also used as AF_INET null laddr, + * by utilize following structure. (At last, same as INRIA) + */ +struct in_addr_4in6 { + u_int32_t ia46_pad32[3]; + struct in_addr ia46_addr4; +}; + +/* + * NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553. + * in_conninfo has some extra padding to accomplish this. + */ +struct in_endpoints { + u_int16_t ie_fport; /* foreign port */ + u_int16_t ie_lport; /* local port */ + /* protocol dependent part, local and foreign addr */ + union { + /* foreign host table entry */ + struct in_addr_4in6 ie46_foreign; + struct in6_addr ie6_foreign; + } ie_dependfaddr; + union { + /* local host table entry */ + struct in_addr_4in6 ie46_local; + struct in6_addr ie6_local; + } ie_dependladdr; +#define ie_faddr ie_dependfaddr.ie46_foreign.ia46_addr4 +#define ie_laddr ie_dependladdr.ie46_local.ia46_addr4 +#define ie6_faddr ie_dependfaddr.ie6_foreign +#define ie6_laddr ie_dependladdr.ie6_local +}; + +/* + * XXX + * At some point struct route should possibly change to: + * struct rtentry *rt + * struct in_endpoints *ie; + */ +struct in_conninfo { + u_int8_t inc_flags; + u_int8_t inc_len; + u_int16_t inc_pad; /* XXX alignment for in_endpoints */ + /* protocol dependent part; cached route */ + struct in_endpoints inc_ie; + union { + /* placeholder for routing entry */ + struct route inc4_route; + struct route_in6 inc6_route; + } inc_dependroute; +}; +#define inc_isipv6 inc_flags /* temp compatability */ +#define inc_fport inc_ie.ie_fport +#define inc_lport inc_ie.ie_lport +#define inc_faddr inc_ie.ie_faddr +#define inc_laddr inc_ie.ie_laddr +#define inc_route inc_dependroute.inc4_route +#define inc6_faddr inc_ie.ie6_faddr +#define inc6_laddr inc_ie.ie6_laddr +#define inc6_route inc_dependroute.inc6_route + +struct icmp6_filter; + +struct inpcb { + LIST_ENTRY(inpcb) inp_hash; /* hash list */ + LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */ + u_int32_t inp_flow; + + /* local and foreign ports, local and foreign addr */ + struct in_conninfo inp_inc; + + caddr_t inp_ppcb; /* pointer to per-protocol pcb */ + struct inpcbinfo *inp_pcbinfo; /* PCB list info */ + struct socket *inp_socket; /* back pointer to socket */ + /* list for this PCB's local port */ + int inp_flags; /* generic IP/datagram flags */ + + struct inpcbpolicy *inp_sp; /* for IPSEC */ + u_char inp_vflag; /* IP version flag (v4/v6) */ +#define INP_IPV4 0x1 +#define INP_IPV6 0x2 + u_char inp_ip_ttl; /* time to live proto */ + u_char inp_ip_p; /* protocol proto */ + + /* protocol dependent part; options */ + struct { + u_char inp4_ip_tos; /* type of service proto */ + struct mbuf *inp4_options; /* IP options */ + struct ip_moptions *inp4_moptions; /* IP multicast options */ + } inp_depend4; +#define inp_fport inp_inc.inc_fport +#define inp_lport inp_inc.inc_lport +#define inp_faddr inp_inc.inc_faddr +#define inp_laddr inp_inc.inc_laddr +#define inp_route inp_inc.inc_route +#define inp_ip_tos inp_depend4.inp4_ip_tos +#define inp_options inp_depend4.inp4_options +#define inp_moptions inp_depend4.inp4_moptions + struct { + /* IP options */ + struct mbuf *inp6_options; + /* IP6 options for outgoing packets */ + struct ip6_pktopts *inp6_outputopts; + /* IP multicast options */ + struct ip6_moptions *inp6_moptions; + /* ICMPv6 code type filter */ + struct icmp6_filter *inp6_icmp6filt; + /* IPV6_CHECKSUM setsockopt */ + int inp6_cksum; + u_short inp6_ifindex; + short inp6_hops; + u_int8_t inp6_hlim; + } inp_depend6; + LIST_ENTRY(inpcb) inp_portlist; + struct inpcbport *inp_phd; /* head of this list */ + inp_gen_t inp_gencnt; /* generation count of this instance */ +#define in6p_faddr inp_inc.inc6_faddr +#define in6p_laddr inp_inc.inc6_laddr +#define in6p_route inp_inc.inc6_route +#define in6p_ip6_hlim inp_depend6.inp6_hlim +#define in6p_hops inp_depend6.inp6_hops /* default hop limit */ +#define in6p_ip6_nxt inp_ip_p +#define in6p_flowinfo inp_flow +#define in6p_vflag inp_vflag +#define in6p_options inp_depend6.inp6_options +#define in6p_outputopts inp_depend6.inp6_outputopts +#define in6p_moptions inp_depend6.inp6_moptions +#define in6p_icmp6filt inp_depend6.inp6_icmp6filt +#define in6p_cksum inp_depend6.inp6_cksum +#define inp6_ifindex inp_depend6.inp6_ifindex +#define in6p_flags inp_flags /* for KAME src sync over BSD*'s */ +#define in6p_socket inp_socket /* for KAME src sync over BSD*'s */ +#define in6p_lport inp_lport /* for KAME src sync over BSD*'s */ +#define in6p_fport inp_fport /* for KAME src sync over BSD*'s */ +#define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */ +}; +/* + * The range of the generation count, as used in this implementation, + * is 9e19. We would have to create 300 billion connections per + * second for this number to roll over in a year. This seems sufficiently + * unlikely that we simply don't concern ourselves with that possibility. + */ + +/* + * Interface exported to userland by various protocols which use + * inpcbs. Hack alert -- only define if struct xsocket is in scope. + */ +#ifdef _SYS_SOCKETVAR_H_ +struct xinpcb { + size_t xi_len; /* length of this structure */ + struct inpcb xi_inp; + struct xsocket xi_socket; + u_quad_t xi_alignment_hack; +}; + +struct xinpgen { + size_t xig_len; /* length of this structure */ + u_int xig_count; /* number of PCBs at this time */ + inp_gen_t xig_gen; /* generation count at this time */ + so_gen_t xig_sogen; /* socket generation count at this time */ +}; +#endif /* _SYS_SOCKETVAR_H_ */ + +struct inpcbport { + LIST_ENTRY(inpcbport) phd_hash; + struct inpcbhead phd_pcblist; + u_short phd_port; +}; + +struct inpcbinfo { /* XXX documentation, prefixes */ + struct inpcbhead *hashbase; + u_long hashmask; + struct inpcbporthead *porthashbase; + u_long porthashmask; + struct inpcbhead *listhead; + u_short lastport; + u_short lastlow; + u_short lasthi; + uma_zone_t ipi_zone; /* zone to allocate pcbs from */ + u_int ipi_count; /* number of pcbs in this list */ + u_quad_t ipi_gencnt; /* current generation count */ +}; + +#define INP_PCBHASH(faddr, lport, fport, mask) \ + (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) +#define INP_PCBPORTHASH(lport, mask) \ + (ntohs((lport)) & (mask)) + +/* flags in inp_flags: */ +#define INP_RECVOPTS 0x01 /* receive incoming IP options */ +#define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ +#define INP_RECVDSTADDR 0x04 /* receive IP dst address */ +#define INP_HDRINCL 0x08 /* user supplies entire IP header */ +#define INP_HIGHPORT 0x10 /* user wants "high" port binding */ +#define INP_LOWPORT 0x20 /* user wants "low" port binding */ +#define INP_ANONPORT 0x40 /* port chosen for user */ +#define INP_RECVIF 0x80 /* receive incoming interface */ +#define INP_MTUDISC 0x100 /* user can do MTU discovery */ +#define INP_FAITH 0x200 /* accept FAITH'ed connections */ + +#define IN6P_IPV6_V6ONLY 0x008000 /* restrict AF_INET6 socket for v6 */ + +#define IN6P_PKTINFO 0x010000 /* receive IP6 dst and I/F */ +#define IN6P_HOPLIMIT 0x020000 /* receive hoplimit */ +#define IN6P_HOPOPTS 0x040000 /* receive hop-by-hop options */ +#define IN6P_DSTOPTS 0x080000 /* receive dst options after rthdr */ +#define IN6P_RTHDR 0x100000 /* receive routing header */ +#define IN6P_RTHDRDSTOPTS 0x200000 /* receive dstoptions before rthdr */ +#define IN6P_AUTOFLOWLABEL 0x800000 /* attach flowlabel automatically */ +#define IN6P_BINDV6ONLY 0x10000000 /* do not grab IPv4 traffic */ + +#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ + INP_RECVIF|\ + IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ + IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ + IN6P_AUTOFLOWLABEL) +#define INP_UNMAPPABLEOPTS (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR|\ + IN6P_AUTOFLOWLABEL) + + /* for KAME src sync over BSD*'s */ +#define IN6P_HIGHPORT INP_HIGHPORT +#define IN6P_LOWPORT INP_LOWPORT +#define IN6P_ANONPORT INP_ANONPORT +#define IN6P_RECVIF INP_RECVIF +#define IN6P_MTUDISC INP_MTUDISC +#define IN6P_FAITH INP_FAITH +#define IN6P_CONTROLOPTS INP_CONTROLOPTS + /* + * socket AF version is {newer than,or include} + * actual datagram AF version + */ + +#define INPLOOKUP_WILDCARD 1 +#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) +#define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ + +#define INP_SOCKAF(so) so->so_proto->pr_domain->dom_family + +#define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af) + +#ifdef _KERNEL +extern int ipport_lowfirstauto; +extern int ipport_lowlastauto; +extern int ipport_firstauto; +extern int ipport_lastauto; +extern int ipport_hifirstauto; +extern int ipport_hilastauto; + +void in_pcbpurgeif0(struct inpcb *, struct ifnet *); +void in_losing(struct inpcb *); +void in_rtchange(struct inpcb *, int); +int in_pcballoc(struct socket *, struct inpcbinfo *, struct thread *); +int in_pcbbind(struct inpcb *, struct sockaddr *, struct thread *); +int in_pcbconnect(struct inpcb *, struct sockaddr *, struct thread *); +void in_pcbdetach(struct inpcb *); +void in_pcbdisconnect(struct inpcb *); +int in_pcbinshash(struct inpcb *); +int in_pcbladdr(struct inpcb *, struct sockaddr *, + struct sockaddr_in **); +struct inpcb * + in_pcblookup_local(struct inpcbinfo *, + struct in_addr, u_int, int); +struct inpcb * + in_pcblookup_hash(struct inpcbinfo *, struct in_addr, u_int, + struct in_addr, u_int, int, struct ifnet *); +void in_pcbnotifyall(struct inpcbhead *, struct in_addr, + int, void (*)(struct inpcb *, int)); +void in_pcbrehash(struct inpcb *); +int in_setpeeraddr(struct socket *so, struct sockaddr **nam); +int in_setsockaddr(struct socket *so, struct sockaddr **nam); +void in_pcbremlists(struct inpcb *inp); +int prison_xinpcb(struct thread *td, struct inpcb *inp); +#endif /* _KERNEL */ + +#endif /* !_NETINET_IN_PCB_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/in_systm.h b/newlib/libc/sys/linux/include/netinet/in_systm.h new file mode 100644 index 000000000..62cea64f1 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/in_systm.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/in_systm.h,v 1.10 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_IN_SYSTM_H_ +#define _NETINET_IN_SYSTM_H_ + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef u_int16_t n_short; /* short as received from the net */ +typedef u_int32_t n_long; /* long as received from the net */ + +typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */ + +#ifdef _KERNEL +n_time iptime(void); +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/in_var.h b/newlib/libc/sys/linux/include/netinet/in_var.h new file mode 100644 index 000000000..ce97b5a11 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/in_var.h @@ -0,0 +1,243 @@ +/* + * Copyright (c) 1985, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_var.h 8.2 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/netinet/in_var.h,v 1.45 2002/03/24 10:19:10 bde Exp $ + */ + +#ifndef _NETINET_IN_VAR_H_ +#define _NETINET_IN_VAR_H_ + +#include +#include + +/* + * Interface address, Internet version. One of these structures + * is allocated for each Internet address on an interface. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ +struct in_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + /* ia_{,sub}net{,mask} in host order */ + u_long ia_net; /* network number of interface */ + u_long ia_netmask; /* mask of net part */ + u_long ia_subnet; /* subnet number, including net */ + u_long ia_subnetmask; /* mask of subnet part */ + struct in_addr ia_netbroadcast; /* to recognize net broadcasts */ + LIST_ENTRY(in_ifaddr) ia_hash; /* entry in bucket of inet addresses */ + TAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ + struct sockaddr_in ia_addr; /* reserve space for interface name */ + struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ +#define ia_broadaddr ia_dstaddr + struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ +}; + +struct in_aliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr_in ifra_addr; + struct sockaddr_in ifra_broadaddr; +#define ifra_dstaddr ifra_broadaddr + struct sockaddr_in ifra_mask; +}; +/* + * Given a pointer to an in_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in. + */ +#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) +#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr)) + +#define IN_LNAOF(in, ifa) \ + ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) + + +#ifdef _KERNEL +extern struct ifqueue ipintrq; /* ip packet input queue */ +extern struct in_addr zeroin_addr; +extern u_char inetctlerrmap[]; + +/* + * Hash table for IP addresses. + */ +extern LIST_HEAD(in_ifaddrhashhead, in_ifaddr) *in_ifaddrhashtbl; +extern TAILQ_HEAD(in_ifaddrhead, in_ifaddr) in_ifaddrhead; +extern u_long in_ifaddrhmask; /* mask for hash table */ + +#define INADDR_NHASH_LOG2 9 +#define INADDR_NHASH (1 << INADDR_NHASH_LOG2) +#define INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) +#define INADDR_HASH(x) \ + (&in_ifaddrhashtbl[INADDR_HASHVAL(x) & in_ifaddrhmask]) + + +/* + * Macro for finding the interface (ifnet structure) corresponding to one + * of our IP addresses. + */ +#define INADDR_TO_IFP(addr, ifp) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ +{ \ + struct in_ifaddr *ia; \ +\ + LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \ + if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ + break; \ + (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \ +} + +/* + * Macro for finding the internet address structure (in_ifaddr) corresponding + * to a given interface (ifnet structure). + */ +#define IFP_TO_IA(ifp, ia) \ + /* struct ifnet *ifp; */ \ + /* struct in_ifaddr *ia; */ \ +{ \ + for ((ia) = TAILQ_FIRST(&in_ifaddrhead); \ + (ia) != NULL && (ia)->ia_ifp != (ifp); \ + (ia) = TAILQ_NEXT((ia), ia_link)) \ + continue; \ +} +#endif + +/* + * This information should be part of the ifnet structure but we don't wish + * to change that - as it might break a number of things + */ + +struct router_info { + struct ifnet *rti_ifp; + int rti_type; /* type of router which is querier on this interface */ + int rti_time; /* # of slow timeouts since last old query */ + struct router_info *rti_next; +}; + +/* + * Internet multicast address structure. There is one of these for each IP + * multicast group to which this host belongs on a given network interface. + * For every entry on the interface's if_multiaddrs list which represents + * an IP multicast group, there is one of these structures. They are also + * kept on a system-wide list to make it easier to keep our legacy IGMP code + * compatible with the rest of the world (see IN_FIRST_MULTI et al, below). + */ +struct in_multi { + LIST_ENTRY(in_multi) inm_link; /* queue macro glue */ + struct in_addr inm_addr; /* IP multicast address, convenience */ + struct ifnet *inm_ifp; /* back pointer to ifnet */ + struct ifmultiaddr *inm_ifma; /* back pointer to ifmultiaddr */ + u_int inm_timer; /* IGMP membership report timer */ + u_int inm_state; /* state of the membership */ + struct router_info *inm_rti; /* router info*/ +}; + +#ifdef _KERNEL + +#ifdef SYSCTL_DECL +SYSCTL_DECL(_net_inet_ip); +SYSCTL_DECL(_net_inet_raw); +#endif + +extern LIST_HEAD(in_multihead, in_multi) in_multihead; + +/* + * Structure used by macros below to remember position when stepping through + * all of the in_multi records. + */ +struct in_multistep { + struct in_multi *i_inm; +}; + +/* + * Macro for looking up the in_multi record for a given IP multicast address + * on a given interface. If no matching record is found, "inm" is set null. + */ +#define IN_LOOKUP_MULTI(addr, ifp, inm) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ + /* struct in_multi *inm; */ \ +do { \ + struct ifmultiaddr *ifma; \ +\ + TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \ + if (ifma->ifma_addr->sa_family == AF_INET \ + && ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \ + (addr).s_addr) \ + break; \ + } \ + (inm) = ifma ? ifma->ifma_protospec : 0; \ +} while(0) + +/* + * Macro to step through all of the in_multi records, one at a time. + * The current position is remembered in "step", which the caller must + * provide. IN_FIRST_MULTI(), below, must be called to initialize "step" + * and get the first record. Both macros return a NULL "inm" when there + * are no remaining records. + */ +#define IN_NEXT_MULTI(step, inm) \ + /* struct in_multistep step; */ \ + /* struct in_multi *inm; */ \ +do { \ + if (((inm) = (step).i_inm) != NULL) \ + (step).i_inm = LIST_NEXT((step).i_inm, inm_link); \ +} while(0) + +#define IN_FIRST_MULTI(step, inm) \ + /* struct in_multistep step; */ \ + /* struct in_multi *inm; */ \ +do { \ + (step).i_inm = LIST_FIRST(&in_multihead); \ + IN_NEXT_MULTI((step), (inm)); \ +} while(0) + +struct route; +struct in_multi *in_addmulti(struct in_addr *, struct ifnet *); +void in_delmulti(struct in_multi *); +int in_control(struct socket *, u_long, caddr_t, struct ifnet *, + struct thread *); +void in_rtqdrain(void); +void ip_input(struct mbuf *); +int in_ifadown(struct ifaddr *ifa, int); +void in_ifscrub(struct ifnet *, struct in_ifaddr *); +int ipflow_fastforward(struct mbuf *); +void ipflow_create(const struct route *, struct mbuf *); +void ipflow_slowtimo(void); + +#endif /* _KERNEL */ + +/* INET6 stuff */ +#include + +#endif /* _NETINET_IN_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/ip.h b/newlib/libc/sys/linux/include/netinet/ip.h new file mode 100644 index 000000000..0e6df1eea --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip.h @@ -0,0 +1,190 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip.h 8.2 (Berkeley) 6/1/94 + * $FreeBSD: src/sys/netinet/ip.h,v 1.19 2001/12/14 19:37:32 rwatson Exp $ + */ + +#ifndef _NETINET_IP_H_ +#define _NETINET_IP_H_ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + */ +struct ip { +#ifdef _IP_VHL + u_char ip_vhl; /* version << 4 | header length >> 2 */ +#else +#if BYTE_ORDER == LITTLE_ENDIAN + u_int ip_hl:4, /* header length */ + ip_v:4; /* version */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int ip_v:4, /* version */ + ip_hl:4; /* header length */ +#endif +#endif /* not _IP_VHL */ + u_char ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#ifdef _IP_VHL +#define IP_MAKE_VHL(v, hl) ((v) << 4 | (hl)) +#define IP_VHL_HL(vhl) ((vhl) & 0x0f) +#define IP_VHL_V(vhl) ((vhl) >> 4) +#define IP_VHL_BORING 0x45 +#endif + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for IP type of service (ip_tos) + */ +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_MINCOST 0x02 +/* ECN bits proposed by Sally Floyd */ +#define IPTOS_CE 0x01 /* congestion experienced */ +#define IPTOS_ECT 0x02 /* ECN-capable transport */ + + +/* + * Definitions for IP precedence (also in ip_tos) (hopefully unused) + */ +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_ESO 133 /* extended security */ +#define IPOPT_CIPSO 134 /* commerical security */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ +#define IPOPT_RA 148 /* router alert */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_char ipt_code; /* IPOPT_TS */ + u_char ipt_len; /* size of structure (variable) */ + u_char ipt_ptr; /* index of current entry */ +#if BYTE_ORDER == LITTLE_ENDIAN + u_int ipt_flg:4, /* flags, see below */ + ipt_oflw:4; /* overflow counter */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ +#endif + union ipt_timestamp { + n_long ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + n_long ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +}; + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 3 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/ip6.h b/newlib/libc/sys/linux/include/netinet/ip6.h new file mode 100644 index 000000000..6c5cbe1d1 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip6.h @@ -0,0 +1,308 @@ +/* $FreeBSD: src/sys/netinet/ip6.h,v 1.5 2001/06/11 12:39:00 ume Exp $ */ +/* $KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_IP6_H_ +#define _NETINET_IP6_H_ + +/* + * Definition for internet protocol version 6. + * RFC 2460 + */ + +struct ip6_hdr { + union { + struct ip6_hdrctl { + u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ + u_int16_t ip6_un1_plen; /* payload length */ + u_int8_t ip6_un1_nxt; /* next header */ + u_int8_t ip6_un1_hlim; /* hop limit */ + } ip6_un1; + u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ + } ip6_ctlun; + struct in6_addr ip6_src; /* source address */ + struct in6_addr ip6_dst; /* destination address */ +} __attribute__((__packed__)); + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +#define IPV6_VERSION 0x60 +#define IPV6_VERSION_MASK 0xf0 + +#if BYTE_ORDER == BIG_ENDIAN +#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */ +#else +#if BYTE_ORDER == LITTLE_ENDIAN +#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */ +#endif /* LITTLE_ENDIAN */ +#endif +#if 1 +/* ECN bits proposed by Sally Floyd */ +#define IP6TOS_CE 0x01 /* congestion experienced */ +#define IP6TOS_ECT 0x02 /* ECN-capable transport */ +#endif + +/* + * Extension Headers + */ + +struct ip6_ext { + u_int8_t ip6e_nxt; + u_int8_t ip6e_len; +} __attribute__((__packed__)); + +/* Hop-by-Hop options header */ +/* XXX should we pad it to force alignment on an 8-byte boundary? */ +struct ip6_hbh { + u_int8_t ip6h_nxt; /* next header */ + u_int8_t ip6h_len; /* length in units of 8 octets */ + /* followed by options */ +} __attribute__((__packed__)); + +/* Destination options header */ +/* XXX should we pad it to force alignment on an 8-byte boundary? */ +struct ip6_dest { + u_int8_t ip6d_nxt; /* next header */ + u_int8_t ip6d_len; /* length in units of 8 octets */ + /* followed by options */ +} __attribute__((__packed__)); + +/* Option types and related macros */ +#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ +#define IP6OPT_PADN 0x01 /* 00 0 00001 */ +#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ +#define IP6OPT_NSAP_ADDR 0xC3 /* 11 0 00011 */ +#define IP6OPT_TUNNEL_LIMIT 0x04 /* 00 0 00100 */ +#define IP6OPT_RTALERT 0x05 /* 00 0 00101 (KAME definition) */ + +#define IP6OPT_RTALERT_LEN 4 +#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ +#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ +#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ +#define IP6OPT_MINLEN 2 + +#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ +#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ +#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ +#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ +#define IP6OPT_EID 0x8a /* 10 0 01010 */ + +#define IP6OPT_TYPE(o) ((o) & 0xC0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xC0 + +#define IP6OPT_MUTABLE 0x20 + +#define IP6OPT_JUMBO_LEN 6 + +/* Routing header */ +struct ip6_rthdr { + u_int8_t ip6r_nxt; /* next header */ + u_int8_t ip6r_len; /* length in units of 8 octets */ + u_int8_t ip6r_type; /* routing type */ + u_int8_t ip6r_segleft; /* segments left */ + /* followed by routing type specific data */ +} __attribute__((__packed__)); + +/* Type 0 Routing header */ +struct ip6_rthdr0 { + u_int8_t ip6r0_nxt; /* next header */ + u_int8_t ip6r0_len; /* length in units of 8 octets */ + u_int8_t ip6r0_type; /* always zero */ + u_int8_t ip6r0_segleft; /* segments left */ + u_int8_t ip6r0_reserved; /* reserved field */ + u_int8_t ip6r0_slmap[3]; /* strict/loose bit map */ + struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */ +} __attribute__((__packed__)); + +/* Fragment header */ +struct ip6_frag { + u_int8_t ip6f_nxt; /* next header */ + u_int8_t ip6f_reserved; /* reserved field */ + u_int16_t ip6f_offlg; /* offset, reserved, and flag */ + u_int32_t ip6f_ident; /* identification */ +} __attribute__((__packed__)); + +#if BYTE_ORDER == BIG_ENDIAN +#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +/* + * Internet implementation parameters. + */ +#define IPV6_MAXHLIM 255 /* maximun hoplimit */ +#define IPV6_DEFHLIM 64 /* default hlim */ +#define IPV6_FRAGTTL 120 /* ttl for fragment packets, in slowtimo tick */ +#define IPV6_HLIMDEC 1 /* subtracted when forwaeding */ + +#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */ +#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/ + +#ifdef _KERNEL +/* + * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the + * target header (including IPv6 itself, extension headers and + * TCP/UDP/ICMP6 headers) are continuous. KAME requires drivers + * to store incoming data into one internal mbuf or one or more external + * mbufs(never into two or more internal mbufs). Thus, the third case is + * supposed to never be matched but is prepared just in case. + */ + +#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \ +do { \ + if ((m)->m_next != NULL) { \ + if (((m)->m_flags & M_LOOP) && \ + ((m)->m_len < (off) + (hlen)) && \ + (((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \ + ip6stat.ip6s_exthdrtoolong++; \ + return ret; \ + } else if ((m)->m_flags & M_EXT) { \ + if ((m)->m_len < (off) + (hlen)) { \ + ip6stat.ip6s_exthdrtoolong++; \ + m_freem(m); \ + return ret; \ + } \ + } else { \ + if ((m)->m_len < (off) + (hlen)) { \ + ip6stat.ip6s_exthdrtoolong++; \ + m_freem(m); \ + return ret; \ + } \ + } \ + } else { \ + if ((m)->m_len < (off) + (hlen)) { \ + ip6stat.ip6s_tooshort++; \ + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \ + m_freem(m); \ + return ret; \ + } \ + } \ +} while (0) + +/* + * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to + * "len") is located in single mbuf, on contiguous memory region. + * The pointer to the region will be returned to pointer variable "val", + * with type "typ". + * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the + * very top of mbuf. GET0 is likely to make memory copy than GET. + * + * XXX we're now testing this, needs m_pulldown() + */ +#define IP6_EXTHDR_GET(val, typ, m, off, len) \ +do { \ + struct mbuf *t; \ + int tmp; \ + if ((m)->m_len >= (off) + (len)) \ + (val) = (typ)(mtod((m), caddr_t) + (off)); \ + else { \ + t = m_pulldown((m), (off), (len), &tmp); \ + if (t) { \ + if (t->m_len < tmp + (len)) \ + panic("m_pulldown malfunction"); \ + (val) = (typ)(mtod(t, caddr_t) + tmp); \ + } else { \ + (val) = (typ)NULL; \ + (m) = NULL; \ + } \ + } \ +} while (0) + +#define IP6_EXTHDR_GET0(val, typ, m, off, len) \ +do { \ + struct mbuf *t; \ + if ((off) == 0) \ + (val) = (typ)mtod(m, caddr_t); \ + else { \ + t = m_pulldown((m), (off), (len), NULL); \ + if (t) { \ + if (t->m_len < (len)) \ + panic("m_pulldown malfunction"); \ + (val) = (typ)mtod(t, caddr_t); \ + } else { \ + (val) = (typ)NULL; \ + (m) = NULL; \ + } \ + } \ +} while (0) +#endif /*_KERNEL*/ + +#endif /* not _NETINET_IP6_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/ip_dummynet.h b/newlib/libc/sys/linux/include/netinet/ip_dummynet.h new file mode 100644 index 000000000..509172f29 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_dummynet.h @@ -0,0 +1,361 @@ +/* + * Copyright (c) 1998-2002 Luigi Rizzo, Universita` di Pisa + * Portions Copyright (c) 2000 Akamba Corp. + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet/ip_dummynet.h,v 1.18 2002/05/05 21:27:47 luigi Exp $ + */ + +#ifndef _IP_DUMMYNET_H +#define _IP_DUMMYNET_H + +/* + * Definition of dummynet data structures. In the structures, I decided + * not to use the macros in in the hope of making the code + * easier to port to other architectures. The type of lists and queue we + * use here is pretty simple anyways. + */ + +/* + * We start with a heap, which is used in the scheduler to decide when + * to transmit packets etc. + * + * The key for the heap is used for two different values: + * + * 1. timer ticks- max 10K/second, so 32 bits are enough; + * + * 2. virtual times. These increase in steps of len/x, where len is the + * packet length, and x is either the weight of the flow, or the + * sum of all weights. + * If we limit to max 1000 flows and a max weight of 100, then + * x needs 17 bits. The packet size is 16 bits, so we can easily + * overflow if we do not allow errors. + * So we use a key "dn_key" which is 64 bits. Some macros are used to + * compare key values and handle wraparounds. + * MAX64 returns the largest of two key values. + * MY_M is used as a shift count when doing fixed point arithmetic + * (a better name would be useful...). + */ +typedef u_int64_t dn_key ; /* sorting key */ +#define DN_KEY_LT(a,b) ((int64_t)((a)-(b)) < 0) +#define DN_KEY_LEQ(a,b) ((int64_t)((a)-(b)) <= 0) +#define DN_KEY_GT(a,b) ((int64_t)((a)-(b)) > 0) +#define DN_KEY_GEQ(a,b) ((int64_t)((a)-(b)) >= 0) +#define MAX64(x,y) (( (int64_t) ( (y)-(x) )) > 0 ) ? (y) : (x) +#define MY_M 16 /* number of left shift to obtain a larger precision */ + +/* + * XXX With this scaling, max 1000 flows, max weight 100, 1Gbit/s, the + * virtual time wraps every 15 days. + */ + +/* + * The OFFSET_OF macro is used to return the offset of a field within + * a structure. It is used by the heap management routines. + */ +#define OFFSET_OF(type, field) ((int)&( ((type *)0)->field) ) + +/* + * A heap entry is made of a key and a pointer to the actual + * object stored in the heap. + * The heap is an array of dn_heap_entry entries, dynamically allocated. + * Current size is "size", with "elements" actually in use. + * The heap normally supports only ordered insert and extract from the top. + * If we want to extract an object from the middle of the heap, we + * have to know where the object itself is located in the heap (or we + * need to scan the whole array). To this purpose, an object has a + * field (int) which contains the index of the object itself into the + * heap. When the object is moved, the field must also be updated. + * The offset of the index in the object is stored in the 'offset' + * field in the heap descriptor. The assumption is that this offset + * is non-zero if we want to support extract from the middle. + */ +struct dn_heap_entry { + dn_key key ; /* sorting key. Topmost element is smallest one */ + void *object ; /* object pointer */ +} ; + +struct dn_heap { + int size ; + int elements ; + int offset ; /* XXX if > 0 this is the offset of direct ptr to obj */ + struct dn_heap_entry *p ; /* really an array of "size" entries */ +} ; + +/* + * MT_DUMMYNET is a new (fake) mbuf type that is prepended to the + * packet when it comes out of a pipe. The definition + * ought to go in /sys/sys/mbuf.h but here it is less intrusive. + */ + +#define MT_DUMMYNET MT_CONTROL + +/* + * struct dn_pkt identifies a packet in the dummynet queue. The + * first part is really an m_hdr for implementation purposes, and some + * fields are saved there. When passing the packet back to the ip_input/ + * ip_output()/bdg_forward, the struct is prepended to the mbuf chain with type + * MT_DUMMYNET, and contains the pointer to the matching rule. + * + * Note: there is no real need to make this structure contain an m_hdr, + * in the future this should be changed to a normal data structure. + */ +struct dn_pkt { + struct m_hdr hdr ; +#define dn_next hdr.mh_nextpkt /* next element in queue */ +#define DN_NEXT(x) (struct dn_pkt *)(x)->dn_next +#define dn_m hdr.mh_next /* packet to be forwarded */ +#define dn_dir hdr.mh_flags /* action when pkt extracted from a queue */ +#define DN_TO_IP_OUT 1 +#define DN_TO_IP_IN 2 +#define DN_TO_BDG_FWD 3 + + dn_key output_time; /* when the pkt is due for delivery */ + struct ifnet *ifp; /* interface, for ip_output */ + struct sockaddr_in *dn_dst ; + struct route ro; /* route, for ip_output. MUST COPY */ + int flags ; /* flags, for ip_output (IPv6 ?) */ +}; + +/* + * Overall structure of dummynet (with WF2Q+): + +In dummynet, packets are selected with the firewall rules, and passed +to two different objects: PIPE or QUEUE. + +A QUEUE is just a queue with configurable size and queue management +policy. It is also associated with a mask (to discriminate among +different flows), a weight (used to give different shares of the +bandwidth to different flows) and a "pipe", which essentially +supplies the transmit clock for all queues associated with that +pipe. + +A PIPE emulates a fixed-bandwidth link, whose bandwidth is +configurable. The "clock" for a pipe can come from either an +internal timer, or from the transmit interrupt of an interface. +A pipe is also associated with one (or more, if masks are used) +queue, where all packets for that pipe are stored. + +The bandwidth available on the pipe is shared by the queues +associated with that pipe (only one in case the packet is sent +to a PIPE) according to the WF2Q+ scheduling algorithm and the +configured weights. + +In general, incoming packets are stored in the appropriate queue, +which is then placed into one of a few heaps managed by a scheduler +to decide when the packet should be extracted. +The scheduler (a function called dummynet()) is run at every timer +tick, and grabs queues from the head of the heaps when they are +ready for processing. + +There are three data structures definining a pipe and associated queues: + + + dn_pipe, which contains the main configuration parameters related + to delay and bandwidth; + + dn_flow_set, which contains WF2Q+ configuration, flow + masks, plr and RED configuration; + + dn_flow_queue, which is the per-flow queue (containing the packets) + +Multiple dn_flow_set can be linked to the same pipe, and multiple +dn_flow_queue can be linked to the same dn_flow_set. +All data structures are linked in a linear list which is used for +housekeeping purposes. + +During configuration, we create and initialize the dn_flow_set +and dn_pipe structures (a dn_pipe also contains a dn_flow_set). + +At runtime: packets are sent to the appropriate dn_flow_set (either +WFQ ones, or the one embedded in the dn_pipe for fixed-rate flows), +which in turn dispatches them to the appropriate dn_flow_queue +(created dynamically according to the masks). + +The transmit clock for fixed rate flows (ready_event()) selects the +dn_flow_queue to be used to transmit the next packet. For WF2Q, +wfq_ready_event() extract a pipe which in turn selects the right +flow using a number of heaps defined into the pipe itself. + + * + */ + +/* + * per flow queue. This contains the flow identifier, the queue + * of packets, counters, and parameters used to support both RED and + * WF2Q+. + * + * A dn_flow_queue is created and initialized whenever a packet for + * a new flow arrives. + */ +struct dn_flow_queue { + struct dn_flow_queue *next ; + struct ipfw_flow_id id ; + + struct dn_pkt *head, *tail ; /* queue of packets */ + u_int len ; + u_int len_bytes ; + long numbytes ; /* credit for transmission (dynamic queues) */ + + u_int64_t tot_pkts ; /* statistics counters */ + u_int64_t tot_bytes ; + u_int32_t drops ; + + int hash_slot ; /* debugging/diagnostic */ + + /* RED parameters */ + int avg ; /* average queue length est. (scaled) */ + int count ; /* arrivals since last RED drop */ + int random ; /* random value (scaled) */ + u_int32_t q_time ; /* start of queue idle time */ + + /* WF2Q+ support */ + struct dn_flow_set *fs ; /* parent flow set */ + int heap_pos ; /* position (index) of struct in heap */ + dn_key sched_time ; /* current time when queue enters ready_heap */ + + dn_key S,F ; /* start time, finish time */ + /* + * Setting F < S means the timestamp is invalid. We only need + * to test this when the queue is empty. + */ +} ; + +/* + * flow_set descriptor. Contains the "template" parameters for the + * queue configuration, and pointers to the hash table of dn_flow_queue's. + * + * The hash table is an array of lists -- we identify the slot by + * hashing the flow-id, then scan the list looking for a match. + * The size of the hash table (buckets) is configurable on a per-queue + * basis. + * + * A dn_flow_set is created whenever a new queue or pipe is created (in the + * latter case, the structure is located inside the struct dn_pipe). + */ +struct dn_flow_set { + struct dn_flow_set *next; /* next flow set in all_flow_sets list */ + + u_short fs_nr ; /* flow_set number */ + u_short flags_fs; +#define DN_HAVE_FLOW_MASK 0x0001 +#define DN_IS_RED 0x0002 +#define DN_IS_GENTLE_RED 0x0004 +#define DN_QSIZE_IS_BYTES 0x0008 /* queue size is measured in bytes */ +#define DN_IS_PIPE 0x4000 +#define DN_IS_QUEUE 0x8000 + + struct dn_pipe *pipe ; /* pointer to parent pipe */ + u_short parent_nr ; /* parent pipe#, 0 if local to a pipe */ + + int weight ; /* WFQ queue weight */ + int qsize ; /* queue size in slots or bytes */ + int plr ; /* pkt loss rate (2^31-1 means 100%) */ + + struct ipfw_flow_id flow_mask ; + + /* hash table of queues onto this flow_set */ + int rq_size ; /* number of slots */ + int rq_elements ; /* active elements */ + struct dn_flow_queue **rq; /* array of rq_size entries */ + + u_int32_t last_expired ; /* do not expire too frequently */ + int backlogged ; /* #active queues for this flowset */ + + /* RED parameters */ +#define SCALE_RED 16 +#define SCALE(x) ( (x) << SCALE_RED ) +#define SCALE_VAL(x) ( (x) >> SCALE_RED ) +#define SCALE_MUL(x,y) ( ( (x) * (y) ) >> SCALE_RED ) + int w_q ; /* queue weight (scaled) */ + int max_th ; /* maximum threshold for queue (scaled) */ + int min_th ; /* minimum threshold for queue (scaled) */ + int max_p ; /* maximum value for p_b (scaled) */ + u_int c_1 ; /* max_p/(max_th-min_th) (scaled) */ + u_int c_2 ; /* max_p*min_th/(max_th-min_th) (scaled) */ + u_int c_3 ; /* for GRED, (1-max_p)/max_th (scaled) */ + u_int c_4 ; /* for GRED, 1 - 2*max_p (scaled) */ + u_int * w_q_lookup ; /* lookup table for computing (1-w_q)^t */ + u_int lookup_depth ; /* depth of lookup table */ + int lookup_step ; /* granularity inside the lookup table */ + int lookup_weight ; /* equal to (1-w_q)^t / (1-w_q)^(t+1) */ + int avg_pkt_size ; /* medium packet size */ + int max_pkt_size ; /* max packet size */ +} ; + +/* + * Pipe descriptor. Contains global parameters, delay-line queue, + * and the flow_set used for fixed-rate queues. + * + * For WF2Q+ support it also has 3 heaps holding dn_flow_queue: + * not_eligible_heap, for queues whose start time is higher + * than the virtual time. Sorted by start time. + * scheduler_heap, for queues eligible for scheduling. Sorted by + * finish time. + * idle_heap, all flows that are idle and can be removed. We + * do that on each tick so we do not slow down too much + * operations during forwarding. + * + */ +struct dn_pipe { /* a pipe */ + struct dn_pipe *next ; + + int pipe_nr ; /* number */ + int bandwidth; /* really, bytes/tick. */ + int delay ; /* really, ticks */ + + struct dn_pkt *head, *tail ; /* packets in delay line */ + + /* WF2Q+ */ + struct dn_heap scheduler_heap ; /* top extract - key Finish time*/ + struct dn_heap not_eligible_heap; /* top extract- key Start time */ + struct dn_heap idle_heap ; /* random extract - key Start=Finish time */ + + dn_key V ; /* virtual time */ + int sum; /* sum of weights of all active sessions */ + int numbytes; /* bits I can transmit (more or less). */ + + dn_key sched_time ; /* time pipe was scheduled in ready_heap */ + + /* + * When the tx clock come from an interface (if_name[0] != '\0'), its name + * is stored below, whereas the ifp is filled when the rule is configured. + */ + char if_name[16]; + struct ifnet *ifp ; + int ready ; /* set if ifp != NULL and we got a signal from it */ + + struct dn_flow_set fs ; /* used with fixed-rate flows */ +}; + +#ifdef _KERNEL +typedef int ip_dn_ctl_t(struct sockopt *); /* raw_ip.c */ +typedef void ip_dn_ruledel_t(void *); /* ip_fw.c */ +typedef int ip_dn_io_t(int pipe, int dir, struct mbuf *m, + struct ifnet *ifp, struct route *ro, struct sockaddr_in * dst, + struct ip_fw *rule, int flags); /* ip_{in,out}put.c, bridge.c */ +extern ip_dn_ctl_t *ip_dn_ctl_ptr; +extern ip_dn_ruledel_t *ip_dn_ruledel_ptr; +extern ip_dn_io_t *ip_dn_io_ptr; +#define DUMMYNET_LOADED (ip_dn_io_ptr != NULL) +#endif + +#endif /* _IP_DUMMYNET_H */ diff --git a/newlib/libc/sys/linux/include/netinet/ip_ecn.h b/newlib/libc/sys/linux/include/netinet/ip_ecn.h new file mode 100644 index 000000000..9f82168b6 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_ecn.h @@ -0,0 +1,49 @@ +/* $FreeBSD: src/sys/netinet/ip_ecn.h,v 1.5 2002/03/19 21:25:46 alfred Exp $ */ +/* $KAME: ip_ecn.h,v 1.6 2001/05/03 14:51:48 itojun Exp $ */ + +/* + * Copyright (C) 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +/* + * ECN consideration on tunnel ingress/egress operation. + * http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt + */ + +#if defined(_KERNEL) && !defined(_LKM) +#include "opt_inet.h" +#endif + +#define ECN_ALLOWED 1 /* ECN allowed */ +#define ECN_FORBIDDEN 0 /* ECN forbidden */ +#define ECN_NOCARE (-1) /* no consideration to ECN */ + +#ifdef _KERNEL +extern void ip_ecn_ingress(int, u_int8_t *, const u_int8_t *); +extern void ip_ecn_egress(int, const u_int8_t *, u_int8_t *); +#endif diff --git a/newlib/libc/sys/linux/include/netinet/ip_encap.h b/newlib/libc/sys/linux/include/netinet/ip_encap.h new file mode 100644 index 000000000..cfc6bca8c --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_encap.h @@ -0,0 +1,64 @@ +/* $FreeBSD: src/sys/netinet/ip_encap.h,v 1.3 2002/03/19 21:25:46 alfred Exp $ */ +/* $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET_IP_ENCAP_H_ +#define _NETINET_IP_ENCAP_H_ + +#ifdef _KERNEL + +struct encaptab { + LIST_ENTRY(encaptab) chain; + int af; + int proto; /* -1: don't care, I'll check myself */ + struct sockaddr_storage src; /* my addr */ + struct sockaddr_storage srcmask; + struct sockaddr_storage dst; /* remote addr */ + struct sockaddr_storage dstmask; + int (*func)(const struct mbuf *, int, int, void *); + const struct protosw *psw; /* only pr_input will be used */ + void *arg; /* passed via m->m_pkthdr.aux */ +}; + +void encap_init(void); +void encap4_input(struct mbuf *, int); +int encap6_input(struct mbuf **, int *, int); +const struct encaptab *encap_attach(int, int, const struct sockaddr *, + const struct sockaddr *, const struct sockaddr *, + const struct sockaddr *, const struct protosw *, void *); +const struct encaptab *encap_attach_func(int, int, + int (*)(const struct mbuf *, int, int, void *), + const struct protosw *, void *); +int encap_detach(const struct encaptab *); +void *encap_getarg(struct mbuf *); +#endif + +#endif /*_NETINET_IP_ENCAP_H_*/ diff --git a/newlib/libc/sys/linux/include/netinet/ip_flow.h b/newlib/libc/sys/linux/include/netinet/ip_flow.h new file mode 100644 index 000000000..90561f07b --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_flow.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by the 3am Software Foundry ("3am"). It was developed by Matt Thomas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet/ip_flow.h,v 1.4 2000/05/26 02:05:46 jake Exp $ + */ + +#ifndef _NETINET_IP_FLOW_H +#define _NETINET_IP_FLOW_H + +struct ipflow { + LIST_ENTRY(ipflow) ipf_next; /* next ipflow in bucket */ + struct in_addr ipf_dst; /* destination address */ + struct in_addr ipf_src; /* source address */ + + u_int8_t ipf_tos; /* type-of-service */ + struct route ipf_ro; /* associated route entry */ + u_long ipf_uses; /* number of uses in this period */ + + int ipf_timer; /* remaining lifetime of this entry */ + u_long ipf_dropped; /* ENOBUFS returned by if_output */ + u_long ipf_errors; /* other errors returned by if_output */ + u_long ipf_last_uses; /* number of uses in last period */ +}; + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/ip_fw.h b/newlib/libc/sys/linux/include/netinet/ip_fw.h new file mode 100644 index 000000000..3c2b1c743 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_fw.h @@ -0,0 +1,350 @@ +/* + * Copyright (c) 1993 Daniel Boulet + * Copyright (c) 1994 Ugen J.S.Antsilevich + * + * Redistribution and use in source forms, with and without modification, + * are permitted provided that this entire comment appears intact. + * + * Redistribution in binary form may occur without any restrictions. + * Obviously, it would be nice if you gave credit where credit is due + * but requiring it would be too onerous. + * + * This software is provided ``AS IS'' without any warranties of any kind. + * + * $FreeBSD: src/sys/netinet/ip_fw.h,v 1.66 2002/05/09 10:34:57 luigi Exp $ + */ + +#ifndef _IP_FW_H +#define _IP_FW_H + +#include + +/* + * This union structure identifies an interface, either explicitly + * by name or implicitly by IP address. The flags IP_FW_F_IIFNAME + * and IP_FW_F_OIFNAME say how to interpret this structure. An + * interface unit number of -1 matches any unit number, while an + * IP address of 0.0.0.0 indicates matches any interface. + * + * The receive and transmit interfaces are only compared against the + * the packet if the corresponding bit (IP_FW_F_IIFACE or IP_FW_F_OIFACE) + * is set. Note some packets lack a receive or transmit interface + * (in which case the missing "interface" never matches). + */ + +union ip_fw_if { + struct in_addr fu_via_ip; /* Specified by IP address */ + struct { /* Specified by interface name */ +#define FW_IFNLEN 10 /* need room ! was IFNAMSIZ */ + char name[FW_IFNLEN]; + short unit; /* -1 means match any unit */ + } fu_via_if; +}; + +/* + * Format of an IP firewall descriptor + * + * fw_src, fw_dst, fw_smsk, fw_dmsk are always stored in network byte order. + * fw_flg and fw_n*p are stored in host byte order (of course). + * Port numbers are stored in HOST byte order. + */ + +/* + * To match MAC headers: + * 12 bytes at fw_mac_hdr contain the dst-src MAC address after masking. + * 12 bytes at fw_mac_mask contain the mask to apply to dst-src + * 2 bytes at fw_mac_type contain the mac type after mask (in net format) + * 2 bytes at fw_mac_type_mask contain the mac type mask + * If IP_FW_F_SRNG, the two contain the low-high of a range of types. + * IP_FW_F_DRNG is used to indicare we want to match a vlan. + */ +#define fw_mac_hdr fw_src +#define fw_mac_mask fw_uar +#define fw_mac_type fw_iplen +#define fw_mac_mask_type fw_ipid + +struct ip_fw { + LIST_ENTRY(ip_fw) next; /* bidirectional list of rules */ + u_int fw_flg; /* Operational Flags word */ + u_int64_t fw_pcnt; /* Packet counters */ + u_int64_t fw_bcnt; /* Byte counters */ + + struct in_addr fw_src; /* Source IP address */ + struct in_addr fw_dst; /* Destination IP address */ + struct in_addr fw_smsk; /* Mask for source IP address */ + struct in_addr fw_dmsk; /* Mask for destination address */ + u_short fw_number; /* Rule number */ + u_char fw_prot; /* IP protocol */ +#if 1 + u_char fw_nports; /* # of src/dst port in array */ +#define IP_FW_GETNSRCP(rule) ((rule)->fw_nports & 0x0f) +#define IP_FW_SETNSRCP(rule, n) do { \ + (rule)->fw_nports &= ~0x0f; \ + (rule)->fw_nports |= (n); \ + } while (0) +#define IP_FW_GETNDSTP(rule) ((rule)->fw_nports >> 4) +#define IP_FW_SETNDSTP(rule, n) do { \ + (rule)->fw_nports &= ~0xf0; \ + (rule)->fw_nports |= (n) << 4;\ + } while (0) +#define IP_FW_HAVEPORTS(rule) ((rule)->fw_nports != 0) +#else + u_char __pad[1]; + u_int _nsrcp; + u_int _ndstp; +#define IP_FW_GETNSRCP(rule) (rule)->_nsrcp +#define IP_FW_SETNSRCP(rule,n) (rule)->_nsrcp = n +#define IP_FW_GETNDSTP(rule) (rule)->_ndstp +#define IP_FW_SETNDSTP(rule,n) (rule)->_ndstp = n +#define IP_FW_HAVEPORTS(rule) ((rule)->_ndstp + (rule)->_nsrcp != 0) +#endif +#define IP_FW_MAX_PORTS 10 /* A reasonable maximum */ + union { + u_short fw_pts[IP_FW_MAX_PORTS]; /* port numbers to match */ +#define IP_FW_ICMPTYPES_MAX 128 +#define IP_FW_ICMPTYPES_DIM (IP_FW_ICMPTYPES_MAX / (sizeof(unsigned) * 8)) + unsigned fw_icmptypes[IP_FW_ICMPTYPES_DIM]; /*ICMP types bitmap*/ + } fw_uar; + + u_int fw_ipflg; /* IP flags word */ + u_short fw_iplen; /* IP length */ + u_short fw_ipid; /* Identification */ + u_char fw_ipopt; /* IP options set */ + u_char fw_ipnopt; /* IP options unset */ + u_char fw_iptos; /* IP type of service set */ + u_char fw_ipntos; /* IP type of service unset */ + u_char fw_ipttl; /* IP time to live */ + u_int fw_ipver:4; /* IP version */ + u_char fw_tcpopt; /* TCP options set */ + u_char fw_tcpnopt; /* TCP options unset */ + u_char fw_tcpf; /* TCP flags set */ + u_char fw_tcpnf; /* TCP flags unset */ + u_short fw_tcpwin; /* TCP window size */ + u_int32_t fw_tcpseq; /* TCP sequence */ + u_int32_t fw_tcpack; /* TCP acknowledgement */ + long timestamp; /* timestamp (tv_sec) of last match */ + union ip_fw_if fw_in_if; /* Incoming interfaces */ + union ip_fw_if fw_out_if; /* Outgoing interfaces */ + union { + u_short fu_divert_port; /* Divert/tee port (options IPDIVERT) */ + u_short fu_pipe_nr; /* queue number (option DUMMYNET) */ + u_short fu_skipto_rule; /* SKIPTO command rule number */ + u_short fu_reject_code; /* REJECT response code */ + struct sockaddr_in fu_fwd_ip; + } fw_un; + void *pipe_ptr; /* flow_set ptr for dummynet pipe */ + void *next_rule_ptr; /* next rule in case of match */ + uid_t fw_uid; /* uid to match */ + gid_t fw_gid; /* gid to match */ + int fw_logamount; /* amount to log */ + u_int64_t fw_loghighest; /* highest number packet to log */ + + long dont_match_prob; /* 0x7fffffff means 1.0, always fail */ + u_char dyn_type; /* type for dynamic rule */ + +#define DYN_KEEP_STATE 0 /* type for keep-state rules */ +#define DYN_LIMIT 1 /* type for limit connection rules */ +#define DYN_LIMIT_PARENT 2 /* parent entry for limit connection rules */ + + /* following two fields are used to limit number of connections + * basing on either src, srcport, dst, dstport. + */ + u_char limit_mask; /* mask type for limit rule, can + * have many. + */ +#define DYN_SRC_ADDR 0x1 +#define DYN_SRC_PORT 0x2 +#define DYN_DST_ADDR 0x4 +#define DYN_DST_PORT 0x8 + + u_short conn_limit; /* # of connections for limit rule */ +}; + +#define fw_divert_port fw_un.fu_divert_port +#define fw_skipto_rule fw_un.fu_skipto_rule +#define fw_reject_code fw_un.fu_reject_code +#define fw_pipe_nr fw_un.fu_pipe_nr +#define fw_fwd_ip fw_un.fu_fwd_ip + +/* + * + * rule_ptr -------------+ + * V + * [ next.le_next ]---->[ next.le_next ]---- [ next.le_next ]---> + * [ next.le_prev ]<----[ next.le_prev ]<----[ next.le_prev ]<--- + * [ body ] [ body ] [ body ] + * + */ + +/* + * Flow mask/flow id for each queue. + */ +struct ipfw_flow_id { + u_int32_t dst_ip; + u_int32_t src_ip; + u_int16_t dst_port; + u_int16_t src_port; + u_int8_t proto; + u_int8_t flags; /* protocol-specific flags */ +}; + +/* + * dynamic ipfw rule + */ +struct ipfw_dyn_rule { + struct ipfw_dyn_rule *next; + struct ipfw_flow_id id; /* (masked) flow id */ + struct ip_fw *rule; /* pointer to rule */ + struct ipfw_dyn_rule *parent; /* pointer to parent rule */ + u_int32_t expire; /* expire time */ + u_int64_t pcnt; /* packet match counters */ + u_int64_t bcnt; /* byte match counters */ + u_int32_t bucket; /* which bucket in hash table */ + u_int32_t state; /* state of this rule (typically a + * combination of TCP flags) + */ + u_int16_t dyn_type; /* rule type */ + u_int16_t count; /* refcount */ +}; + +/* + * Values for "flags" field . + */ +#define IP_FW_F_COMMAND 0x000000ff /* Mask for type of chain entry: */ +#define IP_FW_F_DENY 0x00000000 /* This is a deny rule */ +#define IP_FW_F_REJECT 0x00000001 /* Deny and send a response packet */ +#define IP_FW_F_ACCEPT 0x00000002 /* This is an accept rule */ +#define IP_FW_F_COUNT 0x00000003 /* This is a count rule */ +#define IP_FW_F_DIVERT 0x00000004 /* This is a divert rule */ +#define IP_FW_F_TEE 0x00000005 /* This is a tee rule */ +#define IP_FW_F_SKIPTO 0x00000006 /* This is a skipto rule */ +#define IP_FW_F_FWD 0x00000007 /* This is a "change forwarding + * address" rule + */ +#define IP_FW_F_PIPE 0x00000008 /* This is a dummynet rule */ +#define IP_FW_F_QUEUE 0x00000009 /* This is a dummynet queue */ + +#define IP_FW_F_IN 0x00000100 /* Check inbound packets */ +#define IP_FW_F_OUT 0x00000200 /* Check outbound packets */ +#define IP_FW_F_IIFACE 0x00000400 /* Apply inbound interface test */ +#define IP_FW_F_OIFACE 0x00000800 /* Apply outbound interface test */ +#define IP_FW_F_PRN 0x00001000 /* Print if this rule matches */ +#define IP_FW_F_SRNG 0x00002000 /* The first two src ports are a min + * and max range (stored in host byte + * order). + */ +#define IP_FW_F_DRNG 0x00004000 /* The first two dst ports are a min + * and max range (stored in host byte + * order). + */ +#define IP_FW_F_FRAG 0x00008000 /* Fragment */ +#define IP_FW_F_IIFNAME 0x00010000 /* In interface by name/unit (not IP) */ +#define IP_FW_F_OIFNAME 0x00020000 /* Out interface by name/unit (not IP)*/ +#define IP_FW_F_INVSRC 0x00040000 /* Invert sense of src check */ +#define IP_FW_F_INVDST 0x00080000 /* Invert sense of dst check */ +#define IP_FW_F_ICMPBIT 0x00100000 /* ICMP type bitmap is valid */ +#define IP_FW_F_UID 0x00200000 /* filter by uid */ +#define IP_FW_F_GID 0x00400000 /* filter by gid */ +#define IP_FW_F_RND_MATCH 0x00800000 /* probabilistic rule match */ +#define IP_FW_F_SMSK 0x01000000 /* src-port + mask */ +#define IP_FW_F_DMSK 0x02000000 /* dst-port + mask */ +#define IP_FW_BRIDGED 0x04000000 /* only match bridged packets */ +#define IP_FW_F_KEEP_S 0x08000000 /* keep state */ +#define IP_FW_F_CHECK_S 0x10000000 /* check state */ +#define IP_FW_F_SME 0x20000000 /* source = me */ +#define IP_FW_F_DME 0x40000000 /* destination = me */ +#define IP_FW_F_MAC 0x80000000 /* match MAC header */ + +#define IP_FW_F_MASK 0xFFFFFFFF /* All possible flag bits mask */ + +/* + * Flags for the 'fw_ipflg' field, for comparing values + * of ip and its protocols. + */ +#define IP_FW_IF_TCPOPT 0x00000001 /* tcp options */ +#define IP_FW_IF_TCPFLG 0x00000002 /* tcp flags */ +#define IP_FW_IF_TCPSEQ 0x00000004 /* tcp sequence number */ +#define IP_FW_IF_TCPACK 0x00000008 /* tcp acknowledgement number */ +#define IP_FW_IF_TCPWIN 0x00000010 /* tcp window size */ +#define IP_FW_IF_TCPEST 0x00000020 /* established TCP connection */ +#define IP_FW_IF_TCPMSK 0x0000003f /* mask of all tcp values */ +#define IP_FW_IF_IPOPT 0x00000100 /* ip options */ +#define IP_FW_IF_IPLEN 0x00000200 /* ip length */ +#define IP_FW_IF_IPID 0x00000400 /* ip identification */ +#define IP_FW_IF_IPTOS 0x00000800 /* ip type of service */ +#define IP_FW_IF_IPTTL 0x00001000 /* ip time to live */ +#define IP_FW_IF_IPVER 0x00002000 /* ip version */ +#define IP_FW_IF_IPPRE 0x00004000 /* ip precedence */ +#define IP_FW_IF_IPMSK 0x00007f00 /* mask of all ip values */ +#define IP_FW_IF_MSK 0x0000ffff /* All possible bits mask */ + +/* + * For backwards compatibility with rules specifying "via iface" but + * not restricted to only "in" or "out" packets, we define this combination + * of bits to represent this configuration. + */ + +#define IF_FW_F_VIAHACK (IP_FW_F_IN|IP_FW_F_OUT|IP_FW_F_IIFACE|IP_FW_F_OIFACE) + +/* + * Definitions for REJECT response codes. + * Values less than 256 correspond to ICMP unreachable codes. + */ +#define IP_FW_REJECT_RST 0x0100 /* TCP packets: send RST */ + +/* + * Definitions for IP option names. + */ +#define IP_FW_IPOPT_LSRR 0x01 +#define IP_FW_IPOPT_SSRR 0x02 +#define IP_FW_IPOPT_RR 0x04 +#define IP_FW_IPOPT_TS 0x08 + +/* + * Definitions for TCP option names. + */ +#define IP_FW_TCPOPT_MSS 0x01 +#define IP_FW_TCPOPT_WINDOW 0x02 +#define IP_FW_TCPOPT_SACK 0x04 +#define IP_FW_TCPOPT_TS 0x08 +#define IP_FW_TCPOPT_CC 0x10 + +/* + * Definitions for TCP flags. + */ +#define IP_FW_TCPF_FIN TH_FIN +#define IP_FW_TCPF_SYN TH_SYN +#define IP_FW_TCPF_RST TH_RST +#define IP_FW_TCPF_PSH TH_PUSH +#define IP_FW_TCPF_ACK TH_ACK +#define IP_FW_TCPF_URG TH_URG + +/* + * Main firewall chains definitions and global var's definitions. + */ +#ifdef _KERNEL + +#define IP_FW_PORT_DYNT_FLAG 0x10000 +#define IP_FW_PORT_TEE_FLAG 0x20000 +#define IP_FW_PORT_DENY_FLAG 0x40000 + +/* + * Function definitions. + */ +void ip_fw_init(void); + +/* Firewall hooks */ +struct ip; +struct sockopt; +typedef int ip_fw_chk_t (struct mbuf **m, struct ifnet *oif, + u_int16_t *cookie, struct ip_fw **rule, struct sockaddr_in **next_hop); +typedef int ip_fw_ctl_t (struct sockopt *); +extern ip_fw_chk_t *ip_fw_chk_ptr; +extern ip_fw_ctl_t *ip_fw_ctl_ptr; +extern int fw_one_pass; +extern int fw_enable; +extern struct ipfw_flow_id last_pkt; +#define IPFW_LOADED (ip_fw_chk_ptr != NULL) +#endif /* _KERNEL */ + +#endif /* _IP_FW_H */ diff --git a/newlib/libc/sys/linux/include/netinet/ip_icmp.h b/newlib/libc/sys/linux/include/netinet/ip_icmp.h new file mode 100644 index 000000000..2574d07dc --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_icmp.h @@ -0,0 +1,192 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/ip_icmp.h,v 1.18 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_IP_ICMP_H_ +#define _NETINET_IP_ICMP_H_ + +/* + * Interface Control Message Protocol Definitions. + * Per RFC 792, September 1981. + */ + +/* + * Internal of an ICMP Router Advertisement + */ +struct icmp_ra_addr { + u_int32_t ira_addr; + u_int32_t ira_preference; +}; + +/* + * Structure of an icmp header. + */ +struct icmp { + u_char icmp_type; /* type of message, see below */ + u_char icmp_code; /* type sub code */ + u_short icmp_cksum; /* ones complement cksum of struct */ + union { + u_char ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ + struct ih_idseq { + n_short icd_id; + n_short icd_seq; + } ih_idseq; + int ih_void; + + /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ + struct ih_pmtu { + n_short ipm_void; + n_short ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + u_char irt_num_addrs; + u_char irt_wpa; + u_int16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime + union { + struct id_ts { + n_time its_otime; + n_time its_rtime; + n_time its_ttime; + } id_ts; + struct id_ip { + struct ip idi_ip; + /* options and then 64 bits of data */ + } id_ip; + struct icmp_ra_addr id_radv; + u_int32_t id_mask; + char id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enough to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#ifndef _IP_VHL +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ +#else +#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8) + /* N.B.: must separately check that header length >= 5 */ +#endif + +/* + * Definition of type and code field values. + */ +#define ICMP_ECHOREPLY 0 /* echo reply */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ +#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */ +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_REDIRECT 5 /* shorter route, codes: */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define ICMP_ECHO 8 /* echo service */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_PARAMPROB_ERRATPTR 0 /* error at param ptr */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ +#define ICMP_PARAMPROB_LENGTH 2 /* bad length */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ + (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ + (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ + (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + +#ifdef _KERNEL +void icmp_error(struct mbuf *, int, int, n_long, struct ifnet *); +void icmp_input(struct mbuf *, int); +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/ip_mroute.h b/newlib/libc/sys/linux/include/netinet/ip_mroute.h new file mode 100644 index 000000000..555ff4783 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_mroute.h @@ -0,0 +1,263 @@ +/* + * Copyright (c) 1989 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_mroute.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/ip_mroute.h,v 1.19 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_IP_MROUTE_H_ +#define _NETINET_IP_MROUTE_H_ + +/* + * Definitions for IP multicast forwarding. + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Ajit Thyagarajan, PARC, August 1993. + * Modified by Ajit Thyagarajan, PARC, August 1994. + * + * MROUTING Revision: 3.3.1.3 + */ + + +/* + * Multicast Routing set/getsockopt commands. + */ +#define MRT_INIT 100 /* initialize forwarder */ +#define MRT_DONE 101 /* shut down forwarder */ +#define MRT_ADD_VIF 102 /* create virtual interface */ +#define MRT_DEL_VIF 103 /* delete virtual interface */ +#define MRT_ADD_MFC 104 /* insert forwarding cache entry */ +#define MRT_DEL_MFC 105 /* delete forwarding cache entry */ +#define MRT_VERSION 106 /* get kernel version number */ +#define MRT_ASSERT 107 /* enable PIM assert processing */ + + +#define GET_TIME(t) microtime(&t) + +/* + * Types and macros for handling bitmaps with one bit per virtual interface. + */ +#define MAXVIFS 32 +typedef u_long vifbitmap_t; +typedef u_short vifi_t; /* type of a vif index */ +#define ALL_VIFS (vifi_t)-1 + +#define VIFM_SET(n, m) ((m) |= (1 << (n))) +#define VIFM_CLR(n, m) ((m) &= ~(1 << (n))) +#define VIFM_ISSET(n, m) ((m) & (1 << (n))) +#define VIFM_CLRALL(m) ((m) = 0x00000000) +#define VIFM_COPY(mfrom, mto) ((mto) = (mfrom)) +#define VIFM_SAME(m1, m2) ((m1) == (m2)) + + +/* + * Argument structure for MRT_ADD_VIF. + * (MRT_DEL_VIF takes a single vifi_t argument.) + */ +struct vifctl { + vifi_t vifc_vifi; /* the index of the vif to be added */ + u_char vifc_flags; /* VIFF_ flags defined below */ + u_char vifc_threshold; /* min ttl required to forward on vif */ + u_int vifc_rate_limit; /* max rate */ + struct in_addr vifc_lcl_addr; /* local interface address */ + struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */ +}; + +#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */ +#define VIFF_SRCRT 0x2 /* tunnel uses IP source routing */ + +/* + * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC + * (mfcc_tos to be added at a future point) + */ +struct mfcctl { + struct in_addr mfcc_origin; /* ip origin of mcasts */ + struct in_addr mfcc_mcastgrp; /* multicast group associated*/ + vifi_t mfcc_parent; /* incoming vif */ + u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ +}; + +/* + * The kernel's multicast routing statistics. + */ +struct mrtstat { + u_long mrts_mfc_lookups; /* # forw. cache hash table hits */ + u_long mrts_mfc_misses; /* # forw. cache hash table misses */ + u_long mrts_upcalls; /* # calls to mrouted */ + u_long mrts_no_route; /* no route for packet's origin */ + u_long mrts_bad_tunnel; /* malformed tunnel options */ + u_long mrts_cant_tunnel; /* no room for tunnel options */ + u_long mrts_wrong_if; /* arrived on wrong interface */ + u_long mrts_upq_ovflw; /* upcall Q overflow */ + u_long mrts_cache_cleanups; /* # entries with no upcalls */ + u_long mrts_drop_sel; /* pkts dropped selectively */ + u_long mrts_q_overflow; /* pkts dropped - Q overflow */ + u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */ + u_long mrts_upq_sockfull; /* upcalls dropped - socket full */ +}; + +/* + * Argument structure used by mrouted to get src-grp pkt counts + */ +struct sioc_sg_req { + struct in_addr src; + struct in_addr grp; + u_long pktcnt; + u_long bytecnt; + u_long wrong_if; +}; + +/* + * Argument structure used by mrouted to get vif pkt counts + */ +struct sioc_vif_req { + vifi_t vifi; /* vif number */ + u_long icount; /* Input packet count on vif */ + u_long ocount; /* Output packet count on vif */ + u_long ibytes; /* Input byte count on vif */ + u_long obytes; /* Output byte count on vif */ +}; + + +/* + * The kernel's virtual-interface structure. + */ +struct vif { + u_char v_flags; /* VIFF_ flags defined above */ + u_char v_threshold; /* min ttl required to forward on vif*/ + u_int v_rate_limit; /* max rate */ + struct tbf *v_tbf; /* token bucket structure at intf. */ + struct in_addr v_lcl_addr; /* local interface address */ + struct in_addr v_rmt_addr; /* remote address (tunnels only) */ + struct ifnet *v_ifp; /* pointer to interface */ + u_long v_pkt_in; /* # pkts in on interface */ + u_long v_pkt_out; /* # pkts out on interface */ + u_long v_bytes_in; /* # bytes in on interface */ + u_long v_bytes_out; /* # bytes out on interface */ + struct route v_route; /* cached route if this is a tunnel */ + u_int v_rsvp_on; /* RSVP listening on this vif */ + struct socket *v_rsvpd; /* RSVP daemon socket */ +}; + +/* + * The kernel's multicast forwarding cache entry structure + * (A field for the type of service (mfc_tos) is to be added + * at a future point) + */ +struct mfc { + struct in_addr mfc_origin; /* IP origin of mcasts */ + struct in_addr mfc_mcastgrp; /* multicast group associated*/ + vifi_t mfc_parent; /* incoming vif */ + u_char mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ + u_long mfc_pkt_cnt; /* pkt count for src-grp */ + u_long mfc_byte_cnt; /* byte count for src-grp */ + u_long mfc_wrong_if; /* wrong if for src-grp */ + int mfc_expire; /* time to clean entry up */ + struct timeval mfc_last_assert; /* last time I sent an assert*/ + struct rtdetq *mfc_stall; /* q of packets awaiting mfc */ + struct mfc *mfc_next; /* next mfc entry */ +}; + +/* + * Struct used to communicate from kernel to multicast router + * note the convenient similarity to an IP packet + */ +struct igmpmsg { + u_long unused1; + u_long unused2; + u_char im_msgtype; /* what type of message */ +#define IGMPMSG_NOCACHE 1 +#define IGMPMSG_WRONGVIF 2 + u_char im_mbz; /* must be zero */ + u_char im_vif; /* vif rec'd on */ + u_char unused3; + struct in_addr im_src, im_dst; +}; + +/* + * Argument structure used for pkt info. while upcall is made + */ +struct rtdetq { + struct mbuf *m; /* A copy of the packet */ + struct ifnet *ifp; /* Interface pkt came in on */ + vifi_t xmt_vif; /* Saved copy of imo_multicast_vif */ +#ifdef UPCALL_TIMING + struct timeval t; /* Timestamp */ +#endif /* UPCALL_TIMING */ + struct rtdetq *next; /* Next in list of packets */ +}; + +#define MFCTBLSIZ 256 +#if (MFCTBLSIZ & (MFCTBLSIZ - 1)) == 0 /* from sys:route.h */ +#define MFCHASHMOD(h) ((h) & (MFCTBLSIZ - 1)) +#else +#define MFCHASHMOD(h) ((h) % MFCTBLSIZ) +#endif + +#define MAX_UPQ 4 /* max. no of pkts in upcall Q */ + +/* + * Token Bucket filter code + */ +#define MAX_BKT_SIZE 10000 /* 10K bytes size */ +#define MAXQSIZE 10 /* max # of pkts in queue */ + +/* + * the token bucket filter at each vif + */ +struct tbf +{ + struct timeval tbf_last_pkt_t; /* arr. time of last pkt */ + u_long tbf_n_tok; /* no of tokens in bucket */ + u_long tbf_q_len; /* length of queue at this vif */ + u_long tbf_max_q_len; /* max. queue length */ + struct mbuf *tbf_q; /* Packet queue */ + struct mbuf *tbf_t; /* tail-insertion pointer */ +}; + +#ifdef _KERNEL + +struct sockopt; + +extern int (*ip_mrouter_set)(struct socket *, struct sockopt *); +extern int (*ip_mrouter_get)(struct socket *, struct sockopt *); +extern int (*ip_mrouter_done)(void); +extern int (*mrt_ioctl)(int, caddr_t); + +#endif /* _KERNEL */ + +#endif /* _NETINET_IP_MROUTE_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/ip_var.h b/newlib/libc/sys/linux/include/netinet/ip_var.h new file mode 100644 index 000000000..8ee8602a8 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_var.h @@ -0,0 +1,206 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_var.h 8.2 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/netinet/ip_var.h,v 1.60 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_IP_VAR_H_ +#define _NETINET_IP_VAR_H_ + +#include + +/* + * Overlay for ip header used by other protocols (tcp, udp). + */ +struct ipovly { + u_char ih_x1[9]; /* (unused) */ + u_char ih_pr; /* protocol */ + u_short ih_len; /* protocol length */ + struct in_addr ih_src; /* source internet address */ + struct in_addr ih_dst; /* destination internet address */ +}; + +/* + * Ip reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + * They are timed out after ipq_ttl drops to 0, and may also + * be reclaimed if memory becomes tight. + */ +struct ipq { + TAILQ_ENTRY(ipq) ipq_list; /* to other reass headers */ + u_char ipq_ttl; /* time for reass q to live */ + u_char ipq_p; /* protocol of this fragment */ + u_short ipq_id; /* sequence id for reassembly */ + struct mbuf *ipq_frags; /* to ip headers of fragments */ + struct in_addr ipq_src,ipq_dst; +#ifdef IPDIVERT + u_int32_t ipq_div_info; /* ipfw divert port & flags */ + u_int16_t ipq_div_cookie; /* ipfw divert cookie */ +#endif +}; + +/* + * Structure stored in mbuf in inpcb.ip_options + * and passed to ip_output when ip options are in use. + * The actual length of the options (including ipopt_dst) + * is in m_len. + */ +#define MAX_IPOPTLEN 40 + +struct ipoption { + struct in_addr ipopt_dst; /* first-hop dst if source routed */ + char ipopt_list[MAX_IPOPTLEN]; /* options proper */ +}; + +/* + * Structure attached to inpcb.ip_moptions and + * passed to ip_output when IP multicast options are in use. + */ +struct ip_moptions { + struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */ + struct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */ + u_char imo_multicast_ttl; /* TTL for outgoing multicasts */ + u_char imo_multicast_loop; /* 1 => hear sends if a member */ + u_short imo_num_memberships; /* no. memberships this socket */ + struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS]; + u_long imo_multicast_vif; /* vif num outgoing multicasts */ +}; + +struct ipstat { + u_long ips_total; /* total packets received */ + u_long ips_badsum; /* checksum bad */ + u_long ips_tooshort; /* packet too short */ + u_long ips_toosmall; /* not enough data */ + u_long ips_badhlen; /* ip header length < data size */ + u_long ips_badlen; /* ip length < ip header length */ + u_long ips_fragments; /* fragments received */ + u_long ips_fragdropped; /* frags dropped (dups, out of space) */ + u_long ips_fragtimeout; /* fragments timed out */ + u_long ips_forward; /* packets forwarded */ + u_long ips_fastforward; /* packets fast forwarded */ + u_long ips_cantforward; /* packets rcvd for unreachable dest */ + u_long ips_redirectsent; /* packets forwarded on same net */ + u_long ips_noproto; /* unknown or unsupported protocol */ + u_long ips_delivered; /* datagrams delivered to upper level*/ + u_long ips_localout; /* total ip packets generated here */ + u_long ips_odropped; /* lost packets due to nobufs, etc. */ + u_long ips_reassembled; /* total packets reassembled ok */ + u_long ips_fragmented; /* datagrams successfully fragmented */ + u_long ips_ofragments; /* output fragments created */ + u_long ips_cantfrag; /* don't fragment flag was set, etc. */ + u_long ips_badoptions; /* error in option processing */ + u_long ips_noroute; /* packets discarded due to no route */ + u_long ips_badvers; /* ip version != 4 */ + u_long ips_rawout; /* total raw ip packets generated */ + u_long ips_toolong; /* ip length > max ip packet size */ + u_long ips_notmember; /* multicasts for unregistered grps */ + u_long ips_nogif; /* no match gif found */ + u_long ips_badaddr; /* invalid address on header */ +}; + +#ifdef _KERNEL + +/* flags passed to ip_output as last parameter */ +#define IP_FORWARDING 0x1 /* most of ip header exists */ +#define IP_RAWOUTPUT 0x2 /* raw ip header exists */ +#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */ +#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ + +struct ip; +struct inpcb; +struct route; +struct sockopt; + +extern struct ipstat ipstat; +#ifndef RANDOM_IP_ID +extern u_short ip_id; /* ip packet ctr, for ids */ +#endif +extern int ip_defttl; /* default IP ttl */ +extern int ipforwarding; /* ip forwarding */ +extern struct route ipforward_rt; /* ip forwarding cached route */ +extern u_char ip_protox[]; +extern struct socket *ip_rsvpd; /* reservation protocol daemon */ +extern struct socket *ip_mrouter; /* multicast routing daemon */ +extern int (*legal_vif_num)(int); +extern u_long (*ip_mcast_src)(int); +extern int rsvp_on; +extern struct pr_usrreqs rip_usrreqs; + +int ip_ctloutput(struct socket *, struct sockopt *sopt); +void ip_drain(void); +void ip_freemoptions(struct ip_moptions *); +void ip_init(void); +extern int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *, + struct ip_moptions *); +int ip_output(struct mbuf *, + struct mbuf *, struct route *, int, struct ip_moptions *); +struct in_ifaddr * + ip_rtaddr(struct in_addr, struct route *); +void ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *, + struct mbuf *); +void ip_slowtimo(void); +struct mbuf * + ip_srcroute(void); +void ip_stripoptions(struct mbuf *, struct mbuf *); +#ifdef RANDOM_IP_ID +u_int16_t + ip_randomid(void); +#endif +int rip_ctloutput(struct socket *, struct sockopt *); +void rip_ctlinput(int, struct sockaddr *, void *); +void rip_init(void); +void rip_input(struct mbuf *, int); +int rip_output(struct mbuf *, struct socket *, u_long); +void ipip_input(struct mbuf *, int); +void rsvp_input(struct mbuf *, int); +int ip_rsvp_init(struct socket *); +int ip_rsvp_done(void); +int ip_rsvp_vif_init(struct socket *, struct sockopt *); +int ip_rsvp_vif_done(struct socket *, struct sockopt *); +void ip_rsvp_force_done(struct socket *); + +#ifdef IPDIVERT +void div_init(void); +void div_input(struct mbuf *, int); +void divert_packet(struct mbuf *, int, int); +extern struct pr_usrreqs div_usrreqs; +extern u_int16_t ip_divert_cookie; +#endif + +extern struct sockaddr_in *ip_fw_fwd_addr; + +void in_delayed_cksum(struct mbuf *m); + +#endif /* _KERNEL */ + +#endif /* !_NETINET_IP_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/ipprotosw.h b/newlib/libc/sys/linux/include/netinet/ipprotosw.h new file mode 100644 index 000000000..0367ca2ed --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ipprotosw.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)protosw.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/netinet/ipprotosw.h,v 1.4 2001/09/12 08:37:54 julian Exp $ + */ + +#ifndef _NETINET_IPPROTOSW_H_ +#define _NETINET_IPPROTOSW_H_ + +/* + * For pfil_head structure. + */ +#include + +/* Forward declare these structures referenced from prototypes below. */ +struct mbuf; +struct sockaddr; +struct socket; +struct sockopt; + +struct ipprotosw { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ +/* protocol-protocol hooks */ + pr_in_input_t *pr_input; /* input to protocol (from below) */ + pr_output_t *pr_output; /* output to protocol (from above) */ + pr_ctlinput_t *pr_ctlinput; /* control input (from below) */ + pr_ctloutput_t *pr_ctloutput; /* control output (from above) */ +/* user-protocol hook */ + void *pr_ousrreq; +/* utility hooks */ + pr_init_t *pr_init; + pr_fasttimo_t *pr_fasttimo; /* fast timeout (200ms) */ + pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */ + pr_drain_t *pr_drain; /* flush any excess space possible */ + + struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ + struct pfil_head pr_pfh; +}; + +#endif /* !_NETINET_IPPROTOSW_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/tcp.h b/newlib/libc/sys/linux/include/netinet/tcp.h new file mode 100644 index 000000000..a6154e0ee --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/tcp.h @@ -0,0 +1,137 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp.h,v 1.16 2001/01/09 18:26:17 rwatson Exp $ + */ + +#ifndef _NETINET_TCP_H_ +#define _NETINET_TCP_H_ + +typedef u_int32_t tcp_seq; +typedef u_int32_t tcp_cc; /* connection count per rfc1644 */ + +#define tcp6_seq tcp_seq /* for KAME src sync over BSD*'s */ +#define tcp6hdr tcphdr /* for KAME src sync over BSD*'s */ + +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + u_short th_sport; /* source port */ + u_short th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +#if BYTE_ORDER == LITTLE_ENDIAN + u_int th_x2:4, /* (unused) */ + th_off:4; /* data offset */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int th_off:4, /* data offset */ + th_x2:4; /* (unused) */ +#endif + u_char th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 +#define TH_ECE 0x40 +#define TH_CWR 0x80 +#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR) + + u_short th_win; /* window */ + u_short th_sum; /* checksum */ + u_short th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOLEN_MAXSEG 4 +#define TCPOPT_WINDOW 3 +#define TCPOLEN_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 /* Experimental */ +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOPT_SACK 5 /* Experimental */ +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_TIMESTAMP 10 +#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ +#define TCPOPT_TSTAMP_HDR \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) + +#define TCPOPT_CC 11 /* CC options: RFC-1644 */ +#define TCPOPT_CCNEW 12 +#define TCPOPT_CCECHO 13 +#define TCPOLEN_CC 6 +#define TCPOLEN_CC_APPA (TCPOLEN_CC+2) +#define TCPOPT_CC_HDR(ccopt) \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC) + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). + */ +#define TCP_MSS 512 + +/* + * Default maximum segment size for TCP6. + * With an IP6 MSS of 1280, this is 1220, + * but 1024 is probably more convenient. (xxx kazu in doubt) + * This should be defined as MIN(1024, IP6_MSS - sizeof (struct tcpip6hdr)) + */ +#define TCP6_MSS 1024 + +#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ +#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */ + +#define TCP_MAX_WINSHIFT 14 /* maximum window shift */ + +#define TCP_MAXBURST 4 /* maximum segments in a burst */ + +#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */ +#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr)) + /* max space left for options */ + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define TCP_MAXSEG 0x02 /* set maximum segment size */ +#define TCP_NOPUSH 0x04 /* don't push last block of write */ +#define TCP_NOOPT 0x08 /* don't use TCP options */ + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/tcp_debug.h b/newlib/libc/sys/linux/include/netinet/tcp_debug.h new file mode 100644 index 000000000..3b27d09ac --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/tcp_debug.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_debug.h,v 1.11 2000/01/29 11:49:05 shin Exp $ + */ + +#ifndef _NETINET_TCP_DEBUG_H_ +#define _NETINET_TCP_DEBUG_H_ + +struct tcp_debug { + n_time td_time; + short td_act; + short td_ostate; + caddr_t td_tcb; + int td_family; + /* + * Co-existense of td_ti and td_ti6 below is ugly, but it is necessary + * to achieve backword compatibility to some extent. + */ + struct tcpiphdr td_ti; + struct { +#if !defined(_KERNEL) && defined(INET6) + struct ip6_hdr ip6; +#else + u_char ip6buf[40]; /* sizeof(struct ip6_hdr) */ +#endif + struct tcphdr th; + } td_ti6; +#define td_ip6buf td_ti6.ip6buf + short td_req; + struct tcpcb td_cb; +}; + +#define TA_INPUT 0 +#define TA_OUTPUT 1 +#define TA_USER 2 +#define TA_RESPOND 3 +#define TA_DROP 4 + +#ifdef TANAMES +static char *tanames[] = + { "input", "output", "user", "respond", "drop" }; +#endif + +#define TCP_NDEBUG 100 + +#ifndef _KERNEL +/* XXX common variables for broken applications. */ +struct tcp_debug tcp_debug[TCP_NDEBUG]; +int tcp_debx; +#endif + +#endif /* !_NETINET_TCP_DEBUG_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/tcp_fsm.h b/newlib/libc/sys/linux/include/netinet/tcp_fsm.h new file mode 100644 index 000000000..a45cbc76e --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/tcp_fsm.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_fsm.h,v 1.15 2002/02/03 11:57:32 markm Exp $ + */ + +#ifndef _NETINET_TCP_FSM_H_ +#define _NETINET_TCP_FSM_H_ + +/* + * TCP FSM state definitions. + * Per RFC793, September, 1981. + */ + +#define TCP_NSTATES 11 + +#define TCPS_CLOSED 0 /* closed */ +#define TCPS_LISTEN 1 /* listening for connection */ +#define TCPS_SYN_SENT 2 /* active, have sent syn */ +#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define TCPS_ESTABLISHED 4 /* established */ +#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ +#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ + +/* for KAME src sync over BSD*'s */ +#define TCP6_NSTATES TCP_NSTATES +#define TCP6S_CLOSED TCPS_CLOSED +#define TCP6S_LISTEN TCPS_LISTEN +#define TCP6S_SYN_SENT TCPS_SYN_SENT +#define TCP6S_SYN_RECEIVED TCPS_SYN_RECEIVED +#define TCP6S_ESTABLISHED TCPS_ESTABLISHED +#define TCP6S_CLOSE_WAIT TCPS_CLOSE_WAIT +#define TCP6S_FIN_WAIT_1 TCPS_FIN_WAIT_1 +#define TCP6S_CLOSING TCPS_CLOSING +#define TCP6S_LAST_ACK TCPS_LAST_ACK +#define TCP6S_FIN_WAIT_2 TCPS_FIN_WAIT_2 +#define TCP6S_TIME_WAIT TCPS_TIME_WAIT + +#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) +#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED) +#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT) + +#ifdef TCPOUTFLAGS +/* + * Flags used when sending segments in tcp_output. + * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally + * determined by state, with the proviso that TH_FIN is sent only + * if all data queued for output is included in the segment. + */ +static u_char tcp_outflags[TCP_NSTATES] = { + TH_RST|TH_ACK, /* 0, CLOSED */ + 0, /* 1, LISTEN */ + TH_SYN, /* 2, SYN_SENT */ + TH_SYN|TH_ACK, /* 3, SYN_RECEIVED */ + TH_ACK, /* 4, ESTABLISHED */ + TH_ACK, /* 5, CLOSE_WAIT */ + TH_FIN|TH_ACK, /* 6, FIN_WAIT_1 */ + TH_FIN|TH_ACK, /* 7, CLOSING */ + TH_FIN|TH_ACK, /* 8, LAST_ACK */ + TH_ACK, /* 9, FIN_WAIT_2 */ + TH_ACK, /* 10, TIME_WAIT */ +}; +#endif + +#ifdef KPROF +int tcp_acounts[TCP_NSTATES][PRU_NREQ]; +#endif + +#ifdef TCPSTATES +const char *tcpstates[] = { + "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", + "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", + "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", +}; +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/tcp_seq.h b/newlib/libc/sys/linux/include/netinet/tcp_seq.h new file mode 100644 index 000000000..bb15401ec --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/tcp_seq.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1982, 1986, 1993, 1995 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_seq.h 8.3 (Berkeley) 6/21/95 + * $FreeBSD: src/sys/netinet/tcp_seq.h,v 1.18 2001/11/21 18:45:51 jlemon Exp $ + */ + +#ifndef _NETINET_TCP_SEQ_H_ +#define _NETINET_TCP_SEQ_H_ +/* + * TCP sequence numbers are 32 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define SEQ_LT(a,b) ((int)((a)-(b)) < 0) +#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) +#define SEQ_GT(a,b) ((int)((a)-(b)) > 0) +#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* for modulo comparisons of timestamps */ +#define TSTMP_LT(a,b) ((int)((a)-(b)) < 0) +#define TSTMP_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* + * TCP connection counts are 32 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define CC_LT(a,b) ((int)((a)-(b)) < 0) +#define CC_LEQ(a,b) ((int)((a)-(b)) <= 0) +#define CC_GT(a,b) ((int)((a)-(b)) > 0) +#define CC_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* Macro to increment a CC: skip 0 which has a special meaning */ +#define CC_INC(c) (++(c) == 0 ? ++(c) : (c)) + +/* + * Macros to initialize tcp sequence numbers for + * send and receive from initial send and receive + * sequence numbers. + */ +#define tcp_rcvseqinit(tp) \ + (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 + +#define tcp_sendseqinit(tp) \ + (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ + (tp)->snd_recover = (tp)->iss + +#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * hz) + /* timestamp wrap-around time */ + +#ifdef _KERNEL +extern tcp_cc tcp_ccgen; /* global connection count */ +#endif /* _KERNEL */ +#endif /* _NETINET_TCP_SEQ_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/tcp_timer.h b/newlib/libc/sys/linux/include/netinet/tcp_timer.h new file mode 100644 index 000000000..1af128148 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/tcp_timer.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_timer.h,v 1.19 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_TCP_TIMER_H_ +#define _NETINET_TCP_TIMER_H_ + +/* + * The TCPT_REXMT timer is used to force retransmissions. + * The TCP has the TCPT_REXMT timer set whenever segments + * have been sent for which ACKs are expected but not yet + * received. If an ACK is received which advances tp->snd_una, + * then the retransmit timer is cleared (if there are no more + * outstanding segments) or reset to the base value (if there + * are more ACKs expected). Whenever the retransmit timer goes off, + * we retransmit one unacknowledged segment, and do a backoff + * on the retransmit timer. + * + * The TCPT_PERSIST timer is used to keep window size information + * flowing even if the window goes shut. If all previous transmissions + * have been acknowledged (so that there are no retransmissions in progress), + * and the window is too small to bother sending anything, then we start + * the TCPT_PERSIST timer. When it expires, if the window is nonzero, + * we go to transmit state. Otherwise, at intervals send a single byte + * into the peer's window to force him to update our window information. + * We do this at most as often as TCPT_PERSMIN time intervals, + * but no more frequently than the current estimate of round-trip + * packet time. The TCPT_PERSIST timer is cleared whenever we receive + * a window update from the peer. + * + * The TCPT_KEEP timer is used to keep connections alive. If an + * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time, + * but not yet established, then we drop the connection. Once the connection + * is established, if the connection is idle for TCPTV_KEEP_IDLE time + * (and keepalives have been enabled on the socket), we begin to probe + * the connection. We force the peer to send us a segment by sending: + * + * This segment is (deliberately) outside the window, and should elicit + * an ack segment in response from the peer. If, despite the TCPT_KEEP + * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE + * amount of time probing, then we drop the connection. + */ + +/* + * Time constants. + */ +#define TCPTV_MSL ( 30*hz) /* max seg lifetime (hah!) */ +#define TCPTV_SRTTBASE 0 /* base roundtrip time; + if 0, no idea yet */ +#define TCPTV_RTOBASE ( 3*hz) /* assumed RTO if no info */ +#define TCPTV_SRTTDFLT ( 3*hz) /* assumed RTT if no info */ + +#define TCPTV_PERSMIN ( 5*hz) /* retransmit persistence */ +#define TCPTV_PERSMAX ( 60*hz) /* maximum persist interval */ + +#define TCPTV_KEEP_INIT ( 75*hz) /* initial connect keepalive */ +#define TCPTV_KEEP_IDLE (120*60*hz) /* dflt time before probing */ +#define TCPTV_KEEPINTVL ( 75*hz) /* default probe interval */ +#define TCPTV_KEEPCNT 8 /* max probes before drop */ + +#define TCPTV_MIN ( 1*hz) /* minimum allowable value */ +#define TCPTV_REXMTMAX ( 64*hz) /* max allowable REXMT value */ + +#define TCPTV_TWTRUNC 8 /* RTO factor to truncate TW */ + +#define TCP_LINGERTIME 120 /* linger at most 2 minutes */ + +#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ + +#define TCPTV_DELACK (hz / PR_FASTHZ / 2) /* 100ms timeout */ + +#ifdef TCPTIMERS +static char *tcptimers[] = + { "REXMT", "PERSIST", "KEEP", "2MSL" }; +#endif + +/* + * Force a time value to be in a certain range. + */ +#define TCPT_RANGESET(tv, value, tvmin, tvmax) do { \ + (tv) = (value); \ + if ((u_long)(tv) < (u_long)(tvmin)) \ + (tv) = (tvmin); \ + else if ((u_long)(tv) > (u_long)(tvmax)) \ + (tv) = (tvmax); \ +} while(0) + +#ifdef _KERNEL +extern int tcp_keepinit; /* time to establish connection */ +extern int tcp_keepidle; /* time before keepalive probes begin */ +extern int tcp_keepintvl; /* time between keepalive probes */ +extern int tcp_maxidle; /* time to drop after starting probes */ +extern int tcp_delacktime; /* time before sending a delayed ACK */ +extern int tcp_maxpersistidle; +extern int tcp_msl; +extern int tcp_ttl; /* time to live for TCP segs */ +extern int tcp_backoff[]; + +void tcp_timer_2msl(void *xtp); +void tcp_timer_keep(void *xtp); +void tcp_timer_persist(void *xtp); +void tcp_timer_rexmt(void *xtp); +void tcp_timer_delack(void *xtp); + +#endif /* _KERNEL */ + +#endif /* !_NETINET_TCP_TIMER_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/tcp_var.h b/newlib/libc/sys/linux/include/netinet/tcp_var.h new file mode 100644 index 000000000..adb5208e9 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/tcp_var.h @@ -0,0 +1,486 @@ +/* + * Copyright (c) 1982, 1986, 1993, 1994, 1995 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_var.h 8.4 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/tcp_var.h,v 1.76 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_TCP_VAR_H_ +#define _NETINET_TCP_VAR_H_ + +#include /* needed for in_conninfo, inp_gen_t */ + +/* + * Kernel variables for tcp. + */ +extern int tcp_do_rfc1323; +extern int tcp_do_rfc1644; + +/* TCP segment queue entry */ +struct tseg_qent { + LIST_ENTRY(tseg_qent) tqe_q; + int tqe_len; /* TCP segment data length */ + struct tcphdr *tqe_th; /* a pointer to tcp header */ + struct mbuf *tqe_m; /* mbuf contains packet */ +}; +LIST_HEAD(tsegqe_head, tseg_qent); +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_TSEGQ); +#endif + +struct tcptemp { + u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ + struct tcphdr tt_t; +}; + +#define tcp6cb tcpcb /* for KAME src sync over BSD*'s */ + +/* + * Tcp control block, one per tcp; fields: + * Organized for 16 byte cacheline efficiency. + */ +struct tcpcb { + struct tsegqe_head t_segq; + int t_dupacks; /* consecutive dup acks recd */ + struct tcptemp *unused; /* unused */ + + struct callout *tt_rexmt; /* retransmit timer */ + struct callout *tt_persist; /* retransmit persistence */ + struct callout *tt_keep; /* keepalive */ + struct callout *tt_2msl; /* 2*msl TIME_WAIT timer */ + struct callout *tt_delack; /* delayed ACK timer */ + + struct inpcb *t_inpcb; /* back pointer to internet pcb */ + int t_state; /* state of this connection */ + u_int t_flags; +#define TF_ACKNOW 0x00001 /* ack peer immediately */ +#define TF_DELACK 0x00002 /* ack, but try to delay it */ +#define TF_NODELAY 0x00004 /* don't delay packets to coalesce */ +#define TF_NOOPT 0x00008 /* don't use tcp options */ +#define TF_SENTFIN 0x00010 /* have sent FIN */ +#define TF_REQ_SCALE 0x00020 /* have/will request window scaling */ +#define TF_RCVD_SCALE 0x00040 /* other side has requested scaling */ +#define TF_REQ_TSTMP 0x00080 /* have/will request timestamps */ +#define TF_RCVD_TSTMP 0x00100 /* a timestamp was received in SYN */ +#define TF_SACK_PERMIT 0x00200 /* other side said I could SACK */ +#define TF_NEEDSYN 0x00400 /* send SYN (implicit state) */ +#define TF_NEEDFIN 0x00800 /* send FIN (implicit state) */ +#define TF_NOPUSH 0x01000 /* don't push */ +#define TF_REQ_CC 0x02000 /* have/will request CC */ +#define TF_RCVD_CC 0x04000 /* a CC was received in SYN */ +#define TF_SENDCCNEW 0x08000 /* send CCnew instead of CC in SYN */ +#define TF_MORETOCOME 0x10000 /* More data to be appended to sock */ +#define TF_LQ_OVERFLOW 0x20000 /* listen queue overflow */ +#define TF_LASTIDLE 0x40000 /* connection was previously idle */ +#define TF_RXWIN0SENT 0x80000 /* sent a receiver win 0 in response */ + int t_force; /* 1 if forcing out a byte */ + + tcp_seq snd_una; /* send unacknowledged */ + tcp_seq snd_max; /* highest sequence number sent; + * used to recognize retransmits + */ + tcp_seq snd_nxt; /* send next */ + tcp_seq snd_up; /* send urgent pointer */ + + tcp_seq snd_wl1; /* window update seg seq number */ + tcp_seq snd_wl2; /* window update seg ack number */ + tcp_seq iss; /* initial send sequence number */ + tcp_seq irs; /* initial receive sequence number */ + + tcp_seq rcv_nxt; /* receive next */ + tcp_seq rcv_adv; /* advertised window */ + u_long rcv_wnd; /* receive window */ + tcp_seq rcv_up; /* receive urgent pointer */ + + u_long snd_wnd; /* send window */ + u_long snd_cwnd; /* congestion-controlled window */ + u_long snd_ssthresh; /* snd_cwnd size threshold for + * for slow start exponential to + * linear switch + */ + tcp_seq snd_recover; /* for use in fast recovery */ + + u_int t_maxopd; /* mss plus options */ + + u_long t_rcvtime; /* inactivity time */ + u_long t_starttime; /* time connection was established */ + int t_rtttime; /* round trip time */ + tcp_seq t_rtseq; /* sequence number being timed */ + + int t_rxtcur; /* current retransmit value (ticks) */ + u_int t_maxseg; /* maximum segment size */ + int t_srtt; /* smoothed round-trip time */ + int t_rttvar; /* variance in round-trip time */ + + int t_rxtshift; /* log(2) of rexmt exp. backoff */ + u_int t_rttmin; /* minimum rtt allowed */ + u_long t_rttupdated; /* number of times rtt sampled */ + u_long max_sndwnd; /* largest window peer has offered */ + + int t_softerror; /* possible error not yet reported */ +/* out-of-band data */ + char t_oobflags; /* have some */ + char t_iobc; /* input character */ +#define TCPOOB_HAVEDATA 0x01 +#define TCPOOB_HADDATA 0x02 +/* RFC 1323 variables */ + u_char snd_scale; /* window scaling for send window */ + u_char rcv_scale; /* window scaling for recv window */ + u_char request_r_scale; /* pending window scaling */ + u_char requested_s_scale; + u_long ts_recent; /* timestamp echo data */ + + u_long ts_recent_age; /* when last updated */ + tcp_seq last_ack_sent; +/* RFC 1644 variables */ + tcp_cc cc_send; /* send connection count */ + tcp_cc cc_recv; /* receive connection count */ +/* experimental */ + u_long snd_cwnd_prev; /* cwnd prior to retransmit */ + u_long snd_ssthresh_prev; /* ssthresh prior to retransmit */ + u_long t_badrxtwin; /* window for retransmit recovery */ +}; + +/* + * Structure to hold TCP options that are only used during segment + * processing (in tcp_input), but not held in the tcpcb. + * It's basically used to reduce the number of parameters + * to tcp_dooptions. + */ +struct tcpopt { + u_long to_flags; /* which options are present */ +#define TOF_TS 0x0001 /* timestamp */ +#define TOF_CC 0x0002 /* CC and CCnew are exclusive */ +#define TOF_CCNEW 0x0004 +#define TOF_CCECHO 0x0008 +#define TOF_MSS 0x0010 +#define TOF_SCALE 0x0020 + u_int32_t to_tsval; + u_int32_t to_tsecr; + tcp_cc to_cc; /* holds CC or CCnew */ + tcp_cc to_ccecho; + u_int16_t to_mss; + u_int8_t to_requested_s_scale; + u_int8_t to_pad; +}; + +struct syncache { + inp_gen_t sc_inp_gencnt; /* pointer check */ + struct tcpcb *sc_tp; /* tcb for listening socket */ + struct mbuf *sc_ipopts; /* source route */ + struct in_conninfo sc_inc; /* addresses */ +#define sc_route sc_inc.inc_route +#define sc_route6 sc_inc.inc6_route + u_int32_t sc_tsrecent; + tcp_cc sc_cc_send; /* holds CC or CCnew */ + tcp_cc sc_cc_recv; + tcp_seq sc_irs; /* seq from peer */ + tcp_seq sc_iss; /* our ISS */ + u_long sc_rxttime; /* retransmit time */ + u_int16_t sc_rxtslot; /* retransmit counter */ + u_int16_t sc_peer_mss; /* peer's MSS */ + u_int16_t sc_wnd; /* advertised window */ + u_int8_t sc_requested_s_scale:4, + sc_request_r_scale:4; + u_int8_t sc_flags; +#define SCF_NOOPT 0x01 /* no TCP options */ +#define SCF_WINSCALE 0x02 /* negotiated window scaling */ +#define SCF_TIMESTAMP 0x04 /* negotiated timestamps */ +#define SCF_CC 0x08 /* negotiated CC */ +#define SCF_UNREACH 0x10 /* icmp unreachable received */ +#define SCF_KEEPROUTE 0x20 /* keep cloned route */ + TAILQ_ENTRY(syncache) sc_hash; + TAILQ_ENTRY(syncache) sc_timerq; +}; + +struct syncache_head { + TAILQ_HEAD(, syncache) sch_bucket; + u_int sch_length; +}; + +/* + * The TAO cache entry which is stored in the protocol family specific + * portion of the route metrics. + */ +struct rmxp_tao { + tcp_cc tao_cc; /* latest CC in valid SYN */ + tcp_cc tao_ccsent; /* latest CC sent to peer */ + u_short tao_mssopt; /* peer's cached MSS */ +#ifdef notyet + u_short tao_flags; /* cache status flags */ +#define TAOF_DONT 0x0001 /* peer doesn't understand rfc1644 */ +#define TAOF_OK 0x0002 /* peer does understand rfc1644 */ +#define TAOF_UNDEF 0 /* we don't know yet */ +#endif /* notyet */ +}; +#define rmx_taop(r) ((struct rmxp_tao *)(r).rmx_filler) + +#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) +#define sototcpcb(so) (intotcpcb(sotoinpcb(so))) + +/* + * The smoothed round-trip time and estimated variance + * are stored as fixed point numbers scaled by the values below. + * For convenience, these scales are also used in smoothing the average + * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed). + * With these scales, srtt has 3 bits to the right of the binary point, + * and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the + * binary point, and is smoothed with an ALPHA of 0.75. + */ +#define TCP_RTT_SCALE 32 /* multiplier for srtt; 3 bits frac. */ +#define TCP_RTT_SHIFT 5 /* shift for srtt; 3 bits frac. */ +#define TCP_RTTVAR_SCALE 16 /* multiplier for rttvar; 2 bits */ +#define TCP_RTTVAR_SHIFT 4 /* shift for rttvar; 2 bits */ +#define TCP_DELTA_SHIFT 2 /* see tcp_input.c */ + +/* + * The initial retransmission should happen at rtt + 4 * rttvar. + * Because of the way we do the smoothing, srtt and rttvar + * will each average +1/2 tick of bias. When we compute + * the retransmit timer, we want 1/2 tick of rounding and + * 1 extra tick because of +-1/2 tick uncertainty in the + * firing of the timer. The bias will give us exactly the + * 1.5 tick we need. But, because the bias is + * statistical, we have to test that we don't drop below + * the minimum feasible timer (which is 2 ticks). + * This version of the macro adapted from a paper by Lawrence + * Brakmo and Larry Peterson which outlines a problem caused + * by insufficient precision in the original implementation, + * which results in inappropriately large RTO values for very + * fast networks. + */ +#define TCP_REXMTVAL(tp) \ + max((tp)->t_rttmin, (((tp)->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT)) \ + + (tp)->t_rttvar) >> TCP_DELTA_SHIFT) + +/* + * TCP statistics. + * Many of these should be kept per connection, + * but that's inconvenient at the moment. + */ +struct tcpstat { + u_long tcps_connattempt; /* connections initiated */ + u_long tcps_accepts; /* connections accepted */ + u_long tcps_connects; /* connections established */ + u_long tcps_drops; /* connections dropped */ + u_long tcps_conndrops; /* embryonic connections dropped */ + u_long tcps_closed; /* conn. closed (includes drops) */ + u_long tcps_segstimed; /* segs where we tried to get rtt */ + u_long tcps_rttupdated; /* times we succeeded */ + u_long tcps_delack; /* delayed acks sent */ + u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ + u_long tcps_rexmttimeo; /* retransmit timeouts */ + u_long tcps_persisttimeo; /* persist timeouts */ + u_long tcps_keeptimeo; /* keepalive timeouts */ + u_long tcps_keepprobe; /* keepalive probes sent */ + u_long tcps_keepdrops; /* connections dropped in keepalive */ + + u_long tcps_sndtotal; /* total packets sent */ + u_long tcps_sndpack; /* data packets sent */ + u_long tcps_sndbyte; /* data bytes sent */ + u_long tcps_sndrexmitpack; /* data packets retransmitted */ + u_long tcps_sndrexmitbyte; /* data bytes retransmitted */ + u_long tcps_sndacks; /* ack-only packets sent */ + u_long tcps_sndprobe; /* window probes sent */ + u_long tcps_sndurg; /* packets sent with URG only */ + u_long tcps_sndwinup; /* window update-only packets sent */ + u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + + u_long tcps_rcvtotal; /* total packets received */ + u_long tcps_rcvpack; /* packets received in sequence */ + u_long tcps_rcvbyte; /* bytes received in sequence */ + u_long tcps_rcvbadsum; /* packets received with ccksum errs */ + u_long tcps_rcvbadoff; /* packets received with bad offset */ + u_long tcps_rcvmemdrop; /* packets dropped for lack of memory */ + u_long tcps_rcvshort; /* packets received too short */ + u_long tcps_rcvduppack; /* duplicate-only packets received */ + u_long tcps_rcvdupbyte; /* duplicate-only bytes received */ + u_long tcps_rcvpartduppack; /* packets with some duplicate data */ + u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + u_long tcps_rcvoopack; /* out-of-order packets received */ + u_long tcps_rcvoobyte; /* out-of-order bytes received */ + u_long tcps_rcvpackafterwin; /* packets with data after window */ + u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */ + u_long tcps_rcvafterclose; /* packets rcvd after "close" */ + u_long tcps_rcvwinprobe; /* rcvd window probe packets */ + u_long tcps_rcvdupack; /* rcvd duplicate acks */ + u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */ + u_long tcps_rcvackpack; /* rcvd ack packets */ + u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ + u_long tcps_rcvwinupd; /* rcvd window update packets */ + u_long tcps_pawsdrop; /* segments dropped due to PAWS */ + u_long tcps_predack; /* times hdr predict ok for acks */ + u_long tcps_preddat; /* times hdr predict ok for data pkts */ + u_long tcps_pcbcachemiss; + u_long tcps_cachedrtt; /* times cached RTT in route updated */ + u_long tcps_cachedrttvar; /* times cached rttvar updated */ + u_long tcps_cachedssthresh; /* times cached ssthresh updated */ + u_long tcps_usedrtt; /* times RTT initialized from route */ + u_long tcps_usedrttvar; /* times RTTVAR initialized from rt */ + u_long tcps_usedssthresh; /* times ssthresh initialized from rt*/ + u_long tcps_persistdrop; /* timeout in persist state */ + u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */ + u_long tcps_mturesent; /* resends due to MTU discovery */ + u_long tcps_listendrop; /* listen queue overflows */ + + u_long tcps_sc_added; /* entry added to syncache */ + u_long tcps_sc_retransmitted; /* syncache entry was retransmitted */ + u_long tcps_sc_dupsyn; /* duplicate SYN packet */ + u_long tcps_sc_dropped; /* could not reply to packet */ + u_long tcps_sc_completed; /* successful extraction of entry */ + u_long tcps_sc_bucketoverflow; /* syncache per-bucket limit hit */ + u_long tcps_sc_cacheoverflow; /* syncache cache limit hit */ + u_long tcps_sc_reset; /* RST removed entry from syncache */ + u_long tcps_sc_stale; /* timed out or listen socket gone */ + u_long tcps_sc_aborted; /* syncache entry aborted */ + u_long tcps_sc_badack; /* removed due to bad ACK */ + u_long tcps_sc_unreach; /* ICMP unreachable received */ + u_long tcps_sc_zonefail; /* zalloc() failed */ + u_long tcps_sc_sendcookie; /* SYN cookie sent */ + u_long tcps_sc_recvcookie; /* SYN cookie received */ +}; + +/* + * TCB structure exported to user-land via sysctl(3). + * Evil hack: declare only if in_pcb.h and sys/socketvar.h have been + * included. Not all of our clients do. + */ +#if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_) +struct xtcpcb { + size_t xt_len; + struct inpcb xt_inp; + struct tcpcb xt_tp; + struct xsocket xt_socket; + u_quad_t xt_alignment_hack; +}; +#endif + +/* + * Names for TCP sysctl objects + */ +#define TCPCTL_DO_RFC1323 1 /* use RFC-1323 extensions */ +#define TCPCTL_DO_RFC1644 2 /* use RFC-1644 extensions */ +#define TCPCTL_MSSDFLT 3 /* MSS default */ +#define TCPCTL_STATS 4 /* statistics (read-only) */ +#define TCPCTL_RTTDFLT 5 /* default RTT estimate */ +#define TCPCTL_KEEPIDLE 6 /* keepalive idle timer */ +#define TCPCTL_KEEPINTVL 7 /* interval to send keepalives */ +#define TCPCTL_SENDSPACE 8 /* send buffer space */ +#define TCPCTL_RECVSPACE 9 /* receive buffer space */ +#define TCPCTL_KEEPINIT 10 /* timeout for establishing syn */ +#define TCPCTL_PCBLIST 11 /* list of all outstanding PCBs */ +#define TCPCTL_DELACKTIME 12 /* time before sending delayed ACK */ +#define TCPCTL_V6MSSDFLT 13 /* MSS default for IPv6 */ +#define TCPCTL_MAXID 14 + +#define TCPCTL_NAMES { \ + { 0, 0 }, \ + { "rfc1323", CTLTYPE_INT }, \ + { "rfc1644", CTLTYPE_INT }, \ + { "mssdflt", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "rttdflt", CTLTYPE_INT }, \ + { "keepidle", CTLTYPE_INT }, \ + { "keepintvl", CTLTYPE_INT }, \ + { "sendspace", CTLTYPE_INT }, \ + { "recvspace", CTLTYPE_INT }, \ + { "keepinit", CTLTYPE_INT }, \ + { "pcblist", CTLTYPE_STRUCT }, \ + { "delacktime", CTLTYPE_INT }, \ + { "v6mssdflt", CTLTYPE_INT }, \ +} + + +#ifdef _KERNEL +#ifdef SYSCTL_DECL +SYSCTL_DECL(_net_inet_tcp); +#endif + +extern struct inpcbhead tcb; /* head of queue of active tcpcb's */ +extern struct inpcbinfo tcbinfo; +extern struct tcpstat tcpstat; /* tcp statistics */ +extern int tcp_mssdflt; /* XXX */ +extern int tcp_delack_enabled; +extern int tcp_do_newreno; +extern int ss_fltsz; +extern int ss_fltsz_local; + +void tcp_canceltimers(struct tcpcb *); +struct tcpcb * + tcp_close(struct tcpcb *); +void tcp_ctlinput(int, struct sockaddr *, void *); +int tcp_ctloutput(struct socket *, struct sockopt *); +struct tcpcb * + tcp_drop(struct tcpcb *, int); +void tcp_drain(void); +void tcp_fasttimo(void); +struct rmxp_tao * + tcp_gettaocache(struct in_conninfo *); +void tcp_init(void); +void tcp_input(struct mbuf *, int); +void tcp_mss(struct tcpcb *, int); +int tcp_mssopt(struct tcpcb *); +void tcp_drop_syn_sent(struct inpcb *, int); +void tcp_mtudisc(struct inpcb *, int); +struct tcpcb * + tcp_newtcpcb(struct inpcb *); +int tcp_output(struct tcpcb *); +void tcp_quench(struct inpcb *, int); +void tcp_respond(struct tcpcb *, void *, + struct tcphdr *, struct mbuf *, tcp_seq, tcp_seq, int); +struct rtentry * + tcp_rtlookup(struct in_conninfo *); +void tcp_setpersist(struct tcpcb *); +void tcp_slowtimo(void); +struct tcptemp * + tcp_maketemplate(struct tcpcb *); +void tcp_fillheaders(struct tcpcb *, void *, void *); +struct tcpcb * + tcp_timers(struct tcpcb *, int); +void tcp_trace(int, int, struct tcpcb *, void *, struct tcphdr *, int); +void syncache_init(void); +void syncache_unreach(struct in_conninfo *, struct tcphdr *); +int syncache_expand(struct in_conninfo *, struct tcphdr *, + struct socket **, struct mbuf *); +int syncache_add(struct in_conninfo *, struct tcpopt *, + struct tcphdr *, struct socket **, struct mbuf *); +void syncache_chkrst(struct in_conninfo *, struct tcphdr *); +void syncache_badack(struct in_conninfo *); + +extern struct pr_usrreqs tcp_usrreqs; +extern u_long tcp_sendspace; +extern u_long tcp_recvspace; +tcp_seq tcp_new_isn(struct tcpcb *); + +#endif /* _KERNEL */ + +#endif /* _NETINET_TCP_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet/tcpip.h b/newlib/libc/sys/linux/include/netinet/tcpip.h new file mode 100644 index 000000000..53ecb8de0 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/tcpip.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcpip.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcpip.h,v 1.9 2001/02/26 20:10:16 asmodai Exp $ + */ + +#ifndef _NETINET_TCPIP_H_ +#define _NETINET_TCPIP_H_ + +/* + * Tcp+ip header, after ip options removed. + */ +struct tcpiphdr { + struct ipovly ti_i; /* overlaid ip structure */ + struct tcphdr ti_t; /* tcp header */ +}; +#define ti_x1 ti_i.ih_x1 +#define ti_pr ti_i.ih_pr +#define ti_len ti_i.ih_len +#define ti_src ti_i.ih_src +#define ti_dst ti_i.ih_dst +#define ti_sport ti_t.th_sport +#define ti_dport ti_t.th_dport +#define ti_seq ti_t.th_seq +#define ti_ack ti_t.th_ack +#define ti_x2 ti_t.th_x2 +#define ti_off ti_t.th_off +#define ti_flags ti_t.th_flags +#define ti_win ti_t.th_win +#define ti_sum ti_t.th_sum +#define ti_urp ti_t.th_urp + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/udp.h b/newlib/libc/sys/linux/include/netinet/udp.h new file mode 100644 index 000000000..747e76436 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/udp.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/udp.h,v 1.7 1999/08/28 00:49:34 peter Exp $ + */ + +#ifndef _NETINET_UDP_H_ +#define _NETINET_UDP_H_ + +/* + * Udp protocol header. + * Per RFC 768, September, 1981. + */ +struct udphdr { + u_short uh_sport; /* source port */ + u_short uh_dport; /* destination port */ + u_short uh_ulen; /* udp length */ + u_short uh_sum; /* udp checksum */ +}; + +#endif diff --git a/newlib/libc/sys/linux/include/netinet/udp_var.h b/newlib/libc/sys/linux/include/netinet/udp_var.h new file mode 100644 index 000000000..fc00e6e63 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/udp_var.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/udp_var.h,v 1.25 2002/03/19 21:25:46 alfred Exp $ + */ + +#ifndef _NETINET_UDP_VAR_H_ +#define _NETINET_UDP_VAR_H_ + +/* + * UDP kernel structures and variables. + */ +struct udpiphdr { + struct ipovly ui_i; /* overlaid ip structure */ + struct udphdr ui_u; /* udp header */ +}; +#define ui_x1 ui_i.ih_x1 +#define ui_pr ui_i.ih_pr +#define ui_len ui_i.ih_len +#define ui_src ui_i.ih_src +#define ui_dst ui_i.ih_dst +#define ui_sport ui_u.uh_sport +#define ui_dport ui_u.uh_dport +#define ui_ulen ui_u.uh_ulen +#define ui_sum ui_u.uh_sum + +struct udpstat { + /* input statistics: */ + u_long udps_ipackets; /* total input packets */ + u_long udps_hdrops; /* packet shorter than header */ + u_long udps_badsum; /* checksum error */ + u_long udps_nosum; /* no checksum */ + u_long udps_badlen; /* data length larger than packet */ + u_long udps_noport; /* no socket on port */ + u_long udps_noportbcast; /* of above, arrived as broadcast */ + u_long udps_fullsock; /* not delivered, input socket full */ + u_long udpps_pcbcachemiss; /* input packets missing pcb cache */ + u_long udpps_pcbhashmiss; /* input packets not for hashed pcb */ + /* output statistics: */ + u_long udps_opackets; /* total output packets */ + u_long udps_fastout; /* output packets on fast path */ + /* of no socket on port, arrived as multicast */ + u_long udps_noportmcast; +}; + +/* + * Names for UDP sysctl objects + */ +#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */ +#define UDPCTL_STATS 2 /* statistics (read-only) */ +#define UDPCTL_MAXDGRAM 3 /* max datagram size */ +#define UDPCTL_RECVSPACE 4 /* default receive buffer space */ +#define UDPCTL_PCBLIST 5 /* list of PCBs for UDP sockets */ +#define UDPCTL_MAXID 6 + +#define UDPCTL_NAMES { \ + { 0, 0 }, \ + { "checksum", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "maxdgram", CTLTYPE_INT }, \ + { "recvspace", CTLTYPE_INT }, \ + { "pcblist", CTLTYPE_STRUCT }, \ +} + +#ifdef _KERNEL +SYSCTL_DECL(_net_inet_udp); + +extern struct pr_usrreqs udp_usrreqs; +extern struct inpcbhead udb; +extern struct inpcbinfo udbinfo; +extern u_long udp_sendspace; +extern u_long udp_recvspace; +extern struct udpstat udpstat; +extern int log_in_vain; + +void udp_ctlinput(int, struct sockaddr *, void *); +void udp_init(void); +void udp_input(struct mbuf *, int); + +void udp_notify(struct inpcb *inp, int errno); +int udp_shutdown(struct socket *so); +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netinet6/ah.h b/newlib/libc/sys/linux/include/netinet6/ah.h new file mode 100644 index 000000000..ce7c5e824 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ah.h @@ -0,0 +1,94 @@ +/* $FreeBSD: src/sys/netinet6/ah.h,v 1.7 2002/04/19 04:46:22 suz Exp $ */ +/* $KAME: ah.h,v 1.16 2001/09/04 08:43:19 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * RFC1826/2402 authentication header. + */ + +#ifndef _NETINET6_AH_H_ +#define _NETINET6_AH_H_ + +#if defined(_KERNEL) && !defined(_LKM) +#include "opt_inet.h" +#endif + +struct ah { + u_int8_t ah_nxt; /* Next Header */ + u_int8_t ah_len; /* Length of data, in 32bit */ + u_int16_t ah_reserve; /* Reserved for future use */ + u_int32_t ah_spi; /* Security parameter index */ + /* variable size, 32bit bound*/ /* Authentication data */ +}; + +struct newah { + u_int8_t ah_nxt; /* Next Header */ + u_int8_t ah_len; /* Length of data + 1, in 32bit */ + u_int16_t ah_reserve; /* Reserved for future use */ + u_int32_t ah_spi; /* Security parameter index */ + u_int32_t ah_seq; /* Sequence number field */ + /* variable size, 32bit bound*/ /* Authentication data */ +}; + +#ifdef _KERNEL +struct secasvar; + +struct ah_algorithm_state { + struct secasvar *sav; + void* foo; /* per algorithm data - maybe */ +}; + +struct ah_algorithm { + int (*sumsiz) __P((struct secasvar *)); + int (*mature) __P((struct secasvar *)); + int keymin; /* in bits */ + int keymax; /* in bits */ + const char *name; + int (*init) __P((struct ah_algorithm_state *, struct secasvar *)); + void (*update) __P((struct ah_algorithm_state *, caddr_t, size_t)); + void (*result) __P((struct ah_algorithm_state *, caddr_t)); +}; + +#define AH_MAXSUMSIZE 16 + +extern const struct ah_algorithm *ah_algorithm_lookup __P((int)); + +/* cksum routines */ +extern int ah_hdrlen __P((struct secasvar *)); + +extern size_t ah_hdrsiz __P((struct ipsecrequest *)); +extern void ah4_input __P((struct mbuf *, int)); +extern int ah4_output __P((struct mbuf *, struct ipsecrequest *)); +extern int ah4_calccksum __P((struct mbuf *, caddr_t, size_t, + const struct ah_algorithm *, struct secasvar *)); +#endif /* _KERNEL */ + +#endif /* _NETINET6_AH_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/ah6.h b/newlib/libc/sys/linux/include/netinet6/ah6.h new file mode 100644 index 000000000..a2d16d886 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ah6.h @@ -0,0 +1,52 @@ +/* $FreeBSD: src/sys/netinet6/ah6.h,v 1.4 2001/06/11 12:39:03 ume Exp $ */ +/* $KAME: ah.h,v 1.13 2000/10/18 21:28:00 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * RFC1826/2402 authentication header. + */ + +#ifndef _NETINET6_AH6_H_ +#define _NETINET6_AH6_H_ + +#ifdef _KERNEL +struct secasvar; + +extern int ah6_input __P((struct mbuf **, int *, int)); +extern int ah6_output __P((struct mbuf *, u_char *, struct mbuf *, + struct ipsecrequest *)); +extern int ah6_calccksum __P((struct mbuf *, caddr_t, size_t, + const struct ah_algorithm *, struct secasvar *)); + +extern void ah6_ctlinput __P((int, struct sockaddr *, void *)); +#endif + +#endif /*_NETINET6_AH6_H_*/ diff --git a/newlib/libc/sys/linux/include/netinet6/esp.h b/newlib/libc/sys/linux/include/netinet6/esp.h new file mode 100644 index 000000000..0a22f7a03 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/esp.h @@ -0,0 +1,109 @@ +/* $FreeBSD: src/sys/netinet6/esp.h,v 1.6 2002/04/19 04:46:22 suz Exp $ */ +/* $KAME: esp.h,v 1.19 2001/09/04 08:43:19 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * RFC1827/2406 Encapsulated Security Payload. + */ + +#ifndef _NETINET6_ESP_H_ +#define _NETINET6_ESP_H_ + +#if defined(_KERNEL) && !defined(_LKM) +#include "opt_inet.h" +#endif + +struct esp { + u_int32_t esp_spi; /* ESP */ + /* variable size, 32bit bound */ /* Initialization Vector */ + /* variable size */ /* Payload data */ + /* variable size */ /* padding */ + /* 8bit */ /* pad size */ + /* 8bit */ /* next header */ + /* 8bit */ /* next header */ + /* variable size, 32bit bound */ /* Authentication data (new IPsec) */ +}; + +struct newesp { + u_int32_t esp_spi; /* ESP */ + u_int32_t esp_seq; /* Sequence number */ + /* variable size */ /* (IV and) Payload data */ + /* variable size */ /* padding */ + /* 8bit */ /* pad size */ + /* 8bit */ /* next header */ + /* 8bit */ /* next header */ + /* variable size, 32bit bound *//* Authentication data */ +}; + +struct esptail { + u_int8_t esp_padlen; /* pad length */ + u_int8_t esp_nxt; /* Next header */ + /* variable size, 32bit bound *//* Authentication data (new IPsec)*/ +}; + +#ifdef _KERNEL +struct secasvar; + +struct esp_algorithm { + size_t padbound; /* pad boundary, in byte */ + int ivlenval; /* iv length, in byte */ + int (*mature) __P((struct secasvar *)); + int keymin; /* in bits */ + int keymax; /* in bits */ + int (*schedlen) __P((const struct esp_algorithm *)); + const char *name; + int (*ivlen) __P((const struct esp_algorithm *, struct secasvar *)); + int (*decrypt) __P((struct mbuf *, size_t, + struct secasvar *, const struct esp_algorithm *, int)); + int (*encrypt) __P((struct mbuf *, size_t, size_t, + struct secasvar *, const struct esp_algorithm *, int)); + /* not supposed to be called directly */ + int (*schedule) __P((const struct esp_algorithm *, struct secasvar *)); + int (*blockdecrypt) __P((const struct esp_algorithm *, + struct secasvar *, u_int8_t *, u_int8_t *)); + int (*blockencrypt) __P((const struct esp_algorithm *, + struct secasvar *, u_int8_t *, u_int8_t *)); +}; + +extern const struct esp_algorithm *esp_algorithm_lookup __P((int)); +extern int esp_max_ivlen __P((void)); + +/* crypt routines */ +extern int esp4_output __P((struct mbuf *, struct ipsecrequest *)); +extern void esp4_input __P((struct mbuf *, int)); +extern size_t esp_hdrsiz __P((struct ipsecrequest *)); + +extern int esp_schedule __P((const struct esp_algorithm *, struct secasvar *)); +extern int esp_auth __P((struct mbuf *, size_t, size_t, + struct secasvar *, u_char *)); +#endif /* _KERNEL */ + +#endif /* _NETINET6_ESP_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/esp6.h b/newlib/libc/sys/linux/include/netinet6/esp6.h new file mode 100644 index 000000000..933fe2ac7 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/esp6.h @@ -0,0 +1,48 @@ +/* $FreeBSD: src/sys/netinet6/esp6.h,v 1.4 2001/06/11 12:39:04 ume Exp $ */ +/* $KAME: esp.h,v 1.16 2000/10/18 21:28:00 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * RFC1827/2406 Encapsulated Security Payload. + */ + +#ifndef _NETINET6_ESP6_H_ +#define _NETINET6_ESP6_H_ + +#ifdef _KERNEL +extern int esp6_output __P((struct mbuf *, u_char *, struct mbuf *, + struct ipsecrequest *)); +extern int esp6_input __P((struct mbuf **, int *, int)); + +extern void esp6_ctlinput __P((int, struct sockaddr *, void *)); +#endif /*_KERNEL*/ + +#endif /*_NETINET6_ESP6_H_*/ diff --git a/newlib/libc/sys/linux/include/netinet6/esp_rijndael.h b/newlib/libc/sys/linux/include/netinet6/esp_rijndael.h new file mode 100644 index 000000000..8c7d44e0f --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/esp_rijndael.h @@ -0,0 +1,39 @@ +/* $FreeBSD: src/sys/netinet6/esp_rijndael.h,v 1.1 2001/06/11 12:39:05 ume Exp $ */ +/* $KAME: esp_rijndael.h,v 1.1 2000/09/20 18:15:22 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +int esp_rijndael_schedlen __P((const struct esp_algorithm *)); +int esp_rijndael_schedule __P((const struct esp_algorithm *, + struct secasvar *)); +int esp_rijndael_blockdecrypt __P((const struct esp_algorithm *, + struct secasvar *, u_int8_t *, u_int8_t *)); +int esp_rijndael_blockencrypt __P((const struct esp_algorithm *, + struct secasvar *, u_int8_t *, u_int8_t *)); diff --git a/newlib/libc/sys/linux/include/netinet6/icmp6.h b/newlib/libc/sys/linux/include/netinet6/icmp6.h new file mode 100644 index 000000000..300b8aca2 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/icmp6.h @@ -0,0 +1,4 @@ +/* $FreeBSD: src/sys/netinet6/icmp6.h,v 1.6 2000/07/04 16:35:09 itojun Exp $ */ +/* $KAME: icmp6.h,v 1.17 2000/06/11 17:23:40 jinmei Exp $ */ + +#error "netinet6/icmp6.h is obsolete. use netinet/icmp6.h" diff --git a/newlib/libc/sys/linux/include/netinet6/in6.h b/newlib/libc/sys/linux/include/netinet6/in6.h new file mode 100644 index 000000000..e4d1c1cf2 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/in6.h @@ -0,0 +1,651 @@ +/* $FreeBSD: src/sys/netinet6/in6.h,v 1.19 2002/04/19 04:46:22 suz Exp $ */ +/* $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + */ + +#ifndef __KAME_NETINET_IN_H_INCLUDED_ +#error "do not include netinet6/in6.h directly, include netinet/in.h. see RFC2553" +#endif + +#ifndef _NETINET6_IN6_H_ +#define _NETINET6_IN6_H_ + +#include + +/* + * Identification of the network protocol stack + * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE + * has the table of implementation/integration differences. + */ +#define __KAME__ +#define __KAME_VERSION "20010528/FreeBSD" + +/* + * Local port number conventions: + * + * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root), + * unless a kernel is compiled with IPNOPRIVPORTS defined. + * + * When a user does a bind(2) or connect(2) with a port number of zero, + * a non-conflicting local port address is chosen. + * + * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although + * that is settable by sysctl(3); net.inet.ip.anonportmin and + * net.inet.ip.anonportmax respectively. + * + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this + * default assignment range. + * + * The value IP_PORTRANGE_DEFAULT causes the default behavior. + * + * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT, + * and exists only for FreeBSD compatibility purposes. + * + * The value IP_PORTRANGE_LOW changes the range to the "low" are + * that is (by convention) restricted to privileged processes. + * This convention is based on "vouchsafe" principles only. + * It is only secure if you trust the remote host to restrict these ports. + * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX. + */ + +#define IPV6PORT_RESERVED 1024 +#define IPV6PORT_ANONMIN 49152 +#define IPV6PORT_ANONMAX 65535 +#define IPV6PORT_RESERVEDMIN 600 +#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1) + +/* + * IPv6 address + */ +struct in6_addr { + union { + uint8_t __u6_addr8[16]; + uint16_t __u6_addr16[8]; + uint32_t __u6_addr32[4]; + } __u6_addr; /* 128-bit IP6 address */ +}; + +#define s6_addr __u6_addr.__u6_addr8 +#ifdef _KERNEL /* XXX nonstandard */ +#define s6_addr8 __u6_addr.__u6_addr8 +#define s6_addr16 __u6_addr.__u6_addr16 +#define s6_addr32 __u6_addr.__u6_addr32 +#endif + +#define INET6_ADDRSTRLEN 46 + +/* + * Socket address for IPv6 + */ +#ifndef _XOPEN_SOURCE +#define SIN6_LEN +#endif +struct sockaddr_in6 { + uint8_t sin6_family; /* AF_INET6 (sa_family_t) */ + uint16_t sin6_port; /* Transport layer port # (in_port_t)*/ + uint32_t sin6_flowinfo; /* IP6 flow information */ + struct in6_addr sin6_addr; /* IP6 address */ + uint32_t sin6_scope_id; /* scope zone index */ +}; + +/* + * Local definition for masks + */ +#ifdef _KERNEL /* XXX nonstandard */ +#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}} +#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}} +#endif + +#ifdef _KERNEL +extern const struct sockaddr_in6 sa6_any; + +extern const struct in6_addr in6mask0; +extern const struct in6_addr in6mask32; +extern const struct in6_addr in6mask64; +extern const struct in6_addr in6mask96; +extern const struct in6_addr in6mask128; +#endif /* _KERNEL */ + +/* + * Macros started with IPV6_ADDR is KAME local + */ +#ifdef _KERNEL /* XXX nonstandard */ +#if BYTE_ORDER == BIG_ENDIAN +#define IPV6_ADDR_INT32_ONE 1 +#define IPV6_ADDR_INT32_TWO 2 +#define IPV6_ADDR_INT32_MNL 0xff010000 +#define IPV6_ADDR_INT32_MLL 0xff020000 +#define IPV6_ADDR_INT32_SMP 0x0000ffff +#define IPV6_ADDR_INT16_ULL 0xfe80 +#define IPV6_ADDR_INT16_USL 0xfec0 +#define IPV6_ADDR_INT16_MLL 0xff02 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define IPV6_ADDR_INT32_ONE 0x01000000 +#define IPV6_ADDR_INT32_TWO 0x02000000 +#define IPV6_ADDR_INT32_MNL 0x000001ff +#define IPV6_ADDR_INT32_MLL 0x000002ff +#define IPV6_ADDR_INT32_SMP 0xffff0000 +#define IPV6_ADDR_INT16_ULL 0x80fe +#define IPV6_ADDR_INT16_USL 0xc0fe +#define IPV6_ADDR_INT16_MLL 0x02ff +#endif +#endif + +/* + * Definition of some useful macros to handle IP6 addresses + */ +#define IN6ADDR_ANY_INIT \ + {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6ADDR_LOOPBACK_INIT \ + {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_NODELOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}} + +extern const struct in6_addr in6addr_any; +extern const struct in6_addr in6addr_loopback; +extern const struct in6_addr in6addr_nodelocal_allnodes; +extern const struct in6_addr in6addr_linklocal_allnodes; +extern const struct in6_addr in6addr_linklocal_allrouters; + +/* + * Equality + * NOTE: Some of kernel programming environment (for example, openbsd/sparc) + * does not supply memcmp(). For userland memcmp() is preferred as it is + * in ANSI standard. + */ +#ifdef _KERNEL +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) +#else +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) +#endif + +#ifdef _KERNEL /* non standard */ +/* see if two addresses are equal in a scope-conscious manner. */ +#define SA6_ARE_ADDR_EQUAL(a, b) \ + (((a)->sin6_scope_id == 0 || (b)->sin6_scope_id == 0 || \ + ((a)->sin6_scope_id == (b)->sin6_scope_id)) && \ + (bcmp(&(a)->sin6_addr, &(b)->sin6_addr, sizeof(struct in6_addr)) == 0)) +#endif + +/* + * Unspecified + */ +#define IN6_IS_ADDR_UNSPECIFIED(a) \ + ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0)) + +/* + * Loopback + */ +#define IN6_IS_ADDR_LOOPBACK(a) \ + ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1))) + +/* + * IPv4 compatible + */ +#define IN6_IS_ADDR_V4COMPAT(a) \ + ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1))) + +/* + * Mapped + */ +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) + +/* + * KAME Scope Values + */ + +#ifdef _KERNEL /* XXX nonstandard */ +#define IPV6_ADDR_SCOPE_NODELOCAL 0x01 +#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ +#define IPV6_ADDR_SCOPE_GLOBAL 0x0e +#else +#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 +#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ +#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e +#endif + +/* + * Unicast Scope + * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373). + */ +#define IN6_IS_ADDR_LINKLOCAL(a) \ + (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) +#define IN6_IS_ADDR_SITELOCAL(a) \ + (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) + +/* + * Multicast + */ +#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) + +#ifdef _KERNEL /* XXX nonstandard */ +#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) +#else +#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) +#endif + +/* + * Multicast Scope + */ +#ifdef _KERNEL /* refers nonstandard items */ +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL)) +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL)) +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL)) +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL)) +#define IN6_IS_ADDR_MC_GLOBAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL)) +#else +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL)) +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL)) +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL)) +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL)) +#define IN6_IS_ADDR_MC_GLOBAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) +#endif + +#ifdef _KERNEL /* nonstandard */ +/* + * KAME Scope + */ +#define IN6_IS_SCOPE_LINKLOCAL(a) \ + ((IN6_IS_ADDR_LINKLOCAL(a)) || \ + (IN6_IS_ADDR_MC_LINKLOCAL(a))) + +#define IFA6_IS_DEPRECATED(a) \ + ((a)->ia6_lifetime.ia6t_preferred != 0 && \ + (a)->ia6_lifetime.ia6t_preferred < time_second) +#define IFA6_IS_INVALID(a) \ + ((a)->ia6_lifetime.ia6t_expire != 0 && \ + (a)->ia6_lifetime.ia6t_expire < time_second) +#endif /* _KERNEL */ + +/* + * IP6 route structure + */ +#ifndef _XOPEN_SOURCE +struct route_in6 { + struct rtentry *ro_rt; + struct sockaddr_in6 ro_dst; +}; +#endif + +/* + * Options for use with [gs]etsockopt at the IPV6 level. + * First word of comment is data type; bool is stored in int. + */ +/* no hdrincl */ +#if 0 /* the followings are relic in IPv4 and hence are disabled */ +#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */ +#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */ +#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */ +#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */ +#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */ +#endif +#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */ +#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */ +#define IPV6_MULTICAST_IF 9 /* u_char; set/get IP6 multicast i/f */ +#define IPV6_MULTICAST_HOPS 10 /* u_char; set/get IP6 multicast hops */ +#define IPV6_MULTICAST_LOOP 11 /* u_char; set/get IP6 multicast loopback */ +#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */ +#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */ +#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */ +#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */ +/* RFC2292 options */ +#define IPV6_PKTINFO 19 /* bool; send/recv if, src/dst addr */ +#define IPV6_HOPLIMIT 20 /* bool; hop limit */ +#define IPV6_NEXTHOP 21 /* bool; next hop addr */ +#define IPV6_HOPOPTS 22 /* bool; hop-by-hop option */ +#define IPV6_DSTOPTS 23 /* bool; destination option */ +#define IPV6_RTHDR 24 /* bool; routing header */ +#define IPV6_PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */ + +#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */ +#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */ +#ifndef _KERNEL +#define IPV6_BINDV6ONLY IPV6_V6ONLY +#endif + +#if 1 /* IPSEC */ +#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */ +#endif +#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */ + +#if 1 /* IPV6FIREWALL */ +#define IPV6_FW_ADD 30 /* add a firewall rule to chain */ +#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */ +#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */ +#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */ +#define IPV6_FW_GET 34 /* get entire firewall rule chain */ +#endif + +/* to define items, should talk with KAME guys first, for *BSD compatibility */ + +#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */ +#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */ +#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */ + +/* + * Defaults and limits for options + */ +#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */ +#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ + +/* + * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. + */ +struct ipv6_mreq { + struct in6_addr ipv6mr_multiaddr; + unsigned int ipv6mr_interface; +}; + +/* + * IPV6_PKTINFO: Packet information(RFC2292 sec 5) + */ +struct in6_pktinfo { + struct in6_addr ipi6_addr; /* src/dst IPv6 address */ + unsigned int ipi6_ifindex; /* send/recv interface index */ +}; + +/* + * Argument for IPV6_PORTRANGE: + * - which range to search when port is unspecified at bind() or connect() + */ +#define IPV6_PORTRANGE_DEFAULT 0 /* default range */ +#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ +#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ + +#ifndef _XOPEN_SOURCE +/* + * Definitions for inet6 sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */ + +#define CTL_IPV6PROTO_NAMES { \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "tcp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "udp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "ip6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "ipsec6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "icmp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pim6", CTLTYPE_NODE }, \ +} + +/* + * Names for IP sysctl objects + */ +#define IPV6CTL_FORWARDING 1 /* act as router */ +#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/ +#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */ +#ifdef notyet +#define IPV6CTL_DEFMTU 4 /* default MTU */ +#endif +#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */ +#define IPV6CTL_STATS 6 /* stats */ +#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */ +#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */ +#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */ +#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */ +#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */ +#define IPV6CTL_ACCEPT_RTADV 12 +#define IPV6CTL_KEEPFAITH 13 +#define IPV6CTL_LOG_INTERVAL 14 +#define IPV6CTL_HDRNESTLIMIT 15 +#define IPV6CTL_DAD_COUNT 16 +#define IPV6CTL_AUTO_FLOWLABEL 17 +#define IPV6CTL_DEFMCASTHLIM 18 +#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */ +#define IPV6CTL_KAME_VERSION 20 +#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */ +#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */ +#if 0 /* obsolete */ +#define IPV6CTL_MAPPED_ADDR 23 +#endif +#define IPV6CTL_V6ONLY 24 +#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */ +#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */ +#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */ + +#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */ +#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */ +#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */ +#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */ +#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */ + +/* New entries should be added here from current IPV6CTL_MAXID value. */ +/* to define items, should talk with KAME guys first, for *BSD compatibility */ +#define IPV6CTL_MAXID 37 + +#endif /* !_XOPEN_SOURCE */ + +/* + * Redefinition of mbuf flags + */ +#define M_AUTHIPHDR M_PROTO2 +#define M_DECRYPTED M_PROTO3 +#define M_LOOP M_PROTO4 +#define M_AUTHIPDGM M_PROTO5 + +#ifdef _KERNEL +struct cmsghdr; + +int in6_cksum __P((struct mbuf *, uint8_t, uint32_t, uint32_t)); +int in6_localaddr __P((struct in6_addr *)); +int in6_addrscope __P((struct in6_addr *)); +struct in6_ifaddr *in6_ifawithscope __P((struct ifnet *, struct in6_addr *)); +struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *)); +extern void in6_if_up __P((struct ifnet *)); +struct sockaddr; +extern u_char ip6_protox[]; + +void in6_sin6_2_sin __P((struct sockaddr_in *sin, + struct sockaddr_in6 *sin6)); +void in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin, + struct sockaddr_in6 *sin6)); +void in6_sin6_2_sin_in_sock __P((struct sockaddr *nam)); +void in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam)); + +#define satosin6(sa) ((struct sockaddr_in6 *)(sa)) +#define sin6tosa(sin6) ((struct sockaddr *)(sin6)) +#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) + +extern int (*faithprefix_p)(struct in6_addr *); +#endif /* _KERNEL */ + +__BEGIN_DECLS +struct cmsghdr; + +extern int inet6_option_space __P((int)); +extern int inet6_option_init __P((void *, struct cmsghdr **, int)); +extern int inet6_option_append __P((struct cmsghdr *, const uint8_t *, + int, int)); +extern uint8_t *inet6_option_alloc __P((struct cmsghdr *, int, int, int)); +extern int inet6_option_next __P((const struct cmsghdr *, uint8_t **)); +extern int inet6_option_find __P((const struct cmsghdr *, uint8_t **, int)); + +extern size_t inet6_rthdr_space __P((int, int)); +extern struct cmsghdr *inet6_rthdr_init __P((void *, int)); +extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *, + unsigned int)); +extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int)); +#if 0 /* not implemented yet */ +extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *)); +#endif +extern int inet6_rthdr_segments __P((const struct cmsghdr *)); +extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int)); +extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int)); + +extern int inet6_opt_init __P((void *, size_t)); +extern int inet6_opt_append __P((void *, size_t, int, uint8_t, + size_t, uint8_t, void **)); +extern int inet6_opt_finish __P((void *, size_t, int)); +extern int inet6_opt_set_val __P((void *, size_t, void *, int)); + +extern int inet6_opt_next __P((void *, size_t, int, uint8_t *, + size_t *, void **)); +extern int inet6_opt_find __P((void *, size_t, int, uint8_t, + size_t *, void **)); +extern int inet6_opt_get_val __P((void *, size_t, void *, int)); +extern size_t inet6_rth_space __P((int, int)); +extern void *inet6_rth_init __P((void *, int, int, int)); +extern int inet6_rth_add __P((void *, const struct in6_addr *)); +extern int inet6_rth_reverse __P((const void *, void *)); +extern int inet6_rth_segments __P((const void *)); +extern struct in6_addr *inet6_rth_getaddr __P((const void *, int)); +__END_DECLS + +#endif /* !_NETINET6_IN6_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/in6_gif.h b/newlib/libc/sys/linux/include/netinet6/in6_gif.h new file mode 100644 index 000000000..cd0db9b1e --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/in6_gif.h @@ -0,0 +1,42 @@ +/* $FreeBSD: src/sys/netinet6/in6_gif.h,v 1.3 2000/07/04 16:35:09 itojun Exp $ */ +/* $KAME: in6_gif.h,v 1.5 2000/04/14 08:36:03 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET6_IN6_GIF_H_ +#define _NETINET6_IN6_GIF_H_ + +#define GIF_HLIM 30 + +int in6_gif_input __P((struct mbuf **, int *, int)); +int in6_gif_output __P((struct ifnet *, int, struct mbuf *, struct rtentry *)); +int gif_encapcheck6 __P((const struct mbuf *, int, int, void *)); + +#endif /*_NETINET6_IN6_GIF_H_*/ diff --git a/newlib/libc/sys/linux/include/netinet6/in6_ifattach.h b/newlib/libc/sys/linux/include/netinet6/in6_ifattach.h new file mode 100644 index 000000000..90229e4f7 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/in6_ifattach.h @@ -0,0 +1,46 @@ +/* $FreeBSD: src/sys/netinet6/in6_ifattach.h,v 1.3 2001/06/11 12:39:05 ume Exp $ */ +/* $KAME: in6_ifattach.h,v 1.14 2001/02/08 12:48:39 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET6_IN6_IFATTACH_H_ +#define _NETINET6_IN6_IFATTACH_H_ + +#ifdef _KERNEL +void in6_nigroup_attach __P((const char *, int)); +void in6_nigroup_detach __P((const char *, int)); +void in6_ifattach __P((struct ifnet *, struct ifnet *)); +void in6_ifdetach __P((struct ifnet *)); +void in6_get_tmpifid __P((struct ifnet *, u_int8_t *, const u_int8_t *, int)); +void in6_tmpaddrtimer __P((void *)); +int in6_nigroup __P((struct ifnet *, const char *, int, struct in6_addr *)); +#endif /* _KERNEL */ + +#endif /* _NETINET6_IN6_IFATTACH_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/in6_pcb.h b/newlib/libc/sys/linux/include/netinet6/in6_pcb.h new file mode 100644 index 000000000..c47c6c739 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/in6_pcb.h @@ -0,0 +1,111 @@ +/* $FreeBSD: src/sys/netinet6/in6_pcb.h,v 1.7 2002/02/27 02:44:45 alfred Exp $ */ +/* $KAME: in6_pcb.h,v 1.13 2001/02/06 09:16:53 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET6_IN6_PCB_H_ +#define _NETINET6_IN6_PCB_H_ + +#ifdef _KERNEL +#define satosin6(sa) ((struct sockaddr_in6 *)(sa)) +#define sin6tosa(sin6) ((struct sockaddr *)(sin6)) +#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) + +void in6_pcbpurgeif0 __P((struct in6pcb *, struct ifnet *)); +void in6_losing __P((struct inpcb *)); +int in6_pcballoc __P((struct socket *, struct inpcbinfo *, struct thread *)); +int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct thread *)); +int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct thread *)); +void in6_pcbdetach __P((struct inpcb *)); +void in6_pcbdisconnect __P((struct inpcb *)); +int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, + struct in6_addr **)); +struct inpcb * + in6_pcblookup_local __P((struct inpcbinfo *, + struct in6_addr *, u_int, int)); +struct inpcb * + in6_pcblookup_hash __P((struct inpcbinfo *, + struct in6_addr *, u_int, struct in6_addr *, + u_int, int, struct ifnet *)); +void in6_pcbnotify __P((struct inpcbhead *, struct sockaddr *, + u_int, const struct sockaddr *, u_int, int, + void (*)(struct inpcb *, int))); +void in6_rtchange __P((struct inpcb *, int)); +int in6_setpeeraddr __P((struct socket *so, struct sockaddr **nam)); +int in6_setsockaddr __P((struct socket *so, struct sockaddr **nam)); +int in6_mapped_sockaddr __P((struct socket *so, struct sockaddr **nam)); +int in6_mapped_peeraddr __P((struct socket *so, struct sockaddr **nam)); +struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *, + struct ip6_pktopts *, + struct ip6_moptions *, + struct route_in6 *, + struct in6_addr *, int *)); +int in6_selecthlim __P((struct in6pcb *, struct ifnet *)); +int in6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct thread *)); +void init_sin6 __P((struct sockaddr_in6 *sin6, struct mbuf *m)); +#endif /* _KERNEL */ + +#endif /* !_NETINET6_IN6_PCB_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/in6_prefix.h b/newlib/libc/sys/linux/include/netinet6/in6_prefix.h new file mode 100644 index 000000000..6b2c5205d --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/in6_prefix.h @@ -0,0 +1,91 @@ +/* $FreeBSD: src/sys/netinet6/in6_prefix.h,v 1.5 2001/06/11 12:39:05 ume Exp $ */ +/* $KAME: in6_prefix.h,v 1.10 2001/02/08 16:30:30 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, 1998 and 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +struct rr_prefix { + struct ifprefix rp_ifpr; + LIST_ENTRY(rr_prefix) rp_entry; + LIST_HEAD(rp_addrhead, rp_addr) rp_addrhead; + struct sockaddr_in6 rp_prefix; /* prefix */ + u_int32_t rp_vltime; /* advertised valid lifetime */ + u_int32_t rp_pltime; /* advertised preferred lifetime */ + time_t rp_expire; /* expiration time of the prefix */ + time_t rp_preferred; /* preferred time of the prefix */ + struct in6_prflags rp_flags; + u_char rp_origin; /* from where this prefix info is obtained */ + struct rp_stateflags { + /* if some prefix should be added to this prefix */ + u_char addmark : 1; + u_char delmark : 1; /* if this prefix will be deleted */ + } rp_stateflags; +}; + +#define rp_type rp_ifpr.ifpr_type +#define rp_ifp rp_ifpr.ifpr_ifp +#define rp_plen rp_ifpr.ifpr_plen + +#define rp_raf rp_flags.prf_ra +#define rp_raf_onlink rp_flags.prf_ra.onlink +#define rp_raf_auto rp_flags.prf_ra.autonomous + +#define rp_statef_addmark rp_stateflags.addmark +#define rp_statef_delmark rp_stateflags.delmark + +#define rp_rrf rp_flags.prf_rr +#define rp_rrf_decrvalid rp_flags.prf_rr.decrvalid +#define rp_rrf_decrprefd rp_flags.prf_rr.decrprefd + +struct rp_addr { + LIST_ENTRY(rp_addr) ra_entry; + struct in6_addr ra_ifid; + struct in6_ifaddr *ra_addr; + struct ra_flags { + u_char anycast : 1; + } ra_flags; +}; + +#define ifpr2rp(ifpr) ((struct rr_prefix *)(ifpr)) +#define rp2ifpr(rp) ((struct ifprefix *)(rp)) + +#define RP_IN6(rp) (&(rp)->rp_prefix.sin6_addr) + +#define RR_INFINITE_LIFETIME 0xffffffff + + +LIST_HEAD(rr_prhead, rr_prefix); + +extern struct rr_prhead rr_prefix; + +void in6_rr_timer __P((void *)); +extern struct callout in6_rr_timer_ch; +int delete_each_prefix __P((struct rr_prefix *rpp, u_char origin)); diff --git a/newlib/libc/sys/linux/include/netinet6/in6_var.h b/newlib/libc/sys/linux/include/netinet6/in6_var.h new file mode 100644 index 000000000..7ddfbdb7c --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/in6_var.h @@ -0,0 +1,608 @@ +/* $FreeBSD: src/sys/netinet6/in6_var.h,v 1.10 2002/04/19 04:46:22 suz Exp $ */ +/* $KAME: in6_var.h,v 1.56 2001/03/29 05:34:31 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1985, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET6_IN6_VAR_H_ +#define _NETINET6_IN6_VAR_H_ + +/* + * Interface address, Internet version. One of these structures + * is allocated for each interface with an Internet address. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ + +/* + * pltime/vltime are just for future reference (required to implements 2 + * hour rule for hosts). they should never be modified by nd6_timeout or + * anywhere else. + * userland -> kernel: accept pltime/vltime + * kernel -> userland: throw up everything + * in kernel: modify preferred/expire only + */ +struct in6_addrlifetime { + time_t ia6t_expire; /* valid lifetime expiration time */ + time_t ia6t_preferred; /* preferred lifetime expiration time */ + u_int32_t ia6t_vltime; /* valid lifetime */ + u_int32_t ia6t_pltime; /* prefix lifetime */ +}; + +struct in6_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + struct sockaddr_in6 ia_addr; /* interface address */ + struct sockaddr_in6 ia_net; /* network number of interface */ + struct sockaddr_in6 ia_dstaddr; /* space for destination addr */ + struct sockaddr_in6 ia_prefixmask; /* prefix mask */ + u_int32_t ia_plen; /* prefix length */ + struct in6_ifaddr *ia_next; /* next in6 list of IP6 addresses */ + int ia6_flags; + + struct in6_addrlifetime ia6_lifetime; + struct ifprefix *ia6_ifpr; /* back pointer to ifprefix */ + + struct nd_prefix *ia6_ndpr; /* back pointer to the ND prefix + * (for autoconfigured addresses only) + */ +}; + +/* + * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12). + */ +struct in6_ifstat { + u_quad_t ifs6_in_receive; /* # of total input datagram */ + u_quad_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */ + u_quad_t ifs6_in_toobig; /* # of datagrams exceeded MTU */ + u_quad_t ifs6_in_noroute; /* # of datagrams with no route */ + u_quad_t ifs6_in_addrerr; /* # of datagrams with invalid dst */ + u_quad_t ifs6_in_protounknown; /* # of datagrams with unknown proto */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_in_truncated; /* # of truncated datagrams */ + u_quad_t ifs6_in_discard; /* # of discarded datagrams */ + /* NOTE: fragment timeout is not here */ + u_quad_t ifs6_in_deliver; /* # of datagrams delivered to ULP */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_out_forward; /* # of datagrams forwarded */ + /* NOTE: increment on outgoing if */ + u_quad_t ifs6_out_request; /* # of outgoing datagrams from ULP */ + /* NOTE: does not include forwrads */ + u_quad_t ifs6_out_discard; /* # of discarded datagrams */ + u_quad_t ifs6_out_fragok; /* # of datagrams fragmented */ + u_quad_t ifs6_out_fragfail; /* # of datagrams failed on fragment */ + u_quad_t ifs6_out_fragcreat; /* # of fragment datagrams */ + /* NOTE: this is # after fragment */ + u_quad_t ifs6_reass_reqd; /* # of incoming fragmented packets */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_reass_ok; /* # of reassembled packets */ + /* NOTE: this is # after reass */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_reass_fail; /* # of reass failures */ + /* NOTE: may not be packet count */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */ + u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */ +}; + +/* + * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry. + * XXX: I'm not sure if this file is the right place for this structure... + */ +struct icmp6_ifstat { + /* + * Input statistics + */ + /* ipv6IfIcmpInMsgs, total # of input messages */ + u_quad_t ifs6_in_msg; + /* ipv6IfIcmpInErrors, # of input error messages */ + u_quad_t ifs6_in_error; + /* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */ + u_quad_t ifs6_in_dstunreach; + /* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */ + u_quad_t ifs6_in_adminprohib; + /* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */ + u_quad_t ifs6_in_timeexceed; + /* ipv6IfIcmpInParmProblems, # of input parameter problem errors */ + u_quad_t ifs6_in_paramprob; + /* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */ + u_quad_t ifs6_in_pkttoobig; + /* ipv6IfIcmpInEchos, # of input echo requests */ + u_quad_t ifs6_in_echo; + /* ipv6IfIcmpInEchoReplies, # of input echo replies */ + u_quad_t ifs6_in_echoreply; + /* ipv6IfIcmpInRouterSolicits, # of input router solicitations */ + u_quad_t ifs6_in_routersolicit; + /* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */ + u_quad_t ifs6_in_routeradvert; + /* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */ + u_quad_t ifs6_in_neighborsolicit; + /* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */ + u_quad_t ifs6_in_neighboradvert; + /* ipv6IfIcmpInRedirects, # of input redirects */ + u_quad_t ifs6_in_redirect; + /* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */ + u_quad_t ifs6_in_mldquery; + /* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */ + u_quad_t ifs6_in_mldreport; + /* ipv6IfIcmpInGroupMembReductions, # of input MLD done */ + u_quad_t ifs6_in_mlddone; + + /* + * Output statistics. We should solve unresolved routing problem... + */ + /* ipv6IfIcmpOutMsgs, total # of output messages */ + u_quad_t ifs6_out_msg; + /* ipv6IfIcmpOutErrors, # of output error messages */ + u_quad_t ifs6_out_error; + /* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */ + u_quad_t ifs6_out_dstunreach; + /* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */ + u_quad_t ifs6_out_adminprohib; + /* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */ + u_quad_t ifs6_out_timeexceed; + /* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */ + u_quad_t ifs6_out_paramprob; + /* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */ + u_quad_t ifs6_out_pkttoobig; + /* ipv6IfIcmpOutEchos, # of output echo requests */ + u_quad_t ifs6_out_echo; + /* ipv6IfIcmpOutEchoReplies, # of output echo replies */ + u_quad_t ifs6_out_echoreply; + /* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */ + u_quad_t ifs6_out_routersolicit; + /* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */ + u_quad_t ifs6_out_routeradvert; + /* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */ + u_quad_t ifs6_out_neighborsolicit; + /* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */ + u_quad_t ifs6_out_neighboradvert; + /* ipv6IfIcmpOutRedirects, # of output redirects */ + u_quad_t ifs6_out_redirect; + /* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */ + u_quad_t ifs6_out_mldquery; + /* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */ + u_quad_t ifs6_out_mldreport; + /* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */ + u_quad_t ifs6_out_mlddone; +}; + +struct in6_ifreq { + char ifr_name[IFNAMSIZ]; + union { + struct sockaddr_in6 ifru_addr; + struct sockaddr_in6 ifru_dstaddr; + short ifru_flags; + int ifru_flags6; + int ifru_metric; + caddr_t ifru_data; + struct in6_addrlifetime ifru_lifetime; + struct in6_ifstat ifru_stat; + struct icmp6_ifstat ifru_icmp6stat; + u_int32_t ifru_scope_id[16]; + } ifr_ifru; +}; + +struct in6_aliasreq { + char ifra_name[IFNAMSIZ]; + struct sockaddr_in6 ifra_addr; + struct sockaddr_in6 ifra_dstaddr; + struct sockaddr_in6 ifra_prefixmask; + int ifra_flags; + struct in6_addrlifetime ifra_lifetime; +}; + +/* prefix type macro */ +#define IN6_PREFIX_ND 1 +#define IN6_PREFIX_RR 2 + +/* + * prefix related flags passed between kernel(NDP related part) and + * user land command(ifconfig) and daemon(rtadvd). + */ +struct in6_prflags { + struct prf_ra { + u_char onlink : 1; + u_char autonomous : 1; + u_char reserved : 6; + } prf_ra; + u_char prf_reserved1; + u_short prf_reserved2; + /* want to put this on 4byte offset */ + struct prf_rr { + u_char decrvalid : 1; + u_char decrprefd : 1; + u_char reserved : 6; + } prf_rr; + u_char prf_reserved3; + u_short prf_reserved4; +}; + +struct in6_prefixreq { + char ipr_name[IFNAMSIZ]; + u_char ipr_origin; + u_char ipr_plen; + u_int32_t ipr_vltime; + u_int32_t ipr_pltime; + struct in6_prflags ipr_flags; + struct sockaddr_in6 ipr_prefix; +}; + +#define PR_ORIG_RA 0 +#define PR_ORIG_RR 1 +#define PR_ORIG_STATIC 2 +#define PR_ORIG_KERNEL 3 + +#define ipr_raf_onlink ipr_flags.prf_ra.onlink +#define ipr_raf_auto ipr_flags.prf_ra.autonomous + +#define ipr_statef_onlink ipr_flags.prf_state.onlink + +#define ipr_rrf_decrvalid ipr_flags.prf_rr.decrvalid +#define ipr_rrf_decrprefd ipr_flags.prf_rr.decrprefd + +struct in6_rrenumreq { + char irr_name[IFNAMSIZ]; + u_char irr_origin; + u_char irr_m_len; /* match len for matchprefix */ + u_char irr_m_minlen; /* minlen for matching prefix */ + u_char irr_m_maxlen; /* maxlen for matching prefix */ + u_char irr_u_uselen; /* uselen for adding prefix */ + u_char irr_u_keeplen; /* keeplen from matching prefix */ + struct irr_raflagmask { + u_char onlink : 1; + u_char autonomous : 1; + u_char reserved : 6; + } irr_raflagmask; + u_int32_t irr_vltime; + u_int32_t irr_pltime; + struct in6_prflags irr_flags; + struct sockaddr_in6 irr_matchprefix; + struct sockaddr_in6 irr_useprefix; +}; + +#define irr_raf_mask_onlink irr_raflagmask.onlink +#define irr_raf_mask_auto irr_raflagmask.autonomous +#define irr_raf_mask_reserved irr_raflagmask.reserved + +#define irr_raf_onlink irr_flags.prf_ra.onlink +#define irr_raf_auto irr_flags.prf_ra.autonomous + +#define irr_statef_onlink irr_flags.prf_state.onlink + +#define irr_rrf irr_flags.prf_rr +#define irr_rrf_decrvalid irr_flags.prf_rr.decrvalid +#define irr_rrf_decrprefd irr_flags.prf_rr.decrprefd + +/* + * Given a pointer to an in6_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in6 + */ +#define IA6_IN6(ia) (&((ia)->ia_addr.sin6_addr)) +#define IA6_DSTIN6(ia) (&((ia)->ia_dstaddr.sin6_addr)) +#define IA6_MASKIN6(ia) (&((ia)->ia_prefixmask.sin6_addr)) +#define IA6_SIN6(ia) (&((ia)->ia_addr)) +#define IA6_DSTSIN6(ia) (&((ia)->ia_dstaddr)) +#define IFA_IN6(x) (&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr) +#define IFA_DSTIN6(x) (&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr) + +#define IFPR_IN6(x) (&((struct sockaddr_in6 *)((x)->ifpr_prefix))->sin6_addr) + +#ifdef _KERNEL +#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ + (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ + (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \ + (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \ + (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 ) +#endif + +#define SIOCSIFADDR_IN6 _IOW('i', 12, struct in6_ifreq) +#define SIOCGIFADDR_IN6 _IOWR('i', 33, struct in6_ifreq) + +#ifdef _KERNEL +/* + * SIOCSxxx ioctls should be unused (see comments in in6.c), but + * we do not shift numbers for binary compatibility. + */ +#define SIOCSIFDSTADDR_IN6 _IOW('i', 14, struct in6_ifreq) +#define SIOCSIFNETMASK_IN6 _IOW('i', 22, struct in6_ifreq) +#endif + +#define SIOCGIFDSTADDR_IN6 _IOWR('i', 34, struct in6_ifreq) +#define SIOCGIFNETMASK_IN6 _IOWR('i', 37, struct in6_ifreq) + +#define SIOCDIFADDR_IN6 _IOW('i', 25, struct in6_ifreq) +#define SIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq) + +#define SIOCSIFPHYADDR_IN6 _IOW('i', 70, struct in6_aliasreq) +#define SIOCGIFPSRCADDR_IN6 _IOWR('i', 71, struct in6_ifreq) +#define SIOCGIFPDSTADDR_IN6 _IOWR('i', 72, struct in6_ifreq) + +#define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq) + +#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist) +#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_prlist) +#ifdef _KERNEL +#define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq) +#endif +#define SIOCGIFINFO_IN6 _IOWR('i', 108, struct in6_ndireq) +#define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq) +#define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo) +#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq) +#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq) + +#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq) +#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq) +#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq) +#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq) + +#define SIOCSDEFIFACE_IN6 _IOWR('i', 85, struct in6_ndifreq) +#define SIOCGDEFIFACE_IN6 _IOWR('i', 86, struct in6_ndifreq) + +#define SIOCSIFINFO_FLAGS _IOWR('i', 87, struct in6_ndireq) /* XXX */ + +#define SIOCSSCOPE6 _IOW('i', 88, struct in6_ifreq) +#define SIOCGSCOPE6 _IOWR('i', 89, struct in6_ifreq) +#define SIOCGSCOPE6DEF _IOWR('i', 90, struct in6_ifreq) + +#define SIOCSIFPREFIX_IN6 _IOW('i', 100, struct in6_prefixreq) /* set */ +#define SIOCGIFPREFIX_IN6 _IOWR('i', 101, struct in6_prefixreq) /* get */ +#define SIOCDIFPREFIX_IN6 _IOW('i', 102, struct in6_prefixreq) /* del */ +#define SIOCAIFPREFIX_IN6 _IOW('i', 103, struct in6_rrenumreq) /* add */ +#define SIOCCIFPREFIX_IN6 _IOW('i', 104, \ + struct in6_rrenumreq) /* change */ +#define SIOCSGIFPREFIX_IN6 _IOW('i', 105, \ + struct in6_rrenumreq) /* set global */ + +#define SIOCGETSGCNT_IN6 _IOWR('u', 106, \ + struct sioc_sg_req6) /* get s,g pkt cnt */ +#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, \ + struct sioc_mif_req6) /* get pkt cnt per if */ + +#define IN6_IFF_ANYCAST 0x01 /* anycast address */ +#define IN6_IFF_TENTATIVE 0x02 /* tentative address */ +#define IN6_IFF_DUPLICATED 0x04 /* DAD detected duplicate */ +#define IN6_IFF_DETACHED 0x08 /* may be detached from the link */ +#define IN6_IFF_DEPRECATED 0x10 /* deprecated address */ +#define IN6_IFF_NODAD 0x20 /* don't perform DAD on this address + * (used only at first SIOC* call) + */ +#define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */ +#define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */ +#define IN6_IFF_NOPFX 0x8000 /* skip kernel prefix management. + * XXX: this should be temporary. + */ + +/* do not input/output */ +#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED) + +#ifdef _KERNEL +#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b)) +#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b)) +#endif + +#ifdef _KERNEL +extern struct in6_ifaddr *in6_ifaddr; + +extern struct in6_ifstat **in6_ifstat; +extern size_t in6_ifstatmax; +extern struct icmp6stat icmp6stat; +extern struct icmp6_ifstat **icmp6_ifstat; +extern size_t icmp6_ifstatmax; +#define in6_ifstat_inc(ifp, tag) \ +do { \ + if ((ifp) && (ifp)->if_index <= if_index \ + && (ifp)->if_index < in6_ifstatmax \ + && in6_ifstat && in6_ifstat[(ifp)->if_index]) { \ + in6_ifstat[(ifp)->if_index]->tag++; \ + } \ +} while (0) + +extern struct ifqueue ip6intrq; /* IP6 packet input queue */ +extern struct in6_addr zeroin6_addr; +extern u_char inet6ctlerrmap[]; +extern unsigned long in6_maxmtu; +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_IPMADDR); +#endif + +/* + * Macro for finding the internet address structure (in6_ifaddr) corresponding + * to a given interface (ifnet structure). + */ + +#define IFP_TO_IA6(ifp, ia) \ +/* struct ifnet *ifp; */ \ +/* struct in6_ifaddr *ia; */ \ +do { \ + struct ifaddr *ifa; \ + for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { \ + if (!ifa->ifa_addr) \ + continue; \ + if (ifa->ifa_addr->sa_family == AF_INET6) \ + break; \ + } \ + (ia) = (struct in6_ifaddr *)ifa; \ +} while (0) + +#endif /* _KERNEL */ + +/* + * Multi-cast membership entry. One for each group/ifp that a PCB + * belongs to. + */ +struct in6_multi_mship { + struct in6_multi *i6mm_maddr; /* Multicast address pointer */ + LIST_ENTRY(in6_multi_mship) i6mm_chain; /* multicast options chain */ +}; + +struct in6_multi { + LIST_ENTRY(in6_multi) in6m_entry; /* list glue */ + struct in6_addr in6m_addr; /* IP6 multicast address */ + struct ifnet *in6m_ifp; /* back pointer to ifnet */ + struct ifmultiaddr *in6m_ifma; /* back pointer to ifmultiaddr */ + u_int in6m_refcount; /* # membership claims by sockets */ + u_int in6m_state; /* state of the membership */ + u_int in6m_timer; /* MLD6 listener report timer */ +}; + +#ifdef _KERNEL +extern LIST_HEAD(in6_multihead, in6_multi) in6_multihead; + +/* + * Structure used by macros below to remember position when stepping through + * all of the in6_multi records. + */ +struct in6_multistep { + struct in6_ifaddr *i_ia; + struct in6_multi *i_in6m; +}; + +/* + * Macros for looking up the in6_multi record for a given IP6 multicast + * address on a given interface. If no matching record is found, "in6m" + * returns NLL. + */ + +#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \ +/* struct in6_addr addr; */ \ +/* struct ifnet *ifp; */ \ +/* struct in6_multi *in6m; */ \ +do { \ + struct ifmultiaddr *ifma; \ + TAILQ_FOREACH(ifma, &(ifp)->if_multiaddrs, ifma_link) { \ + if (ifma->ifma_addr->sa_family == AF_INET6 \ + && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \ + &(addr))) \ + break; \ + } \ + (in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \ +} while(0) + +/* + * Macro to step through all of the in6_multi records, one at a time. + * The current position is remembered in "step", which the caller must + * provide. IN6_FIRST_MULTI(), below, must be called to initialize "step" + * and get the first record. Both macros return a NULL "in6m" when there + * are no remaining records. + */ +#define IN6_NEXT_MULTI(step, in6m) \ +/* struct in6_multistep step; */ \ +/* struct in6_multi *in6m; */ \ +do { \ + if (((in6m) = (step).i_in6m) != NULL) \ + (step).i_in6m = (step).i_in6m->in6m_entry.le_next; \ +} while(0) + +#define IN6_FIRST_MULTI(step, in6m) \ +/* struct in6_multistep step; */ \ +/* struct in6_multi *in6m */ \ +do { \ + (step).i_in6m = in6_multihead.lh_first; \ + IN6_NEXT_MULTI((step), (in6m)); \ +} while(0) + +struct in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *, + int *)); +void in6_delmulti __P((struct in6_multi *)); +extern int in6_ifindex2scopeid __P((int)); +extern int in6_mask2len __P((struct in6_addr *, u_char *)); +extern void in6_len2mask __P((struct in6_addr *, int)); +int in6_control __P((struct socket *, + u_long, caddr_t, struct ifnet *, struct thread *)); +int in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *, + struct in6_ifaddr *)); +void in6_purgeaddr __P((struct ifaddr *)); +int in6if_do_dad __P((struct ifnet *)); +void in6_purgeif __P((struct ifnet *)); +void in6_savemkludge __P((struct in6_ifaddr *)); +void in6_setmaxmtu __P((void)); +void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *)); +void in6_purgemkludge __P((struct ifnet *)); +struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int)); +struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *, + struct in6_addr *)); +char *ip6_sprintf __P((const struct in6_addr *)); +int in6_addr2scopeid __P((struct ifnet *, struct in6_addr *)); +int in6_matchlen __P((struct in6_addr *, struct in6_addr *)); +int in6_are_prefix_equal __P((struct in6_addr *p1, struct in6_addr *p2, + int len)); +void in6_prefixlen2mask __P((struct in6_addr *maskp, int len)); +int in6_prefix_ioctl __P((struct socket *so, u_long cmd, caddr_t data, + struct ifnet *ifp)); +int in6_prefix_add_ifid __P((int iilen, struct in6_ifaddr *ia)); +void in6_prefix_remove_ifid __P((int iilen, struct in6_ifaddr *ia)); +void in6_purgeprefix __P((struct ifnet *)); + +int in6_is_addr_deprecated __P((struct sockaddr_in6 *)); +struct inpcb; +int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *, + struct inpcb *, struct ifnet **)); +int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *, + struct ifnet *)); +void in6_clearscope __P((struct in6_addr *)); +#endif /* _KERNEL */ + +#endif /* _NETINET6_IN6_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/ip6.h b/newlib/libc/sys/linux/include/netinet6/ip6.h new file mode 100644 index 000000000..528ff7ce3 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ip6.h @@ -0,0 +1,4 @@ +/* $FreeBSD: src/sys/netinet6/ip6.h,v 1.5 2000/07/04 16:35:09 itojun Exp $ */ +/* $KAME: ip6.h,v 1.7 2000/03/25 07:23:36 sumikawa Exp $ */ + +#error "netinet6/ip6.h is obsolete. use netinet/ip6.h" diff --git a/newlib/libc/sys/linux/include/netinet6/ip6_ecn.h b/newlib/libc/sys/linux/include/netinet6/ip6_ecn.h new file mode 100644 index 000000000..f7b762d5f --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ip6_ecn.h @@ -0,0 +1,41 @@ +/* $FreeBSD: src/sys/netinet6/ip6_ecn.h,v 1.4 2001/06/11 12:39:05 ume Exp $ */ +/* $KAME: ip_ecn.h,v 1.5 2000/03/27 04:58:38 sumikawa Exp $ */ + +/* + * Copyright (C) 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +/* + * ECN consideration on tunnel ingress/egress operation. + * http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt + */ + +#ifdef _KERNEL +extern void ip6_ecn_ingress __P((int, u_int32_t *, const u_int32_t *)); +extern void ip6_ecn_egress __P((int, const u_int32_t *, u_int32_t *)); +#endif diff --git a/newlib/libc/sys/linux/include/netinet6/ip6_fw.h b/newlib/libc/sys/linux/include/netinet6/ip6_fw.h new file mode 100644 index 000000000..ee3aa818f --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ip6_fw.h @@ -0,0 +1,231 @@ +/* $FreeBSD: src/sys/netinet6/ip6_fw.h,v 1.12 2002/04/19 04:46:22 suz Exp $ */ +/* $KAME: ip6_fw.h,v 1.9 2001/08/01 04:29:57 sumikawa Exp $ */ + +/* + * Copyright (C) 1998, 1999, 2000 and 2001 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1993 Daniel Boulet + * Copyright (c) 1994 Ugen J.S.Antsilevich + * + * Redistribution and use in source forms, with and without modification, + * are permitted provided that this entire comment appears intact. + * + * Redistribution in binary form may occur without any restrictions. + * Obviously, it would be nice if you gave credit where credit is due + * but requiring it would be too onerous. + * + * This software is provided ``AS IS'' without any warranties of any kind. + * + */ + +#ifndef _IP6_FW_H +#define _IP6_FW_H + +#include + +/* + * This union structure identifies an interface, either explicitly + * by name or implicitly by IP address. The flags IP_FW_F_IIFNAME + * and IP_FW_F_OIFNAME say how to interpret this structure. An + * interface unit number of -1 matches any unit number, while an + * IP address of 0.0.0.0 indicates matches any interface. + * + * The receive and transmit interfaces are only compared against the + * the packet if the corresponding bit (IP_FW_F_IIFACE or IP_FW_F_OIFACE) + * is set. Note some packets lack a receive or transmit interface + * (in which case the missing "interface" never matches). + */ + +union ip6_fw_if { + struct in6_addr fu_via_ip6; /* Specified by IPv6 address */ + struct { /* Specified by interface name */ +#define IP6FW_IFNLEN IFNAMSIZ + char name[IP6FW_IFNLEN]; + short unit; /* -1 means match any unit */ + } fu_via_if; +}; + +/* + * Format of an IP firewall descriptor + * + * fw_src, fw_dst, fw_smsk, fw_dmsk are always stored in network byte order. + * fw_flg and fw_n*p are stored in host byte order (of course). + * Port numbers are stored in HOST byte order. + * Warning: setsockopt() will fail if sizeof(struct ip_fw) > MLEN (108) + */ + +struct ip6_fw { + u_long fw_pcnt,fw_bcnt; /* Packet and byte counters */ + struct in6_addr fw_src, fw_dst; /* Source and destination IPv6 addr */ + struct in6_addr fw_smsk, fw_dmsk; /* Mask for src and dest IPv6 addr */ + u_short fw_number; /* Rule number */ + u_short fw_flg; /* Flags word */ +#define IPV6_FW_MAX_PORTS 10 /* A reasonable maximum */ + u_int fw_ipflg; /* IP flags word */ + u_short fw_pts[IPV6_FW_MAX_PORTS]; /* Array of port numbers to match */ + u_char fw_ip6opt,fw_ip6nopt; /* IPv6 options set/unset */ + u_char fw_tcpf,fw_tcpnf; /* TCP flags set/unset */ +#define IPV6_FW_ICMPTYPES_DIM (256 / (sizeof(unsigned) * 8)) + unsigned fw_icmp6types[IPV6_FW_ICMPTYPES_DIM]; /* ICMP types bitmap */ + long timestamp; /* timestamp (tv_sec) of last match */ + union ip6_fw_if fw_in_if, fw_out_if;/* Incoming and outgoing interfaces */ + union { + u_short fu_divert_port; /* Divert/tee port (options IP6DIVERT) */ + u_short fu_skipto_rule; /* SKIPTO command rule number */ + u_short fu_reject_code; /* REJECT response code */ + } fw_un; + u_char fw_prot; /* IPv6 protocol */ + u_char fw_nports; /* N'of src ports and # of dst ports */ + /* in ports array (dst ports follow */ + /* src ports; max of 10 ports in all; */ + /* count of 0 means match all ports) */ +}; + +#define IPV6_FW_GETNSRCP(rule) ((rule)->fw_nports & 0x0f) +#define IPV6_FW_SETNSRCP(rule, n) do { \ + (rule)->fw_nports &= ~0x0f; \ + (rule)->fw_nports |= (n); \ + } while (0) +#define IPV6_FW_GETNDSTP(rule) ((rule)->fw_nports >> 4) +#define IPV6_FW_SETNDSTP(rule, n) do { \ + (rule)->fw_nports &= ~0xf0; \ + (rule)->fw_nports |= (n) << 4;\ + } while (0) + +#define fw_divert_port fw_un.fu_divert_port +#define fw_skipto_rule fw_un.fu_skipto_rule +#define fw_reject_code fw_un.fu_reject_code + +struct ip6_fw_chain { + LIST_ENTRY(ip6_fw_chain) chain; + struct ip6_fw *rule; +}; + +/* + * Values for "flags" field . + */ +#define IPV6_FW_F_IN 0x0001 /* Check inbound packets */ +#define IPV6_FW_F_OUT 0x0002 /* Check outbound packets */ +#define IPV6_FW_F_IIFACE 0x0004 /* Apply inbound interface test */ +#define IPV6_FW_F_OIFACE 0x0008 /* Apply outbound interface test */ + +#define IPV6_FW_F_COMMAND 0x0070 /* Mask for type of chain entry: */ +#define IPV6_FW_F_DENY 0x0000 /* This is a deny rule */ +#define IPV6_FW_F_REJECT 0x0010 /* Deny and send a response packet */ +#define IPV6_FW_F_ACCEPT 0x0020 /* This is an accept rule */ +#define IPV6_FW_F_COUNT 0x0030 /* This is a count rule */ +#define IPV6_FW_F_DIVERT 0x0040 /* This is a divert rule */ +#define IPV6_FW_F_TEE 0x0050 /* This is a tee rule */ +#define IPV6_FW_F_SKIPTO 0x0060 /* This is a skipto rule */ + +#define IPV6_FW_F_PRN 0x0080 /* Print if this rule matches */ + +#define IPV6_FW_F_SRNG 0x0100 /* The first two src ports are a min * + * and max range (stored in host byte * + * order). */ + +#define IPV6_FW_F_DRNG 0x0200 /* The first two dst ports are a min * + * and max range (stored in host byte * + * order). */ + +#define IPV6_FW_F_IIFNAME 0x0400 /* In interface by name/unit (not IP) */ +#define IPV6_FW_F_OIFNAME 0x0800 /* Out interface by name/unit (not IP) */ + +#define IPV6_FW_F_INVSRC 0x1000 /* Invert sense of src check */ +#define IPV6_FW_F_INVDST 0x2000 /* Invert sense of dst check */ + +#define IPV6_FW_F_FRAG 0x4000 /* Fragment */ + +#define IPV6_FW_F_ICMPBIT 0x8000 /* ICMP type bitmap is valid */ + +#define IPV6_FW_F_MASK 0xFFFF /* All possible flag bits mask */ + +/* + * Flags for the 'fw_ipflg' field, for comparing values of ip and its protocols. */ +#define IPV6_FW_IF_TCPEST 0x00000020 /* established TCP connection */ +#define IPV6_FW_IF_TCPMSK 0x00000020 /* mask of all TCP values */ + +/* + * For backwards compatibility with rules specifying "via iface" but + * not restricted to only "in" or "out" packets, we define this combination + * of bits to represent this configuration. + */ + +#define IF6_FW_F_VIAHACK (IPV6_FW_F_IN|IPV6_FW_F_OUT|IPV6_FW_F_IIFACE|IPV6_FW_F_OIFACE) + +/* + * Definitions for REJECT response codes. + * Values less than 256 correspond to ICMP unreachable codes. + */ +#define IPV6_FW_REJECT_RST 0x0100 /* TCP packets: send RST */ + +/* + * Definitions for IPv6 option names. + */ +#define IPV6_FW_IP6OPT_HOPOPT 0x01 +#define IPV6_FW_IP6OPT_ROUTE 0x02 +#define IPV6_FW_IP6OPT_FRAG 0x04 +#define IPV6_FW_IP6OPT_ESP 0x08 +#define IPV6_FW_IP6OPT_AH 0x10 +#define IPV6_FW_IP6OPT_NONXT 0x20 +#define IPV6_FW_IP6OPT_OPTS 0x40 + +/* + * Definitions for TCP flags. + */ +#define IPV6_FW_TCPF_FIN TH_FIN +#define IPV6_FW_TCPF_SYN TH_SYN +#define IPV6_FW_TCPF_RST TH_RST +#define IPV6_FW_TCPF_PSH TH_PUSH +#define IPV6_FW_TCPF_ACK TH_ACK +#define IPV6_FW_TCPF_URG TH_URG + +/* + * Main firewall chains definitions and global var's definitions. + */ +#ifdef _KERNEL + +/* + * Function definitions. + */ +void ip6_fw_init(void); + +/* Firewall hooks */ +struct ip6_hdr; +typedef int ip6_fw_chk_t __P((struct ip6_hdr**, struct ifnet*, + u_short *, struct mbuf**)); +typedef int ip6_fw_ctl_t __P((int, struct mbuf**)); +extern ip6_fw_chk_t *ip6_fw_chk_ptr; +extern ip6_fw_ctl_t *ip6_fw_ctl_ptr; +extern int ip6_fw_enable; + +#endif /* _KERNEL */ + +#endif /* _IP6_FW_H */ diff --git a/newlib/libc/sys/linux/include/netinet6/ip6_mroute.h b/newlib/libc/sys/linux/include/netinet6/ip6_mroute.h new file mode 100644 index 000000000..0cd915c68 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ip6_mroute.h @@ -0,0 +1,277 @@ +/* $FreeBSD: src/sys/netinet6/ip6_mroute.h,v 1.5 2002/04/19 04:46:23 suz Exp $ */ +/* $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp */ + +/* + * Definitions for IP multicast forwarding. + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Ajit Thyagarajan, PARC, August 1993. + * Modified by Ajit Thyagarajan, PARC, August 1994. + * Modified by Ahmed Helmy, USC, September 1996. + * + * MROUTING Revision: 1.2 + */ + +#ifndef _NETINET6_IP6_MROUTE_H_ +#define _NETINET6_IP6_MROUTE_H_ + +/* + * Multicast Routing set/getsockopt commands. + */ +#ifdef _KERNEL +#define MRT6_OINIT 100 /* initialize forwarder (omrt6msg) */ +#endif +#define MRT6_DONE 101 /* shut down forwarder */ +#define MRT6_ADD_MIF 102 /* add multicast interface */ +#define MRT6_DEL_MIF 103 /* delete multicast interface */ +#define MRT6_ADD_MFC 104 /* insert forwarding cache entry */ +#define MRT6_DEL_MFC 105 /* delete forwarding cache entry */ +#define MRT6_PIM 107 /* enable pim code */ +#define MRT6_INIT 108 /* initialize forwarder (mrt6msg) */ + +#if BSD >= 199103 +#define GET_TIME(t) microtime(&t) +#elif defined(sun) +#define GET_TIME(t) uniqtime(&t) +#else +#define GET_TIME(t) ((t) = time) +#endif + +/* + * Types and macros for handling bitmaps with one bit per multicast interface. + */ +typedef u_short mifi_t; /* type of a mif index */ +#define MAXMIFS 64 + +#ifndef IF_SETSIZE +#define IF_SETSIZE 256 +#endif + +typedef u_int32_t if_mask; +#define NIFBITS (sizeof(if_mask) * NBBY) /* bits per mask */ + +#ifndef howmany +#define howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif + +typedef struct if_set { + if_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)]; +} if_set; + +#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) +#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS))) +#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS))) +#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f))) +#define IF_ZERO(p) bzero(p, sizeof(*(p))) + +/* + * Argument structure for MRT6_ADD_IF. + */ +struct mif6ctl { + mifi_t mif6c_mifi; /* the index of the mif to be added */ + u_char mif6c_flags; /* MIFF_ flags defined below */ + u_short mif6c_pifi; /* the index of the physical IF */ +#ifdef notyet + u_int mif6c_rate_limit; /* max rate */ +#endif +}; + +#define MIFF_REGISTER 0x1 /* mif represents a register end-point */ + +/* + * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC + */ +struct mf6cctl { + struct sockaddr_in6 mf6cc_origin; /* IPv6 origin of mcasts */ + struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */ + mifi_t mf6cc_parent; /* incoming ifindex */ + struct if_set mf6cc_ifset; /* set of forwarding ifs */ +}; + +/* + * The kernel's multicast routing statistics. + */ +struct mrt6stat { + u_quad_t mrt6s_mfc_lookups; /* # forw. cache hash table hits */ + u_quad_t mrt6s_mfc_misses; /* # forw. cache hash table misses */ + u_quad_t mrt6s_upcalls; /* # calls to mrouted */ + u_quad_t mrt6s_no_route; /* no route for packet's origin */ + u_quad_t mrt6s_bad_tunnel; /* malformed tunnel options */ + u_quad_t mrt6s_cant_tunnel; /* no room for tunnel options */ + u_quad_t mrt6s_wrong_if; /* arrived on wrong interface */ + u_quad_t mrt6s_upq_ovflw; /* upcall Q overflow */ + u_quad_t mrt6s_cache_cleanups; /* # entries with no upcalls */ + u_quad_t mrt6s_drop_sel; /* pkts dropped selectively */ + u_quad_t mrt6s_q_overflow; /* pkts dropped - Q overflow */ + u_quad_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */ + u_quad_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */ +}; + +#ifdef MRT6_OINIT +/* + * Struct used to communicate from kernel to multicast router + * note the convenient similarity to an IPv6 header. + * XXX old version, superseded by mrt6msg. + */ +struct omrt6msg { + u_long unused1; + u_char im6_msgtype; /* what type of message */ +#if 0 +#define MRT6MSG_NOCACHE 1 +#define MRT6MSG_WRONGMIF 2 +#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/ +#endif + u_char im6_mbz; /* must be zero */ + u_char im6_mif; /* mif rec'd on */ + u_char unused2; + struct in6_addr im6_src, im6_dst; +}; +#endif + +/* + * Structure used to communicate from kernel to multicast router. + * We'll overlay the structure onto an MLD header (not an IPv6 header + * like igmpmsg{} used for IPv4 implementation). This is because this + * structure will be passed via an IPv6 raw socket, on which an application + * will only receive the payload i.e. the data after the IPv6 header and all + * the extension headers. (see Section 3 of draft-ietf-ipngwg-2292bis-01) + */ +struct mrt6msg { +#define MRT6MSG_NOCACHE 1 +#define MRT6MSG_WRONGMIF 2 +#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/ + u_char im6_mbz; /* must be zero */ + u_char im6_msgtype; /* what type of message */ + u_int16_t im6_mif; /* mif rec'd on */ + u_int32_t im6_pad; /* padding for 64bit arch */ + struct in6_addr im6_src, im6_dst; +}; + +/* + * Argument structure used by multicast routing daemon to get src-grp + * packet counts + */ +struct sioc_sg_req6 { + struct sockaddr_in6 src; + struct sockaddr_in6 grp; + u_quad_t pktcnt; + u_quad_t bytecnt; + u_quad_t wrong_if; +}; + +/* + * Argument structure used by mrouted to get mif pkt counts + */ +struct sioc_mif_req6 { + mifi_t mifi; /* mif number */ + u_quad_t icount; /* Input packet count on mif */ + u_quad_t ocount; /* Output packet count on mif */ + u_quad_t ibytes; /* Input byte count on mif */ + u_quad_t obytes; /* Output byte count on mif */ +}; + +#if defined(_KERNEL) || defined(KERNEL) +/* + * The kernel's multicast-interface structure. + */ +struct mif6 { + u_char m6_flags; /* MIFF_ flags defined above */ + u_int m6_rate_limit; /* max rate */ +#ifdef notyet + struct tbf *m6_tbf; /* token bucket structure at intf. */ +#endif + struct in6_addr m6_lcl_addr; /* local interface address */ + struct ifnet *m6_ifp; /* pointer to interface */ + u_quad_t m6_pkt_in; /* # pkts in on interface */ + u_quad_t m6_pkt_out; /* # pkts out on interface */ + u_quad_t m6_bytes_in; /* # bytes in on interface */ + u_quad_t m6_bytes_out; /* # bytes out on interface */ + struct route_in6 m6_route;/* cached route if this is a tunnel */ +#ifdef notyet + u_int m6_rsvp_on; /* RSVP listening on this vif */ + struct socket *m6_rsvpd; /* RSVP daemon socket */ +#endif +}; + +/* + * The kernel's multicast forwarding cache entry structure + */ +struct mf6c { + struct sockaddr_in6 mf6c_origin; /* IPv6 origin of mcasts */ + struct sockaddr_in6 mf6c_mcastgrp; /* multicast group associated*/ + mifi_t mf6c_parent; /* incoming IF */ + struct if_set mf6c_ifset; /* set of outgoing IFs */ + + u_quad_t mf6c_pkt_cnt; /* pkt count for src-grp */ + u_quad_t mf6c_byte_cnt; /* byte count for src-grp */ + u_quad_t mf6c_wrong_if; /* wrong if for src-grp */ + int mf6c_expire; /* time to clean entry up */ + struct timeval mf6c_last_assert; /* last time I sent an assert*/ + struct rtdetq *mf6c_stall; /* pkts waiting for route */ + struct mf6c *mf6c_next; /* hash table linkage */ +}; + +#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1) + +/* + * Argument structure used for pkt info. while upcall is made + */ +#ifndef _NETINET_IP_MROUTE_H_ +struct rtdetq { /* XXX: rtdetq is also defined in ip_mroute.h */ + struct mbuf *m; /* A copy of the packet */ + struct ifnet *ifp; /* Interface pkt came in on */ +#ifdef UPCALL_TIMING + struct timeval t; /* Timestamp */ +#endif /* UPCALL_TIMING */ + struct rtdetq *next; +}; +#endif /* _NETINET_IP_MROUTE_H_ */ + +#define MF6CTBLSIZ 256 +#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0 /* from sys:route.h */ +#define MF6CHASHMOD(h) ((h) & (MF6CTBLSIZ - 1)) +#else +#define MF6CHASHMOD(h) ((h) % MF6CTBLSIZ) +#endif + +#define MAX_UPQ6 4 /* max. no of pkts in upcall Q */ + +int ip6_mrouter_set __P((struct socket *so, struct sockopt *sopt)); +int ip6_mrouter_get __P((struct socket *so, struct sockopt *sopt)); +int ip6_mrouter_done __P((void)); +int mrt6_ioctl __P((int, caddr_t)); +#endif /* _KERNEL */ + +#endif /* !_NETINET6_IP6_MROUTE_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/ip6_var.h b/newlib/libc/sys/linux/include/netinet6/ip6_var.h new file mode 100644 index 000000000..d93ade77d --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ip6_var.h @@ -0,0 +1,354 @@ +/* $FreeBSD: src/sys/netinet6/ip6_var.h,v 1.8 2001/09/12 08:37:55 julian Exp $ */ +/* $KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET6_IP6_VAR_H_ +#define _NETINET6_IP6_VAR_H_ + +/* + * IP6 reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + */ +struct ip6q { + u_int32_t ip6q_head; + u_int16_t ip6q_len; + u_int8_t ip6q_nxt; /* ip6f_nxt in first fragment */ + u_int8_t ip6q_hlim; + struct ip6asfrag *ip6q_down; + struct ip6asfrag *ip6q_up; + u_int32_t ip6q_ident; + u_int8_t ip6q_arrive; + u_int8_t ip6q_ttl; + struct in6_addr ip6q_src, ip6q_dst; + struct ip6q *ip6q_next; + struct ip6q *ip6q_prev; + int ip6q_unfrglen; /* len of unfragmentable part */ +#ifdef notyet + u_char *ip6q_nxtp; +#endif +}; + +struct ip6asfrag { + u_int32_t ip6af_head; + u_int16_t ip6af_len; + u_int8_t ip6af_nxt; + u_int8_t ip6af_hlim; + /* must not override the above members during reassembling */ + struct ip6asfrag *ip6af_down; + struct ip6asfrag *ip6af_up; + struct mbuf *ip6af_m; + int ip6af_offset; /* offset in ip6af_m to next header */ + int ip6af_frglen; /* fragmentable part length */ + int ip6af_off; /* fragment offset */ + u_int16_t ip6af_mff; /* more fragment bit in frag off */ +}; + +#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) + +struct ip6_moptions { + struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */ + u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */ + u_char im6o_multicast_loop; /* 1 >= hear sends if a member */ + LIST_HEAD(, in6_multi_mship) im6o_memberships; +}; + +/* + * Control options for outgoing packets + */ + +/* Routing header related info */ +struct ip6po_rhinfo { + struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */ + struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */ +}; +#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr +#define ip6po_route ip6po_rhinfo.ip6po_rhi_route + +struct ip6_pktopts { + struct mbuf *ip6po_m; /* Pointer to mbuf storing the data */ + int ip6po_hlim; /* Hoplimit for outgoing packets */ + + /* Outgoing IF/address information */ + struct in6_pktinfo *ip6po_pktinfo; + + struct sockaddr *ip6po_nexthop; /* Next-hop address */ + + struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */ + + /* Destination options header (before a routing header) */ + struct ip6_dest *ip6po_dest1; + + /* Routing header related info. */ + struct ip6po_rhinfo ip6po_rhinfo; + + /* Destination options header (after a routing header) */ + struct ip6_dest *ip6po_dest2; +}; + +/* + * Control options for incoming packets + */ + +struct ip6stat { + u_quad_t ip6s_total; /* total packets received */ + u_quad_t ip6s_tooshort; /* packet too short */ + u_quad_t ip6s_toosmall; /* not enough data */ + u_quad_t ip6s_fragments; /* fragments received */ + u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */ + u_quad_t ip6s_fragtimeout; /* fragments timed out */ + u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */ + u_quad_t ip6s_forward; /* packets forwarded */ + u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */ + u_quad_t ip6s_redirectsent; /* packets forwarded on same net */ + u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/ + u_quad_t ip6s_localout; /* total ip packets generated here */ + u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */ + u_quad_t ip6s_reassembled; /* total packets reassembled ok */ + u_quad_t ip6s_fragmented; /* datagrams sucessfully fragmented */ + u_quad_t ip6s_ofragments; /* output fragments created */ + u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */ + u_quad_t ip6s_badoptions; /* error in option processing */ + u_quad_t ip6s_noroute; /* packets discarded due to no route */ + u_quad_t ip6s_badvers; /* ip6 version != 6 */ + u_quad_t ip6s_rawout; /* total raw ip packets generated */ + u_quad_t ip6s_badscope; /* scope error */ + u_quad_t ip6s_notmember; /* don't join this multicast group */ + u_quad_t ip6s_nxthist[256]; /* next header history */ + u_quad_t ip6s_m1; /* one mbuf */ + u_quad_t ip6s_m2m[32]; /* two or more mbuf */ + u_quad_t ip6s_mext1; /* one ext mbuf */ + u_quad_t ip6s_mext2m; /* two or more ext mbuf */ + u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */ + u_quad_t ip6s_nogif; /* no match gif found */ + u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */ + + /* + * statistics for improvement of the source address selection + * algorithm: + * XXX: hardcoded 16 = # of ip6 multicast scope types + 1 + */ + /* number of times that address selection fails */ + u_quad_t ip6s_sources_none; + /* number of times that an address on the outgoing I/F is chosen */ + u_quad_t ip6s_sources_sameif[16]; + /* number of times that an address on a non-outgoing I/F is chosen */ + u_quad_t ip6s_sources_otherif[16]; + /* + * number of times that an address that has the same scope + * from the destination is chosen. + */ + u_quad_t ip6s_sources_samescope[16]; + /* + * number of times that an address that has a different scope + * from the destination is chosen. + */ + u_quad_t ip6s_sources_otherscope[16]; + /* number of times that an deprecated address is chosen */ + u_quad_t ip6s_sources_deprecated[16]; + + u_quad_t ip6s_forward_cachehit; + u_quad_t ip6s_forward_cachemiss; +}; + +#ifdef _KERNEL +/* + * IPv6 onion peeling state. + * it will be initialized when we come into ip6_input(). + * XXX do not make it a kitchen sink! + */ +struct ip6aux { + u_int32_t ip6a_flags; +#define IP6A_SWAP 0x01 /* swapped home/care-of on packet */ +#define IP6A_HASEEN 0x02 /* HA was present */ +#define IP6A_BRUID 0x04 /* BR Unique Identifier was present */ +#define IP6A_RTALERTSEEN 0x08 /* rtalert present */ + + /* ip6.ip6_src */ + struct in6_addr ip6a_careof; /* care-of address of the peer */ + struct in6_addr ip6a_home; /* home address of the peer */ + u_int16_t ip6a_bruid; /* BR unique identifier */ + + /* ip6.ip6_dst */ + struct in6_ifaddr *ip6a_dstia6; /* my ifaddr that matches ip6_dst */ + + /* rtalert */ + u_int16_t ip6a_rtalert; /* rtalert option value */ + + /* + * decapsulation history will be here. + * with IPsec it may not be accurate. + */ +}; +#endif + +#ifdef _KERNEL +/* flags passed to ip6_output as last parameter */ +#define IPV6_DADOUTPUT 0x01 /* DAD */ +#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ +#define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ + +extern struct ip6stat ip6stat; /* statistics */ +extern u_int32_t ip6_id; /* fragment identifier */ +extern int ip6_defhlim; /* default hop limit */ +extern int ip6_defmcasthlim; /* default multicast hop limit */ +extern int ip6_forwarding; /* act as router? */ +extern int ip6_forward_srcrt; /* forward src-routed? */ +extern int ip6_gif_hlim; /* Hop limit for gif encap packet */ +extern int ip6_use_deprecated; /* allow deprecated addr as source */ +extern int ip6_rr_prune; /* router renumbering prefix + * walk list every 5 sec. */ +#define ip6_mapped_addr_on (!ip6_v6only) +extern int ip6_v6only; + +extern struct socket *ip6_mrouter; /* multicast routing daemon */ +extern int ip6_sendredirects; /* send IP redirects when forwarding? */ +extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */ +extern int ip6_sourcecheck; /* Verify source interface */ +extern int ip6_sourcecheck_interval; /* Interval between log messages */ +extern int ip6_accept_rtadv; /* Acts as a host not a router */ +extern int ip6_keepfaith; /* Firewall Aided Internet Translator */ +extern int ip6_log_interval; +extern time_t ip6_log_time; +extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */ +extern int ip6_dad_count; /* DupAddrDetectionTransmits */ + +extern u_int32_t ip6_flow_seq; +extern int ip6_auto_flowlabel; +extern int ip6_auto_linklocal; + +extern int ip6_anonportmin; /* minimum ephemeral port */ +extern int ip6_anonportmax; /* maximum ephemeral port */ +extern int ip6_lowportmin; /* minimum reserved port */ +extern int ip6_lowportmax; /* maximum reserved port */ + +extern int ip6_use_tempaddr; /* whether to use temporary addresses. */ + +extern struct pr_usrreqs rip6_usrreqs; +struct sockopt; + +struct inpcb; + +int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt)); + +struct in6_ifaddr; +void ip6_init __P((void)); +void ip6intr __P((void)); +void ip6_input __P((struct mbuf *)); +struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *)); +void ip6_freepcbopts __P((struct ip6_pktopts *)); +void ip6_freemoptions __P((struct ip6_moptions *)); +int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int)); +char * ip6_get_prevhdr __P((struct mbuf *, int)); +int ip6_nexthdr __P((struct mbuf *, int, int, int *)); +int ip6_lasthdr __P((struct mbuf *, int, int, int *)); + +struct mbuf *ip6_addaux __P((struct mbuf *)); +struct mbuf *ip6_findaux __P((struct mbuf *)); +void ip6_delaux __P((struct mbuf *)); + +int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *)); +int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *, + u_int32_t *)); +void ip6_savecontrol __P((struct inpcb *, struct mbuf **, struct ip6_hdr *, + struct mbuf *)); +void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *, + u_int32_t *)); +int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); + +void ip6_forward __P((struct mbuf *, int)); + +void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *)); +int ip6_output __P((struct mbuf *, struct ip6_pktopts *, + struct route_in6 *, + int, + struct ip6_moptions *, struct ifnet **)); +int ip6_ctloutput __P((struct socket *, struct sockopt *sopt)); +void init_ip6pktopts __P((struct ip6_pktopts *)); +int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *, int, int)); +void ip6_clearpktopts __P((struct ip6_pktopts *, int, int)); +struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int)); +int ip6_optlen __P((struct inpcb *)); + +int route6_input __P((struct mbuf **, int *, int)); + +void frag6_init __P((void)); +int frag6_input __P((struct mbuf **, int *, int)); +void frag6_slowtimo __P((void)); +void frag6_drain __P((void)); + +void rip6_init __P((void)); +int rip6_input __P((struct mbuf **mp, int *offp, int proto)); +void rip6_ctlinput __P((int, struct sockaddr *, void *)); +int rip6_ctloutput __P((struct socket *so, struct sockopt *sopt)); +int rip6_output __P((struct mbuf *, ...)); +int rip6_usrreq __P((struct socket *, + int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *)); + +int dest6_input __P((struct mbuf **, int *, int)); +int none_input __P((struct mbuf **, int *, int)); +#endif /* _KERNEL */ + +#endif /* !_NETINET6_IP6_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/ip6protosw.h b/newlib/libc/sys/linux/include/netinet6/ip6protosw.h new file mode 100644 index 000000000..98d3a1dd9 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ip6protosw.h @@ -0,0 +1,163 @@ +/* $FreeBSD: src/sys/netinet6/ip6protosw.h,v 1.9 2002/04/19 04:46:23 suz Exp $ */ +/* $KAME: ip6protosw.h,v 1.25 2001/09/26 06:13:03 keiichi Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */ + +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)protosw.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _NETINET6_IP6PROTOSW_H_ +#define _NETINET6_IP6PROTOSW_H_ + +/* + * For pfil_head structure. + */ +#include + +/* + * Protocol switch table for IPv6. + * All other definitions should refer to sys/protosw.h + */ + +struct mbuf; +struct sockaddr; +struct socket; +struct domain; +struct thread; +struct ip6_hdr; +struct icmp6_hdr; +struct in6_addr; +struct pr_usrreqs; + +/* + * argument type for the last arg of pr_ctlinput(). + * should be consulted only with AF_INET6 family. + * + * IPv6 ICMP IPv6 [exthdrs] finalhdr paylaod + * ^ ^ ^ ^ + * | | ip6c_ip6 ip6c_off + * | ip6c_icmp6 + * ip6c_m + * + * ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original + * (internal) packet carries a routing header, it may point the final + * dstination address in the routing header. + * + * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6 + * (beware of flowlabel, if you try to compare it against others) + * ip6c_dst: ip6c_finaldst + scope info + */ +struct ip6ctlparam { + struct mbuf *ip6c_m; /* start of mbuf chain */ + struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */ + struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */ + int ip6c_off; /* offset of the target proto header */ + struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */ + struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */ + struct in6_addr *ip6c_finaldst; /* final destination address */ + void *ip6c_cmdarg; /* control command dependent data */ + u_int8_t ip6c_nxt; /* final next header field */ +}; + +struct ip6protosw { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ + +/* protocol-protocol hooks */ + int (*pr_input) /* input to protocol (from below) */ + __P((struct mbuf **, int *, int)); + int (*pr_output) /* output to protocol (from above) */ + __P((struct mbuf *, ...)); + void (*pr_ctlinput) /* control input (from below) */ + __P((int, struct sockaddr *, void *)); + int (*pr_ctloutput) /* control output (from above) */ + __P((struct socket *, struct sockopt *)); + +/* user-protocol hook */ + int (*pr_usrreq) /* user request: see list below */ + __P((struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *, struct thread *)); + +/* utility hooks */ + void (*pr_init) /* initialization hook */ + __P((void)); + + void (*pr_fasttimo) /* fast timeout (200ms) */ + __P((void)); + void (*pr_slowtimo) /* slow timeout (500ms) */ + __P((void)); + void (*pr_drain) /* flush any excess space possible */ + __P((void)); + struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ + struct pfil_head pr_pfh; +}; + +#ifdef _KERNEL +extern struct ip6protosw inet6sw[]; +#endif + +#endif /* !_NETINET6_IP6PROTOSW_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/ipcomp.h b/newlib/libc/sys/linux/include/netinet6/ipcomp.h new file mode 100644 index 000000000..c9302e079 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ipcomp.h @@ -0,0 +1,71 @@ +/* $FreeBSD: src/sys/netinet6/ipcomp.h,v 1.4 2002/04/19 04:46:23 suz Exp $ */ +/* $KAME: ipcomp.h,v 1.11 2001/09/04 08:43:19 itojun Exp $ */ + +/* + * Copyright (C) 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * RFC2393 IP payload compression protocol (IPComp). + */ + +#ifndef _NETINET6_IPCOMP_H_ +#define _NETINET6_IPCOMP_H_ + +#if defined(_KERNEL) && !defined(_LKM) +#include "opt_inet.h" +#endif + +struct ipcomp { + u_int8_t comp_nxt; /* Next Header */ + u_int8_t comp_flags; /* reserved, must be zero */ + u_int16_t comp_cpi; /* Compression parameter index */ +}; + +/* well-known algorithm number (in CPI), from RFC2409 */ +#define IPCOMP_OUI 1 /* vendor specific */ +#define IPCOMP_DEFLATE 2 /* RFC2394 */ +#define IPCOMP_LZS 3 /* RFC2395 */ +#define IPCOMP_MAX 4 + +#define IPCOMP_CPI_NEGOTIATE_MIN 256 + +#ifdef _KERNEL +struct ipcomp_algorithm { + int (*compress) __P((struct mbuf *, struct mbuf *, size_t *)); + int (*decompress) __P((struct mbuf *, struct mbuf *, size_t *)); + size_t minplen; /* minimum required length for compression */ +}; + +struct ipsecrequest; +extern const struct ipcomp_algorithm *ipcomp_algorithm_lookup __P((int)); +extern void ipcomp4_input __P((struct mbuf *, int)); +extern int ipcomp4_output __P((struct mbuf *, struct ipsecrequest *)); +#endif /* KERNEL */ + +#endif /* _NETINET6_IPCOMP_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/ipcomp6.h b/newlib/libc/sys/linux/include/netinet6/ipcomp6.h new file mode 100644 index 000000000..e5ec1537d --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ipcomp6.h @@ -0,0 +1,46 @@ +/* $FreeBSD: src/sys/netinet6/ipcomp6.h,v 1.2 2001/06/11 12:39:06 ume Exp $ */ +/* $KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $ */ + +/* + * Copyright (C) 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * RFC2393 IP payload compression protocol (IPComp). + */ + +#ifndef _NETINET6_IPCOMP6_H_ +#define _NETINET6_IPCOMP6_H_ + +#ifdef _KERNEL +extern int ipcomp6_input __P((struct mbuf **, int *, int)); +extern int ipcomp6_output __P((struct mbuf *, u_char *, struct mbuf *, + struct ipsecrequest *)); +#endif /*KERNEL*/ + +#endif /*_NETINET6_IPCOMP6_H_*/ diff --git a/newlib/libc/sys/linux/include/netinet6/ipsec.h b/newlib/libc/sys/linux/include/netinet6/ipsec.h new file mode 100644 index 000000000..5c6cbcfc6 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ipsec.h @@ -0,0 +1,354 @@ +/* $FreeBSD: src/sys/netinet6/ipsec.h,v 1.9 2002/04/19 04:46:23 suz Exp $ */ +/* $KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * IPsec controller part. + */ + +#ifndef _NETINET6_IPSEC_H_ +#define _NETINET6_IPSEC_H_ + +#if defined(_KERNEL) && !defined(_LKM) && !defined(KLD_MODULE) +#include "opt_inet.h" +#include "opt_ipsec.h" +#endif + +#include +#include + +#ifdef _KERNEL + +/* + * Security Policy Index + * Ensure that both address families in the "src" and "dst" are same. + * When the value of the ul_proto is ICMPv6, the port field in "src" + * specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code. + */ +struct secpolicyindex { + u_int8_t dir; /* direction of packet flow, see blow */ + struct sockaddr_storage src; /* IP src address for SP */ + struct sockaddr_storage dst; /* IP dst address for SP */ + u_int8_t prefs; /* prefix length in bits for src */ + u_int8_t prefd; /* prefix length in bits for dst */ + u_int16_t ul_proto; /* upper layer Protocol */ +#ifdef notyet + uid_t uids; + uid_t uidd; + gid_t gids; + gid_t gidd; +#endif +}; + +/* Security Policy Data Base */ +struct secpolicy { + LIST_ENTRY(secpolicy) chain; + + int refcnt; /* reference count */ + struct secpolicyindex spidx; /* selector */ + u_int32_t id; /* It's unique number on the system. */ + u_int state; /* 0: dead, others: alive */ +#define IPSEC_SPSTATE_DEAD 0 +#define IPSEC_SPSTATE_ALIVE 1 + + u_int policy; /* DISCARD, NONE or IPSEC, see keyv2.h */ + struct ipsecrequest *req; + /* pointer to the ipsec request tree, */ + /* if policy == IPSEC else this value == NULL.*/ + + /* + * lifetime handler. + * the policy can be used without limitiation if both lifetime and + * validtime are zero. + * "lifetime" is passed by sadb_lifetime.sadb_lifetime_addtime. + * "validtime" is passed by sadb_lifetime.sadb_lifetime_usetime. + */ + long created; /* time created the policy */ + long lastused; /* updated every when kernel sends a packet */ + long lifetime; /* duration of the lifetime of this policy */ + long validtime; /* duration this policy is valid without use */ +}; + +/* Request for IPsec */ +struct ipsecrequest { + struct ipsecrequest *next; + /* pointer to next structure */ + /* If NULL, it means the end of chain. */ + struct secasindex saidx;/* hint for search proper SA */ + /* if __ss_len == 0 then no address specified.*/ + u_int level; /* IPsec level defined below. */ + + struct secasvar *sav; /* place holder of SA for use */ + struct secpolicy *sp; /* back pointer to SP */ +}; + +/* security policy in PCB */ +struct inpcbpolicy { + struct secpolicy *sp_in; + struct secpolicy *sp_out; + int priv; /* privileged socket ? */ +}; + +/* SP acquiring list table. */ +struct secspacq { + LIST_ENTRY(secspacq) chain; + + struct secpolicyindex spidx; + + long created; /* for lifetime */ + int count; /* for lifetime */ + /* XXX: here is mbuf place holder to be sent ? */ +}; +#endif /* _KERNEL */ + +/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */ +#define IPSEC_PORT_ANY 0 +#define IPSEC_ULPROTO_ANY 255 +#define IPSEC_PROTO_ANY 255 + +/* mode of security protocol */ +/* NOTE: DON'T use IPSEC_MODE_ANY at SPD. It's only use in SAD */ +#define IPSEC_MODE_ANY 0 /* i.e. wildcard. */ +#define IPSEC_MODE_TRANSPORT 1 +#define IPSEC_MODE_TUNNEL 2 + +/* + * Direction of security policy. + * NOTE: Since INVALID is used just as flag. + * The other are used for loop counter too. + */ +#define IPSEC_DIR_ANY 0 +#define IPSEC_DIR_INBOUND 1 +#define IPSEC_DIR_OUTBOUND 2 +#define IPSEC_DIR_MAX 3 +#define IPSEC_DIR_INVALID 4 + +/* Policy level */ +/* + * IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB, + * DISCARD, IPSEC and NONE are allowed for setkey() in SPD. + * DISCARD and NONE are allowed for system default. + */ +#define IPSEC_POLICY_DISCARD 0 /* discarding packet */ +#define IPSEC_POLICY_NONE 1 /* through IPsec engine */ +#define IPSEC_POLICY_IPSEC 2 /* do IPsec */ +#define IPSEC_POLICY_ENTRUST 3 /* consulting SPD if present. */ +#define IPSEC_POLICY_BYPASS 4 /* only for privileged socket. */ + +/* Security protocol level */ +#define IPSEC_LEVEL_DEFAULT 0 /* reference to system default */ +#define IPSEC_LEVEL_USE 1 /* use SA if present. */ +#define IPSEC_LEVEL_REQUIRE 2 /* require SA. */ +#define IPSEC_LEVEL_UNIQUE 3 /* unique SA. */ + +#define IPSEC_MANUAL_REQID_MAX 0x3fff + /* + * if security policy level == unique, this id + * indicate to a relative SA for use, else is + * zero. + * 1 - 0x3fff are reserved for manual keying. + * 0 are reserved for above reason. Others is + * for kernel use. + * Note that this id doesn't identify SA + * by only itself. + */ +#define IPSEC_REPLAYWSIZE 32 + +/* statistics for ipsec processing */ +struct ipsecstat { + u_quad_t in_success; /* succeeded inbound process */ + u_quad_t in_polvio; + /* security policy violation for inbound process */ + u_quad_t in_nosa; /* inbound SA is unavailable */ + u_quad_t in_inval; /* inbound processing failed due to EINVAL */ + u_quad_t in_nomem; /* inbound processing failed due to ENOBUFS */ + u_quad_t in_badspi; /* failed getting a SPI */ + u_quad_t in_ahreplay; /* AH replay check failed */ + u_quad_t in_espreplay; /* ESP replay check failed */ + u_quad_t in_ahauthsucc; /* AH authentication success */ + u_quad_t in_ahauthfail; /* AH authentication failure */ + u_quad_t in_espauthsucc; /* ESP authentication success */ + u_quad_t in_espauthfail; /* ESP authentication failure */ + u_quad_t in_esphist[256]; + u_quad_t in_ahhist[256]; + u_quad_t in_comphist[256]; + u_quad_t out_success; /* succeeded outbound process */ + u_quad_t out_polvio; + /* security policy violation for outbound process */ + u_quad_t out_nosa; /* outbound SA is unavailable */ + u_quad_t out_inval; /* outbound process failed due to EINVAL */ + u_quad_t out_nomem; /* inbound processing failed due to ENOBUFS */ + u_quad_t out_noroute; /* there is no route */ + u_quad_t out_esphist[256]; + u_quad_t out_ahhist[256]; + u_quad_t out_comphist[256]; +}; + +/* + * Definitions for IPsec & Key sysctl operations. + */ +/* + * Names for IPsec & Key sysctl objects + */ +#define IPSECCTL_STATS 1 /* stats */ +#define IPSECCTL_DEF_POLICY 2 +#define IPSECCTL_DEF_ESP_TRANSLEV 3 /* int; ESP transport mode */ +#define IPSECCTL_DEF_ESP_NETLEV 4 /* int; ESP tunnel mode */ +#define IPSECCTL_DEF_AH_TRANSLEV 5 /* int; AH transport mode */ +#define IPSECCTL_DEF_AH_NETLEV 6 /* int; AH tunnel mode */ +#if 0 /* obsolete, do not reuse */ +#define IPSECCTL_INBOUND_CALL_IKE 7 +#endif +#define IPSECCTL_AH_CLEARTOS 8 +#define IPSECCTL_AH_OFFSETMASK 9 +#define IPSECCTL_DFBIT 10 +#define IPSECCTL_ECN 11 +#define IPSECCTL_DEBUG 12 +#define IPSECCTL_ESP_RANDPAD 13 +#define IPSECCTL_MAXID 14 + +#define IPSECCTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ + { "def_policy", CTLTYPE_INT }, \ + { "esp_trans_deflev", CTLTYPE_INT }, \ + { "esp_net_deflev", CTLTYPE_INT }, \ + { "ah_trans_deflev", CTLTYPE_INT }, \ + { "ah_net_deflev", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "ah_cleartos", CTLTYPE_INT }, \ + { "ah_offsetmask", CTLTYPE_INT }, \ + { "dfbit", CTLTYPE_INT }, \ + { "ecn", CTLTYPE_INT }, \ + { "debug", CTLTYPE_INT }, \ + { "esp_randpad", CTLTYPE_INT }, \ +} + +#define IPSEC6CTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ + { "def_policy", CTLTYPE_INT }, \ + { "esp_trans_deflev", CTLTYPE_INT }, \ + { "esp_net_deflev", CTLTYPE_INT }, \ + { "ah_trans_deflev", CTLTYPE_INT }, \ + { "ah_net_deflev", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "ecn", CTLTYPE_INT }, \ + { "debug", CTLTYPE_INT }, \ + { "esp_randpad", CTLTYPE_INT }, \ +} + +#ifdef _KERNEL +struct ipsec_output_state { + struct mbuf *m; + struct route *ro; + struct sockaddr *dst; +}; + +struct ipsec_history { + int ih_proto; + u_int32_t ih_spi; +}; + +extern int ipsec_debug; + +extern struct ipsecstat ipsecstat; +extern struct secpolicy ip4_def_policy; +extern int ip4_esp_trans_deflev; +extern int ip4_esp_net_deflev; +extern int ip4_ah_trans_deflev; +extern int ip4_ah_net_deflev; +extern int ip4_ah_cleartos; +extern int ip4_ah_offsetmask; +extern int ip4_ipsec_dfbit; +extern int ip4_ipsec_ecn; +extern int ip4_esp_randpad; + +#define ipseclog(x) do { if (ipsec_debug) log x; } while (0) + +extern struct secpolicy *ipsec4_getpolicybysock + __P((struct mbuf *, u_int, struct socket *, int *)); +extern struct secpolicy *ipsec4_getpolicybyaddr + __P((struct mbuf *, u_int, int, int *)); + +struct inpcb; +extern int ipsec_init_policy __P((struct socket *so, struct inpcbpolicy **)); +extern int ipsec_copy_policy + __P((struct inpcbpolicy *, struct inpcbpolicy *)); +extern u_int ipsec_get_reqlevel __P((struct ipsecrequest *)); + +extern int ipsec4_set_policy __P((struct inpcb *inp, int optname, + caddr_t request, size_t len, int priv)); +extern int ipsec4_get_policy __P((struct inpcb *inpcb, caddr_t request, + size_t len, struct mbuf **mp)); +extern int ipsec4_delete_pcbpolicy __P((struct inpcb *)); +extern int ipsec4_in_reject_so __P((struct mbuf *, struct socket *)); +extern int ipsec4_in_reject __P((struct mbuf *, struct inpcb *)); + +struct secas; +struct tcpcb; +extern int ipsec_chkreplay __P((u_int32_t, struct secasvar *)); +extern int ipsec_updatereplay __P((u_int32_t, struct secasvar *)); + +extern size_t ipsec4_hdrsiz __P((struct mbuf *, u_int, struct inpcb *)); +extern size_t ipsec_hdrsiz_tcp __P((struct tcpcb *)); + +struct ip; +extern const char *ipsec4_logpacketstr __P((struct ip *, u_int32_t)); +extern const char *ipsec_logsastr __P((struct secasvar *)); + +extern void ipsec_dumpmbuf __P((struct mbuf *)); + +extern int ipsec4_output __P((struct ipsec_output_state *, struct secpolicy *, + int)); +extern int ipsec4_tunnel_validate __P((struct mbuf *, int, u_int, + struct secasvar *)); +extern struct mbuf *ipsec_copypkt __P((struct mbuf *)); +extern void ipsec_delaux __P((struct mbuf *)); +extern int ipsec_setsocket __P((struct mbuf *, struct socket *)); +extern struct socket *ipsec_getsocket __P((struct mbuf *)); +extern int ipsec_addhist __P((struct mbuf *, int, u_int32_t)); +extern struct ipsec_history *ipsec_gethist __P((struct mbuf *, int *)); +extern void ipsec_clearhist __P((struct mbuf *)); +#endif /* _KERNEL */ + +#ifndef _KERNEL +extern caddr_t ipsec_set_policy __P((char *, int)); +extern int ipsec_get_policylen __P((caddr_t)); +extern char *ipsec_dump_policy __P((caddr_t, char *)); + +extern const char *ipsec_strerror __P((void)); +#endif /* !_KERNEL */ + +#endif /* _NETINET6_IPSEC_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/ipsec6.h b/newlib/libc/sys/linux/include/netinet6/ipsec6.h new file mode 100644 index 000000000..04a18cf72 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/ipsec6.h @@ -0,0 +1,83 @@ +/* $FreeBSD: src/sys/netinet6/ipsec6.h,v 1.5 2001/06/11 12:39:06 ume Exp $ */ +/* $KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * IPsec controller part. + */ + +#ifndef _NETINET6_IPSEC6_H_ +#define _NETINET6_IPSEC6_H_ + +#include +#include + +#ifdef _KERNEL +extern struct ipsecstat ipsec6stat; +extern struct secpolicy ip6_def_policy; +extern int ip6_esp_trans_deflev; +extern int ip6_esp_net_deflev; +extern int ip6_ah_trans_deflev; +extern int ip6_ah_net_deflev; +extern int ip6_ipsec_ecn; +extern int ip6_esp_randpad; + +extern struct secpolicy *ipsec6_getpolicybysock + __P((struct mbuf *, u_int, struct socket *, int *)); +extern struct secpolicy *ipsec6_getpolicybyaddr + __P((struct mbuf *, u_int, int, int *)); + +struct inpcb; + +extern int ipsec6_in_reject_so __P((struct mbuf *, struct socket *)); +extern int ipsec6_delete_pcbpolicy __P((struct inpcb *)); +extern int ipsec6_set_policy __P((struct inpcb *inp, int optname, + caddr_t request, size_t len, int priv)); +extern int ipsec6_get_policy + __P((struct inpcb *inp, caddr_t request, size_t len, struct mbuf **mp)); +extern int ipsec6_in_reject __P((struct mbuf *, struct inpcb *)); + +struct tcp6cb; + +extern size_t ipsec6_hdrsiz __P((struct mbuf *, u_int, struct inpcb *)); + +struct ip6_hdr; +extern const char *ipsec6_logpacketstr __P((struct ip6_hdr *, u_int32_t)); + +extern int ipsec6_output_trans __P((struct ipsec_output_state *, u_char *, + struct mbuf *, struct secpolicy *, int, int *)); +extern int ipsec6_output_tunnel __P((struct ipsec_output_state *, + struct secpolicy *, int)); +extern int ipsec6_tunnel_validate __P((struct mbuf *, int, u_int, + struct secasvar *)); +#endif /*_KERNEL*/ + +#endif /*_NETINET6_IPSEC6_H_*/ diff --git a/newlib/libc/sys/linux/include/netinet6/mld6_var.h b/newlib/libc/sys/linux/include/netinet6/mld6_var.h new file mode 100644 index 000000000..85f0da24a --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/mld6_var.h @@ -0,0 +1,53 @@ +/* $FreeBSD: src/sys/netinet6/mld6_var.h,v 1.2 2000/07/04 16:35:10 itojun Exp $ */ +/* $KAME: mld6_var.h,v 1.4 2000/03/25 07:23:54 sumikawa Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET6_MLD6_VAR_H_ +#define _NETINET6_MLD6_VAR_H_ + +#ifdef _KERNEL + +#define MLD6_RANDOM_DELAY(X) (random() % (X) + 1) + +/* + * States for MLD stop-listening processing + */ +#define MLD6_OTHERLISTENER 0 +#define MLD6_IREPORTEDLAST 1 + +void mld6_init __P((void)); +void mld6_input __P((struct mbuf *, int)); +void mld6_start_listening __P((struct in6_multi *)); +void mld6_stop_listening __P((struct in6_multi *)); +void mld6_fasttimeo __P((void)); +#endif /* _KERNEL */ + +#endif /* _NETINET6_MLD6_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/nd6.h b/newlib/libc/sys/linux/include/netinet6/nd6.h new file mode 100644 index 000000000..c6e644df8 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/nd6.h @@ -0,0 +1,404 @@ +/* $FreeBSD: src/sys/netinet6/nd6.h,v 1.10 2002/04/19 04:46:23 suz Exp $ */ +/* $KAME: nd6.h,v 1.76 2001/12/18 02:10:31 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET6_ND6_H_ +#define _NETINET6_ND6_H_ + +/* see net/route.h, or net/if_inarp.h */ +#ifndef RTF_ANNOUNCE +#define RTF_ANNOUNCE RTF_PROTO2 +#endif + +#include +#include + +struct llinfo_nd6 { + struct llinfo_nd6 *ln_next; + struct llinfo_nd6 *ln_prev; + struct rtentry *ln_rt; + struct mbuf *ln_hold; /* last packet until resolved/timeout */ + long ln_asked; /* number of queries already sent for this addr */ + u_long ln_expire; /* lifetime for NDP state transition */ + short ln_state; /* reachability state */ + short ln_router; /* 2^0: ND6 router bit */ + int ln_byhint; /* # of times we made it reachable by UL hint */ +}; + +#define ND6_LLINFO_NOSTATE -2 +/* + * We don't need the WAITDELETE state any more, but we keep the definition + * in a comment line instead of removing it. This is necessary to avoid + * unintentionally reusing the value for another purpose, which might + * affect backward compatibility with old applications. + * (20000711 jinmei@kame.net) + */ +/* #define ND6_LLINFO_WAITDELETE -1 */ +#define ND6_LLINFO_INCOMPLETE 0 +#define ND6_LLINFO_REACHABLE 1 +#define ND6_LLINFO_STALE 2 +#define ND6_LLINFO_DELAY 3 +#define ND6_LLINFO_PROBE 4 + +#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE) + +struct nd_ifinfo { + u_int32_t linkmtu; /* LinkMTU */ + u_int32_t maxmtu; /* Upper bound of LinkMTU */ + u_int32_t basereachable; /* BaseReachableTime */ + u_int32_t reachable; /* Reachable Time */ + u_int32_t retrans; /* Retrans Timer */ + u_int32_t flags; /* Flags */ + int recalctm; /* BaseReacable re-calculation timer */ + u_int8_t chlim; /* CurHopLimit */ + u_int8_t receivedra; + /* the following 3 members are for privacy extension for addrconf */ + u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */ + u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */ + u_int8_t randomid[8]; /* current random ID */ +}; + +#define ND6_IFF_PERFORMNUD 0x1 + +struct in6_nbrinfo { + char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct in6_addr addr; /* IPv6 address of the neighbor */ + long asked; /* number of queries already sent for this addr */ + int isrouter; /* if it acts as a router */ + int state; /* reachability state */ + int expire; /* lifetime for NDP state transition */ +}; + +#define DRLSTSIZ 10 +#define PRLSTSIZ 10 +struct in6_drlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr rtaddr; + u_char flags; + u_short rtlifetime; + u_long expire; + u_short if_index; + } defrouter[DRLSTSIZ]; +}; + +struct in6_defrouter { + struct sockaddr_in6 rtaddr; + u_char flags; + u_short rtlifetime; + u_long expire; + u_short if_index; +}; + +struct in6_prlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr prefix; + struct prf_ra raflags; + u_char prefixlen; + u_char origin; + u_int32_t vltime; + u_int32_t pltime; + time_t expire; + u_short if_index; + u_short advrtrs; /* number of advertisement routers */ + struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ + } prefix[PRLSTSIZ]; +}; + +struct in6_prefix { + struct sockaddr_in6 prefix; + struct prf_ra raflags; + u_char prefixlen; + u_char origin; + u_long vltime; + u_long pltime; + u_long expire; + u_int32_t flags; + int refcnt; + u_short if_index; + u_short advrtrs; /* number of advertisement routers */ + /* struct sockaddr_in6 advrtr[] */ +}; + +#ifdef _KERNEL +struct in6_ondireq { + char ifname[IFNAMSIZ]; + struct { + u_int32_t linkmtu; /* LinkMTU */ + u_int32_t maxmtu; /* Upper bound of LinkMTU */ + u_int32_t basereachable; /* BaseReachableTime */ + u_int32_t reachable; /* Reachable Time */ + u_int32_t retrans; /* Retrans Timer */ + u_int32_t flags; /* Flags */ + int recalctm; /* BaseReacable re-calculation timer */ + u_int8_t chlim; /* CurHopLimit */ + u_int8_t receivedra; + } ndi; +}; +#endif + +struct in6_ndireq { + char ifname[IFNAMSIZ]; + struct nd_ifinfo ndi; +}; + +struct in6_ndifreq { + char ifname[IFNAMSIZ]; + u_long ifindex; +}; + +/* Prefix status */ +#define NDPRF_ONLINK 0x1 +#define NDPRF_DETACHED 0x2 + +/* protocol constants */ +#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */ +#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */ +#define MAX_RTR_SOLICITATIONS 3 + +#define ND6_INFINITE_LIFETIME 0xffffffff + +#ifdef _KERNEL +/* node constants */ +#define MAX_REACHABLE_TIME 3600000 /* msec */ +#define REACHABLE_TIME 30000 /* msec */ +#define RETRANS_TIMER 1000 /* msec */ +#define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */ +#define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */ +#define DEF_TEMP_VALID_LIFETIME 604800 /* 1 week */ +#define DEF_TEMP_PREFERRED_LIFETIME 86400 /* 1 day */ +#define TEMPADDR_REGEN_ADVANCE 5 /* sec */ +#define MAX_TEMP_DESYNC_FACTOR 600 /* 10 min */ +#define ND_COMPUTE_RTIME(x) \ + (((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \ + ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) + +TAILQ_HEAD(nd_drhead, nd_defrouter); +struct nd_defrouter { + TAILQ_ENTRY(nd_defrouter) dr_entry; + struct in6_addr rtaddr; + u_char flags; /* flags on RA message */ + u_short rtlifetime; + u_long expire; + u_long advint; /* Mobile IPv6 addition (milliseconds) */ + u_long advint_expire; /* Mobile IPv6 addition */ + int advints_lost; /* Mobile IPv6 addition */ + struct ifnet *ifp; +}; + +struct nd_prefix { + struct ifnet *ndpr_ifp; + LIST_ENTRY(nd_prefix) ndpr_entry; + struct sockaddr_in6 ndpr_prefix; /* prefix */ + struct in6_addr ndpr_mask; /* netmask derived from the prefix */ + struct in6_addr ndpr_addr; /* address that is derived from the prefix */ + u_int32_t ndpr_vltime; /* advertised valid lifetime */ + u_int32_t ndpr_pltime; /* advertised preferred lifetime */ + time_t ndpr_expire; /* expiration time of the prefix */ + time_t ndpr_preferred; /* preferred time of the prefix */ + struct prf_ra ndpr_flags; + u_int32_t ndpr_stateflags; /* actual state flags */ + /* list of routers that advertise the prefix: */ + LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs; + u_char ndpr_plen; + int ndpr_refcnt; /* reference couter from addresses */ +}; + +#define ndpr_next ndpr_entry.le_next + +#define ndpr_raf ndpr_flags +#define ndpr_raf_onlink ndpr_flags.onlink +#define ndpr_raf_auto ndpr_flags.autonomous + +/* + * We keep expired prefix for certain amount of time, for validation purposes. + * 1800s = MaxRtrAdvInterval + */ +#define NDPR_KEEP_EXPIRED (1800 * 2) + +/* + * Message format for use in obtaining information about prefixes + * from inet6 sysctl function + */ +struct inet6_ndpr_msghdr { + u_short inpm_msglen; /* to skip over non-understood messages */ + u_char inpm_version; /* future binary compatibility */ + u_char inpm_type; /* message type */ + struct in6_addr inpm_prefix; + u_long prm_vltim; + u_long prm_pltime; + u_long prm_expire; + u_long prm_preferred; + struct in6_prflags prm_flags; + u_short prm_index; /* index for associated ifp */ + u_char prm_plen; /* length of prefix in bits */ +}; + +#define prm_raf_onlink prm_flags.prf_ra.onlink +#define prm_raf_auto prm_flags.prf_ra.autonomous + +#define prm_statef_onlink prm_flags.prf_state.onlink + +#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid +#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd + +#define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr)) +#define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr)) + +struct nd_pfxrouter { + LIST_ENTRY(nd_pfxrouter) pfr_entry; +#define pfr_next pfr_entry.le_next + struct nd_defrouter *router; +}; + +LIST_HEAD(nd_prhead, nd_prefix); + +/* nd6.c */ +extern int nd6_prune; +extern int nd6_delay; +extern int nd6_umaxtries; +extern int nd6_mmaxtries; +extern int nd6_useloopback; +extern int nd6_maxnudhint; +extern int nd6_gctimer; +extern struct llinfo_nd6 llinfo_nd6; +extern struct nd_ifinfo *nd_ifinfo; +extern struct nd_drhead nd_defrouter; +extern struct nd_prhead nd_prefix; +extern int nd6_debug; + +#define nd6log(x) do { if (nd6_debug) log x; } while (0) + +extern struct callout nd6_timer_ch; + +/* nd6_rtr.c */ +extern int nd6_defifindex; +extern int ip6_desync_factor; /* seconds */ +extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */ +extern u_int32_t ip6_temp_valid_lifetime; /* seconds */ +extern int ip6_temp_regen_advance; /* seconds */ + +union nd_opts { + struct nd_opt_hdr *nd_opt_array[9]; /* max = home agent info */ + struct { + struct nd_opt_hdr *zero; + struct nd_opt_hdr *src_lladdr; + struct nd_opt_hdr *tgt_lladdr; + struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */ + struct nd_opt_rd_hdr *rh; + struct nd_opt_mtu *mtu; + struct nd_opt_hdr *six; + struct nd_opt_advint *adv; + struct nd_opt_hai *hai; + struct nd_opt_hdr *search; /* multiple opts */ + struct nd_opt_hdr *last; /* multiple opts */ + int done; + struct nd_opt_prefix_info *pi_end;/* multiple opts, end */ + } nd_opt_each; +}; +#define nd_opts_src_lladdr nd_opt_each.src_lladdr +#define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr +#define nd_opts_pi nd_opt_each.pi_beg +#define nd_opts_pi_end nd_opt_each.pi_end +#define nd_opts_rh nd_opt_each.rh +#define nd_opts_mtu nd_opt_each.mtu +#define nd_opts_adv nd_opt_each.adv +#define nd_opts_hai nd_opt_each.hai +#define nd_opts_search nd_opt_each.search +#define nd_opts_last nd_opt_each.last +#define nd_opts_done nd_opt_each.done + +/* XXX: need nd6_var.h?? */ +/* nd6.c */ +void nd6_init __P((void)); +void nd6_ifattach __P((struct ifnet *)); +int nd6_is_addr_neighbor __P((struct sockaddr_in6 *, struct ifnet *)); +void nd6_option_init __P((void *, int, union nd_opts *)); +struct nd_opt_hdr *nd6_option __P((union nd_opts *)); +int nd6_options __P((union nd_opts *)); +struct rtentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *)); +void nd6_setmtu __P((struct ifnet *)); +void nd6_timer __P((void *)); +void nd6_purge __P((struct ifnet *)); +struct llinfo_nd6 *nd6_free __P((struct rtentry *)); +void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int)); +int nd6_resolve __P((struct ifnet *, struct rtentry *, + struct mbuf *, struct sockaddr *, u_char *)); +void nd6_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *)); +int nd6_ioctl __P((u_long, caddr_t, struct ifnet *)); +struct rtentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *, + char *, int, int, int)); +int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *, + struct sockaddr_in6 *, struct rtentry *)); +int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *, + struct sockaddr *, u_char *)); +int nd6_need_cache __P((struct ifnet *)); + +/* nd6_nbr.c */ +void nd6_na_input __P((struct mbuf *, int, int)); +void nd6_na_output __P((struct ifnet *, const struct in6_addr *, + const struct in6_addr *, u_long, int, struct sockaddr *)); +void nd6_ns_input __P((struct mbuf *, int, int)); +void nd6_ns_output __P((struct ifnet *, const struct in6_addr *, + const struct in6_addr *, struct llinfo_nd6 *, int)); +caddr_t nd6_ifptomac __P((struct ifnet *)); +void nd6_dad_start __P((struct ifaddr *, int *)); +void nd6_dad_stop __P((struct ifaddr *)); +void nd6_dad_duplicated __P((struct ifaddr *)); + +/* nd6_rtr.c */ +void nd6_rs_input __P((struct mbuf *, int, int)); +void nd6_ra_input __P((struct mbuf *, int, int)); +void prelist_del __P((struct nd_prefix *)); +void defrouter_addreq __P((struct nd_defrouter *)); +void defrouter_delreq __P((struct nd_defrouter *, int)); +void defrouter_select __P((void)); +void defrtrlist_del __P((struct nd_defrouter *)); +void prelist_remove __P((struct nd_prefix *)); +int prelist_update __P((struct nd_prefix *, struct nd_defrouter *, + struct mbuf *)); +int nd6_prelist_add __P((struct nd_prefix *, struct nd_defrouter *, + struct nd_prefix **)); +int nd6_prefix_onlink __P((struct nd_prefix *)); +int nd6_prefix_offlink __P((struct nd_prefix *)); +void pfxlist_onlink_check __P((void)); +struct nd_defrouter *defrouter_lookup __P((struct in6_addr *, + struct ifnet *)); +struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefix *)); +int in6_init_prefix_ltimes __P((struct nd_prefix *ndpr)); +void rt6_flush __P((struct in6_addr *, struct ifnet *)); +int nd6_setdefaultiface __P((int)); +int in6_tmpifadd __P((const struct in6_ifaddr *, int)); + +#endif /* _KERNEL */ + +#endif /* _NETINET6_ND6_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/pim6.h b/newlib/libc/sys/linux/include/netinet6/pim6.h new file mode 100644 index 000000000..b5c5fd8b2 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/pim6.h @@ -0,0 +1,69 @@ +/* $FreeBSD: src/sys/netinet6/pim6.h,v 1.2 2000/07/04 16:35:10 itojun Exp $ */ +/* $KAME: pim6.h,v 1.3 2000/03/25 07:23:58 sumikawa Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Protocol Independent Multicast (PIM) definitions + * + * Written by Ahmed Helmy, SGI, July 1996 + * + * MULTICAST + */ + +/* + * PIM packet header + */ +#define PIM_VERSION 2 +struct pim { +#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN) + u_char pim_type:4, /* the PIM message type, currently they are: + * Hello, Register, Register-Stop, Join/Prune, + * Bootstrap, Assert, Graft (PIM-DM only), + * Graft-Ack (PIM-DM only), C-RP-Adv + */ + pim_ver:4; /* PIM version number; 2 for PIMv2 */ +#else + u_char pim_ver:4, /* PIM version */ + pim_type:4; /* PIM type */ +#endif + u_char pim_rsv; /* Reserved */ + u_short pim_cksum; /* IP style check sum */ +}; + +#define PIM_MINLEN 8 /* The header min. length is 8 */ +#define PIM6_REG_MINLEN (PIM_MINLEN+40) /* Register message + inner IP6 header */ + +/* + * Message types + */ +#define PIM_REGISTER 1 /* PIM Register type is 1 */ + +/* second bit in reg_head is the null bit */ +#define PIM_NULL_REGISTER 0x40000000 diff --git a/newlib/libc/sys/linux/include/netinet6/pim6_var.h b/newlib/libc/sys/linux/include/netinet6/pim6_var.h new file mode 100644 index 000000000..6fe6f6abe --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/pim6_var.h @@ -0,0 +1,70 @@ +/* $FreeBSD: src/sys/netinet6/pim6_var.h,v 1.3 2000/07/04 16:35:10 itojun Exp $ */ +/* $KAME: pim6_var.h,v 1.8 2000/06/06 08:07:43 jinmei Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET6_PIM6_VAR_H_ +#define _NETINET6_PIM6_VAR_H_ + +/* + * Protocol Independent Multicast (PIM), + * implementation-specific definitions. + * + * Written by George Edmond Eddy (Rusty), ISI, February 1998 + * Modified by Pavlin Ivanov Radoslavov, USC/ISI, May 1998 + */ + +struct pim6stat { + u_quad_t pim6s_rcv_total; /* total PIM messages received */ + u_quad_t pim6s_rcv_tooshort; /* received with too few bytes */ + u_quad_t pim6s_rcv_badsum; /* received with bad checksum */ + u_quad_t pim6s_rcv_badversion; /* received bad PIM version */ + u_quad_t pim6s_rcv_registers; /* received registers */ + u_quad_t pim6s_rcv_badregisters; /* received invalid registers */ + u_quad_t pim6s_snd_registers; /* sent registers */ +}; + +#if (defined(KERNEL)) || (defined(_KERNEL)) +extern struct pim6stat pim6stat; + +int pim6_input __P((struct mbuf **, int*, int)); +#endif /* KERNEL */ + +/* + * Names for PIM sysctl objects + */ +#define PIM6CTL_STATS 1 /* statistics (read-only) */ +#define PIM6CTL_MAXID 2 + +#define PIM6CTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ +} +#endif /* _NETINET6_PIM6_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/raw_ip6.h b/newlib/libc/sys/linux/include/netinet6/raw_ip6.h new file mode 100644 index 000000000..7efd75dcb --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/raw_ip6.h @@ -0,0 +1,54 @@ +/* $FreeBSD: src/sys/netinet6/raw_ip6.h,v 1.1 2001/06/11 12:39:06 ume Exp $ */ +/* $KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $ */ + +/* + * Copyright (C) 2001 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET6_RAW_IP6_H_ +#define _NETINET6_RAW_IP6_H_ + +/* + * ICMPv6 stat is counted separately. see netinet/icmp6.h + */ +struct rip6stat { + u_quad_t rip6s_ipackets; /* total input packets */ + u_quad_t rip6s_isum; /* input checksum computations */ + u_quad_t rip6s_badsum; /* of above, checksum error */ + u_quad_t rip6s_nosock; /* no matching socket */ + u_quad_t rip6s_nosockmcast; /* of above, arrived as multicast */ + u_quad_t rip6s_fullsock; /* not delivered, input socket full */ + + u_quad_t rip6s_opackets; /* total output packets */ +}; + +#ifdef _KERNEL +extern struct rip6stat rip6stat; +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netinet6/scope6_var.h b/newlib/libc/sys/linux/include/netinet6/scope6_var.h new file mode 100644 index 000000000..4f66c53f8 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/scope6_var.h @@ -0,0 +1,46 @@ +/* $FreeBSD: src/sys/netinet6/scope6_var.h,v 1.1 2000/07/04 16:35:10 itojun Exp $ */ +/* $KAME: scope6_var.h,v 1.4 2000/05/18 15:03:27 jinmei Exp $ */ + +/* + * Copyright (C) 2000 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET6_SCOPE6_VAR_H_ +#define _NETINET6_SCOPE6_VAR_H_ + +#ifdef _KERNEL +void scope6_ifattach __P((struct ifnet *)); +int scope6_set __P((struct ifnet *, u_int32_t *)); +int scope6_get __P((struct ifnet *, u_int32_t *)); +void scope6_setdefault __P((struct ifnet *)); +int scope6_get_default __P((u_int32_t *)); +u_int32_t scope6_in6_addrscope __P((struct in6_addr *)); +u_int32_t scope6_addr2default __P((struct in6_addr *)); +#endif /* _KERNEL */ + +#endif /* _NETINET6_SCOPE6_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/tcp6_var.h b/newlib/libc/sys/linux/include/netinet6/tcp6_var.h new file mode 100644 index 000000000..62541ef00 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/tcp6_var.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet6/tcp6_var.h,v 1.5 2001/11/22 04:50:44 jlemon Exp $ + */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994, 1995 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_var.h 8.4 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet6/tcp6_var.h,v 1.5 2001/11/22 04:50:44 jlemon Exp $ + */ + +#ifndef _NETINET_TCP6_VAR_H_ +#define _NETINET_TCP6_VAR_H_ + +#ifdef _KERNEL +#ifdef SYSCTL_DECL +SYSCTL_DECL(_net_inet6_tcp6); +#endif + +extern int tcp_v6mssdflt; /* XXX */ + +struct ip6_hdr; +void tcp6_ctlinput __P((int, struct sockaddr *, void *)); +void tcp6_init __P((void)); +int tcp6_input __P((struct mbuf **, int *, int)); +struct rtentry *tcp_rtlookup6(struct in_conninfo *); + +extern struct pr_usrreqs tcp6_usrreqs; + +#endif /* _KERNEL */ + +#endif /* _NETINET_TCP6_VAR_H_ */ diff --git a/newlib/libc/sys/linux/include/netinet6/udp6_var.h b/newlib/libc/sys/linux/include/netinet6/udp6_var.h new file mode 100644 index 000000000..222d6443a --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet6/udp6_var.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet6/udp6_var.h,v 1.5 2001/09/12 08:37:55 julian Exp $ + */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET6_UDP6_VAR_H_ +#define _NETINET6_UDP6_VAR_H_ + +#ifdef _KERNEL +SYSCTL_DECL(_net_inet6_udp6); + +extern struct pr_usrreqs udp6_usrreqs; + +void udp6_ctlinput __P((int, struct sockaddr *, void *)); +int udp6_input __P((struct mbuf **, int *, int)); +int udp6_output __P((struct inpcb *inp, struct mbuf *m, + struct sockaddr *addr, struct mbuf *control, + struct thread *td)); +#endif + +#endif /*_NETINET6_UDP6_VAR_H_*/ diff --git a/newlib/libc/sys/linux/include/netns/idp.h b/newlib/libc/sys/linux/include/netns/idp.h new file mode 100644 index 000000000..05cd4252b --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/idp.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)idp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/idp.h,v 1.8 1999/08/28 00:49:46 peter Exp $ + */ + +#ifndef _NETNS_IDP_H_ +#define _NETNS_IDP_H_ + +/* + * Definitions for NS(tm) Internet Datagram Protocol + */ +struct idp { + u_short idp_sum; /* Checksum */ + u_short idp_len; /* Length, in bytes, including header */ + u_char idp_tc; /* Transport Control (i.e. hop count) */ + u_char idp_pt; /* Packet Type (i.e. level 2 protocol) */ + struct ns_addr idp_dna; /* Destination Network Address */ + struct ns_addr idp_sna; /* Source Network Address */ +}; + +#endif diff --git a/newlib/libc/sys/linux/include/netns/idp_var.h b/newlib/libc/sys/linux/include/netns/idp_var.h new file mode 100644 index 000000000..aaeb1e028 --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/idp_var.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)idp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/idp_var.h,v 1.10 1999/12/29 04:46:18 peter Exp $ + */ + +#ifndef _NETNS_IDP_VAR_H_ +#define _NETNS_IDP_VAR_H_ + +/* + * IDP Kernel Structures and Variables + */ +struct idpstat { + int idps_badsum; /* checksum bad */ + int idps_tooshort; /* packet too short */ + int idps_toosmall; /* not enough data */ + int idps_badhlen; /* ip header length < data size */ + int idps_badlen; /* ip length < ip header length */ +}; + +#ifdef _KERNEL +struct idpstat idpstat; +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netns/ns.h b/newlib/libc/sys/linux/include/netns/ns.h new file mode 100644 index 000000000..94c801713 --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/ns.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ns.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/ns.h,v 1.15 2002/03/20 02:39:27 alfred Exp $ + */ + +#ifndef _NETNS_NS_H_ +#define _NETNS_NS_H_ + +/* + * Constants and Structures defined by the Xerox Network Software + * per "Internet Transport Protocols", XSIS 028112, December 1981 + */ + +/* + * Protocols + */ +#define NSPROTO_RI 1 /* Routing Information */ +#define NSPROTO_ECHO 2 /* Echo Protocol */ +#define NSPROTO_ERROR 3 /* Error Protocol */ +#define NSPROTO_PE 4 /* Packet Exchange */ +#define NSPROTO_SPP 5 /* Sequenced Packet */ +#define NSPROTO_RAW 255 /* Placemarker*/ +#define NSPROTO_MAX 256 /* Placemarker*/ + + +/* + * Port/Socket numbers: network standard functions + */ + +#define NSPORT_RI 1 /* Routing Information */ +#define NSPORT_ECHO 2 /* Echo */ +#define NSPORT_RE 3 /* Router Error */ + +/* + * Ports < NSPORT_RESERVED are reserved for priveleged + * processes (e.g. root). + */ +#define NSPORT_RESERVED 3000 + +/* flags passed to ns_output as last parameter */ + +#define NS_FORWARDING 0x1 /* most of idp header exists */ +#define NS_ROUTETOIF 0x10 /* same as SO_DONTROUTE */ +#define NS_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ + +#define NS_MAXHOPS 15 + +/* flags passed to get/set socket option */ +#define SO_HEADERS_ON_INPUT 1 +#define SO_HEADERS_ON_OUTPUT 2 +#define SO_DEFAULT_HEADERS 3 +#define SO_LAST_HEADER 4 +#define SO_NSIP_ROUTE 5 +#define SO_SEQNO 6 +#define SO_ALL_PACKETS 7 +#define SO_MTU 8 + + +/* + * NS addressing + */ +union ns_host { + u_char c_host[6]; + u_short s_host[3]; +}; + +union ns_net { + u_char c_net[4]; + u_short s_net[2]; +}; + +union ns_net_u { + union ns_net net_e; + u_long long_e; +}; + +struct ns_addr { + union ns_net x_net; + union ns_host x_host; + u_short x_port; +}; + +/* + * Socket address, Xerox style + */ +struct sockaddr_ns { + u_char sns_len; + u_char sns_family; + struct ns_addr sns_addr; + char sns_zero[2]; +}; +#define sns_port sns_addr.x_port + +#define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \ + ((a).s_net[1]==(b).s_net[1])) +#define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net) +#define satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr) +#define ns_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \ + (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2]) +#define ns_hosteq(s,t) (ns_hosteqnh((s).x_host,(t).x_host)) +#define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \ + ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0)) + +#ifdef _KERNEL +extern struct domain nsdomain; +union ns_host ns_thishost; +union ns_host ns_zerohost; +union ns_host ns_broadhost; +union ns_net ns_zeronet; +union ns_net ns_broadnet; +u_short ns_cksum(); +#else + +#include + +__BEGIN_DECLS +extern struct ns_addr ns_addr(const char *); +extern char *ns_ntoa(struct ns_addr); +__END_DECLS + +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netns/ns_error.h b/newlib/libc/sys/linux/include/netns/ns_error.h new file mode 100644 index 000000000..ae4474722 --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/ns_error.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1984, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ns_error.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/ns_error.h,v 1.10 1999/12/29 04:46:19 peter Exp $ + */ + +#ifndef _NETNS_NS_ERROR_H_ +#define _NETNS_NS_ERROR_H_ + +/* + * Xerox NS error messages + */ + +struct ns_errp { + u_short ns_err_num; /* Error Number */ + u_short ns_err_param; /* Error Parameter */ + struct idp ns_err_idp; /* Initial segment of offending + packet */ + u_char ns_err_lev2[12]; /* at least this much higher + level protocol */ +}; +struct ns_epidp { + struct idp ns_ep_idp; + struct ns_errp ns_ep_errp; +}; + +#define NS_ERR_UNSPEC 0 /* Unspecified Error detected at dest. */ +#define NS_ERR_BADSUM 1 /* Bad Checksum detected at dest */ +#define NS_ERR_NOSOCK 2 /* Specified socket does not exist at dest*/ +#define NS_ERR_FULLUP 3 /* Dest. refuses packet due to resource lim.*/ +#define NS_ERR_UNSPEC_T 0x200 /* Unspec. Error occured before reaching dest*/ +#define NS_ERR_BADSUM_T 0x201 /* Bad Checksum detected in transit */ +#define NS_ERR_UNREACH_HOST 0x202 /* Dest cannot be reached from here*/ +#define NS_ERR_TOO_OLD 0x203 /* Packet x'd 15 routers without delivery*/ +#define NS_ERR_TOO_BIG 0x204 /* Packet too large to be forwarded through + some intermediate gateway. The error + parameter field contains the max packet + size that can be accommodated */ +#define NS_ERR_MAX 20 + +/* + * Variables related to this implementation + * of the network systems error message protocol. + */ +struct ns_errstat { +/* statistics related to ns_err packets generated */ + int ns_es_error; /* # of calls to ns_error */ + int ns_es_oldshort; /* no error 'cuz old ip too short */ + int ns_es_oldns_err; /* no error 'cuz old was ns_err */ + int ns_es_outhist[NS_ERR_MAX]; +/* statistics related to input messages processed */ + int ns_es_badcode; /* ns_err_code out of range */ + int ns_es_tooshort; /* packet < IDP_MINLEN */ + int ns_es_checksum; /* bad checksum */ + int ns_es_badlen; /* calculated bound mismatch */ + int ns_es_reflect; /* number of responses */ + int ns_es_inhist[NS_ERR_MAX]; + u_short ns_es_codes[NS_ERR_MAX];/* which error code for outhist + since we might not know all */ +}; + +#ifdef _KERNEL +struct ns_errstat ns_errstat; +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netns/ns_if.h b/newlib/libc/sys/linux/include/netns/ns_if.h new file mode 100644 index 000000000..4487b44f6 --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/ns_if.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ns_if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/ns_if.h,v 1.13 2002/03/20 02:39:27 alfred Exp $ + */ + +#ifndef _NETNS_NS_IF_H_ +#define _NETNS_NS_IF_H_ + +/* + * Interface address, xerox version. One of these structures + * is allocated for each interface with an internet address. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ + +struct ns_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + struct ns_ifaddr *ia_next; /* next in list of xerox addresses */ + struct sockaddr_ns ia_addr; /* reserve space for my address */ + struct sockaddr_ns ia_dstaddr; /* space for my broadcast address */ +#define ia_broadaddr ia_dstaddr + struct sockaddr_ns ia_netmask; /* space for my network mask */ +}; + +struct ns_aliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr_ns ifra_addr; + struct sockaddr_ns ifra_broadaddr; +#define ifra_dstaddr ifra_broadaddr +}; +/* + * Given a pointer to an ns_ifaddr (ifaddr), + * return a pointer to the addr as a sockadd_ns. + */ + +#define IA_SNS(ia) (&(((struct ns_ifaddr *)(ia))->ia_addr)) + +/* This is not the right place for this but where is? */ +#define ETHERTYPE_NS 0x0600 + +#ifdef NSIP +struct nsip_req { + struct sockaddr rq_ns; /* must be ns format destination */ + struct sockaddr rq_ip; /* must be ip format gateway */ + short rq_flags; +}; +#endif + +#ifdef _KERNEL +struct ns_ifaddr *ns_ifaddr; +struct ns_ifaddr *ns_iaonnetof(); +void nsintr(void); +struct ifqueue nsintrq; /* XNS input packet queue */ +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netns/ns_pcb.h b/newlib/libc/sys/linux/include/netns/ns_pcb.h new file mode 100644 index 000000000..359d839c0 --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/ns_pcb.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ns_pcb.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/ns_pcb.h,v 1.11 1999/12/29 04:46:20 peter Exp $ + */ + +#ifndef _NETNS_NS_PCB_H_ +#define _NETNS_NS_PCB_H_ + +/* + * Ns protocol interface control block. + */ +struct nspcb { + struct nspcb *nsp_next; /* doubly linked list */ + struct nspcb *nsp_prev; + struct socket *nsp_socket; /* back pointer to socket */ + struct ns_addr nsp_faddr; /* destination address */ + struct ns_addr nsp_laddr; /* socket's address */ + caddr_t nsp_pcb; /* protocol specific stuff */ + struct route nsp_route; /* routing information */ + struct ns_addr nsp_lastdst; /* validate cached route for dg socks*/ + long nsp_notify_param; /* extra info passed via ns_pcbnotify*/ + short nsp_flags; + u_char nsp_dpt; /* default packet type for idp_output*/ + u_char nsp_rpt; /* last received packet type by + idp_input() */ +}; + +/* possible flags */ + +#define NSP_IN_ABORT 0x1 /* calling abort through socket */ +#define NSP_RAWIN 0x2 /* show headers on input */ +#define NSP_RAWOUT 0x4 /* show header on output */ +#define NSP_ALL_PACKETS 0x8 /* Turn off higher proto processing */ + +#define NS_WILDCARD 1 + +#define nsp_lport nsp_laddr.x_port +#define nsp_fport nsp_faddr.x_port + +#define sotonspcb(so) ((struct nspcb *)((so)->so_pcb)) + +/* + * Nominal space allocated to a ns socket. + */ +#define NSSNDQ 2048 +#define NSRCVQ 2048 + + +#ifdef _KERNEL +struct nspcb nspcb; /* head of list */ +struct nspcb *ns_pcblookup(); +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netns/sp.h b/newlib/libc/sys/linux/include/netns/sp.h new file mode 100644 index 000000000..90f26c93d --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/sp.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/sp.h,v 1.8 1999/08/28 00:49:52 peter Exp $ + */ + +#ifndef _NETNS_SP_H_ +#define _NETNS_SP_H_ + +/* + * Definitions for Xerox NS style sequenced packet protocol + */ + +struct sphdr { + u_char sp_cc; /* connection control */ + u_char sp_dt; /* datastream type */ +#define SP_SP 0x80 /* system packet */ +#define SP_SA 0x40 /* send acknowledgement */ +#define SP_OB 0x20 /* attention (out of band data) */ +#define SP_EM 0x10 /* end of message */ + u_short sp_sid; /* source connection identifier */ + u_short sp_did; /* destination connection identifier */ + u_short sp_seq; /* sequence number */ + u_short sp_ack; /* acknowledge number */ + u_short sp_alo; /* allocation number */ +}; + +#endif diff --git a/newlib/libc/sys/linux/include/netns/spidp.h b/newlib/libc/sys/linux/include/netns/spidp.h new file mode 100644 index 000000000..310a2b204 --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/spidp.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)spidp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/spidp.h,v 1.8 1999/08/28 00:49:52 peter Exp $ + */ + +#ifndef _NETNS_SPIDP_H_ +#define _NETNS_SPIDP_H_ + +/* + * Definitions for NS(tm) Internet Datagram Protocol + * containing a Sequenced Packet Protocol packet. + */ +struct spidp { + struct idp si_i; + struct sphdr si_s; +}; +struct spidp_q { + struct spidp_q *si_next; + struct spidp_q *si_prev; +}; +#define SI(x) ((struct spidp *)x) +#define si_sum si_i.idp_sum +#define si_len si_i.idp_len +#define si_tc si_i.idp_tc +#define si_pt si_i.idp_pt +#define si_dna si_i.idp_dna +#define si_sna si_i.idp_sna +#define si_sport si_i.idp_sna.x_port +#define si_cc si_s.sp_cc +#define si_dt si_s.sp_dt +#define si_sid si_s.sp_sid +#define si_did si_s.sp_did +#define si_seq si_s.sp_seq +#define si_ack si_s.sp_ack +#define si_alo si_s.sp_alo + +#endif diff --git a/newlib/libc/sys/linux/include/netns/spp_debug.h b/newlib/libc/sys/linux/include/netns/spp_debug.h new file mode 100644 index 000000000..f85cc3901 --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/spp_debug.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)spp_debug.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/spp_debug.h,v 1.9 1999/08/28 00:49:53 peter Exp $ + */ + +#ifndef _NETNS_SPP_DEBUG_H_ +#define _NETNS_SPP_DEBUG_H_ + +struct spp_debug { + u_long sd_time; + short sd_act; + short sd_ostate; + caddr_t sd_cb; + short sd_req; + struct spidp sd_si; + struct sppcb sd_sp; +}; + +#define SA_INPUT 0 +#define SA_OUTPUT 1 +#define SA_USER 2 +#define SA_RESPOND 3 +#define SA_DROP 4 + +#ifdef SANAMES +char *sanames[] = + { "input", "output", "user", "respond", "drop" }; +#endif + +#define SPP_NDEBUG 100 +struct spp_debug spp_debug[SPP_NDEBUG]; +int spp_debx; + +#endif diff --git a/newlib/libc/sys/linux/include/netns/spp_timer.h b/newlib/libc/sys/linux/include/netns/spp_timer.h new file mode 100644 index 000000000..e28ecad7f --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/spp_timer.h @@ -0,0 +1,128 @@ +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)spp_timer.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/spp_timer.h,v 1.9 1999/12/29 04:46:20 peter Exp $ + */ + +#ifndef _NETNS_SPP_TIMER_H_ +#define _NETNS_SPP_TIMER_H_ + +/* + * Definitions of the SPP timers. These timers are counted + * down PR_SLOWHZ times a second. + */ +#define SPPT_NTIMERS 4 + +#define SPPT_REXMT 0 /* retransmit */ +#define SPPT_PERSIST 1 /* retransmit persistance */ +#define SPPT_KEEP 2 /* keep alive */ +#define SPPT_2MSL 3 /* 2*msl quiet time timer */ + +/* + * The SPPT_REXMT timer is used to force retransmissions. + * The SPP has the SPPT_REXMT timer set whenever segments + * have been sent for which ACKs are expected but not yet + * received. If an ACK is received which advances tp->snd_una, + * then the retransmit timer is cleared (if there are no more + * outstanding segments) or reset to the base value (if there + * are more ACKs expected). Whenever the retransmit timer goes off, + * we retransmit one unacknowledged segment, and do a backoff + * on the retransmit timer. + * + * The SPPT_PERSIST timer is used to keep window size information + * flowing even if the window goes shut. If all previous transmissions + * have been acknowledged (so that there are no retransmissions in progress), + * and the window is too small to bother sending anything, then we start + * the SPPT_PERSIST timer. When it expires, if the window is nonzero, + * we go to transmit state. Otherwise, at intervals send a single byte + * into the peer's window to force him to update our window information. + * We do this at most as often as SPPT_PERSMIN time intervals, + * but no more frequently than the current estimate of round-trip + * packet time. The SPPT_PERSIST timer is cleared whenever we receive + * a window update from the peer. + * + * The SPPT_KEEP timer is used to keep connections alive. If an + * connection is idle (no segments received) for SPPTV_KEEP amount of time, + * but not yet established, then we drop the connection. If the connection + * is established, then we force the peer to send us a segment by sending: + * + * This segment is (deliberately) outside the window, and should elicit + * an ack segment in response from the peer. If, despite the SPPT_KEEP + * initiated segments we cannot elicit a response from a peer in SPPT_MAXIDLE + * amount of time, then we drop the connection. + */ + +#define SPP_TTL 30 /* default time to live for SPP segs */ +/* + * Time constants. + */ +#define SPPTV_MSL ( 15*PR_SLOWHZ) /* max seg lifetime */ +#define SPPTV_SRTTBASE 0 /* base roundtrip time; + if 0, no idea yet */ +#define SPPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */ + +#define SPPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */ +#define SPPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */ + +#define SPPTV_KEEP ( 75*PR_SLOWHZ) /* keep alive - 75 secs */ +#define SPPTV_MAXIDLE ( 8*SPPTV_KEEP) /* maximum allowable idle + time before drop conn */ + +#define SPPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */ +#define SPPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */ + +#define SPP_LINGERTIME 120 /* linger at most 2 minutes */ + +#define SPP_MAXRXTSHIFT 12 /* maximum retransmits */ + +#ifdef SPPTIMERS +char *spptimers[] = + { "REXMT", "PERSIST", "KEEP", "2MSL" }; +#endif + +/* + * Force a time value to be in a certain range. + */ +#define SPPT_RANGESET(tv, value, tvmin, tvmax) { \ + (tv) = (value); \ + if ((tv) < (tvmin)) \ + (tv) = (tvmin); \ + else if ((tv) > (tvmax)) \ + (tv) = (tvmax); \ +} + +#ifdef _KERNEL +extern int spp_backoff[]; +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/netns/spp_var.h b/newlib/libc/sys/linux/include/netns/spp_var.h new file mode 100644 index 000000000..ed1ec050d --- /dev/null +++ b/newlib/libc/sys/linux/include/netns/spp_var.h @@ -0,0 +1,221 @@ +/* + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)spp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netns/spp_var.h,v 1.11 1999/12/29 04:46:21 peter Exp $ + */ + +#ifndef _NETNS_SPP_VAR_H_ +#define _NETNS_SPP_VAR_H_ + +/* + * Sp control block, one per connection + */ +struct sppcb { + struct spidp_q s_q; /* queue for out-of-order receipt */ + struct nspcb *s_nspcb; /* backpointer to internet pcb */ + u_char s_state; + u_char s_flags; +#define SF_ACKNOW 0x01 /* Ack peer immediately */ +#define SF_DELACK 0x02 /* Ack, but try to delay it */ +#define SF_HI 0x04 /* Show headers on input */ +#define SF_HO 0x08 /* Show headers on output */ +#define SF_PI 0x10 /* Packet (datagram) interface */ +#define SF_WIN 0x20 /* Window info changed */ +#define SF_RXT 0x40 /* Rxt info changed */ +#define SF_RVD 0x80 /* Calling from read usrreq routine */ + u_short s_mtu; /* Max packet size for this stream */ +/* use sequence fields in headers to store sequence numbers for this + connection */ + struct idp *s_idp; + struct sphdr s_shdr; /* prototype header to transmit */ +#define s_cc s_shdr.sp_cc /* connection control (for EM bit) */ +#define s_dt s_shdr.sp_dt /* datastream type */ +#define s_sid s_shdr.sp_sid /* source connection identifier */ +#define s_did s_shdr.sp_did /* destination connection identifier */ +#define s_seq s_shdr.sp_seq /* sequence number */ +#define s_ack s_shdr.sp_ack /* acknowledge number */ +#define s_alo s_shdr.sp_alo /* allocation number */ +#define s_dport s_idp->idp_dna.x_port /* where we are sending */ + struct sphdr s_rhdr; /* last received header (in effect!)*/ + u_short s_rack; /* their acknowledge number */ + u_short s_ralo; /* their allocation number */ + u_short s_smax; /* highest packet # we have sent */ + u_short s_snxt; /* which packet to send next */ + +/* congestion control */ +#define CUNIT 1024 /* scaling for ... */ + int s_cwnd; /* Congestion-controlled window */ + /* in packets * CUNIT */ + short s_swnd; /* == tcp snd_wnd, in packets */ + short s_smxw; /* == tcp max_sndwnd */ + /* difference of two spp_seq's can be + no bigger than a short */ + u_short s_swl1; /* == tcp snd_wl1 */ + u_short s_swl2; /* == tcp snd_wl2 */ + int s_cwmx; /* max allowable cwnd */ + int s_ssthresh; /* s_cwnd size threshhold for + * slow start exponential-to- + * linear switch */ +/* transmit timing stuff + * srtt and rttvar are stored as fixed point, for convenience in smoothing. + * srtt has 3 bits to the right of the binary point, rttvar has 2. + */ + short s_idle; /* time idle */ + short s_timer[SPPT_NTIMERS]; /* timers */ + short s_rxtshift; /* log(2) of rexmt exp. backoff */ + short s_rxtcur; /* current retransmit value */ + u_short s_rtseq; /* packet being timed */ + short s_rtt; /* timer for round trips */ + short s_srtt; /* averaged timer */ + short s_rttvar; /* variance in round trip time */ + char s_force; /* which timer expired */ + char s_dupacks; /* counter to intuit xmt loss */ + +/* out of band data */ + char s_oobflags; +#define SF_SOOB 0x08 /* sending out of band data */ +#define SF_IOOB 0x10 /* receiving out of band data */ + char s_iobc; /* input characters */ +/* debug stuff */ + u_short s_want; /* Last candidate for sending */ + char s_outx; /* exit taken from spp_output */ + char s_inx; /* exit taken from spp_input */ + u_short s_flags2; /* more flags for testing */ +#define SF_NEWCALL 0x100 /* for new_recvmsg */ +#define SO_NEWCALL 10 /* for new_recvmsg */ +}; + +#define nstosppcb(np) ((struct sppcb *)(np)->nsp_pcb) +#define sotosppcb(so) (nstosppcb(sotonspcb(so))) + +struct sppstat { + long spps_connattempt; /* connections initiated */ + long spps_accepts; /* connections accepted */ + long spps_connects; /* connections established */ + long spps_drops; /* connections dropped */ + long spps_conndrops; /* embryonic connections dropped */ + long spps_closed; /* conn. closed (includes drops) */ + long spps_segstimed; /* segs where we tried to get rtt */ + long spps_rttupdated; /* times we succeeded */ + long spps_delack; /* delayed acks sent */ + long spps_timeoutdrop; /* conn. dropped in rxmt timeout */ + long spps_rexmttimeo; /* retransmit timeouts */ + long spps_persisttimeo; /* persist timeouts */ + long spps_keeptimeo; /* keepalive timeouts */ + long spps_keepprobe; /* keepalive probes sent */ + long spps_keepdrops; /* connections dropped in keepalive */ + + long spps_sndtotal; /* total packets sent */ + long spps_sndpack; /* data packets sent */ + long spps_sndbyte; /* data bytes sent */ + long spps_sndrexmitpack; /* data packets retransmitted */ + long spps_sndrexmitbyte; /* data bytes retransmitted */ + long spps_sndacks; /* ack-only packets sent */ + long spps_sndprobe; /* window probes sent */ + long spps_sndurg; /* packets sent with URG only */ + long spps_sndwinup; /* window update-only packets sent */ + long spps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + long spps_sndvoid; /* couldn't find requested packet*/ + + long spps_rcvtotal; /* total packets received */ + long spps_rcvpack; /* packets received in sequence */ + long spps_rcvbyte; /* bytes received in sequence */ + long spps_rcvbadsum; /* packets received with ccksum errs */ + long spps_rcvbadoff; /* packets received with bad offset */ + long spps_rcvshort; /* packets received too short */ + long spps_rcvduppack; /* duplicate-only packets received */ + long spps_rcvdupbyte; /* duplicate-only bytes received */ + long spps_rcvpartduppack; /* packets with some duplicate data */ + long spps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + long spps_rcvoopack; /* out-of-order packets received */ + long spps_rcvoobyte; /* out-of-order bytes received */ + long spps_rcvpackafterwin; /* packets with data after window */ + long spps_rcvbyteafterwin; /* bytes rcvd after window */ + long spps_rcvafterclose; /* packets rcvd after "close" */ + long spps_rcvwinprobe; /* rcvd window probe packets */ + long spps_rcvdupack; /* rcvd duplicate acks */ + long spps_rcvacktoomuch; /* rcvd acks for unsent data */ + long spps_rcvackpack; /* rcvd ack packets */ + long spps_rcvackbyte; /* bytes acked by rcvd acks */ + long spps_rcvwinupd; /* rcvd window update packets */ +}; +struct spp_istat { + short hdrops; + short badsum; + short badlen; + short slotim; + short fastim; + short nonucn; + short noconn; + short notme; + short wrncon; + short bdreas; + short gonawy; + short notyet; + short lstdup; + struct sppstat newstats; +}; + +#ifdef _KERNEL +struct spp_istat spp_istat; + +/* Following was struct sppstat sppstat; */ +#ifndef sppstat +#define sppstat spp_istat.newstats +#endif + +u_short spp_iss; +extern struct sppcb *spp_close(), *spp_disconnect(), + *spp_usrclosed(), *spp_timers(), *spp_drop(); +#endif + +#define SPP_ISSINCR 128 +/* + * SPP sequence numbers are 16 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#ifdef sun +short xnsCbug; +#define SSEQ_LT(a,b) ((xnsCbug = (short)((a)-(b))) < 0) +#define SSEQ_LEQ(a,b) ((xnsCbug = (short)((a)-(b))) <= 0) +#define SSEQ_GT(a,b) ((xnsCbug = (short)((a)-(b))) > 0) +#define SSEQ_GEQ(a,b) ((xnsCbug = (short)((a)-(b))) >= 0) +#else +#define SSEQ_LT(a,b) (((short)((a)-(b))) < 0) +#define SSEQ_LEQ(a,b) (((short)((a)-(b))) <= 0) +#define SSEQ_GT(a,b) (((short)((a)-(b))) > 0) +#define SSEQ_GEQ(a,b) (((short)((a)-(b))) >= 0) +#endif + +#endif diff --git a/newlib/libc/sys/linux/include/nsswitch.h b/newlib/libc/sys/linux/include/nsswitch.h new file mode 100644 index 000000000..3a578e4ff --- /dev/null +++ b/newlib/libc/sys/linux/include/nsswitch.h @@ -0,0 +1,184 @@ +/* $NetBSD: nsswitch.h,v 1.6 1999/01/26 01:04:07 lukem Exp $ */ +/* $FreeBSD: src/include/nsswitch.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _NSSWITCH_H +#define _NSSWITCH_H 1 + +#include + +#include + +#ifndef _PATH_NS_CONF +#define _PATH_NS_CONF "/etc/nsswitch.conf" +#endif + +#define NS_CONTINUE 0 +#define NS_RETURN 1 + +#define NS_SUCCESS (1<<0) /* entry was found */ +#define NS_UNAVAIL (1<<1) /* source not responding, or corrupt */ +#define NS_NOTFOUND (1<<2) /* source responded 'no such entry' */ +#define NS_TRYAGAIN (1<<3) /* source busy, may respond to retrys */ +#define NS_STATUSMASK 0x000000ff /* bitmask to get the status flags */ + +/* + * currently implemented sources + */ +#define NSSRC_FILES "files" /* local files */ +#define NSSRC_DNS "dns" /* DNS; IN for hosts, HS for others */ +#define NSSRC_NIS "nis" /* YP/NIS */ +#define NSSRC_COMPAT "compat" /* passwd,group in YP compat mode */ + +/* + * currently implemented databases + */ +#define NSDB_HOSTS "hosts" +#define NSDB_GROUP "group" +#define NSDB_GROUP_COMPAT "group_compat" +#define NSDB_NETGROUP "netgroup" +#define NSDB_NETWORKS "networks" +#define NSDB_PASSWD "passwd" +#define NSDB_PASSWD_COMPAT "passwd_compat" +#define NSDB_SHELLS "shells" + +/* + * suggested databases to implement + */ +#define NSDB_ALIASES "aliases" +#define NSDB_AUTH "auth" +#define NSDB_AUTOMOUNT "automount" +#define NSDB_BOOTPARAMS "bootparams" +#define NSDB_ETHERS "ethers" +#define NSDB_EXPORTS "exports" +#define NSDB_NETMASKS "netmasks" +#define NSDB_PHONES "phones" +#define NSDB_PRINTCAP "printcap" +#define NSDB_PROTOCOLS "protocols" +#define NSDB_REMOTE "remote" +#define NSDB_RPC "rpc" +#define NSDB_SENDMAILVARS "sendmailvars" +#define NSDB_SERVICES "services" +#define NSDB_TERMCAP "termcap" +#define NSDB_TTYS "ttys" + +/* + * ns_dtab - `nsswitch dispatch table' + * contains an entry for each source and the appropriate function to call + */ +typedef struct { + const char *src; + int (*callback)(void *retval, void *cb_data, va_list ap); + void *cb_data; +} ns_dtab; + +/* + * macros to help build an ns_dtab[] + */ +#define NS_FILES_CB(F,C) { NSSRC_FILES, F, C }, +#define NS_COMPAT_CB(F,C) { NSSRC_COMPAT, F, C }, + +#ifdef HESIOD +# define NS_DNS_CB(F,C) { NSSRC_DNS, F, C }, +#else +# define NS_DNS_CB(F,C) +#endif + +#ifdef YP +# define NS_NIS_CB(F,C) { NSSRC_NIS, F, C }, +#else +# define NS_NIS_CB(F,C) +#endif + +/* + * ns_src - `nsswitch source' + * used by the nsparser routines to store a mapping between a source + * and its dispatch control flags for a given database. + */ +typedef struct { + const char *name; + u_int32_t flags; +} ns_src; + + +/* + * default sourcelist (if nsswitch.conf is missing, corrupt, + * or the requested database doesn't have an entry. + */ +extern const ns_src __nsdefaultsrc[]; + + +#ifdef _NS_PRIVATE + +/* + * private data structures for back-end nsswitch implementation + */ + +/* + * ns_dbt - `nsswitch database thang' + * for each database in /etc/nsswitch.conf there is a ns_dbt, with its + * name and a list of ns_src's containing the source information. + */ +typedef struct { + const char *name; /* name of database */ + ns_src *srclist; /* list of sources */ + int srclistsize; /* size of srclist */ +} ns_dbt; + +#endif /* _NS_PRIVATE */ + + +#include + +__BEGIN_DECLS +extern int nsdispatch(void *, const ns_dtab [], const char *, + const char *, const ns_src [], ...); + +#ifdef _NS_PRIVATE +extern void _nsdbtaddsrc(ns_dbt *, const ns_src *); +extern void _nsdbtdump(const ns_dbt *); +extern const ns_dbt *_nsdbtget(const char *); +extern void _nsdbtput(const ns_dbt *); +extern void _nsyyerror(const char *); +extern int _nsyylex(void); +extern int _nsyylineno; +#endif /* _NS_PRIVATE */ + +__END_DECLS + +#endif /* !_NSSWITCH_H */ diff --git a/newlib/libc/sys/linux/include/regex.h b/newlib/libc/sys/linux/include/regex.h new file mode 100644 index 000000000..d71c0ceee --- /dev/null +++ b/newlib/libc/sys/linux/include/regex.h @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 1992 Henry Spencer. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regex.h 8.2 (Berkeley) 1/3/94 + * $FreeBSD: src/include/regex.h,v 1.4 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +#include + +/* types */ +typedef off_t regoff_t; + +typedef struct { + int re_magic; + size_t re_nsub; /* number of parenthesized subexpressions */ + __const char *re_endp; /* end pointer for REG_PEND */ + struct re_guts *re_g; /* none of your business :-) */ +} regex_t; + +typedef struct { + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ +} regmatch_t; + +/* regcomp() flags */ +#define REG_BASIC 0000 +#define REG_EXTENDED 0001 +#define REG_ICASE 0002 +#define REG_NOSUB 0004 +#define REG_NEWLINE 0010 +#define REG_NOSPEC 0020 +#define REG_PEND 0040 +#define REG_DUMP 0200 + +/* regerror() flags */ +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 +#define REG_EMPTY 14 +#define REG_ASSERT 15 +#define REG_INVARG 16 +#define REG_ATOI 255 /* convert name to number (!) */ +#define REG_ITOA 0400 /* convert number to name (!) */ + +/* regexec() flags */ +#define REG_NOTBOL 00001 +#define REG_NOTEOL 00002 +#define REG_STARTEND 00004 +#define REG_TRACE 00400 /* tracing of execution */ +#define REG_LARGE 01000 /* force large representation */ +#define REG_BACKR 02000 /* force use of backref code */ + +__BEGIN_DECLS +int regcomp(regex_t *, const char *, int); +size_t regerror(int, const regex_t *, char *, size_t); +int regexec(const regex_t *, const char *, size_t, regmatch_t [], int); +void regfree(regex_t *); +__END_DECLS + +#endif /* !_REGEX_H_ */ diff --git a/newlib/libc/sys/linux/include/resolv.h b/newlib/libc/sys/linux/include/resolv.h new file mode 100644 index 000000000..1114f2d92 --- /dev/null +++ b/newlib/libc/sys/linux/include/resolv.h @@ -0,0 +1,319 @@ +/*- + * Copyright (c) 1983, 1987, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * @(#)resolv.h 8.1 (Berkeley) 6/2/93 + * From Id: resolv.h,v 8.12 1998/04/28 19:36:46 halley Exp $ + * $FreeBSD: src/include/resolv.h,v 1.21 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _RESOLV_H_ +#define _RESOLV_H_ + +#include +#include +#include +#include +#include + +/* + * Revision information. This is the release date in YYYYMMDD format. + * It can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__RES > 19931104)". Do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __RES 19960801 + +/* + * Resolver configuration file. + * Normally not present, but may contain the address of the + * inital name server(s) to query and the domain search list. + */ + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +/* + * Global defines and variables for resolver stub. + */ +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ + +#define RES_TIMEOUT 5 /* min. seconds between retries */ +#define MAXRESOLVSORT 10 /* number of net to sort on */ +#define RES_MAXNDOTS 15 /* should reflect bit field size */ + +struct __res_state { + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + u_long options; /* option flags - see below. */ + int nscount; /* number of name servers */ + struct sockaddr_in + nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + u_short id; /* current message id */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + char defdname[256]; /* default domain (deprecated) */ + u_long pfcode; /* RES_PRF_ flags - see below. */ + unsigned ndots:4; /* threshold for initial abs. query */ + unsigned nsort:4; /* number of elements in sort_list[] */ + char unused[3]; + struct { + struct in_addr addr; + u_int32_t mask; + } sort_list[MAXRESOLVSORT]; + char pad[72]; /* on an i386 this means 512b total */ +}; + +/* for INET6 */ +/* + * replacement of __res_state, separated to keep binary compatibility. + */ +struct __res_state_ext { + struct sockaddr_storage nsaddr_list[MAXNS]; + struct { + int af; /* address family for addr, mask */ + union { + struct in_addr ina; + struct in6_addr in6a; + } addr, mask; + } sort_list[MAXRESOLVSORT]; +}; + +/* + * Resolver options (keep these in synch with res_debug.c, please) + */ +#define RES_INIT 0x00000001 /* address initialized */ +#define RES_DEBUG 0x00000002 /* print debug messages */ +#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ +#define RES_USEVC 0x00000008 /* use virtual circuit */ +#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ +#define RES_IGNTC 0x00000020 /* ignore truncation errors */ +#define RES_RECURSE 0x00000040 /* recursion desired */ +#define RES_DEFNAMES 0x00000080 /* use default domain name */ +#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x00000200 /* search up local domain tree */ +#define RES_INSECURE1 0x00000400 /* type 1 security disabled */ +#define RES_INSECURE2 0x00000800 /* type 2 security disabled */ +#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ +#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ +#define RES_NOTLDQUERY 0x00004000 /* Don't query TLD names */ +/* KAME extensions: use higher bit to avoid conflict with ISC use */ +#define RES_USE_EDNS0 0x40000000 /* use EDNS0 */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x00000001 +#define RES_PRF_UPDATE 0x00000002 +#define RES_PRF_CLASS 0x00000004 +#define RES_PRF_CMD 0x00000008 +#define RES_PRF_QUES 0x00000010 +#define RES_PRF_ANS 0x00000020 +#define RES_PRF_AUTH 0x00000040 +#define RES_PRF_ADD 0x00000080 +#define RES_PRF_HEAD1 0x00000100 +#define RES_PRF_HEAD2 0x00000200 +#define RES_PRF_TTLID 0x00000400 +#define RES_PRF_HEADX 0x00000800 +#define RES_PRF_QUERY 0x00001000 +#define RES_PRF_REPLY 0x00002000 +#define RES_PRF_INIT 0x00004000 +/* 0x00008000 */ + +typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } + res_sendhookact; + +typedef res_sendhookact (*res_send_qhook)(struct sockaddr_in * const *ns, + const u_char **query, + int *querylen, + u_char *ans, + int anssiz, + int *resplen); + +typedef res_sendhookact (*res_send_rhook)(const struct sockaddr_in *ns, + const u_char *query, + int querylen, + u_char *ans, + int anssiz, + int *resplen); + +struct res_sym { + int number; /* Identifying number, like T_MX */ + char * name; /* Its symbolic name, like "MX" */ + char * humanname; /* Its fun name, like "mail exchanger" */ +}; + +extern struct __res_state _res; +/* for INET6 */ +extern struct __res_state_ext _res_ext; + +extern const struct res_sym __p_class_syms[]; +extern const struct res_sym __p_type_syms[]; + +/* Private routines shared between libc/net, named, nslookup and others. */ +#define res_hnok __res_hnok +#define res_ownok __res_ownok +#define res_mailok __res_mailok +#define res_dnok __res_dnok +#define sym_ston __sym_ston +#define sym_ntos __sym_ntos +#define sym_ntop __sym_ntop +#define b64_ntop __b64_ntop +#define b64_pton __b64_pton +#define loc_ntoa __loc_ntoa +#define loc_aton __loc_aton +#define fp_resstat __fp_resstat +#define p_query __p_query +#define dn_skipname __dn_skipname +#define fp_resstat __fp_resstat +#define fp_query __fp_query +#define fp_nquery __fp_nquery +#define hostalias __hostalias +#define putlong __putlong +#define putshort __putshort +#define p_class __p_class +#define p_time __p_time +#define p_type __p_type +#define p_query __p_query +#define p_cdnname __p_cdnname +#define p_section __p_section +#define p_cdname __p_cdname +#define p_fqnname __p_fqnname +#define p_fqname __p_fqname +#define p_option __p_option +#define p_secstodate __p_secstodate +#define dn_count_labels __dn_count_labels +#define dn_comp __dn_comp +#define dn_expand __dn_expand +#define res_init __res_init +#define res_randomid __res_randomid +#define res_query __res_query +#define res_search __res_search +#define res_querydomain __res_querydomain +#define res_mkquery __res_mkquery +#define res_send __res_send +#define res_isourserver __res_isourserver +#define res_nameinquery __res_nameinquery +#define res_queriesmatch __res_queriesmatch +#define res_close __res_close +#define res_opt __res_opt +#define res_mkupdate __res_mkupdate +#define res_mkupdrec __res_mkupdrec +#define res_freeupdrec __res_freeupdrec + +__BEGIN_DECLS +int res_hnok(const char *); +int res_ownok(const char *); +int res_mailok(const char *); +int res_dnok(const char *); +int sym_ston(const struct res_sym *, const char *, int *); +const char * sym_ntos(const struct res_sym *, int, int *); +const char * sym_ntop(const struct res_sym *, int, int *); +int b64_ntop(u_char const *, size_t, char *, size_t); +int b64_pton(char const *, u_char *, size_t); +int loc_aton(const char *, u_char *); +const char * loc_ntoa(const u_char *, char *); +int dn_skipname(const u_char *, const u_char *); +void fp_resstat(struct __res_state *, FILE *); +void fp_query(const u_char *, FILE *); +void fp_nquery(const u_char *, int, FILE *); +const char * hostalias(const char *); +void putlong(u_int32_t, u_char *); +void putshort(u_int16_t, u_char *); +const char * p_class(int); +const char * p_time(u_int32_t); +const char * p_type(int); +void p_query(const u_char *); +const u_char * p_cdnname(const u_char *, const u_char *, int, FILE *); +const u_char * p_cdname(const u_char *, const u_char *, FILE *); +const u_char * p_fqnname(const u_char *, const u_char *, + int, char *, int); +const u_char * p_fqname(const u_char *, const u_char *, FILE *); +const char * p_option(u_long); +char * p_secstodate(u_long); +int dn_count_labels(const char *); +int dn_comp(const char *, u_char *, int, u_char **, u_char **); +int dn_expand(const u_char *, const u_char *, const u_char *, + char *, int); +int res_init(void); +u_int res_randomid(void); +int res_query(const char *, int, int, u_char *, int); +int res_search(const char *, int, int, u_char *, int); +int res_querydomain(const char *, const char *, int, int, + u_char *, int); +int res_mkquery(int, const char *, int, int, const u_char *, + int, const u_char *, u_char *, int); +int res_send(const u_char *, int, u_char *, int); +int res_isourserver(const struct sockaddr_in *); +int res_nameinquery(const char *, int, int, + const u_char *, const u_char *); +int res_queriesmatch(const u_char *, const u_char *, + const u_char *, const u_char *); +void res_close(void); +int res_opt(int, u_char *, int, int); +const char * p_section(int, int); +/* XXX The following depend on the ns_updrec typedef in arpa/nameser.h */ +#ifdef _ARPA_NAMESER_H_ +int res_update(ns_updrec *); +int res_mkupdate(ns_updrec *, u_char *, int); +ns_updrec * res_mkupdrec(int, const char *, u_int, u_int, u_long); +void res_freeupdrec(ns_updrec *); +#endif +__END_DECLS + +#endif /* !_RESOLV_H_ */ diff --git a/newlib/libc/sys/linux/include/rpc/Makefile b/newlib/libc/sys/linux/include/rpc/Makefile new file mode 100644 index 000000000..43a762bfc --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/Makefile @@ -0,0 +1,37 @@ +# from: @(#)Makefile 2.3 88/08/11 4.0 RPCSRC +# $FreeBSD: src/include/rpc/Makefile,v 1.1 2001/03/19 12:49:46 alfred Exp $ + +.SUFFIXES: .x + +RPCCOM = rpcgen -C + +HDRS= rpcb_prot.h + +XFILES= rpcb_prot.x + +HFILES= auth.h auth_unix.h clnt.h clnt_soc.h clnt_stat.h \ + nettype.h pmap_clnt.h pmap_prot.h pmap_rmt.h raw.h \ + rpc.h rpc_msg.h rpcb_clnt.h rpcent.h rpc_com.h \ + svc.h svc_auth.h svc_soc.h svc_dg.h types.h xdr.h + +# Secure RPC +HFILES+= auth_des.h des.h des_crypt.h + +# Kerberos +HFILES+= auth_kerb.h + +CLEANFILES+= ${HDRS} + +all: ${HDRS} + +beforeinstall: + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${HFILES:S;^;${.CURDIR}/;} \ + ${XFILES:S;^;${.CURDIR}/;} \ + ${HDRS} \ + ${DESTDIR}/usr/include/rpc + +.x.h: + ${RPCCOM} -h -DWANT_NFS3 ${.IMPSRC} -o ${.TARGET} + +.include diff --git a/newlib/libc/sys/linux/include/rpc/auth.h b/newlib/libc/sys/linux/include/rpc/auth.h new file mode 100644 index 000000000..811814740 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/auth.h @@ -0,0 +1,356 @@ +/* $NetBSD: auth.h,v 1.15 2000/06/02 22:57:55 fvdl Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)auth.h 1.17 88/02/08 SMI + * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC + * from: @(#)auth.h 1.43 98/02/02 SMI + * $FreeBSD: src/include/rpc/auth.h,v 1.19 2002/03/23 17:24:55 imp Exp $ + */ + +/* + * auth.h, Authentication interface. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + * + * The data structures are completely opaque to the client. The client + * is required to pass a AUTH * to routines that create rpc + * "sessions". + */ + +#ifndef _RPC_AUTH_H +#define _RPC_AUTH_H +#include +#include +#include +#include + +#define MAX_AUTH_BYTES 400 +#define MAXNETNAMELEN 255 /* maximum length of network user's name */ + +/* + * Client side authentication/security data + */ + +typedef struct sec_data { + u_int secmod; /* security mode number e.g. in nfssec.conf */ + u_int rpcflavor; /* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */ + int flags; /* AUTH_F_xxx flags */ + caddr_t data; /* opaque data per flavor */ +} sec_data_t; + +#ifdef _SYSCALL32_IMPL +struct sec_data32 { + uint32_t secmod; /* security mode number e.g. in nfssec.conf */ + uint32_t rpcflavor; /* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */ + int32_t flags; /* AUTH_F_xxx flags */ + caddr32_t data; /* opaque data per flavor */ +}; +#endif /* _SYSCALL32_IMPL */ + +/* + * AUTH_DES flavor specific data from sec_data opaque data field. + * AUTH_KERB has the same structure. + */ +typedef struct des_clnt_data { + struct netbuf syncaddr; /* time sync addr */ + struct knetconfig *knconf; /* knetconfig info that associated */ + /* with the syncaddr. */ + char *netname; /* server's netname */ + int netnamelen; /* server's netname len */ +} dh_k4_clntdata_t; + +#ifdef _SYSCALL32_IMPL +struct des_clnt_data32 { + struct netbuf32 syncaddr; /* time sync addr */ + caddr32_t knconf; /* knetconfig info that associated */ + /* with the syncaddr. */ + caddr32_t netname; /* server's netname */ + int32_t netnamelen; /* server's netname len */ +}; +#endif /* _SYSCALL32_IMPL */ + +#ifdef KERBEROS +/* + * flavor specific data to hold the data for AUTH_DES/AUTH_KERB(v4) + * in sec_data->data opaque field. + */ +typedef struct krb4_svc_data { + int window; /* window option value */ +} krb4_svcdata_t; + +typedef struct krb4_svc_data des_svcdata_t; +#endif /* KERBEROS */ + +/* + * authentication/security specific flags + */ +#define AUTH_F_RPCTIMESYNC 0x001 /* use RPC to do time sync */ +#define AUTH_F_TRYNONE 0x002 /* allow fall back to AUTH_NONE */ + + +/* + * Status returned from authentication check + */ +enum auth_stat { + AUTH_OK=0, + /* + * failed at remote end + */ + AUTH_BADCRED=1, /* bogus credentials (seal broken) */ + AUTH_REJECTEDCRED=2, /* client should begin new session */ + AUTH_BADVERF=3, /* bogus verifier (seal broken) */ + AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ + AUTH_TOOWEAK=5, /* rejected due to security reasons */ + /* + * failed locally + */ + AUTH_INVALIDRESP=6, /* bogus response verifier */ + AUTH_FAILED=7 /* some unknown reason */ +#ifdef KERBEROS + /* + * kerberos errors + */ + , + AUTH_KERB_GENERIC = 8, /* kerberos generic error */ + AUTH_TIMEEXPIRE = 9, /* time of credential expired */ + AUTH_TKT_FILE = 10, /* something wrong with ticket file */ + AUTH_DECODE = 11, /* can't decode authenticator */ + AUTH_NET_ADDR = 12 /* wrong net address in ticket */ +#endif /* KERBEROS */ +}; + +union des_block { + struct { + uint32_t high; + uint32_t low; + } key; + char c[8]; +}; +typedef union des_block des_block; +__BEGIN_DECLS +extern bool_t xdr_des_block(XDR *, des_block *); +__END_DECLS + +/* + * Authentication info. Opaque to client. + */ +struct opaque_auth { + enum_t oa_flavor; /* flavor of auth */ + caddr_t oa_base; /* address of more auth stuff */ + u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ +}; + + +/* + * Auth handle, interface to client side authenticators. + */ +typedef struct __auth { + struct opaque_auth ah_cred; + struct opaque_auth ah_verf; + union des_block ah_key; + struct auth_ops { + void (*ah_nextverf) (struct __auth *); + /* nextverf & serialize */ + int (*ah_marshal) (struct __auth *, XDR *); + /* validate verifier */ + int (*ah_validate) (struct __auth *, + struct opaque_auth *); + /* refresh credentials */ + int (*ah_refresh) (struct __auth *, void *); + /* destroy this structure */ + void (*ah_destroy) (struct __auth *); + } *ah_ops; + void *ah_private; +} AUTH; + + +/* + * Authentication ops. + * The ops and the auth handle provide the interface to the authenticators. + * + * AUTH *auth; + * XDR *xdrs; + * struct opaque_auth verf; + */ +#define AUTH_NEXTVERF(auth) \ + ((*((auth)->ah_ops->ah_nextverf))(auth)) +#define auth_nextverf(auth) \ + ((*((auth)->ah_ops->ah_nextverf))(auth)) + +#define AUTH_MARSHALL(auth, xdrs) \ + ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) +#define auth_marshall(auth, xdrs) \ + ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) + +#define AUTH_VALIDATE(auth, verfp) \ + ((*((auth)->ah_ops->ah_validate))((auth), verfp)) +#define auth_validate(auth, verfp) \ + ((*((auth)->ah_ops->ah_validate))((auth), verfp)) + +#define AUTH_REFRESH(auth, msg) \ + ((*((auth)->ah_ops->ah_refresh))(auth, msg)) +#define auth_refresh(auth, msg) \ + ((*((auth)->ah_ops->ah_refresh))(auth, msg)) + +#define AUTH_DESTROY(auth) \ + ((*((auth)->ah_ops->ah_destroy))(auth)) +#define auth_destroy(auth) \ + ((*((auth)->ah_ops->ah_destroy))(auth)) + + +__BEGIN_DECLS +extern struct opaque_auth _null_auth; +__END_DECLS + +/* + * These are the various implementations of client side authenticators. + */ + +/* + * System style authentication + * AUTH *authunix_create(machname, uid, gid, len, aup_gids) + * char *machname; + * int uid; + * int gid; + * int len; + * int *aup_gids; + */ +__BEGIN_DECLS +extern AUTH *authunix_create(char *, int, int, int, + int *); +extern AUTH *authunix_create_default(void); /* takes no parameters */ +extern AUTH *authnone_create(void); /* takes no parameters */ +__END_DECLS +/* + * DES style authentication + * AUTH *authsecdes_create(servername, window, timehost, ckey) + * char *servername; - network name of server + * u_int window; - time to live + * const char *timehost; - optional hostname to sync with + * des_block *ckey; - optional conversation key to use + */ +__BEGIN_DECLS +extern AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *); +extern AUTH *authdes_seccreate (const char *, const u_int, const char *, + const des_block *); +__END_DECLS + +__BEGIN_DECLS +extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *); +__END_DECLS + +#define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip)) +#define authsys_create_default() authunix_create_default() + +/* + * Netname manipulation routines. + */ +__BEGIN_DECLS +extern int getnetname(char *); +extern int host2netname(char *, const char *, const char *); +extern int user2netname(char *, const uid_t, const char *); +extern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *); +extern int netname2host(char *, char *, const int); +extern void passwd2des ( char *, char * ); +__END_DECLS + +/* + * + * These routines interface to the keyserv daemon + * + */ +__BEGIN_DECLS +extern int key_decryptsession(const char *, des_block *); +extern int key_encryptsession(const char *, des_block *); +extern int key_gendes(des_block *); +extern int key_setsecret(const char *); +extern int key_secretkey_is_set(void); +__END_DECLS + +/* + * Publickey routines. + */ +__BEGIN_DECLS +extern int getpublickey (const char *, char *); +extern int getpublicandprivatekey (char *, char *); +extern int getsecretkey (char *, char *, char *); +__END_DECLS + +#ifdef KERBEROS +/* + * Kerberos style authentication + * AUTH *authkerb_seccreate(service, srv_inst, realm, window, timehost, status) + * const char *service; - service name + * const char *srv_inst; - server instance + * const char *realm; - server realm + * const u_int window; - time to live + * const char *timehost; - optional hostname to sync with + * int *status; - kerberos status returned + */ +__BEGIN_DECLS +extern AUTH *authkerb_seccreate(const char *, const char *, const char *, + const u_int, const char *, int *); +__END_DECLS + +/* + * Map a kerberos credential into a unix cred. + * + * authkerb_getucred(rqst, uid, gid, grouplen, groups) + * const struct svc_req *rqst; - request pointer + * uid_t *uid; + * gid_t *gid; + * short *grouplen; + * int *groups; + * + */ +__BEGIN_DECLS +extern int authkerb_getucred(/* struct svc_req *, uid_t *, gid_t *, + short *, int * */); +__END_DECLS +#endif /* KERBEROS */ + +__BEGIN_DECLS +struct svc_req; +struct rpc_msg; +enum auth_stat _svcauth_null (struct svc_req *, struct rpc_msg *); +enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *); +enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *); +__END_DECLS + +#define AUTH_NONE 0 /* no authentication */ +#define AUTH_NULL 0 /* backward compatibility */ +#define AUTH_SYS 1 /* unix style (uid, gids) */ +#define AUTH_UNIX AUTH_SYS +#define AUTH_SHORT 2 /* short hand unix style */ +#define AUTH_DH 3 /* for Diffie-Hellman mechanism */ +#define AUTH_DES AUTH_DH /* for backward compatibility */ +#define AUTH_KERB 4 /* kerberos style */ + +#endif /* !_RPC_AUTH_H */ diff --git a/newlib/libc/sys/linux/include/rpc/auth_des.h b/newlib/libc/sys/linux/include/rpc/auth_des.h new file mode 100644 index 000000000..24ef5d344 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/auth_des.h @@ -0,0 +1,126 @@ +/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */ +/* $FreeBSD: src/include/rpc/auth_des.h,v 1.3 2002/03/23 17:24:55 imp Exp $ */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC + * from: @(#)auth_des.h 1.14 94/04/25 SMI + */ + +/* + * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. + */ + +/* + * auth_des.h, Protocol for DES style authentication for RPC + */ + +#ifndef _AUTH_DES_ +#define _AUTH_DES_ + +/* + * There are two kinds of "names": fullnames and nicknames + */ +enum authdes_namekind { + ADN_FULLNAME, + ADN_NICKNAME +}; + +/* + * A fullname contains the network name of the client, + * a conversation key and the window + */ +struct authdes_fullname { + char *name; /* network name of client, up to MAXNETNAMELEN */ + des_block key; /* conversation key */ + u_long window; /* associated window */ +}; + + +/* + * A credential + */ +struct authdes_cred { + enum authdes_namekind adc_namekind; + struct authdes_fullname adc_fullname; + u_long adc_nickname; +}; + + + +/* + * A des authentication verifier + */ +struct authdes_verf { + union { + struct timeval adv_ctime; /* clear time */ + des_block adv_xtime; /* crypt time */ + } adv_time_u; + u_long adv_int_u; +}; + +/* + * des authentication verifier: client variety + * + * adv_timestamp is the current time. + * adv_winverf is the credential window + 1. + * Both are encrypted using the conversation key. + */ +#define adv_timestamp adv_time_u.adv_ctime +#define adv_xtimestamp adv_time_u.adv_xtime +#define adv_winverf adv_int_u + +/* + * des authentication verifier: server variety + * + * adv_timeverf is the client's timestamp + client's window + * adv_nickname is the server's nickname for the client. + * adv_timeverf is encrypted using the conversation key. + */ +#define adv_timeverf adv_time_u.adv_ctime +#define adv_xtimeverf adv_time_u.adv_xtime +#define adv_nickname adv_int_u + +/* + * Map a des credential into a unix cred. + * + */ +__BEGIN_DECLS +extern int authdes_getucred( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * ); +__END_DECLS + +__BEGIN_DECLS +extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *); +extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *); +extern int rtime(dev_t, struct netbuf *, int, struct timeval *, + struct timeval *); +extern void kgetnetname(char *); +extern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *); +__END_DECLS + +#endif /* ndef _AUTH_DES_ */ diff --git a/newlib/libc/sys/linux/include/rpc/auth_kerb.h b/newlib/libc/sys/linux/include/rpc/auth_kerb.h new file mode 100644 index 000000000..b686b7883 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/auth_kerb.h @@ -0,0 +1,143 @@ +/* $FreeBSD: src/include/rpc/auth_kerb.h,v 1.1 2001/03/19 12:49:46 alfred Exp $ */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * auth_kerb.h, Protocol for Kerberos style authentication for RPC + * + * Copyright (C) 1986, Sun Microsystems, Inc. + */ + +#ifndef _RPC_AUTH_KERB_H +#define _RPC_AUTH_KERB_H + +#ifdef KERBEROS + +#pragma ident "@(#)auth_kerb.h 1.10 94/04/25 SMI" + +#include +#include +#include +#include +#include + +/* + * There are two kinds of "names": fullnames and nicknames + */ +enum authkerb_namekind { + AKN_FULLNAME, + AKN_NICKNAME +}; +/* + * A fullname contains the ticket and the window + */ +struct authkerb_fullname { + KTEXT_ST ticket; + u_long window; /* associated window */ +}; + +/* + * cooked credential stored in rq_clntcred + */ +struct authkerb_clnt_cred { + /* start of AUTH_DAT */ + unsigned char k_flags; /* Flags from ticket */ + char pname[ANAME_SZ]; /* Principal's name */ + char pinst[INST_SZ]; /* His Instance */ + char prealm[REALM_SZ]; /* His Realm */ + unsigned long checksum; /* Data checksum (opt) */ + C_Block session; /* Session Key */ + int life; /* Life of ticket */ + unsigned long time_sec; /* Time ticket issued */ + unsigned long address; /* Address in ticket */ + /* KTEXT_ST reply; Auth reply (opt) */ + /* end of AUTH_DAT */ + unsigned long expiry; /* time the ticket is expiring */ + u_long nickname; /* Nickname into cache */ + u_long window; /* associated window */ +}; + +typedef struct authkerb_clnt_cred authkerb_clnt_cred; + +/* + * A credential + */ +struct authkerb_cred { + enum authkerb_namekind akc_namekind; + struct authkerb_fullname akc_fullname; + u_long akc_nickname; +}; + +/* + * A kerb authentication verifier + */ +struct authkerb_verf { + union { + struct timeval akv_ctime; /* clear time */ + des_block akv_xtime; /* crypt time */ + } akv_time_u; + u_long akv_int_u; +}; + +/* + * des authentication verifier: client variety + * + * akv_timestamp is the current time. + * akv_winverf is the credential window + 1. + * Both are encrypted using the conversation key. + */ +#ifndef akv_timestamp +#define akv_timestamp akv_time_u.akv_ctime +#define akv_xtimestamp akv_time_u.akv_xtime +#define akv_winverf akv_int_u +#endif +/* + * des authentication verifier: server variety + * + * akv_timeverf is the client's timestamp + client's window + * akv_nickname is the server's nickname for the client. + * akv_timeverf is encrypted using the conversation key. + */ +#ifndef akv_timeverf +#define akv_timeverf akv_time_u.akv_ctime +#define akv_xtimeverf akv_time_u.akv_xtime +#define akv_nickname akv_int_u +#endif + +/* + * Register the service name, instance and realm. + */ +extern int authkerb_create(char *, char *, char *, u_int, + struct netbuf *, int *, dev_t, int, AUTH **); +extern bool_t xdr_authkerb_cred(XDR *, struct authkerb_cred *); +extern bool_t xdr_authkerb_verf(XDR *, struct authkerb_verf *); +extern int svc_kerb_reg(SVCXPRT *, char *, char *, char *); +extern enum auth_stat _svcauth_kerb(struct svc_req *, struct rpc_msg *); + +#endif KERBEROS +#endif /* !_RPC_AUTH_KERB_H */ diff --git a/newlib/libc/sys/linux/include/rpc/auth_unix.h b/newlib/libc/sys/linux/include/rpc/auth_unix.h new file mode 100644 index 000000000..721a5c942 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/auth_unix.h @@ -0,0 +1,84 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)auth_unix.h 1.8 88/02/08 SMI + * from: @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/auth_unix.h,v 1.11 2002/03/23 17:24:55 imp Exp $ + */ + +/* + * auth_unix.h, Protocol for UNIX style authentication parameters for RPC + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* + * The system is very weak. The client uses no encryption for it + * credentials and only sends null verifiers. The server sends backs + * null verifiers or optionally a verifier that suggests a new short hand + * for the credentials. + */ + +#ifndef _RPC_AUTH_UNIX_H +#define _RPC_AUTH_UNIX_H +#include + +/* The machine name is part of a credential; it may not exceed 255 bytes */ +#define MAX_MACHINE_NAME 255 + +/* gids compose part of a credential; there may not be more than 16 of them */ +#define NGRPS 16 + +/* + * Unix style credentials. + */ +struct authunix_parms { + u_long aup_time; + char *aup_machname; + int aup_uid; + int aup_gid; + u_int aup_len; + int *aup_gids; +}; + +#define authsys_parms authunix_parms + +__BEGIN_DECLS +extern bool_t xdr_authunix_parms(XDR *, struct authunix_parms *); +__END_DECLS + +/* + * If a response verifier has flavor AUTH_SHORT, + * then the body of the response verifier encapsulates the following structure; + * again it is serialized in the obvious fashion. + */ +struct short_hand_verf { + struct opaque_auth new_cred; +}; + +#endif /* !_RPC_AUTH_UNIX_H */ diff --git a/newlib/libc/sys/linux/include/rpc/clnt.h b/newlib/libc/sys/linux/include/rpc/clnt.h new file mode 100644 index 000000000..9a23404c3 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/clnt.h @@ -0,0 +1,504 @@ +/* $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)clnt.h 1.31 94/04/29 SMI + * from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/clnt.h,v 1.17 2002/04/28 15:18:45 des Exp $ + */ + +/* + * clnt.h - Client side remote procedure call interface. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_CLNT_H_ +#define _RPC_CLNT_H_ +#include +#include +#include +#include + +/* + * Well-known IPV6 RPC broadcast address. + */ +#define RPCB_MULTICAST_ADDR "ff02::202" + +/* + * the following errors are in general unrecoverable. The caller + * should give up rather than retry. + */ +#define IS_UNRECOVERABLE_RPC(s) (((s) == RPC_AUTHERROR) || \ + ((s) == RPC_CANTENCODEARGS) || \ + ((s) == RPC_CANTDECODERES) || \ + ((s) == RPC_VERSMISMATCH) || \ + ((s) == RPC_PROCUNAVAIL) || \ + ((s) == RPC_PROGUNAVAIL) || \ + ((s) == RPC_PROGVERSMISMATCH) || \ + ((s) == RPC_CANTDECODEARGS)) + +/* + * Error info. + */ +struct rpc_err { + enum clnt_stat re_status; + union { + int RE_errno; /* related system error */ + enum auth_stat RE_why; /* why the auth error occurred */ + struct { + rpcvers_t low; /* lowest version supported */ + rpcvers_t high; /* highest version supported */ + } RE_vers; + struct { /* maybe meaningful if RPC_FAILED */ + int32_t s1; + int32_t s2; + } RE_lb; /* life boot & debugging only */ + } ru; +#define re_errno ru.RE_errno +#define re_why ru.RE_why +#define re_vers ru.RE_vers +#define re_lb ru.RE_lb +}; + + +/* + * Client rpc handle. + * Created by individual implementations + * Client is responsible for initializing auth, see e.g. auth_none.c. + */ +typedef struct __rpc_client { + AUTH *cl_auth; /* authenticator */ + struct clnt_ops { + /* call remote procedure */ + enum clnt_stat (*cl_call)(struct __rpc_client *, + rpcproc_t, xdrproc_t, void *, xdrproc_t, + void *, struct timeval); + /* abort a call */ + void (*cl_abort)(struct __rpc_client *); + /* get specific error code */ + void (*cl_geterr)(struct __rpc_client *, + struct rpc_err *); + /* frees results */ + bool_t (*cl_freeres)(struct __rpc_client *, + xdrproc_t, void *); + /* destroy this structure */ + void (*cl_destroy)(struct __rpc_client *); + /* the ioctl() of rpc */ + bool_t (*cl_control)(struct __rpc_client *, u_int, + void *); + } *cl_ops; + void *cl_private; /* private stuff */ + char *cl_netid; /* network token */ + char *cl_tp; /* device name */ +} CLIENT; + + +/* + * Timers used for the pseudo-transport protocol when using datagrams + */ +struct rpc_timers { + u_short rt_srtt; /* smoothed round-trip time */ + u_short rt_deviate; /* estimated deviation */ + u_long rt_rtxcur; /* current (backed-off) rto */ +}; + +/* + * Feedback values used for possible congestion and rate control + */ +#define FEEDBACK_REXMIT1 1 /* first retransmit */ +#define FEEDBACK_OK 2 /* no retransmits */ + +/* Used to set version of portmapper used in broadcast */ + +#define CLCR_SET_LOWVERS 3 +#define CLCR_GET_LOWVERS 4 + +#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ + +/* + * client side rpc interface ops + * + * Parameter types are: + * + */ + +/* + * enum clnt_stat + * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) + * CLIENT *rh; + * rpcproc_t proc; + * xdrproc_t xargs; + * void *argsp; + * xdrproc_t xres; + * void *resp; + * struct timeval timeout; + */ +#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \ + argsp, xres, resp, secs)) +#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \ + argsp, xres, resp, secs)) + +/* + * void + * CLNT_ABORT(rh); + * CLIENT *rh; + */ +#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) +#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) + +/* + * struct rpc_err + * CLNT_GETERR(rh); + * CLIENT *rh; + */ +#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) +#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) + + +/* + * bool_t + * CLNT_FREERES(rh, xres, resp); + * CLIENT *rh; + * xdrproc_t xres; + * void *resp; + */ +#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) +#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) + +/* + * bool_t + * CLNT_CONTROL(cl, request, info) + * CLIENT *cl; + * u_int request; + * char *info; + */ +#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) +#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) + +/* + * control operations that apply to both udp and tcp transports + */ +#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ +#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ +#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ +#define CLGET_FD 6 /* get connections file descriptor */ +#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */ +#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ +#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ +#define CLGET_XID 10 /* Get xid */ +#define CLSET_XID 11 /* Set xid */ +#define CLGET_VERS 12 /* Get version number */ +#define CLSET_VERS 13 /* Set version number */ +#define CLGET_PROG 14 /* Get program number */ +#define CLSET_PROG 15 /* Set program number */ +#define CLSET_SVC_ADDR 16 /* get server's address (netbuf) */ +#define CLSET_PUSH_TIMOD 17 /* push timod if not already present */ +#define CLSET_POP_TIMOD 18 /* pop timod */ +/* + * Connectionless only control operations + */ +#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ +#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ +#define CLSET_ASYNC 19 +#define CLSET_CONNECT 20 /* Use connect() for UDP. (int) */ + +/* + * void + * CLNT_DESTROY(rh); + * CLIENT *rh; + */ +#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) +#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) + + +/* + * RPCTEST is a test program which is accessible on every rpc + * transport/port. It is used for testing, performance evaluation, + * and network administration. + */ + +#define RPCTEST_PROGRAM ((rpcprog_t)1) +#define RPCTEST_VERSION ((rpcvers_t)1) +#define RPCTEST_NULL_PROC ((rpcproc_t)2) +#define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3) + +/* + * By convention, procedure 0 takes null arguments and returns them + */ + +#define NULLPROC ((rpcproc_t)0) + +/* + * Below are the client handle creation routines for the various + * implementations of client side rpc. They can return NULL if a + * creation failure occurs. + */ + +/* + * Generic client creation routine. Supported protocols are those that + * belong to the nettype namespace (/etc/netconfig). + * CLIENT * + * clnt_create(host, prog, vers, prot); + * const char *host; -- hostname + * const rpcprog_t prog; -- program number + * const rpcvers_t vers; -- version number + * const char *prot; -- protocol + */ +__BEGIN_DECLS +extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t, + const char *); +/* + * + * const char *hostname; -- hostname + * const rpcprog_t prog; -- program number + * const rpcvers_t vers; -- version number + * const char *nettype; -- network type + */ + +/* + * Generic client creation routine. Supported protocols are which belong + * to the nettype name space. + */ +extern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *, + const rpcvers_t, const rpcvers_t, + const char *); +/* + * const char *host; -- hostname + * const rpcprog_t prog; -- program number + * rpcvers_t *vers_out; -- servers highest available version + * const rpcvers_t vers_low; -- low version number + * const rpcvers_t vers_high; -- high version number + * const char *nettype; -- network type + */ + + +/* + * Generic client creation routine. It takes a netconfig structure + * instead of nettype + */ +extern CLIENT *clnt_tp_create(const char *, const rpcprog_t, + const rpcvers_t, const struct netconfig *); +/* + * const char *hostname; -- hostname + * const rpcprog_t prog; -- program number + * const rpcvers_t vers; -- version number + * const struct netconfig *netconf; -- network config structure + */ + +/* + * Generic TLI create routine. Only provided for compatibility. + */ + +extern CLIENT *clnt_tli_create(const int, const struct netconfig *, + const struct netbuf *, const rpcprog_t, + const rpcvers_t, const u_int, const u_int); +/* + * const register int fd; -- fd + * const struct netconfig *nconf; -- netconfig structure + * const struct netbuf *svcaddr; -- servers address + * const u_long prog; -- program number + * const u_long vers; -- version number + * const u_int sendsz; -- send size + * const u_int recvsz; -- recv size + */ + +/* + * Low level clnt create routine for connectionful transports, e.g. tcp. + */ +extern CLIENT *clnt_vc_create(const int, const struct netbuf *, + const rpcprog_t, const rpcvers_t, + const u_int, const u_int); +/* + * Added for compatibility to old rpc 4.0. Obsoleted by clnt_vc_create(). + */ +extern CLIENT *clntunix_create(struct sockaddr_un *, + u_long, u_long, int *, u_int, u_int); +/* + * const int fd; -- open file descriptor + * const struct netbuf *svcaddr; -- servers address + * const rpcprog_t prog; -- program number + * const rpcvers_t vers; -- version number + * const u_int sendsz; -- buffer recv size + * const u_int recvsz; -- buffer send size + */ + +/* + * Low level clnt create routine for connectionless transports, e.g. udp. + */ +extern CLIENT *clnt_dg_create(const int, const struct netbuf *, + const rpcprog_t, const rpcvers_t, + const u_int, const u_int); +/* + * const int fd; -- open file descriptor + * const struct netbuf *svcaddr; -- servers address + * const rpcprog_t program; -- program number + * const rpcvers_t version; -- version number + * const u_int sendsz; -- buffer recv size + * const u_int recvsz; -- buffer send size + */ + +/* + * Memory based rpc (for speed check and testing) + * CLIENT * + * clnt_raw_create(prog, vers) + * u_long prog; + * u_long vers; + */ +extern CLIENT *clnt_raw_create(rpcprog_t, rpcvers_t); + +__END_DECLS + + +/* + * Print why creation failed + */ +__BEGIN_DECLS +extern void clnt_pcreateerror(const char *); /* stderr */ +extern char *clnt_spcreateerror(const char *); /* string */ +__END_DECLS + +/* + * Like clnt_perror(), but is more verbose in its output + */ +__BEGIN_DECLS +extern void clnt_perrno(enum clnt_stat); /* stderr */ +extern char *clnt_sperrno(enum clnt_stat); /* string */ +__END_DECLS + +/* + * Print an English error message, given the client error code + */ +__BEGIN_DECLS +extern void clnt_perror(CLIENT *, const char *); /* stderr */ +extern char *clnt_sperror(CLIENT *, const char *); /* string */ +__END_DECLS + + +/* + * If a creation fails, the following allows the user to figure out why. + */ +struct rpc_createerr { + enum clnt_stat cf_stat; + struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ +}; + +#ifdef _THREAD_SAFE +__BEGIN_DECLS +extern struct rpc_createerr *__rpc_createerr(void); +__END_DECLS +#define rpc_createerr (*(__rpc_createerr())) +#else +extern struct rpc_createerr rpc_createerr; +#endif /* _THREAD_SAFE */ + +/* + * The simplified interface: + * enum clnt_stat + * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype) + * const char *host; + * const rpcprog_t prognum; + * const rpcvers_t versnum; + * const rpcproc_t procnum; + * const xdrproc_t inproc, outproc; + * const char *in; + * char *out; + * const char *nettype; + */ +__BEGIN_DECLS +extern enum clnt_stat rpc_call(const char *, const rpcprog_t, + const rpcvers_t, const rpcproc_t, + const xdrproc_t, const char *, + const xdrproc_t, char *, const char *); +__END_DECLS + +/* + * RPC broadcast interface + * The call is broadcasted to all locally connected nets. + * + * extern enum clnt_stat + * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, + * eachresult, nettype) + * const rpcprog_t prog; -- program number + * const rpcvers_t vers; -- version number + * const rpcproc_t proc; -- procedure number + * const xdrproc_t xargs; -- xdr routine for args + * caddr_t argsp; -- pointer to args + * const xdrproc_t xresults; -- xdr routine for results + * caddr_t resultsp; -- pointer to results + * const resultproc_t eachresult; -- call with each result + * const char *nettype; -- Transport type + * + * For each valid response received, the procedure eachresult is called. + * Its form is: + * done = eachresult(resp, raddr, nconf) + * bool_t done; + * caddr_t resp; + * struct netbuf *raddr; + * struct netconfig *nconf; + * where resp points to the results of the call and raddr is the + * address if the responder to the broadcast. nconf is the transport + * on which the response was received. + * + * extern enum clnt_stat + * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp, + * eachresult, inittime, waittime, nettype) + * const rpcprog_t prog; -- program number + * const rpcvers_t vers; -- version number + * const rpcproc_t proc; -- procedure number + * const xdrproc_t xargs; -- xdr routine for args + * caddr_t argsp; -- pointer to args + * const xdrproc_t xresults; -- xdr routine for results + * caddr_t resultsp; -- pointer to results + * const resultproc_t eachresult; -- call with each result + * const int inittime; -- how long to wait initially + * const int waittime; -- maximum time to wait + * const char *nettype; -- Transport type + */ + +typedef bool_t (*resultproc_t)(caddr_t, ...); + +__BEGIN_DECLS +extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t, + const rpcproc_t, const xdrproc_t, + caddr_t, const xdrproc_t, caddr_t, + const resultproc_t, const char *); +extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t, + const rpcproc_t, const xdrproc_t, + caddr_t, const xdrproc_t, caddr_t, + const resultproc_t, const int, + const int, const char *); +__END_DECLS + +/* For backward compatibility */ +#include + +#endif /* !_RPC_CLNT_H_ */ diff --git a/newlib/libc/sys/linux/include/rpc/clnt_soc.h b/newlib/libc/sys/linux/include/rpc/clnt_soc.h new file mode 100644 index 000000000..338d28fbd --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/clnt_soc.h @@ -0,0 +1,106 @@ +/* $NetBSD: clnt_soc.h,v 1.1 2000/06/02 22:57:55 fvdl Exp $ */ +/* $FreeBSD: src/include/rpc/clnt_soc.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc. + */ + +/* + * clnt.h - Client side remote procedure call interface. + */ + +#ifndef _RPC_CLNT_SOC_H +#define _RPC_CLNT_SOC_H + +/* derived from clnt_soc.h 1.3 88/12/17 SMI */ + +/* + * All the following declarations are only for backward compatibility + * with TS-RPC. + */ + +#include + +#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ + +/* + * TCP based rpc + * CLIENT * + * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) + * struct sockaddr_in *raddr; + * u_long prog; + * u_long version; + * register int *sockp; + * u_int sendsz; + * u_int recvsz; + */ +__BEGIN_DECLS +extern CLIENT *clnttcp_create(struct sockaddr_in *, u_long, u_long, int *, + u_int, u_int); +__END_DECLS + +/* + * Raw (memory) rpc. + */ +__BEGIN_DECLS +extern CLIENT *clntraw_create(u_long, u_long); +__END_DECLS + + +/* + * UDP based rpc. + * CLIENT * + * clntudp_create(raddr, program, version, wait, sockp) + * struct sockaddr_in *raddr; + * u_long program; + * u_long version; + * struct timeval wait; + * int *sockp; + * + * Same as above, but you specify max packet sizes. + * CLIENT * + * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) + * struct sockaddr_in *raddr; + * u_long program; + * u_long version; + * struct timeval wait; + * int *sockp; + * u_int sendsz; + * u_int recvsz; + */ +__BEGIN_DECLS +extern CLIENT *clntudp_create(struct sockaddr_in *, u_long, u_long, + struct timeval, int *); +extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, u_long, u_long, + struct timeval, int *, u_int, u_int); +__END_DECLS + +#endif /* _RPC_CLNT_SOC_H */ diff --git a/newlib/libc/sys/linux/include/rpc/clnt_stat.h b/newlib/libc/sys/linux/include/rpc/clnt_stat.h new file mode 100644 index 000000000..397bdbc59 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/clnt_stat.h @@ -0,0 +1,83 @@ +/* $FreeBSD: src/include/rpc/clnt_stat.h,v 1.2 2001/03/20 08:20:50 alfred Exp $ */ +/* + * Copyright (c) 1986 - 1991, 1994, 1996, 1997 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * clnt_stat.h - Client side remote procedure call enum + * + */ + +#ifndef _RPC_CLNT_STAT_H +#define _RPC_CLNT_STAT_H + +/* #pragma ident "@(#)clnt_stat.h 1.2 97/04/28 SMI" */ + +#ifdef __cplusplus +extern "C" { +#endif + +enum clnt_stat { + RPC_SUCCESS = 0, /* call succeeded */ + /* + * local errors + */ + RPC_CANTENCODEARGS = 1, /* can't encode arguments */ + RPC_CANTDECODERES = 2, /* can't decode results */ + RPC_CANTSEND = 3, /* failure in sending call */ + RPC_CANTRECV = 4, + /* failure in receiving result */ + RPC_TIMEDOUT = 5, /* call timed out */ + RPC_INTR = 18, /* call interrupted */ + RPC_UDERROR = 23, /* recv got uderr indication */ + /* + * remote errors + */ + RPC_VERSMISMATCH = 6, /* rpc versions not compatible */ + RPC_AUTHERROR = 7, /* authentication error */ + RPC_PROGUNAVAIL = 8, /* program not available */ + RPC_PROGVERSMISMATCH = 9, /* program version mismatched */ + RPC_PROCUNAVAIL = 10, /* procedure unavailable */ + RPC_CANTDECODEARGS = 11, /* decode arguments error */ + RPC_SYSTEMERROR = 12, /* generic "other problem" */ + + /* + * rpc_call & clnt_create errors + */ + RPC_UNKNOWNHOST = 13, /* unknown host name */ + RPC_UNKNOWNPROTO = 17, /* unknown protocol */ + RPC_UNKNOWNADDR = 19, /* Remote address unknown */ + RPC_NOBROADCAST = 21, /* Broadcasting not supported */ + + /* + * rpcbind errors + */ + RPC_RPCBFAILURE = 14, /* the pmapper failed in its call */ +#define RPC_PMAPFAILURE RPC_RPCBFAILURE + RPC_PROGNOTREGISTERED = 15, /* remote program is not registered */ + RPC_N2AXLATEFAILURE = 22, + /* Name to address translation failed */ + /* + * Misc error in the TLI library + */ + RPC_TLIERROR = 20, + /* + * unspecified error + */ + RPC_FAILED = 16, + /* + * asynchronous errors + */ + RPC_INPROGRESS = 24, + RPC_STALERACHANDLE = 25, + RPC_CANTCONNECT = 26, /* couldn't make connection (cots) */ + RPC_XPRTFAILED = 27, /* received discon from remote (cots) */ + RPC_CANTCREATESTREAM = 28 /* can't push rpc module (cots) */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* !_RPC_CLNT_STAT_H */ diff --git a/newlib/libc/sys/linux/include/rpc/des.h b/newlib/libc/sys/linux/include/rpc/des.h new file mode 100644 index 000000000..385afde07 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/des.h @@ -0,0 +1,83 @@ +/* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ +/* $FreeBSD: src/include/rpc/des.h,v 1.4 2002/03/23 17:24:55 imp Exp $ */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Generic DES driver interface + * Keep this file hardware independent! + * Copyright (c) 1986 by Sun Microsystems, Inc. + */ + +#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */ +#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */ + +enum desdir { ENCRYPT, DECRYPT }; +enum desmode { CBC, ECB }; + +/* + * parameters to ioctl call + */ +struct desparams { + u_char des_key[8]; /* key (with low bit parity) */ + enum desdir des_dir; /* direction */ + enum desmode des_mode; /* mode */ + u_char des_ivec[8]; /* input vector */ + unsigned des_len; /* number of bytes to crypt */ + union { + u_char UDES_data[DES_QUICKLEN]; + u_char *UDES_buf; + } UDES; +# define des_data UDES.UDES_data /* direct data here if quick */ +# define des_buf UDES.UDES_buf /* otherwise, pointer to data */ +}; + +#ifdef notdef + +/* + * These ioctls are only implemented in SunOS. Maybe someday + * if somebody writes a driver for DES hardware that works + * with FreeBSD, we can being that back. + */ + +/* + * Encrypt an arbitrary sized buffer + */ +#define DESIOCBLOCK _IOWR('d', 6, struct desparams) + +/* + * Encrypt of small amount of data, quickly + */ +#define DESIOCQUICK _IOWR('d', 7, struct desparams) + +#endif + +/* + * Software DES. + */ +extern int _des_crypt( char *, int, struct desparams * ); diff --git a/newlib/libc/sys/linux/include/rpc/des_crypt.h b/newlib/libc/sys/linux/include/rpc/des_crypt.h new file mode 100644 index 000000000..eb166eded --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/des_crypt.h @@ -0,0 +1,106 @@ +/* + * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI + * $FreeBSD: src/include/rpc/des_crypt.h,v 1.4 2002/03/23 17:24:55 imp Exp $ + * + * des_crypt.h, des library routine interface + * Copyright (C) 1986, Sun Microsystems, Inc. + */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. + */ + +/* + * des_crypt.h, des library routine interface + */ + +#ifndef _DES_DES_CRYPT_H +#define _DES_DES_CRYPT_H + +#include +#include + +#define DES_MAXDATA 8192 /* max bytes encrypted in one call */ +#define DES_DIRMASK (1 << 0) +#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */ +#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */ + + +#define DES_DEVMASK (1 << 1) +#define DES_HW (0*DES_DEVMASK) /* Use hardware device */ +#define DES_SW (1*DES_DEVMASK) /* Use software device */ + + +#define DESERR_NONE 0 /* succeeded */ +#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */ +#define DESERR_HWERROR 2 /* failed, hardware/driver error */ +#define DESERR_BADPARAM 3 /* failed, bad parameter to call */ + +#define DES_FAILED(err) \ + ((err) > DESERR_NOHWDEVICE) + +/* + * cbc_crypt() + * ecb_crypt() + * + * Encrypt (or decrypt) len bytes of a buffer buf. + * The length must be a multiple of eight. + * The key should have odd parity in the low bit of each byte. + * ivec is the input vector, and is updated to the new one (cbc only). + * The mode is created by oring together the appropriate parameters. + * DESERR_NOHWDEVICE is returned if DES_HW was specified but + * there was no hardware to do it on (the data will still be + * encrypted though, in software). + */ + + +/* + * Cipher Block Chaining mode + */ +__BEGIN_DECLS +int cbc_crypt( char *, char *, unsigned int, unsigned int, char *); +__END_DECLS + +/* + * Electronic Code Book mode + */ +__BEGIN_DECLS +int ecb_crypt( char *, char *, unsigned int, unsigned int ); +__END_DECLS + +/* + * Set des parity for a key. + * DES parity is odd and in the low bit of each byte + */ +__BEGIN_DECLS +void des_setparity( char *); +__END_DECLS + +#endif /* _DES_DES_CRYPT_H */ diff --git a/newlib/libc/sys/linux/include/rpc/nettype.h b/newlib/libc/sys/linux/include/rpc/nettype.h new file mode 100644 index 000000000..b18dc49fe --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/nettype.h @@ -0,0 +1,64 @@ +/* $NetBSD: nettype.h,v 1.2 2000/07/06 03:17:19 christos Exp $ */ +/* $FreeBSD: src/include/rpc/nettype.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. + */ + +/* + * nettype.h, Nettype definitions. + * All for the topmost layer of rpc + * + */ + +#ifndef _RPC_NETTYPE_H +#define _RPC_NETTYPE_H + +#include + +#define _RPC_NONE 0 +#define _RPC_NETPATH 1 +#define _RPC_VISIBLE 2 +#define _RPC_CIRCUIT_V 3 +#define _RPC_DATAGRAM_V 4 +#define _RPC_CIRCUIT_N 5 +#define _RPC_DATAGRAM_N 6 +#define _RPC_TCP 7 +#define _RPC_UDP 8 + +__BEGIN_DECLS +extern void *__rpc_setconf(const char *); +extern void __rpc_endconf(void *); +extern struct netconfig *__rpc_getconf(void *); +extern struct netconfig *__rpc_getconfip(const char *); +__END_DECLS + +#endif /* !_RPC_NETTYPE_H */ diff --git a/newlib/libc/sys/linux/include/rpc/pmap_clnt.h b/newlib/libc/sys/linux/include/rpc/pmap_clnt.h new file mode 100644 index 000000000..e6333c7c7 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/pmap_clnt.h @@ -0,0 +1,86 @@ +/* $NetBSD: pmap_clnt.h,v 1.9 2000/06/02 22:57:55 fvdl Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)pmap_clnt.h 1.11 88/02/08 SMI + * from: @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/pmap_clnt.h,v 1.14 2002/04/28 15:18:45 des Exp $ + */ + +/* + * pmap_clnt.h + * Supplies C routines to get to portmap services. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* + * Usage: + * success = pmap_set(program, version, protocol, port); + * success = pmap_unset(program, version); + * port = pmap_getport(address, program, version, protocol); + * head = pmap_getmaps(address); + * clnt_stat = pmap_rmtcall(address, program, version, procedure, + * xdrargs, argsp, xdrres, resp, tout, port_ptr) + * (works for udp only.) + * clnt_stat = clnt_broadcast(program, version, procedure, + * xdrargs, argsp, xdrres, resp, eachresult) + * (like pmap_rmtcall, except the call is broadcasted to all + * locally connected nets. For each valid response received, + * the procedure eachresult is called. Its form is: + * done = eachresult(resp, raddr) + * bool_t done; + * caddr_t resp; + * struct sockaddr_in raddr; + * where resp points to the results of the call and raddr is the + * address if the responder to the broadcast. + */ + +#ifndef _RPC_PMAP_CLNT_H_ +#define _RPC_PMAP_CLNT_H_ +#include + +__BEGIN_DECLS +extern bool_t pmap_set(u_long, u_long, int, int); +extern bool_t pmap_unset(u_long, u_long); +extern struct pmaplist *pmap_getmaps(struct sockaddr_in *); +extern enum clnt_stat pmap_rmtcall(struct sockaddr_in *, + u_long, u_long, u_long, + xdrproc_t, caddr_t, + xdrproc_t, caddr_t, + struct timeval, u_long *); +extern enum clnt_stat clnt_broadcast(u_long, u_long, u_long, + xdrproc_t, void *, + xdrproc_t, void *, + resultproc_t); +extern u_short pmap_getport(struct sockaddr_in *, + u_long, u_long, u_int); +__END_DECLS + +#endif /* !_RPC_PMAP_CLNT_H_ */ diff --git a/newlib/libc/sys/linux/include/rpc/pmap_prot.h b/newlib/libc/sys/linux/include/rpc/pmap_prot.h new file mode 100644 index 000000000..d83049943 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/pmap_prot.h @@ -0,0 +1,107 @@ +/* $NetBSD: pmap_prot.h,v 1.8 2000/06/02 22:57:55 fvdl Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)pmap_prot.h 1.14 88/02/08 SMI + * from: @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/pmap_prot.h,v 1.12 2002/03/23 17:24:55 imp Exp $ + */ + +/* + * pmap_prot.h + * Protocol for the local binder service, or pmap. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + * + * The following procedures are supported by the protocol: + * + * PMAPPROC_NULL() returns () + * takes nothing, returns nothing + * + * PMAPPROC_SET(struct pmap) returns (bool_t) + * TRUE is success, FALSE is failure. Registers the tuple + * [prog, vers, prot, port]. + * + * PMAPPROC_UNSET(struct pmap) returns (bool_t) + * TRUE is success, FALSE is failure. Un-registers pair + * [prog, vers]. prot and port are ignored. + * + * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). + * 0 is failure. Otherwise returns the port number where the pair + * [prog, vers] is registered. It may lie! + * + * PMAPPROC_DUMP() RETURNS (struct pmaplist *) + * + * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) + * RETURNS (port, string<>); + * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); + * Calls the procedure on the local machine. If it is not registered, + * this procedure is quite; ie it does not return error information!!! + * This procedure only is supported on rpc/udp and calls via + * rpc/udp. This routine only passes null authentication parameters. + * This file has no interface to xdr routines for PMAPPROC_CALLIT. + * + * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. + */ + +#ifndef _RPC_PMAP_PROT_H +#define _RPC_PMAP_PROT_H +#include + +#define PMAPPORT ((u_short)111) +#define PMAPPROG ((u_long)100000) +#define PMAPVERS ((u_long)2) +#define PMAPVERS_PROTO ((u_long)2) +#define PMAPVERS_ORIG ((u_long)1) +#define PMAPPROC_NULL ((u_long)0) +#define PMAPPROC_SET ((u_long)1) +#define PMAPPROC_UNSET ((u_long)2) +#define PMAPPROC_GETPORT ((u_long)3) +#define PMAPPROC_DUMP ((u_long)4) +#define PMAPPROC_CALLIT ((u_long)5) + +struct pmap { + long unsigned pm_prog; + long unsigned pm_vers; + long unsigned pm_prot; + long unsigned pm_port; +}; + +struct pmaplist { + struct pmap pml_map; + struct pmaplist *pml_next; +}; + +__BEGIN_DECLS +extern bool_t xdr_pmap(XDR *, struct pmap *); +extern bool_t xdr_pmaplist(XDR *, struct pmaplist **); +extern bool_t xdr_pmaplist_ptr(XDR *, struct pmaplist *); +__END_DECLS + +#endif /* !_RPC_PMAP_PROT_H */ diff --git a/newlib/libc/sys/linux/include/rpc/pmap_rmt.h b/newlib/libc/sys/linux/include/rpc/pmap_rmt.h new file mode 100644 index 000000000..3e069e785 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/pmap_rmt.h @@ -0,0 +1,65 @@ +/* $NetBSD: pmap_rmt.h,v 1.7 1998/02/11 23:01:23 lukem Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)pmap_rmt.h 1.2 88/02/08 SMI + * from: @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/pmap_rmt.h,v 1.12 2002/03/23 17:24:55 imp Exp $ + */ + +/* + * Structures and XDR routines for parameters to and replies from + * the portmapper remote-call-service. + * + * Copyright (C) 1986, Sun Microsystems, Inc. + */ + +#ifndef _RPC_PMAP_RMT_H +#define _RPC_PMAP_RMT_H +#include + +struct rmtcallargs { + u_long prog, vers, proc, arglen; + caddr_t args_ptr; + xdrproc_t xdr_args; +}; + +struct rmtcallres { + u_long *port_ptr; + u_long resultslen; + caddr_t results_ptr; + xdrproc_t xdr_results; +}; + +__BEGIN_DECLS +extern bool_t xdr_rmtcall_args(XDR *, struct rmtcallargs *); +extern bool_t xdr_rmtcallres(XDR *, struct rmtcallres *); +__END_DECLS + +#endif /* !_RPC_PMAP_RMT_H */ diff --git a/newlib/libc/sys/linux/include/rpc/raw.h b/newlib/libc/sys/linux/include/rpc/raw.h new file mode 100644 index 000000000..d418bf41e --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/raw.h @@ -0,0 +1,58 @@ +/* $NetBSD: raw.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ +/* $FreeBSD: src/include/rpc/raw.h,v 1.1 2001/03/19 12:49:47 alfred Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. + */ + +#ifndef _RPC_RAW_H +#define _RPC_RAW_H + +/* from: @(#)raw.h 1.11 94/04/25 SMI */ +/* from: @(#)raw.h 1.2 88/10/25 SMI */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * raw.h + * + * Raw interface + * The common memory area over which they will communicate + */ +extern char *__rpc_rawcombuf; + +#ifdef __cplusplus +} +#endif + +#endif /* _RPC_RAW_H */ diff --git a/newlib/libc/sys/linux/include/rpc/rpc.h b/newlib/libc/sys/linux/include/rpc/rpc.h new file mode 100644 index 000000000..72a717c05 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/rpc.h @@ -0,0 +1,108 @@ +/* $NetBSD: rpc.h,v 1.13 2000/06/02 22:57:56 fvdl Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)rpc.h 1.9 88/02/08 SMI + * from: @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC + * $FreeBSD: src/include/rpc/rpc.h,v 1.17 2002/03/23 17:24:55 imp Exp $ + */ + +/* + * rpc.h, Just includes the billions of rpc header files necessary to + * do remote procedure calling. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ +#ifndef _RPC_RPC_H +#define _RPC_RPC_H + +#include /* some typedefs */ +#include +#include + +/* external data representation interfaces */ +#include /* generic (de)serializer */ + +/* Client side only authentication */ +#include /* generic authenticator (client side) */ + +/* Client side (mostly) remote procedure call */ +#include /* generic rpc stuff */ + +/* semi-private protocol headers */ +#include /* protocol for rpc messages */ +#include /* protocol for unix style cred */ +/* + * Uncomment-out the next line if you are building the rpc library with + * DES Authentication (see the README file in the secure_rpc/ directory). + */ +#include /* protocol for des style cred */ + +/* Server side only remote procedure callee */ +#include /* service manager and multiplexer */ +#include /* service side authenticator */ + +/* Portmapper client, server, and protocol headers */ +#include +#include + +#ifndef _KERNEL +#include /* rpcbind interface functions */ +#endif + +#include + +__BEGIN_DECLS +extern int get_myaddress(struct sockaddr_in *); +extern int bindresvport(int, struct sockaddr_in *); +extern int registerrpc(int, int, int, char *(*)(char [UDPMSGSIZE]), + xdrproc_t, xdrproc_t); +extern int callrpc(const char *, int, int, int, xdrproc_t, void *, + xdrproc_t , void *); +extern int getrpcport(char *, int, int, int); + +char *taddr2uaddr(const struct netconfig *, const struct netbuf *); +struct netbuf *uaddr2taddr(const struct netconfig *, const char *); + +struct sockaddr; +extern int bindresvport_sa(int, struct sockaddr *); +__END_DECLS + +/* + * The following are not exported interfaces, they are for internal library + * and rpcbind use only. Do not use, they may change without notice. + */ +__BEGIN_DECLS +int __rpc_nconf2fd(const struct netconfig *); +int __rpc_nconf2sockinfo(const struct netconfig *, struct __rpc_sockinfo *); +int __rpc_fd2sockinfo(int, struct __rpc_sockinfo *); +u_int __rpc_get_t_size(int, int, int); +__END_DECLS + +#endif /* !_RPC_RPC_H */ diff --git a/newlib/libc/sys/linux/include/rpc/rpc_com.h b/newlib/libc/sys/linux/include/rpc/rpc_com.h new file mode 100644 index 000000000..8c6a26e3e --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/rpc_com.h @@ -0,0 +1,83 @@ +/* $NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $ */ +/* $FreeBSD: src/include/rpc/rpc_com.h,v 1.5 2002/03/23 17:24:55 imp Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. + */ + +/* + * rpc_com.h, Common definitions for both the server and client side. + * All for the topmost layer of rpc + * + */ + +#ifndef _RPC_RPCCOM_H +#define _RPC_RPCCOM_H + +#include + +/* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */ + +/* + * The max size of the transport, if the size cannot be determined + * by other means. + */ +#define RPC_MAXDATASIZE 9000 +#define RPC_MAXADDRSIZE 1024 + +#define __RPC_GETXID(now) ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \ + (u_int32_t)(now)->tv_usec) + +__BEGIN_DECLS +extern u_int __rpc_get_a_size(int); +extern int __rpc_dtbsize(void); +extern int _rpc_dtablesize(void); +extern struct netconfig * __rpcgettp(int); +extern int __rpc_get_default_domain(char **); + +char *__rpc_taddr2uaddr_af(int, const struct netbuf *); +struct netbuf *__rpc_uaddr2taddr_af(int, const char *); +int __rpc_fixup_addr(struct netbuf *, const struct netbuf *); +int __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **); +int __rpc_seman2socktype(int); +int __rpc_socktype2seman(int); +void *rpc_nullproc(CLIENT *); +int __rpc_sockisbound(int); + +struct netbuf *__rpcb_findaddr(rpcprog_t, rpcvers_t, const struct netconfig *, + const char *, CLIENT **); +bool_t __rpc_control(int,void *); + +char *_get_next_token(char *, int); + +__END_DECLS + +#endif /* _RPC_RPCCOM_H */ diff --git a/newlib/libc/sys/linux/include/rpc/rpc_msg.h b/newlib/libc/sys/linux/include/rpc/rpc_msg.h new file mode 100644 index 000000000..6cb229c21 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/rpc_msg.h @@ -0,0 +1,214 @@ +/* $NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)rpc_msg.h 1.7 86/07/16 SMI + * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.14 2002/03/23 17:24:55 imp Exp $ + */ + +/* + * rpc_msg.h + * rpc message definition + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_RPC_MSG_H +#define _RPC_RPC_MSG_H + +#define RPC_MSG_VERSION ((u_int32_t) 2) +#define RPC_SERVICE_PORT ((u_short) 2048) + +/* + * Bottom up definition of an rpc message. + * NOTE: call and reply use the same overall stuct but + * different parts of unions within it. + */ + +enum msg_type { + CALL=0, + REPLY=1 +}; + +enum reply_stat { + MSG_ACCEPTED=0, + MSG_DENIED=1 +}; + +enum accept_stat { + SUCCESS=0, + PROG_UNAVAIL=1, + PROG_MISMATCH=2, + PROC_UNAVAIL=3, + GARBAGE_ARGS=4, + SYSTEM_ERR=5 +}; + +enum reject_stat { + RPC_MISMATCH=0, + AUTH_ERROR=1 +}; + +/* + * Reply part of an rpc exchange + */ + +/* + * Reply to an rpc request that was accepted by the server. + * Note: there could be an error even though the request was + * accepted. + */ +struct accepted_reply { + struct opaque_auth ar_verf; + enum accept_stat ar_stat; + union { + struct { + rpcvers_t low; + rpcvers_t high; + } AR_versions; + struct { + caddr_t where; + xdrproc_t proc; + } AR_results; + /* and many other null cases */ + } ru; +#define ar_results ru.AR_results +#define ar_vers ru.AR_versions +}; + +/* + * Reply to an rpc request that was rejected by the server. + */ +struct rejected_reply { + enum reject_stat rj_stat; + union { + struct { + rpcvers_t low; + rpcvers_t high; + } RJ_versions; + enum auth_stat RJ_why; /* why authentication did not work */ + } ru; +#define rj_vers ru.RJ_versions +#define rj_why ru.RJ_why +}; + +/* + * Body of a reply to an rpc request. + */ +struct reply_body { + enum reply_stat rp_stat; + union { + struct accepted_reply RP_ar; + struct rejected_reply RP_dr; + } ru; +#define rp_acpt ru.RP_ar +#define rp_rjct ru.RP_dr +}; + +/* + * Body of an rpc request call. + */ +struct call_body { + rpcvers_t cb_rpcvers; /* must be equal to two */ + rpcprog_t cb_prog; + rpcvers_t cb_vers; + rpcproc_t cb_proc; + struct opaque_auth cb_cred; + struct opaque_auth cb_verf; /* protocol specific - provided by client */ +}; + +/* + * The rpc message + */ +struct rpc_msg { + u_int32_t rm_xid; + enum msg_type rm_direction; + union { + struct call_body RM_cmb; + struct reply_body RM_rmb; + } ru; +#define rm_call ru.RM_cmb +#define rm_reply ru.RM_rmb +}; +#define acpted_rply ru.RM_rmb.ru.RP_ar +#define rjcted_rply ru.RM_rmb.ru.RP_dr + +__BEGIN_DECLS +/* + * XDR routine to handle a rpc message. + * xdr_callmsg(xdrs, cmsg) + * XDR *xdrs; + * struct rpc_msg *cmsg; + */ +extern bool_t xdr_callmsg(XDR *, struct rpc_msg *); + +/* + * XDR routine to pre-serialize the static part of a rpc message. + * xdr_callhdr(xdrs, cmsg) + * XDR *xdrs; + * struct rpc_msg *cmsg; + */ +extern bool_t xdr_callhdr(XDR *, struct rpc_msg *); + +/* + * XDR routine to handle a rpc reply. + * xdr_replymsg(xdrs, rmsg) + * XDR *xdrs; + * struct rpc_msg *rmsg; + */ +extern bool_t xdr_replymsg(XDR *, struct rpc_msg *); + + +/* + * XDR routine to handle a accepted rpc reply. + * xdr_accepted_reply(xdrs, rej) + * XDR *xdrs; + * struct accepted_reply *rej; + */ +extern bool_t xdr_accepted_reply(XDR *, struct accepted_reply *); + +/* + * XDR routine to handle a rejected rpc reply. + * xdr_rejected_reply(xdrs, rej) + * XDR *xdrs; + * struct rejected_reply *rej; + */ +extern bool_t xdr_rejected_reply(XDR *, struct rejected_reply *); + +/* + * Fills in the error part of a reply message. + * _seterr_reply(msg, error) + * struct rpc_msg *msg; + * struct rpc_err *error; + */ +extern void _seterr_reply(struct rpc_msg *, struct rpc_err *); +__END_DECLS + +#endif /* !_RPC_RPC_MSG_H */ diff --git a/newlib/libc/sys/linux/include/rpc/rpcb_clnt.h b/newlib/libc/sys/linux/include/rpc/rpcb_clnt.h new file mode 100644 index 000000000..3b9966b3b --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/rpcb_clnt.h @@ -0,0 +1,85 @@ +/* $NetBSD: rpcb_clnt.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ +/* $FreeBSD: src/include/rpc/rpcb_clnt.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. + */ + +/* + * rpcb_clnt.h + * Supplies C routines to get to rpcbid services. + * + */ + +/* + * Usage: + * success = rpcb_set(program, version, nconf, address); + * success = rpcb_unset(program, version, nconf); + * success = rpcb_getaddr(program, version, nconf, host); + * head = rpcb_getmaps(nconf, host); + * clnt_stat = rpcb_rmtcall(nconf, host, program, version, procedure, + * xdrargs, argsp, xdrres, resp, tout, addr_ptr) + * success = rpcb_gettime(host, timep) + * uaddr = rpcb_taddr2uaddr(nconf, taddr); + * taddr = rpcb_uaddr2uaddr(nconf, uaddr); + */ + +#ifndef _RPC_RPCB_CLNT_H +#define _RPC_RPCB_CLNT_H + +/* #pragma ident "@(#)rpcb_clnt.h 1.13 94/04/25 SMI" */ +/* rpcb_clnt.h 1.3 88/12/05 SMI */ + +#include +#include + +__BEGIN_DECLS +extern bool_t rpcb_set(const rpcprog_t, const rpcvers_t, + const struct netconfig *, const struct netbuf *); +extern bool_t rpcb_unset(const rpcprog_t, const rpcvers_t, + const struct netconfig *); +extern rpcblist *rpcb_getmaps(const struct netconfig *, const char *); +extern enum clnt_stat rpcb_rmtcall(const struct netconfig *, + const char *, const rpcprog_t, + const rpcvers_t, const rpcproc_t, + const xdrproc_t, const caddr_t, + const xdrproc_t, const caddr_t, + const struct timeval, + const struct netbuf *); +extern bool_t rpcb_getaddr(const rpcprog_t, const rpcvers_t, + const struct netconfig *, struct netbuf *, + const char *); +extern bool_t rpcb_gettime(const char *, time_t *); +extern char *rpcb_taddr2uaddr(struct netconfig *, struct netbuf *); +extern struct netbuf *rpcb_uaddr2taddr(struct netconfig *, char *); +__END_DECLS + +#endif /* !_RPC_RPCB_CLNT_H */ diff --git a/newlib/libc/sys/linux/include/rpc/rpcb_prot.h b/newlib/libc/sys/linux/include/rpc/rpcb_prot.h new file mode 100644 index 000000000..1442603ee --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/rpcb_prot.h @@ -0,0 +1,660 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _RPCB_PROT_H_RPCGEN +#define _RPCB_PROT_H_RPCGEN + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * $FreeBSD: src/include/rpc/rpcb_prot.x,v 1.3 2002/03/13 10:29:06 obrien Exp $ + * + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1988 by Sun Microsystems, Inc. + */ +/* from rpcb_prot.x */ + +/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */ + +#ifndef _KERNEL + + +/* + * The following procedures are supported by the protocol in version 3: + * + * RPCBPROC_NULL() returns () + * takes nothing, returns nothing + * + * RPCBPROC_SET(rpcb) returns (bool_t) + * TRUE is success, FALSE is failure. Registers the tuple + * [prog, vers, address, owner, netid]. + * Finds out owner and netid information on its own. + * + * RPCBPROC_UNSET(rpcb) returns (bool_t) + * TRUE is success, FALSE is failure. Un-registers tuple + * [prog, vers, netid]. addresses is ignored. + * If netid is NULL, unregister all. + * + * RPCBPROC_GETADDR(rpcb) returns (string). + * 0 is failure. Otherwise returns the universal address where the + * triple [prog, vers, netid] is registered. Ignore address and owner. + * + * RPCBPROC_DUMP() RETURNS (rpcblist_ptr) + * used to dump the entire rpcbind maps + * + * RPCBPROC_CALLIT(rpcb_rmtcallargs) + * RETURNS (rpcb_rmtcallres); + * Calls the procedure on the remote machine. If it is not registered, + * this procedure is quiet; i.e. it does not return error information!!! + * This routine only passes null authentication parameters. + * It has no interface to xdr routines for RPCBPROC_CALLIT. + * + * RPCBPROC_GETTIME() returns (int). + * Gets the remote machines time + * + * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf) + * Returns the netbuf address from universal address. + * + * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string) + * Returns the universal address from netbuf address. + * + * END OF RPCBIND VERSION 3 PROCEDURES + */ +/* + * Except for RPCBPROC_CALLIT, the procedures above are carried over to + * rpcbind version 4. Those below are added or modified for version 4. + * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER + * AS RPCBPROC_CALLIT. + * + * RPCBPROC_BCAST(rpcb_rmtcallargs) + * RETURNS (rpcb_rmtcallres); + * Calls the procedure on the remote machine. If it is not registered, + * this procedure IS quiet; i.e. it DOES NOT return error information!!! + * This routine should be used for broadcasting and nothing else. + * + * RPCBPROC_GETVERSADDR(rpcb) returns (string). + * 0 is failure. Otherwise returns the universal address where the + * triple [prog, vers, netid] is registered. Ignore address and owner. + * Same as RPCBPROC_GETADDR except that if the given version number + * is not available, the address is not returned. + * + * RPCBPROC_INDIRECT(rpcb_rmtcallargs) + * RETURNS (rpcb_rmtcallres); + * Calls the procedure on the remote machine. If it is not registered, + * this procedure is NOT quiet; i.e. it DOES return error information!!! + * as any normal application would expect. + * + * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr). + * Same as RPCBPROC_GETADDR except that it returns a list of all the + * addresses registered for the combination (prog, vers) (for all + * transports). + * + * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers) + * Returns the statistics about the kind of requests received by rpcbind. + */ + +/* + * A mapping of (program, version, network ID) to address + */ + +struct rpcb { + rpcprog_t r_prog; + rpcvers_t r_vers; + char *r_netid; + char *r_addr; + char *r_owner; +}; +typedef struct rpcb rpcb; + +typedef rpcb RPCB; + + +/* + * A list of mappings + * + * Below are two definitions for the rpcblist structure. This is done because + * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a + * struct rpcblist * that rpcgen would produce. One version of the rpcblist + * structure (actually called rp__list) is used with rpcgen, and the other is + * defined only in the header file for compatibility with the specified + * interface. + */ + +struct rp__list { + rpcb rpcb_map; + struct rp__list *rpcb_next; +}; +typedef struct rp__list rp__list; + +typedef rp__list *rpcblist_ptr; + +typedef struct rp__list rpcblist; +typedef struct rp__list RPCBLIST; + +#ifndef __cplusplus +struct rpcblist { + RPCB rpcb_map; + struct rpcblist *rpcb_next; +}; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern bool_t xdr_rpcblist(XDR *, rpcblist**); +#ifdef __cplusplus +} +#endif + + +/* + * Arguments of remote calls + */ + +struct rpcb_rmtcallargs { + rpcprog_t prog; + rpcvers_t vers; + rpcproc_t proc; + struct { + u_int args_len; + char *args_val; + } args; +}; +typedef struct rpcb_rmtcallargs rpcb_rmtcallargs; + +/* + * Client-side only representation of rpcb_rmtcallargs structure. + * + * The routine that XDRs the rpcb_rmtcallargs structure must deal with the + * opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to + * be passed the XDR routine that knows the args' structure. This routine + * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since + * the application being called already knows the args structure. So we use a + * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which + * includes the args' XDR routine. + */ +struct r_rpcb_rmtcallargs { + rpcprog_t prog; + rpcvers_t vers; + rpcproc_t proc; + struct { + u_int args_len; + char *args_val; + } args; + xdrproc_t xdr_args; /* encodes args */ +}; + + +/* + * Results of the remote call + */ + +struct rpcb_rmtcallres { + char *addr; + struct { + u_int results_len; + char *results_val; + } results; +}; +typedef struct rpcb_rmtcallres rpcb_rmtcallres; + +/* + * Client-side only representation of rpcb_rmtcallres structure. + */ +struct r_rpcb_rmtcallres { + char *addr; + struct { + u_int32_t results_len; + char *results_val; + } results; + xdrproc_t xdr_res; /* decodes results */ +}; + +/* + * rpcb_entry contains a merged address of a service on a particular + * transport, plus associated netconfig information. A list of rpcb_entrys + * is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used + * in r_nc_* fields. + */ + +struct rpcb_entry { + char *r_maddr; + char *r_nc_netid; + u_int r_nc_semantics; + char *r_nc_protofmly; + char *r_nc_proto; +}; +typedef struct rpcb_entry rpcb_entry; + +/* + * A list of addresses supported by a service. + */ + +struct rpcb_entry_list { + rpcb_entry rpcb_entry_map; + struct rpcb_entry_list *rpcb_entry_next; +}; +typedef struct rpcb_entry_list rpcb_entry_list; + +typedef rpcb_entry_list *rpcb_entry_list_ptr; + +/* + * rpcbind statistics + */ + +#define rpcb_highproc_2 RPCBPROC_CALLIT +#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR +#define rpcb_highproc_4 RPCBPROC_GETSTAT +#define RPCBSTAT_HIGHPROC 13 +#define RPCBVERS_STAT 3 +#define RPCBVERS_4_STAT 2 +#define RPCBVERS_3_STAT 1 +#define RPCBVERS_2_STAT 0 + +/* Link list of all the stats about getport and getaddr */ + +struct rpcbs_addrlist { + rpcprog_t prog; + rpcvers_t vers; + int success; + int failure; + char *netid; + struct rpcbs_addrlist *next; +}; +typedef struct rpcbs_addrlist rpcbs_addrlist; + +/* Link list of all the stats about rmtcall */ + +struct rpcbs_rmtcalllist { + rpcprog_t prog; + rpcvers_t vers; + rpcproc_t proc; + int success; + int failure; + int indirect; + char *netid; + struct rpcbs_rmtcalllist *next; +}; +typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist; + +typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; + +typedef rpcbs_addrlist *rpcbs_addrlist_ptr; + +typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; + +struct rpcb_stat { + rpcbs_proc info; + int setinfo; + int unsetinfo; + rpcbs_addrlist_ptr addrinfo; + rpcbs_rmtcalllist_ptr rmtinfo; +}; +typedef struct rpcb_stat rpcb_stat; + +/* + * One rpcb_stat structure is returned for each version of rpcbind + * being monitored. + */ + +typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; + +/* + * We don't define netbuf in RPCL, since it would contain structure member + * names that would conflict with the definition of struct netbuf in + * . Instead we merely declare the XDR routine xdr_netbuf() here, + * and implement it ourselves in rpc/rpcb_prot.c. + */ +#ifdef __cplusplus +extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *); + +#else /* __STDC__ */ +extern bool_t xdr_netbuf(XDR *, struct netbuf *); + +#endif + +#define RPCBVERS_3 RPCBVERS +#define RPCBVERS_4 RPCBVERS4 + +#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock" + +#else /* ndef _KERNEL */ +#ifdef __cplusplus +extern "C" { +#endif + +/* + * A mapping of (program, version, network ID) to address + */ +struct rpcb { + rpcprog_t r_prog; /* program number */ + rpcvers_t r_vers; /* version number */ + char *r_netid; /* network id */ + char *r_addr; /* universal address */ + char *r_owner; /* owner of the mapping */ +}; +typedef struct rpcb RPCB; + +/* + * A list of mappings + */ +struct rpcblist { + RPCB rpcb_map; + struct rpcblist *rpcb_next; +}; +typedef struct rpcblist RPCBLIST; +typedef struct rpcblist *rpcblist_ptr; + +/* + * Remote calls arguments + */ +struct rpcb_rmtcallargs { + rpcprog_t prog; /* program number */ + rpcvers_t vers; /* version number */ + rpcproc_t proc; /* procedure number */ + u_int32_t arglen; /* arg len */ + caddr_t args_ptr; /* argument */ + xdrproc_t xdr_args; /* XDR routine for argument */ +}; +typedef struct rpcb_rmtcallargs rpcb_rmtcallargs; + +/* + * Remote calls results + */ +struct rpcb_rmtcallres { + char *addr_ptr; /* remote universal address */ + u_int32_t resultslen; /* results length */ + caddr_t results_ptr; /* results */ + xdrproc_t xdr_results; /* XDR routine for result */ +}; +typedef struct rpcb_rmtcallres rpcb_rmtcallres; + +struct rpcb_entry { + char *r_maddr; + char *r_nc_netid; + unsigned int r_nc_semantics; + char *r_nc_protofmly; + char *r_nc_proto; +}; +typedef struct rpcb_entry rpcb_entry; + +/* + * A list of addresses supported by a service. + */ + +struct rpcb_entry_list { + rpcb_entry rpcb_entry_map; + struct rpcb_entry_list *rpcb_entry_next; +}; +typedef struct rpcb_entry_list rpcb_entry_list; + +typedef rpcb_entry_list *rpcb_entry_list_ptr; + +/* + * rpcbind statistics + */ + +#define rpcb_highproc_2 RPCBPROC_CALLIT +#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR +#define rpcb_highproc_4 RPCBPROC_GETSTAT +#define RPCBSTAT_HIGHPROC 13 +#define RPCBVERS_STAT 3 +#define RPCBVERS_4_STAT 2 +#define RPCBVERS_3_STAT 1 +#define RPCBVERS_2_STAT 0 + +/* Link list of all the stats about getport and getaddr */ + +struct rpcbs_addrlist { + rpcprog_t prog; + rpcvers_t vers; + int success; + int failure; + char *netid; + struct rpcbs_addrlist *next; +}; +typedef struct rpcbs_addrlist rpcbs_addrlist; + +/* Link list of all the stats about rmtcall */ + +struct rpcbs_rmtcalllist { + rpcprog_t prog; + rpcvers_t vers; + rpcproc_t proc; + int success; + int failure; + int indirect; + char *netid; + struct rpcbs_rmtcalllist *next; +}; +typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist; + +typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; + +typedef rpcbs_addrlist *rpcbs_addrlist_ptr; + +typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; + +struct rpcb_stat { + rpcbs_proc info; + int setinfo; + int unsetinfo; + rpcbs_addrlist_ptr addrinfo; + rpcbs_rmtcalllist_ptr rmtinfo; +}; +typedef struct rpcb_stat rpcb_stat; + +/* + * One rpcb_stat structure is returned for each version of rpcbind + * being monitored. + */ + +typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; + +#ifdef __cplusplus +} +#endif + +#endif /* ndef _KERNEL */ + +#define RPCBPROG 100000 +#define RPCBVERS 3 + +#if defined(__STDC__) || defined(__cplusplus) +#define RPCBPROC_SET 1 +extern bool_t * rpcbproc_set_3(rpcb *, CLIENT *); +extern bool_t * rpcbproc_set_3_svc(rpcb *, struct svc_req *); +#define RPCBPROC_UNSET 2 +extern bool_t * rpcbproc_unset_3(rpcb *, CLIENT *); +extern bool_t * rpcbproc_unset_3_svc(rpcb *, struct svc_req *); +#define RPCBPROC_GETADDR 3 +extern char ** rpcbproc_getaddr_3(rpcb *, CLIENT *); +extern char ** rpcbproc_getaddr_3_svc(rpcb *, struct svc_req *); +#define RPCBPROC_DUMP 4 +extern rpcblist_ptr * rpcbproc_dump_3(void *, CLIENT *); +extern rpcblist_ptr * rpcbproc_dump_3_svc(void *, struct svc_req *); +#define RPCBPROC_CALLIT 5 +extern rpcb_rmtcallres * rpcbproc_callit_3(rpcb_rmtcallargs *, CLIENT *); +extern rpcb_rmtcallres * rpcbproc_callit_3_svc(rpcb_rmtcallargs *, struct svc_req *); +#define RPCBPROC_GETTIME 6 +extern u_int * rpcbproc_gettime_3(void *, CLIENT *); +extern u_int * rpcbproc_gettime_3_svc(void *, struct svc_req *); +#define RPCBPROC_UADDR2TADDR 7 +extern struct netbuf * rpcbproc_uaddr2taddr_3(char **, CLIENT *); +extern struct netbuf * rpcbproc_uaddr2taddr_3_svc(char **, struct svc_req *); +#define RPCBPROC_TADDR2UADDR 8 +extern char ** rpcbproc_taddr2uaddr_3(struct netbuf *, CLIENT *); +extern char ** rpcbproc_taddr2uaddr_3_svc(struct netbuf *, struct svc_req *); +extern int rpcbprog_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define RPCBPROC_SET 1 +extern bool_t * rpcbproc_set_3(); +extern bool_t * rpcbproc_set_3_svc(); +#define RPCBPROC_UNSET 2 +extern bool_t * rpcbproc_unset_3(); +extern bool_t * rpcbproc_unset_3_svc(); +#define RPCBPROC_GETADDR 3 +extern char ** rpcbproc_getaddr_3(); +extern char ** rpcbproc_getaddr_3_svc(); +#define RPCBPROC_DUMP 4 +extern rpcblist_ptr * rpcbproc_dump_3(); +extern rpcblist_ptr * rpcbproc_dump_3_svc(); +#define RPCBPROC_CALLIT 5 +extern rpcb_rmtcallres * rpcbproc_callit_3(); +extern rpcb_rmtcallres * rpcbproc_callit_3_svc(); +#define RPCBPROC_GETTIME 6 +extern u_int * rpcbproc_gettime_3(); +extern u_int * rpcbproc_gettime_3_svc(); +#define RPCBPROC_UADDR2TADDR 7 +extern struct netbuf * rpcbproc_uaddr2taddr_3(); +extern struct netbuf * rpcbproc_uaddr2taddr_3_svc(); +#define RPCBPROC_TADDR2UADDR 8 +extern char ** rpcbproc_taddr2uaddr_3(); +extern char ** rpcbproc_taddr2uaddr_3_svc(); +extern int rpcbprog_3_freeresult (); +#endif /* K&R C */ +#define RPCBVERS4 4 + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t * rpcbproc_set_4(rpcb *, CLIENT *); +extern bool_t * rpcbproc_set_4_svc(rpcb *, struct svc_req *); +extern bool_t * rpcbproc_unset_4(rpcb *, CLIENT *); +extern bool_t * rpcbproc_unset_4_svc(rpcb *, struct svc_req *); +extern char ** rpcbproc_getaddr_4(rpcb *, CLIENT *); +extern char ** rpcbproc_getaddr_4_svc(rpcb *, struct svc_req *); +extern rpcblist_ptr * rpcbproc_dump_4(void *, CLIENT *); +extern rpcblist_ptr * rpcbproc_dump_4_svc(void *, struct svc_req *); +#define RPCBPROC_BCAST RPCBPROC_CALLIT +extern rpcb_rmtcallres * rpcbproc_bcast_4(rpcb_rmtcallargs *, CLIENT *); +extern rpcb_rmtcallres * rpcbproc_bcast_4_svc(rpcb_rmtcallargs *, struct svc_req *); +extern u_int * rpcbproc_gettime_4(void *, CLIENT *); +extern u_int * rpcbproc_gettime_4_svc(void *, struct svc_req *); +extern struct netbuf * rpcbproc_uaddr2taddr_4(char **, CLIENT *); +extern struct netbuf * rpcbproc_uaddr2taddr_4_svc(char **, struct svc_req *); +extern char ** rpcbproc_taddr2uaddr_4(struct netbuf *, CLIENT *); +extern char ** rpcbproc_taddr2uaddr_4_svc(struct netbuf *, struct svc_req *); +#define RPCBPROC_GETVERSADDR 9 +extern char ** rpcbproc_getversaddr_4(rpcb *, CLIENT *); +extern char ** rpcbproc_getversaddr_4_svc(rpcb *, struct svc_req *); +#define RPCBPROC_INDIRECT 10 +extern rpcb_rmtcallres * rpcbproc_indirect_4(rpcb_rmtcallargs *, CLIENT *); +extern rpcb_rmtcallres * rpcbproc_indirect_4_svc(rpcb_rmtcallargs *, struct svc_req *); +#define RPCBPROC_GETADDRLIST 11 +extern rpcb_entry_list_ptr * rpcbproc_getaddrlist_4(rpcb *, CLIENT *); +extern rpcb_entry_list_ptr * rpcbproc_getaddrlist_4_svc(rpcb *, struct svc_req *); +#define RPCBPROC_GETSTAT 12 +extern rpcb_stat * rpcbproc_getstat_4(void *, CLIENT *); +extern rpcb_stat * rpcbproc_getstat_4_svc(void *, struct svc_req *); +extern int rpcbprog_4_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern bool_t * rpcbproc_set_4(); +extern bool_t * rpcbproc_set_4_svc(); +extern bool_t * rpcbproc_unset_4(); +extern bool_t * rpcbproc_unset_4_svc(); +extern char ** rpcbproc_getaddr_4(); +extern char ** rpcbproc_getaddr_4_svc(); +extern rpcblist_ptr * rpcbproc_dump_4(); +extern rpcblist_ptr * rpcbproc_dump_4_svc(); +#define RPCBPROC_BCAST RPCBPROC_CALLIT +extern rpcb_rmtcallres * rpcbproc_bcast_4(); +extern rpcb_rmtcallres * rpcbproc_bcast_4_svc(); +extern u_int * rpcbproc_gettime_4(); +extern u_int * rpcbproc_gettime_4_svc(); +extern struct netbuf * rpcbproc_uaddr2taddr_4(); +extern struct netbuf * rpcbproc_uaddr2taddr_4_svc(); +extern char ** rpcbproc_taddr2uaddr_4(); +extern char ** rpcbproc_taddr2uaddr_4_svc(); +#define RPCBPROC_GETVERSADDR 9 +extern char ** rpcbproc_getversaddr_4(); +extern char ** rpcbproc_getversaddr_4_svc(); +#define RPCBPROC_INDIRECT 10 +extern rpcb_rmtcallres * rpcbproc_indirect_4(); +extern rpcb_rmtcallres * rpcbproc_indirect_4_svc(); +#define RPCBPROC_GETADDRLIST 11 +extern rpcb_entry_list_ptr * rpcbproc_getaddrlist_4(); +extern rpcb_entry_list_ptr * rpcbproc_getaddrlist_4_svc(); +#define RPCBPROC_GETSTAT 12 +extern rpcb_stat * rpcbproc_getstat_4(); +extern rpcb_stat * rpcbproc_getstat_4_svc(); +extern int rpcbprog_4_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpcb (XDR *, rpcb*); +extern bool_t xdr_rp__list (XDR *, rp__list*); +extern bool_t xdr_rpcblist_ptr (XDR *, rpcblist_ptr*); +extern bool_t xdr_rpcb_rmtcallargs (XDR *, rpcb_rmtcallargs*); +extern bool_t xdr_rpcb_rmtcallres (XDR *, rpcb_rmtcallres*); +extern bool_t xdr_rpcb_entry (XDR *, rpcb_entry*); +extern bool_t xdr_rpcb_entry_list (XDR *, rpcb_entry_list*); +extern bool_t xdr_rpcb_entry_list_ptr (XDR *, rpcb_entry_list_ptr*); +extern bool_t xdr_rpcbs_addrlist (XDR *, rpcbs_addrlist*); +extern bool_t xdr_rpcbs_rmtcalllist (XDR *, rpcbs_rmtcalllist*); +extern bool_t xdr_rpcbs_proc (XDR *, rpcbs_proc); +extern bool_t xdr_rpcbs_addrlist_ptr (XDR *, rpcbs_addrlist_ptr*); +extern bool_t xdr_rpcbs_rmtcalllist_ptr (XDR *, rpcbs_rmtcalllist_ptr*); +extern bool_t xdr_rpcb_stat (XDR *, rpcb_stat*); +extern bool_t xdr_rpcb_stat_byvers (XDR *, rpcb_stat_byvers); + +#else /* K&R C */ +extern bool_t xdr_rpcb (); +extern bool_t xdr_rp__list (); +extern bool_t xdr_rpcblist_ptr (); +extern bool_t xdr_rpcb_rmtcallargs (); +extern bool_t xdr_rpcb_rmtcallres (); +extern bool_t xdr_rpcb_entry (); +extern bool_t xdr_rpcb_entry_list (); +extern bool_t xdr_rpcb_entry_list_ptr (); +extern bool_t xdr_rpcbs_addrlist (); +extern bool_t xdr_rpcbs_rmtcalllist (); +extern bool_t xdr_rpcbs_proc (); +extern bool_t xdr_rpcbs_addrlist_ptr (); +extern bool_t xdr_rpcbs_rmtcalllist_ptr (); +extern bool_t xdr_rpcb_stat (); +extern bool_t xdr_rpcb_stat_byvers (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_RPCB_PROT_H_RPCGEN */ diff --git a/newlib/libc/sys/linux/include/rpc/rpcb_prot.x b/newlib/libc/sys/linux/include/rpc/rpcb_prot.x new file mode 100644 index 000000000..39f162776 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/rpcb_prot.x @@ -0,0 +1,554 @@ +%/* +% * $FreeBSD: src/include/rpc/rpcb_prot.x,v 1.3 2002/03/13 10:29:06 obrien Exp $ +% * +% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for +% * unrestricted use provided that this legend is included on all tape +% * media and as a part of the software program in whole or part. Users +% * may copy or modify Sun RPC without charge, but are not authorized +% * to license or distribute it to anyone else except as part of a product or +% * program developed by the user. +% * +% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE +% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +% * +% * Sun RPC is provided with no support and without any obligation on the +% * part of Sun Microsystems, Inc. to assist in its use, correction, +% * modification or enhancement. +% * +% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE +% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC +% * OR ANY PART THEREOF. +% * +% * In no event will Sun Microsystems, Inc. be liable for any lost revenue +% * or profits or other special, indirect and consequential damages, even if +% * Sun has been advised of the possibility of such damages. +% * +% * Sun Microsystems, Inc. +% * 2550 Garcia Avenue +% * Mountain View, California 94043 +% */ +%/* +% * Copyright (c) 1988 by Sun Microsystems, Inc. +% */ + +%/* from rpcb_prot.x */ + +#ifdef RPC_HDR +% +%/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */ +% +%#ifndef _KERNEL +% +#endif + +/* + * rpcb_prot.x + * rpcbind protocol, versions 3 and 4, in RPC Language + */ +% +%/* +% * The following procedures are supported by the protocol in version 3: +% * +% * RPCBPROC_NULL() returns () +% * takes nothing, returns nothing +% * +% * RPCBPROC_SET(rpcb) returns (bool_t) +% * TRUE is success, FALSE is failure. Registers the tuple +% * [prog, vers, address, owner, netid]. +% * Finds out owner and netid information on its own. +% * +% * RPCBPROC_UNSET(rpcb) returns (bool_t) +% * TRUE is success, FALSE is failure. Un-registers tuple +% * [prog, vers, netid]. addresses is ignored. +% * If netid is NULL, unregister all. +% * +% * RPCBPROC_GETADDR(rpcb) returns (string). +% * 0 is failure. Otherwise returns the universal address where the +% * triple [prog, vers, netid] is registered. Ignore address and owner. +% * +% * RPCBPROC_DUMP() RETURNS (rpcblist_ptr) +% * used to dump the entire rpcbind maps +% * +% * RPCBPROC_CALLIT(rpcb_rmtcallargs) +% * RETURNS (rpcb_rmtcallres); +% * Calls the procedure on the remote machine. If it is not registered, +% * this procedure is quiet; i.e. it does not return error information!!! +% * This routine only passes null authentication parameters. +% * It has no interface to xdr routines for RPCBPROC_CALLIT. +% * +% * RPCBPROC_GETTIME() returns (int). +% * Gets the remote machines time +% * +% * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf) +% * Returns the netbuf address from universal address. +% * +% * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string) +% * Returns the universal address from netbuf address. +% * +% * END OF RPCBIND VERSION 3 PROCEDURES +% */ +%/* +% * Except for RPCBPROC_CALLIT, the procedures above are carried over to +% * rpcbind version 4. Those below are added or modified for version 4. +% * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER +% * AS RPCBPROC_CALLIT. +% * +% * RPCBPROC_BCAST(rpcb_rmtcallargs) +% * RETURNS (rpcb_rmtcallres); +% * Calls the procedure on the remote machine. If it is not registered, +% * this procedure IS quiet; i.e. it DOES NOT return error information!!! +% * This routine should be used for broadcasting and nothing else. +% * +% * RPCBPROC_GETVERSADDR(rpcb) returns (string). +% * 0 is failure. Otherwise returns the universal address where the +% * triple [prog, vers, netid] is registered. Ignore address and owner. +% * Same as RPCBPROC_GETADDR except that if the given version number +% * is not available, the address is not returned. +% * +% * RPCBPROC_INDIRECT(rpcb_rmtcallargs) +% * RETURNS (rpcb_rmtcallres); +% * Calls the procedure on the remote machine. If it is not registered, +% * this procedure is NOT quiet; i.e. it DOES return error information!!! +% * as any normal application would expect. +% * +% * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr). +% * Same as RPCBPROC_GETADDR except that it returns a list of all the +% * addresses registered for the combination (prog, vers) (for all +% * transports). +% * +% * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers) +% * Returns the statistics about the kind of requests received by rpcbind. +% */ +% +%/* +% * A mapping of (program, version, network ID) to address +% */ +struct rpcb { + rpcprog_t r_prog; /* program number */ + rpcvers_t r_vers; /* version number */ + string r_netid<>; /* network id */ + string r_addr<>; /* universal address */ + string r_owner<>; /* owner of this service */ +}; +#ifdef RPC_HDR +% +%typedef rpcb RPCB; +% +#endif +% +%/* +% * A list of mappings +% * +% * Below are two definitions for the rpcblist structure. This is done because +% * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a +% * struct rpcblist * that rpcgen would produce. One version of the rpcblist +% * structure (actually called rp__list) is used with rpcgen, and the other is +% * defined only in the header file for compatibility with the specified +% * interface. +% */ + +struct rp__list { + rpcb rpcb_map; + struct rp__list *rpcb_next; +}; + +typedef rp__list *rpcblist_ptr; /* results of RPCBPROC_DUMP */ + +#ifdef RPC_HDR +% +%typedef struct rp__list rpcblist; +%typedef struct rp__list RPCBLIST; +% +%#ifndef __cplusplus +%struct rpcblist { +% RPCB rpcb_map; +% struct rpcblist *rpcb_next; +%}; +%#endif +% +%#ifdef __cplusplus +%extern "C" { +%#endif +%extern bool_t xdr_rpcblist(XDR *, rpcblist**); +%#ifdef __cplusplus +%} +%#endif +% +#endif + +% +%/* +% * Arguments of remote calls +% */ +struct rpcb_rmtcallargs { + rpcprog_t prog; /* program number */ + rpcvers_t vers; /* version number */ + rpcproc_t proc; /* procedure number */ + opaque args<>; /* argument */ +}; +#ifdef RPC_HDR +% +%/* +% * Client-side only representation of rpcb_rmtcallargs structure. +% * +% * The routine that XDRs the rpcb_rmtcallargs structure must deal with the +% * opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to +% * be passed the XDR routine that knows the args' structure. This routine +% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since +% * the application being called already knows the args structure. So we use a +% * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which +% * includes the args' XDR routine. +% */ +%struct r_rpcb_rmtcallargs { +% rpcprog_t prog; +% rpcvers_t vers; +% rpcproc_t proc; +% struct { +% u_int args_len; +% char *args_val; +% } args; +% xdrproc_t xdr_args; /* encodes args */ +%}; +% +#endif /* def RPC_HDR */ +% +%/* +% * Results of the remote call +% */ +struct rpcb_rmtcallres { + string addr<>; /* remote universal address */ + opaque results<>; /* result */ +}; +#ifdef RPC_HDR +% +%/* +% * Client-side only representation of rpcb_rmtcallres structure. +% */ +%struct r_rpcb_rmtcallres { +% char *addr; +% struct { +% u_int32_t results_len; +% char *results_val; +% } results; +% xdrproc_t xdr_res; /* decodes results */ +%}; +#endif /* RPC_HDR */ +% +%/* +% * rpcb_entry contains a merged address of a service on a particular +% * transport, plus associated netconfig information. A list of rpcb_entrys +% * is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used +% * in r_nc_* fields. +% */ +struct rpcb_entry { + string r_maddr<>; /* merged address of service */ + string r_nc_netid<>; /* netid field */ + unsigned int r_nc_semantics; /* semantics of transport */ + string r_nc_protofmly<>; /* protocol family */ + string r_nc_proto<>; /* protocol name */ +}; +% +%/* +% * A list of addresses supported by a service. +% */ +struct rpcb_entry_list { + rpcb_entry rpcb_entry_map; + struct rpcb_entry_list *rpcb_entry_next; +}; + +typedef rpcb_entry_list *rpcb_entry_list_ptr; + +% +%/* +% * rpcbind statistics +% */ +% +const rpcb_highproc_2 = RPCBPROC_CALLIT; +const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR; +const rpcb_highproc_4 = RPCBPROC_GETSTAT; + +const RPCBSTAT_HIGHPROC = 13; /* # of procs in rpcbind V4 plus one */ +const RPCBVERS_STAT = 3; /* provide only for rpcbind V2, V3 and V4 */ +const RPCBVERS_4_STAT = 2; +const RPCBVERS_3_STAT = 1; +const RPCBVERS_2_STAT = 0; +% +%/* Link list of all the stats about getport and getaddr */ +struct rpcbs_addrlist { + rpcprog_t prog; + rpcvers_t vers; + int success; + int failure; + string netid<>; + struct rpcbs_addrlist *next; +}; +% +%/* Link list of all the stats about rmtcall */ +struct rpcbs_rmtcalllist { + rpcprog_t prog; + rpcvers_t vers; + rpcproc_t proc; + int success; + int failure; + int indirect; /* whether callit or indirect */ + string netid<>; + struct rpcbs_rmtcalllist *next; +}; + +typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; +typedef rpcbs_addrlist *rpcbs_addrlist_ptr; +typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; + +struct rpcb_stat { + rpcbs_proc info; + int setinfo; + int unsetinfo; + rpcbs_addrlist_ptr addrinfo; + rpcbs_rmtcalllist_ptr rmtinfo; +}; +% +%/* +% * One rpcb_stat structure is returned for each version of rpcbind +% * being monitored. +% */ + +typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; + +#ifdef RPC_HDR +% +%/* +% * We don't define netbuf in RPCL, since it would contain structure member +% * names that would conflict with the definition of struct netbuf in +% * . Instead we merely declare the XDR routine xdr_netbuf() here, +% * and implement it ourselves in rpc/rpcb_prot.c. +% */ +%#ifdef __cplusplus +%extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *); +% +%#else /* __STDC__ */ +%extern bool_t xdr_netbuf(XDR *, struct netbuf *); +% +%#endif +#endif /* def RPC_HDR */ + +/* + * rpcbind procedures + */ +program RPCBPROG { + version RPCBVERS { + bool + RPCBPROC_SET(rpcb) = 1; + + bool + RPCBPROC_UNSET(rpcb) = 2; + + string + RPCBPROC_GETADDR(rpcb) = 3; + + rpcblist_ptr + RPCBPROC_DUMP(void) = 4; + + rpcb_rmtcallres + RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5; + + unsigned int + RPCBPROC_GETTIME(void) = 6; + + struct netbuf + RPCBPROC_UADDR2TADDR(string) = 7; + + string + RPCBPROC_TADDR2UADDR(struct netbuf) = 8; + } = 3; + + version RPCBVERS4 { + bool + RPCBPROC_SET(rpcb) = 1; + + bool + RPCBPROC_UNSET(rpcb) = 2; + + string + RPCBPROC_GETADDR(rpcb) = 3; + + rpcblist_ptr + RPCBPROC_DUMP(void) = 4; + + /* + * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT; + * the new name is intended to indicate that this + * procedure should be used for broadcast RPC, and + * RPCBPROC_INDIRECT should be used for indirect calls. + */ + rpcb_rmtcallres + RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT; + + unsigned int + RPCBPROC_GETTIME(void) = 6; + + struct netbuf + RPCBPROC_UADDR2TADDR(string) = 7; + + string + RPCBPROC_TADDR2UADDR(struct netbuf) = 8; + + string + RPCBPROC_GETVERSADDR(rpcb) = 9; + + rpcb_rmtcallres + RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10; + + rpcb_entry_list_ptr + RPCBPROC_GETADDRLIST(rpcb) = 11; + + rpcb_stat_byvers + RPCBPROC_GETSTAT(void) = 12; + } = 4; +} = 100000; +#ifdef RPC_HDR +% +%#define RPCBVERS_3 RPCBVERS +%#define RPCBVERS_4 RPCBVERS4 +% +%#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock" +% +%#else /* ndef _KERNEL */ +%#ifdef __cplusplus +%extern "C" { +%#endif +% +%/* +% * A mapping of (program, version, network ID) to address +% */ +%struct rpcb { +% rpcprog_t r_prog; /* program number */ +% rpcvers_t r_vers; /* version number */ +% char *r_netid; /* network id */ +% char *r_addr; /* universal address */ +% char *r_owner; /* owner of the mapping */ +%}; +%typedef struct rpcb RPCB; +% +%/* +% * A list of mappings +% */ +%struct rpcblist { +% RPCB rpcb_map; +% struct rpcblist *rpcb_next; +%}; +%typedef struct rpcblist RPCBLIST; +%typedef struct rpcblist *rpcblist_ptr; +% +%/* +% * Remote calls arguments +% */ +%struct rpcb_rmtcallargs { +% rpcprog_t prog; /* program number */ +% rpcvers_t vers; /* version number */ +% rpcproc_t proc; /* procedure number */ +% u_int32_t arglen; /* arg len */ +% caddr_t args_ptr; /* argument */ +% xdrproc_t xdr_args; /* XDR routine for argument */ +%}; +%typedef struct rpcb_rmtcallargs rpcb_rmtcallargs; +% +%/* +% * Remote calls results +% */ +%struct rpcb_rmtcallres { +% char *addr_ptr; /* remote universal address */ +% u_int32_t resultslen; /* results length */ +% caddr_t results_ptr; /* results */ +% xdrproc_t xdr_results; /* XDR routine for result */ +%}; +%typedef struct rpcb_rmtcallres rpcb_rmtcallres; +% +%struct rpcb_entry { +% char *r_maddr; +% char *r_nc_netid; +% unsigned int r_nc_semantics; +% char *r_nc_protofmly; +% char *r_nc_proto; +%}; +%typedef struct rpcb_entry rpcb_entry; +% +%/* +% * A list of addresses supported by a service. +% */ +% +%struct rpcb_entry_list { +% rpcb_entry rpcb_entry_map; +% struct rpcb_entry_list *rpcb_entry_next; +%}; +%typedef struct rpcb_entry_list rpcb_entry_list; +% +%typedef rpcb_entry_list *rpcb_entry_list_ptr; +% +%/* +% * rpcbind statistics +% */ +% +%#define rpcb_highproc_2 RPCBPROC_CALLIT +%#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR +%#define rpcb_highproc_4 RPCBPROC_GETSTAT +%#define RPCBSTAT_HIGHPROC 13 +%#define RPCBVERS_STAT 3 +%#define RPCBVERS_4_STAT 2 +%#define RPCBVERS_3_STAT 1 +%#define RPCBVERS_2_STAT 0 +% +%/* Link list of all the stats about getport and getaddr */ +% +%struct rpcbs_addrlist { +% rpcprog_t prog; +% rpcvers_t vers; +% int success; +% int failure; +% char *netid; +% struct rpcbs_addrlist *next; +%}; +%typedef struct rpcbs_addrlist rpcbs_addrlist; +% +%/* Link list of all the stats about rmtcall */ +% +%struct rpcbs_rmtcalllist { +% rpcprog_t prog; +% rpcvers_t vers; +% rpcproc_t proc; +% int success; +% int failure; +% int indirect; +% char *netid; +% struct rpcbs_rmtcalllist *next; +%}; +%typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist; +% +%typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; +% +%typedef rpcbs_addrlist *rpcbs_addrlist_ptr; +% +%typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; +% +%struct rpcb_stat { +% rpcbs_proc info; +% int setinfo; +% int unsetinfo; +% rpcbs_addrlist_ptr addrinfo; +% rpcbs_rmtcalllist_ptr rmtinfo; +%}; +%typedef struct rpcb_stat rpcb_stat; +% +%/* +% * One rpcb_stat structure is returned for each version of rpcbind +% * being monitored. +% */ +% +%typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; +% +%#ifdef __cplusplus +%} +%#endif +% +%#endif /* ndef _KERNEL */ +#endif /* RPC_HDR */ diff --git a/newlib/libc/sys/linux/include/rpc/rpcent.h b/newlib/libc/sys/linux/include/rpc/rpcent.h new file mode 100644 index 000000000..dbc8b0e5f --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/rpcent.h @@ -0,0 +1,69 @@ +/* $NetBSD: rpcent.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ +/* $FreeBSD: src/include/rpc/rpcent.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. + */ + +/* + * rpcent.h, + * For converting rpc program numbers to names etc. + * + */ + +#ifndef _RPC_RPCENT_H +#define _RPC_RPCENT_H + +/* #pragma ident "@(#)rpcent.h 1.13 94/04/25 SMI" */ +/* @(#)rpcent.h 1.1 88/12/06 SMI */ + + +struct rpcent { + char *r_name; /* name of server for this rpc program */ + char **r_aliases; /* alias list */ + int r_number; /* rpc program number */ +}; + +__BEGIN_DECLS +extern struct rpcent *getrpcbyname_r(const char *, struct rpcent *, + char *, int); +extern struct rpcent *getrpcbynumber_r(int, struct rpcent *, char *, int); +extern struct rpcent *getrpcent_r(struct rpcent *, char *, int); + +/* Old interfaces that return a pointer to a static area; MT-unsafe */ +extern struct rpcent *getrpcbyname(char *); +extern struct rpcent *getrpcbynumber(int); +extern struct rpcent *getrpcent(void); +extern void setrpcent(int); +extern void endrpcent(void); +__END_DECLS + +#endif /* !_RPC_CENT_H */ diff --git a/newlib/libc/sys/linux/include/rpc/svc.h b/newlib/libc/sys/linux/include/rpc/svc.h new file mode 100644 index 000000000..6a8997bda --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/svc.h @@ -0,0 +1,429 @@ +/* $NetBSD: svc.h,v 1.17 2000/06/02 22:57:56 fvdl Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)svc.h 1.35 88/12/17 SMI + * from: @(#)svc.h 1.27 94/04/25 SMI + * $FreeBSD: src/include/rpc/svc.h,v 1.22 2002/04/28 15:18:45 des Exp $ + */ + +/* + * svc.h, Server-side remote procedure call interface. + * + * Copyright (C) 1986-1993 by Sun Microsystems, Inc. + */ + +#ifndef _RPC_SVC_H +#define _RPC_SVC_H +#include + +/* + * This interface must manage two items concerning remote procedure calling: + * + * 1) An arbitrary number of transport connections upon which rpc requests + * are received. The two most notable transports are TCP and UDP; they are + * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; + * they in turn call xprt_register and xprt_unregister. + * + * 2) An arbitrary number of locally registered services. Services are + * described by the following four data: program number, version number, + * "service dispatch" function, a transport handle, and a boolean that + * indicates whether or not the exported program should be registered with a + * local binder service; if true the program's number and version and the + * port number from the transport handle are registered with the binder. + * These data are registered with the rpc svc system via svc_register. + * + * A service's dispatch function is called whenever an rpc request comes in + * on a transport. The request's program and version numbers must match + * those of the registered service. The dispatch function is passed two + * parameters, struct svc_req * and SVCXPRT *, defined below. + */ + +/* + * Service control requests + */ +#define SVCGET_VERSQUIET 1 +#define SVCSET_VERSQUIET 2 + + +enum xprt_stat { + XPRT_DIED, + XPRT_MOREREQS, + XPRT_IDLE +}; + +/* + * Server side transport handle + */ +typedef struct __rpc_svcxprt { + int xp_fd; + u_short xp_port; /* associated port number */ + const struct xp_ops { + /* receive incoming requests */ + bool_t (*xp_recv)(struct __rpc_svcxprt *, struct rpc_msg *); + /* get transport status */ + enum xprt_stat (*xp_stat)(struct __rpc_svcxprt *); + /* get arguments */ + bool_t (*xp_getargs)(struct __rpc_svcxprt *, xdrproc_t, + void *); + /* send reply */ + bool_t (*xp_reply)(struct __rpc_svcxprt *, struct rpc_msg *); + /* free mem allocated for args */ + bool_t (*xp_freeargs)(struct __rpc_svcxprt *, xdrproc_t, + void *); + /* destroy this struct */ + void (*xp_destroy)(struct __rpc_svcxprt *); + } *xp_ops; + int xp_addrlen; /* length of remote address */ + struct sockaddr_in xp_raddr; /* remote addr. (backward ABI compat) */ + /* XXX - fvdl stick this here for ABI backward compat reasons */ + const struct xp_ops2 { + /* catch-all function */ + bool_t (*xp_control)(struct __rpc_svcxprt *, const u_int, + void *); + } *xp_ops2; + char *xp_tp; /* transport provider device name */ + char *xp_netid; /* network token */ + struct netbuf xp_ltaddr; /* local transport address */ + struct netbuf xp_rtaddr; /* remote transport address */ + struct opaque_auth xp_verf; /* raw response verifier */ + void *xp_p1; /* private: for use by svc ops */ + void *xp_p2; /* private: for use by svc ops */ + void *xp_p3; /* private: for use by svc lib */ + int xp_type; /* transport type */ +} SVCXPRT; + +/* + * Service request + */ +struct svc_req { + u_int32_t rq_prog; /* service program number */ + u_int32_t rq_vers; /* service protocol version */ + u_int32_t rq_proc; /* the desired procedure */ + struct opaque_auth rq_cred; /* raw creds from the wire */ + void *rq_clntcred; /* read only cooked cred */ + SVCXPRT *rq_xprt; /* associated transport */ +}; + +/* + * Approved way of getting address of caller + */ +#define svc_getrpccaller(x) (&(x)->xp_rtaddr) + +/* + * FreeBSD-only definition to get the creds of the caller (AF_LOCAL). + */ +#define __svc_getcallercreds(x) ((struct cmsgcred *)(x)->xp_p2) + +/* + * Operations defined on an SVCXPRT handle + * + * SVCXPRT *xprt; + * struct rpc_msg *msg; + * xdrproc_t xargs; + * void * argsp; + */ +#define SVC_RECV(xprt, msg) \ + (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) +#define svc_recv(xprt, msg) \ + (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) + +#define SVC_STAT(xprt) \ + (*(xprt)->xp_ops->xp_stat)(xprt) +#define svc_stat(xprt) \ + (*(xprt)->xp_ops->xp_stat)(xprt) + +#define SVC_GETARGS(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) +#define svc_getargs(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) + +#define SVC_REPLY(xprt, msg) \ + (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) +#define svc_reply(xprt, msg) \ + (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) + +#define SVC_FREEARGS(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) +#define svc_freeargs(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) + +#define SVC_DESTROY(xprt) \ + (*(xprt)->xp_ops->xp_destroy)(xprt) +#define svc_destroy(xprt) \ + (*(xprt)->xp_ops->xp_destroy)(xprt) + +#define SVC_CONTROL(xprt, rq, in) \ + (*(xprt)->xp_ops2->xp_control)((xprt), (rq), (in)) + +/* + * Service registration + * + * svc_reg(xprt, prog, vers, dispatch, nconf) + * const SVCXPRT *xprt; + * const rpcprog_t prog; + * const rpcvers_t vers; + * const void (*dispatch)(); + * const struct netconfig *nconf; + */ + +__BEGIN_DECLS +extern bool_t svc_reg(SVCXPRT *, const rpcprog_t, const rpcvers_t, + void (*)(struct svc_req *, SVCXPRT *), + const struct netconfig *); +__END_DECLS + +/* + * Service un-registration + * + * svc_unreg(prog, vers) + * const rpcprog_t prog; + * const rpcvers_t vers; + */ + +__BEGIN_DECLS +extern void svc_unreg(const rpcprog_t, const rpcvers_t); +__END_DECLS + +/* + * Transport registration. + * + * xprt_register(xprt) + * SVCXPRT *xprt; + */ +__BEGIN_DECLS +extern void xprt_register(SVCXPRT *); +__END_DECLS + +/* + * Transport un-register + * + * xprt_unregister(xprt) + * SVCXPRT *xprt; + */ +__BEGIN_DECLS +extern void xprt_unregister(SVCXPRT *); +__END_DECLS + + +/* + * When the service routine is called, it must first check to see if it + * knows about the procedure; if not, it should call svcerr_noproc + * and return. If so, it should deserialize its arguments via + * SVC_GETARGS (defined above). If the deserialization does not work, + * svcerr_decode should be called followed by a return. Successful + * decoding of the arguments should be followed the execution of the + * procedure's code and a call to svc_sendreply. + * + * Also, if the service refuses to execute the procedure due to too- + * weak authentication parameters, svcerr_weakauth should be called. + * Note: do not confuse access-control failure with weak authentication! + * + * NB: In pure implementations of rpc, the caller always waits for a reply + * msg. This message is sent when svc_sendreply is called. + * Therefore pure service implementations should always call + * svc_sendreply even if the function logically returns void; use + * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows + * for the abuse of pure rpc via batched calling or pipelining. In the + * case of a batched call, svc_sendreply should NOT be called since + * this would send a return message, which is what batching tries to avoid. + * It is the service/protocol writer's responsibility to know which calls are + * batched and which are not. Warning: responding to batch calls may + * deadlock the caller and server processes! + */ + +__BEGIN_DECLS +extern bool_t svc_sendreply(SVCXPRT *, xdrproc_t, void *); +extern void svcerr_decode(SVCXPRT *); +extern void svcerr_weakauth(SVCXPRT *); +extern void svcerr_noproc(SVCXPRT *); +extern void svcerr_progvers(SVCXPRT *, rpcvers_t, rpcvers_t); +extern void svcerr_auth(SVCXPRT *, enum auth_stat); +extern void svcerr_noprog(SVCXPRT *); +extern void svcerr_systemerr(SVCXPRT *); +extern int rpc_reg(rpcprog_t, rpcvers_t, rpcproc_t, + char *(*)(char *), xdrproc_t, xdrproc_t, + char *); +__END_DECLS + +/* + * Lowest level dispatching -OR- who owns this process anyway. + * Somebody has to wait for incoming requests and then call the correct + * service routine. The routine svc_run does infinite waiting; i.e., + * svc_run never returns. + * Since another (co-existant) package may wish to selectively wait for + * incoming calls or other events outside of the rpc architecture, the + * routine svc_getreq is provided. It must be passed readfds, the + * "in-place" results of a select system call (see select, section 2). + */ + +/* + * Global keeper of rpc service descriptors in use + * dynamic; must be inspected before each call to select + */ +extern int svc_maxfd; +#ifdef FD_SETSIZE +extern fd_set svc_fdset; +#define svc_fds svc_fdset.fds_bits[0] /* compatibility */ +#else +extern int svc_fds; +#endif /* def FD_SETSIZE */ + +/* + * a small program implemented by the svc_rpc implementation itself; + * also see clnt.h for protocol numbers. + */ +__BEGIN_DECLS +extern void rpctest_service(void); +__END_DECLS + +__BEGIN_DECLS +extern void svc_getreq(int); +extern void svc_getreqset(fd_set *); +extern void svc_getreq_common(int); +struct pollfd; +extern void svc_getreq_poll(struct pollfd *, int); + +extern void svc_run(void); +extern void svc_exit(void); +__END_DECLS + +/* + * Socket to use on svcxxx_create call to get default socket + */ +#define RPC_ANYSOCK -1 +#define RPC_ANYFD RPC_ANYSOCK + +/* + * These are the existing service side transport implementations + */ + +__BEGIN_DECLS +/* + * Transport independent svc_create routine. + */ +extern int svc_create(void (*)(struct svc_req *, SVCXPRT *), + const rpcprog_t, const rpcvers_t, const char *); +/* + * void (*dispatch)(); -- dispatch routine + * const rpcprog_t prognum; -- program number + * const rpcvers_t versnum; -- version number + * const char *nettype; -- network type + */ + + +/* + * Generic server creation routine. It takes a netconfig structure + * instead of a nettype. + */ + +extern SVCXPRT *svc_tp_create(void (*)(struct svc_req *, SVCXPRT *), + const rpcprog_t, const rpcvers_t, + const struct netconfig *); + /* + * void (*dispatch)(); -- dispatch routine + * const rpcprog_t prognum; -- program number + * const rpcvers_t versnum; -- version number + * const struct netconfig *nconf; -- netconfig structure + */ + + +/* + * Generic TLI create routine + */ +extern SVCXPRT *svc_tli_create(const int, const struct netconfig *, + const struct t_bind *, const u_int, + const u_int); +/* + * const int fd; -- connection end point + * const struct netconfig *nconf; -- netconfig structure for network + * const struct t_bind *bindaddr; -- local bind address + * const u_int sendsz; -- max sendsize + * const u_int recvsz; -- max recvsize + */ + +/* + * Connectionless and connectionful create routines + */ + +extern SVCXPRT *svc_vc_create(const int, const u_int, const u_int); +/* + * const int fd; -- open connection end point + * const u_int sendsize; -- max send size + * const u_int recvsize; -- max recv size + */ + +/* + * Added for compatibility to old rpc 4.0. Obsoleted by svc_vc_create(). + */ +extern SVCXPRT *svcunix_create(int, u_int, u_int, char *); + +extern SVCXPRT *svc_dg_create(const int, const u_int, const u_int); + /* + * const int fd; -- open connection + * const u_int sendsize; -- max send size + * const u_int recvsize; -- max recv size + */ + + +/* + * the routine takes any *open* connection + * descriptor as its first input and is used for open connections. + */ +extern SVCXPRT *svc_fd_create(const int, const u_int, const u_int); +/* + * const int fd; -- open connection end point + * const u_int sendsize; -- max send size + * const u_int recvsize; -- max recv size + */ + +/* + * Added for compatibility to old rpc 4.0. Obsoleted by svc_fd_create(). + */ +extern SVCXPRT *svcunixfd_create(int, u_int, u_int); + +/* + * Memory based rpc (for speed check and testing) + */ +extern SVCXPRT *svc_raw_create(void); + +/* + * svc_dg_enable_cache() enables the cache on dg transports. + */ +int svc_dg_enablecache(SVCXPRT *, const u_int); + +int __rpc_get_local_uid(SVCXPRT *_transp, uid_t *_uid); + +__END_DECLS + + +/* for backward compatibility */ +#include + +#endif /* !_RPC_SVC_H */ diff --git a/newlib/libc/sys/linux/include/rpc/svc_auth.h b/newlib/libc/sys/linux/include/rpc/svc_auth.h new file mode 100644 index 000000000..366f752d9 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/svc_auth.h @@ -0,0 +1,55 @@ +/* $NetBSD: svc_auth.h,v 1.8 2000/06/02 22:57:57 fvdl Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)svc_auth.h 1.6 86/07/16 SMI + * @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/svc_auth.h,v 1.14 2002/03/23 17:24:55 imp Exp $ + */ + +/* + * svc_auth.h, Service side of rpc authentication. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_SVC_AUTH_H +#define _RPC_SVC_AUTH_H + +/* + * Server side authenticator + */ +__BEGIN_DECLS +extern enum auth_stat _authenticate(struct svc_req *, struct rpc_msg *); +extern int svc_auth_reg(int, enum auth_stat (*)(struct svc_req *, + struct rpc_msg *)); + +__END_DECLS + +#endif /* !_RPC_SVC_AUTH_H */ diff --git a/newlib/libc/sys/linux/include/rpc/svc_dg.h b/newlib/libc/sys/linux/include/rpc/svc_dg.h new file mode 100644 index 000000000..67d25643b --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/svc_dg.h @@ -0,0 +1,51 @@ +/* $NetBSD: svc_dg.h,v 1.1 2000/06/02 23:11:16 fvdl Exp $ */ +/* $FreeBSD: src/include/rpc/svc_dg.h,v 1.1 2001/03/19 12:49:47 alfred Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * XXX - this file exists only so that the rpcbind code can pull it in. + * This should go away. It should only be include by svc_dg.c and + * rpcb_svc_com.c in the rpcbind code. + */ + +/* + * kept in xprt->xp_p2 + */ +struct svc_dg_data { + /* XXX: optbuf should be the first field, used by ti_opts.c code */ + size_t su_iosz; /* size of send.recv buffer */ + u_int32_t su_xid; /* transaction id */ + XDR su_xdrs; /* XDR handle */ + char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */ + void *su_cache; /* cached data, NULL if none */ +}; + +#define __rpcb_get_dg_xidp(x) (&((struct svc_dg_data *)(x)->xp_p2)->su_xid) diff --git a/newlib/libc/sys/linux/include/rpc/svc_soc.h b/newlib/libc/sys/linux/include/rpc/svc_soc.h new file mode 100644 index 000000000..ceb4392c7 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/svc_soc.h @@ -0,0 +1,116 @@ +/* $NetBSD: svc_soc.h,v 1.1 2000/06/02 22:57:57 fvdl Exp $ */ +/* $FreeBSD: src/include/rpc/svc_soc.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. + */ + +/* + * svc.h, Server-side remote procedure call interface. + */ + +#ifndef _RPC_SVC_SOC_H +#define _RPC_SVC_SOC_H +#include + +/* #pragma ident "@(#)svc_soc.h 1.11 94/04/25 SMI" */ +/* svc_soc.h 1.8 89/05/01 SMI */ + +/* + * All the following declarations are only for backward compatibility + * with TS-RPC + */ + +/* + * Approved way of getting address of caller + */ +#define svc_getcaller(x) (&(x)->xp_raddr) + +/* + * Service registration + * + * svc_register(xprt, prog, vers, dispatch, protocol) + * SVCXPRT *xprt; + * u_long prog; + * u_long vers; + * void (*dispatch)(); + * int protocol; like TCP or UDP, zero means do not register + */ +__BEGIN_DECLS +extern bool_t svc_register(SVCXPRT *, u_long, u_long, + void (*)(struct svc_req *, SVCXPRT *), int); +__END_DECLS + +/* + * Service un-registration + * + * svc_unregister(prog, vers) + * u_long prog; + * u_long vers; + */ +__BEGIN_DECLS +extern void svc_unregister(u_long, u_long); +__END_DECLS + + +/* + * Memory based rpc for testing and timing. + */ +__BEGIN_DECLS +extern SVCXPRT *svcraw_create(void); +__END_DECLS + + +/* + * Udp based rpc. + */ +__BEGIN_DECLS +extern SVCXPRT *svcudp_create(int); +extern SVCXPRT *svcudp_bufcreate(int, u_int, u_int); +extern int svcudp_enablecache(SVCXPRT *, u_long); +__END_DECLS + + +/* + * Tcp based rpc. + */ +__BEGIN_DECLS +extern SVCXPRT *svctcp_create(int, u_int, u_int); +__END_DECLS + +/* + * Fd based rpc. + */ +__BEGIN_DECLS +extern SVCXPRT *svcfd_create(int, u_int, u_int); +__END_DECLS + +#endif /* !_RPC_SVC_SOC_H */ diff --git a/newlib/libc/sys/linux/include/rpc/types.h b/newlib/libc/sys/linux/include/rpc/types.h new file mode 100644 index 000000000..259127c00 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/types.h @@ -0,0 +1,108 @@ +/* $NetBSD: types.h,v 1.13 2000/06/13 01:02:44 thorpej Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)types.h 1.18 87/07/24 SMI + * from: @(#)types.h 2.3 88/08/15 4.0 RPCSRC + * $FreeBSD: src/include/rpc/types.h,v 1.10 2001/03/19 12:49:47 alfred Exp $ + */ + +/* + * Rpc additions to + */ +#ifndef _RPC_TYPES_H +#define _RPC_TYPES_H + +#include + +typedef int32_t bool_t; +typedef int32_t enum_t; + +typedef u_int32_t rpcprog_t; +typedef u_int32_t rpcvers_t; +typedef u_int32_t rpcproc_t; +typedef u_int32_t rpcprot_t; +typedef u_int32_t rpcport_t; +typedef int32_t rpc_inline_t; + +#define __dontcare__ -1 + +#ifndef FALSE +# define FALSE (0) +#endif +#ifndef TRUE +# define TRUE (1) +#endif +#ifndef NULL +# define NULL 0 +#endif + +#define mem_alloc(bsize) calloc(1, bsize) +#define mem_free(ptr, bsize) free(ptr) + +#include +#include + +/* + * The netbuf structure is defined here, because FreeBSD / NetBSD only use + * it inside the RPC code. It's in on SVR4, but it would be confusing + * to have an xti.h, since FreeBSD / NetBSD does not support XTI/TLI. + */ + +/* + * The netbuf structure is used for transport-independent address storage. + */ +struct netbuf { + unsigned int maxlen; + unsigned int len; + void *buf; +}; + +/* + * The format of the addres and options arguments of the XTI t_bind call. + * Only provided for compatibility, it should not be used. + */ + +struct t_bind { + struct netbuf addr; + unsigned int qlen; +}; + +/* + * Internal library and rpcbind use. This is not an exported interface, do + * not use. + */ +struct __rpc_sockinfo { + int si_af; + int si_proto; + int si_socktype; + int si_alen; +}; + +#endif /* !_RPC_TYPES_H */ diff --git a/newlib/libc/sys/linux/include/rpc/xdr.h b/newlib/libc/sys/linux/include/rpc/xdr.h new file mode 100644 index 000000000..678dbe417 --- /dev/null +++ b/newlib/libc/sys/linux/include/rpc/xdr.h @@ -0,0 +1,365 @@ +/* $NetBSD: xdr.h,v 1.19 2000/07/17 05:00:45 matt Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)xdr.h 1.19 87/04/22 SMI + * from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/xdr.h,v 1.21 2002/04/28 15:18:45 des Exp $ + */ + +/* + * xdr.h, External Data Representation Serialization Routines. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_XDR_H +#define _RPC_XDR_H +#include + +/* + * XDR provides a conventional way for converting between C data + * types and an external bit-string representation. Library supplied + * routines provide for the conversion on built-in C data types. These + * routines and utility routines defined here are used to help implement + * a type encode/decode routine for each user-defined type. + * + * Each data type provides a single procedure which takes two arguments: + * + * bool_t + * xdrproc(xdrs, argresp) + * XDR *xdrs; + * *argresp; + * + * xdrs is an instance of a XDR handle, to which or from which the data + * type is to be converted. argresp is a pointer to the structure to be + * converted. The XDR handle contains an operation field which indicates + * which of the operations (ENCODE, DECODE * or FREE) is to be performed. + * + * XDR_DECODE may allocate space if the pointer argresp is null. This + * data can be freed with the XDR_FREE operation. + * + * We write only one procedure per data type to make it easy + * to keep the encode and decode procedures for a data type consistent. + * In many cases the same code performs all operations on a user defined type, + * because all the hard work is done in the component type routines. + * decode as a series of calls on the nested data types. + */ + +/* + * Xdr operations. XDR_ENCODE causes the type to be encoded into the + * stream. XDR_DECODE causes the type to be extracted from the stream. + * XDR_FREE can be used to release the space allocated by an XDR_DECODE + * request. + */ +enum xdr_op { + XDR_ENCODE=0, + XDR_DECODE=1, + XDR_FREE=2 +}; + +/* + * This is the number of bytes per unit of external data. + */ +#define BYTES_PER_XDR_UNIT (4) +#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ + * BYTES_PER_XDR_UNIT) + +/* + * The XDR handle. + * Contains operation which is being applied to the stream, + * an operations vector for the particular implementation (e.g. see xdr_mem.c), + * and two private fields for the use of the particular implementation. + */ +typedef struct __rpc_xdr { + enum xdr_op x_op; /* operation; fast additional param */ + const struct xdr_ops { + /* get a long from underlying stream */ + bool_t (*x_getlong)(struct __rpc_xdr *, long *); + /* put a long to " */ + bool_t (*x_putlong)(struct __rpc_xdr *, const long *); + /* get some bytes from " */ + bool_t (*x_getbytes)(struct __rpc_xdr *, char *, u_int); + /* put some bytes to " */ + bool_t (*x_putbytes)(struct __rpc_xdr *, const char *, u_int); + /* returns bytes off from beginning */ + u_int (*x_getpostn)(struct __rpc_xdr *); + /* lets you reposition the stream */ + bool_t (*x_setpostn)(struct __rpc_xdr *, u_int); + /* buf quick ptr to buffered data */ + int32_t *(*x_inline)(struct __rpc_xdr *, u_int); + /* free privates of this xdr_stream */ + void (*x_destroy)(struct __rpc_xdr *); + bool_t (*x_control)(struct __rpc_xdr *, int, void *); + } *x_ops; + char * x_public; /* users' data */ + void * x_private; /* pointer to private data */ + char * x_base; /* private used for position info */ + int x_handy; /* extra private word */ +} XDR; + +/* + * A xdrproc_t exists for each data type which is to be encoded or decoded. + * + * The second argument to the xdrproc_t is a pointer to an opaque pointer. + * The opaque pointer generally points to a structure of the data type + * to be decoded. If this pointer is 0, then the type routines should + * allocate dynamic storage of the appropriate size and return it. + */ +#ifdef _KERNEL +typedef bool_t (*xdrproc_t)(XDR *, void *, u_int); +#else +/* + * XXX can't actually prototype it, because some take three args!!! + */ +typedef bool_t (*xdrproc_t)(XDR *, ...); +#endif + +/* + * Operations defined on a XDR handle + * + * XDR *xdrs; + * long *longp; + * char * addr; + * u_int len; + * u_int pos; + */ +#define XDR_GETLONG(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlong)(xdrs, longp) +#define xdr_getlong(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlong)(xdrs, longp) + +#define XDR_PUTLONG(xdrs, longp) \ + (*(xdrs)->x_ops->x_putlong)(xdrs, longp) +#define xdr_putlong(xdrs, longp) \ + (*(xdrs)->x_ops->x_putlong)(xdrs, longp) + +static __inline int +xdr_getint32(XDR *xdrs, int32_t *ip) +{ + long l; + + if (!xdr_getlong(xdrs, &l)) + return (FALSE); + *ip = (int32_t)l; + return (TRUE); +} + +static __inline int +xdr_putint32(XDR *xdrs, int32_t *ip) +{ + long l; + + l = (long)*ip; + return xdr_putlong(xdrs, &l); +} + +#define XDR_GETINT32(xdrs, int32p) xdr_getint32(xdrs, int32p) +#define XDR_PUTINT32(xdrs, int32p) xdr_putint32(xdrs, int32p) + +#define XDR_GETBYTES(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) +#define xdr_getbytes(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) + +#define XDR_PUTBYTES(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) +#define xdr_putbytes(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) + +#define XDR_GETPOS(xdrs) \ + (*(xdrs)->x_ops->x_getpostn)(xdrs) +#define xdr_getpos(xdrs) \ + (*(xdrs)->x_ops->x_getpostn)(xdrs) + +#define XDR_SETPOS(xdrs, pos) \ + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) +#define xdr_setpos(xdrs, pos) \ + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) + +#define XDR_INLINE(xdrs, len) \ + (*(xdrs)->x_ops->x_inline)(xdrs, len) +#define xdr_inline(xdrs, len) \ + (*(xdrs)->x_ops->x_inline)(xdrs, len) + +#define XDR_DESTROY(xdrs) \ + if ((xdrs)->x_ops->x_destroy) \ + (*(xdrs)->x_ops->x_destroy)(xdrs) +#define xdr_destroy(xdrs) \ + if ((xdrs)->x_ops->x_destroy) \ + (*(xdrs)->x_ops->x_destroy)(xdrs) + +#define XDR_CONTROL(xdrs, req, op) \ + if ((xdrs)->x_ops->x_control) \ + (*(xdrs)->x_ops->x_control)(xdrs, req, op) +#define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op) + +/* + * Solaris strips the '_t' from these types -- not sure why. + * But, let's be compatible. + */ +#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp) +#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp) +#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp) +#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp) +#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp) + +/* + * Support struct for discriminated unions. + * You create an array of xdrdiscrim structures, terminated with + * a entry with a null procedure pointer. The xdr_union routine gets + * the discriminant value and then searches the array of structures + * for a matching value. If a match is found the associated xdr routine + * is called to handle that part of the union. If there is + * no match, then a default routine may be called. + * If there is no match and no default routine it is an error. + */ +#define NULL_xdrproc_t ((xdrproc_t)0) +struct xdr_discrim { + int value; + xdrproc_t proc; +}; + +/* + * In-line routines for fast encode/decode of primitive data types. + * Caveat emptor: these use single memory cycles to get the + * data from the underlying buffer, and will fail to operate + * properly if the data is not aligned. The standard way to use these + * is to say: + * if ((buf = XDR_INLINE(xdrs, count)) == NULL) + * return (FALSE); + * <<< macro calls >>> + * where ``count'' is the number of bytes of data occupied + * by the primitive data types. + * + * N.B. and frozen for all time: each data type here uses 4 bytes + * of external representation. + */ +#define IXDR_GET_INT32(buf) ((int32_t)__ntohl((u_int32_t)*(buf)++)) +#define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)__htonl((u_int32_t)v)) +#define IXDR_GET_U_INT32(buf) ((u_int32_t)IXDR_GET_INT32(buf)) +#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v))) + +#define IXDR_GET_LONG(buf) ((long)__ntohl((u_int32_t)*(buf)++)) +#define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)__htonl((u_int32_t)v)) + +#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) +#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) +#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) +#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) +#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) + +#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), (v)) +#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), (v)) +#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), (v)) +#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), (v)) +#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), (v)) + +/* + * These are the "generic" xdr routines. + */ +__BEGIN_DECLS +extern bool_t xdr_void(void); +extern bool_t xdr_int(XDR *, int *); +extern bool_t xdr_u_int(XDR *, u_int *); +extern bool_t xdr_long(XDR *, long *); +extern bool_t xdr_u_long(XDR *, u_long *); +extern bool_t xdr_short(XDR *, short *); +extern bool_t xdr_u_short(XDR *, u_short *); +extern bool_t xdr_int16_t(XDR *, int16_t *); +extern bool_t xdr_u_int16_t(XDR *, u_int16_t *); +extern bool_t xdr_int32_t(XDR *, int32_t *); +extern bool_t xdr_u_int32_t(XDR *, u_int32_t *); +extern bool_t xdr_int64_t(XDR *, int64_t *); +extern bool_t xdr_u_int64_t(XDR *, u_int64_t *); +extern bool_t xdr_bool(XDR *, bool_t *); +extern bool_t xdr_enum(XDR *, enum_t *); +extern bool_t xdr_array(XDR *, char **, u_int *, u_int, u_int, xdrproc_t); +extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int); +extern bool_t xdr_opaque(XDR *, char *, u_int); +extern bool_t xdr_string(XDR *, char **, u_int); +extern bool_t xdr_union(XDR *, enum_t *, char *, const struct xdr_discrim *, xdrproc_t); +extern bool_t xdr_char(XDR *, char *); +extern bool_t xdr_u_char(XDR *, u_char *); +extern bool_t xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t); +extern bool_t xdr_float(XDR *, float *); +extern bool_t xdr_double(XDR *, double *); +extern bool_t xdr_quadruple(XDR *, long double *); +extern bool_t xdr_reference(XDR *, char **, u_int, xdrproc_t); +extern bool_t xdr_pointer(XDR *, char **, u_int, xdrproc_t); +extern bool_t xdr_wrapstring(XDR *, char **); +extern void xdr_free(xdrproc_t, void *); +extern bool_t xdr_hyper(XDR *, long long *); +extern bool_t xdr_u_hyper(XDR *, unsigned long long *); +extern bool_t xdr_longlong_t(XDR *, long long *); +extern bool_t xdr_u_longlong_t(XDR *, unsigned long long *); +__END_DECLS + +/* + * Common opaque bytes objects used by many rpc protocols; + * declared here due to commonality. + */ +#define MAX_NETOBJ_SZ 1024 +struct netobj { + u_int n_len; + char *n_bytes; +}; +typedef struct netobj netobj; +extern bool_t xdr_netobj(XDR *, struct netobj *); + +/* + * These are the public routines for the various implementations of + * xdr streams. + */ +__BEGIN_DECLS +/* XDR using memory buffers */ +extern void xdrmem_create(XDR *, char *, u_int, enum xdr_op); + +/* XDR using stdio library */ +#ifdef _STDIO_H_ +extern void xdrstdio_create(XDR *, FILE *, enum xdr_op); +#endif + +/* XDR pseudo records for tcp */ +extern void xdrrec_create(XDR *, u_int, u_int, void *, + int (*)(void *, void *, int), + int (*)(void *, void *, int)); + +/* make end of xdr record */ +extern bool_t xdrrec_endofrecord(XDR *, int); + +/* move to beginning of next record */ +extern bool_t xdrrec_skiprecord(XDR *); + +/* true if no more input */ +extern bool_t xdrrec_eof(XDR *); +extern u_int xdrrec_readbytes(XDR *, caddr_t, u_int); +__END_DECLS + +#endif /* !_RPC_XDR_H */ diff --git a/newlib/libc/sys/linux/include/rune.h b/newlib/libc/sys/linux/include/rune.h new file mode 100644 index 000000000..d8aa03dda --- /dev/null +++ b/newlib/libc/sys/linux/include/rune.h @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)rune.h 8.1 (Berkeley) 6/27/93 + * $FreeBSD: src/include/rune.h,v 1.2 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _RUNE_H_ +#define _RUNE_H_ + +#include +#include + +#define _PATH_LOCALE "/usr/share/locale" + +#define _INVALID_RUNE _CurrentRuneLocale->invalid_rune + +#define __sgetrune _CurrentRuneLocale->sgetrune +#define __sputrune _CurrentRuneLocale->sputrune + +#define sgetrune(s, n, r) (*__sgetrune)((s), (n), (r)) +#define sputrune(c, s, n, r) (*__sputrune)((c), (s), (n), (r)) + +__BEGIN_DECLS +char *mbrune(const char *, rune_t); +char *mbrrune(const char *, rune_t); +char *mbmb(const char *, char *); +long fgetrune(FILE *); +int fputrune(rune_t, FILE *); +int fungetrune(rune_t, FILE *); +int setrunelocale(char *); +void setinvalidrune(rune_t); +__END_DECLS + +#endif /*! _RUNE_H_ */ diff --git a/newlib/libc/sys/linux/include/runetype.h b/newlib/libc/sys/linux/include/runetype.h new file mode 100644 index 000000000..a0a3a4316 --- /dev/null +++ b/newlib/libc/sys/linux/include/runetype.h @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)runetype.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/runetype.h,v 1.5 2002/03/26 01:35:05 bde Exp $ + */ + +#ifndef _RUNETYPE_H_ +#define _RUNETYPE_H_ + +#include +#include + +#ifdef _BSD_RUNE_T_ +typedef _BSD_RUNE_T_ rune_t; +#undef _BSD_RUNE_T_ +#endif + +typedef int rune_t; + +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +typedef unsigned int size_t; + +#ifdef _BSD_WCHAR_T_ +typedef _BSD_WCHAR_T_ wchar_t; +#undef _BSD_WCHAR_T_ +#endif + +#define _CACHED_RUNES (1 <<8 ) /* Must be a power of 2 */ +#define _CRMASK (~(_CACHED_RUNES - 1)) + +/* + * The lower 8 bits of runetype[] contain the digit value of the rune. + */ +typedef struct { + rune_t min; /* First rune of the range */ + rune_t max; /* Last rune (inclusive) of the range */ + rune_t map; /* What first maps to in maps */ + unsigned long *types; /* Array of types in range */ +} _RuneEntry; + +typedef struct { + int nranges; /* Number of ranges stored */ + _RuneEntry *ranges; /* Pointer to the ranges */ +} _RuneRange; + +typedef struct { + char magic[8]; /* Magic saying what version we are */ + char encoding[32]; /* ASCII name of this encoding */ + + rune_t (*sgetrune)(const char *, size_t, char const **); + int (*sputrune)(rune_t, char *, size_t, char **); + rune_t invalid_rune; + + unsigned long runetype[_CACHED_RUNES]; + rune_t maplower[_CACHED_RUNES]; + rune_t mapupper[_CACHED_RUNES]; + + /* + * The following are to deal with Runes larger than _CACHED_RUNES - 1. + * Their data is actually contiguous with this structure so as to make + * it easier to read/write from/to disk. + */ + _RuneRange runetype_ext; + _RuneRange maplower_ext; + _RuneRange mapupper_ext; + + void *variable; /* Data which depends on the encoding */ + int variable_len; /* how long that data is */ +} _RuneLocale; + +#define _RUNE_MAGIC_1 "RuneMagi" /* Indicates version 0 of RuneLocale */ + +extern _RuneLocale _DefaultRuneLocale; +extern _RuneLocale *_CurrentRuneLocale; + +#endif /* !_RUNETYPE_H_ */ diff --git a/newlib/libc/sys/linux/include/semaphore.h b/newlib/libc/sys/linux/include/semaphore.h new file mode 100644 index 000000000..8793768a8 --- /dev/null +++ b/newlib/libc/sys/linux/include/semaphore.h @@ -0,0 +1 @@ +#include diff --git a/newlib/libc/sys/linux/include/setlocale.h b/newlib/libc/sys/linux/include/setlocale.h new file mode 100644 index 000000000..3eb769863 --- /dev/null +++ b/newlib/libc/sys/linux/include/setlocale.h @@ -0,0 +1,37 @@ +/*- + * Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/locale/setlocale.h,v 1.4 2001/12/20 18:28:52 phantom Exp $ + */ + +#ifndef _SETLOCALE_H_ +#define _SETLOCALE_H_ + +#define ENCODING_LEN 31 +#define CATEGORY_LEN 11 + +extern char *_PathLocale; + +#endif /* !_SETLOCALE_H_ */ diff --git a/newlib/libc/sys/linux/include/un-namespace.h b/newlib/libc/sys/linux/include/un-namespace.h new file mode 100644 index 000000000..01d9b8fa0 --- /dev/null +++ b/newlib/libc/sys/linux/include/un-namespace.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2001 Daniel Eischen . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/include/un-namespace.h,v 1.7 2002/03/29 22:43:42 markm Exp $ + */ + +#ifndef _UN_NAMESPACE_H_ +#define _UN_NAMESPACE_H_ + +#undef accept +#undef __acl_aclcheck_fd +#undef __acl_delete_fd +#undef __acl_get_fd +#undef __acl_set_fd +#undef bind +#undef __cap_get_fd +#undef __cap_set_fd +#undef close +#undef connect +#undef dup +#undef dup2 +#undef execve +#undef fcntl +#undef flock +#undef fstat +#undef fstatfs +#undef fsync +#undef getdirentries +#undef getlogin +#undef getpeername +#undef getprogname +#undef getsockname +#undef getsockopt +#undef ioctl +#undef kevent +#undef listen +#undef nanosleep +#undef open +#undef pthread_getspecific +#undef pthread_key_create +#undef pthread_key_delete +#undef pthread_mutex_destroy +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_trylock +#undef pthread_mutex_unlock +#undef pthread_mutexattr_init +#undef pthread_mutexattr_destroy +#undef pthread_mutexattr_settype +#undef pthread_once +#undef pthread_self +#undef pthread_setspecific +#undef read +#undef readv +#undef recvfrom +#undef recvmsg +#undef select +#undef sendmsg +#undef sendto +#undef setsockopt +#undef sigaction +#undef sigprocmask +#undef sigsuspend +#undef socket +#undef socketpair +#undef wait4 +#undef write +#undef writev + +#if 0 +#undef creat +#undef fchflags +#undef fchmod +#undef fpathconf +#undef msync +#undef nfssvc +#undef pause +#undef poll +#undef pthread_rwlock_destroy +#undef pthread_rwlock_init +#undef pthread_rwlock_rdlock +#undef pthread_rwlock_tryrdlock +#undef pthread_rwlock_trywrlock +#undef pthread_rwlock_unlock +#undef pthread_rwlock_wrlock +#undef pthread_rwlockattr_init +#undef pthread_rwlockattr_destroy +#undef sched_yield +#undef sendfile +#undef shutdown +#undef sigaltstack +#undef sigpending +#undef sigreturn +#undef sigsetmask +#undef sleep +#undef system +#undef tcdrain +#undef wait +#undef waitpid +#endif /* 0 */ + +#ifdef _SIGNAL_H_ +int _sigaction(int, const struct sigaction *, struct sigaction *); +#endif + +#ifdef _SYS_EVENT_H_ +int _kevent(int, const struct kevent *, int, struct kevent *, + int, const struct timespec *); +#endif + +#ifdef _SYS_FCNTL_H_ +int _flock(int, int); +#endif + +#undef err +#undef warn + +#endif /* _UN_NAMESPACE_H_ */ diff --git a/newlib/libc/sys/linux/include/wordexp.h b/newlib/libc/sys/linux/include/wordexp.h new file mode 100644 index 000000000..5bc3d00f8 --- /dev/null +++ b/newlib/libc/sys/linux/include/wordexp.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +#include + +struct _wordexp_t +{ + size_t we_wordc; /* Count of words matched by words. */ + char **we_wordv; /* Pointer to list of expanded words. */ + size_t we_offs; /* Slots to reserve at the beginning of we_wordv. */ +}; + +typedef struct _wordexp_t wordexp_t; + +#define WRDE_DOOFFS 0x0001 /* Use we_offs. */ +#define WRDE_APPEND 0x0002 /* Append to output from previous call. */ +#define WRDE_NOCMD 0x0004 /* Don't perform command substitution. */ +#define WRDE_REUSE 0x0008 /* pwordexp points to a wordexp_t struct returned from + a previous successful call to wordexp. */ +#define WRDE_SHOWERR 0x0010 /* Print error messages to stderr. */ +#define WRDE_UNDEF 0x0020 /* Report attempt to expand undefined shell variable. */ + +enum { + WRDE_SUCCESS, + WRDE_NOSPACE, + WRDE_BADCHAR, + WRDE_BADVAL, + WRDE_CMDSUB, + WRDE_SYNTAX, + WRDE_NOSYS +}; + +/* Note: This implementation of wordexp requires a version of bash + that supports the --wordexp and --protected arguments to be present + on the system. It does not support the WRDE_UNDEF flag. */ +int wordexp(const char *, wordexp_t *, int); +void wordfree(wordexp_t *); diff --git a/newlib/libc/sys/linux/intl/Makefile.am b/newlib/libc/sys/linux/intl/Makefile.am new file mode 100644 index 000000000..ec1021793 --- /dev/null +++ b/newlib/libc/sys/linux/intl/Makefile.am @@ -0,0 +1,36 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +LIB_SOURCES = \ + bindtextdom.c catgets.c dcgettext.c dgettext.c gettext.c \ + dcigettext.c dcngettext.c dngettext.c ngettext.c open_catalog.c \ + finddomain.c loadmsgcat.c localealias.c textdomain.c \ + l10nflist.c explodename.c plural.c stpcpy.c + + +libintl_la_LDFLAGS = -Xcompiler -nostdlib + +msgcatdir = /usr/share/locale + +if USE_LIBTOOL +noinst_LTLIBRARIES = libintl.la +libintl_la_SOURCES = $(LIB_SOURCES) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(LIB_SOURCES) +noinst_DATA = +endif # USE_LIBTOOL + +include $(srcdir)/../../../../Makefile.shared + +AM_CFLAGS = -D_LIBC -DHAVE_CONFIG_H -D_GNU_SOURCE -D__libc_enable_secure=1 -D'LOCALEDIR="$(msgcatdir)"' -D'LOCALE_ALIAS_PATH="$(msgcatdir)"' -DNLSPATH='"$(msgcatdir)/%L/%N:$(msgcatdir)/%L/LC_MESSAGES/%N:$(msgcatdir)/%l/%N:$(msgcatdir)/%l/LC_MESSAGES/%N:"' + +# shouldn't have to do the following, but if needed +BISONFLAGS = --yacc --name-prefix=__gettext --output +plural.c: plural.y + $(BISON) $(BISONFLAGS) $@ $^ + diff --git a/newlib/libc/sys/linux/intl/Makefile.in b/newlib/libc/sys/linux/intl/Makefile.in new file mode 100644 index 000000000..8cbf52b6f --- /dev/null +++ b/newlib/libc/sys/linux/intl/Makefile.in @@ -0,0 +1,386 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LINUX_MACH_LIB = @LINUX_MACH_LIB@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +aext = @aext@ +libm_machine_dir = @libm_machine_dir@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +LIB_SOURCES = \ + bindtextdom.c catgets.c dcgettext.c dgettext.c gettext.c \ + dcigettext.c dcngettext.c dngettext.c ngettext.c open_catalog.c \ + finddomain.c loadmsgcat.c localealias.c textdomain.c \ + l10nflist.c explodename.c plural.c stpcpy.c + + +libintl_la_LDFLAGS = -Xcompiler -nostdlib + +msgcatdir = /usr/share/locale + +@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libintl.la +@USE_LIBTOOL_TRUE@libintl_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) +@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in +@USE_LIBTOOL_FALSE@noinst_DATA = +@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a +@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) + +AM_CFLAGS = -D_LIBC -DHAVE_CONFIG_H -D_GNU_SOURCE -D__libc_enable_secure=1 -D'LOCALEDIR="$(msgcatdir)"' -D'LOCALE_ALIAS_PATH="$(msgcatdir)"' -DNLSPATH='"$(msgcatdir)/%L/%N:$(msgcatdir)/%L/LC_MESSAGES/%N:$(msgcatdir)/%l/%N:$(msgcatdir)/%l/LC_MESSAGES/%N:"' + +# shouldn't have to do the following, but if needed +BISONFLAGS = --yacc --name-prefix=__gettext --output +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +lib_a_LIBADD = +@USE_LIBTOOL_FALSE@lib_a_OBJECTS = bindtextdom.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@catgets.$(OBJEXT) dcgettext.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dgettext.$(OBJEXT) gettext.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dcigettext.$(OBJEXT) dcngettext.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@dngettext.$(OBJEXT) ngettext.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@open_catalog.$(OBJEXT) finddomain.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@loadmsgcat.$(OBJEXT) localealias.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@textdomain.$(OBJEXT) l10nflist.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@explodename.$(OBJEXT) plural.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@stpcpy.$(OBJEXT) +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libintl_la_LIBADD = +@USE_LIBTOOL_TRUE@libintl_la_OBJECTS = bindtextdom.lo catgets.lo \ +@USE_LIBTOOL_TRUE@dcgettext.lo dgettext.lo gettext.lo dcigettext.lo \ +@USE_LIBTOOL_TRUE@dcngettext.lo dngettext.lo ngettext.lo \ +@USE_LIBTOOL_TRUE@open_catalog.lo finddomain.lo loadmsgcat.lo \ +@USE_LIBTOOL_TRUE@localealias.lo textdomain.lo l10nflist.lo \ +@USE_LIBTOOL_TRUE@explodename.lo plural.lo stpcpy.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(noinst_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(lib_a_SOURCES) $(libintl_la_SOURCES) +OBJECTS = $(lib_a_OBJECTS) $(libintl_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../Makefile.shared + cd $(top_srcdir) && $(AUTOMAKE) --cygnus intl/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) + -rm -f lib.a + $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +mostlyclean-noinstLTLIBRARIES: + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + +distclean-noinstLTLIBRARIES: + +maintainer-clean-noinstLTLIBRARIES: + +libintl.la: $(libintl_la_OBJECTS) $(libintl_la_DEPENDENCIES) + $(LINK) $(libintl_la_LDFLAGS) $(libintl_la_OBJECTS) $(libintl_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = intl + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ + clean-noinstLTLIBRARIES clean-tags clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstLIBRARIES distclean-compile \ + distclean-libtool distclean-noinstLTLIBRARIES \ + distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-noinstLTLIBRARIES \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ +distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ +maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-info-am install-info \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done +plural.c: plural.y + $(BISON) $(BISONFLAGS) $@ $^ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/libc/sys/linux/intl/bindtextdom.c b/newlib/libc/sys/linux/intl/bindtextdom.c new file mode 100644 index 000000000..afd503050 --- /dev/null +++ b/newlib/libc/sys/linux/intl/bindtextdom.c @@ -0,0 +1,387 @@ +/* Implementation of the bindtextdomain(3) function + Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) (bcopy (Src, Dst, Num), (Dst)) +# endif +#endif + +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif +#include "gettextP.h" + +#ifdef _LIBC +/* We have to handle multi-threaded applications. */ +# include +#else +/* Provide dummy implementation if this is outside glibc. */ +# define __libc_rwlock_define(CLASS, NAME) +# define __libc_rwlock_wrlock(NAME) +# define __libc_rwlock_unlock(NAME) +#endif + +/* The internal variables in the standalone libintl.a must have different + names than the internal variables in GNU libc, otherwise programs + using libintl.a cannot be linked statically. */ +#if !defined _LIBC +# define _nl_default_dirname _nl_default_dirname__ +# define _nl_domain_bindings _nl_domain_bindings__ +#endif + +/* Some compilers, like SunOS4 cc, don't have offsetof in . */ +#ifndef offsetof +# define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) +#endif + +/* @@ end of prolog @@ */ + +/* Contains the default location of the message catalogs. */ +extern const char _nl_default_dirname[]; + +/* List with bindings of specific domains. */ +extern struct binding *_nl_domain_bindings; + +/* Lock variable to protect the global data in the gettext implementation. */ +__libc_rwlock_define (extern, _nl_state_lock) + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define BINDTEXTDOMAIN __bindtextdomain +# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset +# ifdef _GLIBC +# ifndef strdup +# define strdup(str) __strdup (str) +# endif +# endif +#else +# define BINDTEXTDOMAIN bindtextdomain__ +# define BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset__ +#endif + +/* Prototypes for local functions. */ +static void set_binding_values PARAMS ((const char *domainname, + const char **dirnamep, + const char **codesetp)); + +/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP + to be used for the DOMAINNAME message catalog. + If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not + modified, only the current value is returned. + If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither + modified nor returned. */ +static void +set_binding_values (domainname, dirnamep, codesetp) + const char *domainname; + const char **dirnamep; + const char **codesetp; +{ + struct binding *binding; + int modified; + + /* Some sanity checks. */ + if (domainname == NULL || domainname[0] == '\0') + { + if (dirnamep) + *dirnamep = NULL; + if (codesetp) + *codesetp = NULL; + return; + } + + __libc_rwlock_wrlock (_nl_state_lock); + + modified = 0; + + for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) + { + int compare = strcmp (domainname, binding->domainname); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It is not in the list. */ + binding = NULL; + break; + } + } + + if (binding != NULL) + { + if (dirnamep) + { + const char *dirname = *dirnamep; + + if (dirname == NULL) + /* The current binding has be to returned. */ + *dirnamep = binding->dirname; + else + { + /* The domain is already bound. If the new value and the old + one are equal we simply do nothing. Otherwise replace the + old binding. */ + char *result = binding->dirname; + if (strcmp (dirname, result) != 0) + { + if (strcmp (dirname, _nl_default_dirname) == 0) + result = (char *) _nl_default_dirname; + else + { +#if defined _LIBC || defined HAVE_STRDUP + result = strdup (dirname); +#else + size_t len = strlen (dirname) + 1; + result = (char *) malloc (len); + if (__builtin_expect (result != NULL, 1)) + memcpy (result, dirname, len); +#endif + } + + if (__builtin_expect (result != NULL, 1)) + { + if (binding->dirname != _nl_default_dirname) + free (binding->dirname); + + binding->dirname = result; + modified = 1; + } + } + *dirnamep = result; + } + } + + if (codesetp) + { + const char *codeset = *codesetp; + + if (codeset == NULL) + /* The current binding has be to returned. */ + *codesetp = binding->codeset; + else + { + /* The domain is already bound. If the new value and the old + one are equal we simply do nothing. Otherwise replace the + old binding. */ + char *result = binding->codeset; + if (result == NULL || strcmp (codeset, result) != 0) + { +#if defined _LIBC || defined HAVE_STRDUP + result = strdup (codeset); +#else + size_t len = strlen (codeset) + 1; + result = (char *) malloc (len); + if (__builtin_expect (result != NULL, 1)) + memcpy (result, codeset, len); +#endif + + if (__builtin_expect (result != NULL, 1)) + { + if (binding->codeset != NULL) + free (binding->codeset); + + binding->codeset = result; + ++binding->codeset_cntr; + modified = 1; + } + } + *codesetp = result; + } + } + } + else if ((dirnamep == NULL || *dirnamep == NULL) + && (codesetp == NULL || *codesetp == NULL)) + { + /* Simply return the default values. */ + if (dirnamep) + *dirnamep = _nl_default_dirname; + if (codesetp) + *codesetp = NULL; + } + else + { + /* We have to create a new binding. */ + size_t len = strlen (domainname) + 1; + struct binding *new_binding = + (struct binding *) malloc (offsetof (struct binding, domainname) + len); + + if (__builtin_expect (new_binding == NULL, 0)) + goto failed; + + memcpy (new_binding->domainname, domainname, len); + + if (dirnamep) + { + const char *dirname = *dirnamep; + + if (dirname == NULL) + /* The default value. */ + dirname = _nl_default_dirname; + else + { + if (strcmp (dirname, _nl_default_dirname) == 0) + dirname = _nl_default_dirname; + else + { + char *result; +#if defined _LIBC || defined HAVE_STRDUP + result = strdup (dirname); + if (__builtin_expect (result == NULL, 0)) + goto failed_dirname; +#else + size_t len = strlen (dirname) + 1; + result = (char *) malloc (len); + if (__builtin_expect (result == NULL, 0)) + goto failed_dirname; + memcpy (result, dirname, len); +#endif + dirname = result; + } + } + *dirnamep = dirname; + new_binding->dirname = (char *) dirname; + } + else + /* The default value. */ + new_binding->dirname = (char *) _nl_default_dirname; + + new_binding->codeset_cntr = 0; + + if (codesetp) + { + const char *codeset = *codesetp; + + if (codeset != NULL) + { + char *result; + +#if defined _LIBC || defined HAVE_STRDUP + result = strdup (codeset); + if (__builtin_expect (result == NULL, 0)) + goto failed_codeset; +#else + size_t len = strlen (codeset) + 1; + result = (char *) malloc (len); + if (__builtin_expect (result == NULL, 0)) + goto failed_codeset; + memcpy (result, codeset, len); +#endif + codeset = result; + ++new_binding->codeset_cntr; + } + *codesetp = codeset; + new_binding->codeset = (char *) codeset; + } + else + new_binding->codeset = NULL; + + /* Now enqueue it. */ + if (_nl_domain_bindings == NULL + || strcmp (domainname, _nl_domain_bindings->domainname) < 0) + { + new_binding->next = _nl_domain_bindings; + _nl_domain_bindings = new_binding; + } + else + { + binding = _nl_domain_bindings; + while (binding->next != NULL + && strcmp (domainname, binding->next->domainname) > 0) + binding = binding->next; + + new_binding->next = binding->next; + binding->next = new_binding; + } + + modified = 1; + + /* Here we deal with memory allocation failures. */ + if (0) + { + failed_codeset: + if (new_binding->dirname != _nl_default_dirname) + free (new_binding->dirname); + failed_dirname: + free (new_binding); + failed: + if (dirnamep) + *dirnamep = NULL; + if (codesetp) + *codesetp = NULL; + } + } + + /* If we modified any binding, we flush the caches. */ + if (modified) + ++_nl_msg_cat_cntr; + + __libc_rwlock_unlock (_nl_state_lock); +} + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +char * +BINDTEXTDOMAIN (domainname, dirname) + const char *domainname; + const char *dirname; +{ + set_binding_values (domainname, &dirname, NULL); + return (char *) dirname; +} + +/* Specify the character encoding in which the messages from the + DOMAINNAME message catalog will be returned. */ +char * +BIND_TEXTDOMAIN_CODESET (domainname, codeset) + const char *domainname; + const char *codeset; +{ + set_binding_values (domainname, NULL, &codeset); + return (char *) codeset; +} + +#ifdef _LIBC +/* Aliases for function names in GNU C Library. */ +weak_alias (__bindtextdomain, bindtextdomain); +weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset); +#endif diff --git a/newlib/libc/sys/linux/intl/catgets.c b/newlib/libc/sys/linux/intl/catgets.c new file mode 100644 index 000000000..b11cc597b --- /dev/null +++ b/newlib/libc/sys/linux/intl/catgets.c @@ -0,0 +1,142 @@ +/* Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper, . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "catgetsinfo.h" + + +/* Open the catalog and return a descriptor for the catalog. */ +nl_catd +catopen (const char *cat_name, int flag) +{ + __nl_catd result; + const char *env_var = NULL; + const char *nlspath = NULL; + + if (strchr (cat_name, '/') == NULL) + { + if (flag == NL_CAT_LOCALE) + /* Use the current locale setting for LC_MESSAGES. */ + env_var = setlocale (LC_MESSAGES, NULL); + else + /* Use the LANG environment variable. */ + env_var = getenv ("LANG"); + + if (env_var == NULL || *env_var == '\0' + || (__libc_enable_secure && strchr (env_var, '/') != NULL)) + env_var = "C"; + + nlspath = getenv ("NLSPATH"); + if (nlspath != NULL && *nlspath != '\0') + { + /* Append the system dependent directory. */ + size_t len = strlen (nlspath) + 1 + sizeof NLSPATH; + char *tmp = alloca (len); + + __stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH); + nlspath = tmp; + } + else + nlspath = NLSPATH; + } + + result = (__nl_catd) malloc (sizeof (*result)); + if (result == NULL) + /* We cannot get enough memory. */ + return (nl_catd) -1; + + if (__open_catalog (cat_name, nlspath, env_var, result) != 0) + /* Couldn't open the file. */ + return (nl_catd) -1; + + return (nl_catd) result; +} + + +/* Return message from message catalog. */ +char * +catgets (nl_catd catalog_desc, int set, int message, const char *string) +{ + __nl_catd catalog; + size_t idx; + size_t cnt; + + /* Be generous if catalog which failed to be open is used. */ + if (catalog_desc == (nl_catd) -1 || ++set <= 0 || message < 0) + return (char *) string; + + catalog = (__nl_catd) catalog_desc; + + idx = ((set * message) % catalog->plane_size) * 3; + cnt = 0; + do + { + if (catalog->name_ptr[idx + 0] == (u_int32_t) set + && catalog->name_ptr[idx + 1] == (u_int32_t) message) + return (char *) &catalog->strings[catalog->name_ptr[idx + 2]]; + + idx += catalog->plane_size * 3; + } + while (++cnt < catalog->plane_depth); + + __set_errno (ENOMSG); + return (char *) string; +} + + +/* Return resources used for loaded message catalog. */ +int +catclose (nl_catd catalog_desc) +{ + __nl_catd catalog; + + /* Be generous if catalog which failed to be open is used. */ + if (catalog_desc == (nl_catd) -1) + { + __set_errno (EBADF); + return -1; + } + + catalog = (__nl_catd) catalog_desc; + +#ifdef _POSIX_MAPPED_FILES + if (catalog->status == mmapped) + __munmap ((void *) catalog->file_ptr, catalog->file_size); + else +#endif /* _POSIX_MAPPED_FILES */ + if (catalog->status == malloced) + free ((void *) catalog->file_ptr); + else + { + __set_errno (EBADF); + return -1; + } + + free ((void *) catalog); + + return 0; +} diff --git a/newlib/libc/sys/linux/intl/catgetsinfo.h b/newlib/libc/sys/linux/intl/catgetsinfo.h new file mode 100644 index 000000000..d4aa003b3 --- /dev/null +++ b/newlib/libc/sys/linux/intl/catgetsinfo.h @@ -0,0 +1,56 @@ +/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper, . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +struct catalog_obj +{ + u_int32_t magic; + u_int32_t plane_size; + u_int32_t plane_depth; + /* This is in fact two arrays in one: always a pair of name and + pointer into the data area. */ + u_int32_t name_ptr[0]; +}; + + +/* This structure will be filled after loading the catalog. */ +typedef struct catalog_info +{ + enum { mmapped, malloced } status; + + size_t plane_size; + size_t plane_depth; + u_int32_t *name_ptr; + const char *strings; + + struct catalog_obj *file_ptr; + size_t file_size; +} *__nl_catd; + + + +/* The magic number to signal we really have a catalog file. */ +#define CATGETS_MAGIC 0x960408de + + +/* Prototypes for helper functions. */ +extern int __open_catalog (const char *cat_name, const char *nlspath, + const char *env_var, __nl_catd __catalog); diff --git a/newlib/libc/sys/linux/intl/config.h b/newlib/libc/sys/linux/intl/config.h new file mode 100644 index 000000000..010de6079 --- /dev/null +++ b/newlib/libc/sys/linux/intl/config.h @@ -0,0 +1,26 @@ +#define HAVE_ICONV 1 +#define HAVE_STRING_H 1 +#define HAVE_MEMPCPY 1 +#define HAVE_STRCHR 1 +#define HAVE_STRDUP 1 +#define HAVE_MMAP 1 +#define HAVE_STRTOUL 1 +#define HAVE_ALLOCA_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_STRCASECMP 1 +#define HAVE_WEAK_SYMBOLS 1 +#define HAVE_GNU_LD 1 +#define HAVE_ELF 1 +#define __ASSUME_REALTIME_SIGNALS 1 +#define ASM_GLOBAL_DIRECTIVE .global + +#define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) + +#define UINT32_C(c) c ## U + +#include diff --git a/newlib/libc/sys/linux/intl/dcgettext.c b/newlib/libc/sys/linux/intl/dcgettext.c new file mode 100644 index 000000000..c250da42b --- /dev/null +++ b/newlib/libc/sys/linux/intl/dcgettext.c @@ -0,0 +1,59 @@ +/* Implementation of the dcgettext(3) function. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DCGETTEXT __dcgettext +# define DCIGETTEXT __dcigettext +#else +# define DCGETTEXT dcgettext__ +# define DCIGETTEXT dcigettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +char * +DCGETTEXT (domainname, msgid, category) + const char *domainname; + const char *msgid; + int category; +{ + return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dcgettext, dcgettext); +#endif diff --git a/newlib/libc/sys/linux/intl/dcigettext.c b/newlib/libc/sys/linux/intl/dcigettext.c new file mode 100644 index 000000000..017be4623 --- /dev/null +++ b/newlib/libc/sys/linux/intl/dcigettext.c @@ -0,0 +1,1284 @@ +/* Implementation of the internal dcigettext function. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef MB_CAPABLE + +/* Tell glibc's to provide a prototype for mempcpy(). + This must come before because may include + , and once has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#if defined __GNUC__ && !defined C_ALLOCA +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if (defined HAVE_ALLOCA_H || defined _LIBC) && !defined C_ALLOCA +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#ifndef errno +extern int errno; +#endif +#ifndef __set_errno +# define __set_errno(val) errno = (val) +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +# include +#else +char *getenv (); +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#if defined HAVE_LOCALE_H || defined _LIBC +# include +#endif + +#if defined HAVE_SYS_PARAM_H || defined _LIBC +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif +#include "hash-string.h" + +/* Thread safetyness. */ +#ifdef _LIBC +# include +#else +/* Provide dummy implementation if this is outside glibc. */ +# define __libc_lock_define_initialized(CLASS, NAME) +# define __libc_lock_lock(NAME) +# define __libc_lock_unlock(NAME) +# define __libc_rwlock_define_initialized(CLASS, NAME) +# define __libc_rwlock_rdlock(NAME) +# define __libc_rwlock_unlock(NAME) +#endif + +/* Alignment of types. */ +#if defined __GNUC__ && __GNUC__ >= 2 +# define alignof(TYPE) __alignof__ (TYPE) +#else +# define alignof(TYPE) \ + ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2) +#endif + +/* The internal variables in the standalone libintl.a must have different + names than the internal variables in GNU libc, otherwise programs + using libintl.a cannot be linked statically. */ +#if !defined _LIBC +# define _nl_default_default_domain _nl_default_default_domain__ +# define _nl_current_default_domain _nl_current_default_domain__ +# define _nl_default_dirname _nl_default_dirname__ +# define _nl_domain_bindings _nl_domain_bindings__ +#endif + +/* Some compilers, like SunOS4 cc, don't have offsetof in . */ +#ifndef offsetof +# define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) +#endif + +/* @@ end of prolog @@ */ + +#ifdef _GLIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# define getcwd __getcwd +# ifndef stpcpy +# define stpcpy __stpcpy +# endif +# define tfind __tfind +#else +# if !defined HAVE_GETCWD +char *getwd (); +# define getcwd(buf, max) getwd (buf) +# else +char *getcwd (); +# endif +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +# ifndef HAVE_MEMPCPY +static void *mempcpy PARAMS ((void *dest, const void *src, size_t n)); +# endif +#endif + +/* Amount to increase buffer size by in each try. */ +#define PATH_INCR 32 + +/* The following is from pathmax.h. */ +/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define + PATH_MAX but might cause redefinition warnings when sys/param.h is + later included (as on MORE/BSD 4.3). */ +#if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__) +# include +#endif + +#ifndef _POSIX_PATH_MAX +# define _POSIX_PATH_MAX 255 +#endif + +#if !defined PATH_MAX && defined _PC_PATH_MAX +# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX)) +#endif + +/* Don't include sys/param.h if it already has been. */ +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +#endif + +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif + +#ifndef PATH_MAX +# define PATH_MAX _POSIX_PATH_MAX +#endif + +/* XPG3 defines the result of `setlocale (category, NULL)' as: + ``Directs `setlocale()' to query `category' and return the current + setting of `local'.'' + However it does not specify the exact format. Neither do SUSV2 and + ISO C 99. So we can use this feature only on selected systems (e.g. + those using GNU C Library). */ +#ifdef _LIBC +# define HAVE_LOCALE_NULL +#endif + +/* This is the type used for the search tree where known translations + are stored. */ +struct known_translation_t +{ + /* Domain in which to search. */ + char *domainname; + + /* The category. */ + int category; + + /* State of the catalog counter at the point the string was found. */ + int counter; + + /* Catalog where the string was found. */ + struct loaded_l10nfile *domain; + + /* And finally the translation. */ + const char *translation; + size_t translation_length; + + /* Pointer to the string in question. */ + char msgid[ZERO]; +}; + +/* Root of the search tree with known translations. We can use this + only if the system provides the `tsearch' function family. */ +#if defined HAVE_TSEARCH || defined _LIBC +# include + +static void *root; + +# ifdef _GLIBC +# define tsearch __tsearch +# endif + +/* Function to compare two entries in the table of known translations. */ +static int transcmp PARAMS ((const void *p1, const void *p2)); +static int +transcmp (p1, p2) + const void *p1; + const void *p2; +{ + const struct known_translation_t *s1; + const struct known_translation_t *s2; + int result; + + s1 = (const struct known_translation_t *) p1; + s2 = (const struct known_translation_t *) p2; + + result = strcmp (s1->msgid, s2->msgid); + if (result == 0) + { + result = strcmp (s1->domainname, s2->domainname); + if (result == 0) + /* We compare the category last (though this is the cheapest + operation) since it is hopefully always the same (namely + LC_MESSAGES). */ + result = s1->category - s2->category; + } + + return result; +} +#endif + +/* Name of the default domain used for gettext(3) prior any call to + textdomain(3). The default value for this is "messages". */ +const char _nl_default_default_domain[] = "messages"; + +/* Value used as the default domain for gettext(3). */ +const char *_nl_current_default_domain = _nl_default_default_domain; + +/* Contains the default location of the message catalogs. */ +const char _nl_default_dirname[] = LOCALEDIR; + +/* List with bindings of specific domains created by bindtextdomain() + calls. */ +struct binding *_nl_domain_bindings; + +/* Prototypes for local functions. */ +static char *plural_lookup PARAMS ((struct loaded_l10nfile *domain, + unsigned long int n, + const char *translation, + size_t translation_len)) + internal_function; +static unsigned long int plural_eval PARAMS ((struct expression *pexp, + unsigned long int n)) + internal_function; +static const char *category_to_name PARAMS ((int category)) internal_function; +static const char *guess_category_value PARAMS ((int category, + const char *categoryname)) + internal_function; + + +/* For those loosing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +/* Nothing has to be done. */ +# define ADD_BLOCK(list, address) /* nothing */ +# define FREE_BLOCKS(list) /* nothing */ +#else +struct block_list +{ + void *address; + struct block_list *next; +}; +# define ADD_BLOCK(list, addr) \ + do { \ + struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ + /* If we cannot get a free block we cannot add the new element to \ + the list. */ \ + if (newp != NULL) { \ + newp->address = (addr); \ + newp->next = (list); \ + (list) = newp; \ + } \ + } while (0) +# define FREE_BLOCKS(list) \ + do { \ + while (list != NULL) { \ + struct block_list *old = list; \ + list = list->next; \ + free (old); \ + } \ + } while (0) +# undef alloca +# define alloca(size) (malloc (size)) +#endif /* have alloca */ + + +#ifdef _LIBC +/* List of blocks allocated for translations. */ +typedef struct transmem_list +{ + struct transmem_list *next; + char data[ZERO]; +} transmem_block_t; +static struct transmem_list *transmem_list; +#else +typedef unsigned char transmem_block_t; +#endif + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DCIGETTEXT __dcigettext +#else +# define DCIGETTEXT dcigettext__ +#endif + +/* Lock variable to protect the global data in the gettext implementation. */ +__libc_rwlock_define_initialized (, _nl_state_lock) + +/* Checking whether the binaries runs SUID must be done and glibc provides + easier methods therefore we make a difference here. */ +#ifdef _LIBC +# define ENABLE_SECURE __libc_enable_secure +# define DETERMINE_SECURE +#else +static int enable_secure; +# define ENABLE_SECURE (enable_secure == 1) +# define DETERMINE_SECURE \ + if (enable_secure == 0) \ + { \ + if (getuid () != geteuid () || getgid () != getegid ()) \ + enable_secure = 1; \ + else \ + enable_secure = -1; \ + } +#endif + +/* Look up MSGID in the DOMAINNAME message catalog for the current + CATEGORY locale and, if PLURAL is nonzero, search over string + depending on the plural form determined by N. */ +char * +DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) + const char *domainname; + const char *msgid1; + const char *msgid2; + int plural; + unsigned long int n; + int category; +{ +#ifndef HAVE_ALLOCA + struct block_list *block_list = NULL; +#endif + struct loaded_l10nfile *domain; + struct binding *binding; + const char *categoryname; + const char *categoryvalue; + char *dirname, *xdomainname; + char *single_locale; + char *retval; + size_t retlen; + int saved_errno; +#if defined HAVE_TSEARCH || defined _LIBC + struct known_translation_t *search; + struct known_translation_t **foundp = NULL; + size_t msgid_len; +#endif + size_t domainname_len; + + /* If no real MSGID is given return NULL. */ + if (msgid1 == NULL) + return NULL; + + __libc_rwlock_rdlock (_nl_state_lock); + + /* If DOMAINNAME is NULL, we are interested in the default domain. If + CATEGORY is not LC_MESSAGES this might not make much sense but the + definition left this undefined. */ + if (domainname == NULL) + domainname = _nl_current_default_domain; + +#if defined HAVE_TSEARCH || defined _LIBC + msgid_len = strlen (msgid1) + 1; + + /* Try to find the translation among those which we found at + some time. */ + search = (struct known_translation_t *) + alloca (offsetof (struct known_translation_t, msgid) + msgid_len); + memcpy (search->msgid, msgid1, msgid_len); + search->domainname = (char *) domainname; + search->category = category; + + foundp = (struct known_translation_t **) tfind (search, &root, transcmp); + if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr) + { + /* Now deal with plural. */ + if (plural) + retval = plural_lookup ((*foundp)->domain, n, (*foundp)->translation, + (*foundp)->translation_length); + else + retval = (char *) (*foundp)->translation; + + __libc_rwlock_unlock (_nl_state_lock); + return retval; + } +#endif + + /* Preserve the `errno' value. */ + saved_errno = errno; + + /* See whether this is a SUID binary or not. */ + DETERMINE_SECURE; + + /* First find matching binding. */ + for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) + { + int compare = strcmp (domainname, binding->domainname); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It is not in the list. */ + binding = NULL; + break; + } + } + + if (binding == NULL) + dirname = (char *) _nl_default_dirname; + else if (binding->dirname[0] == '/') + dirname = binding->dirname; + else + { + /* We have a relative path. Make it absolute now. */ + size_t dirname_len = strlen (binding->dirname) + 1; + size_t path_max; + char *ret; + + path_max = (unsigned int) PATH_MAX; + path_max += 2; /* The getcwd docs say to do this. */ + + dirname = (char *) alloca (path_max + dirname_len); + ADD_BLOCK (block_list, dirname); + + __set_errno (0); + while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE) + { + path_max += PATH_INCR; + dirname = (char *) alloca (path_max + dirname_len); + ADD_BLOCK (block_list, dirname); + __set_errno (0); + } + + if (ret == NULL) + { + /* We cannot get the current working directory. Don't signal an + error but simply return the default string. */ + FREE_BLOCKS (block_list); + __libc_rwlock_unlock (_nl_state_lock); + __set_errno (saved_errno); + return (plural == 0 + ? (char *) msgid1 + /* Use the Germanic plural rule. */ + : n == 1 ? (char *) msgid1 : (char *) msgid2); + } + + stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname); + } + + /* Now determine the symbolic name of CATEGORY and its value. */ + categoryname = category_to_name (category); + categoryvalue = guess_category_value (category, categoryname); + + domainname_len = strlen (domainname); + xdomainname = (char *) alloca (strlen (categoryname) + + domainname_len + 5); + ADD_BLOCK (block_list, xdomainname); + + stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), + domainname, domainname_len), + ".mo"); + + /* Creating working area. */ + single_locale = (char *) alloca (strlen (categoryvalue) + 1); + ADD_BLOCK (block_list, single_locale); + + + /* Search for the given string. This is a loop because we perhaps + got an ordered list of languages to consider for the translation. */ + while (1) + { + /* Make CATEGORYVALUE point to the next element of the list. */ + while (categoryvalue[0] != '\0' && categoryvalue[0] == ':') + ++categoryvalue; + if (categoryvalue[0] == '\0') + { + /* The whole contents of CATEGORYVALUE has been searched but + no valid entry has been found. We solve this situation + by implicitly appending a "C" entry, i.e. no translation + will take place. */ + single_locale[0] = 'C'; + single_locale[1] = '\0'; + } + else + { + char *cp = single_locale; + while (categoryvalue[0] != '\0' && categoryvalue[0] != ':') + *cp++ = *categoryvalue++; + *cp = '\0'; + + /* When this is a SUID binary we must not allow accessing files + outside the dedicated directories. */ + if (ENABLE_SECURE && strchr (single_locale, '/') != NULL) + /* Ingore this entry. */ + continue; + } + + /* If the current locale value is C (or POSIX) we don't load a + domain. Return the MSGID. */ + if (strcmp (single_locale, "C") == 0 + || strcmp (single_locale, "POSIX") == 0) + { + FREE_BLOCKS (block_list); + __libc_rwlock_unlock (_nl_state_lock); + __set_errno (saved_errno); + return (plural == 0 + ? (char *) msgid1 + /* Use the Germanic plural rule. */ + : n == 1 ? (char *) msgid1 : (char *) msgid2); + } + + + /* Find structure describing the message catalog matching the + DOMAINNAME and CATEGORY. */ + domain = _nl_find_domain (dirname, single_locale, xdomainname, binding); + + if (domain != NULL) + { + retval = _nl_find_msg (domain, binding, msgid1, &retlen); + + if (retval == NULL) + { + int cnt; + + for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) + { + retval = _nl_find_msg (domain->successor[cnt], binding, + msgid1, &retlen); + + if (retval != NULL) + { + domain = domain->successor[cnt]; + break; + } + } + } + + if (retval != NULL) + { + /* Found the translation of MSGID1 in domain DOMAIN: + starting at RETVAL, RETLEN bytes. */ + FREE_BLOCKS (block_list); + __set_errno (saved_errno); +#if defined HAVE_TSEARCH || defined _LIBC + if (foundp == NULL) + { + /* Create a new entry and add it to the search tree. */ + struct known_translation_t *newp; + + newp = (struct known_translation_t *) + malloc (offsetof (struct known_translation_t, msgid) + + msgid_len + domainname_len + 1); + if (newp != NULL) + { + newp->domainname = + mempcpy (newp->msgid, msgid1, msgid_len); + memcpy (newp->domainname, domainname, domainname_len + 1); + newp->category = category; + newp->counter = _nl_msg_cat_cntr; + newp->domain = domain; + newp->translation = retval; + newp->translation_length = retlen; + + /* Insert the entry in the search tree. */ + foundp = (struct known_translation_t **) + tsearch (newp, &root, transcmp); + if (foundp == NULL + || __builtin_expect (*foundp != newp, 0)) + /* The insert failed. */ + free (newp); + } + } + else + { + /* We can update the existing entry. */ + (*foundp)->counter = _nl_msg_cat_cntr; + (*foundp)->domain = domain; + (*foundp)->translation = retval; + (*foundp)->translation_length = retlen; + } +#endif + /* Now deal with plural. */ + if (plural) + retval = plural_lookup (domain, n, retval, retlen); + + __libc_rwlock_unlock (_nl_state_lock); + return retval; + } + } + } + /* NOTREACHED */ +} + + +char * +internal_function +_nl_find_msg (domain_file, domainbinding, msgid, lengthp) + struct loaded_l10nfile *domain_file; + struct binding *domainbinding; + const char *msgid; + size_t *lengthp; +{ + struct loaded_domain *domain; + size_t act; + char *result; + size_t resultlen; + + if (domain_file->decided == 0) + _nl_load_domain (domain_file, domainbinding); + + if (domain_file->data == NULL) + return NULL; + + domain = (struct loaded_domain *) domain_file->data; + + /* Locate the MSGID and its translation. */ + if (domain->hash_size > 2 && domain->hash_tab != NULL) + { + /* Use the hashing table. */ + nls_uint32 len = strlen (msgid); + nls_uint32 hash_val = hash_string (msgid); + nls_uint32 idx = hash_val % domain->hash_size; + nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2)); + + while (1) + { + nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]); + + if (nstr == 0) + /* Hash table entry is empty. */ + return NULL; + + /* Compare msgid with the original string at index nstr-1. + We compare the lengths with >=, not ==, because plural entries + are represented by strings with an embedded NUL. */ + if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) >= len + && (strcmp (msgid, + domain->data + W (domain->must_swap, + domain->orig_tab[nstr - 1].offset)) + == 0)) + { + act = nstr - 1; + goto found; + } + + if (idx >= domain->hash_size - incr) + idx -= domain->hash_size - incr; + else + idx += incr; + } + /* NOTREACHED */ + } + else + { + /* Try the default method: binary search in the sorted array of + messages. */ + size_t top, bottom; + + bottom = 0; + top = domain->nstrings; + while (bottom < top) + { + int cmp_val; + + act = (bottom + top) / 2; + cmp_val = strcmp (msgid, (domain->data + + W (domain->must_swap, + domain->orig_tab[act].offset))); + if (cmp_val < 0) + top = act; + else if (cmp_val > 0) + bottom = act + 1; + else + goto found; + } + /* No translation was found. */ + return NULL; + } + + found: + /* The translation was found at index ACT. If we have to convert the + string to use a different character set, this is the time. */ + result = ((char *) domain->data + + W (domain->must_swap, domain->trans_tab[act].offset)); + resultlen = W (domain->must_swap, domain->trans_tab[act].length) + 1; + +#if defined _LIBC || HAVE_ICONV + if (domain->codeset_cntr + != (domainbinding != NULL ? domainbinding->codeset_cntr : 0)) + { + /* The domain's codeset has changed through bind_textdomain_codeset() + since the message catalog was initialized or last accessed. We + have to reinitialize the converter. */ + _nl_free_domain_conv (domain); + _nl_init_domain_conv (domain_file, domain, domainbinding); + } + + if ( +# ifdef _GLIBC + domain->conv != (__gconv_t) -1 +# else +# if HAVE_ICONV + domain->conv != (iconv_t) -1 +# endif +# endif + ) + { + /* We are supposed to do a conversion. First allocate an + appropriate table with the same structure as the table + of translations in the file, where we can put the pointers + to the converted strings in. + There is a slight complication with plural entries. They + are represented by consecutive NUL terminated strings. We + handle this case by converting RESULTLEN bytes, including + NULs. */ + + if (domain->conv_tab == NULL + && ((domain->conv_tab = (char **) calloc (domain->nstrings, + sizeof (char *))) + == NULL)) + /* Mark that we didn't succeed allocating a table. */ + domain->conv_tab = (char **) -1; + + if (__builtin_expect (domain->conv_tab == (char **) -1, 0)) + /* Nothing we can do, no more memory. */ + goto converted; + + if (domain->conv_tab[act] == NULL) + { + /* We haven't used this string so far, so it is not + translated yet. Do this now. */ + /* We use a bit more efficient memory handling. + We allocate always larger blocks which get used over + time. This is faster than many small allocations. */ + __libc_lock_define_initialized (static, lock) +# define INITIAL_BLOCK_SIZE 4080 + static unsigned char *freemem; + static size_t freemem_size; + + const unsigned char *inbuf; + unsigned char *outbuf; + int malloc_count; +# ifndef _LIBC + transmem_block_t *transmem_list = NULL; +# endif + + __libc_lock_lock (lock); + + inbuf = (const unsigned char *) result; + outbuf = freemem + sizeof (size_t); + + malloc_count = 0; + while (1) + { + transmem_block_t *newmem; +# ifdef _GLIBC + size_t non_reversible; + int res; + + if (freemem_size < sizeof (size_t)) + goto resize_freemem; + + res = __gconv (domain->conv, + &inbuf, inbuf + resultlen, + &outbuf, + outbuf + freemem_size - sizeof (size_t), + &non_reversible); + + if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT) + break; + + if (res != __GCONV_FULL_OUTPUT) + { + __libc_lock_unlock (lock); + goto converted; + } + + inbuf = result; +# else +# if HAVE_ICONV + const char *inptr = (const char *) inbuf; + size_t inleft = resultlen; + char *outptr = (char *) outbuf; + size_t outleft; + + if (freemem_size < sizeof (size_t)) + goto resize_freemem; + + outleft = freemem_size - sizeof (size_t); + if (iconv (domain->conv, + (char **) &inptr, &inleft, + &outptr, &outleft) + != (size_t) (-1)) + { + outbuf = (unsigned char *) outptr; + break; + } + if (errno != E2BIG) + { + __libc_lock_unlock (lock); + goto converted; + } +# endif +# endif + + resize_freemem: + /* We must allocate a new buffer or resize the old one. */ + if (malloc_count > 0) + { + ++malloc_count; + freemem_size = malloc_count * INITIAL_BLOCK_SIZE; + newmem = (transmem_block_t *) realloc (transmem_list, + freemem_size); +# ifdef _LIBC + if (newmem != NULL) + transmem_list = transmem_list->next; + else + { + struct transmem_list *old = transmem_list; + + transmem_list = transmem_list->next; + free (old); + } +# endif + } + else + { + malloc_count = 1; + freemem_size = INITIAL_BLOCK_SIZE; + newmem = (transmem_block_t *) malloc (freemem_size); + } + if (__builtin_expect (newmem == NULL, 0)) + { + freemem = NULL; + freemem_size = 0; + __libc_lock_unlock (lock); + goto converted; + } + +# ifdef _LIBC + /* Add the block to the list of blocks we have to free + at some point. */ + newmem->next = transmem_list; + transmem_list = newmem; + + freemem = newmem->data; + freemem_size -= offsetof (struct transmem_list, data); +# else + transmem_list = newmem; + freemem = newmem; +# endif + + outbuf = freemem + sizeof (size_t); + } + + /* We have now in our buffer a converted string. Put this + into the table of conversions. */ + *(size_t *) freemem = outbuf - freemem - sizeof (size_t); + domain->conv_tab[act] = (char *) freemem; + /* Shrink freemem, but keep it aligned. */ + freemem_size -= outbuf - freemem; + freemem = outbuf; + freemem += freemem_size & (alignof (size_t) - 1); + freemem_size = freemem_size & ~ (alignof (size_t) - 1); + + __libc_lock_unlock (lock); + } + + /* Now domain->conv_tab[act] contains the translation of all + the plural variants. */ + result = domain->conv_tab[act] + sizeof (size_t); + resultlen = *(size_t *) domain->conv_tab[act]; + } + + converted: + /* The result string is converted. */ + +#endif /* _LIBC || HAVE_ICONV */ + + *lengthp = resultlen; + return result; +} + + +/* Look up a plural variant. */ +static char * +internal_function +plural_lookup (domain, n, translation, translation_len) + struct loaded_l10nfile *domain; + unsigned long int n; + const char *translation; + size_t translation_len; +{ + struct loaded_domain *domaindata = (struct loaded_domain *) domain->data; + unsigned long int index; + const char *p; + + index = plural_eval (domaindata->plural, n); + if (index >= domaindata->nplurals) + /* This should never happen. It means the plural expression and the + given maximum value do not match. */ + index = 0; + + /* Skip INDEX strings at TRANSLATION. */ + p = translation; + while (index-- > 0) + { +#ifdef _GLIBC + p = __rawmemchr (p, '\0'); +#else + p = strchr (p, '\0'); +#endif + /* And skip over the NUL byte. */ + p++; + + if (p >= translation + translation_len) + /* This should never happen. It means the plural expression + evaluated to a value larger than the number of variants + available for MSGID1. */ + return (char *) translation; + } + return (char *) p; +} + + +/* Function to evaluate the plural expression and return an index value. */ +static unsigned long int +internal_function +plural_eval (pexp, n) + struct expression *pexp; + unsigned long int n; +{ + switch (pexp->nargs) + { + case 0: + switch (pexp->operation) + { + case var: + return n; + case num: + return pexp->val.num; + default: + break; + } + /* NOTREACHED */ + break; + case 1: + { + /* pexp->operation must be lnot. */ + unsigned long int arg = plural_eval (pexp->val.args[0], n); + return ! arg; + } + case 2: + { + unsigned long int leftarg = plural_eval (pexp->val.args[0], n); + if (pexp->operation == lor) + return leftarg || plural_eval (pexp->val.args[1], n); + else if (pexp->operation == land) + return leftarg && plural_eval (pexp->val.args[1], n); + else + { + unsigned long int rightarg = plural_eval (pexp->val.args[1], n); + + switch (pexp->operation) + { + case mult: + return leftarg * rightarg; + case divide: + return leftarg / rightarg; + case module: + return leftarg % rightarg; + case plus: + return leftarg + rightarg; + case minus: + return leftarg - rightarg; + case less_than: + return leftarg < rightarg; + case greater_than: + return leftarg > rightarg; + case less_or_equal: + return leftarg <= rightarg; + case greater_or_equal: + return leftarg >= rightarg; + case equal: + return leftarg == rightarg; + case not_equal: + return leftarg != rightarg; + default: + break; + } + } + /* NOTREACHED */ + break; + } + case 3: + { + /* pexp->operation must be qmop. */ + unsigned long int boolarg = plural_eval (pexp->val.args[0], n); + return plural_eval (pexp->val.args[boolarg ? 1 : 2], n); + } + } + /* NOTREACHED */ + return 0; +} + + +/* Return string representation of locale CATEGORY. */ +static const char * +internal_function +category_to_name (category) + int category; +{ + const char *retval; + + switch (category) + { +#ifdef LC_COLLATE + case LC_COLLATE: + retval = "LC_COLLATE"; + break; +#endif +#ifdef LC_CTYPE + case LC_CTYPE: + retval = "LC_CTYPE"; + break; +#endif +#ifdef LC_MONETARY + case LC_MONETARY: + retval = "LC_MONETARY"; + break; +#endif +#ifdef LC_NUMERIC + case LC_NUMERIC: + retval = "LC_NUMERIC"; + break; +#endif +#ifdef LC_TIME + case LC_TIME: + retval = "LC_TIME"; + break; +#endif +#ifdef LC_MESSAGES + case LC_MESSAGES: + retval = "LC_MESSAGES"; + break; +#endif +#ifdef LC_RESPONSE + case LC_RESPONSE: + retval = "LC_RESPONSE"; + break; +#endif +#ifdef LC_ALL + case LC_ALL: + /* This might not make sense but is perhaps better than any other + value. */ + retval = "LC_ALL"; + break; +#endif + default: + /* If you have a better idea for a default value let me know. */ + retval = "LC_XXX"; + } + + return retval; +} + +/* Guess value of current locale from value of the environment variables. */ +static const char * +internal_function +guess_category_value (category, categoryname) + int category; + const char *categoryname; +{ + const char *language; + const char *retval; + + /* The highest priority value is the `LANGUAGE' environment + variable. But we don't use the value if the currently selected + locale is the C locale. This is a GNU extension. */ + language = getenv ("LANGUAGE"); + if (language != NULL && language[0] == '\0') + language = NULL; + + /* We have to proceed with the POSIX methods of looking to `LC_ALL', + `LC_xxx', and `LANG'. On some systems this can be done by the + `setlocale' function itself. */ +#if defined _LIBC || (defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL) + retval = setlocale (category, NULL); +#else + /* Setting of LC_ALL overwrites all other. */ + retval = getenv ("LC_ALL"); + if (retval == NULL || retval[0] == '\0') + { + /* Next comes the name of the desired category. */ + retval = getenv (categoryname); + if (retval == NULL || retval[0] == '\0') + { + /* Last possibility is the LANG environment variable. */ + retval = getenv ("LANG"); + if (retval == NULL || retval[0] == '\0') + /* We use C as the default domain. POSIX says this is + implementation defined. */ + return "C"; + } + } +#endif + + return language != NULL && strcmp (retval, "C") != 0 ? language : retval; +} + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_GLIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif + +#if !_LIBC && !HAVE_MEMPCPY +static void * +mempcpy (dest, src, n) + void *dest; + const void *src; + size_t n; +{ + return (void *) ((char *) memcpy (dest, src, n) + n); +} +#endif + + +#ifdef _LIBC +/* If we want to free all resources we have to do some work at + program's end. */ +static void __attribute__ ((unused)) +free_mem (void) +{ + void *old; + + while (_nl_domain_bindings != NULL) + { + struct binding *oldp = _nl_domain_bindings; + _nl_domain_bindings = _nl_domain_bindings->next; + if (oldp->dirname != _nl_default_dirname) + /* Yes, this is a pointer comparison. */ + free (oldp->dirname); + free (oldp->codeset); + free (oldp); + } + + if (_nl_current_default_domain != _nl_default_default_domain) + /* Yes, again a pointer comparison. */ + free ((char *) _nl_current_default_domain); + + /* Remove the search tree with the known translations. */ + tdestroy (root, free); + root = NULL; + + while (transmem_list != NULL) + { + old = transmem_list; + transmem_list = transmem_list->next; + free (old); + } +} + +text_set_element (__libc_subfreeres, free_mem); +#endif +#else /* !MB_CAPABLE */ + +#include +#include + +/* Name of the default domain used for gettext(3) prior any call to + textdomain(3). The default value for this is "messages". */ +const char _nl_default_default_domain[] = "messages"; + +/* Value used as the default domain for gettext(3). */ +const char *_nl_current_default_domain = _nl_default_default_domain; + +/* Contains the default location of the message catalogs. */ +const char _nl_default_dirname[] = LOCALEDIR; + +/* List with bindings of specific domains created by bindtextdomain() + calls. */ +struct binding *_nl_domain_bindings; + +/* this is actually usually defined in loadmsgcat.c, but we do it + here so we don't need the other file at all. */ +int _nl_msg_cat_cntr; + +/* Lock variable to protect the global data in the gettext implementation. */ +__libc_rwlock_define_initialized (, _nl_state_lock) + + +/* For non-MB-capable programs, the locale must be "C", so we can + avoid excess program size by short-circuiting this function. */ +char * +__dcigettext (domainname, msgid1, msgid2, plural, n, category) + const char *domainname; + const char *msgid1; + const char *msgid2; + int plural; + unsigned long int n; + int category; +{ + if (plural && n > 1) + return msgid2; + return msgid1; +} +weak_alias(__dcigettext, dcigettext) + +#endif /* !MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/dcngettext.c b/newlib/libc/sys/linux/intl/dcngettext.c new file mode 100644 index 000000000..068d5fa3f --- /dev/null +++ b/newlib/libc/sys/linux/intl/dcngettext.c @@ -0,0 +1,61 @@ +/* Implementation of the dcngettext(3) function. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DCNGETTEXT __dcngettext +# define DCIGETTEXT __dcigettext +#else +# define DCNGETTEXT dcngettext__ +# define DCIGETTEXT dcigettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +char * +DCNGETTEXT (domainname, msgid1, msgid2, n, category) + const char *domainname; + const char *msgid1; + const char *msgid2; + unsigned long int n; + int category; +{ + return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dcngettext, dcngettext); +#endif diff --git a/newlib/libc/sys/linux/intl/dgettext.c b/newlib/libc/sys/linux/intl/dgettext.c new file mode 100644 index 000000000..d0e5ed2b2 --- /dev/null +++ b/newlib/libc/sys/linux/intl/dgettext.c @@ -0,0 +1,62 @@ +/* Implementation of the dgettext(3) function. + Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined HAVE_LOCALE_H || defined _LIBC +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DGETTEXT __dgettext +# define DCGETTEXT __dcgettext +#else +# define DGETTEXT dgettext__ +# define DCGETTEXT dcgettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog of the current + LC_MESSAGES locale. */ +char * +DGETTEXT (domainname, msgid) + const char *domainname; + const char *msgid; +{ + return DCGETTEXT (domainname, msgid, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dgettext, dgettext); +#endif diff --git a/newlib/libc/sys/linux/intl/dngettext.c b/newlib/libc/sys/linux/intl/dngettext.c new file mode 100644 index 000000000..a620024b6 --- /dev/null +++ b/newlib/libc/sys/linux/intl/dngettext.c @@ -0,0 +1,64 @@ +/* Implementation of the dngettext(3) function. + Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined HAVE_LOCALE_H || defined _LIBC +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DNGETTEXT __dngettext +# define DCNGETTEXT __dcngettext +#else +# define DNGETTEXT dngettext__ +# define DCNGETTEXT dcngettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog of the current + LC_MESSAGES locale and skip message according to the plural form. */ +char * +DNGETTEXT (domainname, msgid1, msgid2, n) + const char *domainname; + const char *msgid1; + const char *msgid2; + unsigned long int n; +{ + return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dngettext, dngettext); +#endif diff --git a/newlib/libc/sys/linux/intl/explodename.c b/newlib/libc/sys/linux/intl/explodename.c new file mode 100644 index 000000000..d36b045bb --- /dev/null +++ b/newlib/libc/sys/linux/intl/explodename.c @@ -0,0 +1,204 @@ +#ifdef MB_CAPABLE + +/* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +#endif +#include + +#include "loadinfo.h" + +/* On some strange systems still no definition of NULL is found. Sigh! */ +#ifndef NULL +# if defined __STDC__ && __STDC__ +# define NULL ((void *) 0) +# else +# define NULL 0 +# endif +#endif + +/* @@ end of prolog @@ */ + +char * +_nl_find_language (name) + const char *name; +{ + while (name[0] != '\0' && name[0] != '_' && name[0] != '@' + && name[0] != '+' && name[0] != ',') + ++name; + + return (char *) name; +} + + +int +_nl_explode_name (name, language, modifier, territory, codeset, + normalized_codeset, special, sponsor, revision) + char *name; + const char **language; + const char **modifier; + const char **territory; + const char **codeset; + const char **normalized_codeset; + const char **special; + const char **sponsor; + const char **revision; +{ + enum { undecided, xpg, cen } syntax; + char *cp; + int mask; + + *modifier = NULL; + *territory = NULL; + *codeset = NULL; + *normalized_codeset = NULL; + *special = NULL; + *sponsor = NULL; + *revision = NULL; + + /* Now we determine the single parts of the locale name. First + look for the language. Termination symbols are `_' and `@' if + we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + mask = 0; + syntax = undecided; + *language = cp = name; + cp = _nl_find_language (*language); + + if (*language == cp) + /* This does not make sense: language has to be specified. Use + this entry as it is without exploding. Perhaps it is an alias. */ + cp = strchr (*language, '\0'); + else if (cp[0] == '_') + { + /* Next is the territory. */ + cp[0] = '\0'; + *territory = ++cp; + + while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' + && cp[0] != '+' && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= TERRITORY; + + if (cp[0] == '.') + { + /* Next is the codeset. */ + syntax = xpg; + cp[0] = '\0'; + *codeset = ++cp; + + while (cp[0] != '\0' && cp[0] != '@') + ++cp; + + mask |= XPG_CODESET; + + if (*codeset != cp && (*codeset)[0] != '\0') + { + *normalized_codeset = _nl_normalize_codeset (*codeset, + cp - *codeset); + if (strcmp (*codeset, *normalized_codeset) == 0) + free ((char *) *normalized_codeset); + else + mask |= XPG_NORM_CODESET; + } + } + } + + if (cp[0] == '@' || (syntax != xpg && cp[0] == '+')) + { + /* Next is the modifier. */ + syntax = cp[0] == '@' ? xpg : cen; + cp[0] = '\0'; + *modifier = ++cp; + + while (syntax == cen && cp[0] != '\0' && cp[0] != '+' + && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= XPG_MODIFIER | CEN_AUDIENCE; + } + + if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_')) + { + syntax = cen; + + if (cp[0] == '+') + { + /* Next is special application (CEN syntax). */ + cp[0] = '\0'; + *special = ++cp; + + while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= CEN_SPECIAL; + } + + if (cp[0] == ',') + { + /* Next is sponsor (CEN syntax). */ + cp[0] = '\0'; + *sponsor = ++cp; + + while (cp[0] != '\0' && cp[0] != '_') + ++cp; + + mask |= CEN_SPONSOR; + } + + if (cp[0] == '_') + { + /* Next is revision (CEN syntax). */ + cp[0] = '\0'; + *revision = ++cp; + + mask |= CEN_REVISION; + } + } + + /* For CEN syntax values it might be important to have the + separator character in the file name, not for XPG syntax. */ + if (syntax == xpg) + { + if (*territory != NULL && (*territory)[0] == '\0') + mask &= ~TERRITORY; + + if (*codeset != NULL && (*codeset)[0] == '\0') + mask &= ~XPG_CODESET; + + if (*modifier != NULL && (*modifier)[0] == '\0') + mask &= ~XPG_MODIFIER; + } + + return mask; +} + +#endif /* MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/finddomain.c b/newlib/libc/sys/linux/intl/finddomain.c new file mode 100644 index 000000000..f64305776 --- /dev/null +++ b/newlib/libc/sys/linux/intl/finddomain.c @@ -0,0 +1,220 @@ +#ifdef MB_CAPABLE + +/* Handle list of needed message catalogs + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Ulrich Drepper , 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) (bcopy (Src, Dst, Num), (Dst)) +# endif +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ +/* List of already loaded domains. */ +static struct loaded_l10nfile *_nl_loaded_domains; + + +/* Return a data structure describing the message catalog described by + the DOMAINNAME and CATEGORY parameters with respect to the currently + established bindings. */ +struct loaded_l10nfile * +internal_function +_nl_find_domain (dirname, locale, domainname, domainbinding) + const char *dirname; + char *locale; + const char *domainname; + struct binding *domainbinding; +{ + struct loaded_l10nfile *retval; + const char *language; + const char *modifier; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *special; + const char *sponsor; + const char *revision; + const char *alias_value; + int mask; + + /* LOCALE can consist of up to four recognized parts for the XPG syntax: + + language[_territory[.codeset]][@modifier] + + and six parts for the CEN syntax: + + language[_territory][+audience][+special][,[sponsor][_revision]] + + Beside the first part all of them are allowed to be missing. If + the full specified locale is not found, the less specific one are + looked for. The various parts will be stripped off according to + the following order: + (1) revision + (2) sponsor + (3) special + (4) codeset + (5) normalized codeset + (6) territory + (7) audience/modifier + */ + + /* If we have already tested for this locale entry there has to + be one data set in the list of loaded domains. */ + retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, + strlen (dirname) + 1, 0, locale, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, domainname, 0); + if (retval != NULL) + { + /* We know something about this locale. */ + int cnt; + + if (retval->decided == 0) + _nl_load_domain (retval, domainbinding); + + if (retval->data != NULL) + return retval; + + for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) + { + if (retval->successor[cnt]->decided == 0) + _nl_load_domain (retval->successor[cnt], domainbinding); + + if (retval->successor[cnt]->data != NULL) + break; + } + return cnt >= 0 ? retval : NULL; + /* NOTREACHED */ + } + + /* See whether the locale value is an alias. If yes its value + *overwrites* the alias name. No test for the original value is + done. */ + alias_value = _nl_expand_alias (locale); + if (alias_value != NULL) + { +#if defined _LIBC || defined HAVE_STRDUP + locale = strdup (alias_value); + if (locale == NULL) + return NULL; +#else + size_t len = strlen (alias_value) + 1; + locale = (char *) malloc (len); + if (locale == NULL) + return NULL; + + memcpy (locale, alias_value, len); +#endif + } + + /* Now we determine the single parts of the locale name. First + look for the language. Termination symbols are `_' and `@' if + we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + mask = _nl_explode_name (locale, &language, &modifier, &territory, + &codeset, &normalized_codeset, &special, + &sponsor, &revision); + + /* Create all possible locale entries which might be interested in + generalization. */ + retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, + strlen (dirname) + 1, mask, language, territory, + codeset, normalized_codeset, modifier, special, + sponsor, revision, domainname, 1); + if (retval == NULL) + /* This means we are out of core. */ + return NULL; + + if (retval->decided == 0) + _nl_load_domain (retval, domainbinding); + if (retval->data == NULL) + { + int cnt; + for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) + { + if (retval->successor[cnt]->decided == 0) + _nl_load_domain (retval->successor[cnt], domainbinding); + if (retval->successor[cnt]->data != NULL) + break; + } + } + + /* The room for an alias was dynamically allocated. Free it now. */ + if (alias_value != NULL) + free (locale); + + /* The space for normalized_codeset is dynamically allocated. Free it. */ + if (mask & XPG_NORM_CODESET) + free ((void *) normalized_codeset); + + return retval; +} + + +#ifdef _LIBC +static void __attribute__ ((unused)) +free_mem (void) +{ + struct loaded_l10nfile *runp = _nl_loaded_domains; + + while (runp != NULL) + { + struct loaded_l10nfile *here = runp; + if (runp->data != NULL) + _nl_unload_domain ((struct loaded_domain *) runp->data); + runp = runp->next; + free ((char *) here->filename); + free (here); + } +} + +text_set_element (__libc_subfreeres, free_mem); +#endif + +#endif /* MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/gettext.c b/newlib/libc/sys/linux/intl/gettext.c new file mode 100644 index 000000000..2b107d558 --- /dev/null +++ b/newlib/libc/sys/linux/intl/gettext.c @@ -0,0 +1,75 @@ +/* Implementation of gettext(3) function. + Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef _LIBC +# define __need_NULL +# include +#else +# ifdef STDC_HEADERS +# include /* Just for NULL. */ +# else +# ifdef HAVE_STRING_H +# include +# else +# define NULL ((void *) 0) +# endif +# endif +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +#include + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define GETTEXT __gettext +# define DCGETTEXT __dcgettext +#else +# define GETTEXT gettext__ +# define DCGETTEXT dcgettext__ +#endif + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +char * +GETTEXT (msgid) + const char *msgid; +{ + return DCGETTEXT (NULL, msgid, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__gettext, gettext); +#endif diff --git a/newlib/libc/sys/linux/intl/gettext.h b/newlib/libc/sys/linux/intl/gettext.h new file mode 100644 index 000000000..c427d89d1 --- /dev/null +++ b/newlib/libc/sys/linux/intl/gettext.h @@ -0,0 +1,103 @@ +/* Internal header for GNU gettext internationalization functions. + Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _GETTEXT_H +#define _GETTEXT_H 1 + +#if HAVE_LIMITS_H || _LIBC +# include +#endif + +/* @@ end of prolog @@ */ + +/* The magic number of the GNU message catalog format. */ +#define _MAGIC 0x950412de +#define _MAGIC_SWAPPED 0xde120495 + +/* Revision number of the currently used .mo (binary) file format. */ +#define MO_REVISION_NUMBER 0 + +/* The following contortions are an attempt to use the C preprocessor + to determine an unsigned integral type that is 32 bits wide. An + alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but + as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work + when cross-compiling. */ + +#if __STDC__ +# define UINT_MAX_32_BITS 4294967295U +#else +# define UINT_MAX_32_BITS 0xFFFFFFFF +#endif + +/* If UINT_MAX isn't defined, assume it's a 32-bit type. + This should be valid for all systems GNU cares about because + that doesn't include 16-bit systems, and only modern systems + (that certainly have ) have 64+-bit integral types. */ + +#ifndef UINT_MAX +# define UINT_MAX UINT_MAX_32_BITS +#endif + +#if UINT_MAX == UINT_MAX_32_BITS +typedef unsigned nls_uint32; +#else +# if USHRT_MAX == UINT_MAX_32_BITS +typedef unsigned short nls_uint32; +# else +# if ULONG_MAX == UINT_MAX_32_BITS +typedef unsigned long nls_uint32; +# else + /* The following line is intended to throw an error. Using #error is + not portable enough. */ + "Cannot determine unsigned 32-bit data type." +# endif +# endif +#endif + + +/* Header for binary .mo file format. */ +struct mo_file_header +{ + /* The magic number. */ + nls_uint32 magic; + /* The revision number of the file format. */ + nls_uint32 revision; + /* The number of strings pairs. */ + nls_uint32 nstrings; + /* Offset of table with start offsets of original strings. */ + nls_uint32 orig_tab_offset; + /* Offset of table with start offsets of translation strings. */ + nls_uint32 trans_tab_offset; + /* Size of hashing table. */ + nls_uint32 hash_tab_size; + /* Offset of first hashing entry. */ + nls_uint32 hash_tab_offset; +}; + +struct string_desc +{ + /* Length of addressed string. */ + nls_uint32 length; + /* Offset of string in file. */ + nls_uint32 offset; +}; + +/* @@ begin of epilog @@ */ + +#endif /* gettext.h */ diff --git a/newlib/libc/sys/linux/intl/gettextP.h b/newlib/libc/sys/linux/intl/gettextP.h new file mode 100644 index 000000000..6c9035bc1 --- /dev/null +++ b/newlib/libc/sys/linux/intl/gettextP.h @@ -0,0 +1,256 @@ +/* Header describing internals of libintl library. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Ulrich Drepper , 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _GETTEXTP_H +#define _GETTEXTP_H + +#include /* Get size_t. */ +#include + +#ifdef _GLIBC +# include "gconv_int.h" +#else +# if HAVE_ICONV +# include +# endif +#endif + +#include "loadinfo.h" + +#include "gettext.h" /* Get nls_uint32. */ + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef internal_function +# define internal_function +#endif + +/* Tell the compiler when a conditional or integer expression is + almost always true or almost always false. */ +#ifndef HAVE_BUILTIN_EXPECT +# define __builtin_expect(expr, val) (expr) +#endif + +#ifndef W +# define W(flag, data) ((flag) ? SWAP (data) : (data)) +#endif + + +#ifdef _LIBC +# include +# define SWAP(i) bswap_32 (i) +#else +static nls_uint32 SWAP PARAMS ((nls_uint32 i)); + +static inline nls_uint32 +SWAP (i) + nls_uint32 i; +{ + return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24); +} +#endif + + +/* This is the representation of the expressions to determine the + plural form. */ +struct expression +{ + int nargs; /* Number of arguments. */ + enum operator + { + /* Without arguments: */ + var, /* The variable "n". */ + num, /* Decimal number. */ + /* Unary operators: */ + lnot, /* Logical NOT. */ + /* Binary operators: */ + mult, /* Multiplication. */ + divide, /* Division. */ + module, /* Module operation. */ + plus, /* Addition. */ + minus, /* Subtraction. */ + less_than, /* Comparison. */ + greater_than, /* Comparison. */ + less_or_equal, /* Comparison. */ + greater_or_equal, /* Comparison. */ + equal, /* Comparision for equality. */ + not_equal, /* Comparision for inequality. */ + land, /* Logical AND. */ + lor, /* Logical OR. */ + /* Ternary operators: */ + qmop /* Question mark operator. */ + } operation; + union + { + unsigned long int num; /* Number value for `num'. */ + struct expression *args[3]; /* Up to three arguments. */ + } val; +}; + +/* This is the data structure to pass information to the parser and get + the result in a thread-safe way. */ +struct parse_args +{ + const char *cp; + struct expression *res; +}; + + +/* The representation of an opened message catalog. */ +struct loaded_domain +{ + const char *data; + int use_mmap; + size_t mmap_size; + int must_swap; + nls_uint32 nstrings; + struct string_desc *orig_tab; + struct string_desc *trans_tab; + nls_uint32 hash_size; + nls_uint32 *hash_tab; + int codeset_cntr; +#ifdef _GLIBC + __gconv_t conv; +#else +# if HAVE_ICONV + iconv_t conv; +# endif +#endif + char **conv_tab; + + struct expression *plural; + unsigned long int nplurals; +}; + +/* We want to allocate a string at the end of the struct. But ISO C + doesn't allow zero sized arrays. */ +#ifdef __GNUC__ +# define ZERO 0 +#else +# define ZERO 1 +#endif + +/* A set of settings bound to a message domain. Used to store settings + from bindtextdomain() and bind_textdomain_codeset(). */ +struct binding +{ + struct binding *next; + char *dirname; + int codeset_cntr; /* Incremented each time codeset changes. */ + char *codeset; + char domainname[ZERO]; +}; + +/* A counter which is incremented each time some previous translations + become invalid. + This variable is part of the external ABI of the GNU libintl. */ +extern int _nl_msg_cat_cntr; + +struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname, + char *__locale, + const char *__domainname, + struct binding *__domainbinding)) + internal_function; +void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain, + struct binding *__domainbinding)) + internal_function; +void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) + internal_function; +const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file, + struct loaded_domain *__domain, + struct binding *__domainbinding)) + internal_function; +void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain)) + internal_function; + +char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file, + struct binding *domainbinding, + const char *msgid, size_t *lengthp)) + internal_function; + +#ifdef _LIBC +extern char *__gettext PARAMS ((const char *__msgid)); +extern char *__dgettext PARAMS ((const char *__domainname, + const char *__msgid)); +extern char *__dcgettext PARAMS ((const char *__domainname, + const char *__msgid, int __category)); +extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2, + unsigned long int __n)); +extern char *__dngettext PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int n)); +extern char *__dcngettext PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category)); +extern char *__dcigettext PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + int __plural, unsigned long int __n, + int __category)); +extern char *__textdomain PARAMS ((const char *__domainname)); +extern char *__bindtextdomain PARAMS ((const char *__domainname, + const char *__dirname)); +extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname, + const char *__codeset)); +#else +extern char *gettext__ PARAMS ((const char *__msgid)); +extern char *dgettext__ PARAMS ((const char *__domainname, + const char *__msgid)); +extern char *dcgettext__ PARAMS ((const char *__domainname, + const char *__msgid, int __category)); +extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2, + unsigned long int __n)); +extern char *dngettext__ PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n)); +extern char *dcngettext__ PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category)); +extern char *dcigettext__ PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + int __plural, unsigned long int __n, + int __category)); +extern char *textdomain__ PARAMS ((const char *__domainname)); +extern char *bindtextdomain__ PARAMS ((const char *__domainname, + const char *__dirname)); +extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname, + const char *__codeset)); +#endif + +#ifdef _LIBC +extern void __gettext_free_exp PARAMS ((struct expression *exp)) + internal_function; +extern int __gettextparse PARAMS ((void *arg)); +#else +extern void gettext_free_exp__ PARAMS ((struct expression *exp)) + internal_function; +extern int gettextparse__ PARAMS ((void *arg)); +#endif + +/* @@ begin of epilog @@ */ + +#endif /* gettextP.h */ diff --git a/newlib/libc/sys/linux/intl/hash-string.h b/newlib/libc/sys/linux/intl/hash-string.h new file mode 100644 index 000000000..ae4bcfb3e --- /dev/null +++ b/newlib/libc/sys/linux/intl/hash-string.h @@ -0,0 +1,60 @@ +/* Implements a string hashing function. + Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +#endif + +/* We assume to have `unsigned long int' value with at least 32 bits. */ +#define HASHWORDBITS 32 + + +/* Defines the so called `hashpjw' function by P.J. Weinberger + [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, + 1986, 1987 Bell Telephone Laboratories, Inc.] */ +static unsigned long int hash_string PARAMS ((const char *__str_param)); + +static inline unsigned long int +hash_string (str_param) + const char *str_param; +{ + unsigned long int hval, g; + const char *str = str_param; + + /* Compute the hash value for the given string. */ + hval = 0; + while (*str != '\0') + { + hval <<= 4; + hval += (unsigned long int) *str++; + g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4)); + if (g != 0) + { + hval ^= g >> (HASHWORDBITS - 8); + hval ^= g; + } + } + return hval; +} diff --git a/newlib/libc/sys/linux/intl/l10nflist.c b/newlib/libc/sys/linux/intl/l10nflist.c new file mode 100644 index 000000000..1a5cf1e0c --- /dev/null +++ b/newlib/libc/sys/linux/intl/l10nflist.c @@ -0,0 +1,421 @@ +#ifdef MB_CAPABLE + +/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Tell glibc's to provide a prototype for stpcpy(). + This must come before because may include + , and once has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) (bcopy (Src, Dst, Num), (Dst)) +# endif +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#if defined _LIBC || defined HAVE_ARGZ_H +# include +#endif +#include +#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#include "loadinfo.h" + +/* On some strange systems still no definition of NULL is found. Sigh! */ +#ifndef NULL +# if defined __STDC__ && __STDC__ +# define NULL ((void *) 0) +# else +# define NULL 0 +# endif +#endif + +/* @@ end of prolog @@ */ + +#ifdef _GLIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# ifndef stpcpy +# define stpcpy(dest, src) __stpcpy(dest, src) +# endif +#else +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +#endif + +/* Define function which are usually not available. */ + +#if !defined _LIBC && !defined HAVE___ARGZ_COUNT +/* Returns the number of strings in ARGZ. */ +static size_t argz_count__ PARAMS ((const char *argz, size_t len)); + +static size_t +argz_count__ (argz, len) + const char *argz; + size_t len; +{ + size_t count = 0; + while (len > 0) + { + size_t part_len = strlen (argz); + argz += part_len + 1; + len -= part_len + 1; + count++; + } + return count; +} +# undef __argz_count +# define __argz_count(argz, len) argz_count__ (argz, len) +#endif /* !_LIBC && !HAVE___ARGZ_COUNT */ + +#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY +/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's + except the last into the character SEP. */ +static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep)); + +static void +argz_stringify__ (argz, len, sep) + char *argz; + size_t len; + int sep; +{ + while (len > 0) + { + size_t part_len = strlen (argz); + argz += part_len; + len -= part_len + 1; + if (len > 0) + *argz++ = sep; + } +} +# undef __argz_stringify +# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep) +#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */ + +#if !defined _LIBC && !defined HAVE___ARGZ_NEXT +static char *argz_next__ PARAMS ((char *argz, size_t argz_len, + const char *entry)); + +static char * +argz_next__ (argz, argz_len, entry) + char *argz; + size_t argz_len; + const char *entry; +{ + if (entry) + { + if (entry < argz + argz_len) + entry = strchr (entry, '\0') + 1; + + return entry >= argz + argz_len ? NULL : (char *) entry; + } + else + if (argz_len > 0) + return argz; + else + return 0; +} +# undef __argz_next +# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry) +#endif /* !_LIBC && !HAVE___ARGZ_NEXT */ + + +/* Return number of bits set in X. */ +static int pop PARAMS ((int x)); + +static inline int +pop (x) + int x; +{ + /* We assume that no more than 16 bits are used. */ + x = ((x & ~0x5555) >> 1) + (x & 0x5555); + x = ((x & ~0x3333) >> 2) + (x & 0x3333); + x = ((x >> 4) + x) & 0x0f0f; + x = ((x >> 8) + x) & 0xff; + + return x; +} + + +struct loaded_l10nfile * +_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, + territory, codeset, normalized_codeset, modifier, special, + sponsor, revision, filename, do_allocate) + struct loaded_l10nfile **l10nfile_list; + const char *dirlist; + size_t dirlist_len; + int mask; + const char *language; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *modifier; + const char *special; + const char *sponsor; + const char *revision; + const char *filename; + int do_allocate; +{ + char *abs_filename; + struct loaded_l10nfile *last = NULL; + struct loaded_l10nfile *retval; + char *cp; + size_t entries; + int cnt; + + /* Allocate room for the full file name. */ + abs_filename = (char *) malloc (dirlist_len + + strlen (language) + + ((mask & TERRITORY) != 0 + ? strlen (territory) + 1 : 0) + + ((mask & XPG_CODESET) != 0 + ? strlen (codeset) + 1 : 0) + + ((mask & XPG_NORM_CODESET) != 0 + ? strlen (normalized_codeset) + 1 : 0) + + (((mask & XPG_MODIFIER) != 0 + || (mask & CEN_AUDIENCE) != 0) + ? strlen (modifier) + 1 : 0) + + ((mask & CEN_SPECIAL) != 0 + ? strlen (special) + 1 : 0) + + (((mask & CEN_SPONSOR) != 0 + || (mask & CEN_REVISION) != 0) + ? (1 + ((mask & CEN_SPONSOR) != 0 + ? strlen (sponsor) + 1 : 0) + + ((mask & CEN_REVISION) != 0 + ? strlen (revision) + 1 : 0)) : 0) + + 1 + strlen (filename) + 1); + + if (abs_filename == NULL) + return NULL; + + retval = NULL; + last = NULL; + + /* Construct file name. */ + memcpy (abs_filename, dirlist, dirlist_len); + argz_stringify (abs_filename, dirlist_len, ':'); + cp = abs_filename + (dirlist_len - 1); + *cp++ = '/'; + cp = stpcpy (cp, language); + + if ((mask & TERRITORY) != 0) + { + *cp++ = '_'; + cp = stpcpy (cp, territory); + } + if ((mask & XPG_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, codeset); + } + if ((mask & XPG_NORM_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, normalized_codeset); + } + if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0) + { + /* This component can be part of both syntaces but has different + leading characters. For CEN we use `+', else `@'. */ + *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@'; + cp = stpcpy (cp, modifier); + } + if ((mask & CEN_SPECIAL) != 0) + { + *cp++ = '+'; + cp = stpcpy (cp, special); + } + if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0) + { + *cp++ = ','; + if ((mask & CEN_SPONSOR) != 0) + cp = stpcpy (cp, sponsor); + if ((mask & CEN_REVISION) != 0) + { + *cp++ = '_'; + cp = stpcpy (cp, revision); + } + } + + *cp++ = '/'; + stpcpy (cp, filename); + + /* Look in list of already loaded domains whether it is already + available. */ + last = NULL; + for (retval = *l10nfile_list; retval != NULL; retval = retval->next) + if (retval->filename != NULL) + { + int compare = strcmp (retval->filename, abs_filename); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It's not in the list. */ + retval = NULL; + break; + } + + last = retval; + } + + if (retval != NULL || do_allocate == 0) + { + free (abs_filename); + return retval; + } + + retval = (struct loaded_l10nfile *) + malloc (sizeof (*retval) + (argz_count (dirlist, dirlist_len) + * (1 << pop (mask)) + * sizeof (struct loaded_l10nfile *))); + if (retval == NULL) + return NULL; + + retval->filename = abs_filename; + retval->decided = (argz_count (dirlist, dirlist_len) != 1 + || ((mask & XPG_CODESET) != 0 + && (mask & XPG_NORM_CODESET) != 0)); + retval->data = NULL; + + if (last == NULL) + { + retval->next = *l10nfile_list; + *l10nfile_list = retval; + } + else + { + retval->next = last->next; + last->next = retval; + } + + entries = 0; + /* If the DIRLIST is a real list the RETVAL entry corresponds not to + a real file. So we have to use the DIRLIST separation mechanism + of the inner loop. */ + cnt = argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask; + for (; cnt >= 0; --cnt) + if ((cnt & ~mask) == 0 + && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0) + && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) + { + /* Iterate over all elements of the DIRLIST. */ + char *dir = NULL; + + while ((dir = argz_next ((char *) dirlist, dirlist_len, dir)) + != NULL) + retval->successor[entries++] + = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, + language, territory, codeset, + normalized_codeset, modifier, special, + sponsor, revision, filename, 1); + } + retval->successor[entries] = NULL; + + return retval; +} + +/* Normalize codeset name. There is no standard for the codeset + names. Normalization allows the user to use any of the common + names. The return value is dynamically allocated and has to be + freed by the caller. */ +const char * +_nl_normalize_codeset (codeset, name_len) + const char *codeset; + size_t name_len; +{ + int len = 0; + int only_digit = 1; + char *retval; + char *wp; + size_t cnt; + + for (cnt = 0; cnt < name_len; ++cnt) + if (isalnum (codeset[cnt])) + { + ++len; + + if (isalpha (codeset[cnt])) + only_digit = 0; + } + + retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1); + + if (retval != NULL) + { + if (only_digit) + wp = stpcpy (retval, "iso"); + else + wp = retval; + + for (cnt = 0; cnt < name_len; ++cnt) + if (isalpha (codeset[cnt])) + *wp++ = tolower (codeset[cnt]); + else if (isdigit (codeset[cnt])) + *wp++ = codeset[cnt]; + + *wp = '\0'; + } + + return (const char *) retval; +} + + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_GLIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif + +#endif /* MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/loadinfo.h b/newlib/libc/sys/linux/intl/loadinfo.h new file mode 100644 index 000000000..1de6cfd24 --- /dev/null +++ b/newlib/libc/sys/linux/intl/loadinfo.h @@ -0,0 +1,100 @@ +/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LOADINFO_H +#define _LOADINFO_H 1 + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef internal_function +# define internal_function +#endif + +/* Tell the compiler when a conditional or integer expression is + almost always true or almost always false. */ +#ifndef HAVE_BUILTIN_EXPECT +# define __builtin_expect(expr, val) (expr) +#endif + +/* Encoding of locale name parts. */ +#define CEN_REVISION 1 +#define CEN_SPONSOR 2 +#define CEN_SPECIAL 4 +#define XPG_NORM_CODESET 8 +#define XPG_CODESET 16 +#define TERRITORY 32 +#define CEN_AUDIENCE 64 +#define XPG_MODIFIER 128 + +#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) +#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) + + +struct loaded_l10nfile +{ + const char *filename; + int decided; + + const void *data; + + struct loaded_l10nfile *next; + struct loaded_l10nfile *successor[1]; +}; + + +/* Normalize codeset name. There is no standard for the codeset + names. Normalization allows the user to use any of the common + names. The return value is dynamically allocated and has to be + freed by the caller. */ +extern const char *_nl_normalize_codeset PARAMS ((const char *codeset, + size_t name_len)); + +extern struct loaded_l10nfile * +_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, + const char *dirlist, size_t dirlist_len, int mask, + const char *language, const char *territory, + const char *codeset, + const char *normalized_codeset, + const char *modifier, const char *special, + const char *sponsor, const char *revision, + const char *filename, int do_allocate)); + + +extern const char *_nl_expand_alias PARAMS ((const char *name)); + +/* normalized_codeset is dynamically allocated and has to be freed by + the caller. */ +extern int _nl_explode_name PARAMS ((char *name, const char **language, + const char **modifier, + const char **territory, + const char **codeset, + const char **normalized_codeset, + const char **special, + const char **sponsor, + const char **revision)); + +extern char *_nl_find_language PARAMS ((const char *name)); + +#endif /* loadinfo.h */ diff --git a/newlib/libc/sys/linux/intl/loadmsgcat.c b/newlib/libc/sys/linux/intl/loadmsgcat.c new file mode 100644 index 000000000..94f3e9a4c --- /dev/null +++ b/newlib/libc/sys/linux/intl/loadmsgcat.c @@ -0,0 +1,562 @@ +#ifdef MB_CAPABLE + +/* Load needed message catalogs. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Tell glibc's to provide a prototype for mempcpy(). + This must come before because may include + , and once has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#ifdef _LIBC +# include +# include +#endif + +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || (defined _LIBC && defined _POSIX_MAPPED_FILES) +# include +# undef HAVE_MMAP +# define HAVE_MMAP 1 +#else +# undef HAVE_MMAP +#endif + +#include "gettext.h" +#include "gettextP.h" + +#ifdef _GLIBC +# include "localeinfo.h" +#endif + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ISO C functions. This is required by the standard + because some ISO C functions will require linking with this object + file and the name space must not be polluted. */ +# define open __open +# define close __close +# define read __read +# define mmap __mmap +# define munmap __munmap +#endif + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define PLURAL_PARSE __gettextparse +#else +# define PLURAL_PARSE gettextparse__ +#endif + +/* For those losing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +# define freea(p) /* nothing */ +#else +# define alloca(n) malloc (n) +# define freea(p) free (p) +#endif + +/* We need a sign, whether a new catalog was loaded, which can be associated + with all translations. This is important if the translations are + cached by one of GCC's features. */ +int _nl_msg_cat_cntr; + +#if defined __GNUC__ \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) + +/* These structs are the constant expression for the germanic plural + form determination. It represents the expression "n != 1". */ +static const struct expression plvar = +{ + .nargs = 0, + .operation = var, +}; +static const struct expression plone = +{ + .nargs = 0, + .operation = num, + .val = + { + .num = 1 + } +}; +static struct expression germanic_plural = +{ + .nargs = 2, + .operation = not_equal, + .val = + { + .args = + { + [0] = (struct expression *) &plvar, + [1] = (struct expression *) &plone + } + } +}; + +# define INIT_GERMANIC_PLURAL() + +#else + +/* For compilers without support for ISO C 99 struct/union initializers: + Initialization at run-time. */ + +static struct expression plvar; +static struct expression plone; +static struct expression germanic_plural; + +static void +init_germanic_plural () +{ + if (plone.val.num == 0) + { + plvar.nargs = 0; + plvar.operation = var; + + plone.nargs = 0; + plone.operation = num; + plone.val.num = 1; + + germanic_plural.nargs = 2; + germanic_plural.operation = not_equal; + germanic_plural.val.args[0] = &plvar; + germanic_plural.val.args[1] = &plone; + } +} + +# define INIT_GERMANIC_PLURAL() init_germanic_plural () + +#endif + + +/* Initialize the codeset dependent parts of an opened message catalog. + Return the header entry. */ +const char * +internal_function +_nl_init_domain_conv (domain_file, domain, domainbinding) + struct loaded_l10nfile *domain_file; + struct loaded_domain *domain; + struct binding *domainbinding; +{ + /* Find out about the character set the file is encoded with. + This can be found (in textual form) in the entry "". If this + entry does not exist or if this does not contain the `charset=' + information, we will assume the charset matches the one the + current locale and we don't have to perform any conversion. */ + char *nullentry; + size_t nullentrylen; + + /* Preinitialize fields, to avoid recursion during _nl_find_msg. */ + domain->codeset_cntr = + (domainbinding != NULL ? domainbinding->codeset_cntr : 0); +#ifdef _GLIBC + domain->conv = (__gconv_t) -1; +#else +# if HAVE_ICONV + domain->conv = (iconv_t) -1; +# endif +#endif + domain->conv_tab = NULL; + + /* Get the header entry. */ + nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen); + + if (nullentry != NULL) + { +#if defined _LIBC || HAVE_ICONV + const char *charsetstr; + + charsetstr = strstr (nullentry, "charset="); + if (charsetstr != NULL) + { + size_t len; + char *charset; + const char *outcharset; + + charsetstr += strlen ("charset="); + len = strcspn (charsetstr, " \t\n"); + + charset = (char *) alloca (len + 1); +# if defined _LIBC || HAVE_MEMPCPY + *((char *) mempcpy (charset, charsetstr, len)) = '\0'; +# else + memcpy (charset, charsetstr, len); + charset[len] = '\0'; +# endif + + /* The output charset should normally be determined by the + locale. But sometimes the locale is not used or not correctly + set up, so we provide a possibility for the user to override + this. Moreover, the value specified through + bind_textdomain_codeset overrides both. */ + if (domainbinding != NULL && domainbinding->codeset != NULL) + outcharset = domainbinding->codeset; + else + { + outcharset = getenv ("OUTPUT_CHARSET"); + if (outcharset == NULL || outcharset[0] == '\0') + { +# ifdef _GLIBC + outcharset = (*_nl_current[LC_CTYPE])->values[_NL_ITEM_INDEX (CODESET)].string; +# else +# if HAVE_ICONV + extern const char *__locale_charset (void); + outcharset = __locale_charset (); +# endif +# endif + } + } + +# ifdef _GLIBC + /* We always want to use transliteration. */ + outcharset = norm_add_slashes (outcharset, "TRANSLIT"); + charset = norm_add_slashes (charset, NULL); + if (__gconv_open (outcharset, charset, &domain->conv, + GCONV_AVOID_NOCONV) + != __GCONV_OK) + domain->conv = (__gconv_t) -1; +# else +# if HAVE_ICONV + /* When using GNU libiconv, we want to use transliteration. */ +# if _LIBICONV_VERSION + len = strlen (outcharset); + { + char *tmp = (char *) alloca (len + 10 + 1); + memcpy (tmp, outcharset, len); + memcpy (tmp + len, "//TRANSLIT", 10 + 1); + outcharset = tmp; + } +# endif + domain->conv = iconv_open (outcharset, charset); +# if _LIBICONV_VERSION + freea (outcharset); +# endif +# endif +# endif + + freea (charset); + } +#endif /* _LIBC || HAVE_ICONV */ + } + + return nullentry; +} + +/* Frees the codeset dependent parts of an opened message catalog. */ +void +internal_function +_nl_free_domain_conv (domain) + struct loaded_domain *domain; +{ + if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1) + free (domain->conv_tab); + +#ifdef _GLIBC + if (domain->conv != (__gconv_t) -1) + __gconv_close (domain->conv); +#else +# if HAVE_ICONV + if (domain->conv != (iconv_t) -1) + iconv_close (domain->conv); +# endif +#endif +} + +/* Load the message catalogs specified by FILENAME. If it is no valid + message catalog do nothing. */ +void +internal_function +_nl_load_domain (domain_file, domainbinding) + struct loaded_l10nfile *domain_file; + struct binding *domainbinding; +{ + int fd; + size_t size; +#ifdef _LIBC + struct stat64 st; +#else + struct stat st; +#endif + struct mo_file_header *data = (struct mo_file_header *) -1; + int use_mmap = 0; + struct loaded_domain *domain; + const char *nullentry; + + domain_file->decided = 1; + domain_file->data = NULL; + + /* Note that it would be useless to store domainbinding in domain_file + because domainbinding might be == NULL now but != NULL later (after + a call to bind_textdomain_codeset). */ + + /* If the record does not represent a valid locale the FILENAME + might be NULL. This can happen when according to the given + specification the locale file name is different for XPG and CEN + syntax. */ + if (domain_file->filename == NULL) + return; + + /* Try to open the addressed file. */ + fd = open (domain_file->filename, O_RDONLY); + if (fd == -1) + return; + + /* We must know about the size of the file. */ + if ( +#ifdef _LIBC + __builtin_expect (fstat64 (fd, &st) != 0, 0) +#else + __builtin_expect (fstat (fd, &st) != 0, 0) +#endif + || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0) + || __builtin_expect (size < sizeof (struct mo_file_header), 0)) + { + /* Something went wrong. */ + close (fd); + return; + } + +#ifdef HAVE_MMAP + /* Now we are ready to load the file. If mmap() is available we try + this first. If not available or it failed we try to load it. */ + data = (struct mo_file_header *) mmap (NULL, size, PROT_READ, + MAP_PRIVATE, fd, 0); + + if (__builtin_expect (data != (struct mo_file_header *) -1, 1)) + { + /* mmap() call was successful. */ + close (fd); + use_mmap = 1; + } +#endif + + /* If the data is not yet available (i.e. mmap'ed) we try to load + it manually. */ + if (data == (struct mo_file_header *) -1) + { + size_t to_read; + char *read_ptr; + + data = (struct mo_file_header *) malloc (size); + if (data == NULL) + return; + + to_read = size; + read_ptr = (char *) data; + do + { + long int nb = (long int) read (fd, read_ptr, to_read); + if (nb <= 0) + { +#ifdef EINTR + if (nb == -1 && errno == EINTR) + continue; +#endif + close (fd); + return; + } + read_ptr += nb; + to_read -= nb; + } + while (to_read > 0); + + close (fd); + } + + /* Using the magic number we can test whether it really is a message + catalog file. */ + if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED, + 0)) + { + /* The magic number is wrong: not a message catalog file. */ +#ifdef HAVE_MMAP + if (use_mmap) + munmap ((caddr_t) data, size); + else +#endif + free (data); + return; + } + + domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain)); + if (domain == NULL) + return; + domain_file->data = domain; + + domain->data = (char *) data; + domain->use_mmap = use_mmap; + domain->mmap_size = size; + domain->must_swap = data->magic != _MAGIC; + + /* Fill in the information about the available tables. */ + switch (W (domain->must_swap, data->revision)) + { + case 0: + domain->nstrings = W (domain->must_swap, data->nstrings); + domain->orig_tab = (struct string_desc *) + ((char *) data + W (domain->must_swap, data->orig_tab_offset)); + domain->trans_tab = (struct string_desc *) + ((char *) data + W (domain->must_swap, data->trans_tab_offset)); + domain->hash_size = W (domain->must_swap, data->hash_tab_size); + domain->hash_tab = (nls_uint32 *) + ((char *) data + W (domain->must_swap, data->hash_tab_offset)); + break; + default: + /* This is an invalid revision. */ +#ifdef HAVE_MMAP + if (use_mmap) + munmap ((caddr_t) data, size); + else +#endif + free (data); + free (domain); + domain_file->data = NULL; + return; + } + + /* Now initialize the character set converter from the character set + the file is encoded with (found in the header entry) to the domain's + specified character set or the locale's character set. */ + nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding); + + /* Also look for a plural specification. */ + if (nullentry != NULL) + { + const char *plural; + const char *nplurals; + + plural = strstr (nullentry, "plural="); + nplurals = strstr (nullentry, "nplurals="); + if (plural == NULL || nplurals == NULL) + goto no_plural; + else + { + /* First get the number. */ + char *endp; + unsigned long int n; + struct parse_args args; + + nplurals += 9; + while (*nplurals != '\0' && isspace (*nplurals)) + ++nplurals; +#if defined HAVE_STRTOUL || defined _LIBC + n = strtoul (nplurals, &endp, 10); +#else + for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++) + n = n * 10 + (*endp - '0'); +#endif + domain->nplurals = n; + if (nplurals == endp) + goto no_plural; + + /* Due to the restrictions bison imposes onto the interface of the + scanner function we have to put the input string and the result + passed up from the parser into the same structure which address + is passed down to the parser. */ + plural += 7; + args.cp = plural; + if (PLURAL_PARSE (&args) != 0) + goto no_plural; + domain->plural = args.res; + } + } + else + { + /* By default we are using the Germanic form: singular form only + for `one', the plural form otherwise. Yes, this is also what + English is using since English is a Germanic language. */ + no_plural: + INIT_GERMANIC_PLURAL (); + domain->plural = &germanic_plural; + domain->nplurals = 2; + } +} + + +#ifdef _LIBC +void +internal_function +_nl_unload_domain (domain) + struct loaded_domain *domain; +{ + if (domain->plural != &germanic_plural) + __gettext_free_exp (domain->plural); + + _nl_free_domain_conv (domain); + +# ifdef _POSIX_MAPPED_FILES + if (domain->use_mmap) + munmap ((caddr_t) domain->data, domain->mmap_size); + else +# endif /* _POSIX_MAPPED_FILES */ + free ((void *) domain->data); + + free (domain); +} +#endif + +#endif diff --git a/newlib/libc/sys/linux/intl/locale.alias b/newlib/libc/sys/linux/intl/locale.alias new file mode 100644 index 000000000..08c250d35 --- /dev/null +++ b/newlib/libc/sys/linux/intl/locale.alias @@ -0,0 +1,75 @@ +# Locale name alias data base. +# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# The format of this file is the same as for the corresponding file of +# the X Window System, which normally can be found in +# /usr/lib/X11/locale/locale.alias +# A single line contains two fields: an alias and a substitution value. +# All entries are case independent. + +# Note: This file is far from being complete. If you have a value for +# your own site which you think might be useful for others too, share +# it with the rest of us. Send it using the `glibcbug' script to +# bugs@gnu.org. + +bokmal no_NO.ISO-8859-1 +bokmål no_NO.ISO-8859-1 +catalan ca_ES.ISO-8859-1 +croatian hr_HR.ISO-8859-2 +czech cs_CZ.ISO-8859-2 +danish da_DK.ISO-8859-1 +dansk da_DK.ISO-8859-1 +deutsch de_DE.ISO-8859-1 +dutch nl_NL.ISO-8859-1 +eesti et_EE.ISO-8859-1 +estonian et_EE.ISO-8859-1 +finnish fi_FI.ISO-8859-1 +français fr_FR.ISO-8859-1 +french fr_FR.ISO-8859-1 +galego gl_ES.ISO-8859-1 +galician gl_ES.ISO-8859-1 +german de_DE.ISO-8859-1 +greek el_GR.ISO-8859-7 +hebrew he_IL.ISO-8859-8 +hrvatski hr_HR.ISO-8859-2 +hungarian hu_HU.ISO-8859-2 +icelandic is_IS.ISO-8859-1 +italian it_IT.ISO-8859-1 +japanese ja_JP.eucJP +japanese.euc ja_JP.eucJP +ja_JP ja_JP.eucJP +ja_JP.ujis ja_JP.eucJP +japanese.sjis ja_JP.SJIS +korean ko_KR.eucKR +korean.euc ko_KR.eucKR +ko_KR ko_KR.eucKR +lithuanian lt_LT.ISO-8859-13 +nb_NO no_NO.ISO-8859-1 +nb_NO.ISO-8859-1 no_NO.ISO-8859-1 +norwegian no_NO.ISO-8859-1 +nynorsk nn_NO.ISO-8859-1 +polish pl_PL.ISO-8859-2 +portuguese pt_PT.ISO-8859-1 +romanian ro_RO.ISO-8859-2 +russian ru_RU.ISO-8859-5 +slovak sk_SK.ISO-8859-2 +slovene sl_SI.ISO-8859-2 +slovenian sl_SI.ISO-8859-2 +spanish es_ES.ISO-8859-1 +swedish sv_SE.ISO-8859-1 +thai th_TH.TIS-620 +turkish tr_TR.ISO-8859-9 diff --git a/newlib/libc/sys/linux/intl/localealias.c b/newlib/libc/sys/linux/intl/localealias.c new file mode 100644 index 000000000..03b6304cc --- /dev/null +++ b/newlib/libc/sys/linux/intl/localealias.c @@ -0,0 +1,443 @@ +#ifdef MB_CAPABLE + +/* Handle aliases for locale names. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Tell glibc's to provide a prototype for mempcpy(). + This must come before because may include + , and once has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#if defined _GLIBC || defined HAVE___FSETLOCKING +# include +#endif +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) (bcopy (Src, Dst, Num), (Dst)) +# endif +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ + +#ifdef _GLIBC +# define strcasecmp __strcasecmp +# ifndef mempcpy +# define mempcpy __mempcpy +# endif +# define HAVE_MEMPCPY 1 +# define HAVE___FSETLOCKING 1 +#endif + +/* We need locking here since we can be called from different places. */ +# include + +__libc_lock_define_initialized (static, lock); +#endif + +#ifndef internal_function +# define internal_function +#endif + +/* Some optimizations for glibc. */ +#ifdef _GLIBC +# define FEOF(fp) feof_unlocked (fp) +# define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp) +#else +# define FEOF(fp) feof (fp) +# define FGETS(buf, n, fp) fgets (buf, n, fp) +#endif + +/* For those losing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +# define freea(p) /* nothing */ +#else +# define alloca(n) malloc (n) +# define freea(p) free (p) +#endif + +#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED +# undef fgets +# define fgets(buf, len, s) fgets_unlocked (buf, len, s) +#endif +#if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED +# undef feof +# define feof(s) feof_unlocked (s) +#endif + + +struct alias_map +{ + const char *alias; + const char *value; +}; + + +static char *string_space; +static size_t string_space_act; +static size_t string_space_max; +static struct alias_map *map; +static size_t nmap; +static size_t maxmap; + + +/* Prototypes for local functions. */ +static size_t read_alias_file PARAMS ((const char *fname, int fname_len)) + internal_function; +static int extend_alias_table PARAMS ((void)); +static int alias_compare PARAMS ((const struct alias_map *map1, + const struct alias_map *map2)); + + +const char * +_nl_expand_alias (name) + const char *name; +{ + static const char *locale_alias_path = LOCALE_ALIAS_PATH; + struct alias_map *retval; + const char *result = NULL; + size_t added; + +#ifdef _LIBC + __libc_lock_lock (lock); +#endif + + do + { + struct alias_map item; + + item.alias = name; + + if (nmap > 0) + retval = (struct alias_map *) bsearch (&item, map, nmap, + sizeof (struct alias_map), + (int (*) PARAMS ((const void *, + const void *)) + ) alias_compare); + else + retval = NULL; + + /* We really found an alias. Return the value. */ + if (retval != NULL) + { + result = retval->value; + break; + } + + /* Perhaps we can find another alias file. */ + added = 0; + while (added == 0 && locale_alias_path[0] != '\0') + { + const char *start; + + while (locale_alias_path[0] == ':') + ++locale_alias_path; + start = locale_alias_path; + + while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':') + ++locale_alias_path; + + if (start < locale_alias_path) + added = read_alias_file (start, locale_alias_path - start); + } + } + while (added != 0); + +#ifdef _LIBC + __libc_lock_unlock (lock); +#endif + + return result; +} + + +static size_t +internal_function +read_alias_file (fname, fname_len) + const char *fname; + int fname_len; +{ + FILE *fp; + char *full_fname; + size_t added; + static const char aliasfile[] = "/locale.alias"; + + full_fname = (char *) alloca (fname_len + sizeof aliasfile); +#ifdef HAVE_MEMPCPY + mempcpy (mempcpy (full_fname, fname, fname_len), + aliasfile, sizeof aliasfile); +#else + memcpy (full_fname, fname, fname_len); + memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile); +#endif + + fp = fopen (full_fname, "r"); + freea (full_fname); + if (fp == NULL) + return 0; + +#ifdef HAVE___FSETLOCKING + /* No threads present. */ + __fsetlocking (fp, FSETLOCKING_BYCALLER); +#endif + + added = 0; + while (!FEOF (fp)) + { + /* It is a reasonable approach to use a fix buffer here because + a) we are only interested in the first two fields + b) these fields must be usable as file names and so must not + be that long + */ + char buf[BUFSIZ]; + char *alias; + char *value; + char *cp; + + if (FGETS (buf, sizeof buf, fp) == NULL) + /* EOF reached. */ + break; + + /* Possibly not the whole line fits into the buffer. Ignore + the rest of the line. */ + if (strchr (buf, '\n') == NULL) + { + char altbuf[BUFSIZ]; + do + if (FGETS (altbuf, sizeof altbuf, fp) == NULL) + /* Make sure the inner loop will be left. The outer loop + will exit at the `feof' test. */ + break; + while (strchr (altbuf, '\n') == NULL); + } + + cp = buf; + /* Ignore leading white space. */ + while (isspace (cp[0])) + ++cp; + + /* A leading '#' signals a comment line. */ + if (cp[0] != '\0' && cp[0] != '#') + { + alias = cp++; + while (cp[0] != '\0' && !isspace (cp[0])) + ++cp; + /* Terminate alias name. */ + if (cp[0] != '\0') + *cp++ = '\0'; + + /* Now look for the beginning of the value. */ + while (isspace (cp[0])) + ++cp; + + if (cp[0] != '\0') + { + size_t alias_len; + size_t value_len; + + value = cp++; + while (cp[0] != '\0' && !isspace (cp[0])) + ++cp; + /* Terminate value. */ + if (cp[0] == '\n') + { + /* This has to be done to make the following test + for the end of line possible. We are looking for + the terminating '\n' which do not overwrite here. */ + *cp++ = '\0'; + *cp = '\n'; + } + else if (cp[0] != '\0') + *cp++ = '\0'; + + if (nmap >= maxmap) + if (__builtin_expect (extend_alias_table (), 0)) + return added; + + alias_len = strlen (alias) + 1; + value_len = strlen (value) + 1; + + if (string_space_act + alias_len + value_len > string_space_max) + { + /* Increase size of memory pool. */ + size_t new_size = (string_space_max + + (alias_len + value_len > 1024 + ? alias_len + value_len : 1024)); + char *new_pool = (char *) realloc (string_space, new_size); + if (new_pool == NULL) + return added; + + if (__builtin_expect (string_space != new_pool, 0)) + { + size_t i; + + for (i = 0; i < nmap; i++) + { + map[i].alias += new_pool - string_space; + map[i].value += new_pool - string_space; + } + } + + string_space = new_pool; + string_space_max = new_size; + } + + map[nmap].alias = memcpy (&string_space[string_space_act], + alias, alias_len); + string_space_act += alias_len; + + map[nmap].value = memcpy (&string_space[string_space_act], + value, value_len); + string_space_act += value_len; + + ++nmap; + ++added; + } + } + } + + /* Should we test for ferror()? I think we have to silently ignore + errors. --drepper */ + fclose (fp); + + if (added > 0) + qsort (map, nmap, sizeof (struct alias_map), + (int (*) PARAMS ((const void *, const void *))) alias_compare); + + return added; +} + + +static int +extend_alias_table () +{ + size_t new_size; + struct alias_map *new_map; + + new_size = maxmap == 0 ? 100 : 2 * maxmap; + new_map = (struct alias_map *) realloc (map, (new_size + * sizeof (struct alias_map))); + if (new_map == NULL) + /* Simply don't extend: we don't have any more core. */ + return -1; + + map = new_map; + maxmap = new_size; + return 0; +} + + +#ifdef _LIBC +static void __attribute__ ((unused)) +free_mem (void) +{ + if (string_space != NULL) + free (string_space); + if (map != NULL) + free (map); +} +text_set_element (__libc_subfreeres, free_mem); +#endif + + +static int +alias_compare (map1, map2) + const struct alias_map *map1; + const struct alias_map *map2; +{ +#if defined _LIBC || defined HAVE_STRCASECMP + return strcasecmp (map1->alias, map2->alias); +#else + const unsigned char *p1 = (const unsigned char *) map1->alias; + const unsigned char *p2 = (const unsigned char *) map2->alias; + unsigned char c1, c2; + + if (p1 == p2) + return 0; + + do + { + /* I know this seems to be odd but the tolower() function in + some systems libc cannot handle nonalpha characters. */ + c1 = isupper (*p1) ? tolower (*p1) : *p1; + c2 = isupper (*p2) ? tolower (*p2) : *p2; + if (c1 == '\0') + break; + ++p1; + ++p2; + } + while (c1 == c2); + + return c1 - c2; +#endif +} + +#endif /* MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/ngettext.c b/newlib/libc/sys/linux/intl/ngettext.c new file mode 100644 index 000000000..70d43838b --- /dev/null +++ b/newlib/libc/sys/linux/intl/ngettext.c @@ -0,0 +1,77 @@ +/* Implementation of ngettext(3) function. + Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef _LIBC +# define __need_NULL +# include +#else +# ifdef STDC_HEADERS +# include /* Just for NULL. */ +# else +# ifdef HAVE_STRING_H +# include +# else +# define NULL ((void *) 0) +# endif +# endif +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +#include + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define NGETTEXT __ngettext +# define DCNGETTEXT __dcngettext +#else +# define NGETTEXT ngettext__ +# define DCNGETTEXT dcngettext__ +#endif + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +char * +NGETTEXT (msgid1, msgid2, n) + const char *msgid1; + const char *msgid2; + unsigned long int n; +{ + return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__ngettext, ngettext); +#endif diff --git a/newlib/libc/sys/linux/intl/open_catalog.c b/newlib/libc/sys/linux/intl/open_catalog.c new file mode 100644 index 000000000..a0c4a807c --- /dev/null +++ b/newlib/libc/sys/linux/intl/open_catalog.c @@ -0,0 +1,334 @@ +/* Copyright (C) 1996-2000, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper, . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#ifdef _POSIX_MAPPED_FILES +# include +#endif +#include + +#include "catgetsinfo.h" + + +#define SWAPU32(w) bswap_32 (w) + + +int +__open_catalog (const char *cat_name, const char *nlspath, const char *env_var, + __nl_catd catalog) +{ + int fd = -1; + struct stat64 st; + int swapping; + size_t cnt; + size_t max_offset; + size_t tab_size; + const char *lastp; + int result = -1; + + if (strchr (cat_name, '/') != NULL || nlspath == NULL) + fd = __open (cat_name, O_RDONLY); + else + { + const char *run_nlspath = nlspath; +#define ENOUGH(n) \ + if (__builtin_expect (bufact + (n) >= bufmax, 0)) \ + { \ + char *old_buf = buf; \ + bufmax += 256 + (n); \ + buf = (char *) alloca (bufmax); \ + memcpy (buf, old_buf, bufact); \ + } + + /* The RUN_NLSPATH variable contains a colon separated list of + descriptions where we expect to find catalogs. We have to + recognize certain % substitutions and stop when we found the + first existing file. */ + char *buf; + size_t bufact; + size_t bufmax; + size_t len; + + buf = NULL; + bufmax = 0; + + fd = -1; + while (*run_nlspath != '\0') + { + bufact = 0; + + if (*run_nlspath == ':') + { + /* Leading colon or adjacent colons - treat same as %N. */ + len = strlen (cat_name); + ENOUGH (len); + memcpy (&buf[bufact], cat_name, len); + bufact += len; + } + else + while (*run_nlspath != ':' && *run_nlspath != '\0') + if (*run_nlspath == '%') + { + const char *tmp; + + ++run_nlspath; /* We have seen the `%'. */ + switch (*run_nlspath++) + { + case 'N': + /* Use the catalog name. */ + len = strlen (cat_name); + ENOUGH (len); + memcpy (&buf[bufact], cat_name, len); + bufact += len; + break; + case 'L': + /* Use the current locale category value. */ + len = strlen (env_var); + ENOUGH (len); + memcpy (&buf[bufact], env_var, len); + bufact += len; + break; + case 'l': + /* Use language element of locale category value. */ + tmp = env_var; + do + { + ENOUGH (1); + buf[bufact++] = *tmp++; + } + while (*tmp != '\0' && *tmp != '_' && *tmp != '.'); + break; + case 't': + /* Use territory element of locale category value. */ + tmp = env_var; + do + ++tmp; + while (*tmp != '\0' && *tmp != '_' && *tmp != '.'); + if (*tmp == '_') + { + ++tmp; + do + { + ENOUGH (1); + buf[bufact++] = *tmp++; + } + while (*tmp != '\0' && *tmp != '.'); + } + break; + case 'c': + /* Use code set element of locale category value. */ + tmp = env_var; + do + ++tmp; + while (*tmp != '\0' && *tmp != '.'); + if (*tmp == '.') + { + ++tmp; + do + { + ENOUGH (1); + buf[bufact++] = *tmp++; + } + while (*tmp != '\0'); + } + break; + case '%': + ENOUGH (1); + buf[bufact++] = '%'; + break; + default: + /* Unknown variable: ignore this path element. */ + bufact = 0; + while (*run_nlspath != '\0' && *run_nlspath != ':') + ++run_nlspath; + break; + } + } + else + { + ENOUGH (1); + buf[bufact++] = *run_nlspath++; + } + + ENOUGH (1); + buf[bufact] = '\0'; + + if (bufact != 0) + { + fd = __open (buf, O_RDONLY); + if (fd >= 0) + break; + } + + ++run_nlspath; + } + } + + /* Avoid dealing with directories and block devices */ + if (__builtin_expect (fd, 0) < 0) + return -1; + + if (__builtin_expect (fstat64 (fd, &st), 0) < 0) + goto close_unlock_return; + + if (__builtin_expect (!S_ISREG (st.st_mode), 0) + || st.st_size < sizeof (struct catalog_obj)) + { + /* `errno' is not set correctly but the file is not usable. + Use an reasonable error value. */ + __set_errno (EINVAL); + goto close_unlock_return; + } + + catalog->file_size = st.st_size; +#ifdef _POSIX_MAPPED_FILES +# ifndef MAP_COPY + /* Linux seems to lack read-only copy-on-write. */ +# define MAP_COPY MAP_PRIVATE +# endif +# ifndef MAP_FILE + /* Some systems do not have this flag; it is superfluous. */ +# define MAP_FILE 0 +# endif +# ifndef MAP_INHERIT + /* Some systems might lack this; they lose. */ +# define MAP_INHERIT 0 +# endif + catalog->file_ptr = + (struct catalog_obj *) __mmap (NULL, st.st_size, PROT_READ, + MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0); + if (__builtin_expect (catalog->file_ptr != (struct catalog_obj *) MAP_FAILED, + 1)) + /* Tell the world we managed to mmap the file. */ + catalog->status = mmapped; + else +#endif /* _POSIX_MAPPED_FILES */ + { + /* mmap failed perhaps because the system call is not + implemented. Try to load the file. */ + size_t todo; + catalog->file_ptr = malloc (st.st_size); + if (catalog->file_ptr == NULL) + goto close_unlock_return; + + todo = st.st_size; + /* Save read, handle partial reads. */ + do + { + size_t now = __read (fd, (((char *) catalog->file_ptr) + + (st.st_size - todo)), todo); + if (now == 0 || now == (size_t) -1) + { +#ifdef EINTR + if (now == (size_t) -1 && errno == EINTR) + continue; +#endif + free ((void *) catalog->file_ptr); + goto close_unlock_return; + } + todo -= now; + } + while (todo > 0); + catalog->status = malloced; + } + + /* Determine whether the file is a catalog file and if yes whether + it is written using the correct byte order. Else we have to swap + the values. */ + if (__builtin_expect (catalog->file_ptr->magic, CATGETS_MAGIC) + == CATGETS_MAGIC) + swapping = 0; + else if (catalog->file_ptr->magic == SWAPU32 (CATGETS_MAGIC)) + swapping = 1; + else + { + invalid_file: + /* Invalid file. Free the resources and mark catalog as not + usable. */ +#ifdef _POSIX_MAPPED_FILES + if (catalog->status == mmapped) + __munmap ((void *) catalog->file_ptr, catalog->file_size); + else +#endif /* _POSIX_MAPPED_FILES */ + free (catalog->file_ptr); + goto close_unlock_return; + } + +#define SWAP(x) (swapping ? SWAPU32 (x) : (x)) + + /* Get dimensions of the used hashing table. */ + catalog->plane_size = SWAP (catalog->file_ptr->plane_size); + catalog->plane_depth = SWAP (catalog->file_ptr->plane_depth); + + /* The file contains two versions of the pointer tables. Pick the + right one for the local byte order. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + catalog->name_ptr = &catalog->file_ptr->name_ptr[0]; +#elif __BYTE_ORDER == __BIG_ENDIAN + catalog->name_ptr = &catalog->file_ptr->name_ptr[catalog->plane_size + * catalog->plane_depth + * 3]; +#else +# error Cannot handle __BYTE_ORDER byte order +#endif + + /* The rest of the file contains all the strings. They are + addressed relative to the position of the first string. */ + catalog->strings = + (const char *) &catalog->file_ptr->name_ptr[catalog->plane_size + * catalog->plane_depth * 3 * 2]; + + /* Determine the largest string offset mentioned in the table. */ + max_offset = 0; + tab_size = 3 * catalog->plane_size * catalog->plane_depth; + for (cnt = 2; cnt < tab_size; cnt += 3) + if (catalog->name_ptr[cnt] > max_offset) + max_offset = catalog->name_ptr[cnt]; + + /* Now we can check whether the file is large enough to contain the + tables it says it contains. */ + if (st.st_size <= (sizeof (struct catalog_obj) + 2 * tab_size + max_offset)) + /* The last string is not contained in the file. */ + goto invalid_file; + + lastp = catalog->strings + max_offset; + max_offset = (st.st_size + - sizeof (struct catalog_obj) + 2 * tab_size + max_offset); + while (*lastp != '\0') + { + if (--max_offset == 0) + goto invalid_file; + ++lastp; + } + + /* We succeeded. */ + result = 0; + + /* Release the lock again. */ + close_unlock_return: + __close (fd); + + return result; +} diff --git a/newlib/libc/sys/linux/intl/plural.c b/newlib/libc/sys/linux/intl/plural.c new file mode 100644 index 000000000..7585c2743 --- /dev/null +++ b/newlib/libc/sys/linux/intl/plural.c @@ -0,0 +1,1319 @@ + +/* A Bison parser, made from plural.y + by GNU Bison version 1.28 */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define yyparse __gettextparse +#define yylex __gettextlex +#define yyerror __gettexterror +#define yylval __gettextlval +#define yychar __gettextchar +#define yydebug __gettextdebug +#define yynerrs __gettextnerrs +#define EQUOP2 257 +#define CMPOP2 258 +#define ADDOP2 259 +#define MULOP2 260 +#define NUMBER 261 + +#line 1 "plural.y" + +/* Expression parsing for plural form selection. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Ulrich Drepper , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "gettextP.h" + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define FREE_EXPRESSION __gettext_free_exp +#else +# define FREE_EXPRESSION gettext_free_exp__ +# define __gettextparse gettextparse__ +#endif + +#define YYLEX_PARAM &((struct parse_args *) arg)->cp +#define YYPARSE_PARAM arg + +#line 46 "plural.y" +typedef union { + unsigned long int num; + enum operator op; + struct expression *exp; +} YYSTYPE; +#line 52 "plural.y" + +/* Prototypes for local functions. */ +static struct expression *new_exp PARAMS ((int nargs, enum operator op, + struct expression * const *args)); +static inline struct expression *new_exp_0 PARAMS ((enum operator op)); +static inline struct expression *new_exp_1 PARAMS ((enum operator op, + struct expression *right)); +static struct expression *new_exp_2 PARAMS ((enum operator op, + struct expression *left, + struct expression *right)); +static inline struct expression *new_exp_3 PARAMS ((enum operator op, + struct expression *bexp, + struct expression *tbranch, + struct expression *fbranch)); +static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); +static void yyerror PARAMS ((const char *str)); + +/* Allocation of expressions. */ + +static struct expression * +new_exp (nargs, op, args) + int nargs; + enum operator op; + struct expression * const *args; +{ + int i; + struct expression *newp; + + /* If any of the argument could not be malloc'ed, just return NULL. */ + for (i = nargs - 1; i >= 0; i--) + if (args[i] == NULL) + goto fail; + + /* Allocate a new expression. */ + newp = (struct expression *) malloc (sizeof (*newp)); + if (newp != NULL) + { + newp->nargs = nargs; + newp->operation = op; + for (i = nargs - 1; i >= 0; i--) + newp->val.args[i] = args[i]; + return newp; + } + + fail: + for (i = nargs - 1; i >= 0; i--) + FREE_EXPRESSION (args[i]); + + return NULL; +} + +static inline struct expression * +new_exp_0 (op) + enum operator op; +{ + return new_exp (0, op, NULL); +} + +static inline struct expression * +new_exp_1 (op, right) + enum operator op; + struct expression *right; +{ + struct expression *args[1]; + + args[0] = right; + return new_exp (1, op, args); +} + +static struct expression * +new_exp_2 (op, left, right) + enum operator op; + struct expression *left; + struct expression *right; +{ + struct expression *args[2]; + + args[0] = left; + args[1] = right; + return new_exp (2, op, args); +} + +static inline struct expression * +new_exp_3 (op, bexp, tbranch, fbranch) + enum operator op; + struct expression *bexp; + struct expression *tbranch; + struct expression *fbranch; +{ + struct expression *args[3]; + + args[0] = bexp; + args[1] = tbranch; + args[2] = fbranch; + return new_exp (3, op, args); +} + +#include + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 27 +#define YYFLAG -32768 +#define YYNTBASE 16 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 10, 2, 2, 2, 2, 5, 2, 14, + 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 12, 2, 2, + 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 6, 7, 8, 9, + 11 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 8, 12, 16, 20, 24, 28, 32, 35, + 37, 39 +}; + +static const short yyrhs[] = { 17, + 0, 17, 3, 17, 12, 17, 0, 17, 4, 17, + 0, 17, 5, 17, 0, 17, 6, 17, 0, 17, + 7, 17, 0, 17, 8, 17, 0, 17, 9, 17, + 0, 10, 17, 0, 13, 0, 11, 0, 14, 17, + 15, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 171, 179, 183, 187, 191, 195, 199, 203, 207, 211, + 215, 220 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","'?'","'|'", +"'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'", +"start","exp", NULL +}; +#endif + +static const short yyr1[] = { 0, + 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17 +}; + +static const short yyr2[] = { 0, + 1, 5, 3, 3, 3, 3, 3, 3, 2, 1, + 1, 3 +}; + +static const short yydefact[] = { 0, + 0, 11, 10, 0, 1, 9, 0, 0, 0, 0, + 0, 0, 0, 0, 12, 0, 3, 4, 5, 6, + 7, 8, 0, 2, 0, 0, 0 +}; + +static const short yydefgoto[] = { 25, + 5 +}; + +static const short yypact[] = { -9, + -9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9, + -9, -9, -9, -9,-32768, 24, 39, 43, 16, 26, + -3,-32768, -9, 34, 21, 53,-32768 +}; + +static const short yypgoto[] = {-32768, + -1 +}; + + +#define YYLAST 53 + + +static const short yytable[] = { 6, + 1, 2, 7, 3, 4, 14, 16, 17, 18, 19, + 20, 21, 22, 8, 9, 10, 11, 12, 13, 14, + 26, 24, 12, 13, 14, 15, 8, 9, 10, 11, + 12, 13, 14, 13, 14, 23, 8, 9, 10, 11, + 12, 13, 14, 10, 11, 12, 13, 14, 11, 12, + 13, 14, 27 +}; + +static const short yycheck[] = { 1, + 10, 11, 4, 13, 14, 9, 8, 9, 10, 11, + 12, 13, 14, 3, 4, 5, 6, 7, 8, 9, + 0, 23, 7, 8, 9, 15, 3, 4, 5, 6, + 7, 8, 9, 8, 9, 12, 3, 4, 5, 6, + 7, 8, 9, 5, 6, 7, 8, 9, 6, 7, + 8, 9, 0 +}; +#define YYPURE 1 + +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/lib/bison.simple" +/* This file comes from bison-1.28. */ + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) +{ + register char *t = to; + register char *f = from; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 217 "/usr/lib/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 1: +#line 172 "plural.y" +{ + if (yyvsp[0].exp == NULL) + YYABORT; + ((struct parse_args *) arg)->res = yyvsp[0].exp; + ; + break;} +case 2: +#line 180 "plural.y" +{ + yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 3: +#line 184 "plural.y" +{ + yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 4: +#line 188 "plural.y" +{ + yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 5: +#line 192 "plural.y" +{ + yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 6: +#line 196 "plural.y" +{ + yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 7: +#line 200 "plural.y" +{ + yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 8: +#line 204 "plural.y" +{ + yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 9: +#line 208 "plural.y" +{ + yyval.exp = new_exp_1 (lnot, yyvsp[0].exp); + ; + break;} +case 10: +#line 212 "plural.y" +{ + yyval.exp = new_exp_0 (var); + ; + break;} +case 11: +#line 216 "plural.y" +{ + if ((yyval.exp = new_exp_0 (num)) != NULL) + yyval.exp->val.num = yyvsp[0].num; + ; + break;} +case 12: +#line 221 "plural.y" +{ + yyval.exp = yyvsp[-1].exp; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 543 "/usr/lib/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; +} +#line 226 "plural.y" + + +void +internal_function +FREE_EXPRESSION (exp) + struct expression *exp; +{ + if (exp == NULL) + return; + + /* Handle the recursive case. */ + switch (exp->nargs) + { + case 3: + FREE_EXPRESSION (exp->val.args[2]); + /* FALLTHROUGH */ + case 2: + FREE_EXPRESSION (exp->val.args[1]); + /* FALLTHROUGH */ + case 1: + FREE_EXPRESSION (exp->val.args[0]); + /* FALLTHROUGH */ + default: + break; + } + + free (exp); +} + + +static int +yylex (lval, pexp) + YYSTYPE *lval; + const char **pexp; +{ + const char *exp = *pexp; + int result; + + while (1) + { + if (exp[0] == '\0') + { + *pexp = exp; + return YYEOF; + } + + if (exp[0] != ' ' && exp[0] != '\t') + break; + + ++exp; + } + + result = *exp++; + switch (result) + { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + { + unsigned long int n = result - '0'; + while (exp[0] >= '0' && exp[0] <= '9') + { + n *= 10; + n += exp[0] - '0'; + ++exp; + } + lval->num = n; + result = NUMBER; + } + break; + + case '=': + if (exp[0] == '=') + { + ++exp; + lval->op = equal; + result = EQUOP2; + } + else + result = YYERRCODE; + break; + + case '!': + if (exp[0] == '=') + { + ++exp; + lval->op = not_equal; + result = EQUOP2; + } + break; + + case '&': + case '|': + if (exp[0] == result) + ++exp; + else + result = YYERRCODE; + break; + + case '<': + if (exp[0] == '=') + { + ++exp; + lval->op = less_or_equal; + } + else + lval->op = less_than; + result = CMPOP2; + break; + + case '>': + if (exp[0] == '=') + { + ++exp; + lval->op = greater_or_equal; + } + else + lval->op = greater_than; + result = CMPOP2; + break; + + case '*': + lval->op = mult; + result = MULOP2; + break; + + case '/': + lval->op = divide; + result = MULOP2; + break; + + case '%': + lval->op = module; + result = MULOP2; + break; + + case '+': + lval->op = plus; + result = ADDOP2; + break; + + case '-': + lval->op = minus; + result = ADDOP2; + break; + + case 'n': + case '?': + case ':': + case '(': + case ')': + /* Nothing, just return the character. */ + break; + + case ';': + case '\n': + case '\0': + /* Be safe and let the user call this function again. */ + --exp; + result = YYEOF; + break; + + default: + result = YYERRCODE; +#if YYDEBUG != 0 + --exp; +#endif + break; + } + + *pexp = exp; + + return result; +} + + +static void +yyerror (str) + const char *str; +{ + /* Do nothing. We don't print error messages here. */ +} diff --git a/newlib/libc/sys/linux/intl/plural.y b/newlib/libc/sys/linux/intl/plural.y new file mode 100644 index 000000000..90b0004f5 --- /dev/null +++ b/newlib/libc/sys/linux/intl/plural.y @@ -0,0 +1,406 @@ +%{ +/* Expression parsing for plural form selection. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Ulrich Drepper , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "gettextP.h" + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define FREE_EXPRESSION __gettext_free_exp +#else +# define FREE_EXPRESSION gettext_free_exp__ +# define __gettextparse gettextparse__ +#endif + +#define YYLEX_PARAM &((struct parse_args *) arg)->cp +#define YYPARSE_PARAM arg +%} +%pure_parser +%expect 7 + +%union { + unsigned long int num; + enum operator op; + struct expression *exp; +} + +%{ +/* Prototypes for local functions. */ +static struct expression *new_exp PARAMS ((int nargs, enum operator op, + struct expression * const *args)); +static inline struct expression *new_exp_0 PARAMS ((enum operator op)); +static inline struct expression *new_exp_1 PARAMS ((enum operator op, + struct expression *right)); +static struct expression *new_exp_2 PARAMS ((enum operator op, + struct expression *left, + struct expression *right)); +static inline struct expression *new_exp_3 PARAMS ((enum operator op, + struct expression *bexp, + struct expression *tbranch, + struct expression *fbranch)); +static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); +static void yyerror PARAMS ((const char *str)); + +/* Allocation of expressions. */ + +static struct expression * +new_exp (nargs, op, args) + int nargs; + enum operator op; + struct expression * const *args; +{ + int i; + struct expression *newp; + + /* If any of the argument could not be malloc'ed, just return NULL. */ + for (i = nargs - 1; i >= 0; i--) + if (args[i] == NULL) + goto fail; + + /* Allocate a new expression. */ + newp = (struct expression *) malloc (sizeof (*newp)); + if (newp != NULL) + { + newp->nargs = nargs; + newp->operation = op; + for (i = nargs - 1; i >= 0; i--) + newp->val.args[i] = args[i]; + return newp; + } + + fail: + for (i = nargs - 1; i >= 0; i--) + FREE_EXPRESSION (args[i]); + + return NULL; +} + +static inline struct expression * +new_exp_0 (op) + enum operator op; +{ + return new_exp (0, op, NULL); +} + +static inline struct expression * +new_exp_1 (op, right) + enum operator op; + struct expression *right; +{ + struct expression *args[1]; + + args[0] = right; + return new_exp (1, op, args); +} + +static struct expression * +new_exp_2 (op, left, right) + enum operator op; + struct expression *left; + struct expression *right; +{ + struct expression *args[2]; + + args[0] = left; + args[1] = right; + return new_exp (2, op, args); +} + +static inline struct expression * +new_exp_3 (op, bexp, tbranch, fbranch) + enum operator op; + struct expression *bexp; + struct expression *tbranch; + struct expression *fbranch; +{ + struct expression *args[3]; + + args[0] = bexp; + args[1] = tbranch; + args[2] = fbranch; + return new_exp (3, op, args); +} + +%} + +/* This declares that all operators have the same associativity and the + precedence order as in C. See [Harbison, Steele: C, A Reference Manual]. + There is no unary minus and no bitwise operators. + Operators with the same syntactic behaviour have been merged into a single + token, to save space in the array generated by bison. */ +%right '?' /* ? */ +%left '|' /* || */ +%left '&' /* && */ +%left EQUOP2 /* == != */ +%left CMPOP2 /* < > <= >= */ +%left ADDOP2 /* + - */ +%left MULOP2 /* * / % */ +%right '!' /* ! */ + +%token EQUOP2 CMPOP2 ADDOP2 MULOP2 +%token NUMBER +%type exp + +%% + +start: exp + { + if ($1 == NULL) + YYABORT; + ((struct parse_args *) arg)->res = $1; + } + ; + +exp: exp '?' exp ':' exp + { + $$ = new_exp_3 (qmop, $1, $3, $5); + } + | exp '|' exp + { + $$ = new_exp_2 (lor, $1, $3); + } + | exp '&' exp + { + $$ = new_exp_2 (land, $1, $3); + } + | exp EQUOP2 exp + { + $$ = new_exp_2 ($2, $1, $3); + } + | exp CMPOP2 exp + { + $$ = new_exp_2 ($2, $1, $3); + } + | exp ADDOP2 exp + { + $$ = new_exp_2 ($2, $1, $3); + } + | exp MULOP2 exp + { + $$ = new_exp_2 ($2, $1, $3); + } + | '!' exp + { + $$ = new_exp_1 (lnot, $2); + } + | 'n' + { + $$ = new_exp_0 (var); + } + | NUMBER + { + if (($$ = new_exp_0 (num)) != NULL) + $$->val.num = $1; + } + | '(' exp ')' + { + $$ = $2; + } + ; + +%% + +void +internal_function +FREE_EXPRESSION (exp) + struct expression *exp; +{ + if (exp == NULL) + return; + + /* Handle the recursive case. */ + switch (exp->nargs) + { + case 3: + FREE_EXPRESSION (exp->val.args[2]); + /* FALLTHROUGH */ + case 2: + FREE_EXPRESSION (exp->val.args[1]); + /* FALLTHROUGH */ + case 1: + FREE_EXPRESSION (exp->val.args[0]); + /* FALLTHROUGH */ + default: + break; + } + + free (exp); +} + + +static int +yylex (lval, pexp) + YYSTYPE *lval; + const char **pexp; +{ + const char *exp = *pexp; + int result; + + while (1) + { + if (exp[0] == '\0') + { + *pexp = exp; + return YYEOF; + } + + if (exp[0] != ' ' && exp[0] != '\t') + break; + + ++exp; + } + + result = *exp++; + switch (result) + { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + { + unsigned long int n = result - '0'; + while (exp[0] >= '0' && exp[0] <= '9') + { + n *= 10; + n += exp[0] - '0'; + ++exp; + } + lval->num = n; + result = NUMBER; + } + break; + + case '=': + if (exp[0] == '=') + { + ++exp; + lval->op = equal; + result = EQUOP2; + } + else + result = YYERRCODE; + break; + + case '!': + if (exp[0] == '=') + { + ++exp; + lval->op = not_equal; + result = EQUOP2; + } + break; + + case '&': + case '|': + if (exp[0] == result) + ++exp; + else + result = YYERRCODE; + break; + + case '<': + if (exp[0] == '=') + { + ++exp; + lval->op = less_or_equal; + } + else + lval->op = less_than; + result = CMPOP2; + break; + + case '>': + if (exp[0] == '=') + { + ++exp; + lval->op = greater_or_equal; + } + else + lval->op = greater_than; + result = CMPOP2; + break; + + case '*': + lval->op = mult; + result = MULOP2; + break; + + case '/': + lval->op = divide; + result = MULOP2; + break; + + case '%': + lval->op = module; + result = MULOP2; + break; + + case '+': + lval->op = plus; + result = ADDOP2; + break; + + case '-': + lval->op = minus; + result = ADDOP2; + break; + + case 'n': + case '?': + case ':': + case '(': + case ')': + /* Nothing, just return the character. */ + break; + + case ';': + case '\n': + case '\0': + /* Be safe and let the user call this function again. */ + --exp; + result = YYEOF; + break; + + default: + result = YYERRCODE; +#if YYDEBUG != 0 + --exp; +#endif + break; + } + + *pexp = exp; + + return result; +} + + +static void +yyerror (str) + const char *str; +{ + /* Do nothing. We don't print error messages here. */ +} diff --git a/newlib/libc/sys/linux/intl/stpcpy.c b/newlib/libc/sys/linux/intl/stpcpy.c new file mode 100644 index 000000000..0af6c67c8 --- /dev/null +++ b/newlib/libc/sys/linux/intl/stpcpy.c @@ -0,0 +1,10 @@ +char * +__stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} + diff --git a/newlib/libc/sys/linux/intl/textdomain.c b/newlib/libc/sys/linux/intl/textdomain.c new file mode 100644 index 000000000..b03ad8079 --- /dev/null +++ b/newlib/libc/sys/linux/intl/textdomain.c @@ -0,0 +1,155 @@ +/* Implementation of the textdomain(3) function. + Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) (bcopy (Src, Dst, Num), (Dst)) +# endif +#endif + +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif +#include "gettextP.h" + +#ifdef _LIBC +/* We have to handle multi-threaded applications. */ +# include +#else +/* Provide dummy implementation if this is outside glibc. */ +# define __libc_rwlock_define(CLASS, NAME) +# define __libc_rwlock_wrlock(NAME) +# define __libc_rwlock_unlock(NAME) +#endif + +/* The internal variables in the standalone libintl.a must have different + names than the internal variables in GNU libc, otherwise programs + using libintl.a cannot be linked statically. */ +#if !defined _LIBC +# define _nl_default_default_domain _nl_default_default_domain__ +# define _nl_current_default_domain _nl_current_default_domain__ +#endif + +/* @@ end of prolog @@ */ + +/* Name of the default text domain. */ +extern const char _nl_default_default_domain[]; + +/* Default text domain in which entries for gettext(3) are to be found. */ +extern const char *_nl_current_default_domain; + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define TEXTDOMAIN __textdomain +# ifdef _GLIBC +# ifndef strdup +# define strdup(str) __strdup (str) +# endif +# endif +#else +# define TEXTDOMAIN textdomain__ +#endif + +/* Lock variable to protect the global data in the gettext implementation. */ +__libc_rwlock_define (extern, _nl_state_lock) + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +char * +TEXTDOMAIN (domainname) + const char *domainname; +{ + char *new_domain; + char *old_domain; + + /* A NULL pointer requests the current setting. */ + if (domainname == NULL) + return (char *) _nl_current_default_domain; + + __libc_rwlock_wrlock (_nl_state_lock); + + old_domain = (char *) _nl_current_default_domain; + + /* If domain name is the null string set to default domain "messages". */ + if (domainname[0] == '\0' + || strcmp (domainname, _nl_default_default_domain) == 0) + { + _nl_current_default_domain = _nl_default_default_domain; + new_domain = (char *) _nl_current_default_domain; + } + else if (strcmp (domainname, old_domain) == 0) + /* This can happen and people will use it to signal that some + environment variable changed. */ + new_domain = old_domain; + else + { + /* If the following malloc fails `_nl_current_default_domain' + will be NULL. This value will be returned and so signals we + are out of core. */ +#if defined _LIBC || defined HAVE_STRDUP + new_domain = strdup (domainname); +#else + size_t len = strlen (domainname) + 1; + new_domain = (char *) malloc (len); + if (new_domain != NULL) + memcpy (new_domain, domainname, len); +#endif + + if (new_domain != NULL) + _nl_current_default_domain = new_domain; + } + + /* We use this possibility to signal a change of the loaded catalogs + since this is most likely the case and there is no other easy we + to do it. Do it only when the call was successful. */ + if (new_domain != NULL) + { + ++_nl_msg_cat_cntr; + + if (old_domain != new_domain && old_domain != _nl_default_default_domain) + free (old_domain); + } + + __libc_rwlock_unlock (_nl_state_lock); + + return new_domain; +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__textdomain, textdomain); +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/LICENSE b/newlib/libc/sys/linux/linuxthreads/LICENSE new file mode 100644 index 000000000..7bcca6050 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/LICENSE @@ -0,0 +1,501 @@ +GNU LIBRARY GENERAL PUBLIC LICENSE +********************************** + + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place -- Suite 330, Boston, MA 02111-1307, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + [This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + +Preamble +======== + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it in +new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License, which was designed for utility +programs. This license, the GNU Library General Public License, +applies to certain designated libraries. This license is quite +different from the ordinary one; be sure to read it in full, and don't +assume that anything in it is the same as in the ordinary license. + + The reason we have a separate public license for some libraries is +that they blur the distinction we usually make between modifying or +adding to a program and simply using it. Linking a program with a +library, without changing the library, is in some sense simply using +the library, and is analogous to running a utility program or +application program. However, in a textual and legal sense, the linked +executable is a combined work, a derivative of the original library, +and the ordinary General Public License treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended +to permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to +achieve this as regards changes in header files, but we have achieved +it as regards changes in the actual functions of the Library.) The +hope is that this will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which + contains a notice placed by the copyright holder or other + authorized party saying it may be distributed under the terms of + this Library General Public License (also called "this License"). + Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data + prepared so as to be conveniently linked with application programs + (which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work + which has been distributed under these terms. A "work based on the + Library" means either the Library or any derivative work under + copyright law: that is to say, a work containing the Library or a + portion of it, either verbatim or with modifications and/or + translated straightforwardly into another language. (Hereinafter, + translation is included without limitation in the term + "modification".) + + "Source code" for a work means the preferred form of the work for + making modifications to it. For a library, complete source code + means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to + control compilation and installation of the library. + + Activities other than copying, distribution and modification are + not covered by this License; they are outside its scope. The act + of running a program using the Library is not restricted, and + output from such a program is covered only if its contents + constitute a work based on the Library (independent of the use of + the Library in a tool for writing it). Whether that is true + depends on what the Library does and what the program that uses + the Library does. + + 1. You may copy and distribute verbatim copies of the Library's + complete source code as you receive it, in any medium, provided + that you conspicuously and appropriately publish on each copy an + appropriate copyright notice and disclaimer of warranty; keep + intact all the notices that refer to this License and to the + absence of any warranty; and distribute a copy of this License + along with the Library. + + You may charge a fee for the physical act of transferring a copy, + and you may at your option offer warranty protection in exchange + for a fee. + + 2. You may modify your copy or copies of the Library or any portion + of it, thus forming a work based on the Library, and copy and + distribute such modifications or work under the terms of Section 1 + above, provided that you also meet all of these conditions: + + a. The modified work must itself be a software library. + + b. You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c. You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d. If a facility in the modified Library refers to a function or + a table of data to be supplied by an application program that + uses the facility, other than as an argument passed when the + facility is invoked, then you must make a good faith effort + to ensure that, in the event an application does not supply + such function or table, the facility still operates, and + performs whatever part of its purpose remains meaningful. + + (For example, a function in a library to compute square roots + has a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function + must be optional: if the application does not supply it, the + square root function must still compute square roots.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the + Library, and can be reasonably considered independent and separate + works in themselves, then this License, and its terms, do not + apply to those sections when you distribute them as separate + works. But when you distribute the same sections as part of a + whole which is a work based on the Library, the distribution of + the whole must be on the terms of this License, whose permissions + for other licensees extend to the entire whole, and thus to each + and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or + contest your rights to work written entirely by you; rather, the + intent is to exercise the right to control the distribution of + derivative or collective works based on the Library. + + In addition, mere aggregation of another work not based on the + Library with the Library (or with a work based on the Library) on + a volume of a storage or distribution medium does not bring the + other work under the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public + License instead of this License to a given copy of the Library. + To do this, you must alter all the notices that refer to this + License, so that they refer to the ordinary GNU General Public + License, version 2, instead of to this License. (If a newer + version than version 2 of the ordinary GNU General Public License + has appeared, then you can specify that version instead if you + wish.) Do not make any other change in these notices. + + Once this change is made in a given copy, it is irreversible for + that copy, so the ordinary GNU General Public License applies to + all subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of + the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or + derivative of it, under Section 2) in object code or executable + form under the terms of Sections 1 and 2 above provided that you + accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software + interchange. + + If distribution of object code is made by offering access to copy + from a designated place, then offering equivalent access to copy + the source code from the same place satisfies the requirement to + distribute the source code, even though third parties are not + compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the + Library, but is designed to work with the Library by being + compiled or linked with it, is called a "work that uses the + Library". Such a work, in isolation, is not a derivative work of + the Library, and therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library + creates an executable that is a derivative of the Library (because + it contains portions of the Library), rather than a "work that + uses the library". The executable is therefore covered by this + License. Section 6 states terms for distribution of such + executables. + + When a "work that uses the Library" uses material from a header + file that is part of the Library, the object code for the work may + be a derivative work of the Library even though the source code is + not. Whether this is true is especially significant if the work + can be linked without the Library, or if the work is itself a + library. The threshold for this to be true is not precisely + defined by law. + + If such an object file uses only numerical parameters, data + structure layouts and accessors, and small macros and small inline + functions (ten lines or less in length), then the use of the object + file is unrestricted, regardless of whether it is legally a + derivative work. (Executables containing this object code plus + portions of the Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may + distribute the object code for the work under the terms of Section + 6. Any executables containing that work also fall under Section 6, + whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or + link a "work that uses the Library" with the Library to produce a + work containing portions of the Library, and distribute that work + under terms of your choice, provided that the terms permit + modification of the work for the customer's own use and reverse + engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the + Library is used in it and that the Library and its use are covered + by this License. You must supply a copy of this License. If the + work during execution displays copyright notices, you must include + the copyright notice for the Library among them, as well as a + reference directing the user to the copy of this License. Also, + you must do one of these things: + + a. Accompany the work with the complete corresponding + machine-readable source code for the Library including + whatever changes were used in the work (which must be + distributed under Sections 1 and 2 above); and, if the work + is an executable linked with the Library, with the complete + machine-readable "work that uses the Library", as object code + and/or source code, so that the user can modify the Library + and then relink to produce a modified executable containing + the modified Library. (It is understood that the user who + changes the contents of definitions files in the Library will + not necessarily be able to recompile the application to use + the modified definitions.) + + b. Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + + c. If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the + above specified materials from the same place. + + d. Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the + Library" must include any data and utility programs needed for + reproducing the executable from it. However, as a special + exception, the source code distributed need not include anything + that is normally distributed (in either source or binary form) + with the major components (compiler, kernel, and so on) of the + operating system on which the executable runs, unless that + component itself accompanies the executable. + + It may happen that this requirement contradicts the license + restrictions of other proprietary libraries that do not normally + accompany the operating system. Such a contradiction means you + cannot use both them and the Library together in an executable + that you distribute. + + 7. You may place library facilities that are a work based on the + Library side-by-side in a single library together with other + library facilities not covered by this License, and distribute + such a combined library, provided that the separate distribution + of the work based on the Library and of the other library + facilities is otherwise permitted, and provided that you do these + two things: + + a. Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b. Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same + work. + + 8. You may not copy, modify, sublicense, link with, or distribute the + Library except as expressly provided under this License. Any + attempt otherwise to copy, modify, sublicense, link with, or + distribute the Library is void, and will automatically terminate + your rights under this License. However, parties who have + received copies, or rights, from you under this License will not + have their licenses terminated so long as such parties remain in + full compliance. + + 9. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify + or distribute the Library or its derivative works. These actions + are prohibited by law if you do not accept this License. + Therefore, by modifying or distributing the Library (or any work + based on the Library), you indicate your acceptance of this + License to do so, and all its terms and conditions for copying, + distributing or modifying the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the + Library), the recipient automatically receives a license from the + original licensor to copy, distribute, link with or modify the + Library subject to these terms and conditions. You may not impose + any further restrictions on the recipients' exercise of the rights + granted herein. You are not responsible for enforcing compliance + by third parties to this License. + + 11. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent + issues), conditions are imposed on you (whether by court order, + agreement or otherwise) that contradict the conditions of this + License, they do not excuse you from the conditions of this + License. If you cannot distribute so as to satisfy simultaneously + your obligations under this License and any other pertinent + obligations, then as a consequence you may not distribute the + Library at all. For example, if a patent license would not permit + royalty-free redistribution of the Library by all those who + receive copies directly or indirectly through you, then the only + way you could satisfy both it and this License would be to refrain + entirely from distribution of the Library. + + If any portion of this section is held invalid or unenforceable + under any particular circumstance, the balance of the section is + intended to apply, and the section as a whole is intended to apply + in other circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of + any such claims; this section has the sole purpose of protecting + the integrity of the free software distribution system which is + implemented by public license practices. Many people have made + generous contributions to the wide range of software distributed + through that system in reliance on consistent application of that + system; it is up to the author/donor to decide if he or she is + willing to distribute software through any other system and a + licensee cannot impose that choice. + + This section is intended to make thoroughly clear what is believed + to be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in + certain countries either by patents or by copyrighted interfaces, + the original copyright holder who places the Library under this + License may add an explicit geographical distribution limitation + excluding those countries, so that distribution is permitted only + in or among countries not thus excluded. In such case, this + License incorporates the limitation as if written in the body of + this License. + + 13. The Free Software Foundation may publish revised and/or new + versions of the Library General Public License from time to time. + Such new versions will be similar in spirit to the present version, + but may differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the + Library specifies a version number of this License which applies + to it and "any later version", you have the option of following + the terms and conditions either of that version or of any later + version published by the Free Software Foundation. If the Library + does not specify a license version number, you may choose any + version ever published by the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free + programs whose distribution conditions are incompatible with these, + write to the author to ask for permission. For software which is + copyrighted by the Free Software Foundation, write to the Free + Software Foundation; we sometimes make exceptions for this. Our + decision will be guided by the two goals of preserving the free + status of all derivatives of our free software and of promoting + the sharing and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE + LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT + HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT + WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT + NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE + QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE + LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY + SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY + MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE + LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, + INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR + INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF + DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU + OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY + OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries +============================================== + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of +the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should have +at least the "copyright" line and a pointer to where the full notice is +found. + + ONE LINE TO GIVE THE LIBRARY'S NAME AND AN IDEA OF WHAT IT DOES. + Copyright (C) YEAR NAME OF AUTHOR + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2 of the License, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + + Also add information on how to contact you by electronic and paper +mail. + + You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the library + `Frob' (a library for tweaking knobs) written by James Random Hacker. + + SIGNATURE OF TY COON, 1 April 1990 + Ty Coon, President of Vice + + That's all there is to it! + diff --git a/newlib/libc/sys/linux/linuxthreads/Makefile.am b/newlib/libc/sys/linux/linuxthreads/Makefile.am new file mode 100644 index 000000000..a47cecc17 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/Makefile.am @@ -0,0 +1,139 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/../include -I$(srcdir)/machine/$(machine_dir) -I$(srcdir)/machine/generic $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) -I$(srcdir)/.. + +LIBTOOL_VERSION_INFO = 0:0:0 + +LIB_SOURCES= \ + attr.c barrier.c condvar.c \ + events.c getcpuclockid.c getreent.c join.c lockfile.c manager.c \ + mq_notify.c oldsemaphore.c prio.c ptclock_gettime.c ptclock_settime.c \ + ptlongjmp.c pt-machine.c reent.c rwlock.c semaphore.c \ + signals.c spinlock.c sysctl.c \ + timer_create.c timer_getoverr.c timer_routines.c \ + timer_delete.c timer_gettime.c timer_settime.c \ + wrapsyscall.c + +LIB_DB_SOURCES = td_init.c td_log.c td_ta_delete.c td_ta_get_nthreads.c \ + td_ta_get_ph.c td_ta_map_id2thr.c td_ta_map_lwp2thr.c \ + td_ta_new.c td_ta_thr_iter.c td_ta_tsd_iter.c \ + td_thr_get_info.c td_thr_getfpregs.c td_thr_getgregs.c \ + td_thr_getxregs.c td_thr_getxregsize.c td_thr_setfpregs.c \ + td_thr_setgregs.c td_thr_setprio.c td_thr_setsigpending.c \ + td_thr_setxregs.c td_thr_sigsetmask.c td_thr_tsd.c \ + td_thr_validate.c td_thr_dbsuspend.c td_thr_dbresume.c \ + td_ta_setconcurrency.c td_ta_enable_stats.c \ + td_ta_reset_stats.c td_ta_get_stats.c td_ta_event_addr.c \ + td_thr_event_enable.c td_thr_set_event.c \ + td_thr_clear_event.c td_thr_event_getmsg.c \ + td_ta_set_event.c td_ta_event_getmsg.c \ + td_ta_clear_event.c td_symbol_list.c + +# Because of how libtool moves objects around, these files must be built last. +LIBADD_OBJS = mutex.$(oext) specific.$(oext) pthread.$(oext) \ + cancel.$(oext) + +ELIX_3_OBJS = \ + ptfork.$(oext) + +if ELIX_LEVEL_1 +EXTRA_OBJS = reqsyscalls.$(oext) +else +if ELIX_LEVEL_2 +EXTRA_OBJS = reqsyscalls.$(oext) +else +EXTRA_OBJS = $(ELIX_3_OBJS) +endif +endif + +SUBDIRS = machine . + +tooldir = $(tooldir) +toollibdir = $(top_toollibdir) + +libpthread_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO) -release newlib -no-undefined -Xcompiler -nostdlib -Xlinker --version-script=$(srcdir)/../shared.ld `cat extra-libtool-objlist` +libthread_db_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO) -release newlib -no-undefined -Xcompiler -nostdlib -Xlinker --version-script=$(srcdir)/../shared.ld + +if USE_LIBTOOL + +# objects listed later in LIBPTHREAD_OBJLISTS will override those listed earlier +extra-libtool-objlist: $(MACHINE_OBJLIST) + cat $(MACHINE_OBJLIST) | $(AWK) '{ libpthread[$$1] = $$2 }; END { for (x in libpthread) printf ("%s\n", libpthread[x]) }' > $@ + +toollib_LTLIBRARIES = libpthread.la libthread_db.la +libpthread_la_SOURCES = $(LIB_SOURCES) +libpthread_la_LIBADD = $(LIBADD_OBJS) $(EXTRA_OBJS) +## libpthread_la_DEPENDENCIES = defs.h crti.S +libpthread_la_DEPENDENCIES = $(LIBADD_OBJS) $(EXTRA_OBJS) extra-libtool-objlist +noinst_DATA=objectlist.awk.in +LIB_COMPILE = $(LTCOMPILE) + +libthread_db_la_SOURCES = $(LIB_DB_SOURCES) + +else + +toollib_LIBRARIES = libpthread.a libthread_db.a +libpthread_a_SOURCES = $(LIB_SOURCES) +libpthread_a_LIBADD = $(LIBADD_OBJS) $(EXTRA_OBJS) $(MACHINE_LIB) +## libpthread_a_DEPENDENCIES = defs.h crti.S +libpthread_a_DEPENDENCIES = $(LIBADD_OBJS) $(EXTRA_OBJS) $(MACHINE_LIB) +LIB_COMPILE = $(COMPILE) + +libthread_db_a_SOURCES = $(LIB_DB_SOURCES) + +endif # USE_LIBTOOL + +include $(srcdir)/../../../../Makefile.shared + +doc: + +install-data-local: install-toollibLIBRARIES + -rm -f $(DESTDIR)$(toollibdir)/libthread_db.so.1 + ln -s $(DESTDIR)$(toollibdir)/libthread_db.so $(DESTDIR)$(toollibdir)/libthread_db.so.1 || cp $(DESTDIR)$(toollibdir)/libthread_db.so $(DESTDIR)$(toollibdir)/libthread_db.so.1 + +AM_CFLAGS = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 +ACLOCAL_AMFLAGS = -I ../../../.. +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host + +## PTHREAD_HEADERS=pthread.h semaphore.h + +CFLAGS_pt_initfini = -g0 -fPIC -fno-inline-functions +CFLAGS_noweak=-D__NO_WEAK_PTHREAD_ALIASES +CFLAGS_cancel=-D__NO_WEAK_PTHREAD_ALIASES -D_RPC_THREAD_SAFE_ +CFLAGS_pthread=-D__NO_WEAK_PTHREAD_ALIASES -DHAVE_Z_NODELETE + +pt-initfini.s: $(srcdir)/pt-initfini.c + $(CC) -S $(CFLAGS_pt_initfini) -finhibit-size-directive \ + $(patsubst -f%,-fno-%,$(exceptions)) -o $@ + +# We only have one kind of startup code files. Static binaries and +# shared libraries are build using the PIC version. +crti.S: pt-initfini.s + sed -n -e '1,/@HEADER_ENDS/p' \ + -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \ + -e '/@TRAILER_BEGINS/,$$p' $< > $@ + +defs.h: pt-initfini.s + sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \ + $(AWK) -f defs.awk > $@ + +crti.o: crti.S defs.h + $(CC) -g0 $(ASFLAGS) -o $@ + +mutex.$(oext): $(srcdir)/mutex.c + $(LIB_COMPILE) $(CFLAGS_noweak) -c $< -o $@ + +specific.$(oext): $(srcdir)/specific.c + $(LIB_COMPILE) $(CFLAGS_noweak) -c $< -o $@ + +pthread.$(oext): $(srcdir)/pthread.c + $(LIB_COMPILE) $(CFLAGS_pthread) -c $< -o $@ + +ptfork.$(oext): $(srcdir)/ptfork.c + $(LIB_COMPILE) $(CFLAGS_noweak) -c $< -o $@ + +cancel.$(oext): $(srcdir)/cancel.c + $(LIB_COMPILE) $(CFLAGS_cancel) -c $< -o $@ + diff --git a/newlib/libc/sys/linux/linuxthreads/Makefile.in b/newlib/libc/sys/linux/linuxthreads/Makefile.in new file mode 100644 index 000000000..6ab7ced4c --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/Makefile.in @@ -0,0 +1,705 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MACHINE_LIB = @MACHINE_LIB@ +MACHINE_OBJLIST = @MACHINE_OBJLIST@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +aext = @aext@ +libm_machine_dir = @libm_machine_dir@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/../include -I$(srcdir)/machine/$(machine_dir) -I$(srcdir)/machine/generic $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) -I$(srcdir)/.. + +LIBTOOL_VERSION_INFO = 0:0:0 + +LIB_SOURCES = \ + attr.c barrier.c condvar.c \ + events.c getcpuclockid.c getreent.c join.c lockfile.c manager.c \ + mq_notify.c oldsemaphore.c prio.c ptclock_gettime.c ptclock_settime.c \ + ptlongjmp.c pt-machine.c reent.c rwlock.c semaphore.c \ + signals.c spinlock.c sysctl.c \ + timer_create.c timer_getoverr.c timer_routines.c \ + timer_delete.c timer_gettime.c timer_settime.c \ + wrapsyscall.c + + +LIB_DB_SOURCES = td_init.c td_log.c td_ta_delete.c td_ta_get_nthreads.c \ + td_ta_get_ph.c td_ta_map_id2thr.c td_ta_map_lwp2thr.c \ + td_ta_new.c td_ta_thr_iter.c td_ta_tsd_iter.c \ + td_thr_get_info.c td_thr_getfpregs.c td_thr_getgregs.c \ + td_thr_getxregs.c td_thr_getxregsize.c td_thr_setfpregs.c \ + td_thr_setgregs.c td_thr_setprio.c td_thr_setsigpending.c \ + td_thr_setxregs.c td_thr_sigsetmask.c td_thr_tsd.c \ + td_thr_validate.c td_thr_dbsuspend.c td_thr_dbresume.c \ + td_ta_setconcurrency.c td_ta_enable_stats.c \ + td_ta_reset_stats.c td_ta_get_stats.c td_ta_event_addr.c \ + td_thr_event_enable.c td_thr_set_event.c \ + td_thr_clear_event.c td_thr_event_getmsg.c \ + td_ta_set_event.c td_ta_event_getmsg.c \ + td_ta_clear_event.c td_symbol_list.c + + +# Because of how libtool moves objects around, these files must be built last. +LIBADD_OBJS = mutex.$(oext) specific.$(oext) pthread.$(oext) \ + cancel.$(oext) + + +ELIX_3_OBJS = \ + ptfork.$(oext) + +@ELIX_LEVEL_1_TRUE@EXTRA_OBJS = @ELIX_LEVEL_1_TRUE@reqsyscalls.$(oext) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@EXTRA_OBJS = @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@reqsyscalls.$(oext) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@EXTRA_OBJS = @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@$(ELIX_3_OBJS) + +SUBDIRS = machine . + +tooldir = $(tooldir) +toollibdir = $(top_toollibdir) + +libpthread_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO) -release newlib -no-undefined -Xcompiler -nostdlib -Xlinker --version-script=$(srcdir)/../shared.ld `cat extra-libtool-objlist` +libthread_db_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO) -release newlib -no-undefined -Xcompiler -nostdlib -Xlinker --version-script=$(srcdir)/../shared.ld + +@USE_LIBTOOL_TRUE@toollib_LTLIBRARIES = @USE_LIBTOOL_TRUE@libpthread.la libthread_db.la +@USE_LIBTOOL_TRUE@libpthread_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) +@USE_LIBTOOL_TRUE@libpthread_la_LIBADD = @USE_LIBTOOL_TRUE@$(LIBADD_OBJS) $(EXTRA_OBJS) +@USE_LIBTOOL_TRUE@libpthread_la_DEPENDENCIES = @USE_LIBTOOL_TRUE@$(LIBADD_OBJS) $(EXTRA_OBJS) extra-libtool-objlist +@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in +@USE_LIBTOOL_TRUE@LIB_COMPILE = @USE_LIBTOOL_TRUE@$(LTCOMPILE) +@USE_LIBTOOL_FALSE@LIB_COMPILE = @USE_LIBTOOL_FALSE@$(COMPILE) + +@USE_LIBTOOL_TRUE@libthread_db_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_DB_SOURCES) + +@USE_LIBTOOL_FALSE@toollib_LIBRARIES = @USE_LIBTOOL_FALSE@libpthread.a libthread_db.a +@USE_LIBTOOL_FALSE@libpthread_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) +@USE_LIBTOOL_FALSE@libpthread_a_LIBADD = @USE_LIBTOOL_FALSE@$(LIBADD_OBJS) $(EXTRA_OBJS) $(MACHINE_LIB) +@USE_LIBTOOL_FALSE@libpthread_a_DEPENDENCIES = @USE_LIBTOOL_FALSE@$(LIBADD_OBJS) $(EXTRA_OBJS) $(MACHINE_LIB) + +@USE_LIBTOOL_FALSE@libthread_db_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_DB_SOURCES) + +AM_CFLAGS = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 +ACLOCAL_AMFLAGS = -I ../../../.. +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host + +CFLAGS_pt_initfini = -g0 -fPIC -fno-inline-functions +CFLAGS_noweak = -D__NO_WEAK_PTHREAD_ALIASES +CFLAGS_cancel = -D__NO_WEAK_PTHREAD_ALIASES -D_RPC_THREAD_SAFE_ +CFLAGS_pthread = -D__NO_WEAK_PTHREAD_ALIASES -DHAVE_Z_NODELETE +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(toollib_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +@USE_LIBTOOL_FALSE@libpthread_a_OBJECTS = attr.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@barrier.$(OBJEXT) condvar.$(OBJEXT) events.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getcpuclockid.$(OBJEXT) getreent.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@join.$(OBJEXT) lockfile.$(OBJEXT) manager.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@mq_notify.$(OBJEXT) oldsemaphore.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@prio.$(OBJEXT) ptclock_gettime.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ptclock_settime.$(OBJEXT) ptlongjmp.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@pt-machine.$(OBJEXT) reent.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@rwlock.$(OBJEXT) semaphore.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@signals.$(OBJEXT) spinlock.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sysctl.$(OBJEXT) timer_create.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@timer_getoverr.$(OBJEXT) timer_routines.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@timer_delete.$(OBJEXT) timer_gettime.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@timer_settime.$(OBJEXT) wrapsyscall.$(OBJEXT) +libthread_db_a_LIBADD = +@USE_LIBTOOL_FALSE@libthread_db_a_OBJECTS = td_init.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_log.$(OBJEXT) td_ta_delete.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_get_nthreads.$(OBJEXT) td_ta_get_ph.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_map_id2thr.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_map_lwp2thr.$(OBJEXT) td_ta_new.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_thr_iter.$(OBJEXT) td_ta_tsd_iter.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_get_info.$(OBJEXT) td_thr_getfpregs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_getgregs.$(OBJEXT) td_thr_getxregs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_getxregsize.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_setfpregs.$(OBJEXT) td_thr_setgregs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_setprio.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_setsigpending.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_setxregs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_sigsetmask.$(OBJEXT) td_thr_tsd.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_validate.$(OBJEXT) td_thr_dbsuspend.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_dbresume.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_setconcurrency.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_enable_stats.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_reset_stats.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_get_stats.$(OBJEXT) td_ta_event_addr.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_event_enable.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_set_event.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_clear_event.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_thr_event_getmsg.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_set_event.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_event_getmsg.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@td_ta_clear_event.$(OBJEXT) td_symbol_list.$(OBJEXT) +LTLIBRARIES = $(toollib_LTLIBRARIES) + +@USE_LIBTOOL_TRUE@libpthread_la_OBJECTS = attr.lo barrier.lo condvar.lo \ +@USE_LIBTOOL_TRUE@events.lo getcpuclockid.lo getreent.lo join.lo \ +@USE_LIBTOOL_TRUE@lockfile.lo manager.lo mq_notify.lo oldsemaphore.lo \ +@USE_LIBTOOL_TRUE@prio.lo ptclock_gettime.lo ptclock_settime.lo \ +@USE_LIBTOOL_TRUE@ptlongjmp.lo pt-machine.lo reent.lo rwlock.lo \ +@USE_LIBTOOL_TRUE@semaphore.lo signals.lo spinlock.lo sysctl.lo \ +@USE_LIBTOOL_TRUE@timer_create.lo timer_getoverr.lo timer_routines.lo \ +@USE_LIBTOOL_TRUE@timer_delete.lo timer_gettime.lo timer_settime.lo \ +@USE_LIBTOOL_TRUE@wrapsyscall.lo +libthread_db_la_LIBADD = +@USE_LIBTOOL_TRUE@libthread_db_la_OBJECTS = td_init.lo td_log.lo \ +@USE_LIBTOOL_TRUE@td_ta_delete.lo td_ta_get_nthreads.lo td_ta_get_ph.lo \ +@USE_LIBTOOL_TRUE@td_ta_map_id2thr.lo td_ta_map_lwp2thr.lo td_ta_new.lo \ +@USE_LIBTOOL_TRUE@td_ta_thr_iter.lo td_ta_tsd_iter.lo \ +@USE_LIBTOOL_TRUE@td_thr_get_info.lo td_thr_getfpregs.lo \ +@USE_LIBTOOL_TRUE@td_thr_getgregs.lo td_thr_getxregs.lo \ +@USE_LIBTOOL_TRUE@td_thr_getxregsize.lo td_thr_setfpregs.lo \ +@USE_LIBTOOL_TRUE@td_thr_setgregs.lo td_thr_setprio.lo \ +@USE_LIBTOOL_TRUE@td_thr_setsigpending.lo td_thr_setxregs.lo \ +@USE_LIBTOOL_TRUE@td_thr_sigsetmask.lo td_thr_tsd.lo td_thr_validate.lo \ +@USE_LIBTOOL_TRUE@td_thr_dbsuspend.lo td_thr_dbresume.lo \ +@USE_LIBTOOL_TRUE@td_ta_setconcurrency.lo td_ta_enable_stats.lo \ +@USE_LIBTOOL_TRUE@td_ta_reset_stats.lo td_ta_get_stats.lo \ +@USE_LIBTOOL_TRUE@td_ta_event_addr.lo td_thr_event_enable.lo \ +@USE_LIBTOOL_TRUE@td_thr_set_event.lo td_thr_clear_event.lo \ +@USE_LIBTOOL_TRUE@td_thr_event_getmsg.lo td_ta_set_event.lo \ +@USE_LIBTOOL_TRUE@td_ta_event_getmsg.lo td_ta_clear_event.lo \ +@USE_LIBTOOL_TRUE@td_symbol_list.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(noinst_DATA) + +DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(libpthread_a_SOURCES) $(libthread_db_a_SOURCES) $(libpthread_la_SOURCES) $(libthread_db_la_SOURCES) +OBJECTS = $(libpthread_a_OBJECTS) $(libthread_db_a_OBJECTS) $(libpthread_la_OBJECTS) $(libthread_db_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../Makefile.shared + cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \ + ../../../../acinclude.m4 ../../../../aclocal.m4 \ + ../../../../libtool.m4 + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +mostlyclean-toollibLIBRARIES: + +clean-toollibLIBRARIES: + -test -z "$(toollib_LIBRARIES)" || rm -f $(toollib_LIBRARIES) + +distclean-toollibLIBRARIES: + +maintainer-clean-toollibLIBRARIES: + +install-toollibLIBRARIES: $(toollib_LIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(toollibdir) + @list='$(toollib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(toollibdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(toollibdir)/$$p; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(toollib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(RANLIB) $(DESTDIR)$(toollibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(toollibdir)/$$p; \ + else :; fi; \ + done + +uninstall-toollibLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(toollib_LIBRARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(toollibdir)/$$p; \ + done + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libpthread.a: $(libpthread_a_OBJECTS) $(libpthread_a_DEPENDENCIES) + -rm -f libpthread.a + $(AR) cru libpthread.a $(libpthread_a_OBJECTS) $(libpthread_a_LIBADD) + $(RANLIB) libpthread.a + +libthread_db.a: $(libthread_db_a_OBJECTS) $(libthread_db_a_DEPENDENCIES) + -rm -f libthread_db.a + $(AR) cru libthread_db.a $(libthread_db_a_OBJECTS) $(libthread_db_a_LIBADD) + $(RANLIB) libthread_db.a + +mostlyclean-toollibLTLIBRARIES: + +clean-toollibLTLIBRARIES: + -test -z "$(toollib_LTLIBRARIES)" || rm -f $(toollib_LTLIBRARIES) + +distclean-toollibLTLIBRARIES: + +maintainer-clean-toollibLTLIBRARIES: + +install-toollibLTLIBRARIES: $(toollib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(toollibdir) + @list='$(toollib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toollibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toollibdir)/$$p; \ + else :; fi; \ + done + +uninstall-toollibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(toollib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toollibdir)/$$p; \ + done + +libpthread.la: $(libpthread_la_OBJECTS) $(libpthread_la_DEPENDENCIES) + $(LINK) -rpath $(toollibdir) $(libpthread_la_LDFLAGS) $(libpthread_la_OBJECTS) $(libpthread_la_LIBADD) $(LIBS) + +libthread_db.la: $(libthread_db_la_OBJECTS) $(libthread_db_la_DEPENDENCIES) + $(LINK) -rpath $(toollibdir) $(libthread_db_la_LDFLAGS) $(libthread_db_la_OBJECTS) $(libthread_db_la_LIBADD) $(LIBS) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-info-am: +install-info: install-info-recursive +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: install-toollibLIBRARIES install-toollibLTLIBRARIES \ + install-data-local +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: uninstall-toollibLIBRARIES uninstall-toollibLTLIBRARIES +uninstall: uninstall-recursive +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(toollibdir) $(DESTDIR)$(toollibdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-toollibLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-toollibLTLIBRARIES \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-toollibLIBRARIES clean-compile clean-libtool \ + clean-toollibLTLIBRARIES clean-tags clean-generic \ + mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-toollibLIBRARIES distclean-compile \ + distclean-libtool distclean-toollibLTLIBRARIES \ + distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-toollibLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-toollibLTLIBRARIES \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: mostlyclean-toollibLIBRARIES distclean-toollibLIBRARIES \ +clean-toollibLIBRARIES maintainer-clean-toollibLIBRARIES \ +uninstall-toollibLIBRARIES install-toollibLIBRARIES mostlyclean-compile \ +distclean-compile clean-compile maintainer-clean-compile \ +mostlyclean-libtool distclean-libtool clean-libtool \ +maintainer-clean-libtool mostlyclean-toollibLTLIBRARIES \ +distclean-toollibLTLIBRARIES clean-toollibLTLIBRARIES \ +maintainer-clean-toollibLTLIBRARIES uninstall-toollibLTLIBRARIES \ +install-toollibLTLIBRARIES install-data-recursive \ +uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-info-am \ +install-info install-exec-am install-exec install-data-local \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# objects listed later in LIBPTHREAD_OBJLISTS will override those listed earlier +@USE_LIBTOOL_TRUE@extra-libtool-objlist: $(MACHINE_OBJLIST) +@USE_LIBTOOL_TRUE@ cat $(MACHINE_OBJLIST) | $(AWK) '{ libpthread[$$1] = $$2 }; END { for (x in libpthread) printf ("%s\n", libpthread[x]) }' > $@ + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done + +doc: + +install-data-local: install-toollibLIBRARIES + -rm -f $(DESTDIR)$(toollibdir)/libthread_db.so.1 + ln -s $(DESTDIR)$(toollibdir)/libthread_db.so $(DESTDIR)$(toollibdir)/libthread_db.so.1 || cp $(DESTDIR)$(toollibdir)/libthread_db.so $(DESTDIR)$(toollibdir)/libthread_db.so.1 + +pt-initfini.s: $(srcdir)/pt-initfini.c + $(CC) -S $(CFLAGS_pt_initfini) -finhibit-size-directive \ + $(patsubst -f%,-fno-%,$(exceptions)) -o $@ + +# We only have one kind of startup code files. Static binaries and +# shared libraries are build using the PIC version. +crti.S: pt-initfini.s + sed -n -e '1,/@HEADER_ENDS/p' \ + -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \ + -e '/@TRAILER_BEGINS/,$$p' $< > $@ + +defs.h: pt-initfini.s + sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \ + $(AWK) -f defs.awk > $@ + +crti.o: crti.S defs.h + $(CC) -g0 $(ASFLAGS) -o $@ + +mutex.$(oext): $(srcdir)/mutex.c + $(LIB_COMPILE) $(CFLAGS_noweak) -c $< -o $@ + +specific.$(oext): $(srcdir)/specific.c + $(LIB_COMPILE) $(CFLAGS_noweak) -c $< -o $@ + +pthread.$(oext): $(srcdir)/pthread.c + $(LIB_COMPILE) $(CFLAGS_pthread) -c $< -o $@ + +ptfork.$(oext): $(srcdir)/ptfork.c + $(LIB_COMPILE) $(CFLAGS_noweak) -c $< -o $@ + +cancel.$(oext): $(srcdir)/cancel.c + $(LIB_COMPILE) $(CFLAGS_cancel) -c $< -o $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/libc/sys/linux/linuxthreads/aclocal.m4 b/newlib/libc/sys/linux/linuxthreads/aclocal.m4 new file mode 100644 index 000000000..98bba1a0b --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/aclocal.m4 @@ -0,0 +1,1191 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl This provides configure definitions used by all the newlib +dnl configure.in files. + +dnl Basic newlib configury. This calls basic introductory stuff, +dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs +dnl configure.host. The only argument is the relative path to the top +dnl newlib directory. + +AC_DEFUN(NEWLIB_CONFIGURE, +[ +dnl Default to --enable-multilib +AC_ARG_ENABLE(multilib, +[ --enable-multilib build many library versions (default)], +[case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; + esac], [multilib=yes])dnl + +dnl Support --enable-target-optspace +AC_ARG_ENABLE(target-optspace, +[ --enable-target-optspace optimize for space], +[case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;; + esac], [target_optspace=])dnl + +dnl Support --enable-malloc-debugging - currently only supported for Cygwin +AC_ARG_ENABLE(malloc-debugging, +[ --enable-malloc-debugging indicate malloc debugging requested], +[case "${enableval}" in + yes) malloc_debugging=yes ;; + no) malloc_debugging=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;; + esac], [malloc_debugging=])dnl + +dnl Support --enable-newlib-mb +AC_ARG_ENABLE(newlib-mb, +[ --enable-newlib-mb enable multibyte support], +[case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;; + esac], [newlib_mb=])dnl + +dnl Support --enable-newlib-multithread +AC_ARG_ENABLE(newlib-multithread, +[ --enable-newlib-multithread enable support for multiple threads], +[case "${enableval}" in + yes) newlib_multithread=yes ;; + no) newlib_multithread=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; + esac], [newlib_multithread=yes])dnl + +dnl Support --enable-newlib-elix-level +AC_ARG_ENABLE(newlib-elix-level, +[ --enable-newlib-elix-level supply desired elix library level (1-4)], +[case "${enableval}" in + 0) newlib_elix_level=0 ;; + 1) newlib_elix_level=1 ;; + 2) newlib_elix_level=2 ;; + 3) newlib_elix_level=3 ;; + 4) newlib_elix_level=4 ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;; + esac], [newlib_elix_level=0])dnl + +dnl Support --disable-newlib-io-float +AC_ARG_ENABLE(newlib-io-float, +[ --disable-newlib-io-float disable printf/scanf family float support], +[case "${enableval}" in + yes) newlib_io_float=yes ;; + no) newlib_io_float=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; + esac], [newlib_io_float=yes])dnl + +dnl Support --disable-newlib-supplied-syscalls +AC_ARG_ENABLE(newlib-supplied-syscalls, +[ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls], +[case "${enableval}" in + yes) newlib_may_supply_syscalls=yes ;; + no) newlib_may_supply_syscalls=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;; + esac], [newlib_may_supply_syscalls=yes])dnl + +AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes) + +dnl We may get other options which we don't document: +dnl --with-target-subdir, --with-multisrctop, --with-multisubdir + +test -z "[$]{with_target_subdir}" && with_target_subdir=. + +if test "[$]{srcdir}" = "."; then + if test "[$]{with_target_subdir}" != "."; then + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" + else + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" + fi +else + newlib_basedir="[$]{srcdir}/$1" +fi +AC_SUBST(newlib_basedir) + +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(newlib, 1.11.0) + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +AC_CHECK_TOOL(AS, as) +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) + +AC_PROG_INSTALL + +AM_MAINTAINER_MODE + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + AC_EXEEXT +fi + +. [$]{newlib_basedir}/configure.host + +newlib_cflags="[$]{newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} +AC_SUBST(NEWLIB_CFLAGS) + +LDFLAGS=${ldflags} +AC_SUBST(LDFLAGS) + +AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) +AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) +AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) +AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) +AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) + +AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) + +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we +# use oext, which is set in configure.host based on the target platform. +OBJEXT=${oext} + +AC_SUBST(OBJEXT) +AC_SUBST(oext) +AC_SUBST(aext) + +AC_SUBST(libm_machine_dir) +AC_SUBST(machine_dir) +AC_SUBST(sys_dir) +]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + + +# serial 46 AC_PROG_LIBTOOL +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])])])])])]) + +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +AC_ARG_WITH(pic, + [ --with-pic try to use only PIC/non-PIC objects [default=use both]], + pic_mode="$withval", pic_mode=default) +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + re_direlt=['/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + case $host_cpu in + hppa*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + ia64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + esac + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] + else + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'] + fi + ;; + +newsos6) + [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +[sysv5uw[78]* | sysv4*uw2*)] + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + +# AC_LIBTOOL_CXX - enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) + +AC_DEFUN([_AC_LIBTOOL_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +# AC_LIBTOOL_GCJ - enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) + +AC_DEFUN([_AC_LIBTOOL_GCJ], +[AC_REQUIRE([AC_PROG_LIBTOOL]) +AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +dnl old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + diff --git a/newlib/libc/sys/linux/linuxthreads/attr.c b/newlib/libc/sys/linux/linuxthreads/attr.c new file mode 100644 index 000000000..4b3a8f434 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/attr.c @@ -0,0 +1,308 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Handling of thread attributes */ + +#include +#include +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include + +int __pthread_attr_init_2_1(pthread_attr_t *attr) +{ + size_t ps = __getpagesize (); + + attr->__detachstate = PTHREAD_CREATE_JOINABLE; + attr->__schedpolicy = SCHED_OTHER; + attr->__schedparam.sched_priority = 0; + attr->__inheritsched = PTHREAD_EXPLICIT_SCHED; + attr->__scope = PTHREAD_SCOPE_SYSTEM; + attr->__guardsize = ps; + attr->__stackaddr = NULL; + attr->__stackaddr_set = 0; + attr->__stacksize = STACK_SIZE - ps; + return 0; +} + +versioned_symbol (libpthread, __pthread_attr_init_2_1, pthread_attr_init, + GLIBC_2_1); + +#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1) +int __pthread_attr_init_2_0(pthread_attr_t *attr) +{ + attr->__detachstate = PTHREAD_CREATE_JOINABLE; + attr->__schedpolicy = SCHED_OTHER; + attr->__schedparam.sched_priority = 0; + attr->__inheritsched = PTHREAD_EXPLICIT_SCHED; + attr->__scope = PTHREAD_SCOPE_SYSTEM; + return 0; +} +compat_symbol (libpthread, __pthread_attr_init_2_0, pthread_attr_init, + GLIBC_2_0); +#endif + +int pthread_attr_destroy(pthread_attr_t *attr) +{ + return 0; +} + +int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) +{ + if (detachstate < PTHREAD_CREATE_JOINABLE || + detachstate > PTHREAD_CREATE_DETACHED) + return EINVAL; + attr->__detachstate = detachstate; + return 0; +} + +int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate) +{ + *detachstate = attr->__detachstate; + return 0; +} + +int pthread_attr_setschedparam(pthread_attr_t *attr, + const struct sched_param *param) +{ + int max_prio = __sched_get_priority_max(attr->__schedpolicy); + int min_prio = __sched_get_priority_min(attr->__schedpolicy); + + if (param->sched_priority < min_prio || param->sched_priority > max_prio) + return EINVAL; + memcpy (&attr->__schedparam, param, sizeof (struct sched_param)); + return 0; +} + +int pthread_attr_getschedparam(const pthread_attr_t *attr, + struct sched_param *param) +{ + memcpy (param, &attr->__schedparam, sizeof (struct sched_param)); + return 0; +} + +int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) +{ + if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR) + return EINVAL; + attr->__schedpolicy = policy; + return 0; +} + +int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy) +{ + *policy = attr->__schedpolicy; + return 0; +} + +int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit) +{ + if (inherit != PTHREAD_INHERIT_SCHED && inherit != PTHREAD_EXPLICIT_SCHED) + return EINVAL; + attr->__inheritsched = inherit; + return 0; +} + +int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit) +{ + *inherit = attr->__inheritsched; + return 0; +} + +int pthread_attr_setscope(pthread_attr_t *attr, int scope) +{ + switch (scope) { + case PTHREAD_SCOPE_SYSTEM: + attr->__scope = scope; + return 0; + case PTHREAD_SCOPE_PROCESS: + return ENOTSUP; + default: + return EINVAL; + } +} + +int pthread_attr_getscope(const pthread_attr_t *attr, int *scope) +{ + *scope = attr->__scope; + return 0; +} + +int __pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize) +{ + /* The guard size must not be larger than the stack itself */ + if (guardsize >= attr->__stacksize) return EINVAL; + + attr->__guardsize = guardsize; + + return 0; +} +weak_alias (__pthread_attr_setguardsize, pthread_attr_setguardsize) + +int __pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize) +{ + *guardsize = attr->__guardsize; + return 0; +} +weak_alias (__pthread_attr_getguardsize, pthread_attr_getguardsize) + +int __pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) +{ + attr->__stackaddr = stackaddr; + attr->__stackaddr_set = 1; + return 0; +} +weak_alias (__pthread_attr_setstackaddr, pthread_attr_setstackaddr) + +link_warning (pthread_attr_setstackaddr, + "the use of `pthread_attr_setstackaddr' is deprecated, use `pthread_attr_setstack'") + +int __pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr) +{ + /* XXX This function has a stupid definition. The standard specifies + no error value but what is if no stack address was set? We simply + return the value we have in the member. */ + *stackaddr = attr->__stackaddr; + return 0; +} +weak_alias (__pthread_attr_getstackaddr, pthread_attr_getstackaddr) + +link_warning (pthread_attr_getstackaddr, + "the use of `pthread_attr_getstackaddr' is deprecated, use `pthread_attr_getstack'") + + +int __pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) +{ +#ifdef FLOATING_STACKS + /* We have to check against the maximum allowed stack size. This is no + problem if the manager is already started and we determined it. If + this hasn't happened, we have to find the limit outself. */ + if (__pthread_max_stacksize == 0) + __pthread_init_max_stacksize (); + + if (stacksize > __pthread_max_stacksize) + return EINVAL; +#else + /* We have a fixed size limit. */ + if (stacksize > STACK_SIZE) + return EINVAL; +#endif + + /* We don't accept value smaller than PTHREAD_STACK_MIN. */ + if (stacksize < PTHREAD_STACK_MIN) + return EINVAL; + + attr->__stacksize = stacksize; + return 0; +} +weak_alias (__pthread_attr_setstacksize, pthread_attr_setstacksize) + +int __pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize) +{ + *stacksize = attr->__stacksize; + return 0; +} +weak_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize) + +int __pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, + size_t stacksize) +{ + int err; + + if ((((uintptr_t) stackaddr) + & (__alignof__ (struct _pthread_descr_struct) - 1)) != 0) + err = EINVAL; + else + err = __pthread_attr_setstacksize (attr, stacksize); + if (err == 0) + { +#ifndef _STACK_GROWS_UP + attr->__stackaddr = (char *) stackaddr + stacksize; +#else + attr->__stackaddr = stackaddr; +#endif + attr->__stackaddr_set = 1; + } + + return err; +} +weak_alias (__pthread_attr_setstack, pthread_attr_setstack) + +int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr, + size_t *stacksize) +{ + /* XXX This function has a stupid definition. The standard specifies + no error value but what is if no stack address was set? We simply + return the value we have in the member. */ +#ifndef _STACK_GROWS_UP + *stackaddr = (char *) attr->__stackaddr - attr->__stacksize; +#else + *stackaddr = attr->__stackaddr; +#endif + *stacksize = attr->__stacksize; + return 0; +} +weak_alias (__pthread_attr_getstack, pthread_attr_getstack) + +int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) +{ + pthread_handle handle = thread_handle (thread); + pthread_descr descr; + + if (handle == NULL) + return ENOENT; + + descr = handle->h_descr; + + attr->__detachstate = (descr->p_detached + ? PTHREAD_CREATE_DETACHED + : PTHREAD_CREATE_JOINABLE); + + attr->__schedpolicy = __sched_getscheduler (descr->p_pid); + if (attr->__schedpolicy == -1) + return errno; + + if (__sched_getparam (descr->p_pid, + (struct sched_param *) &attr->__schedparam) != 0) + return errno; + + attr->__inheritsched = descr->p_inheritsched; + attr->__scope = PTHREAD_SCOPE_SYSTEM; +#ifdef _STACK_GROWS_DOWN + attr->__stacksize = (char *)(descr + 1) - (char *)descr->p_guardaddr + - descr->p_guardsize; +#else + attr->__stacksize = (char *)descr->p_guardaddr - (char *)descr; +#endif + attr->__guardsize = descr->p_guardsize; + attr->__stackaddr_set = descr->p_userstack; +#ifdef NEED_SEPARATE_REGISTER_STACK + if (descr->p_userstack == 0) + attr->__stacksize *= 2; + /* XXX This is awkward. The guard pages are in the middle of the + two stacks. We must count the guard size in the stack size since + otherwise the range of the stack area cannot be computed. */ + attr->__stacksize += attr->__guardsize; +#endif +#ifndef _STACK_GROWS_UP + attr->__stackaddr = (char *)(descr + 1); +#else + attr->__stackaddr = (char *)descr; +#endif + + return 0; +} diff --git a/newlib/libc/sys/linux/linuxthreads/barrier.c b/newlib/libc/sys/linux/linuxthreads/barrier.c new file mode 100644 index 000000000..1293bad85 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/barrier.c @@ -0,0 +1,125 @@ +/* POSIX barrier implementation for LinuxThreads. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kaz Kylheku , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "queue.h" +#include "restart.h" + +int +pthread_barrier_wait(pthread_barrier_t *barrier) +{ + pthread_descr self = thread_self(); + pthread_descr temp_wake_queue, th; + int result = 0; + + __pthread_lock(&barrier->__ba_lock, self); + + /* If the required number of threads have achieved rendezvous... */ + if (barrier->__ba_present >= barrier->__ba_required - 1) + { + /* ... then this last caller shall be the serial thread */ + result = PTHREAD_BARRIER_SERIAL_THREAD; + /* Copy and clear wait queue and reset barrier. */ + temp_wake_queue = barrier->__ba_waiting; + barrier->__ba_waiting = NULL; + barrier->__ba_present = 0; + } + else + { + result = 0; + barrier->__ba_present++; + enqueue(&barrier->__ba_waiting, self); + } + + __pthread_unlock(&barrier->__ba_lock); + + if (result == 0) + { + /* Non-serial threads have to suspend */ + suspend(self); + /* We don't bother dealing with cancellation because the POSIX + spec for barriers doesn't mention that pthread_barrier_wait + is a cancellation point. */ + } + else + { + /* Serial thread wakes up all others. */ + while ((th = dequeue(&temp_wake_queue)) != NULL) + restart(th); + } + + return result; +} + +int +pthread_barrier_init(pthread_barrier_t *barrier, + const pthread_barrierattr_t *attr, + unsigned int count) +{ + if (count == 0) + return EINVAL; + + __pthread_init_lock(&barrier->__ba_lock); + barrier->__ba_required = count; + barrier->__ba_present = 0; + barrier->__ba_waiting = NULL; + return 0; +} + +int +pthread_barrier_destroy(pthread_barrier_t *barrier) +{ + if (barrier->__ba_waiting != NULL) return EBUSY; + return 0; +} + +int +pthread_barrierattr_init(pthread_barrierattr_t *attr) +{ + attr->__pshared = PTHREAD_PROCESS_PRIVATE; + return 0; +} + +int +pthread_barrierattr_destroy(pthread_barrierattr_t *attr) +{ + return 0; +} + +int +__pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, + int *pshared) +{ + *pshared = attr->__pshared; + return 0; +} + +int +pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared) +{ + if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) + return EINVAL; + + attr->__pshared = pshared; + return 0; +} diff --git a/newlib/libc/sys/linux/linuxthreads/bits/initspin.h b/newlib/libc/sys/linux/linuxthreads/bits/initspin.h new file mode 100644 index 000000000..af19d44e6 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/bits/initspin.h @@ -0,0 +1,28 @@ +/* Generic definitions for spinlock initializers. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Initial value of a spinlock. Most platforms should use zero, + unless they only implement a "test and clear" operation instead of + the usual "test and set". */ +#define __LT_SPINLOCK_INIT 0 + +/* Macros for lock initializers, using the above definition. */ +#define __LOCK_INITIALIZER { 0, __LT_SPINLOCK_INIT } +#define __ALT_LOCK_INITIALIZER { 0, __LT_SPINLOCK_INIT } +#define __ATOMIC_INITIALIZER { 0, __LT_SPINLOCK_INIT } diff --git a/newlib/libc/sys/linux/linuxthreads/bits/libc-lock.h b/newlib/libc/sys/linux/linuxthreads/bits/libc-lock.h new file mode 100644 index 000000000..2c1d16277 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/bits/libc-lock.h @@ -0,0 +1,327 @@ +/* libc-internal interface for mutex locks. LinuxThreads version. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _BITS_LIBC_LOCK_H +#define _BITS_LIBC_LOCK_H 1 + +#include + +/* Mutex type. */ +#if defined(_LIBC) || defined(_IO_MTSAFE_IO) +typedef pthread_mutex_t __libc_lock_t; +typedef struct { pthread_mutex_t mutex; } __libc_lock_recursive_t; +# ifdef __USE_UNIX98 +typedef pthread_rwlock_t __libc_rwlock_t; +# else +typedef struct __libc_rwlock_opaque__ __libc_rwlock_t; +# endif +#else +typedef struct __libc_lock_opaque__ __libc_lock_t; +typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; +typedef struct __libc_rwlock_opaque__ __libc_rwlock_t; +#endif + +/* Type for key to thread-specific data. */ +typedef pthread_key_t __libc_key_t; + +/* Define a lock variable NAME with storage class CLASS. The lock must be + initialized with __libc_lock_init before it can be used (or define it + with __libc_lock_define_initialized, below). Use `extern' for CLASS to + declare a lock defined in another module. In public structure + definitions you must use a pointer to the lock structure (i.e., NAME + begins with a `*'), because its storage size will not be known outside + of libc. */ +#define __libc_lock_define(CLASS,NAME) \ + CLASS __libc_lock_t NAME; +#define __libc_rwlock_define(CLASS,NAME) \ + CLASS __libc_rwlock_t NAME; +#define __libc_lock_define_recursive(CLASS,NAME) \ + CLASS __libc_lock_recursive_t NAME; + +/* Define an initialized lock variable NAME with storage class CLASS. + + For the C library we take a deeper look at the initializer. For + this implementation all fields are initialized to zero. Therefore + we don't initialize the variable which allows putting it into the + BSS section. (Except on PA-RISC and other odd architectures, where + initialized locks must be set to one due to the lack of normal + atomic operations.) */ + +#if __LT_SPINLOCK_INIT == 0 +# define __libc_lock_define_initialized(CLASS,NAME) \ + CLASS __libc_lock_t NAME; +#else +# define __libc_lock_define_initialized(CLASS,NAME) \ + CLASS __libc_lock_t NAME = PTHREAD_MUTEX_INITIALIZER; +#endif + +#define __libc_rwlock_define_initialized(CLASS,NAME) \ + CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER; + +/* Define an initialized recursive lock variable NAME with storage + class CLASS. */ +#define __libc_lock_define_initialized_recursive(CLASS,NAME) \ + CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER; +#define _LIBC_LOCK_RECURSIVE_INITIALIZER \ + {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP} + +/* Initialize the named lock variable, leaving it in a consistent, unlocked + state. */ +#define __libc_lock_init(NAME) \ + (__pthread_mutex_init != NULL ? __pthread_mutex_init (&(NAME), NULL) : 0); +#define __libc_rwlock_init(NAME) \ + (__pthread_rwlock_init != NULL ? __pthread_rwlock_init (&(NAME), NULL) : 0); + +/* Same as last but this time we initialize a recursive mutex. */ +#define __libc_lock_init_recursive(NAME) \ + do { \ + if (__pthread_mutex_init != NULL) \ + { \ + pthread_mutexattr_t __attr; \ + __pthread_mutexattr_init (&__attr); \ + __pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \ + __pthread_mutex_init (&(NAME).mutex, &__attr); \ + __pthread_mutexattr_destroy (&__attr); \ + } \ + } while (0); + +/* Finalize the named lock variable, which must be locked. It cannot be + used again until __libc_lock_init is called again on it. This must be + called on a lock variable before the containing storage is reused. */ +#define __libc_lock_fini(NAME) \ + (__pthread_mutex_destroy != NULL ? __pthread_mutex_destroy (&(NAME)) : 0); +#define __libc_rwlock_fini(NAME) \ + (__pthread_rwlock_destroy != NULL ? __pthread_rwlock_destroy (&(NAME)) : 0); + +/* Finalize recursive named lock. */ +#define __libc_lock_fini_recursive(NAME) __libc_lock_fini ((NAME).mutex) + +/* Lock the named lock variable. */ +#define __libc_lock_lock(NAME) \ + (__pthread_mutex_lock != NULL ? __pthread_mutex_lock (&(NAME)) : 0); +#define __libc_rwlock_rdlock(NAME) \ + (__pthread_rwlock_rdlock != NULL ? __pthread_rwlock_rdlock (&(NAME)) : 0); +#define __libc_rwlock_wrlock(NAME) \ + (__pthread_rwlock_wrlock != NULL ? __pthread_rwlock_wrlock (&(NAME)) : 0); + +/* Lock the recursive named lock variable. */ +#define __libc_lock_lock_recursive(NAME) __libc_lock_lock ((NAME).mutex) + +/* Try to lock the named lock variable. */ +#define __libc_lock_trylock(NAME) \ + (__pthread_mutex_trylock != NULL ? __pthread_mutex_trylock (&(NAME)) : 0) +#define __libc_rwlock_tryrdlock(NAME) \ + (__pthread_rwlock_tryrdlock != NULL \ + ? __pthread_rwlock_tryrdlock (&(NAME)) : 0) +#define __libc_rwlock_trywrlock(NAME) \ + (__pthread_rwlock_trywrlock != NULL \ + ? __pthread_rwlock_trywrlock (&(NAME)) : 0) + +/* Try to lock the recursive named lock variable. */ +#define __libc_lock_trylock_recursive(NAME) __libc_lock_trylock ((NAME).mutex) + +/* Unlock the named lock variable. */ +#define __libc_lock_unlock(NAME) \ + (__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (&(NAME)) : 0); +#define __libc_rwlock_unlock(NAME) \ + (__pthread_rwlock_unlock != NULL ? __pthread_rwlock_unlock (&(NAME)) : 0); + +/* Unlock the recursive named lock variable. */ +#define __libc_lock_unlock_recursive(NAME) __libc_lock_unlock ((NAME).mutex) + + +/* Define once control variable. */ +#if PTHREAD_ONCE_INIT == 0 +/* Special case for static variables where we can avoid the initialization + if it is zero. */ +# define __libc_once_define(CLASS, NAME) \ + CLASS pthread_once_t NAME +#else +# define __libc_once_define(CLASS, NAME) \ + CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT +#endif + +/* Call handler iff the first call. */ +#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ + do { \ + if (__pthread_once != NULL) \ + __pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION)); \ + else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ + INIT_FUNCTION (); \ + (ONCE_CONTROL) = !PTHREAD_ONCE_INIT; \ + } \ + } while (0) + + +/* Start critical region with cleanup. */ +#define __libc_cleanup_region_start(DOIT, FCT, ARG) \ + { struct _pthread_cleanup_buffer _buffer; \ + int _avail = (DOIT) && _pthread_cleanup_push_defer != NULL; \ + if (_avail) { \ + _pthread_cleanup_push_defer (&_buffer, (FCT), (ARG)); \ + } + +/* End critical region with cleanup. */ +#define __libc_cleanup_region_end(DOIT) \ + if (_avail) { \ + _pthread_cleanup_pop_restore (&_buffer, (DOIT)); \ + } \ + } + +/* Sometimes we have to exit the block in the middle. */ +#define __libc_cleanup_end(DOIT) \ + if (_avail) { \ + _pthread_cleanup_pop_restore (&_buffer, (DOIT)); \ + } + +/* Create thread-specific key. */ +#define __libc_key_create(KEY, DESTRUCTOR) \ + (__pthread_key_create != NULL ? __pthread_key_create (KEY, DESTRUCTOR) : 1) + +/* Get thread-specific data. */ +#define __libc_getspecific(KEY) \ + (__pthread_getspecific != NULL ? __pthread_getspecific (KEY) : NULL) + +/* Set thread-specific data. */ +#define __libc_setspecific(KEY, VALUE) \ + (__pthread_setspecific != NULL ? __pthread_setspecific (KEY, VALUE) : 0) + + +/* Register handlers to execute before and after `fork'. */ +#define __libc_atfork(PREPARE, PARENT, CHILD) \ + (__pthread_atfork != NULL ? __pthread_atfork (PREPARE, PARENT, CHILD) : 0) + +/* Functions that are used by this file and are internal to the GNU C + library. */ + +extern int __pthread_mutex_init (pthread_mutex_t *__mutex, + __const pthread_mutexattr_t *__mutex_attr); + +extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); + +extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex); + +extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); + +extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); + +extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr); + +extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); + +extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr, + int __kind); + +#ifdef __USE_UNIX98 +extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock, + __const pthread_rwlockattr_t *__attr); + +extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); +#endif + +extern int __pthread_key_create (pthread_key_t *__key, + void (*__destr_function) (void *)); + +extern int __pthread_setspecific (pthread_key_t __key, + __const void *__pointer); + +extern void *__pthread_getspecific (pthread_key_t __key); + +extern int __pthread_once (pthread_once_t *__once_control, + void (*__init_routine) (void)); + +extern int __pthread_atfork (void (*__prepare) (void), + void (*__parent) (void), + void (*__child) (void)); + + + +/* Make the pthread functions weak so that we can elide them from + single-threaded processes. */ +#ifndef __NO_WEAK_PTHREAD_ALIASES +# ifdef weak_extern +# if _LIBC +# include +# else +# define BP_SYM (sym) sym +# endif +weak_extern (BP_SYM (__pthread_mutex_init)) +weak_extern (BP_SYM (__pthread_mutex_destroy)) +weak_extern (BP_SYM (__pthread_mutex_lock)) +weak_extern (BP_SYM (__pthread_mutex_trylock)) +weak_extern (BP_SYM (__pthread_mutex_unlock)) +weak_extern (BP_SYM (__pthread_mutexattr_init)) +weak_extern (BP_SYM (__pthread_mutexattr_destroy)) +weak_extern (BP_SYM (__pthread_mutexattr_settype)) +weak_extern (BP_SYM (__pthread_rwlock_init)) +weak_extern (BP_SYM (__pthread_rwlock_destroy)) +weak_extern (BP_SYM (__pthread_rwlock_rdlock)) +weak_extern (BP_SYM (__pthread_rwlock_tryrdlock)) +weak_extern (BP_SYM (__pthread_rwlock_wrlock)) +weak_extern (BP_SYM (__pthread_rwlock_trywrlock)) +weak_extern (BP_SYM (__pthread_rwlock_unlock)) +weak_extern (BP_SYM (__pthread_key_create)) +weak_extern (BP_SYM (__pthread_setspecific)) +weak_extern (BP_SYM (__pthread_getspecific)) +weak_extern (BP_SYM (__pthread_once)) +weak_extern (__pthread_initialize) +weak_extern (__pthread_atfork) +weak_extern (BP_SYM (_pthread_cleanup_push_defer)) +weak_extern (BP_SYM (_pthread_cleanup_pop_restore)) +# else +# pragma weak __pthread_mutex_init +# pragma weak __pthread_mutex_destroy +# pragma weak __pthread_mutex_lock +# pragma weak __pthread_mutex_trylock +# pragma weak __pthread_mutex_unlock +# pragma weak __pthread_mutexattr_init +# pragma weak __pthread_mutexattr_destroy +# pragma weak __pthread_mutexattr_settype +# pragma weak __pthread_rwlock_destroy +# pragma weak __pthread_rwlock_rdlock +# pragma weak __pthread_rwlock_tryrdlock +# pragma weak __pthread_rwlock_wrlock +# pragma weak __pthread_rwlock_trywrlock +# pragma weak __pthread_rwlock_unlock +# pragma weak __pthread_key_create +# pragma weak __pthread_setspecific +# pragma weak __pthread_getspecific +# pragma weak __pthread_once +# pragma weak __pthread_initialize +# pragma weak __pthread_atfork +# pragma weak _pthread_cleanup_push_defer +# pragma weak _pthread_cleanup_pop_restore +# endif +#endif + +/* We need portable names for some functions. E.g., when they are + used as argument to __libc_cleanup_region_start. */ +#define __libc_mutex_unlock __pthread_mutex_unlock + +#endif /* bits/libc-lock.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/bits/libc-tsd.h b/newlib/libc/sys/linux/linuxthreads/bits/libc-tsd.h new file mode 100644 index 000000000..7a532ea74 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/bits/libc-tsd.h @@ -0,0 +1,44 @@ +/* libc-internal interface for thread-specific data. LinuxThreads version. + Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _BITS_LIBC_TSD_H +#define _BITS_LIBC_TSD_H 1 + + +/* Fast thread-specific data internal to libc. */ +enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0, + _LIBC_TSD_KEY_DL_ERROR, + _LIBC_TSD_KEY_RPC_VARS, + _LIBC_TSD_KEY_N }; + +extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW; +extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t, + __const void *) __THROW; + +#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data; +#define __libc_tsd_get(KEY) \ + (__libc_internal_tsd_get != NULL \ + ? __libc_internal_tsd_get (_LIBC_TSD_KEY_##KEY) \ + : __libc_tsd_##KEY##_data) +#define __libc_tsd_set(KEY, VALUE) \ + (__libc_internal_tsd_set != NULL \ + ? __libc_internal_tsd_set (_LIBC_TSD_KEY_##KEY, (VALUE)) \ + : ((__libc_tsd_##KEY##_data = (VALUE)), 0)) + +#endif /* bits/libc-tsd.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/bits/local_lim.h b/newlib/libc/sys/linux/linuxthreads/bits/local_lim.h new file mode 100644 index 000000000..0a7c83706 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/bits/local_lim.h @@ -0,0 +1,77 @@ +/* Minimum guaranteed maximum values for system limits. Linux version. + Copyright (C) 1993, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* The kernel header pollutes the namespace with the NR_OPEN symbol + and defines LINK_MAX although filesystems have different maxima. A + similar thing is true for OPEN_MAX: the limit can be changed at + runtime and therefore the macro must not be defined. Remove this + after including the header if necessary. */ +#ifndef NR_OPEN +# define __undef_NR_OPEN +#endif +#ifndef LINK_MAX +# define __undef_LINK_MAX +#endif +#ifndef OPEN_MAX +# define __undef_OPEN_MAX +#endif + +/* The kernel sources contain a file with all the needed information. */ +#include + +/* Have to remove NR_OPEN? */ +#ifdef __undef_NR_OPEN +# undef NR_OPEN +# undef __undef_NR_OPEN +#endif +/* Have to remove LINK_MAX? */ +#ifdef __undef_LINK_MAX +# undef LINK_MAX +# undef __undef_LINK_MAX +#endif +/* Have to remove OPEN_MAX? */ +#ifdef __undef_OPEN_MAX +# undef OPEN_MAX +# undef __undef_OPEN_MAX +#endif + +/* The number of data keys per process. */ +#define _POSIX_THREAD_KEYS_MAX 128 +/* This is the value this implementation supports. */ +#define PTHREAD_KEYS_MAX 1024 + +/* Controlling the iterations of destructors for thread-specific data. */ +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +/* Number of iterations this implementation does. */ +#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS + +/* The number of threads per process. */ +#define _POSIX_THREAD_THREADS_MAX 64 +/* This is the value this implementation supports. */ +#define PTHREAD_THREADS_MAX 1024 + +/* Maximum amount by which a process can descrease its asynchronous I/O + priority level. */ +#define AIO_PRIO_DELTA_MAX 20 + +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 16384 + +/* Maximum number of POSIX timers available. */ +#define TIMER_MAX 256 diff --git a/newlib/libc/sys/linux/linuxthreads/bits/posix_opt.h b/newlib/libc/sys/linux/linuxthreads/bits/posix_opt.h new file mode 100644 index 000000000..54640bb56 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/bits/posix_opt.h @@ -0,0 +1,141 @@ +/* Define POSIX options for Linux. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _POSIX_OPT_H +#define _POSIX_OPT_H 1 + +/* Job control is supported. */ +#define _POSIX_JOB_CONTROL 1 + +/* Processes have a saved set-user-ID and a saved set-group-ID. */ +#define _POSIX_SAVED_IDS 1 + +/* Priority scheduling is supported. */ +#define _POSIX_PRIORITY_SCHEDULING 1 + +/* Synchronizing file data is supported. */ +#define _POSIX_SYNCHRONIZED_IO 1 + +/* The fsync function is present. */ +#define _POSIX_FSYNC 1 + +/* Mapping of files to memory is supported. */ +#define _POSIX_MAPPED_FILES 1 + +/* Locking of all memory is supported. */ +#define _POSIX_MEMLOCK 1 + +/* Locking of ranges of memory is supported. */ +#define _POSIX_MEMLOCK_RANGE 1 + +/* Setting of memory protections is supported. */ +#define _POSIX_MEMORY_PROTECTION 1 + +/* Implementation supports `poll' function. */ +#define _POSIX_POLL 1 + +/* Implementation supports `select' and `pselect' functions. */ +#define _POSIX_SELECT 1 + +/* Only root can change owner of file. */ +#define _POSIX_CHOWN_RESTRICTED 1 + +/* `c_cc' member of 'struct termios' structure can be disabled by + using the value _POSIX_VDISABLE. */ +#define _POSIX_VDISABLE '\0' + +/* Filenames are not silently truncated. */ +#define _POSIX_NO_TRUNC 1 + +/* X/Open realtime support is available. */ +#define _XOPEN_REALTIME 1 + +/* X/Open realtime thread support is available. */ +#define _XOPEN_REALTIME_THREADS 1 + +/* XPG4.2 shared memory is supported. */ +#define _XOPEN_SHM 1 + +/* Tell we have POSIX threads. */ +#define _POSIX_THREADS 1 + +/* We have the reentrant functions described in POSIX. */ +#define _POSIX_REENTRANT_FUNCTIONS 1 +#define _POSIX_THREAD_SAFE_FUNCTIONS 1 + +/* We provide priority scheduling for threads. */ +#define _POSIX_THREAD_PRIORITY_SCHEDULING 1 + +/* We support user-defined stack sizes. */ +#define _POSIX_THREAD_ATTR_STACKSIZE 1 + +/* We support user-defined stacks. */ +#define _POSIX_THREAD_ATTR_STACKADDR 1 + +/* We support POSIX.1b semaphores, but only the non-shared form for now. */ +#define _POSIX_SEMAPHORES 1 + +/* Real-time signals are supported. */ +#define _POSIX_REALTIME_SIGNALS 1 + +/* We support asynchronous I/O. */ +#define _POSIX_ASYNCHRONOUS_IO 1 +#define _POSIX_ASYNC_IO 1 +/* Alternative name for Unix98. */ +#define _LFS_ASYNCHRONOUS_IO 1 + +/* The LFS support in asynchronous I/O is also available. */ +#define _LFS64_ASYNCHRONOUS_IO 1 + +/* The rest of the LFS is also available. */ +#define _LFS_LARGEFILE 1 +#define _LFS64_LARGEFILE 1 +#define _LFS64_STDIO 1 + +/* POSIX shared memory objects are implemented. */ +#define _POSIX_SHARED_MEMORY_OBJECTS 1 + +/* GNU libc provides regular expression handling. */ +#define _POSIX_REGEXP 1 + +/* Reader/Writer locks are available. */ +#define _POSIX_READER_WRITER_LOCKS 200912L + +/* We have a POSIX shell. */ +#define _POSIX_SHELL 1 + +/* We support the Timeouts option. */ +#define _POSIX_TIMEOUTS 200912L + +/* We support spinlocks. */ +#define _POSIX_SPIN_LOCKS 200912L + +/* The `spawn' function family is supported. */ +#define _POSIX_SPAWN 200912L + +/* We have POSIX timers. */ +#define _POSIX_TIMERS 1 + +/* The barrier functions are available. */ +#define _POSIX_BARRIERS 200912L + +/* POSIX message queues are not yet supported. */ +#undef _POSIX_MESSAGE_PASSING + +#endif /* posix_opt.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/bits/pthreadtypes.h b/newlib/libc/sys/linux/linuxthreads/bits/pthreadtypes.h new file mode 100644 index 000000000..3ee5c4813 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/bits/pthreadtypes.h @@ -0,0 +1,142 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +#if !defined _BITS_TYPES_H && !defined _PTHREAD_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_PTHREADTYPES_H +#define _BITS_PTHREADTYPES_H 1 + +#define __need_schedparam +#include + +/* Fast locks (not abstract because mutexes and conditions aren't abstract). */ +struct _pthread_fastlock +{ + long int __status; /* "Free" or "taken" or head of waiting list */ + int __spinlock; /* Used by compare_and_swap emulation. Also, + adaptive SMP lock stores spin count here. */ +}; + +#ifndef _PTHREAD_DESCR_DEFINED +/* Thread descriptors */ +typedef struct _pthread_descr_struct *_pthread_descr; +# define _PTHREAD_DESCR_DEFINED +#endif + + +/* Attributes for threads. */ +typedef struct __pthread_attr_s +{ + int __detachstate; + int __schedpolicy; + struct __sched_param __schedparam; + int __inheritsched; + int __scope; + size_t __guardsize; + int __stackaddr_set; + void *__stackaddr; + size_t __stacksize; +} pthread_attr_t; + + +/* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */ +typedef struct +{ + struct _pthread_fastlock __c_lock; /* Protect against concurrent access */ + _pthread_descr __c_waiting; /* Threads waiting on this condition */ +} pthread_cond_t; + + +/* Attribute for conditionally variables. */ +typedef struct +{ + int __dummy; +} pthread_condattr_t; + +/* Keys for thread-specific data */ +typedef unsigned int pthread_key_t; + + +/* Mutexes (not abstract because of PTHREAD_MUTEX_INITIALIZER). */ +/* (The layout is unnatural to maintain binary compatibility + with earlier releases of LinuxThreads.) */ +typedef struct +{ + int __m_reserved; /* Reserved for future use */ + int __m_count; /* Depth of recursive locking */ + _pthread_descr __m_owner; /* Owner thread (if recursive or errcheck) */ + int __m_kind; /* Mutex kind: fast, recursive or errcheck */ + struct _pthread_fastlock __m_lock; /* Underlying fast lock */ +} pthread_mutex_t; + + +/* Attribute for mutex. */ +typedef struct +{ + int __mutexkind; +} pthread_mutexattr_t; + + +/* Once-only execution */ +typedef int pthread_once_t; + + +#ifdef __USE_UNIX98 +/* Read-write locks. */ +typedef struct _pthread_rwlock_t +{ + struct _pthread_fastlock __rw_lock; /* Lock to guarantee mutual exclusion */ + int __rw_readers; /* Number of readers */ + _pthread_descr __rw_writer; /* Identity of writer, or NULL if none */ + _pthread_descr __rw_read_waiting; /* Threads waiting for reading */ + _pthread_descr __rw_write_waiting; /* Threads waiting for writing */ + int __rw_kind; /* Reader/Writer preference selection */ + int __rw_pshared; /* Shared between processes or not */ +} pthread_rwlock_t; + + +/* Attribute for read-write locks. */ +typedef struct +{ + int __lockkind; + int __pshared; +} pthread_rwlockattr_t; +#endif + +#ifdef __USE_XOPEN2K +/* POSIX spinlock data type. */ +typedef volatile int pthread_spinlock_t; + +/* POSIX barrier. */ +typedef struct { + struct _pthread_fastlock __ba_lock; /* Lock to guarantee mutual exclusion */ + int __ba_required; /* Threads needed for completion */ + int __ba_present; /* Threads waiting */ + _pthread_descr __ba_waiting; /* Queue of waiting threads */ +} pthread_barrier_t; + +/* barrier attribute */ +typedef struct { + int __pshared; +} pthread_barrierattr_t; + +#endif + + +/* Thread identifiers */ +typedef unsigned long int pthread_t; + +#endif /* bits/pthreadtypes.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/bits/sigthread.h b/newlib/libc/sys/linux/linuxthreads/bits/sigthread.h new file mode 100644 index 000000000..1c62d8196 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/bits/sigthread.h @@ -0,0 +1,38 @@ +/* Signal handling function for threaded programs. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _BITS_SIGTHREAD_H +#define _BITS_SIGTHREAD_H 1 + +#if !defined _SIGNAL_H && !defined _PTHREAD_H +# error "Never include this file directly. Use instead" +#endif + +/* Functions for handling signals. */ + +/* Modify the signal mask for the calling thread. The arguments have + the same meaning as for sigprocmask(2). */ +extern int pthread_sigmask (int __how, + __const sigset_t *__restrict __newmask, + sigset_t *__restrict __oldmask)__THROW; + +/* Send signal SIGNO to the given thread. */ +extern int pthread_kill (pthread_t __thread1, int __signo) __THROW; + +#endif /* bits/sigthread.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/bp-sym.h b/newlib/libc/sys/linux/linuxthreads/bp-sym.h new file mode 100644 index 000000000..1aeb2364e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/bp-sym.h @@ -0,0 +1,26 @@ +/* Bounded-pointer symbol modifier. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Greg McGary + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define BP_SYM(name) _BP_SYM (name) +#if __BOUNDED_POINTERS__ +# define _BP_SYM(name) __BP_##name +#else +# define _BP_SYM(name) name +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/cancel.c b/newlib/libc/sys/linux/linuxthreads/cancel.c new file mode 100644 index 000000000..0fd6cd094 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/cancel.c @@ -0,0 +1,220 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Thread cancellation */ + +#include +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "restart.h" + +#ifdef _STACK_GROWS_DOWN +# define FRAME_LEFT(frame, other) ((char *) frame >= (char *) other) +#elif _STACK_GROWS_UP +# define FRAME_LEFT(frame, other) ((char *) frame <= (char *) other) +#else +# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP" +#endif + + +int pthread_setcancelstate(int state, int * oldstate) +{ + pthread_descr self = thread_self(); + if (state < PTHREAD_CANCEL_ENABLE || state > PTHREAD_CANCEL_DISABLE) + return EINVAL; + if (oldstate != NULL) *oldstate = THREAD_GETMEM(self, p_cancelstate); + THREAD_SETMEM(self, p_cancelstate, state); + if (THREAD_GETMEM(self, p_canceled) && + THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE && + THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS) + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + return 0; +} + +int pthread_setcanceltype(int type, int * oldtype) +{ + pthread_descr self = thread_self(); + if (type < PTHREAD_CANCEL_DEFERRED || type > PTHREAD_CANCEL_ASYNCHRONOUS) + return EINVAL; + if (oldtype != NULL) *oldtype = THREAD_GETMEM(self, p_canceltype); + THREAD_SETMEM(self, p_canceltype, type); + if (THREAD_GETMEM(self, p_canceled) && + THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE && + THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS) + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + return 0; +} + +int pthread_cancel(pthread_t thread) +{ + pthread_handle handle = thread_handle(thread); + int pid; + int dorestart = 0; + pthread_descr th; + pthread_extricate_if *pextricate; + int already_canceled; + + __pthread_lock(&handle->h_lock, NULL); + if (invalid_handle(handle, thread)) { + __pthread_unlock(&handle->h_lock); + return ESRCH; + } + + th = handle->h_descr; + + already_canceled = th->p_canceled; + th->p_canceled = 1; + + if (th->p_cancelstate == PTHREAD_CANCEL_DISABLE || already_canceled) { + __pthread_unlock(&handle->h_lock); + return 0; + } + + pextricate = th->p_extricate; + pid = th->p_pid; + + /* If the thread has registered an extrication interface, then + invoke the interface. If it returns 1, then we succeeded in + dequeuing the thread from whatever waiting object it was enqueued + with. In that case, it is our responsibility to wake it up. + And also to set the p_woken_by_cancel flag so the woken thread + can tell that it was woken by cancellation. */ + + if (pextricate != NULL) { + dorestart = pextricate->pu_extricate_func(pextricate->pu_object, th); + th->p_woken_by_cancel = dorestart; + } + + __pthread_unlock(&handle->h_lock); + + /* If the thread has suspended or is about to, then we unblock it by + issuing a restart, instead of a cancel signal. Otherwise we send + the cancel signal to unblock the thread from a cancellation point, + or to initiate asynchronous cancellation. The restart is needed so + we have proper accounting of restarts; suspend decrements the thread's + resume count, and restart() increments it. This also means that suspend's + handling of the cancel signal is obsolete. */ + + if (dorestart) + restart(th); + else + kill(pid, __pthread_sig_cancel); + + return 0; +} + +void pthread_testcancel(void) +{ + pthread_descr self = thread_self(); + if (THREAD_GETMEM(self, p_canceled) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); +} + +void _pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer, + void (*routine)(void *), void * arg) +{ + pthread_descr self = thread_self(); + buffer->__routine = routine; + buffer->__arg = arg; + buffer->__prev = THREAD_GETMEM(self, p_cleanup); + if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev)) + buffer->__prev = NULL; + THREAD_SETMEM(self, p_cleanup, buffer); +} + +void _pthread_cleanup_pop(struct _pthread_cleanup_buffer * buffer, + int execute) +{ + pthread_descr self = thread_self(); + if (execute) buffer->__routine(buffer->__arg); + THREAD_SETMEM(self, p_cleanup, buffer->__prev); +} + +void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer, + void (*routine)(void *), void * arg) +{ + pthread_descr self = thread_self(); + buffer->__routine = routine; + buffer->__arg = arg; + buffer->__canceltype = THREAD_GETMEM(self, p_canceltype); + buffer->__prev = THREAD_GETMEM(self, p_cleanup); + if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev)) + buffer->__prev = NULL; + THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED); + THREAD_SETMEM(self, p_cleanup, buffer); +} + +void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer, + int execute) +{ + pthread_descr self = thread_self(); + if (execute) buffer->__routine(buffer->__arg); + THREAD_SETMEM(self, p_cleanup, buffer->__prev); + THREAD_SETMEM(self, p_canceltype, buffer->__canceltype); + if (THREAD_GETMEM(self, p_canceled) && + THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE && + THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS) + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); +} + +void __pthread_perform_cleanup(char *currentframe) +{ + pthread_descr self = thread_self(); + struct _pthread_cleanup_buffer *c = THREAD_GETMEM(self, p_cleanup); + struct _pthread_cleanup_buffer *last; + + if (c != NULL) + while (FRAME_LEFT (currentframe, c)) + { + last = c; + c = c->__prev; + + if (c == NULL || FRAME_LEFT (last, c)) + { + c = NULL; + break; + } + } + + while (c != NULL) + { + c->__routine(c->__arg); + + last = c; + c = c->__prev; + + if (FRAME_LEFT (last, c)) + break; + } + +#if 0 + /* And the TSD which needs special help. */ + if (THREAD_GETMEM(self, p_libc_specific[_LIBC_TSD_KEY_RPC_VARS]) != NULL) + __rpc_thread_destroy (); +#endif +} + +#ifndef SHARED +/* We need a hook to force the cancelation wrappers and file locking + to be linked in when static libpthread is used. */ +extern const int __pthread_provide_wrappers; +static const int *const __pthread_require_wrappers = + &__pthread_provide_wrappers; +extern const int __pthread_provide_lockfile; +static const int *const __pthread_require_lockfile = + &__pthread_provide_lockfile; +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/condvar.c b/newlib/libc/sys/linux/linuxthreads/condvar.c new file mode 100644 index 000000000..a06211f58 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/condvar.c @@ -0,0 +1,301 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* and Pavel Krauz (krauz@fsid.cvut.cz). */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Condition variables */ + +#include +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "queue.h" +#include "restart.h" + +int pthread_cond_init(pthread_cond_t *cond, + const pthread_condattr_t *cond_attr) +{ + __pthread_init_lock(&cond->__c_lock); + cond->__c_waiting = NULL; + return 0; +} + +int pthread_cond_destroy(pthread_cond_t *cond) +{ + if (cond->__c_waiting != NULL) return EBUSY; + return 0; +} + +/* Function called by pthread_cancel to remove the thread from + waiting on a condition variable queue. */ + +static int cond_extricate_func(void *obj, pthread_descr th) +{ + volatile pthread_descr self = thread_self(); + pthread_cond_t *cond = obj; + int did_remove = 0; + + __pthread_lock(&cond->__c_lock, self); + did_remove = remove_from_queue(&cond->__c_waiting, th); + __pthread_unlock(&cond->__c_lock); + + return did_remove; +} + +int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) +{ + volatile pthread_descr self = thread_self(); + pthread_extricate_if extr; + int already_canceled = 0; + int spurious_wakeup_count; + + /* Check whether the mutex is locked and owned by this thread. */ + if (mutex->__m_kind != PTHREAD_MUTEX_TIMED_NP + && mutex->__m_kind != PTHREAD_MUTEX_ADAPTIVE_NP + && mutex->__m_owner != self) + return EINVAL; + + /* Set up extrication interface */ + extr.pu_object = cond; + extr.pu_extricate_func = cond_extricate_func; + + /* Register extrication interface */ + THREAD_SETMEM(self, p_condvar_avail, 0); + __pthread_set_own_extricate_if(self, &extr); + + /* Atomically enqueue thread for waiting, but only if it is not + canceled. If the thread is canceled, then it will fall through the + suspend call below, and then call pthread_exit without + having to worry about whether it is still on the condition variable queue. + This depends on pthread_cancel setting p_canceled before calling the + extricate function. */ + + __pthread_lock(&cond->__c_lock, self); + if (!(THREAD_GETMEM(self, p_canceled) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)) + enqueue(&cond->__c_waiting, self); + else + already_canceled = 1; + __pthread_unlock(&cond->__c_lock); + + if (already_canceled) { + __pthread_set_own_extricate_if(self, 0); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + + pthread_mutex_unlock(mutex); + + spurious_wakeup_count = 0; + while (1) + { + suspend(self); + if (THREAD_GETMEM(self, p_condvar_avail) == 0 + && (THREAD_GETMEM(self, p_woken_by_cancel) == 0 + || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE)) + { + /* Count resumes that don't belong to us. */ + spurious_wakeup_count++; + continue; + } + break; + } + + __pthread_set_own_extricate_if(self, 0); + + /* Check for cancellation again, to provide correct cancellation + point behavior */ + + if (THREAD_GETMEM(self, p_woken_by_cancel) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) { + THREAD_SETMEM(self, p_woken_by_cancel, 0); + pthread_mutex_lock(mutex); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + + /* Put back any resumes we caught that don't belong to us. */ + while (spurious_wakeup_count--) + restart(self); + + pthread_mutex_lock(mutex); + return 0; +} + +static int +pthread_cond_timedwait_relative(pthread_cond_t *cond, + pthread_mutex_t *mutex, + const struct timespec * abstime) +{ + volatile pthread_descr self = thread_self(); + int already_canceled = 0; + pthread_extricate_if extr; + int spurious_wakeup_count; + + /* Check whether the mutex is locked and owned by this thread. */ + if (mutex->__m_kind != PTHREAD_MUTEX_TIMED_NP + && mutex->__m_kind != PTHREAD_MUTEX_ADAPTIVE_NP + && mutex->__m_owner != self) + return EINVAL; + + /* Set up extrication interface */ + extr.pu_object = cond; + extr.pu_extricate_func = cond_extricate_func; + + /* Register extrication interface */ + THREAD_SETMEM(self, p_condvar_avail, 0); + __pthread_set_own_extricate_if(self, &extr); + + /* Enqueue to wait on the condition and check for cancellation. */ + __pthread_lock(&cond->__c_lock, self); + if (!(THREAD_GETMEM(self, p_canceled) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)) + enqueue(&cond->__c_waiting, self); + else + already_canceled = 1; + __pthread_unlock(&cond->__c_lock); + + if (already_canceled) { + __pthread_set_own_extricate_if(self, 0); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + + pthread_mutex_unlock(mutex); + + spurious_wakeup_count = 0; + while (1) + { + if (!timedsuspend(self, abstime)) { + int was_on_queue; + + /* __pthread_lock will queue back any spurious restarts that + may happen to it. */ + + __pthread_lock(&cond->__c_lock, self); + was_on_queue = remove_from_queue(&cond->__c_waiting, self); + __pthread_unlock(&cond->__c_lock); + + if (was_on_queue) { + __pthread_set_own_extricate_if(self, 0); + pthread_mutex_lock(mutex); + return ETIMEDOUT; + } + + /* Eat the outstanding restart() from the signaller */ + suspend(self); + } + + if (THREAD_GETMEM(self, p_condvar_avail) == 0 + && (THREAD_GETMEM(self, p_woken_by_cancel) == 0 + || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE)) + { + /* Count resumes that don't belong to us. */ + spurious_wakeup_count++; + continue; + } + break; + } + + __pthread_set_own_extricate_if(self, 0); + + /* The remaining logic is the same as in other cancellable waits, + such as pthread_join sem_wait or pthread_cond wait. */ + + if (THREAD_GETMEM(self, p_woken_by_cancel) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) { + THREAD_SETMEM(self, p_woken_by_cancel, 0); + pthread_mutex_lock(mutex); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + + /* Put back any resumes we caught that don't belong to us. */ + while (spurious_wakeup_count--) + restart(self); + + pthread_mutex_lock(mutex); + return 0; +} + +int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + const struct timespec * abstime) +{ + /* Indirect call through pointer! */ + return pthread_cond_timedwait_relative(cond, mutex, abstime); +} + +int pthread_cond_signal(pthread_cond_t *cond) +{ + pthread_descr th; + + __pthread_lock(&cond->__c_lock, NULL); + th = dequeue(&cond->__c_waiting); + __pthread_unlock(&cond->__c_lock); + if (th != NULL) { + th->p_condvar_avail = 1; + WRITE_MEMORY_BARRIER(); + restart(th); + } + return 0; +} + +int pthread_cond_broadcast(pthread_cond_t *cond) +{ + pthread_descr tosignal, th; + + __pthread_lock(&cond->__c_lock, NULL); + /* Copy the current state of the waiting queue and empty it */ + tosignal = cond->__c_waiting; + cond->__c_waiting = NULL; + __pthread_unlock(&cond->__c_lock); + /* Now signal each process in the queue */ + while ((th = dequeue(&tosignal)) != NULL) { + th->p_condvar_avail = 1; + WRITE_MEMORY_BARRIER(); + restart(th); + } + return 0; +} + +int pthread_condattr_init(pthread_condattr_t *attr) +{ + return 0; +} + +int pthread_condattr_destroy(pthread_condattr_t *attr) +{ + return 0; +} + +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3 + +int pthread_condattr_getpshared (const pthread_condattr_t *attr, int *pshared) +{ + *pshared = PTHREAD_PROCESS_PRIVATE; + return 0; +} + +int pthread_condattr_setpshared (pthread_condattr_t *attr, int pshared) +{ + if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) + return EINVAL; + + /* For now it is not possible to shared a conditional variable. */ + if (pshared != PTHREAD_PROCESS_PRIVATE) + return ENOSYS; + + return 0; +} + +#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 3 */ + diff --git a/newlib/libc/sys/linux/linuxthreads/config.h b/newlib/libc/sys/linux/linuxthreads/config.h new file mode 100644 index 000000000..99b0528a6 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/config.h @@ -0,0 +1,14 @@ +#define HAVE_WEAK_SYMBOLS 1 +#define HAVE_GNU_LD 1 +#define HAVE_ELF 1 +#define __ASSUME_REALTIME_SIGNALS 1 +#define ASM_GLOBAL_DIRECTIVE .global + +#define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) + +#define UINT32_C(c) c ## U diff --git a/newlib/libc/sys/linux/linuxthreads/configure b/newlib/libc/sys/linux/linuxthreads/configure new file mode 100755 index 000000000..47404e5ea --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/configure @@ -0,0 +1,3461 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-multilib build many library versions (default)" +ac_help="$ac_help + --enable-target-optspace optimize for space" +ac_help="$ac_help + --enable-malloc-debugging indicate malloc debugging requested" +ac_help="$ac_help + --enable-newlib-mb enable multibyte support" +ac_help="$ac_help + --enable-newlib-multithread enable support for multiple threads" +ac_help="$ac_help + --enable-newlib-elix-level supply desired elix library level (1-4)" +ac_help="$ac_help + --disable-newlib-io-float disable printf/scanf family float support" +ac_help="$ac_help + --disable-newlib-supplied-syscalls disable newlib from supplying syscalls" +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --enable-shared[=PKGS] build shared libraries [default=yes]" +ac_help="$ac_help + --enable-static[=PKGS] build static libraries [default=yes]" +ac_help="$ac_help + --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" +ac_help="$ac_help + --disable-libtool-lock avoid locking (might break parallel builds)" +ac_help="$ac_help + --with-pic try to use only PIC/non-PIC objects [default=use both]" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +sitefile= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=attr.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi +else + CONFIG_SITE="$sitefile" +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in ../../../../.. $srcdir/../../../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ../../../../.. $srcdir/../../../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:600: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:653: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:710: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:743: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:776: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + +# Check whether --enable-multilib or --disable-multilib was given. +if test "${enable_multilib+set}" = set; then + enableval="$enable_multilib" + case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;; + esac +else + multilib=yes +fi + +# Check whether --enable-target-optspace or --disable-target-optspace was given. +if test "${enable_target_optspace+set}" = set; then + enableval="$enable_target_optspace" + case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;; + esac +else + target_optspace= +fi + +# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. +if test "${enable_malloc_debugging+set}" = set; then + enableval="$enable_malloc_debugging" + case "${enableval}" in + yes) malloc_debugging=yes ;; + no) malloc_debugging=no ;; + *) { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;; + esac +else + malloc_debugging= +fi + +# Check whether --enable-newlib-mb or --disable-newlib-mb was given. +if test "${enable_newlib_mb+set}" = set; then + enableval="$enable_newlib_mb" + case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;; + esac +else + newlib_mb= +fi + +# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given. +if test "${enable_newlib_multithread+set}" = set; then + enableval="$enable_newlib_multithread" + case "${enableval}" in + yes) newlib_multithread=yes ;; + no) newlib_multithread=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;; + esac +else + newlib_multithread=yes +fi + +# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given. +if test "${enable_newlib_elix_level+set}" = set; then + enableval="$enable_newlib_elix_level" + case "${enableval}" in + 0) newlib_elix_level=0 ;; + 1) newlib_elix_level=1 ;; + 2) newlib_elix_level=2 ;; + 3) newlib_elix_level=3 ;; + 4) newlib_elix_level=4 ;; + *) { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;; + esac +else + newlib_elix_level=0 +fi + +# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given. +if test "${enable_newlib_io_float+set}" = set; then + enableval="$enable_newlib_io_float" + case "${enableval}" in + yes) newlib_io_float=yes ;; + no) newlib_io_float=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;; + esac +else + newlib_io_float=yes +fi + +# Check whether --enable-newlib-supplied-syscalls or --disable-newlib-supplied-syscalls was given. +if test "${enable_newlib_supplied_syscalls+set}" = set; then + enableval="$enable_newlib_supplied_syscalls" + case "${enableval}" in + yes) newlib_may_supply_syscalls=yes ;; + no) newlib_may_supply_syscalls=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-supplied-syscalls option" 1>&2; exit 1; } ;; + esac +else + newlib_may_supply_syscalls=yes +fi + + + +if test x${newlib_may_supply_syscalls} = xyes; then + MAY_SUPPLY_SYSCALLS_TRUE= + MAY_SUPPLY_SYSCALLS_FALSE='#' +else + MAY_SUPPLY_SYSCALLS_TRUE='#' + MAY_SUPPLY_SYSCALLS_FALSE= +fi + + +test -z "${with_target_subdir}" && with_target_subdir=. + +if test "${srcdir}" = "."; then + if test "${with_target_subdir}" != "."; then + newlib_basedir="${srcdir}/${with_multisrctop}../../../../.." + else + newlib_basedir="${srcdir}/${with_multisrctop}../../../.." + fi +else + newlib_basedir="${srcdir}/../../../.." +fi + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:956: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:977: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:995: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + + +PACKAGE=newlib + +VERSION=1.11.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:1038: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:1051: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:1064: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:1077: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:1090: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1115: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1145: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1194: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1218: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1249: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1281: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1313: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1345: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1390: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1444: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + + + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1478: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + +fi + +. ${newlib_basedir}/configure.host + +newlib_cflags="${newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} + + +LDFLAGS=${ldflags} + + + + +if test x${newlib_elix_level} = x0; then + ELIX_LEVEL_0_TRUE= + ELIX_LEVEL_0_FALSE='#' +else + ELIX_LEVEL_0_TRUE='#' + ELIX_LEVEL_0_FALSE= +fi + + +if test x${newlib_elix_level} = x1; then + ELIX_LEVEL_1_TRUE= + ELIX_LEVEL_1_FALSE='#' +else + ELIX_LEVEL_1_TRUE='#' + ELIX_LEVEL_1_FALSE= +fi + + +if test x${newlib_elix_level} = x2; then + ELIX_LEVEL_2_TRUE= + ELIX_LEVEL_2_FALSE='#' +else + ELIX_LEVEL_2_TRUE='#' + ELIX_LEVEL_2_FALSE= +fi + + +if test x${newlib_elix_level} = x3; then + ELIX_LEVEL_3_TRUE= + ELIX_LEVEL_3_FALSE='#' +else + ELIX_LEVEL_3_TRUE='#' + ELIX_LEVEL_3_FALSE= +fi + + +if test x${newlib_elix_level} = x4; then + ELIX_LEVEL_4_TRUE= + ELIX_LEVEL_4_FALSE='#' +else + ELIX_LEVEL_4_TRUE='#' + ELIX_LEVEL_4_FALSE= +fi + + + +if test x${use_libtool} = xyes; then + USE_LIBTOOL_TRUE= + USE_LIBTOOL_FALSE='#' +else + USE_LIBTOOL_TRUE='#' + USE_LIBTOOL_FALSE= +fi + +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we +# use oext, which is set in configure.host based on the target platform. +OBJEXT=${oext} + + + + + + + + + + + +if test "${use_libtool}" = "yes"; then + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1664: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1694: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1745: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1777: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1788 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1819: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1824: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1852: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:1895: checking for ld used by GCC" >&5 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:1925: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:1928: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:1963: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi + +echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 +echo "configure:1980: checking for $LD option to reload object files" >&5 +if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_ld_reload_flag='-r' +fi + +echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:1992: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$ac_t""$NM" 1>&6 + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:2030: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 +echo "configure:2051: checking how to recognise dependant libraries" >&5 +if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.012) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + case $host_cpu in + hppa*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + esac + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newsos6) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac + +fi + +echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + +echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +echo "configure:2224: checking for object suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if { (eval echo configure:2230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_objext" 1>&6 +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 +echo "configure:2254: checking for ${ac_tool_prefix}file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo $ac_n "checking for file""... $ac_c" 1>&6 +echo "configure:2316: checking for file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2387: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2419: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + +# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2454: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_STRIP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2486: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="strip" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + STRIP=":" +fi +fi + + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + +libtool_flags="$libtool_flags --enable-win32-dll" +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + : +fi + +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi + +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 2553 "configure"' > conftest.$ac_ext + if { (eval echo configure:2554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo configure:2573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +echo "configure:2591: checking whether the C compiler needs -belf" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_needs_belf=no +fi +rm -f conftest* + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +fi + +echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +*-*-cygwin* | *-*-mingw* | *-*-pw32*) + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2641: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_DLLTOOL"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2673: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_DLLTOOL="dlltool" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false" +fi +fi +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + DLLTOOL="false" +fi +fi + + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2708: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_AS"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2740: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + AS="false" +fi +fi + + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2775: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_OBJDUMP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2807: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="objdump" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + OBJDUMP="false" +fi +fi + + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6 +echo "configure:2843: checking if libtool should supply DllMain function" >&5 +if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_need_dllmain=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_need_dllmain=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_need_dllmain" 1>&6 + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6 +echo "configure:2877: checking how to link DLLs" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_dll_switch=-mdll +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_dll_switch=-dll +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6 + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + +esac + + +# Save cache, so that ltconfig can load it +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } + +# Reload cache, that may have been modified by ltconfig +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log + + + + + + +for ac_prog in mawk gawk nawk awk +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3003: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AWK" && break +done + +fi + +if test -n "${machine_dir}"; then + MACHINE_OBJLIST=machine/${machine_dir}/objectlist.awk.in + MACHINE_LIB=machine/${machine_dir}/lib.a +fi + + + +subdirs="machine" + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@MAY_SUPPLY_SYSCALLS_TRUE@%$MAY_SUPPLY_SYSCALLS_TRUE%g +s%@MAY_SUPPLY_SYSCALLS_FALSE@%$MAY_SUPPLY_SYSCALLS_FALSE%g +s%@newlib_basedir@%$newlib_basedir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@RANLIB@%$RANLIB%g +s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g +s%@EXEEXT@%$EXEEXT%g +s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g +s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g +s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g +s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g +s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g +s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g +s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g +s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g +s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g +s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g +s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g +s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g +s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g +s%@OBJEXT@%$OBJEXT%g +s%@oext@%$oext%g +s%@aext@%$aext%g +s%@libm_machine_dir@%$libm_machine_dir%g +s%@machine_dir@%$machine_dir%g +s%@sys_dir@%$sys_dir%g +s%@LN_S@%$LN_S%g +s%@STRIP@%$STRIP%g +s%@DLLTOOL@%$DLLTOOL%g +s%@OBJDUMP@%$OBJDUMP%g +s%@LIBTOOL@%$LIBTOOL%g +s%@AWK@%$AWK%g +s%@MACHINE_OBJLIST@%$MACHINE_OBJLIST%g +s%@MACHINE_LIB@%$MACHINE_LIB%g +s%@subdirs@%$subdirs%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in machine; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + diff --git a/newlib/libc/sys/linux/linuxthreads/configure.in b/newlib/libc/sys/linux/linuxthreads/configure.in new file mode 100644 index 000000000..113743a87 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/configure.in @@ -0,0 +1,31 @@ +dnl This is the newlib/libc/sys/linux/linuxthreads configure.in file. +dnl Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.5) +AC_INIT(attr.c) + +dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. +AC_CONFIG_AUX_DIR(../../../../..) + +NEWLIB_CONFIGURE(../../../..) + +dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and +dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first +dnl line of the macro which fail because appropriate LDFLAGS are not set. + +if test "${use_libtool}" = "yes"; then +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL +AC_PROG_AWK +fi + +if test -n "${machine_dir}"; then + MACHINE_OBJLIST=machine/${machine_dir}/objectlist.awk.in + MACHINE_LIB=machine/${machine_dir}/lib.a +fi +AC_SUBST(MACHINE_OBJLIST) +AC_SUBST(MACHINE_LIB) + +AC_CONFIG_SUBDIRS(machine) + +AC_OUTPUT(Makefile) diff --git a/newlib/libc/sys/linux/linuxthreads/defs.awk b/newlib/libc/sys/linux/linuxthreads/defs.awk new file mode 100644 index 000000000..7ca5a3364 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/defs.awk @@ -0,0 +1,27 @@ +/^[ ]*\.endp/ { need_endp = 1 } +/^[ ]*\.end/ { need_end = 1 } +/^[ ]*\.align/ { if($2 > max) max = $2; } + +END { + if(need_endp) + { + print "#define END_INIT .endp _init"; + print "#define END_FINI .endp _fini"; + } else if(need_end) + { + print "#define END_INIT .end _init"; + print "#define END_FINI .end _fini"; + } + else + { + print "#define END_INIT"; + print "#define END_FINI"; + } + if(max) + print "#define ALIGN .align", max; + else + print "#define ALIGN"; + + print "#include "; + print "weak_extern (__gmon_start__)"; +} diff --git a/newlib/libc/sys/linux/linuxthreads/ecmutex.c b/newlib/libc/sys/linux/linuxthreads/ecmutex.c new file mode 100644 index 000000000..ce54ddf33 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/ecmutex.c @@ -0,0 +1,157 @@ +/* Test of the error checking mutex and incidently also barriers. */ + +#include +#include +#include +#include + + +static pthread_mutex_t locks[] = +{ + PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, + PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, + PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, + PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, + PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +}; +#define nlocks ((int) (sizeof (locks) / sizeof (locks[0]))) + +static pthread_barrier_t barrier; +#define SYNC pthread_barrier_wait (&barrier) + +#define NTHREADS nlocks + +#define ROUNDS 20 + + +static void * +worker (void *arg) +{ + /* We are locking the and unlocked the locks and check the errors. + Since we are using the error-checking variant the implementation + should report them. */ + int nr = (long int) arg; + int i; + void *result = NULL; + int retval; + + for (i = 0; i < ROUNDS; ++i) + { + /* Skip the rounds which would make other == own. */ + if (i % nlocks == 0) + continue; + + /* Get the "own" mutex. */ + if (pthread_mutex_trylock (&locks[nr]) != 0) + { + printf ("thread %d failed getting own mutex\n", nr); + result = (void *) 1; + } + + /* Try locking "own" mutex again. */ + retval = pthread_mutex_lock (&locks[nr]); + if (retval != EDEADLK) + { + printf ("thread %d failed getting own mutex\n", nr); + result = (void *) 1; + } + + /* Try to get a different semaphore. */ + SYNC; + retval = pthread_mutex_trylock (&locks[(nr + i) % nlocks]); + if (retval != EBUSY) + { + printf ("thread %d didn't deadlock on getting %d's lock\n", + nr, (nr + i) % nlocks); + result = (void *) 1; + } + + /* Try unlocking other's lock. */ + retval = pthread_mutex_unlock (&locks[(nr + i) % nlocks]); + if (retval != EPERM) + { + printf ("thread %d managed releasing mutex %d\n", + nr, (nr + i) % nlocks); + result = (void *) 1; + } + + /* All lock one mutex now. */ + SYNC; + retval = pthread_mutex_lock (&locks[i % nlocks]); + if (nr == (i % nlocks)) + { + if (retval != EDEADLK) + { + printf ("thread %d didn't deadlock on getting %d's lock\n", + nr, (nr + i) % nlocks); + result = (void *) 1; + } + if (pthread_mutex_unlock (&locks[i % nlocks]) != 0) + { + printf ("thread %d failed releasing own mutex\n", nr); + result = (void *) 1; + } + } + else + { + if (retval != 0) + { + printf ("thread %d failed acquiring mutex %d\n", + nr, i % nlocks); + result = (void *) 1; + } + else if (pthread_mutex_unlock (&locks[i % nlocks]) != 0) + { + printf ("thread %d failed releasing mutex %d\n", + nr, i % nlocks); + result = (void *) 1; + } + } + + /* Unlock the own lock. */ + SYNC; + if (nr != (i % nlocks) && pthread_mutex_unlock (&locks[nr]) != 0) + { + printf ("thread %d failed releasing own mutex\n", nr); + result = (void *) 1; + } + + /* Try unlocking again. */ + retval = pthread_mutex_unlock (&locks[nr]); + if (retval == 0) + { + printf ("thread %d managed releasing own mutex twice\n", nr); + result = (void *) 1; + } + } + + return result; +} + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + pthread_t threads[NTHREADS]; + int i; + void *res; + int result = 0; + + pthread_barrier_init (&barrier, NULL, NTHREADS); + + for (i = 0; i < NTHREADS; ++i) + if (pthread_create (&threads[i], NULL, worker, (void *) (long int) i) != 0) + { + printf ("failed to create thread %d: %m\n", i); + exit (1); + } + + for (i = 0; i < NTHREADS; ++i) + if (pthread_join (threads[i], &res) != 0 || res != NULL) + result = 1; + + return result; +} + +#include "../test-skeleton.c" diff --git a/newlib/libc/sys/linux/linuxthreads/events.c b/newlib/libc/sys/linux/linuxthreads/events.c new file mode 100644 index 000000000..c65bafc76 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/events.c @@ -0,0 +1,37 @@ +/* Event functions used while debugging. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* The functions contained here do nothing, they just return. */ + +#include "internals.h" + +void +__linuxthreads_create_event (void) +{ +} + +void +__linuxthreads_death_event (void) +{ +} + +void +__linuxthreads_reap_event (void) +{ +} diff --git a/newlib/libc/sys/linux/linuxthreads/getcpuclockid.c b/newlib/libc/sys/linux/linuxthreads/getcpuclockid.c new file mode 100644 index 000000000..76d39a5de --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/getcpuclockid.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +int +pthread_getcpuclockid (pthread_t thread_id, clockid_t *clock_id) +{ + /* We don't allow any process ID but our own. */ + if (thread_handle (thread_id)->h_descr != thread_self ()) + return EPERM; + +#ifdef CLOCK_THREAD_CPUTIME_ID + /* Store the number. */ + *clock_id = CLOCK_THREAD_CPUTIME_ID; + + return 0; +#else + /* We don't have a timer for that. */ + return ENOENT; +#endif +} diff --git a/newlib/libc/sys/linux/linuxthreads/getreent.c b/newlib/libc/sys/linux/linuxthreads/getreent.c new file mode 100644 index 000000000..e73c4a531 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/getreent.c @@ -0,0 +1,11 @@ +/* get thread-specific reentrant pointer */ + +#include + +struct _reent * +__getreent (void) +{ + pthread_descr self = thread_self(); + return THREAD_GETMEM(self, p_reentp); +} + diff --git a/newlib/libc/sys/linux/linuxthreads/internals.h b/newlib/libc/sys/linux/linuxthreads/internals.h new file mode 100644 index 000000000..6da0deb43 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/internals.h @@ -0,0 +1,576 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +#ifndef _INTERNALS_H +#define _INTERNALS_H 1 + +/* Internal data structures */ + +/* Includes */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include /* for _LIBC_TSD_KEY_N */ + +extern long int testandset (int *spinlock); +extern int __compare_and_swap (long int *p, long int oldval, long int newval); + +#include "libc-symbols.h" +#include "pt-machine.h" +#include "semaphore.h" +#include "thread_dbP.h" +#include + +#ifndef THREAD_GETMEM +# define THREAD_GETMEM(descr, member) descr->member +#endif +#ifndef THREAD_GETMEM_NC +# define THREAD_GETMEM_NC(descr, member) descr->member +#endif +#ifndef THREAD_SETMEM +# define THREAD_SETMEM(descr, member, value) descr->member = (value) +#endif +#ifndef THREAD_SETMEM_NC +# define THREAD_SETMEM_NC(descr, member, value) descr->member = (value) +#endif + +/* Arguments passed to thread creation routine */ + +struct pthread_start_args { + void * (*start_routine)(void *); /* function to run */ + void * arg; /* its argument */ + sigset_t mask; /* initial signal mask for thread */ + int schedpolicy; /* initial scheduling policy (if any) */ + struct __sched_param schedparam; /* initial scheduling parameters (if any) */ +}; + + +/* We keep thread specific data in a special data structure, a two-level + array. The top-level array contains pointers to dynamically allocated + arrays of a certain number of data pointers. So we can implement a + sparse array. Each dynamic second-level array has + PTHREAD_KEY_2NDLEVEL_SIZE + entries. This value shouldn't be too large. */ +#define PTHREAD_KEY_2NDLEVEL_SIZE 32 + +/* We need to address PTHREAD_KEYS_MAX key with PTHREAD_KEY_2NDLEVEL_SIZE + keys in each subarray. */ +#define PTHREAD_KEY_1STLEVEL_SIZE \ + ((PTHREAD_KEYS_MAX + PTHREAD_KEY_2NDLEVEL_SIZE - 1) \ + / PTHREAD_KEY_2NDLEVEL_SIZE) + +typedef void (*destr_function)(void *); + +struct pthread_key_struct { + int in_use; /* already allocated? */ + destr_function destr; /* destruction routine */ +}; + + +#define PTHREAD_START_ARGS_INITIALIZER(fct) \ + { (void *(*) (void *)) fct, NULL, {{0, }}, 0, { 0 } } + +/* The type of thread descriptors */ + +typedef struct _pthread_descr_struct * pthread_descr; + +/* Callback interface for removing the thread from waiting on an + object if it is cancelled while waiting or about to wait. + This hold a pointer to the object, and a pointer to a function + which ``extricates'' the thread from its enqueued state. + The function takes two arguments: pointer to the wait object, + and a pointer to the thread. It returns 1 if an extrication + actually occured, and hence the thread must also be signalled. + It returns 0 if the thread had already been extricated. */ + +typedef struct _pthread_extricate_struct { + void *pu_object; + int (*pu_extricate_func)(void *, pthread_descr); +} pthread_extricate_if; + +/* Atomic counter made possible by compare_and_swap */ + +struct pthread_atomic { + long p_count; + int p_spinlock; +}; + +/* Context info for read write locks. The pthread_rwlock_info structure + is information about a lock that has been read-locked by the thread + in whose list this structure appears. The pthread_rwlock_context + is embedded in the thread context and contains a pointer to the + head of the list of lock info structures, as well as a count of + read locks that are untracked, because no info structure could be + allocated for them. */ + +struct _pthread_rwlock_t; + +typedef struct _pthread_rwlock_info { + struct _pthread_rwlock_info *pr_next; + struct _pthread_rwlock_t *pr_lock; + int pr_lock_count; +} pthread_readlock_info; + +struct _pthread_descr_struct { + union { + struct { + pthread_descr self; /* Pointer to this structure */ + } data; + void *__padding[16]; + } p_header; + pthread_descr p_nextlive, p_prevlive; + /* Double chaining of active threads */ + pthread_descr p_nextwaiting; /* Next element in the queue holding the thr */ + pthread_descr p_nextlock; /* can be on a queue and waiting on a lock */ + pthread_t p_tid; /* Thread identifier */ + int p_pid; /* PID of Unix process */ + int p_priority; /* Thread priority (== 0 if not realtime) */ + struct _pthread_fastlock * p_lock; /* Spinlock for synchronized accesses */ + int p_signal; /* last signal received */ + sigjmp_buf * p_signal_jmp; /* where to siglongjmp on a signal or NULL */ + sigjmp_buf * p_cancel_jmp; /* where to siglongjmp on a cancel or NULL */ + char p_terminated; /* true if terminated e.g. by pthread_exit */ + char p_detached; /* true if detached */ + char p_exited; /* true if the assoc. process terminated */ + void * p_retval; /* placeholder for return value */ + int p_retcode; /* placeholder for return code */ + pthread_descr p_joining; /* thread joining on that thread or NULL */ + struct _pthread_cleanup_buffer * p_cleanup; /* cleanup functions */ + char p_cancelstate; /* cancellation state */ + char p_canceltype; /* cancellation type (deferred/async) */ + char p_canceled; /* cancellation request pending */ + struct _reent * p_reentp; /* pointer to reent struct */ + struct _reent p_reent; /* reentrant structure for newlib */ + int * p_h_errnop; /* pointer to used h_errno variable */ + int p_h_errno; /* error returned by last netdb function */ + char * p_in_sighandler; /* stack address of sighandler, or NULL */ + char p_sigwaiting; /* true if a sigwait() is in progress */ + struct pthread_start_args p_start_args; /* arguments for thread creation */ + void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE]; /* thread-specific data */ + void * p_libc_specific[_LIBC_TSD_KEY_N]; /* thread-specific data for libc */ + int p_userstack; /* nonzero if the user provided the stack */ + void *p_guardaddr; /* address of guard area or NULL */ + size_t p_guardsize; /* size of guard area */ + int p_nr; /* Index of descriptor in __pthread_handles */ + int p_report_events; /* Nonzero if events must be reported. */ + td_eventbuf_t p_eventbuf; /* Data for event. */ + struct pthread_atomic p_resume_count; /* number of times restart() was + called on thread */ + char p_woken_by_cancel; /* cancellation performed wakeup */ + char p_condvar_avail; /* flag if conditional variable became avail */ + char p_sem_avail; /* flag if semaphore became available */ + pthread_extricate_if *p_extricate; /* See above */ + pthread_readlock_info *p_readlock_list; /* List of readlock info structs */ + pthread_readlock_info *p_readlock_free; /* Free list of structs */ + int p_untracked_readlock_count; /* Readlocks not tracked by list */ + struct __res_state *p_resp; /* Pointer to resolver state */ + struct __res_state p_res; /* per-thread resolver state */ + int p_inheritsched; /* copied from the thread attribute */ +#if HP_TIMING_AVAIL + hp_timing_t p_cpuclock_offset; /* Initial CPU clock for thread. */ +#endif + /* New elements must be added at the end. */ +} __attribute__ ((aligned(32))); /* We need to align the structure so that + doubles are aligned properly. This is 8 + bytes on MIPS and 16 bytes on MIPS64. + 32 bytes might give better cache + utilization. */ + + +/* The type of thread handles. */ + +typedef struct pthread_handle_struct * pthread_handle; + +struct pthread_handle_struct { + struct _pthread_fastlock h_lock; /* Fast lock for sychronized access */ + pthread_descr h_descr; /* Thread descriptor or NULL if invalid */ + char * h_bottom; /* Lowest address in the stack thread */ +}; + +/* The type of messages sent to the thread manager thread */ + +struct pthread_request { + pthread_descr req_thread; /* Thread doing the request */ + enum { /* Request kind */ + REQ_CREATE, REQ_FREE, REQ_PROCESS_EXIT, REQ_MAIN_THREAD_EXIT, + REQ_POST, REQ_DEBUG, REQ_KICK, REQ_FOR_EACH_THREAD + } req_kind; + union { /* Arguments for request */ + struct { /* For REQ_CREATE: */ + const pthread_attr_t * attr; /* thread attributes */ + void * (*fn)(void *); /* start function */ + void * arg; /* argument to start function */ + sigset_t mask; /* signal mask */ + } create; + struct { /* For REQ_FREE: */ + pthread_t thread_id; /* identifier of thread to free */ + } free; + struct { /* For REQ_PROCESS_EXIT: */ + int code; /* exit status */ + } exit; + void * post; /* For REQ_POST: the semaphore */ + struct { /* For REQ_FOR_EACH_THREAD: callback */ + void (*fn)(void *, pthread_descr); + void *arg; + } for_each; + } req_args; +}; + + +/* Signals used for suspend/restart and for cancellation notification. */ + +extern int __pthread_sig_restart; +extern int __pthread_sig_cancel; + +/* Signal used for interfacing with gdb */ + +extern int __pthread_sig_debug; + +/* Global array of thread handles, used for validating a thread id + and retrieving the corresponding thread descriptor. Also used for + mapping the available stack segments. */ + +extern struct pthread_handle_struct __pthread_handles[PTHREAD_THREADS_MAX]; + +/* Descriptor of the initial thread */ + +extern struct _pthread_descr_struct __pthread_initial_thread; + +/* Descriptor of the manager thread */ + +extern struct _pthread_descr_struct __pthread_manager_thread; + +/* Descriptor of the main thread */ + +extern pthread_descr __pthread_main_thread; + +/* Limit between the stack of the initial thread (above) and the + stacks of other threads (below). Aligned on a STACK_SIZE boundary. + Initially 0, meaning that the current thread is (by definition) + the initial thread. */ + +extern char *__pthread_initial_thread_bos; + +/* Indicate whether at least one thread has a user-defined stack (if 1), + or all threads have stacks supplied by LinuxThreads (if 0). */ + +extern int __pthread_nonstandard_stacks; + +/* File descriptor for sending requests to the thread manager. + Initially -1, meaning that __pthread_initialize_manager must be called. */ + +extern int __pthread_manager_request; + +/* Other end of the pipe for sending requests to the thread manager. */ + +extern int __pthread_manager_reader; + +/* Limits of the thread manager stack. */ + +extern char *__pthread_manager_thread_bos; +extern char *__pthread_manager_thread_tos; + +#ifdef FLOATING_STACKS +/* Maximum stack size. */ +extern size_t __pthread_max_stacksize; +#endif + +/* Pending request for a process-wide exit */ + +extern int __pthread_exit_requested, __pthread_exit_code; + +/* Set to 1 by gdb if we're debugging */ + +extern volatile int __pthread_threads_debug; + +/* Globally enabled events. */ +extern volatile td_thr_events_t __pthread_threads_events; + +/* Pointer to descriptor of thread with last event. */ +extern volatile pthread_descr __pthread_last_event; + +/* Flag which tells whether we are executing on SMP kernel. */ +extern int __pthread_smp_kernel; + +/* Return the handle corresponding to a thread id */ + +static inline pthread_handle thread_handle(pthread_t id) +{ + return &__pthread_handles[id % PTHREAD_THREADS_MAX]; +} + +/* Validate a thread handle. Must have acquired h->h_spinlock before. */ + +static inline int invalid_handle(pthread_handle h, pthread_t id) +{ + return h->h_descr == NULL || h->h_descr->p_tid != id || h->h_descr->p_terminated; +} + +static inline int nonexisting_handle(pthread_handle h, pthread_t id) +{ + return h->h_descr == NULL || h->h_descr->p_tid != id; +} + +/* Fill in defaults left unspecified by pt-machine.h. */ + +/* We round up a value with page size. */ +#ifndef page_roundup +#define page_roundup(v,p) ((((size_t) (v)) + (p) - 1) & ~((p) - 1)) +#endif + +/* The page size we can get from the system. This should likely not be + changed by the machine file but, you never know. */ +#ifndef PAGE_SIZE +#define PAGE_SIZE (sysconf (_SC_PAGE_SIZE)) +#endif + +/* The max size of the thread stack segments. If the default + THREAD_SELF implementation is used, this must be a power of two and + a multiple of PAGE_SIZE. */ +#ifndef STACK_SIZE +#define STACK_SIZE (2 * 1024 * 1024) +#endif + +/* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */ +#ifndef INITIAL_STACK_SIZE +#define INITIAL_STACK_SIZE (4 * PAGE_SIZE) +#endif + +/* Size of the thread manager stack. The "- 32" avoids wasting space + with some malloc() implementations. */ +#ifndef THREAD_MANAGER_STACK_SIZE +#define THREAD_MANAGER_STACK_SIZE (2 * PAGE_SIZE - 32) +#endif + +/* The base of the "array" of thread stacks. The array will grow down from + here. Defaults to the calculated bottom of the initial application + stack. */ +#ifndef THREAD_STACK_START_ADDRESS +#define THREAD_STACK_START_ADDRESS __pthread_initial_thread_bos +#endif + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#ifndef CURRENT_STACK_FRAME +#define CURRENT_STACK_FRAME ({ char __csf; &__csf; }) +#endif + +/* Recover thread descriptor for the current thread */ + +extern pthread_descr __pthread_find_self (void) __attribute__ ((const)); + +static inline pthread_descr thread_self (void) __attribute__ ((const)); +static inline pthread_descr thread_self (void) +{ +#ifdef THREAD_SELF + return THREAD_SELF; +#else + char *sp = CURRENT_STACK_FRAME; + if (sp >= __pthread_initial_thread_bos) + return &__pthread_initial_thread; + else if (sp >= __pthread_manager_thread_bos + && sp < __pthread_manager_thread_tos) + return &__pthread_manager_thread; + else if (__pthread_nonstandard_stacks) + return __pthread_find_self(); + else +#ifdef _STACK_GROWS_DOWN + return (pthread_descr)(((unsigned long)sp | (STACK_SIZE-1))+1) - 1; +#else + return (pthread_descr)((unsigned long)sp &~ (STACK_SIZE-1)); +#endif +#endif +} + +/* If MEMORY_BARRIER isn't defined in pt-machine.h, assume the architecture + doesn't need a memory barrier instruction (e.g. Intel x86). Still we + need the compiler to respect the barrier and emit all outstanding + operations which modify memory. Some architectures distinguish between + full, read and write barriers. */ + +#ifndef MEMORY_BARRIER +#define MEMORY_BARRIER() asm ("" : : : "memory") +#endif +#ifndef READ_MEMORY_BARRIER +#define READ_MEMORY_BARRIER() MEMORY_BARRIER() +#endif +#ifndef WRITE_MEMORY_BARRIER +#define WRITE_MEMORY_BARRIER() MEMORY_BARRIER() +#endif + +/* Max number of times we must spin on a spinlock calling sched_yield(). + After MAX_SPIN_COUNT iterations, we put the calling thread to sleep. */ + +#ifndef MAX_SPIN_COUNT +#define MAX_SPIN_COUNT 50 +#endif + +/* Max number of times the spinlock in the adaptive mutex implementation + spins actively on SMP systems. */ + +#ifndef MAX_ADAPTIVE_SPIN_COUNT +#define MAX_ADAPTIVE_SPIN_COUNT 100 +#endif + +/* Duration of sleep (in nanoseconds) when we can't acquire a spinlock + after MAX_SPIN_COUNT iterations of sched_yield(). + With the 2.0 and 2.1 kernels, this MUST BE > 2ms. + (Otherwise the kernel does busy-waiting for realtime threads, + giving other threads no chance to run.) */ + +#ifndef SPIN_SLEEP_DURATION +#define SPIN_SLEEP_DURATION 2000001 +#endif + +/* Debugging */ + +#ifdef DEBUG +#include +#define ASSERT assert +#define MSG __pthread_message +#else +#define ASSERT(x) +#define MSG(msg,arg...) +#endif + +/* Internal global functions */ + +extern void __pthread_do_exit (void *retval, char *currentframe) + __attribute__ ((__noreturn__)); +extern void __pthread_destroy_specifics (void); +extern void __pthread_perform_cleanup (char *currentframe); +extern void __pthread_init_max_stacksize (void); +extern int __pthread_initialize_manager (void); +extern void __pthread_message (char * fmt, ...); +extern int __pthread_manager (void *reqfd); +extern int __pthread_manager_event (void *reqfd); +extern void __pthread_manager_sighandler (int sig); +extern void __pthread_reset_main_thread (void); +extern void __pthread_once_fork_prepare (void); +extern void __pthread_once_fork_parent (void); +extern void __pthread_once_fork_child (void); +extern void __flockfilelist (void); +extern void __funlockfilelist (void); +extern void __fresetlockfiles (void); +extern void __pthread_manager_adjust_prio (int thread_prio); +extern void __pthread_initialize_minimal (void); + +extern int __pthread_attr_setguardsize (pthread_attr_t *__attr, + size_t __guardsize); +extern int __pthread_attr_getguardsize (const pthread_attr_t *__attr, + size_t *__guardsize); +extern int __pthread_attr_setstackaddr (pthread_attr_t *__attr, + void *__stackaddr); +extern int __pthread_attr_getstackaddr (const pthread_attr_t *__attr, + void **__stackaddr); +extern int __pthread_attr_setstacksize (pthread_attr_t *__attr, + size_t __stacksize); +extern int __pthread_attr_getstacksize (const pthread_attr_t *__attr, + size_t *__stacksize); +extern int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, + size_t __stacksize); +extern int __pthread_attr_getstack (const pthread_attr_t *__attr, void **__stackaddr, + size_t *__stacksize); +extern int __pthread_getconcurrency (void); +extern int __pthread_setconcurrency (int __level); +extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex, + const struct timespec *__abstime); +extern int __pthread_mutexattr_getpshared (const pthread_mutexattr_t *__attr, + int *__pshared); +extern int __pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, + int __pshared); +extern int __pthread_mutexattr_gettype (const pthread_mutexattr_t *__attr, + int *__kind); +extern void __pthread_kill_other_threads_np (void); + +extern void __pthread_restart_old(pthread_descr th); +extern void __pthread_suspend_old(pthread_descr self); +extern int __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abs); + +extern void __pthread_restart_new(pthread_descr th); +extern void __pthread_suspend_new(pthread_descr self); +extern int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abs); + +extern void __pthread_wait_for_restart_signal(pthread_descr self); + +extern int __pthread_yield (void); + +extern int __pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, + __const struct timespec *__restrict + __abstime); +extern int __pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, + __const struct timespec *__restrict + __abstime); +extern int __pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr); + +extern int __pthread_barrierattr_getpshared (__const pthread_barrierattr_t * + __restrict __attr, + int *__restrict __pshared); + +extern int __pthread_spin_lock (pthread_spinlock_t *__lock); +extern int __pthread_spin_trylock (pthread_spinlock_t *__lock); +extern int __pthread_spin_unlock (pthread_spinlock_t *__lock); +extern int __pthread_spin_init (pthread_spinlock_t *__lock, int __pshared); +extern int __pthread_spin_destroy (pthread_spinlock_t *__lock); + +extern int __pthread_clock_gettime (hp_timing_t freq, struct timespec *tp); +extern void __pthread_clock_settime (hp_timing_t offset); + + +/* Global pointers to old or new suspend functions */ + +extern void (*__pthread_restart)(pthread_descr); +extern void (*__pthread_suspend)(pthread_descr); +extern int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *); + +/* Prototypes for the function without cancelation support when the + normal version has it. */ +extern int __libc_close (int fd); +extern int __libc_nanosleep (const struct timespec *requested_time, + struct timespec *remaining); +/* Prototypes for some of the new semaphore functions. */ +extern int __new_sem_post (sem_t * sem); +extern int __new_sem_init (sem_t *__sem, int __pshared, unsigned int __value); +extern int __new_sem_wait (sem_t *__sem); +extern int __new_sem_trywait (sem_t *__sem); +extern int __new_sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval); +extern int __new_sem_destroy (sem_t *__sem); + +/* Prototypes for compatibility functions. */ +extern int __pthread_attr_init_2_1 (pthread_attr_t *__attr); +extern int __pthread_attr_init_2_0 (pthread_attr_t *__attr); +extern int __pthread_create_2_1 (pthread_t *__restrict __thread1, + const pthread_attr_t *__attr, + void *(*__start_routine) (void *), + void *__restrict __arg); +extern int __pthread_create_2_0 (pthread_t *__restrict __thread1, + const pthread_attr_t *__attr, + void *(*__start_routine) (void *), + void *__restrict arg); + +/* The functions called the signal events. */ +extern void __linuxthreads_create_event (void); +extern void __linuxthreads_death_event (void); +extern void __linuxthreads_reap_event (void); + +/* This function is called to initialize the pthread library. */ +extern void __pthread_initialize (void); + +#endif /* internals.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/join.c b/newlib/libc/sys/linux/linuxthreads/join.c new file mode 100644 index 000000000..a6ed08c97 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/join.c @@ -0,0 +1,218 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Thread termination and joining */ + +#include +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "restart.h" + +void pthread_exit(void * retval) +{ + __pthread_do_exit (retval, CURRENT_STACK_FRAME); +} + +void __pthread_do_exit(void *retval, char *currentframe) +{ + pthread_descr self = thread_self(); + pthread_descr joining; + struct pthread_request request; + + /* Reset the cancellation flag to avoid looping if the cleanup handlers + contain cancellation points */ + THREAD_SETMEM(self, p_canceled, 0); + /* Call cleanup functions and destroy the thread-specific data */ + __pthread_perform_cleanup(currentframe); + __pthread_destroy_specifics(); + /* Store return value */ + __pthread_lock(THREAD_GETMEM(self, p_lock), self); + THREAD_SETMEM(self, p_retval, retval); + /* See whether we have to signal the death. */ + if (THREAD_GETMEM(self, p_report_events)) + { + /* See whether TD_DEATH is in any of the mask. */ + int idx = __td_eventword (TD_DEATH); + uint32_t mask = __td_eventmask (TD_DEATH); + + if ((mask & (__pthread_threads_events.event_bits[idx] + | THREAD_GETMEM_NC(self, + p_eventbuf.eventmask.event_bits[idx]))) + != 0) + { + /* Yep, we have to signal the death. */ + THREAD_SETMEM(self, p_eventbuf.eventnum, TD_DEATH); + THREAD_SETMEM(self, p_eventbuf.eventdata, self); + __pthread_last_event = self; + + /* Now call the function to signal the event. */ + __linuxthreads_death_event(); + } + } + /* Say that we've terminated */ + THREAD_SETMEM(self, p_terminated, 1); + /* See if someone is joining on us */ + joining = THREAD_GETMEM(self, p_joining); + __pthread_unlock(THREAD_GETMEM(self, p_lock)); + /* Restart joining thread if any */ + if (joining != NULL) restart(joining); + /* If this is the initial thread, block until all threads have terminated. + If another thread calls exit, we'll be terminated from our signal + handler. */ + if (self == __pthread_main_thread && __pthread_manager_request >= 0) { + request.req_thread = self; + request.req_kind = REQ_MAIN_THREAD_EXIT; + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *)&request, sizeof(request))); + suspend(self); + /* Main thread flushes stdio streams and runs atexit functions. + It also calls a handler within LinuxThreads which sends a process exit + request to the thread manager. */ + exit(0); + } + /* Threads other than the main one terminate without flushing stdio streams + or running atexit functions. */ + _exit(0); +} + +/* Function called by pthread_cancel to remove the thread from + waiting on a condition variable queue. */ + +static int join_extricate_func(void *obj, pthread_descr th) +{ + volatile pthread_descr self = thread_self(); + pthread_handle handle = obj; + pthread_descr jo; + int did_remove = 0; + + __pthread_lock(&handle->h_lock, self); + jo = handle->h_descr; + did_remove = jo->p_joining != NULL; + jo->p_joining = NULL; + __pthread_unlock(&handle->h_lock); + + return did_remove; +} + +int pthread_join(pthread_t thread_id, void ** thread_return) +{ + volatile pthread_descr self = thread_self(); + struct pthread_request request; + pthread_handle handle = thread_handle(thread_id); + pthread_descr th; + pthread_extricate_if extr; + int already_canceled = 0; + + /* Set up extrication interface */ + extr.pu_object = handle; + extr.pu_extricate_func = join_extricate_func; + + __pthread_lock(&handle->h_lock, self); + if (nonexisting_handle(handle, thread_id)) { + __pthread_unlock(&handle->h_lock); + return ESRCH; + } + th = handle->h_descr; + if (th == self) { + __pthread_unlock(&handle->h_lock); + return EDEADLK; + } + /* If detached or already joined, error */ + if (th->p_detached || th->p_joining != NULL) { + __pthread_unlock(&handle->h_lock); + return EINVAL; + } + /* If not terminated yet, suspend ourselves. */ + if (! th->p_terminated) { + /* Register extrication interface */ + __pthread_set_own_extricate_if(self, &extr); + if (!(THREAD_GETMEM(self, p_canceled) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)) + th->p_joining = self; + else + already_canceled = 1; + __pthread_unlock(&handle->h_lock); + + if (already_canceled) { + __pthread_set_own_extricate_if(self, 0); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + + suspend(self); + /* Deregister extrication interface */ + __pthread_set_own_extricate_if(self, 0); + + /* This is a cancellation point */ + if (THREAD_GETMEM(self, p_woken_by_cancel) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) { + THREAD_SETMEM(self, p_woken_by_cancel, 0); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + __pthread_lock(&handle->h_lock, self); + } + /* Get return value */ + if (thread_return != NULL) *thread_return = th->p_retval; + __pthread_unlock(&handle->h_lock); + /* Send notification to thread manager */ + if (__pthread_manager_request >= 0) { + request.req_thread = self; + request.req_kind = REQ_FREE; + request.req_args.free.thread_id = thread_id; + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + } + return 0; +} + +int pthread_detach(pthread_t thread_id) +{ + int terminated; + struct pthread_request request; + pthread_handle handle = thread_handle(thread_id); + pthread_descr th; + + __pthread_lock(&handle->h_lock, NULL); + if (nonexisting_handle(handle, thread_id)) { + __pthread_unlock(&handle->h_lock); + return ESRCH; + } + th = handle->h_descr; + /* If already detached, error */ + if (th->p_detached) { + __pthread_unlock(&handle->h_lock); + return EINVAL; + } + /* If already joining, don't do anything. */ + if (th->p_joining != NULL) { + __pthread_unlock(&handle->h_lock); + return 0; + } + /* Mark as detached */ + th->p_detached = 1; + terminated = th->p_terminated; + __pthread_unlock(&handle->h_lock); + /* If already terminated, notify thread manager to reclaim resources */ + if (terminated && __pthread_manager_request >= 0) { + request.req_thread = thread_self(); + request.req_kind = REQ_FREE; + request.req_args.free.thread_id = thread_id; + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + } + return 0; +} diff --git a/newlib/libc/sys/linux/linuxthreads/joinrace.c b/newlib/libc/sys/linux/linuxthreads/joinrace.c new file mode 100644 index 000000000..8e1064c98 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/joinrace.c @@ -0,0 +1,48 @@ +/* Test case by Permaine Cheung . */ + +#include +#include +#include +#include + +static void * +sub1 (void *arg) +{ + /* Nothing. */ + return NULL; +} + +int +main (void) +{ + int istatus; + int policy; + int cnt; + pthread_t thread1; + struct sched_param spresult1, sp1; + + for (cnt = 0; cnt < 100; ++cnt) + { + printf ("Round %d\n", cnt); + + pthread_create (&thread1, NULL, &sub1, NULL); + pthread_join (thread1, NULL); + + istatus = pthread_getschedparam (thread1, &policy, &spresult1); + if (istatus != ESRCH) + { + printf ("pthread_getschedparam returns: %d\n", istatus); + return 1; + } + + sp1.sched_priority = 0; + istatus = pthread_setschedparam (thread1, SCHED_OTHER, &sp1); + if (istatus != ESRCH) + { + printf ("pthread_setschedparam returns: %d\n", istatus); + return 2; + } + } + + return 0; +} diff --git a/newlib/libc/sys/linux/linuxthreads/kernel-features.h b/newlib/libc/sys/linux/linuxthreads/kernel-features.h new file mode 100644 index 000000000..562a6c765 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/kernel-features.h @@ -0,0 +1,193 @@ +/* Set flags signalling availability of kernel features based on given + kernel version number. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file must not contain any C code. At least it must be protected + to allow using the file also in assembler files. */ + +#ifndef __LINUX_KERNEL_VERSION +/* We assume the worst; all kernels should be supported. */ +# define __LINUX_KERNEL_VERSION 0 +#endif + +/* We assume for __LINUX_KERNEL_VERSION the same encoding used in + linux/version.h. I.e., the major, minor, and subminor all get a + byte with the major number being in the highest byte. This means + we can do numeric comparisons. + + In the following we will define certain symbols depending on + whether the describes kernel feature is available in the kernel + version given by __LINUX_KERNEL_VERSION. We are not always exactly + recording the correct versions in which the features were + introduced. If somebody cares these values can afterwards be + corrected. Most of the numbers here are set corresponding to + 2.2.0. */ + +/* `getcwd' system call. */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_GETCWD_SYSCALL 1 +#endif + +/* Real-time signal became usable in 2.1.70. */ +#if __LINUX_KERNEL_VERSION >= 131398 +# define __ASSUME_REALTIME_SIGNALS 1 +#endif + +/* When were the `pread'/`pwrite' syscalls introduced? */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_PREAD_SYSCALL 1 +# define __ASSUME_PWRITE_SYSCALL 1 +#endif + +/* When was `poll' introduced? */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_POLL_SYSCALL 1 +#endif + +/* The `lchown' syscall was introduced in 2.1.80. */ +#if __LINUX_KERNEL_VERSION >= 131408 +# define __ASSUME_LCHOWN_SYSCALL 1 +#endif + +/* When did the `setresuid' sysall became available? */ +#if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__ +# define __ASSUME_SETRESUID_SYSCALL 1 +#endif + +/* The SIOCGIFNAME ioctl is available starting with 2.1.50. */ +#if __LINUX_KERNEL_VERSION >= 131408 +# define __ASSUME_SIOCGIFNAME 1 +#endif + +/* On x86 another `getrlimit' syscall was added in 2.3.25. */ +#if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__ +# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 +#endif + +/* On x86 the truncate64/ftruncate64 syscalls were introduced in 2.3.31. */ +#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ +# define __ASSUME_TRUNCATE64_SYSCALL 1 +#endif + +/* On x86 the mmap2 syscall was introduced in 2.3.31. */ +#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ +# define __ASSUME_MMAP2_SYSCALL 1 +#endif + +/* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */ +#if __LINUX_KERNEL_VERSION >= 131874 && defined __i386__ +# define __ASSUME_STAT64_SYSCALL 1 +#endif + +/* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64 + syscalls were introduced in 2.3.35. */ +#if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__) +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_MMAP2_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +#endif + +/* I know for sure that these are in 2.3.35 on powerpc. */ +#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 +#endif + +/* Linux 2.3.39 introduced 32bit UID/GIDs and IPC64. Some platforms had 32 + bit type all along. */ +#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__ +# define __ASSUME_32BITUIDS 1 +# ifndef __powerpc__ +# define __ASSUME_IPC64 1 +# endif +# ifdef __sparc__ +# define __ASSUME_SETRESUID_SYSCALL 1 +# endif +#endif + +/* Linux 2.4.0 on PPC introduced a correct IPC64. */ +#if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__ +# define __ASSUME_IPC64 1 +#endif + +/* We can use the LDTs for threading with Linux 2.3.99 and newer. */ +#if __LINUX_KERNEL_VERSION >= 131939 +# define __ASSUME_LDT_WORKS 1 +#endif + +/* The changed st_ino field appeared in 2.4.0-test6. But we cannot + distinguish this version from other 2.4.0 releases. Therefore play + save and assume it available is for 2.4.1 and up. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_ST_INO_64_BIT 1 +#endif + +/* To support locking of large files a new fcntl() syscall was introduced + in 2.4.0-test7. We test for 2.4.1 for the earliest version we know + the syscall is available. */ +#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __sparc__) +# define __ASSUME_FCNTL64 1 +#endif + +/* Arm got fcntl64 in 2.4.4, PowerPC and SH have it also in 2.4.4 (I + don't know when it got introduced). */ +#if __LINUX_KERNEL_VERSION >= 132100 \ + && (defined __arm__ || defined __powerpc__ || defined __sh__) +# define __ASSUME_FCNTL64 1 +#endif + +/* The getdents64 syscall was introduced in 2.4.0-test7. We test for + 2.4.1 for the earliest version we know the syscall is available. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_GETDENTS64_SYSCALL 1 +#endif + +/* When did O_DIRECTORY became available? Early in 2.3 but when? + Be safe, use 2.3.99. */ +#if __LINUX_KERNEL_VERSION >= 131939 +# define __ASSUME_O_DIRECTORY 1 +#endif + +/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes + up the page size information. */ +#if __LINUX_KERNEL_VERSION >= 132097 +# define __ASSUME_AT_PAGESIZE 1 +#endif + +/* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way + and the mmap2 syscall made it into the official kernel. */ +#if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__ +# define __ASSUME_STD_AUXV 1 +# define __ASSUME_MMAP2_SYSCALL 1 +#endif + +/* There are an infinite number of PA-RISC kernel versions numbered + 2.4.0. But they've not really been released as such. We require + and expect the final version here. */ +#ifdef __hppa__ +# define __ASSUME_32BITUIDS 1 +# define __ASSUME_TRUNCATE64_SYSCALL 1 +# define __ASSUME_MMAP2_SYSCALL 1 +# define __ASSUME_STAT64_SYSCALL 1 +# define __ASSUME_IPC64 1 +# define __ASSUME_ST_INO_64_BIT 1 +# define __ASSUME_FCNTL64 1 +# define __ASSUME_GETDENTS64_SYSCALL 1 +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/libc-internal.h b/newlib/libc/sys/linux/linuxthreads/libc-internal.h new file mode 100644 index 000000000..8369ffec2 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/libc-internal.h @@ -0,0 +1,29 @@ +/* This file contains a number of internal prototype declarations that + don't fit anywhere else. */ + +#ifndef _LIBC_INTERNAL +# define _LIBC_INTERNAL 1 + +#include + +/* Initialize the `__libc_enable_secure' flag. */ +extern void __libc_init_secure (void); + +/* This function will be called from _init in init-first.c. */ +extern void __libc_global_ctors (void); + +/* Discover the tick frequency of the machine if something goes wrong, + we return 0, an impossible hertz. */ +extern int __profile_frequency (void); + +/* Hooks for the instrumenting functions. */ +extern void __cyg_profile_func_enter (void *this_fn, void *call_site); +extern void __cyg_profile_func_exit (void *this_fn, void *call_site); + +/* Get frequency of the system processor. */ +extern hp_timing_t __get_clockfreq (void); + +/* Free all allocated resources. */ +extern void __libc_freeres (void); + +#endif /* _LIBC_INTERNAL */ diff --git a/newlib/libc/sys/linux/linuxthreads/libc-symbols.h b/newlib/libc/sys/linux/linuxthreads/libc-symbols.h new file mode 100644 index 000000000..97b672643 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/libc-symbols.h @@ -0,0 +1,352 @@ +/* Support macros for making weak and strong aliases for symbols, + and for using symbol sets and linker warnings with GNU ld. + Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LIBC_SYMBOLS_H +#define _LIBC_SYMBOLS_H 1 + +/* This file's macros are included implicitly in the compilation of every + file in the C library by -imacros. + + We include config.h which is generated by configure. + It should define for us the following symbols: + + * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. + * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. + * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, + and for symbol set and warning messages extensions in a.out and ELF. + * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. + * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. + * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. + + */ + +/* This is defined for the compilation of all C library code. features.h + tests this to avoid inclusion of stubs.h while compiling the library, + before stubs.h has been generated. Some library code that is shared + with other packages also tests this symbol to see if it is being + compiled as part of the C library. We must define this before including + config.h, because it makes some definitions conditional on whether libc + itself is being compiled, or just some generator program. */ +#define _LIBC 1 + +/* Enable declarations of GNU extensions, since we are compiling them. */ +#define _GNU_SOURCE 1 +/* And we also need the data for the reentrant functions. */ +#define _REENTRANT 1 + +#include + +/* The symbols in all the user (non-_) macros are C symbols. + HAVE_GNU_LD without HAVE_ELF implies a.out. */ + +#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE +# define HAVE_WEAK_SYMBOLS +#endif + +#ifndef __SYMBOL_PREFIX +# ifdef NO_UNDERSCORES +# define __SYMBOL_PREFIX +# else +# define __SYMBOL_PREFIX "_" +# endif +#endif + +#ifndef C_SYMBOL_NAME +# ifdef NO_UNDERSCORES +# define C_SYMBOL_NAME(name) name +# else +# define C_SYMBOL_NAME(name) _##name +# endif +#endif + +#ifndef ASM_LINE_SEP +# define ASM_LINE_SEP ; +#endif + +#ifndef C_SYMBOL_DOT_NAME +# define C_SYMBOL_DOT_NAME(name) .##name +#endif + +#ifndef __ASSEMBLER__ +/* GCC understands weak symbols and aliases; use its interface where + possible, instead of embedded assembly language. */ + +/* Define ALIASNAME as a strong alias for NAME. */ +# define strong_alias(name, aliasname) _strong_alias(name, aliasname) +# define _strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); + +/* This comes between the return type and function name in + a function definition to make that definition weak. */ +# define weak_function __attribute__ ((weak)) +# define weak_const_function __attribute__ ((weak, __const__)) + +# ifdef HAVE_WEAK_SYMBOLS + +/* Define ALIASNAME as a weak alias for NAME. + If weak aliases are not available, this defines a strong alias. */ +# define weak_alias(name, aliasname) _weak_alias (name, aliasname) +# define _weak_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); + +/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ +# define weak_extern(symbol) _weak_extern (symbol) +# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol); +# else +# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); +# endif + +# else + +# define weak_alias(name, aliasname) strong_alias(name, aliasname) +# define weak_extern(symbol) /* Nothing. */ + +# endif + +#else /* __ASSEMBLER__ */ + +# ifdef HAVE_ASM_SET_DIRECTIVE +# define strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) +# else +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +# else +# define strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +# endif +# endif + +# ifdef HAVE_WEAK_SYMBOLS +# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +# define weak_alias(original, alias) \ + .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) +# define weak_extern(symbol) \ + .weakext C_SYMBOL_NAME (symbol) + +# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ + +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define weak_alias(original, alias) \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +# else +# define weak_alias(original, alias) \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +# endif + +# define weak_extern(symbol) \ + .weak C_SYMBOL_NAME (symbol) + +# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ + +# else /* ! HAVE_WEAK_SYMBOLS */ + +# define weak_alias(original, alias) strong_alias(original, alias) +# define weak_extern(symbol) /* Nothing */ +# endif /* ! HAVE_WEAK_SYMBOLS */ + +#endif /* __ASSEMBLER__ */ + +/* On some platforms we can make internal function calls (i.e., calls of + functions not exported) a bit faster by using a different calling + convention. */ +#ifndef internal_function +# define internal_function /* empty */ +#endif + +/* Prepare for the case that `__builtin_expect' is not available. */ +#ifndef HAVE_BUILTIN_EXPECT +# define __builtin_expect(expr, val) (expr) +#endif + +/* Determine the return address. */ +#define RETURN_ADDRESS(nr) \ + __builtin_extract_return_addr (__builtin_return_address (nr)) + +/* When a reference to SYMBOL is encountered, the linker will emit a + warning message MSG. */ +#ifdef HAVE_GNU_LD +# ifdef HAVE_ELF + +/* We want the .gnu.warning.SYMBOL section to be unallocated. */ +# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE +# define __make_section_unallocated(section_string) \ + asm (".section " section_string "\n\t.previous"); +# elif defined HAVE_ASM_POPSECTION_DIRECTIVE +# define __make_section_unallocated(section_string) \ + asm (".pushsection " section_string "\n\t.popsection"); +# else +# define __make_section_unallocated(section_string) +# endif + +/* Tacking on "\n\t#" to the section name makes gcc put it's bogus + section attributes on what looks like a comment to the assembler. */ +# ifdef HAVE_SECTION_QUOTES +# define link_warning(symbol, msg) \ + __make_section_unallocated (".gnu.warning." #symbol) \ + static const char __evoke_link_warning_##symbol[] \ + __attribute__ ((section (".gnu.warning." #symbol "\"\n\t#\""))) = msg; +# else +# define link_warning(symbol, msg) \ + __make_section_unallocated (".gnu.warning." #symbol) \ + static const char __evoke_link_warning_##symbol[] \ + __attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg; +# endif +# else /* Not ELF: a.out */ +# ifdef HAVE_XCOFF +/* XCOFF does not support .stabs. + The native aix linker will remove the .stab and .stabstr sections + The gnu linker will have a fatal error if there is a relocation for + symbol in the .stab section. Silently disable this macro. */ +# define link_warning(symbol, msg) +# else +# define link_warning(symbol, msg) \ + asm (".stabs \"" msg "\",30,0,0,0\n\t" \ + ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); +# endif /* XCOFF */ +# endif +#else +/* We will never be heard; they will all die horribly. */ +# define link_warning(symbol, msg) +#endif + +/* A canned warning for sysdeps/stub functions. */ +#define stub_warning(name) \ + link_warning (name, \ + "warning: " #name " is not implemented and will always fail") + +/* + +*/ + +#ifdef HAVE_GNU_LD + +/* Symbol set support macros. */ + +# ifdef HAVE_ELF + +/* Make SYMBOL, which is in the text segment, an element of SET. */ +# define text_set_element(set, symbol) _elf_set_element(set, symbol) +/* Make SYMBOL, which is in the data segment, an element of SET. */ +# define data_set_element(set, symbol) _elf_set_element(set, symbol) +/* Make SYMBOL, which is in the bss segment, an element of SET. */ +# define bss_set_element(set, symbol) _elf_set_element(set, symbol) + +/* These are all done the same way in ELF. + There is a new section created for each set. */ +# ifdef SHARED +/* When building a shared library, make the set section writable, + because it will need to be relocated at run time anyway. */ +# define _elf_set_element(set, symbol) \ + static const void *__elf_set_##set##_element_##symbol##__ \ + __attribute__ ((unused, section (#set))) = &(symbol) +# else +# define _elf_set_element(set, symbol) \ + static const void *const __elf_set_##set##_element_##symbol##__ \ + __attribute__ ((unused, section (#set))) = &(symbol) +# endif + +/* Define SET as a symbol set. This may be required (it is in a.out) to + be able to use the set's contents. */ +# define symbol_set_define(set) symbol_set_declare(set) + +/* Declare SET for use in this module, if defined in another module. */ +# define symbol_set_declare(set) \ + extern void *const __start_##set __attribute__ ((__weak__)); \ + extern void *const __stop_##set __attribute__ ((__weak__)); \ + weak_extern (__start_##set) weak_extern (__stop_##set) + +/* Return a pointer (void *const *) to the first element of SET. */ +# define symbol_set_first_element(set) (&__start_##set) + +/* Return true iff PTR (a void *const *) has been incremented + past the last element in SET. */ +# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set) + +# else /* Not ELF: a.out. */ + +# ifdef HAVE_XCOFF +/* XCOFF does not support .stabs. + The native aix linker will remove the .stab and .stabstr sections + The gnu linker will have a fatal error if there is a relocation for + symbol in the .stab section. Silently disable these macros. */ +# define text_set_element(set, symbol) +# define data_set_element(set, symbol) +# define bss_set_element(set, symbol) +# else +# define text_set_element(set, symbol) \ + asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) +# define data_set_element(set, symbol) \ + asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) +# define bss_set_element(set, symbol) ?error Must use initialized data. +# endif /* XCOFF */ +# define symbol_set_define(set) void *const (set)[1]; +# define symbol_set_declare(set) extern void *const (set)[1]; + +# define symbol_set_first_element(set) &(set)[1] +# define symbol_set_end_p(set, ptr) (*(ptr) == 0) + +# endif /* ELF. */ +#else +/* We cannot do anything in generial. */ +# define text_set_element(set, symbol) asm ("") +# define data_set_element(set, symbol) asm ("") +# define bss_set_element(set, symbol) asm ("") +# define symbol_set_define(set) void *const (set)[1]; +# define symbol_set_declare(set) extern void *const (set)[1]; + +# define symbol_set_first_element(set) &(set)[1] +# define symbol_set_end_p(set, ptr) (*(ptr) == 0) +#endif /* Have GNU ld. */ + +#if DO_VERSIONING +# define symbol_version(real, name, version) \ + _symbol_version(real, name, version) +# define default_symbol_version(real, name, version) \ + _default_symbol_version(real, name, version) +# ifdef __ASSEMBLER__ +# define _symbol_version(real, name, version) \ + .symver real, name##@##version +# define _default_symbol_version(real, name, version) \ + .symver real, name##@##@##version +# else +# define _symbol_version(real, name, version) \ + __asm__ (".symver " #real "," #name "@" #version) +# define _default_symbol_version(real, name, version) \ + __asm__ (".symver " #real "," #name "@@" #version) +# endif +#else +# define symbol_version(real, name, version) +# define default_symbol_version(real, name, version) \ + strong_alias(real, name) +#endif + +#endif /* libc-symbols.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/linuxthreads.texi b/newlib/libc/sys/linux/linuxthreads/linuxthreads.texi new file mode 100644 index 000000000..9513a67a6 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/linuxthreads.texi @@ -0,0 +1,1630 @@ +@node POSIX Threads +@c @node POSIX Threads, , Top, Top +@chapter POSIX Threads +@c %MENU% The standard threads library + +@c This chapter needs more work bigtime. -zw + +This chapter describes the pthreads (POSIX threads) library. This +library provides support functions for multithreaded programs: thread +primitives, synchronization objects, and so forth. It also implements +POSIX 1003.1b semaphores (not to be confused with System V semaphores). + +The threads operations (@samp{pthread_*}) do not use @var{errno}. +Instead they return an error code directly. The semaphore operations do +use @var{errno}. + +@menu +* Basic Thread Operations:: Creating, terminating, and waiting for threads. +* Thread Attributes:: Tuning thread scheduling. +* Cancellation:: Stopping a thread before it's done. +* Cleanup Handlers:: Deallocating resources when a thread is + canceled. +* Mutexes:: One way to synchronize threads. +* Condition Variables:: Another way. +* POSIX Semaphores:: And a third way. +* Thread-Specific Data:: Variables with different values in + different threads. +* Threads and Signal Handling:: Why you should avoid mixing the two, and + how to do it if you must. +* Threads and Fork:: Interactions between threads and the + @code{fork} function. +* Streams and Fork:: Interactions between stdio streams and + @code{fork}. +* Miscellaneous Thread Functions:: A grab bag of utility routines. +@end menu + +@node Basic Thread Operations +@section Basic Thread Operations + +These functions are the thread equivalents of @code{fork}, @code{exit}, +and @code{wait}. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_create (pthread_t * @var{thread}, pthread_attr_t * @var{attr}, void * (*@var{start_routine})(void *), void * @var{arg}) +@code{pthread_create} creates a new thread of control that executes +concurrently with the calling thread. The new thread calls the +function @var{start_routine}, passing it @var{arg} as first argument. The +new thread terminates either explicitly, by calling @code{pthread_exit}, +or implicitly, by returning from the @var{start_routine} function. The +latter case is equivalent to calling @code{pthread_exit} with the result +returned by @var{start_routine} as exit code. + +The @var{attr} argument specifies thread attributes to be applied to the +new thread. @xref{Thread Attributes}, for details. The @var{attr} +argument can also be @code{NULL}, in which case default attributes are +used: the created thread is joinable (not detached) and has an ordinary +(not realtime) scheduling policy. + +On success, the identifier of the newly created thread is stored in the +location pointed by the @var{thread} argument, and a 0 is returned. On +error, a non-zero error code is returned. + +This function may return the following errors: +@table @code +@item EAGAIN +Not enough system resources to create a process for the new thread, +or more than @code{PTHREAD_THREADS_MAX} threads are already active. +@end table +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun void pthread_exit (void *@var{retval}) +@code{pthread_exit} terminates the execution of the calling thread. All +cleanup handlers (@pxref{Cleanup Handlers}) that have been set for the +calling thread with @code{pthread_cleanup_push} are executed in reverse +order (the most recently pushed handler is executed first). Finalization +functions for thread-specific data are then called for all keys that +have non-@code{NULL} values associated with them in the calling thread +(@pxref{Thread-Specific Data}). Finally, execution of the calling +thread is stopped. + +The @var{retval} argument is the return value of the thread. It can be +retrieved from another thread using @code{pthread_join}. + +The @code{pthread_exit} function never returns. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_cancel (pthread_t @var{thread}) + +@code{pthread_cancel} sends a cancellation request to the thread denoted +by the @var{thread} argument. If there is no such thread, +@code{pthread_cancel} fails and returns @code{ESRCH}. Otherwise it +returns 0. @xref{Cancellation}, for details. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_join (pthread_t @var{th}, void **thread_@var{return}) +@code{pthread_join} suspends the execution of the calling thread until +the thread identified by @var{th} terminates, either by calling +@code{pthread_exit} or by being canceled. + +If @var{thread_return} is not @code{NULL}, the return value of @var{th} +is stored in the location pointed to by @var{thread_return}. The return +value of @var{th} is either the argument it gave to @code{pthread_exit}, +or @code{PTHREAD_CANCELED} if @var{th} was canceled. + +The joined thread @code{th} must be in the joinable state: it must not +have been detached using @code{pthread_detach} or the +@code{PTHREAD_CREATE_DETACHED} attribute to @code{pthread_create}. + +When a joinable thread terminates, its memory resources (thread +descriptor and stack) are not deallocated until another thread performs +@code{pthread_join} on it. Therefore, @code{pthread_join} must be called +once for each joinable thread created to avoid memory leaks. + +At most one thread can wait for the termination of a given +thread. Calling @code{pthread_join} on a thread @var{th} on which +another thread is already waiting for termination returns an error. + +@code{pthread_join} is a cancellation point. If a thread is canceled +while suspended in @code{pthread_join}, the thread execution resumes +immediately and the cancellation is executed without waiting for the +@var{th} thread to terminate. If cancellation occurs during +@code{pthread_join}, the @var{th} thread remains not joined. + +On success, the return value of @var{th} is stored in the location +pointed to by @var{thread_return}, and 0 is returned. On error, one of +the following values is returned: +@table @code +@item ESRCH +No thread could be found corresponding to that specified by @var{th}. +@item EINVAL +The @var{th} thread has been detached, or another thread is already +waiting on termination of @var{th}. +@item EDEADLK +The @var{th} argument refers to the calling thread. +@end table +@end deftypefun + +@node Thread Attributes +@section Thread Attributes + +@comment pthread.h +@comment POSIX + +Threads have a number of attributes that may be set at creation time. +This is done by filling a thread attribute object @var{attr} of type +@code{pthread_attr_t}, then passing it as second argument to +@code{pthread_create}. Passing @code{NULL} is equivalent to passing a +thread attribute object with all attributes set to their default values. + +Attribute objects are consulted only when creating a new thread. The +same attribute object can be used for creating several threads. +Modifying an attribute object after a call to @code{pthread_create} does +not change the attributes of the thread previously created. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_attr_init (pthread_attr_t *@var{attr}) +@code{pthread_attr_init} initializes the thread attribute object +@var{attr} and fills it with default values for the attributes. (The +default values are listed below for each attribute.) + +Each attribute @var{attrname} (see below for a list of all attributes) +can be individually set using the function +@code{pthread_attr_set@var{attrname}} and retrieved using the function +@code{pthread_attr_get@var{attrname}}. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_attr_destroy (pthread_attr_t *@var{attr}) +@code{pthread_attr_destroy} destroys the attribute object pointed to by +@var{attr} releasing any resources associated with it. @var{attr} is +left in an undefined state, and you must not use it again in a call to +any pthreads function until it has been reinitialized. +@end deftypefun + +@findex pthread_attr_setdetachstate +@findex pthread_attr_setguardsize +@findex pthread_attr_setinheritsched +@findex pthread_attr_setschedparam +@findex pthread_attr_setschedpolicy +@findex pthread_attr_setscope +@findex pthread_attr_setstack +@findex pthread_attr_setstackaddr +@findex pthread_attr_setstacksize +@comment pthread.h +@comment POSIX +@deftypefun int pthread_attr_setattr (pthread_attr_t *@var{obj}, int @var{value}) +Set attribute @var{attr} to @var{value} in the attribute object pointed +to by @var{obj}. See below for a list of possible attributes and the +values they can take. + +On success, these functions return 0. If @var{value} is not meaningful +for the @var{attr} being modified, they will return the error code +@code{EINVAL}. Some of the functions have other failure modes; see +below. +@end deftypefun + +@findex pthread_attr_getdetachstate +@findex pthread_attr_getguardsize +@findex pthread_attr_getinheritsched +@findex pthread_attr_getschedparam +@findex pthread_attr_getschedpolicy +@findex pthread_attr_getscope +@findex pthread_attr_getstack +@findex pthread_attr_getstackaddr +@findex pthread_attr_getstacksize +@comment pthread.h +@comment POSIX +@deftypefun int pthread_attr_getattr (const pthread_attr_t *@var{obj}, int *@var{value}) +Store the current setting of @var{attr} in @var{obj} into the variable +pointed to by @var{value}. + +These functions always return 0. +@end deftypefun + +The following thread attributes are supported: +@table @samp +@item detachstate +Choose whether the thread is created in the joinable state (value +@code{PTHREAD_CREATE_JOINABLE}) or in the detached state +(@code{PTHREAD_CREATE_DETACHED}). The default is +@code{PTHREAD_CREATE_JOINABLE}. + +In the joinable state, another thread can synchronize on the thread +termination and recover its termination code using @code{pthread_join}, +but some of the thread resources are kept allocated after the thread +terminates, and reclaimed only when another thread performs +@code{pthread_join} on that thread. + +In the detached state, the thread resources are immediately freed when +it terminates, but @code{pthread_join} cannot be used to synchronize on +the thread termination. + +A thread created in the joinable state can later be put in the detached +thread using @code{pthread_detach}. + +@item schedpolicy +Select the scheduling policy for the thread: one of @code{SCHED_OTHER} +(regular, non-realtime scheduling), @code{SCHED_RR} (realtime, +round-robin) or @code{SCHED_FIFO} (realtime, first-in first-out). +The default is @code{SCHED_OTHER}. +@c Not doc'd in our manual: FIXME. +@c See @code{sched_setpolicy} for more information on scheduling policies. + +The realtime scheduling policies @code{SCHED_RR} and @code{SCHED_FIFO} +are available only to processes with superuser privileges. +@code{pthread_attr_setschedparam} will fail and return @code{ENOTSUP} if +you try to set a realtime policy when you are unprivileged. + +The scheduling policy of a thread can be changed after creation with +@code{pthread_setschedparam}. + +@item schedparam +Change the scheduling parameter (the scheduling priority) +for the thread. The default is 0. + +This attribute is not significant if the scheduling policy is +@code{SCHED_OTHER}; it only matters for the realtime policies +@code{SCHED_RR} and @code{SCHED_FIFO}. + +The scheduling priority of a thread can be changed after creation with +@code{pthread_setschedparam}. + +@item inheritsched +Choose whether the scheduling policy and scheduling parameter for the +newly created thread are determined by the values of the +@var{schedpolicy} and @var{schedparam} attributes (value +@code{PTHREAD_EXPLICIT_SCHED}) or are inherited from the parent thread +(value @code{PTHREAD_INHERIT_SCHED}). The default is +@code{PTHREAD_EXPLICIT_SCHED}. + +@item scope +Choose the scheduling contention scope for the created thread. The +default is @code{PTHREAD_SCOPE_SYSTEM}, meaning that the threads contend +for CPU time with all processes running on the machine. In particular, +thread priorities are interpreted relative to the priorities of all +other processes on the machine. The other possibility, +@code{PTHREAD_SCOPE_PROCESS}, means that scheduling contention occurs +only between the threads of the running process: thread priorities are +interpreted relative to the priorities of the other threads of the +process, regardless of the priorities of other processes. + +@code{PTHREAD_SCOPE_PROCESS} is not supported in LinuxThreads. If you +try to set the scope to this value, @code{pthread_attr_setscope} will +fail and return @code{ENOTSUP}. + +@item stackaddr +Provide an address for an application managed stack. The size of the +stack must be at least @code{PTHREAD_STACK_MIN}. + +@item stacksize +Change the size of the stack created for the thread. The value defines +the minimum stack size, in bytes. + +If the value exceeds the system's maximum stack size, or is smaller +than @code{PTHREAD_STACK_MIN}, @code{pthread_attr_setstacksize} will +fail and return @code{EINVAL}. + +@item stack +Provide both the address and size of an application managed stack to +use for the new thread. The base of the memory area is @var{stackaddr} +with the size of the memory area, @var{stacksize}, measured in bytes. + +If the value of @var{stacksize} is less than @code{PTHREAD_STACK_MIN}, +or greater than the system's maximum stack size, or if the value of +@var{stackaddr} lacks the proper alignment, @code{pthread_attr_setstack} +will fail and return @code{EINVAL}. + +@item guardsize +Change the minimum size in bytes of the guard area for the thread's +stack. The default size is a single page. If this value is set, it +will be rounded up to the nearest page size. If the value is set to 0, +a guard area will not be created for this thread. The space allocated +for the guard area is used to catch stack overflow. Therefore, when +allocating large structures on the stack, a larger guard area may be +required to catch a stack overflow. + +If the caller is managing their own stacks (if the @code{stackaddr} +attribute has been set), then the @code{guardsize} attribute is ignored. + +If the value exceeds the @code{stacksize}, @code{pthread_atrr_setguardsize} +will fail and return @code{EINVAL}. +@end table + +@node Cancellation +@section Cancellation + +Cancellation is the mechanism by which a thread can terminate the +execution of another thread. More precisely, a thread can send a +cancellation request to another thread. Depending on its settings, the +target thread can then either ignore the request, honor it immediately, +or defer it till it reaches a cancellation point. When threads are +first created by @code{pthread_create}, they always defer cancellation +requests. + +When a thread eventually honors a cancellation request, it behaves as if +@code{pthread_exit(PTHREAD_CANCELED)} was called. All cleanup handlers +are executed in reverse order, finalization functions for +thread-specific data are called, and finally the thread stops executing. +If the canceled thread was joinable, the return value +@code{PTHREAD_CANCELED} is provided to whichever thread calls +@var{pthread_join} on it. See @code{pthread_exit} for more information. + +Cancellation points are the points where the thread checks for pending +cancellation requests and performs them. The POSIX threads functions +@code{pthread_join}, @code{pthread_cond_wait}, +@code{pthread_cond_timedwait}, @code{pthread_testcancel}, +@code{sem_wait}, and @code{sigwait} are cancellation points. In +addition, these system calls are cancellation points: + +@multitable @columnfractions .33 .33 .33 +@item @t{accept} @tab @t{open} @tab @t{sendmsg} +@item @t{close} @tab @t{pause} @tab @t{sendto} +@item @t{connect} @tab @t{read} @tab @t{system} +@item @t{fcntl} @tab @t{recv} @tab @t{tcdrain} +@item @t{fsync} @tab @t{recvfrom} @tab @t{wait} +@item @t{lseek} @tab @t{recvmsg} @tab @t{waitpid} +@item @t{msync} @tab @t{send} @tab @t{write} +@item @t{nanosleep} +@end multitable + +@noindent +All library functions that call these functions (such as +@code{printf}) are also cancellation points. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_setcancelstate (int @var{state}, int *@var{oldstate}) +@code{pthread_setcancelstate} changes the cancellation state for the +calling thread -- that is, whether cancellation requests are ignored or +not. The @var{state} argument is the new cancellation state: either +@code{PTHREAD_CANCEL_ENABLE} to enable cancellation, or +@code{PTHREAD_CANCEL_DISABLE} to disable cancellation (cancellation +requests are ignored). + +If @var{oldstate} is not @code{NULL}, the previous cancellation state is +stored in the location pointed to by @var{oldstate}, and can thus be +restored later by another call to @code{pthread_setcancelstate}. + +If the @var{state} argument is not @code{PTHREAD_CANCEL_ENABLE} or +@code{PTHREAD_CANCEL_DISABLE}, @code{pthread_setcancelstate} fails and +returns @code{EINVAL}. Otherwise it returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_setcanceltype (int @var{type}, int *@var{oldtype}) +@code{pthread_setcanceltype} changes the type of responses to +cancellation requests for the calling thread: asynchronous (immediate) +or deferred. The @var{type} argument is the new cancellation type: +either @code{PTHREAD_CANCEL_ASYNCHRONOUS} to cancel the calling thread +as soon as the cancellation request is received, or +@code{PTHREAD_CANCEL_DEFERRED} to keep the cancellation request pending +until the next cancellation point. If @var{oldtype} is not @code{NULL}, +the previous cancellation state is stored in the location pointed to by +@var{oldtype}, and can thus be restored later by another call to +@code{pthread_setcanceltype}. + +If the @var{type} argument is not @code{PTHREAD_CANCEL_DEFERRED} or +@code{PTHREAD_CANCEL_ASYNCHRONOUS}, @code{pthread_setcanceltype} fails +and returns @code{EINVAL}. Otherwise it returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun void pthread_testcancel (@var{void}) +@code{pthread_testcancel} does nothing except testing for pending +cancellation and executing it. Its purpose is to introduce explicit +checks for cancellation in long sequences of code that do not call +cancellation point functions otherwise. +@end deftypefun + +@node Cleanup Handlers +@section Cleanup Handlers + +Cleanup handlers are functions that get called when a thread terminates, +either by calling @code{pthread_exit} or because of +cancellation. Cleanup handlers are installed and removed following a +stack-like discipline. + +The purpose of cleanup handlers is to free the resources that a thread +may hold at the time it terminates. In particular, if a thread exits or +is canceled while it owns a locked mutex, the mutex will remain locked +forever and prevent other threads from executing normally. The best way +to avoid this is, just before locking the mutex, to install a cleanup +handler whose effect is to unlock the mutex. Cleanup handlers can be +used similarly to free blocks allocated with @code{malloc} or close file +descriptors on thread termination. + +Here is how to lock a mutex @var{mut} in such a way that it will be +unlocked if the thread is canceled while @var{mut} is locked: + +@smallexample +pthread_cleanup_push(pthread_mutex_unlock, (void *) &mut); +pthread_mutex_lock(&mut); +/* do some work */ +pthread_mutex_unlock(&mut); +pthread_cleanup_pop(0); +@end smallexample + +Equivalently, the last two lines can be replaced by + +@smallexample +pthread_cleanup_pop(1); +@end smallexample + +Notice that the code above is safe only in deferred cancellation mode +(see @code{pthread_setcanceltype}). In asynchronous cancellation mode, a +cancellation can occur between @code{pthread_cleanup_push} and +@code{pthread_mutex_lock}, or between @code{pthread_mutex_unlock} and +@code{pthread_cleanup_pop}, resulting in both cases in the thread trying +to unlock a mutex not locked by the current thread. This is the main +reason why asynchronous cancellation is difficult to use. + +If the code above must also work in asynchronous cancellation mode, +then it must switch to deferred mode for locking and unlocking the +mutex: + +@smallexample +pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); +pthread_cleanup_push(pthread_mutex_unlock, (void *) &mut); +pthread_mutex_lock(&mut); +/* do some work */ +pthread_cleanup_pop(1); +pthread_setcanceltype(oldtype, NULL); +@end smallexample + +The code above can be rewritten in a more compact and efficient way, +using the non-portable functions @code{pthread_cleanup_push_defer_np} +and @code{pthread_cleanup_pop_restore_np}: + +@smallexample +pthread_cleanup_push_defer_np(pthread_mutex_unlock, (void *) &mut); +pthread_mutex_lock(&mut); +/* do some work */ +pthread_cleanup_pop_restore_np(1); +@end smallexample + +@comment pthread.h +@comment POSIX +@deftypefun void pthread_cleanup_push (void (*@var{routine}) (void *), void *@var{arg}) + +@code{pthread_cleanup_push} installs the @var{routine} function with +argument @var{arg} as a cleanup handler. From this point on to the +matching @code{pthread_cleanup_pop}, the function @var{routine} will be +called with arguments @var{arg} when the thread terminates, either +through @code{pthread_exit} or by cancellation. If several cleanup +handlers are active at that point, they are called in LIFO order: the +most recently installed handler is called first. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun void pthread_cleanup_pop (int @var{execute}) +@code{pthread_cleanup_pop} removes the most recently installed cleanup +handler. If the @var{execute} argument is not 0, it also executes the +handler, by calling the @var{routine} function with arguments +@var{arg}. If the @var{execute} argument is 0, the handler is only +removed but not executed. +@end deftypefun + +Matching pairs of @code{pthread_cleanup_push} and +@code{pthread_cleanup_pop} must occur in the same function, at the same +level of block nesting. Actually, @code{pthread_cleanup_push} and +@code{pthread_cleanup_pop} are macros, and the expansion of +@code{pthread_cleanup_push} introduces an open brace @code{@{} with the +matching closing brace @code{@}} being introduced by the expansion of the +matching @code{pthread_cleanup_pop}. + +@comment pthread.h +@comment GNU +@deftypefun void pthread_cleanup_push_defer_np (void (*@var{routine}) (void *), void *@var{arg}) +@code{pthread_cleanup_push_defer_np} is a non-portable extension that +combines @code{pthread_cleanup_push} and @code{pthread_setcanceltype}. +It pushes a cleanup handler just as @code{pthread_cleanup_push} does, +but also saves the current cancellation type and sets it to deferred +cancellation. This ensures that the cleanup mechanism is effective even +if the thread was initially in asynchronous cancellation mode. +@end deftypefun + +@comment pthread.h +@comment GNU +@deftypefun void pthread_cleanup_pop_restore_np (int @var{execute}) +@code{pthread_cleanup_pop_restore_np} pops a cleanup handler introduced +by @code{pthread_cleanup_push_defer_np}, and restores the cancellation +type to its value at the time @code{pthread_cleanup_push_defer_np} was +called. +@end deftypefun + +@code{pthread_cleanup_push_defer_np} and +@code{pthread_cleanup_pop_restore_np} must occur in matching pairs, at +the same level of block nesting. + +The sequence + +@smallexample +pthread_cleanup_push_defer_np(routine, arg); +... +pthread_cleanup_pop_defer_np(execute); +@end smallexample + +@noindent +is functionally equivalent to (but more compact and efficient than) + +@smallexample +@{ + int oldtype; + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); + pthread_cleanup_push(routine, arg); + ... + pthread_cleanup_pop(execute); + pthread_setcanceltype(oldtype, NULL); +@} +@end smallexample + + +@node Mutexes +@section Mutexes + +A mutex is a MUTual EXclusion device, and is useful for protecting +shared data structures from concurrent modifications, and implementing +critical sections and monitors. + +A mutex has two possible states: unlocked (not owned by any thread), +and locked (owned by one thread). A mutex can never be owned by two +different threads simultaneously. A thread attempting to lock a mutex +that is already locked by another thread is suspended until the owning +thread unlocks the mutex first. + +None of the mutex functions is a cancellation point, not even +@code{pthread_mutex_lock}, in spite of the fact that it can suspend a +thread for arbitrary durations. This way, the status of mutexes at +cancellation points is predictable, allowing cancellation handlers to +unlock precisely those mutexes that need to be unlocked before the +thread stops executing. Consequently, threads using deferred +cancellation should never hold a mutex for extended periods of time. + +It is not safe to call mutex functions from a signal handler. In +particular, calling @code{pthread_mutex_lock} or +@code{pthread_mutex_unlock} from a signal handler may deadlock the +calling thread. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutex_init (pthread_mutex_t *@var{mutex}, const pthread_mutexattr_t *@var{mutexattr}) + +@code{pthread_mutex_init} initializes the mutex object pointed to by +@var{mutex} according to the mutex attributes specified in @var{mutexattr}. +If @var{mutexattr} is @code{NULL}, default attributes are used instead. + +The LinuxThreads implementation supports only one mutex attribute, +the @var{mutex type}, which is either ``fast'', ``recursive'', or +``error checking''. The type of a mutex determines whether +it can be locked again by a thread that already owns it. +The default type is ``fast''. + +Variables of type @code{pthread_mutex_t} can also be initialized +statically, using the constants @code{PTHREAD_MUTEX_INITIALIZER} (for +timed mutexes), @code{PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP} (for +recursive mutexes), @code{PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP} +(for fast mutexes(, and @code{PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP} +(for error checking mutexes). + +@code{pthread_mutex_init} always returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutex_lock (pthread_mutex_t *mutex)) +@code{pthread_mutex_lock} locks the given mutex. If the mutex is +currently unlocked, it becomes locked and owned by the calling thread, +and @code{pthread_mutex_lock} returns immediately. If the mutex is +already locked by another thread, @code{pthread_mutex_lock} suspends the +calling thread until the mutex is unlocked. + +If the mutex is already locked by the calling thread, the behavior of +@code{pthread_mutex_lock} depends on the type of the mutex. If the mutex +is of the ``fast'' type, the calling thread is suspended. It will +remain suspended forever, because no other thread can unlock the mutex. +If the mutex is of the ``error checking'' type, @code{pthread_mutex_lock} +returns immediately with the error code @code{EDEADLK}. If the mutex is +of the ``recursive'' type, @code{pthread_mutex_lock} succeeds and +returns immediately, recording the number of times the calling thread +has locked the mutex. An equal number of @code{pthread_mutex_unlock} +operations must be performed before the mutex returns to the unlocked +state. +@c This doesn't discuss PTHREAD_MUTEX_TIMED_NP mutex attributes. FIXME +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutex_trylock (pthread_mutex_t *@var{mutex}) +@code{pthread_mutex_trylock} behaves identically to +@code{pthread_mutex_lock}, except that it does not block the calling +thread if the mutex is already locked by another thread (or by the +calling thread in the case of a ``fast'' mutex). Instead, +@code{pthread_mutex_trylock} returns immediately with the error code +@code{EBUSY}. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutex_timedlock (pthread_mutex_t *@var{mutex}, const struct timespec *@var{abstime}) +The @code{pthread_mutex_timedlock} is similar to the +@code{pthread_mutex_lock} function but instead of blocking for in +indefinite time if the mutex is locked by another thread, it returns +when the time specified in @var{abstime} is reached. + +This function can only be used on standard (``timed'') and ``error +checking'' mutexes. It behaves just like @code{pthread_mutex_lock} for +all other types. + +If the mutex is successfully locked, the function returns zero. If the +time specified in @var{abstime} is reached without the mutex being locked, +@code{ETIMEDOUT} is returned. + +This function was introduced in the POSIX.1d revision of the POSIX standard. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutex_unlock (pthread_mutex_t *@var{mutex}) +@code{pthread_mutex_unlock} unlocks the given mutex. The mutex is +assumed to be locked and owned by the calling thread on entrance to +@code{pthread_mutex_unlock}. If the mutex is of the ``fast'' type, +@code{pthread_mutex_unlock} always returns it to the unlocked state. If +it is of the ``recursive'' type, it decrements the locking count of the +mutex (number of @code{pthread_mutex_lock} operations performed on it by +the calling thread), and only when this count reaches zero is the mutex +actually unlocked. + +On ``error checking'' mutexes, @code{pthread_mutex_unlock} actually +checks at run-time that the mutex is locked on entrance, and that it was +locked by the same thread that is now calling +@code{pthread_mutex_unlock}. If these conditions are not met, +@code{pthread_mutex_unlock} returns @code{EPERM}, and the mutex remains +unchanged. ``Fast'' and ``recursive'' mutexes perform no such checks, +thus allowing a locked mutex to be unlocked by a thread other than its +owner. This is non-portable behavior and must not be relied upon. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutex_destroy (pthread_mutex_t *@var{mutex}) +@code{pthread_mutex_destroy} destroys a mutex object, freeing the +resources it might hold. The mutex must be unlocked on entrance. In the +LinuxThreads implementation, no resources are associated with mutex +objects, thus @code{pthread_mutex_destroy} actually does nothing except +checking that the mutex is unlocked. + +If the mutex is locked by some thread, @code{pthread_mutex_destroy} +returns @code{EBUSY}. Otherwise it returns 0. +@end deftypefun + +If any of the above functions (except @code{pthread_mutex_init}) +is applied to an uninitialized mutex, they will simply return +@code{EINVAL} and do nothing. + +A shared global variable @var{x} can be protected by a mutex as follows: + +@smallexample +int x; +pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; +@end smallexample + +All accesses and modifications to @var{x} should be bracketed by calls to +@code{pthread_mutex_lock} and @code{pthread_mutex_unlock} as follows: + +@smallexample +pthread_mutex_lock(&mut); +/* operate on x */ +pthread_mutex_unlock(&mut); +@end smallexample + +Mutex attributes can be specified at mutex creation time, by passing a +mutex attribute object as second argument to @code{pthread_mutex_init}. +Passing @code{NULL} is equivalent to passing a mutex attribute object +with all attributes set to their default values. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutexattr_init (pthread_mutexattr_t *@var{attr}) +@code{pthread_mutexattr_init} initializes the mutex attribute object +@var{attr} and fills it with default values for the attributes. + +This function always returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutexattr_destroy (pthread_mutexattr_t *@var{attr}) +@code{pthread_mutexattr_destroy} destroys a mutex attribute object, +which must not be reused until it is +reinitialized. @code{pthread_mutexattr_destroy} does nothing in the +LinuxThreads implementation. + +This function always returns 0. +@end deftypefun + +LinuxThreads supports only one mutex attribute: the mutex type, which is +either @code{PTHREAD_MUTEX_ADAPTIVE_NP} for ``fast'' mutexes, +@code{PTHREAD_MUTEX_RECURSIVE_NP} for ``recursive'' mutexes, +@code{PTHREAD_MUTEX_TIMED_NP} for ``timed'' mutexes, or +@code{PTHREAD_MUTEX_ERRORCHECK_NP} for ``error checking'' mutexes. As +the @code{NP} suffix indicates, this is a non-portable extension to the +POSIX standard and should not be employed in portable programs. + +The mutex type determines what happens if a thread attempts to lock a +mutex it already owns with @code{pthread_mutex_lock}. If the mutex is of +the ``fast'' type, @code{pthread_mutex_lock} simply suspends the calling +thread forever. If the mutex is of the ``error checking'' type, +@code{pthread_mutex_lock} returns immediately with the error code +@code{EDEADLK}. If the mutex is of the ``recursive'' type, the call to +@code{pthread_mutex_lock} returns immediately with a success return +code. The number of times the thread owning the mutex has locked it is +recorded in the mutex. The owning thread must call +@code{pthread_mutex_unlock} the same number of times before the mutex +returns to the unlocked state. + +The default mutex type is ``timed'', that is, @code{PTHREAD_MUTEX_TIMED_NP}. +@c This doesn't describe how a ``timed'' mutex behaves. FIXME + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutexattr_settype (pthread_mutexattr_t *@var{attr}, int @var{type}) +@code{pthread_mutexattr_settype} sets the mutex type attribute in +@var{attr} to the value specified by @var{type}. + +If @var{type} is not @code{PTHREAD_MUTEX_ADAPTIVE_NP}, +@code{PTHREAD_MUTEX_RECURSIVE_NP}, @code{PTHREAD_MUTEX_TIMED_NP}, or +@code{PTHREAD_MUTEX_ERRORCHECK_NP}, this function will return +@code{EINVAL} and leave @var{attr} unchanged. + +The standard Unix98 identifiers @code{PTHREAD_MUTEX_DEFAULT}, +@code{PTHREAD_MUTEX_NORMAL}, @code{PTHREAD_MUTEX_RECURSIVE}, +and @code{PTHREAD_MUTEX_ERRORCHECK} are also permitted. + +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_mutexattr_gettype (const pthread_mutexattr_t *@var{attr}, int *@var{type}) +@code{pthread_mutexattr_gettype} retrieves the current value of the +mutex type attribute in @var{attr} and stores it in the location pointed +to by @var{type}. + +This function always returns 0. +@end deftypefun + +@node Condition Variables +@section Condition Variables + +A condition (short for ``condition variable'') is a synchronization +device that allows threads to suspend execution until some predicate on +shared data is satisfied. The basic operations on conditions are: signal +the condition (when the predicate becomes true), and wait for the +condition, suspending the thread execution until another thread signals +the condition. + +A condition variable must always be associated with a mutex, to avoid +the race condition where a thread prepares to wait on a condition +variable and another thread signals the condition just before the first +thread actually waits on it. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_cond_init (pthread_cond_t *@var{cond}, pthread_condattr_t *cond_@var{attr}) + +@code{pthread_cond_init} initializes the condition variable @var{cond}, +using the condition attributes specified in @var{cond_attr}, or default +attributes if @var{cond_attr} is @code{NULL}. The LinuxThreads +implementation supports no attributes for conditions, hence the +@var{cond_attr} parameter is actually ignored. + +Variables of type @code{pthread_cond_t} can also be initialized +statically, using the constant @code{PTHREAD_COND_INITIALIZER}. + +This function always returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_cond_signal (pthread_cond_t *@var{cond}) +@code{pthread_cond_signal} restarts one of the threads that are waiting +on the condition variable @var{cond}. If no threads are waiting on +@var{cond}, nothing happens. If several threads are waiting on +@var{cond}, exactly one is restarted, but it is not specified which. + +This function always returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_cond_broadcast (pthread_cond_t *@var{cond}) +@code{pthread_cond_broadcast} restarts all the threads that are waiting +on the condition variable @var{cond}. Nothing happens if no threads are +waiting on @var{cond}. + +This function always returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_cond_wait (pthread_cond_t *@var{cond}, pthread_mutex_t *@var{mutex}) +@code{pthread_cond_wait} atomically unlocks the @var{mutex} (as per +@code{pthread_unlock_mutex}) and waits for the condition variable +@var{cond} to be signaled. The thread execution is suspended and does +not consume any CPU time until the condition variable is signaled. The +@var{mutex} must be locked by the calling thread on entrance to +@code{pthread_cond_wait}. Before returning to the calling thread, +@code{pthread_cond_wait} re-acquires @var{mutex} (as per +@code{pthread_lock_mutex}). + +Unlocking the mutex and suspending on the condition variable is done +atomically. Thus, if all threads always acquire the mutex before +signaling the condition, this guarantees that the condition cannot be +signaled (and thus ignored) between the time a thread locks the mutex +and the time it waits on the condition variable. + +This function always returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_cond_timedwait (pthread_cond_t *@var{cond}, pthread_mutex_t *@var{mutex}, const struct timespec *@var{abstime}) +@code{pthread_cond_timedwait} atomically unlocks @var{mutex} and waits +on @var{cond}, as @code{pthread_cond_wait} does, but it also bounds the +duration of the wait. If @var{cond} has not been signaled before time +@var{abstime}, the mutex @var{mutex} is re-acquired and +@code{pthread_cond_timedwait} returns the error code @code{ETIMEDOUT}. +The wait can also be interrupted by a signal; in that case +@code{pthread_cond_timedwait} returns @code{EINTR}. + +The @var{abstime} parameter specifies an absolute time, with the same +origin as @code{time} and @code{gettimeofday}: an @var{abstime} of 0 +corresponds to 00:00:00 GMT, January 1, 1970. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_cond_destroy (pthread_cond_t *@var{cond}) +@code{pthread_cond_destroy} destroys the condition variable @var{cond}, +freeing the resources it might hold. If any threads are waiting on the +condition variable, @code{pthread_cond_destroy} leaves @var{cond} +untouched and returns @code{EBUSY}. Otherwise it returns 0, and +@var{cond} must not be used again until it is reinitialized. + +In the LinuxThreads implementation, no resources are associated with +condition variables, so @code{pthread_cond_destroy} actually does +nothing. +@end deftypefun + +@code{pthread_cond_wait} and @code{pthread_cond_timedwait} are +cancellation points. If a thread is canceled while suspended in one of +these functions, the thread immediately resumes execution, relocks the +mutex specified by @var{mutex}, and finally executes the cancellation. +Consequently, cleanup handlers are assured that @var{mutex} is locked +when they are called. + +It is not safe to call the condition variable functions from a signal +handler. In particular, calling @code{pthread_cond_signal} or +@code{pthread_cond_broadcast} from a signal handler may deadlock the +calling thread. + +Consider two shared variables @var{x} and @var{y}, protected by the +mutex @var{mut}, and a condition variable @var{cond} that is to be +signaled whenever @var{x} becomes greater than @var{y}. + +@smallexample +int x,y; +pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; +pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +@end smallexample + +Waiting until @var{x} is greater than @var{y} is performed as follows: + +@smallexample +pthread_mutex_lock(&mut); +while (x <= y) @{ + pthread_cond_wait(&cond, &mut); +@} +/* operate on x and y */ +pthread_mutex_unlock(&mut); +@end smallexample + +Modifications on @var{x} and @var{y} that may cause @var{x} to become greater than +@var{y} should signal the condition if needed: + +@smallexample +pthread_mutex_lock(&mut); +/* modify x and y */ +if (x > y) pthread_cond_broadcast(&cond); +pthread_mutex_unlock(&mut); +@end smallexample + +If it can be proved that at most one waiting thread needs to be waken +up (for instance, if there are only two threads communicating through +@var{x} and @var{y}), @code{pthread_cond_signal} can be used as a slightly more +efficient alternative to @code{pthread_cond_broadcast}. In doubt, use +@code{pthread_cond_broadcast}. + +To wait for @var{x} to becomes greater than @var{y} with a timeout of 5 +seconds, do: + +@smallexample +struct timeval now; +struct timespec timeout; +int retcode; + +pthread_mutex_lock(&mut); +gettimeofday(&now); +timeout.tv_sec = now.tv_sec + 5; +timeout.tv_nsec = now.tv_usec * 1000; +retcode = 0; +while (x <= y && retcode != ETIMEDOUT) @{ + retcode = pthread_cond_timedwait(&cond, &mut, &timeout); +@} +if (retcode == ETIMEDOUT) @{ + /* timeout occurred */ +@} else @{ + /* operate on x and y */ +@} +pthread_mutex_unlock(&mut); +@end smallexample + +Condition attributes can be specified at condition creation time, by +passing a condition attribute object as second argument to +@code{pthread_cond_init}. Passing @code{NULL} is equivalent to passing +a condition attribute object with all attributes set to their default +values. + +The LinuxThreads implementation supports no attributes for +conditions. The functions on condition attributes are included only for +compliance with the POSIX standard. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_condattr_init (pthread_condattr_t *@var{attr}) +@deftypefunx int pthread_condattr_destroy (pthread_condattr_t *@var{attr}) +@code{pthread_condattr_init} initializes the condition attribute object +@var{attr} and fills it with default values for the attributes. +@code{pthread_condattr_destroy} destroys the condition attribute object +@var{attr}. + +Both functions do nothing in the LinuxThreads implementation. + +@code{pthread_condattr_init} and @code{pthread_condattr_destroy} always +return 0. +@end deftypefun + +@node POSIX Semaphores +@section POSIX Semaphores + +@vindex SEM_VALUE_MAX +Semaphores are counters for resources shared between threads. The +basic operations on semaphores are: increment the counter atomically, +and wait until the counter is non-null and decrement it atomically. + +Semaphores have a maximum value past which they cannot be incremented. +The macro @code{SEM_VALUE_MAX} is defined to be this maximum value. In +the GNU C library, @code{SEM_VALUE_MAX} is equal to @code{INT_MAX} +(@pxref{Range of Type}), but it may be much smaller on other systems. + +The pthreads library implements POSIX 1003.1b semaphores. These should +not be confused with System V semaphores (@code{ipc}, @code{semctl} and +@code{semop}). +@c !!! SysV IPC is not doc'd at all in our manual + +All the semaphore functions and macros are defined in @file{semaphore.h}. + +@comment semaphore.h +@comment POSIX +@deftypefun int sem_init (sem_t *@var{sem}, int @var{pshared}, unsigned int @var{value}) +@code{sem_init} initializes the semaphore object pointed to by +@var{sem}. The count associated with the semaphore is set initially to +@var{value}. The @var{pshared} argument indicates whether the semaphore +is local to the current process (@var{pshared} is zero) or is to be +shared between several processes (@var{pshared} is not zero). + +On success @code{sem_init} returns 0. On failure it returns -1 and sets +@var{errno} to one of the following values: + +@table @code +@item EINVAL +@var{value} exceeds the maximal counter value @code{SEM_VALUE_MAX} + +@item ENOSYS +@var{pshared} is not zero. LinuxThreads currently does not support +process-shared semaphores. (This will eventually change.) +@end table +@end deftypefun + +@comment semaphore.h +@comment POSIX +@deftypefun int sem_destroy (sem_t * @var{sem}) +@code{sem_destroy} destroys a semaphore object, freeing the resources it +might hold. If any threads are waiting on the semaphore when +@code{sem_destroy} is called, it fails and sets @var{errno} to +@code{EBUSY}. + +In the LinuxThreads implementation, no resources are associated with +semaphore objects, thus @code{sem_destroy} actually does nothing except +checking that no thread is waiting on the semaphore. This will change +when process-shared semaphores are implemented. +@end deftypefun + +@comment semaphore.h +@comment POSIX +@deftypefun int sem_wait (sem_t * @var{sem}) +@code{sem_wait} suspends the calling thread until the semaphore pointed +to by @var{sem} has non-zero count. It then atomically decreases the +semaphore count. + +@code{sem_wait} is a cancellation point. It always returns 0. +@end deftypefun + +@comment semaphore.h +@comment POSIX +@deftypefun int sem_trywait (sem_t * @var{sem}) +@code{sem_trywait} is a non-blocking variant of @code{sem_wait}. If the +semaphore pointed to by @var{sem} has non-zero count, the count is +atomically decreased and @code{sem_trywait} immediately returns 0. If +the semaphore count is zero, @code{sem_trywait} immediately returns -1 +and sets errno to @code{EAGAIN}. +@end deftypefun + +@comment semaphore.h +@comment POSIX +@deftypefun int sem_post (sem_t * @var{sem}) +@code{sem_post} atomically increases the count of the semaphore pointed to +by @var{sem}. This function never blocks. + +@c !!! This para appears not to agree with the code. +On processors supporting atomic compare-and-swap (Intel 486, Pentium and +later, Alpha, PowerPC, MIPS II, Motorola 68k, Ultrasparc), the +@code{sem_post} function is can safely be called from signal handlers. +This is the only thread synchronization function provided by POSIX +threads that is async-signal safe. On the Intel 386 and earlier Sparc +chips, the current LinuxThreads implementation of @code{sem_post} is not +async-signal safe, because the hardware does not support the required +atomic operations. + +@code{sem_post} always succeeds and returns 0, unless the semaphore +count would exceed @code{SEM_VALUE_MAX} after being incremented. In +that case @code{sem_post} returns -1 and sets @var{errno} to +@code{EINVAL}. The semaphore count is left unchanged. +@end deftypefun + +@comment semaphore.h +@comment POSIX +@deftypefun int sem_getvalue (sem_t * @var{sem}, int * @var{sval}) +@code{sem_getvalue} stores in the location pointed to by @var{sval} the +current count of the semaphore @var{sem}. It always returns 0. +@end deftypefun + +@node Thread-Specific Data +@section Thread-Specific Data + +Programs often need global or static variables that have different +values in different threads. Since threads share one memory space, this +cannot be achieved with regular variables. Thread-specific data is the +POSIX threads answer to this need. + +Each thread possesses a private memory block, the thread-specific data +area, or TSD area for short. This area is indexed by TSD keys. The TSD +area associates values of type @code{void *} to TSD keys. TSD keys are +common to all threads, but the value associated with a given TSD key can +be different in each thread. + +For concreteness, the TSD areas can be viewed as arrays of @code{void *} +pointers, TSD keys as integer indices into these arrays, and the value +of a TSD key as the value of the corresponding array element in the +calling thread. + +When a thread is created, its TSD area initially associates @code{NULL} +with all keys. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_key_create (pthread_key_t *@var{key}, void (*destr_function) (void *)) +@code{pthread_key_create} allocates a new TSD key. The key is stored in +the location pointed to by @var{key}. There is a limit of +@code{PTHREAD_KEYS_MAX} on the number of keys allocated at a given +time. The value initially associated with the returned key is +@code{NULL} in all currently executing threads. + +The @var{destr_function} argument, if not @code{NULL}, specifies a +destructor function associated with the key. When a thread terminates +via @code{pthread_exit} or by cancellation, @var{destr_function} is +called on the value associated with the key in that thread. The +@var{destr_function} is not called if a key is deleted with +@code{pthread_key_delete} or a value is changed with +@code{pthread_setspecific}. The order in which destructor functions are +called at thread termination time is unspecified. + +Before the destructor function is called, the @code{NULL} value is +associated with the key in the current thread. A destructor function +might, however, re-associate non-@code{NULL} values to that key or some +other key. To deal with this, if after all the destructors have been +called for all non-@code{NULL} values, there are still some +non-@code{NULL} values with associated destructors, then the process is +repeated. The LinuxThreads implementation stops the process after +@code{PTHREAD_DESTRUCTOR_ITERATIONS} iterations, even if some +non-@code{NULL} values with associated descriptors remain. Other +implementations may loop indefinitely. + +@code{pthread_key_create} returns 0 unless @code{PTHREAD_KEYS_MAX} keys +have already been allocated, in which case it fails and returns +@code{EAGAIN}. +@end deftypefun + + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_key_delete (pthread_key_t @var{key}) +@code{pthread_key_delete} deallocates a TSD key. It does not check +whether non-@code{NULL} values are associated with that key in the +currently executing threads, nor call the destructor function associated +with the key. + +If there is no such key @var{key}, it returns @code{EINVAL}. Otherwise +it returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_setspecific (pthread_key_t @var{key}, const void *@var{pointer}) +@code{pthread_setspecific} changes the value associated with @var{key} +in the calling thread, storing the given @var{pointer} instead. + +If there is no such key @var{key}, it returns @code{EINVAL}. Otherwise +it returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun {void *} pthread_getspecific (pthread_key_t @var{key}) +@code{pthread_getspecific} returns the value currently associated with +@var{key} in the calling thread. + +If there is no such key @var{key}, it returns @code{NULL}. +@end deftypefun + +The following code fragment allocates a thread-specific array of 100 +characters, with automatic reclaimation at thread exit: + +@smallexample +/* Key for the thread-specific buffer */ +static pthread_key_t buffer_key; + +/* Once-only initialisation of the key */ +static pthread_once_t buffer_key_once = PTHREAD_ONCE_INIT; + +/* Allocate the thread-specific buffer */ +void buffer_alloc(void) +@{ + pthread_once(&buffer_key_once, buffer_key_alloc); + pthread_setspecific(buffer_key, malloc(100)); +@} + +/* Return the thread-specific buffer */ +char * get_buffer(void) +@{ + return (char *) pthread_getspecific(buffer_key); +@} + +/* Allocate the key */ +static void buffer_key_alloc() +@{ + pthread_key_create(&buffer_key, buffer_destroy); +@} + +/* Free the thread-specific buffer */ +static void buffer_destroy(void * buf) +@{ + free(buf); +@} +@end smallexample + +@node Threads and Signal Handling +@section Threads and Signal Handling + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_sigmask (int @var{how}, const sigset_t *@var{newmask}, sigset_t *@var{oldmask}) +@code{pthread_sigmask} changes the signal mask for the calling thread as +described by the @var{how} and @var{newmask} arguments. If @var{oldmask} +is not @code{NULL}, the previous signal mask is stored in the location +pointed to by @var{oldmask}. + +The meaning of the @var{how} and @var{newmask} arguments is the same as +for @code{sigprocmask}. If @var{how} is @code{SIG_SETMASK}, the signal +mask is set to @var{newmask}. If @var{how} is @code{SIG_BLOCK}, the +signals specified to @var{newmask} are added to the current signal mask. +If @var{how} is @code{SIG_UNBLOCK}, the signals specified to +@var{newmask} are removed from the current signal mask. + +Recall that signal masks are set on a per-thread basis, but signal +actions and signal handlers, as set with @code{sigaction}, are shared +between all threads. + +The @code{pthread_sigmask} function returns 0 on success, and one of the +following error codes on error: +@table @code +@item EINVAL +@var{how} is not one of @code{SIG_SETMASK}, @code{SIG_BLOCK}, or @code{SIG_UNBLOCK} + +@item EFAULT +@var{newmask} or @var{oldmask} point to invalid addresses +@end table +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_kill (pthread_t @var{thread}, int @var{signo}) +@code{pthread_kill} sends signal number @var{signo} to the thread +@var{thread}. The signal is delivered and handled as described in +@ref{Signal Handling}. + +@code{pthread_kill} returns 0 on success, one of the following error codes +on error: +@table @code +@item EINVAL +@var{signo} is not a valid signal number + +@item ESRCH +The thread @var{thread} does not exist (e.g. it has already terminated) +@end table +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int sigwait (const sigset_t *@var{set}, int *@var{sig}) +@code{sigwait} suspends the calling thread until one of the signals in +@var{set} is delivered to the calling thread. It then stores the number +of the signal received in the location pointed to by @var{sig} and +returns. The signals in @var{set} must be blocked and not ignored on +entrance to @code{sigwait}. If the delivered signal has a signal handler +function attached, that function is @emph{not} called. + +@code{sigwait} is a cancellation point. It always returns 0. +@end deftypefun + +For @code{sigwait} to work reliably, the signals being waited for must be +blocked in all threads, not only in the calling thread, since +otherwise the POSIX semantics for signal delivery do not guarantee +that it's the thread doing the @code{sigwait} that will receive the signal. +The best way to achieve this is block those signals before any threads +are created, and never unblock them in the program other than by +calling @code{sigwait}. + +Signal handling in LinuxThreads departs significantly from the POSIX +standard. According to the standard, ``asynchronous'' (external) signals +are addressed to the whole process (the collection of all threads), +which then delivers them to one particular thread. The thread that +actually receives the signal is any thread that does not currently block +the signal. + +In LinuxThreads, each thread is actually a kernel process with its own +PID, so external signals are always directed to one particular thread. +If, for instance, another thread is blocked in @code{sigwait} on that +signal, it will not be restarted. + +The LinuxThreads implementation of @code{sigwait} installs dummy signal +handlers for the signals in @var{set} for the duration of the +wait. Since signal handlers are shared between all threads, other +threads must not attach their own signal handlers to these signals, or +alternatively they should all block these signals (which is recommended +anyway). + +@node Threads and Fork +@section Threads and Fork + +It's not intuitively obvious what should happen when a multi-threaded POSIX +process calls @code{fork}. Not only are the semantics tricky, but you may +need to write code that does the right thing at fork time even if that code +doesn't use the @code{fork} function. Moreover, you need to be aware of +interaction between @code{fork} and some library features like +@code{pthread_once} and stdio streams. + +When @code{fork} is called by one of the threads of a process, it creates a new +process which is copy of the calling process. Effectively, in addition to +copying certain system objects, the function takes a snapshot of the memory +areas of the parent process, and creates identical areas in the child. +To make matters more complicated, with threads it's possible for two or more +threads to concurrently call fork to create two or more child processes. + +The child process has a copy of the address space of the parent, but it does +not inherit any of its threads. Execution of the child process is carried out +by a new thread which returns from @code{fork} function with a return value of +zero; it is the only thread in the child process. Because threads are not +inherited across fork, issues arise. At the time of the call to @code{fork}, +threads in the parent process other than the one calling @code{fork} may have +been executing critical regions of code. As a result, the child process may +get a copy of objects that are not in a well-defined state. This potential +problem affects all components of the program. + +Any program component which will continue being used in a child process must +correctly handle its state during @code{fork}. For this purpose, the POSIX +interface provides the special function @code{pthread_atfork} for installing +pointers to handler functions which are called from within @code{fork}. + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_atfork (void (*@var{prepare})(void), void (*@var{parent})(void), void (*@var{child})(void)) + +@code{pthread_atfork} registers handler functions to be called just +before and just after a new process is created with @code{fork}. The +@var{prepare} handler will be called from the parent process, just +before the new process is created. The @var{parent} handler will be +called from the parent process, just before @code{fork} returns. The +@var{child} handler will be called from the child process, just before +@code{fork} returns. + +@code{pthread_atfork} returns 0 on success and a non-zero error code on +error. + +One or more of the three handlers @var{prepare}, @var{parent} and +@var{child} can be given as @code{NULL}, meaning that no handler needs +to be called at the corresponding point. + +@code{pthread_atfork} can be called several times to install several +sets of handlers. At @code{fork} time, the @var{prepare} handlers are +called in LIFO order (last added with @code{pthread_atfork}, first +called before @code{fork}), while the @var{parent} and @var{child} +handlers are called in FIFO order (first added, first called). + +If there is insufficient memory available to register the handlers, +@code{pthread_atfork} fails and returns @code{ENOMEM}. Otherwise it +returns 0. + +The functions @code{fork} and @code{pthread_atfork} must not be regarded as +reentrant from the context of the handlers. That is to say, if a +@code{pthread_atfork} handler invoked from within @code{fork} calls +@code{pthread_atfork} or @code{fork}, the behavior is undefined. + +Registering a triplet of handlers is an atomic operation with respect to fork. +If new handlers are registered at about the same time as a fork occurs, either +all three handlers will be called, or none of them will be called. + +The handlers are inherited by the child process, and there is no +way to remove them, short of using @code{exec} to load a new +pocess image. + +@end deftypefun + +To understand the purpose of @code{pthread_atfork}, recall that +@code{fork} duplicates the whole memory space, including mutexes in +their current locking state, but only the calling thread: other threads +are not running in the child process. Thus, if a mutex is locked by a +thread other than the thread calling @code{fork}, that mutex will remain +locked forever in the child process, possibly blocking the execution of +the child process. Or if some shared data, such as a linked list, was in the +middle of being updated by a thread in the parent process, the child +will get a copy of the incompletely updated data which it cannot use. + +To avoid this, install handlers with @code{pthread_atfork} as follows: have the +@var{prepare} handler lock the mutexes (in locking order), and the +@var{parent} handler unlock the mutexes. The @var{child} handler should reset +the mutexes using @code{pthread_mutex_init}, as well as any other +synchronization objects such as condition variables. + +Locking the global mutexes before the fork ensures that all other threads are +locked out of the critical regions of code protected by those mutexes. Thus +when @code{fork} takes a snapshot of the parent's address space, that snapshot +will copy valid, stable data. Resetting the synchronization objects in the +child process will ensure they are properly cleansed of any artifacts from the +threading subsystem of the parent process. For example, a mutex may inherit +a wait queue of threads waiting for the lock; this wait queue makes no sense +in the child process. Initializing the mutex takes care of this. + +@node Streams and Fork +@section Streams and Fork + +The GNU standard I/O library has an internal mutex which guards the internal +linked list of all standard C FILE objects. This mutex is properly taken care +of during @code{fork} so that the child receives an intact copy of the list. +This allows the @code{fopen} function, and related stream-creating functions, +to work correctly in the child process, since these functions need to insert +into the list. + +However, the individual stream locks are not completely taken care of. Thus +unless the multithreaded application takes special precautions in its use of +@code{fork}, the child process might not be able to safely use the streams that +it inherited from the parent. In general, for any given open stream in the +parent that is to be used by the child process, the application must ensure +that that stream is not in use by another thread when @code{fork} is called. +Otherwise an inconsistent copy of the stream object be produced. An easy way to +ensure this is to use @code{flockfile} to lock the stream prior to calling +@code{fork} and then unlock it with @code{funlockfile} inside the parent +process, provided that the parent's threads properly honor these locks. +Nothing special needs to be done in the child process, since the library +internally resets all stream locks. + +Note that the stream locks are not shared between the parent and child. +For example, even if you ensure that, say, the stream @code{stdout} is properly +treated and can be safely used in the child, the stream locks do not provide +an exclusion mechanism between the parent and child. If both processes write +to @code{stdout}, strangely interleaved output may result regardless of +the explicit use of @code{flockfile} or implicit locks. + +Also note that these provisions are a GNU extension; other systems might not +provide any way for streams to be used in the child of a multithreaded process. +POSIX requires that such a child process confines itself to calling only +asynchronous safe functions, which excludes much of the library, including +standard I/O. + +@node Miscellaneous Thread Functions +@section Miscellaneous Thread Functions + +@comment pthread.h +@comment POSIX +@deftypefun {pthread_t} pthread_self (@var{void}) +@code{pthread_self} returns the thread identifier for the calling thread. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_equal (pthread_t thread1, pthread_t thread2) +@code{pthread_equal} determines if two thread identifiers refer to the same +thread. + +A non-zero value is returned if @var{thread1} and @var{thread2} refer to +the same thread. Otherwise, 0 is returned. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_detach (pthread_t @var{th}) +@code{pthread_detach} puts the thread @var{th} in the detached +state. This guarantees that the memory resources consumed by @var{th} +will be freed immediately when @var{th} terminates. However, this +prevents other threads from synchronizing on the termination of @var{th} +using @code{pthread_join}. + +A thread can be created initially in the detached state, using the +@code{detachstate} attribute to @code{pthread_create}. In contrast, +@code{pthread_detach} applies to threads created in the joinable state, +and which need to be put in the detached state later. + +After @code{pthread_detach} completes, subsequent attempts to perform +@code{pthread_join} on @var{th} will fail. If another thread is already +joining the thread @var{th} at the time @code{pthread_detach} is called, +@code{pthread_detach} does nothing and leaves @var{th} in the joinable +state. + +On success, 0 is returned. On error, one of the following codes is +returned: +@table @code +@item ESRCH +No thread could be found corresponding to that specified by @var{th} +@item EINVAL +The thread @var{th} is already in the detached state +@end table +@end deftypefun + +@comment pthread.h +@comment GNU +@deftypefun void pthread_kill_other_threads_np (@var{void}) +@code{pthread_kill_other_threads_np} is a non-portable LinuxThreads extension. +It causes all threads in the program to terminate immediately, except +the calling thread which proceeds normally. It is intended to be +called just before a thread calls one of the @code{exec} functions, +e.g. @code{execve}. + +Termination of the other threads is not performed through +@code{pthread_cancel} and completely bypasses the cancellation +mechanism. Hence, the current settings for cancellation state and +cancellation type are ignored, and the cleanup handlers are not +executed in the terminated threads. + +According to POSIX 1003.1c, a successful @code{exec*} in one of the +threads should automatically terminate all other threads in the program. +This behavior is not yet implemented in LinuxThreads. Calling +@code{pthread_kill_other_threads_np} before @code{exec*} achieves much +of the same behavior, except that if @code{exec*} ultimately fails, then +all other threads are already killed. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_once (pthread_once_t *once_@var{control}, void (*@var{init_routine}) (void)) + +The purpose of @code{pthread_once} is to ensure that a piece of +initialization code is executed at most once. The @var{once_control} +argument points to a static or extern variable statically initialized +to @code{PTHREAD_ONCE_INIT}. + +The first time @code{pthread_once} is called with a given +@var{once_control} argument, it calls @var{init_routine} with no +argument and changes the value of the @var{once_control} variable to +record that initialization has been performed. Subsequent calls to +@code{pthread_once} with the same @code{once_control} argument do +nothing. + +If a thread is cancelled while executing @var{init_routine} +the state of the @var{once_control} variable is reset so that +a future call to @code{pthread_once} will call the routine again. + +If the process forks while one or more threads are executing +@code{pthread_once} initialization routines, the states of their respective +@var{once_control} variables will appear to be reset in the child process so +that if the child calls @code{pthread_once}, the routines will be executed. + +@code{pthread_once} always returns 0. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_setschedparam (pthread_t target_@var{thread}, int @var{policy}, const struct sched_param *@var{param}) + +@code{pthread_setschedparam} sets the scheduling parameters for the +thread @var{target_thread} as indicated by @var{policy} and +@var{param}. @var{policy} can be either @code{SCHED_OTHER} (regular, +non-realtime scheduling), @code{SCHED_RR} (realtime, round-robin) or +@code{SCHED_FIFO} (realtime, first-in first-out). @var{param} specifies +the scheduling priority for the two realtime policies. See +@code{sched_setpolicy} for more information on scheduling policies. + +The realtime scheduling policies @code{SCHED_RR} and @code{SCHED_FIFO} +are available only to processes with superuser privileges. + +On success, @code{pthread_setschedparam} returns 0. On error it returns +one of the following codes: +@table @code +@item EINVAL +@var{policy} is not one of @code{SCHED_OTHER}, @code{SCHED_RR}, +@code{SCHED_FIFO}, or the priority value specified by @var{param} is not +valid for the specified policy + +@item EPERM +Realtime scheduling was requested but the calling process does not have +sufficient privileges. + +@item ESRCH +The @var{target_thread} is invalid or has already terminated + +@item EFAULT +@var{param} points outside the process memory space +@end table +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_getschedparam (pthread_t target_@var{thread}, int *@var{policy}, struct sched_param *@var{param}) + +@code{pthread_getschedparam} retrieves the scheduling policy and +scheduling parameters for the thread @var{target_thread} and stores them +in the locations pointed to by @var{policy} and @var{param}, +respectively. + +@code{pthread_getschedparam} returns 0 on success, or one of the +following error codes on failure: +@table @code +@item ESRCH +The @var{target_thread} is invalid or has already terminated. + +@item EFAULT +@var{policy} or @var{param} point outside the process memory space. + +@end table +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_setconcurrency (int @var{level}) +@code{pthread_setconcurrency} is unused in LinuxThreads due to the lack +of a mapping of user threads to kernel threads. It exists for source +compatibility. It does store the value @var{level} so that it can be +returned by a subsequent call to @code{pthread_getconcurrency}. It takes +no other action however. +@end deftypefun + +@comment pthread.h +@comment POSIX +@deftypefun int pthread_getconcurrency () +@code{pthread_getconcurrency} is unused in LinuxThreads due to the lack +of a mapping of user threads to kernel threads. It exists for source +compatibility. However, it will return the value that was set by the +last call to @code{pthread_setconcurrency}. +@end deftypefun + diff --git a/newlib/libc/sys/linux/linuxthreads/lockfile.c b/newlib/libc/sys/linux/linuxthreads/lockfile.c new file mode 100644 index 000000000..0aeb15086 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/lockfile.c @@ -0,0 +1,97 @@ +/* lockfile - Handle locking and unlocking of stream. + Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include "internals.h" + +#ifdef USE_IN_LIBIO +#include "../libio/libioP.h" +#endif + +#ifndef SHARED +/* We need a hook to force this file to be linked in when static + libpthread is used. */ +const int __pthread_provide_lockfile = 0; +#endif + +void +__flockfile (FILE *stream) +{ + __lock_acquire_recursive (*(_LOCK_RECURSIVE_T *)&stream->_lock); +} +#undef _IO_flockfile +strong_alias (__flockfile, _IO_flockfile) +weak_alias (__flockfile, flockfile); + + +void +__funlockfile (FILE *stream) +{ + __lock_release_recursive (*(_LOCK_RECURSIVE_T *)&stream->_lock); +} +#undef _IO_funlockfile +strong_alias (__funlockfile, _IO_funlockfile) +weak_alias (__funlockfile, funlockfile); + + +int +__ftrylockfile (FILE *stream) +{ + return __lock_try_acquire_recursive (*(_LOCK_RECURSIVE_T *)&stream->_lock); +} +strong_alias (__ftrylockfile, _IO_ftrylockfile) +weak_alias (__ftrylockfile, ftrylockfile); + +void +__flockfilelist(void) +{ +#ifdef USE_IN_LIBIO + _IO_list_lock(); +#endif +} + +void +__funlockfilelist(void) +{ +#ifdef USE_IN_LIBIO + _IO_list_unlock(); +#endif +} + +void +__fresetlockfiles (void) +{ +#ifdef USE_IN_LIBIO + _IO_ITER i; + + pthread_mutexattr_t attr; + + __pthread_mutexattr_init (&attr); + __pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE_NP); + + for (i = _IO_iter_begin(); i != _IO_iter_end(); i = _IO_iter_next(i)) + __pthread_mutex_init (_IO_iter_file(i)->_lock, &attr); + + __pthread_mutexattr_destroy (&attr); + + _IO_list_resetlock(); +#endif +} diff --git a/newlib/libc/sys/linux/linuxthreads/machine/Makefile.am b/newlib/libc/sys/linux/linuxthreads/machine/Makefile.am new file mode 100644 index 000000000..27c348c3b --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/Makefile.am @@ -0,0 +1,10 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +SUBDIRS = $(machine_dir) . + +doc: + +ACLOCAL_AMFLAGS = -I ../../../../.. +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host diff --git a/newlib/libc/sys/linux/linuxthreads/machine/Makefile.in b/newlib/libc/sys/linux/linuxthreads/machine/Makefile.in new file mode 100644 index 000000000..52a2b60ea --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/Makefile.in @@ -0,0 +1,356 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +aext = @aext@ +libm_machine_dir = @libm_machine_dir@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +SUBDIRS = $(machine_dir) . + +ACLOCAL_AMFLAGS = -I ../../../../.. +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \ + ../../../../../acinclude.m4 ../../../../../aclocal.m4 \ + ../../../../../libtool.m4 + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-info-am: +install-info: install-info-recursive +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: install-data-recursive uninstall-data-recursive \ +install-exec-recursive uninstall-exec-recursive installdirs-recursive \ +uninstalldirs-recursive all-recursive check-recursive \ +installcheck-recursive info-recursive dvi-recursive \ +mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-info-am \ +install-info install-exec-am install-exec install-data-am install-data \ +install-am install uninstall-am uninstall all-redirect all-am all \ +installdirs-am installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean + + +doc: + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/libc/sys/linux/linuxthreads/machine/aclocal.m4 b/newlib/libc/sys/linux/linuxthreads/machine/aclocal.m4 new file mode 100644 index 000000000..98bba1a0b --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/aclocal.m4 @@ -0,0 +1,1191 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl This provides configure definitions used by all the newlib +dnl configure.in files. + +dnl Basic newlib configury. This calls basic introductory stuff, +dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs +dnl configure.host. The only argument is the relative path to the top +dnl newlib directory. + +AC_DEFUN(NEWLIB_CONFIGURE, +[ +dnl Default to --enable-multilib +AC_ARG_ENABLE(multilib, +[ --enable-multilib build many library versions (default)], +[case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; + esac], [multilib=yes])dnl + +dnl Support --enable-target-optspace +AC_ARG_ENABLE(target-optspace, +[ --enable-target-optspace optimize for space], +[case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;; + esac], [target_optspace=])dnl + +dnl Support --enable-malloc-debugging - currently only supported for Cygwin +AC_ARG_ENABLE(malloc-debugging, +[ --enable-malloc-debugging indicate malloc debugging requested], +[case "${enableval}" in + yes) malloc_debugging=yes ;; + no) malloc_debugging=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;; + esac], [malloc_debugging=])dnl + +dnl Support --enable-newlib-mb +AC_ARG_ENABLE(newlib-mb, +[ --enable-newlib-mb enable multibyte support], +[case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;; + esac], [newlib_mb=])dnl + +dnl Support --enable-newlib-multithread +AC_ARG_ENABLE(newlib-multithread, +[ --enable-newlib-multithread enable support for multiple threads], +[case "${enableval}" in + yes) newlib_multithread=yes ;; + no) newlib_multithread=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; + esac], [newlib_multithread=yes])dnl + +dnl Support --enable-newlib-elix-level +AC_ARG_ENABLE(newlib-elix-level, +[ --enable-newlib-elix-level supply desired elix library level (1-4)], +[case "${enableval}" in + 0) newlib_elix_level=0 ;; + 1) newlib_elix_level=1 ;; + 2) newlib_elix_level=2 ;; + 3) newlib_elix_level=3 ;; + 4) newlib_elix_level=4 ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;; + esac], [newlib_elix_level=0])dnl + +dnl Support --disable-newlib-io-float +AC_ARG_ENABLE(newlib-io-float, +[ --disable-newlib-io-float disable printf/scanf family float support], +[case "${enableval}" in + yes) newlib_io_float=yes ;; + no) newlib_io_float=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; + esac], [newlib_io_float=yes])dnl + +dnl Support --disable-newlib-supplied-syscalls +AC_ARG_ENABLE(newlib-supplied-syscalls, +[ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls], +[case "${enableval}" in + yes) newlib_may_supply_syscalls=yes ;; + no) newlib_may_supply_syscalls=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;; + esac], [newlib_may_supply_syscalls=yes])dnl + +AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes) + +dnl We may get other options which we don't document: +dnl --with-target-subdir, --with-multisrctop, --with-multisubdir + +test -z "[$]{with_target_subdir}" && with_target_subdir=. + +if test "[$]{srcdir}" = "."; then + if test "[$]{with_target_subdir}" != "."; then + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" + else + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" + fi +else + newlib_basedir="[$]{srcdir}/$1" +fi +AC_SUBST(newlib_basedir) + +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(newlib, 1.11.0) + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +AC_CHECK_TOOL(AS, as) +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) + +AC_PROG_INSTALL + +AM_MAINTAINER_MODE + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + AC_EXEEXT +fi + +. [$]{newlib_basedir}/configure.host + +newlib_cflags="[$]{newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} +AC_SUBST(NEWLIB_CFLAGS) + +LDFLAGS=${ldflags} +AC_SUBST(LDFLAGS) + +AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) +AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) +AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) +AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) +AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) + +AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) + +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we +# use oext, which is set in configure.host based on the target platform. +OBJEXT=${oext} + +AC_SUBST(OBJEXT) +AC_SUBST(oext) +AC_SUBST(aext) + +AC_SUBST(libm_machine_dir) +AC_SUBST(machine_dir) +AC_SUBST(sys_dir) +]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + + +# serial 46 AC_PROG_LIBTOOL +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])])])])])]) + +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +AC_ARG_WITH(pic, + [ --with-pic try to use only PIC/non-PIC objects [default=use both]], + pic_mode="$withval", pic_mode=default) +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + re_direlt=['/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + case $host_cpu in + hppa*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + ia64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + esac + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] + else + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'] + fi + ;; + +newsos6) + [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +[sysv5uw[78]* | sysv4*uw2*)] + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + +# AC_LIBTOOL_CXX - enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) + +AC_DEFUN([_AC_LIBTOOL_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +# AC_LIBTOOL_GCJ - enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) + +AC_DEFUN([_AC_LIBTOOL_GCJ], +[AC_REQUIRE([AC_PROG_LIBTOOL]) +AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +dnl old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + diff --git a/newlib/libc/sys/linux/linuxthreads/machine/configure b/newlib/libc/sys/linux/linuxthreads/machine/configure new file mode 100755 index 000000000..5dd19e50e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/configure @@ -0,0 +1,3430 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-multilib build many library versions (default)" +ac_help="$ac_help + --enable-target-optspace optimize for space" +ac_help="$ac_help + --enable-malloc-debugging indicate malloc debugging requested" +ac_help="$ac_help + --enable-newlib-mb enable multibyte support" +ac_help="$ac_help + --enable-newlib-multithread enable support for multiple threads" +ac_help="$ac_help + --enable-newlib-elix-level supply desired elix library level (1-4)" +ac_help="$ac_help + --disable-newlib-io-float disable printf/scanf family float support" +ac_help="$ac_help + --disable-newlib-supplied-syscalls disable newlib from supplying syscalls" +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --enable-shared[=PKGS] build shared libraries [default=yes]" +ac_help="$ac_help + --enable-static[=PKGS] build static libraries [default=yes]" +ac_help="$ac_help + --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" +ac_help="$ac_help + --disable-libtool-lock avoid locking (might break parallel builds)" +ac_help="$ac_help + --with-pic try to use only PIC/non-PIC objects [default=use both]" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +sitefile= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=i386 + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi +else + CONFIG_SITE="$sitefile" +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in ../../../../../.. $srcdir/../../../../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ../../../../../.. $srcdir/../../../../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:600: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:653: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:710: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:743: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:776: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + +# Check whether --enable-multilib or --disable-multilib was given. +if test "${enable_multilib+set}" = set; then + enableval="$enable_multilib" + case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;; + esac +else + multilib=yes +fi + +# Check whether --enable-target-optspace or --disable-target-optspace was given. +if test "${enable_target_optspace+set}" = set; then + enableval="$enable_target_optspace" + case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;; + esac +else + target_optspace= +fi + +# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. +if test "${enable_malloc_debugging+set}" = set; then + enableval="$enable_malloc_debugging" + case "${enableval}" in + yes) malloc_debugging=yes ;; + no) malloc_debugging=no ;; + *) { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;; + esac +else + malloc_debugging= +fi + +# Check whether --enable-newlib-mb or --disable-newlib-mb was given. +if test "${enable_newlib_mb+set}" = set; then + enableval="$enable_newlib_mb" + case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;; + esac +else + newlib_mb= +fi + +# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given. +if test "${enable_newlib_multithread+set}" = set; then + enableval="$enable_newlib_multithread" + case "${enableval}" in + yes) newlib_multithread=yes ;; + no) newlib_multithread=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;; + esac +else + newlib_multithread=yes +fi + +# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given. +if test "${enable_newlib_elix_level+set}" = set; then + enableval="$enable_newlib_elix_level" + case "${enableval}" in + 0) newlib_elix_level=0 ;; + 1) newlib_elix_level=1 ;; + 2) newlib_elix_level=2 ;; + 3) newlib_elix_level=3 ;; + 4) newlib_elix_level=4 ;; + *) { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;; + esac +else + newlib_elix_level=0 +fi + +# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given. +if test "${enable_newlib_io_float+set}" = set; then + enableval="$enable_newlib_io_float" + case "${enableval}" in + yes) newlib_io_float=yes ;; + no) newlib_io_float=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;; + esac +else + newlib_io_float=yes +fi + +# Check whether --enable-newlib-supplied-syscalls or --disable-newlib-supplied-syscalls was given. +if test "${enable_newlib_supplied_syscalls+set}" = set; then + enableval="$enable_newlib_supplied_syscalls" + case "${enableval}" in + yes) newlib_may_supply_syscalls=yes ;; + no) newlib_may_supply_syscalls=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-supplied-syscalls option" 1>&2; exit 1; } ;; + esac +else + newlib_may_supply_syscalls=yes +fi + + + +if test x${newlib_may_supply_syscalls} = xyes; then + MAY_SUPPLY_SYSCALLS_TRUE= + MAY_SUPPLY_SYSCALLS_FALSE='#' +else + MAY_SUPPLY_SYSCALLS_TRUE='#' + MAY_SUPPLY_SYSCALLS_FALSE= +fi + + +test -z "${with_target_subdir}" && with_target_subdir=. + +if test "${srcdir}" = "."; then + if test "${with_target_subdir}" != "."; then + newlib_basedir="${srcdir}/${with_multisrctop}../../../../../.." + else + newlib_basedir="${srcdir}/${with_multisrctop}../../../../.." + fi +else + newlib_basedir="${srcdir}/../../../../.." +fi + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:956: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:977: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:995: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + + +PACKAGE=newlib + +VERSION=1.11.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:1038: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:1051: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:1064: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:1077: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:1090: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1115: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1145: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1194: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1218: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1249: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1281: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1313: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1345: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1390: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1444: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + + + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1478: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + +fi + +. ${newlib_basedir}/configure.host + +newlib_cflags="${newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} + + +LDFLAGS=${ldflags} + + + + +if test x${newlib_elix_level} = x0; then + ELIX_LEVEL_0_TRUE= + ELIX_LEVEL_0_FALSE='#' +else + ELIX_LEVEL_0_TRUE='#' + ELIX_LEVEL_0_FALSE= +fi + + +if test x${newlib_elix_level} = x1; then + ELIX_LEVEL_1_TRUE= + ELIX_LEVEL_1_FALSE='#' +else + ELIX_LEVEL_1_TRUE='#' + ELIX_LEVEL_1_FALSE= +fi + + +if test x${newlib_elix_level} = x2; then + ELIX_LEVEL_2_TRUE= + ELIX_LEVEL_2_FALSE='#' +else + ELIX_LEVEL_2_TRUE='#' + ELIX_LEVEL_2_FALSE= +fi + + +if test x${newlib_elix_level} = x3; then + ELIX_LEVEL_3_TRUE= + ELIX_LEVEL_3_FALSE='#' +else + ELIX_LEVEL_3_TRUE='#' + ELIX_LEVEL_3_FALSE= +fi + + +if test x${newlib_elix_level} = x4; then + ELIX_LEVEL_4_TRUE= + ELIX_LEVEL_4_FALSE='#' +else + ELIX_LEVEL_4_TRUE='#' + ELIX_LEVEL_4_FALSE= +fi + + + +if test x${use_libtool} = xyes; then + USE_LIBTOOL_TRUE= + USE_LIBTOOL_FALSE='#' +else + USE_LIBTOOL_TRUE='#' + USE_LIBTOOL_FALSE= +fi + +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we +# use oext, which is set in configure.host based on the target platform. +OBJEXT=${oext} + + + + + + + + + + +if test "${use_libtool}" = "yes"; then + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1663: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1693: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1744: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1776: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1787 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1818: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1823: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1851: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:1894: checking for ld used by GCC" >&5 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:1924: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:1927: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:1962: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi + +echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 +echo "configure:1979: checking for $LD option to reload object files" >&5 +if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_ld_reload_flag='-r' +fi + +echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:1991: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$ac_t""$NM" 1>&6 + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:2029: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 +echo "configure:2050: checking how to recognise dependant libraries" >&5 +if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.012) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + case $host_cpu in + hppa*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + esac + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newsos6) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac + +fi + +echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + +echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +echo "configure:2223: checking for object suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if { (eval echo configure:2229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_objext" 1>&6 +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 +echo "configure:2253: checking for ${ac_tool_prefix}file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo $ac_n "checking for file""... $ac_c" 1>&6 +echo "configure:2315: checking for file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2386: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2418: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + +# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2453: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_STRIP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2485: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="strip" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + STRIP=":" +fi +fi + + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + +libtool_flags="$libtool_flags --enable-win32-dll" +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + : +fi + +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi + +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 2552 "configure"' > conftest.$ac_ext + if { (eval echo configure:2553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo configure:2572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +echo "configure:2590: checking whether the C compiler needs -belf" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_needs_belf=no +fi +rm -f conftest* + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +fi + +echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +*-*-cygwin* | *-*-mingw* | *-*-pw32*) + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2640: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_DLLTOOL"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2672: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_DLLTOOL="dlltool" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false" +fi +fi +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + DLLTOOL="false" +fi +fi + + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2707: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_AS"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2739: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + AS="false" +fi +fi + + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2774: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_OBJDUMP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2806: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="objdump" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + OBJDUMP="false" +fi +fi + + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6 +echo "configure:2842: checking if libtool should supply DllMain function" >&5 +if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_need_dllmain=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_need_dllmain=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_need_dllmain" 1>&6 + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6 +echo "configure:2876: checking how to link DLLs" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_dll_switch=-mdll +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_dll_switch=-dll +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6 + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + +esac + + +# Save cache, so that ltconfig can load it +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } + +# Reload cache, that may have been modified by ltconfig +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log + + + + + + +fi + +if test -n "${machine_dir}"; then + subdirs="${machine_dir}" + +fi + + + +if test x${machine_dir} != x; then + HAVE_MACHINE_DIR_TRUE= + HAVE_MACHINE_DIR_FALSE='#' +else + HAVE_MACHINE_DIR_TRUE='#' + HAVE_MACHINE_DIR_FALSE= +fi + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@MAY_SUPPLY_SYSCALLS_TRUE@%$MAY_SUPPLY_SYSCALLS_TRUE%g +s%@MAY_SUPPLY_SYSCALLS_FALSE@%$MAY_SUPPLY_SYSCALLS_FALSE%g +s%@newlib_basedir@%$newlib_basedir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@RANLIB@%$RANLIB%g +s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g +s%@EXEEXT@%$EXEEXT%g +s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g +s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g +s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g +s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g +s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g +s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g +s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g +s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g +s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g +s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g +s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g +s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g +s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g +s%@OBJEXT@%$OBJEXT%g +s%@oext@%$oext%g +s%@aext@%$aext%g +s%@libm_machine_dir@%$libm_machine_dir%g +s%@machine_dir@%$machine_dir%g +s%@sys_dir@%$sys_dir%g +s%@LN_S@%$LN_S%g +s%@STRIP@%$STRIP%g +s%@DLLTOOL@%$DLLTOOL%g +s%@OBJDUMP@%$OBJDUMP%g +s%@LIBTOOL@%$LIBTOOL%g +s%@subdirs@%$subdirs%g +s%@HAVE_MACHINE_DIR_TRUE@%$HAVE_MACHINE_DIR_TRUE%g +s%@HAVE_MACHINE_DIR_FALSE@%$HAVE_MACHINE_DIR_FALSE%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in ${machine_dir}; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + diff --git a/newlib/libc/sys/linux/linuxthreads/machine/configure.in b/newlib/libc/sys/linux/linuxthreads/machine/configure.in new file mode 100644 index 000000000..b2a205ed7 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/configure.in @@ -0,0 +1,26 @@ +dnl This is the newlib/libc/sys configure.in file. +dnl Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.5) +AC_INIT(i386) + +dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. +AC_CONFIG_AUX_DIR(../../../../../..) + +NEWLIB_CONFIGURE(../../../../..) + +dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and +dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first +dnl line of the macro which fail because appropriate LDFLAGS are not set. +if test "${use_libtool}" = "yes"; then +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL +fi + +if test -n "${machine_dir}"; then + AC_CONFIG_SUBDIRS(${machine_dir}) +fi + +AM_CONDITIONAL(HAVE_MACHINE_DIR, test x${machine_dir} != x) + +AC_OUTPUT(Makefile) diff --git a/newlib/libc/sys/linux/linuxthreads/machine/generic/generic-sysdep.h b/newlib/libc/sys/linux/linuxthreads/machine/generic/generic-sysdep.h new file mode 100644 index 000000000..27f5b6988 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/generic/generic-sysdep.h @@ -0,0 +1,46 @@ +/* Generic asm macros used on many machines. + Copyright (C) 1991, 92, 93, 96, 98 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#ifndef C_LABEL + +/* Define a macro we can use to construct the asm name for a C symbol. */ +#ifdef NO_UNDERSCORES +#ifdef __STDC__ +#define C_LABEL(name) name##: +#else +#define C_LABEL(name) name/**/: +#endif +#else +#ifdef __STDC__ +#define C_LABEL(name) _##name##: +#else +#define C_LABEL(name) _/**/name/**/: +#endif +#endif + +#endif + +/* Mark the end of function named SYM. This is used on some platforms + to generate correct debugging information. */ +#ifndef END +#define END(sym) +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.am b/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.am new file mode 100644 index 000000000..d7271e5a6 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.am @@ -0,0 +1,26 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/../../../include -I$(srcdir)/../.. -I$(srcdir)/../generic -I$(srcdir)/../../.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +LIB_SOURCES = clone.S i386-sysdep.S pspinlock.c sysdep.S + +liblinuxthreadsi386_la_LDFLAGS = -Xcompiler -nostdlib + +if USE_LIBTOOL +noinst_LTLIBRARIES = liblinuxthreadsi386.la +liblinuxthreadsi386_la_SOURCES = $(LIB_SOURCES) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(LIB_SOURCES) +noinst_DATA = +endif # USE_LIBTOOL + +include $(srcdir)/../../../../../../Makefile.shared + +AM_CFLAGS = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 + +ACLOCAL_AMFLAGS = -I ../../../../../.. +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in b/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in new file mode 100644 index 000000000..0485e6bc8 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in @@ -0,0 +1,411 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +aext = @aext@ +libm_machine_dir = @libm_machine_dir@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/../../../include -I$(srcdir)/../.. -I$(srcdir)/../generic -I$(srcdir)/../../.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +LIB_SOURCES = clone.S i386-sysdep.S pspinlock.c sysdep.S + +liblinuxthreadsi386_la_LDFLAGS = -Xcompiler -nostdlib + +@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@liblinuxthreadsi386.la +@USE_LIBTOOL_TRUE@liblinuxthreadsi386_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) +@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in +@USE_LIBTOOL_FALSE@noinst_DATA = +@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a +@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) + +AM_CFLAGS = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 + +ACLOCAL_AMFLAGS = -I ../../../../../.. +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +lib_a_LIBADD = +@USE_LIBTOOL_FALSE@lib_a_OBJECTS = clone.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@i386-sysdep.$(OBJEXT) pspinlock.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sysdep.$(OBJEXT) +LTLIBRARIES = $(noinst_LTLIBRARIES) + +liblinuxthreadsi386_la_LIBADD = +@USE_LIBTOOL_TRUE@liblinuxthreadsi386_la_OBJECTS = clone.lo \ +@USE_LIBTOOL_TRUE@i386-sysdep.lo pspinlock.lo sysdep.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(noinst_DATA) + +DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(lib_a_SOURCES) $(liblinuxthreadsi386_la_SOURCES) +OBJECTS = $(lib_a_OBJECTS) $(liblinuxthreadsi386_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../../../Makefile.shared + cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \ + ../../../../../../acinclude.m4 \ + ../../../../../../aclocal.m4 \ + ../../../../../../libtool.m4 + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) + -rm -f lib.a + $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +mostlyclean-noinstLTLIBRARIES: + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + +distclean-noinstLTLIBRARIES: + +maintainer-clean-noinstLTLIBRARIES: + +liblinuxthreadsi386.la: $(liblinuxthreadsi386_la_OBJECTS) $(liblinuxthreadsi386_la_DEPENDENCIES) + $(LINK) $(liblinuxthreadsi386_la_LDFLAGS) $(liblinuxthreadsi386_la_OBJECTS) $(liblinuxthreadsi386_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ + clean-noinstLTLIBRARIES clean-tags clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstLIBRARIES distclean-compile \ + distclean-libtool distclean-noinstLTLIBRARIES \ + distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-noinstLTLIBRARIES \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ +distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ +maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-info-am install-info \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/aclocal.m4 b/newlib/libc/sys/linux/linuxthreads/machine/i386/aclocal.m4 new file mode 100644 index 000000000..98bba1a0b --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/aclocal.m4 @@ -0,0 +1,1191 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl This provides configure definitions used by all the newlib +dnl configure.in files. + +dnl Basic newlib configury. This calls basic introductory stuff, +dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs +dnl configure.host. The only argument is the relative path to the top +dnl newlib directory. + +AC_DEFUN(NEWLIB_CONFIGURE, +[ +dnl Default to --enable-multilib +AC_ARG_ENABLE(multilib, +[ --enable-multilib build many library versions (default)], +[case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; + esac], [multilib=yes])dnl + +dnl Support --enable-target-optspace +AC_ARG_ENABLE(target-optspace, +[ --enable-target-optspace optimize for space], +[case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;; + esac], [target_optspace=])dnl + +dnl Support --enable-malloc-debugging - currently only supported for Cygwin +AC_ARG_ENABLE(malloc-debugging, +[ --enable-malloc-debugging indicate malloc debugging requested], +[case "${enableval}" in + yes) malloc_debugging=yes ;; + no) malloc_debugging=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;; + esac], [malloc_debugging=])dnl + +dnl Support --enable-newlib-mb +AC_ARG_ENABLE(newlib-mb, +[ --enable-newlib-mb enable multibyte support], +[case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;; + esac], [newlib_mb=])dnl + +dnl Support --enable-newlib-multithread +AC_ARG_ENABLE(newlib-multithread, +[ --enable-newlib-multithread enable support for multiple threads], +[case "${enableval}" in + yes) newlib_multithread=yes ;; + no) newlib_multithread=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; + esac], [newlib_multithread=yes])dnl + +dnl Support --enable-newlib-elix-level +AC_ARG_ENABLE(newlib-elix-level, +[ --enable-newlib-elix-level supply desired elix library level (1-4)], +[case "${enableval}" in + 0) newlib_elix_level=0 ;; + 1) newlib_elix_level=1 ;; + 2) newlib_elix_level=2 ;; + 3) newlib_elix_level=3 ;; + 4) newlib_elix_level=4 ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;; + esac], [newlib_elix_level=0])dnl + +dnl Support --disable-newlib-io-float +AC_ARG_ENABLE(newlib-io-float, +[ --disable-newlib-io-float disable printf/scanf family float support], +[case "${enableval}" in + yes) newlib_io_float=yes ;; + no) newlib_io_float=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; + esac], [newlib_io_float=yes])dnl + +dnl Support --disable-newlib-supplied-syscalls +AC_ARG_ENABLE(newlib-supplied-syscalls, +[ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls], +[case "${enableval}" in + yes) newlib_may_supply_syscalls=yes ;; + no) newlib_may_supply_syscalls=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;; + esac], [newlib_may_supply_syscalls=yes])dnl + +AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes) + +dnl We may get other options which we don't document: +dnl --with-target-subdir, --with-multisrctop, --with-multisubdir + +test -z "[$]{with_target_subdir}" && with_target_subdir=. + +if test "[$]{srcdir}" = "."; then + if test "[$]{with_target_subdir}" != "."; then + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" + else + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" + fi +else + newlib_basedir="[$]{srcdir}/$1" +fi +AC_SUBST(newlib_basedir) + +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(newlib, 1.11.0) + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +AC_CHECK_TOOL(AS, as) +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) + +AC_PROG_INSTALL + +AM_MAINTAINER_MODE + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + AC_EXEEXT +fi + +. [$]{newlib_basedir}/configure.host + +newlib_cflags="[$]{newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} +AC_SUBST(NEWLIB_CFLAGS) + +LDFLAGS=${ldflags} +AC_SUBST(LDFLAGS) + +AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) +AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) +AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) +AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) +AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) + +AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) + +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we +# use oext, which is set in configure.host based on the target platform. +OBJEXT=${oext} + +AC_SUBST(OBJEXT) +AC_SUBST(oext) +AC_SUBST(aext) + +AC_SUBST(libm_machine_dir) +AC_SUBST(machine_dir) +AC_SUBST(sys_dir) +]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + + +# serial 46 AC_PROG_LIBTOOL +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])])])])])]) + +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +AC_ARG_WITH(pic, + [ --with-pic try to use only PIC/non-PIC objects [default=use both]], + pic_mode="$withval", pic_mode=default) +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + re_direlt=['/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + case $host_cpu in + hppa*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + ia64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + esac + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] + else + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'] + fi + ;; + +newsos6) + [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +[sysv5uw[78]* | sysv4*uw2*)] + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + +# AC_LIBTOOL_CXX - enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) + +AC_DEFUN([_AC_LIBTOOL_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +# AC_LIBTOOL_GCJ - enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) + +AC_DEFUN([_AC_LIBTOOL_GCJ], +[AC_REQUIRE([AC_PROG_LIBTOOL]) +AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +dnl old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/bp-asm.h b/newlib/libc/sys/linux/linuxthreads/machine/i386/bp-asm.h new file mode 100644 index 000000000..34d5227a6 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/bp-asm.h @@ -0,0 +1,144 @@ +/* Bounded-pointer definitions for x86 assembler. + Copyright (C) 2000 Free Software Foundation, Inc. + Contributed by Greg McGary + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in the GNU MP Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _bp_asm_h_ +# define _bp_asm_h_ 1 + +# if __ASSEMBLER__ + +# if __BOUNDED_POINTERS__ + +/* Bounded pointers occupy three words. */ +# define PTR_SIZE 12 +/* Bounded pointer return values are passed back through a hidden + argument that points to caller-allocate space. The hidden arg + occupies one word on the stack. */ +# define RTN_SIZE 4 +/* Although the caller pushes the hidden arg, the callee is + responsible for popping it. */ +# define RET_PTR ret $RTN_SIZE +/* Maintain frame pointer chain in leaf assembler functions for the benefit + of debugging stack traces when bounds violations occur. */ +# define ENTER pushl %ebp; movl %esp, %ebp +# define LEAVE movl %ebp, %esp; popl %ebp +/* Stack space overhead of procedure-call linkage: return address and + frame pointer. */ +# define LINKAGE 8 +/* Stack offset of return address after calling ENTER. */ +# define PCOFF 4 + +/* Int 5 is the "bound range" exception also raised by the "bound" + instruction. */ +# define BOUNDS_VIOLATED int $5 + +# define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM) \ + cmpl 4+BP_MEM, VAL_REG; \ + jae 0f; /* continue if value >= low */ \ + BOUNDS_VIOLATED; \ + 0: + +# define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc) \ + cmpl 8+BP_MEM, VAL_REG; \ + Jcc 0f; /* continue if value < high */ \ + BOUNDS_VIOLATED; \ + 0: + +# define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM) \ + cmpl 4+BP_MEM, VAL_REG; \ + jb 1f; /* die if value < low */ \ + cmpl 8+BP_MEM, VAL_REG; \ + jb 0f; /* continue if value < high */ \ + 1: BOUNDS_VIOLATED; \ + 0: + +# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH) \ + CHECK_BOUNDS_LOW(VAL_REG, BP_MEM); \ + addl LENGTH, VAL_REG; \ + cmpl 8+BP_MEM, VAL_REG; \ + jbe 0f; /* continue if value <= high */ \ + BOUNDS_VIOLATED; \ + 0: subl LENGTH, VAL_REG /* restore value */ + +/* Take bounds from BP_MEM and affix them to the pointer + value in %eax, stuffing all into memory at RTN(%esp). + Use %edx as a scratch register. */ + +# define RETURN_BOUNDED_POINTER(BP_MEM) \ + movl RTN(%esp), %edx; \ + movl %eax, 0(%edx); \ + movl 4+BP_MEM, %eax; \ + movl %eax, 4(%edx); \ + movl 8+BP_MEM, %eax; \ + movl %eax, 8(%edx) + +# define RETURN_NULL_BOUNDED_POINTER \ + movl RTN(%esp), %edx; \ + movl %eax, 0(%edx); \ + movl %eax, 4(%edx); \ + movl %eax, 8(%edx) + +/* The caller of __errno_location is responsible for allocating space + for the three-word BP return-value and passing pushing its address + as an implicit first argument. */ +# define PUSH_ERRNO_LOCATION_RETURN \ + subl $8, %esp; \ + subl $4, %esp; \ + pushl %esp + +/* __errno_location is responsible for popping the implicit first + argument, but we must pop the space for the BP itself. We also + dereference the return value in order to dig out the pointer value. */ +# define POP_ERRNO_LOCATION_RETURN \ + popl %eax; \ + addl $8, %esp + +# else /* !__BOUNDED_POINTERS__ */ + +/* Unbounded pointers occupy one word. */ +# define PTR_SIZE 4 +/* Unbounded pointer return values are passed back in the register %eax. */ +# define RTN_SIZE 0 +/* Use simple return instruction for unbounded pointer values. */ +# define RET_PTR ret +/* Don't maintain frame pointer chain for leaf assembler functions. */ +# define ENTER +# define LEAVE +/* Stack space overhead of procedure-call linkage: return address only. */ +# define LINKAGE 4 +/* Stack offset of return address after calling ENTER. */ +# define PCOFF 0 + +# define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM) +# define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc) +# define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM) +# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH) +# define RETURN_BOUNDED_POINTER(BP_MEM) + +# define RETURN_NULL_BOUNDED_POINTER + +# define PUSH_ERRNO_LOCATION_RETURN +# define POP_ERRNO_LOCATION_RETURN + +# endif /* !__BOUNDED_POINTERS__ */ + +# endif /* __ASSEMBLER__ */ + +#endif /* _bp_asm_h_ */ diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/clone.S b/newlib/libc/sys/linux/linuxthreads/machine/i386/clone.S new file mode 100644 index 000000000..dd00c2fb5 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/clone.S @@ -0,0 +1,95 @@ +/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@tamu.edu) + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* clone() is even more special than fork() as it mucks with stacks + and invokes a function in the right context after its all over. */ + +#include +#define _ERRNO_H 1 +#include +#include +#include +#include + +/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ + +#define PARMS LINKAGE /* no space for saved regs */ +#define FUNC PARMS +#define STACK FUNC+4 +#define FLAGS STACK+PTR_SIZE +#define ARG FLAGS+4 + + .text +ENTRY (BP_SYM (__clone)) + /* Sanity check arguments. */ + movl $-EINVAL,%eax + movl FUNC(%esp),%ecx /* no NULL function pointers */ +#ifdef PIC + jecxz SYSCALL_ERROR_LABEL +#else + testl %ecx,%ecx + jz SYSCALL_ERROR_LABEL +#endif + movl STACK(%esp),%ecx /* no NULL stack pointers */ +#ifdef PIC + jecxz SYSCALL_ERROR_LABEL +#else + testl %ecx,%ecx + jz SYSCALL_ERROR_LABEL +#endif + + /* Insert the argument onto the new stack. */ + subl $8,%ecx + movl ARG(%esp),%eax /* no negative argument counts */ + movl %eax,4(%ecx) + + /* Save the function pointer as the zeroth argument. + It will be popped off in the child in the ebx frobbing below. */ + movl FUNC(%esp),%eax + movl %eax,0(%ecx) + + /* Do the system call */ + pushl %ebx + movl FLAGS+4(%esp),%ebx + movl $SYS_ify(clone),%eax + int $0x80 + popl %ebx + + test %eax,%eax + jl SYSCALL_ERROR_LABEL + jz thread_start + +L(pseudo_end): + ret + +thread_start: + subl %ebp,%ebp /* terminate the stack frame */ + call *%ebx +#ifdef PIC + call L(here) +L(here): + popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx +#endif + pushl %eax + call JUMPTARGET (_exit) + +PSEUDO_END (BP_SYM (__clone)) + +weak_alias (BP_SYM (__clone), BP_SYM (clone)) diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/configure b/newlib/libc/sys/linux/linuxthreads/machine/i386/configure new file mode 100755 index 000000000..310e8b3aa --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/configure @@ -0,0 +1,3351 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-multilib build many library versions (default)" +ac_help="$ac_help + --enable-target-optspace optimize for space" +ac_help="$ac_help + --enable-malloc-debugging indicate malloc debugging requested" +ac_help="$ac_help + --enable-newlib-mb enable multibyte support" +ac_help="$ac_help + --enable-newlib-multithread enable support for multiple threads" +ac_help="$ac_help + --enable-newlib-elix-level supply desired elix library level (1-4)" +ac_help="$ac_help + --disable-newlib-io-float disable printf/scanf family float support" +ac_help="$ac_help + --disable-newlib-supplied-syscalls disable newlib from supplying syscalls" +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --enable-shared[=PKGS] build shared libraries [default=yes]" +ac_help="$ac_help + --enable-static[=PKGS] build static libraries [default=yes]" +ac_help="$ac_help + --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" +ac_help="$ac_help + --disable-libtool-lock avoid locking (might break parallel builds)" +ac_help="$ac_help + --with-pic try to use only PIC/non-PIC objects [default=use both]" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +sitefile= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=pspinlock.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi +else + CONFIG_SITE="$sitefile" +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in ../../../../../../.. $srcdir/../../../../../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ../../../../../../.. $srcdir/../../../../../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:600: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:653: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:710: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:743: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:776: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + +# Check whether --enable-multilib or --disable-multilib was given. +if test "${enable_multilib+set}" = set; then + enableval="$enable_multilib" + case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;; + esac +else + multilib=yes +fi + +# Check whether --enable-target-optspace or --disable-target-optspace was given. +if test "${enable_target_optspace+set}" = set; then + enableval="$enable_target_optspace" + case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;; + esac +else + target_optspace= +fi + +# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. +if test "${enable_malloc_debugging+set}" = set; then + enableval="$enable_malloc_debugging" + case "${enableval}" in + yes) malloc_debugging=yes ;; + no) malloc_debugging=no ;; + *) { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;; + esac +else + malloc_debugging= +fi + +# Check whether --enable-newlib-mb or --disable-newlib-mb was given. +if test "${enable_newlib_mb+set}" = set; then + enableval="$enable_newlib_mb" + case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;; + esac +else + newlib_mb= +fi + +# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given. +if test "${enable_newlib_multithread+set}" = set; then + enableval="$enable_newlib_multithread" + case "${enableval}" in + yes) newlib_multithread=yes ;; + no) newlib_multithread=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;; + esac +else + newlib_multithread=yes +fi + +# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given. +if test "${enable_newlib_elix_level+set}" = set; then + enableval="$enable_newlib_elix_level" + case "${enableval}" in + 0) newlib_elix_level=0 ;; + 1) newlib_elix_level=1 ;; + 2) newlib_elix_level=2 ;; + 3) newlib_elix_level=3 ;; + 4) newlib_elix_level=4 ;; + *) { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;; + esac +else + newlib_elix_level=0 +fi + +# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given. +if test "${enable_newlib_io_float+set}" = set; then + enableval="$enable_newlib_io_float" + case "${enableval}" in + yes) newlib_io_float=yes ;; + no) newlib_io_float=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;; + esac +else + newlib_io_float=yes +fi + +# Check whether --enable-newlib-supplied-syscalls or --disable-newlib-supplied-syscalls was given. +if test "${enable_newlib_supplied_syscalls+set}" = set; then + enableval="$enable_newlib_supplied_syscalls" + case "${enableval}" in + yes) newlib_may_supply_syscalls=yes ;; + no) newlib_may_supply_syscalls=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-supplied-syscalls option" 1>&2; exit 1; } ;; + esac +else + newlib_may_supply_syscalls=yes +fi + + + +if test x${newlib_may_supply_syscalls} = xyes; then + MAY_SUPPLY_SYSCALLS_TRUE= + MAY_SUPPLY_SYSCALLS_FALSE='#' +else + MAY_SUPPLY_SYSCALLS_TRUE='#' + MAY_SUPPLY_SYSCALLS_FALSE= +fi + + +test -z "${with_target_subdir}" && with_target_subdir=. + +if test "${srcdir}" = "."; then + if test "${with_target_subdir}" != "."; then + newlib_basedir="${srcdir}/${with_multisrctop}../../../../../../.." + else + newlib_basedir="${srcdir}/${with_multisrctop}../../../../../.." + fi +else + newlib_basedir="${srcdir}/../../../../../.." +fi + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:956: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:977: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:995: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + + +PACKAGE=newlib + +VERSION=1.11.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:1038: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:1051: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:1064: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:1077: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:1090: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1115: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1145: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1194: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1218: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1249: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1281: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1313: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1345: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1390: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1444: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + + + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1478: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + +fi + +. ${newlib_basedir}/configure.host + +newlib_cflags="${newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} + + +LDFLAGS=${ldflags} + + + + +if test x${newlib_elix_level} = x0; then + ELIX_LEVEL_0_TRUE= + ELIX_LEVEL_0_FALSE='#' +else + ELIX_LEVEL_0_TRUE='#' + ELIX_LEVEL_0_FALSE= +fi + + +if test x${newlib_elix_level} = x1; then + ELIX_LEVEL_1_TRUE= + ELIX_LEVEL_1_FALSE='#' +else + ELIX_LEVEL_1_TRUE='#' + ELIX_LEVEL_1_FALSE= +fi + + +if test x${newlib_elix_level} = x2; then + ELIX_LEVEL_2_TRUE= + ELIX_LEVEL_2_FALSE='#' +else + ELIX_LEVEL_2_TRUE='#' + ELIX_LEVEL_2_FALSE= +fi + + +if test x${newlib_elix_level} = x3; then + ELIX_LEVEL_3_TRUE= + ELIX_LEVEL_3_FALSE='#' +else + ELIX_LEVEL_3_TRUE='#' + ELIX_LEVEL_3_FALSE= +fi + + +if test x${newlib_elix_level} = x4; then + ELIX_LEVEL_4_TRUE= + ELIX_LEVEL_4_FALSE='#' +else + ELIX_LEVEL_4_TRUE='#' + ELIX_LEVEL_4_FALSE= +fi + + + +if test x${use_libtool} = xyes; then + USE_LIBTOOL_TRUE= + USE_LIBTOOL_FALSE='#' +else + USE_LIBTOOL_TRUE='#' + USE_LIBTOOL_FALSE= +fi + +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we +# use oext, which is set in configure.host based on the target platform. +OBJEXT=${oext} + + + + + + + + + + + +if test "${use_libtool}" = "yes"; then + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1664: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1694: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1745: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1777: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1788 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1819: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1824: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1852: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:1895: checking for ld used by GCC" >&5 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:1925: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:1928: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:1963: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi + +echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 +echo "configure:1980: checking for $LD option to reload object files" >&5 +if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_ld_reload_flag='-r' +fi + +echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:1992: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$ac_t""$NM" 1>&6 + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:2030: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 +echo "configure:2051: checking how to recognise dependant libraries" >&5 +if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.012) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + case $host_cpu in + hppa*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + esac + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newsos6) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac + +fi + +echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + +echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +echo "configure:2224: checking for object suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if { (eval echo configure:2230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_objext" 1>&6 +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 +echo "configure:2254: checking for ${ac_tool_prefix}file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo $ac_n "checking for file""... $ac_c" 1>&6 +echo "configure:2316: checking for file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2387: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2419: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + +# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2454: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_STRIP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2486: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="strip" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + STRIP=":" +fi +fi + + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + +libtool_flags="$libtool_flags --enable-win32-dll" +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + : +fi + +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi + +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 2553 "configure"' > conftest.$ac_ext + if { (eval echo configure:2554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo configure:2573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +echo "configure:2591: checking whether the C compiler needs -belf" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_needs_belf=no +fi +rm -f conftest* + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +fi + +echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +*-*-cygwin* | *-*-mingw* | *-*-pw32*) + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2641: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_DLLTOOL"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2673: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_DLLTOOL="dlltool" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false" +fi +fi +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + DLLTOOL="false" +fi +fi + + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2708: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_AS"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2740: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + AS="false" +fi +fi + + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2775: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_OBJDUMP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2807: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="objdump" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + OBJDUMP="false" +fi +fi + + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6 +echo "configure:2843: checking if libtool should supply DllMain function" >&5 +if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_need_dllmain=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_need_dllmain=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_need_dllmain" 1>&6 + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6 +echo "configure:2877: checking how to link DLLs" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_dll_switch=-mdll +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_dll_switch=-dll +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6 + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + +esac + + +# Save cache, so that ltconfig can load it +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } + +# Reload cache, that may have been modified by ltconfig +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log + + + + + + +for ac_prog in mawk gawk nawk awk +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3003: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AWK" && break +done + +fi + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@MAY_SUPPLY_SYSCALLS_TRUE@%$MAY_SUPPLY_SYSCALLS_TRUE%g +s%@MAY_SUPPLY_SYSCALLS_FALSE@%$MAY_SUPPLY_SYSCALLS_FALSE%g +s%@newlib_basedir@%$newlib_basedir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@RANLIB@%$RANLIB%g +s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g +s%@EXEEXT@%$EXEEXT%g +s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g +s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g +s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g +s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g +s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g +s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g +s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g +s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g +s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g +s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g +s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g +s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g +s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g +s%@OBJEXT@%$OBJEXT%g +s%@oext@%$oext%g +s%@aext@%$aext%g +s%@libm_machine_dir@%$libm_machine_dir%g +s%@machine_dir@%$machine_dir%g +s%@sys_dir@%$sys_dir%g +s%@LN_S@%$LN_S%g +s%@STRIP@%$STRIP%g +s%@DLLTOOL@%$DLLTOOL%g +s%@OBJDUMP@%$OBJDUMP%g +s%@LIBTOOL@%$LIBTOOL%g +s%@AWK@%$AWK%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/configure.in b/newlib/libc/sys/linux/linuxthreads/machine/i386/configure.in new file mode 100644 index 000000000..bdf1a587f --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/configure.in @@ -0,0 +1,22 @@ +dnl This is the newlib/libc/sys/linux/linuxthreads/machine/i386 configure file. +dnl Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.5) +AC_INIT(pspinlock.c) + +dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. +AC_CONFIG_AUX_DIR(../../../../../../..) + +NEWLIB_CONFIGURE(../../../../../..) + +dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and +dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first +dnl line of the macro which fail because appropriate LDFLAGS are not set. + +if test "${use_libtool}" = "yes"; then +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL +AC_PROG_AWK +fi + +AC_OUTPUT(Makefile) diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.S b/newlib/libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.S new file mode 100644 index 000000000..aec21c0f5 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.S @@ -0,0 +1,60 @@ +/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 2000 Free Software Foundation, Inc. + This file has been modified from the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#define _ERRNO_H +#include +#include +#include + +.globl __syscall_error + +__syscall_error: +#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN + /* We translate the system's EWOULDBLOCK error into EAGAIN. + The GNU C library always defines EWOULDBLOCK==EAGAIN. + EWOULDBLOCK_sys is the original number. */ + cmpl $EWOULDBLOCK_sys, %eax /* Is it the old EWOULDBLOCK? */ + jne notb /* Branch if not. */ + movl $EAGAIN, %eax /* Yes; translate it to EAGAIN. */ +notb: +#endif +#ifndef PIC + pushl %eax + PUSH_ERRNO_LOCATION_RETURN + call BP_SYM (__errno) + POP_ERRNO_LOCATION_RETURN + popl %ecx + movl %ecx, (%eax) +#else + /* The caller has pushed %ebx and then set it up to + point to the GOT before calling us through the PLT. */ + pushl %eax + PUSH_ERRNO_LOCATION_RETURN + call C_SYMBOL_NAME (BP_SYM (__errno)@PLT) + POP_ERRNO_LOCATION_RETURN + popl %ecx + /* Pop %ebx value saved before jumping here. */ + popl %ebx + movl %ecx, (%eax) +#endif + movl $-1, %eax + ret + +#undef __syscall_error +END (__syscall_error) diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.h b/newlib/libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.h new file mode 100644 index 000000000..02b4c19af --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/i386-sysdep.h @@ -0,0 +1,130 @@ +/* Assembler macros for i386. + Copyright (C) 1991, 92, 93, 95, 96, 98 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define NO_UNDERSCORES + +#include + +#ifdef __ASSEMBLER__ + +/* Syntactic details of assembler. */ + +#ifdef HAVE_ELF + +/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */ +#define ALIGNARG(log2) 1< +#include +#include "internals.h" + +/* This implementation is similar to the one used in the Linux kernel. + But the kernel is byte instructions for the memory access. This is + faster but unusable here. The problem is that only 128 + threads/processes could use the spinlock at the same time. If (by + a design error in the program) a thread/process would hold the + spinlock for a time long enough to accumulate 128 waiting + processes, the next one will find a positive value in the spinlock + and assume it is unlocked. We cannot accept that. */ + +int +__pthread_spin_lock (pthread_spinlock_t *lock) +{ + asm volatile + ("\n" + "1:\n\t" + "lock; decl %0\n\t" + "js 2f\n\t" + ".section .text.spinlock,\"ax\"\n" + "2:\n\t" + "cmpl $0,%0\n\t" + "rep; nop\n\t" + "jle 2b\n\t" + "jmp 1b\n\t" + ".previous" + : "=m" (*lock)); + return 0; +} +weak_alias (__pthread_spin_lock, pthread_spin_lock) + + +int +__pthread_spin_trylock (pthread_spinlock_t *lock) +{ + int oldval; + + asm volatile + ("xchgl %0,%1" + : "=r" (oldval), "=m" (*lock) + : "0" (0)); + return oldval > 0 ? 0 : EBUSY; +} +weak_alias (__pthread_spin_trylock, pthread_spin_trylock) + + +int +__pthread_spin_unlock (pthread_spinlock_t *lock) +{ + asm volatile + ("movl $1,%0" + : "=m" (*lock)); + return 0; +} +weak_alias (__pthread_spin_unlock, pthread_spin_unlock) + + +int +__pthread_spin_init (pthread_spinlock_t *lock, int pshared) +{ + /* We can ignore the `pshared' parameter. Since we are busy-waiting + all processes which can access the memory location `lock' points + to can use the spinlock. */ + *lock = 1; + return 0; +} +weak_alias (__pthread_spin_init, pthread_spin_init) + + +int +__pthread_spin_destroy (pthread_spinlock_t *lock) +{ + /* Nothing to do. */ + return 0; +} +weak_alias (__pthread_spin_destroy, pthread_spin_destroy) diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/pt-machine.h b/newlib/libc/sys/linux/linuxthreads/machine/i386/pt-machine.h new file mode 100644 index 000000000..3346bcc34 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/pt-machine.h @@ -0,0 +1,98 @@ +/* Machine-dependent pthreads configuration and inline functions. + i386 version. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef PT_EI +# define PT_EI extern inline +#endif + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#define CURRENT_STACK_FRAME __builtin_frame_address (0) + + +/* Spinlock implementation; required. */ +PT_EI long int +testandset (int *spinlock) +{ + long int ret; + + __asm__ __volatile__( + "xchgl %0, %1" + : "=r"(ret), "=m"(*spinlock) + : "0"(1), "m"(*spinlock) + : "memory"); + + return ret; +} + + +/* Compare-and-swap for semaphores. + Available on the 486 and above, but not on the 386. + We test dynamically whether it's available or not. */ + +#define HAS_COMPARE_AND_SWAP +#define TEST_FOR_COMPARE_AND_SWAP + +PT_EI int +__compare_and_swap (long int *p, long int oldval, long int newval) +{ + char ret; + long int readval; + + __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" + : "=q" (ret), "=m" (*p), "=a" (readval) + : "r" (newval), "m" (*p), "a" (oldval) + : "memory"); + return ret; +} + + +PT_EI int +get_eflags (void) +{ + int res; + __asm__ __volatile__ ("pushfl; popl %0" : "=r" (res) : ); + return res; +} + + +PT_EI void +set_eflags (int newflags) +{ + __asm__ __volatile__ ("pushl %0; popfl" : : "r" (newflags) : "cc"); +} + + +PT_EI int +compare_and_swap_is_available (void) +{ + int oldflags = get_eflags (); + int changed; + /* Flip AC bit in EFLAGS. */ + set_eflags (oldflags ^ 0x40000); + /* See if bit changed. */ + changed = (get_eflags () ^ oldflags) & 0x40000; + /* Restore EFLAGS. */ + set_eflags (oldflags); + /* If the AC flag did not change, it's a 386 and it lacks cmpxchg. + Otherwise, it's a 486 or above and it has cmpxchg. */ + return changed != 0; +} diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/sigcontextinfo.h b/newlib/libc/sys/linux/linuxthreads/machine/i386/sigcontextinfo.h new file mode 100644 index 000000000..6530ba6f3 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/sigcontextinfo.h @@ -0,0 +1,51 @@ +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define SIGCONTEXT struct sigcontext +#define SIGCONTEXT_EXTRA_ARGS +#define GET_PC(ctx) ((void *) ctx.eip) +#define GET_FRAME(ctx) ((void *) ctx.ebp) +#define GET_STACK(ctx) ((void *) ctx.esp_at_signal) +#define CALL_SIGHANDLER(handler, signo, ctx) \ +do { \ + int __tmp1, __tmp2, __tmp3, __tmp4; \ + __asm __volatile ("movl\t%%esp, %%edi\n\t" \ + "andl\t$-16, %%esp\n\t" \ + "subl\t%8, %%esp\n\t" \ + "movl\t%%edi, %c8-4(%%esp)\n\t" \ + "movl\t%1, 0(%%esp)\n\t" \ + "leal\t4(%%esp), %%edi\n\t" \ + "cld\n\t" \ + "rep\tmovsl\n\t" \ + "call\t*%0\n\t" \ + "cld\n\t" \ + "movl\t%9, %%ecx\n\t" \ + "subl\t%%edi, %%esi\n\t" \ + "leal\t4(%%esp,%%esi,1), %%edi\n\t" \ + "leal\t4(%%esp), %%esi\n\t" \ + "rep\tmovsl\n\t" \ + "movl\t%c8-4(%%esp), %%esp\n\t" \ + : "=a" (__tmp1), "=d" (__tmp2), "=S" (__tmp3), \ + "=c" (__tmp4) \ + : "0" (handler), "1" (signo), "2" (&ctx), \ + "3" (sizeof (struct sigcontext) / 4), \ + "n" ((sizeof (struct sigcontext) + 19) & ~15), \ + "i" (sizeof (struct sigcontext) / 4) \ + : "cc", "edi"); \ +} while (0) diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/stackinfo.h b/newlib/libc/sys/linux/linuxthreads/machine/i386/stackinfo.h new file mode 100644 index 000000000..a9a6745aa --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/stackinfo.h @@ -0,0 +1,28 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file contains a bit of information about the stack allocation + of the processor. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +/* On x86 the stack grows down. */ +#define _STACK_GROWS_DOWN 1 + +#endif /* stackinfo.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/sysdep.S b/newlib/libc/sys/linux/linuxthreads/machine/i386/sysdep.S new file mode 100644 index 000000000..f219805a8 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/sysdep.S @@ -0,0 +1,41 @@ +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +/* The following code is only used in the shared library when we + compile the reentrant version. Otherwise each system call defines + each own version. */ + +#ifndef PIC + +/* The syscall stubs jump here when they detect an error. + The code for Linux is almost identical to the canonical Unix/i386 + code, except that the error number in %eax is negated. */ + +#undef CALL_MCOUNT +#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %eax. */ + + .text +ENTRY (__syscall_error) + negl %eax + +#define __syscall_error __syscall_error_1 +#include + +#endif /* !PIC */ diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/sysdep.h b/newlib/libc/sys/linux/linuxthreads/machine/i386/sysdep.h new file mode 100644 index 000000000..48aeab195 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/sysdep.h @@ -0,0 +1,291 @@ +/* Copyright (C) 1992, 93, 95, 96, 97, 98, 99, 00 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper, , August 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LINUX_I386_SYSDEP_H +#define _LINUX_I386_SYSDEP_H 1 + +#include "i386-sysdep.h" + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* ELF-like local names start with `.L'. */ +#undef L +#define L(name) .L##name + +#ifdef __ASSEMBLER__ + +/* Linux uses a negative return value to indicate syscall errors, + unlike most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be + negative even if the call succeeded. E.g., the `lseek' system call + might return a large offset. Therefore we must not anymore test + for < 0, but test for a real error by making sure the value in %eax + is a real error number. Linus said he will make sure the no syscall + returns a value in -1 .. -4095 as a valid result so we can savely + test with -4095. */ + +/* We don't want the label for the error handle to be global when we define + it here. */ +#ifdef PIC +# define SYSCALL_ERROR_LABEL 0f +#else +# define SYSCALL_ERROR_LABEL syscall_error +#endif + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (args, syscall_name); \ + cmpl $-4095, %eax; \ + jae SYSCALL_ERROR_LABEL; \ + L(pseudo_end): + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + SYSCALL_ERROR_HANDLER \ + END (name) + +#ifndef PIC +#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ +#else +/* Store (- %eax) into errno through the GOT. */ +#ifdef _LIBC_REENTRANT +#define SYSCALL_ERROR_HANDLER \ +0:pushl %ebx; \ + call 1f; \ +1:popl %ebx; \ + xorl %edx, %edx; \ + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx; \ + subl %eax, %edx; \ + pushl %edx; \ + PUSH_ERRNO_LOCATION_RETURN; \ + call BP_SYM (__errno_location)@PLT; \ + POP_ERRNO_LOCATION_RETURN; \ + popl %ecx; \ + popl %ebx; \ + movl %ecx, (%eax); \ + orl $-1, %eax; \ + jmp L(pseudo_end); +/* A quick note: it is assumed that the call to `__errno_location' does + not modify the stack! */ +#else +#define SYSCALL_ERROR_HANDLER \ +0:call 1f; \ +1:popl %ecx; \ + xorl %edx, %edx; \ + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx; \ + subl %eax, %edx; \ + movl errno@GOT(%ecx), %ecx; \ + movl %edx, (%ecx); \ + orl $-1, %eax; \ + jmp L(pseudo_end); +#endif /* _LIBC_REENTRANT */ +#endif /* PIC */ + +/* Linux takes system call arguments in registers: + + syscall number %eax call-clobbered + arg 1 %ebx call-saved + arg 2 %ecx call-clobbered + arg 3 %edx call-clobbered + arg 4 %esi call-saved + arg 5 %edi call-saved + + The stack layout upon entering the function is: + + 20(%esp) Arg# 5 + 16(%esp) Arg# 4 + 12(%esp) Arg# 3 + 8(%esp) Arg# 2 + 4(%esp) Arg# 1 + (%esp) Return address + + (Of course a function with say 3 arguments does not have entries for + arguments 4 and 5.) + + The following code tries hard to be optimal. A general assumption + (which is true according to the data books I have) is that + + 2 * xchg is more expensive than pushl + movl + popl + + Beside this a neat trick is used. The calling conventions for Linux + tell that among the registers used for parameters %ecx and %edx need + not be saved. Beside this we may clobber this registers even when + they are not used for parameter passing. + + As a result one can see below that we save the content of the %ebx + register in the %edx register when we have less than 3 arguments + (2 * movl is less expensive than pushl + popl). + + Second unlike for the other registers we don't save the content of + %ecx and %edx when we have more than 1 and 2 registers resp. + + The code below might look a bit long but we have to take care for + the pipelined processors (i586). Here the `pushl' and `popl' + instructions are marked as NP (not pairable) but the exception is + two consecutive of these instruction. This gives no penalty on + other processors though. */ + +#undef DO_CALL +#define DO_CALL(args, syscall_name) \ + PUSHARGS_##args \ + DOARGS_##args \ + movl $SYS_ify (syscall_name), %eax; \ + int $0x80 \ + POPARGS_##args + +#define PUSHARGS_0 /* No arguments to push. */ +#define DOARGS_0 /* No arguments to frob. */ +#define POPARGS_0 /* No arguments to pop. */ +#define _PUSHARGS_0 /* No arguments to push. */ +#define _DOARGS_0(n) /* No arguments to frob. */ +#define _POPARGS_0 /* No arguments to pop. */ + +#define PUSHARGS_1 movl %ebx, %edx; PUSHARGS_0 +#define DOARGS_1 _DOARGS_1 (4) +#define POPARGS_1 POPARGS_0; movl %edx, %ebx +#define _PUSHARGS_1 pushl %ebx; _PUSHARGS_0 +#define _DOARGS_1(n) movl n(%esp), %ebx; _DOARGS_0(n-4) +#define _POPARGS_1 _POPARGS_0; popl %ebx + +#define PUSHARGS_2 PUSHARGS_1 +#define DOARGS_2 _DOARGS_2 (8) +#define POPARGS_2 POPARGS_1 +#define _PUSHARGS_2 _PUSHARGS_1 +#define _DOARGS_2(n) movl n(%esp), %ecx; _DOARGS_1 (n-4) +#define _POPARGS_2 _POPARGS_1 + +#define PUSHARGS_3 _PUSHARGS_2 +#define DOARGS_3 _DOARGS_3 (16) +#define POPARGS_3 _POPARGS_3 +#define _PUSHARGS_3 _PUSHARGS_2 +#define _DOARGS_3(n) movl n(%esp), %edx; _DOARGS_2 (n-4) +#define _POPARGS_3 _POPARGS_2 + +#define PUSHARGS_4 _PUSHARGS_4 +#define DOARGS_4 _DOARGS_4 (24) +#define POPARGS_4 _POPARGS_4 +#define _PUSHARGS_4 pushl %esi; _PUSHARGS_3 +#define _DOARGS_4(n) movl n(%esp), %esi; _DOARGS_3 (n-4) +#define _POPARGS_4 _POPARGS_3; popl %esi + +#define PUSHARGS_5 _PUSHARGS_5 +#define DOARGS_5 _DOARGS_5 (32) +#define POPARGS_5 _POPARGS_5 +#define _PUSHARGS_5 pushl %edi; _PUSHARGS_4 +#define _DOARGS_5(n) movl n(%esp), %edi; _DOARGS_4 (n-4) +#define _POPARGS_5 _POPARGS_4; popl %edi + +#else /* !__ASSEMBLER__ */ + +/* We need some help from the assembler to generate optimal code. We + define some macros here which later will be used. */ +asm (".L__X'%ebx = 1\n\t" + ".L__X'%ecx = 2\n\t" + ".L__X'%edx = 2\n\t" + ".L__X'%eax = 3\n\t" + ".L__X'%esi = 3\n\t" + ".L__X'%edi = 3\n\t" + ".L__X'%ebp = 3\n\t" + ".L__X'%esp = 3\n\t" + ".macro bpushl name reg\n\t" + ".if 1 - \\name\n\t" + ".if 2 - \\name\n\t" + "pushl %ebx\n\t" + ".else\n\t" + "xchgl \\reg, %ebx\n\t" + ".endif\n\t" + ".endif\n\t" + ".endm\n\t" + ".macro bpopl name reg\n\t" + ".if 1 - \\name\n\t" + ".if 2 - \\name\n\t" + "popl %ebx\n\t" + ".else\n\t" + "xchgl \\reg, %ebx\n\t" + ".endif\n\t" + ".endif\n\t" + ".endm\n\t" + ".macro bmovl name reg\n\t" + ".if 1 - \\name\n\t" + ".if 2 - \\name\n\t" + "movl \\reg, %ebx\n\t" + ".endif\n\t" + ".endif\n\t" + ".endm\n\t"); + +/* Define a macro which expands inline into the wrapper code for a system + call. */ +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + unsigned int resultvar; \ + asm volatile ( \ + LOADARGS_##nr \ + "movl %1, %%eax\n\t" \ + "int $0x80\n\t" \ + RESTOREARGS_##nr \ + : "=a" (resultvar) \ + : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \ + if (resultvar >= 0xfffff001) \ + { \ + __set_errno (-resultvar); \ + resultvar = 0xffffffff; \ + } \ + (int) resultvar; }) + +#define LOADARGS_0 +#define LOADARGS_1 \ + "bpushl .L__X'%k2, %k2\n\t" \ + "bmovl .L__X'%k2, %k2\n\t" +#define LOADARGS_2 LOADARGS_1 +#define LOADARGS_3 LOADARGS_1 +#define LOADARGS_4 LOADARGS_1 +#define LOADARGS_5 LOADARGS_1 + +#define RESTOREARGS_0 +#define RESTOREARGS_1 \ + "bpopl .L__X'%k2, %k2\n\t" +#define RESTOREARGS_2 RESTOREARGS_1 +#define RESTOREARGS_3 RESTOREARGS_1 +#define RESTOREARGS_4 RESTOREARGS_1 +#define RESTOREARGS_5 RESTOREARGS_1 + +#define ASMFMT_0() +#define ASMFMT_1(arg1) \ + , "acdSD" (arg1) +#define ASMFMT_2(arg1, arg2) \ + , "adCD" (arg1), "c" (arg2) +#define ASMFMT_3(arg1, arg2, arg3) \ + , "aCD" (arg1), "c" (arg2), "d" (arg3) +#define ASMFMT_4(arg1, arg2, arg3, arg4) \ + , "aD" (arg1), "c" (arg2), "d" (arg3), "S" (arg4) +#define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \ + , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5) + +#endif /* __ASSEMBLER__ */ + +#endif /* linux/i386/sysdep.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/useldt.h b/newlib/libc/sys/linux/linuxthreads/machine/i386/useldt.h new file mode 100644 index 000000000..02d079c9e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/useldt.h @@ -0,0 +1,205 @@ +/* Special definitions for ix86 machine using segment register based + thread descriptor. + Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include /* For offsetof. */ +#include /* For abort(). */ + + +/* We don't want to include the kernel header. So duplicate the + information. */ + +/* Structure passed on `modify_ldt' call. */ +struct modify_ldt_ldt_s +{ + unsigned int entry_number; + unsigned long int base_addr; + unsigned int limit; + unsigned int seg_32bit:1; + unsigned int contents:2; + unsigned int read_exec_only:1; + unsigned int limit_in_pages:1; + unsigned int seg_not_present:1; + unsigned int useable:1; + unsigned int empty:25; +}; + +/* System call to set LDT entry. */ +extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); + + +/* Return the thread descriptor for the current thread. + + The contained asm must *not* be marked volatile since otherwise + assignments like + pthread_descr self = thread_self(); + do not get optimized away. */ +#define THREAD_SELF \ +({ \ + register pthread_descr __self; \ + __asm__ ("movl %%gs:%c1,%0" : "=r" (__self) \ + : "i" (offsetof (struct _pthread_descr_struct, \ + p_header.data.self))); \ + __self; \ +}) + +/* Initialize the thread-unique value. */ +#define INIT_THREAD_SELF(descr, nr) \ +{ \ + struct modify_ldt_ldt_s ldt_entry = \ + { nr, (unsigned long int) descr, sizeof (*descr), 1, 0, 0, 0, 0, 1, 0 }; \ + if (__modify_ldt (1, &ldt_entry, sizeof (ldt_entry)) != 0) \ + abort (); \ + __asm__ __volatile__ ("movw %w0, %%gs" : : "q" (nr * 8 + 7)); \ +} + +/* Free resources associated with thread descriptor. */ +#define FREE_THREAD(descr, nr) \ +{ \ + struct modify_ldt_ldt_s ldt_entry = \ + { nr, 0, 0, 0, 0, 1, 0, 1, 0, 0 }; \ + __modify_ldt (1, &ldt_entry, sizeof (ldt_entry)); \ +} + +/* Read member of the thread descriptor directly. */ +#define THREAD_GETMEM(descr, member) \ +({ \ + __typeof__ (descr->member) __value; \ + if (sizeof (__value) == 1) \ + __asm__ __volatile__ ("movb %%gs:%P2,%b0" \ + : "=q" (__value) \ + : "0" (0), \ + "i" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else if (sizeof (__value) == 4) \ + __asm__ __volatile__ ("movl %%gs:%P1,%0" \ + : "=r" (__value) \ + : "i" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else \ + { \ + if (sizeof (__value) != 8) \ + /* There should not be any value with a size other than 1, 4 or 8. */\ + abort (); \ + \ + __asm__ __volatile__ ("movl %%gs:%P1,%%eax\n\t" \ + "movl %%gs:%P2,%%edx" \ + : "=A" (__value) \ + : "i" (offsetof (struct _pthread_descr_struct, \ + member)), \ + "i" (offsetof (struct _pthread_descr_struct, \ + member) + 4)); \ + } \ + __value; \ +}) + +/* Same as THREAD_GETMEM, but the member offset can be non-constant. */ +#define THREAD_GETMEM_NC(descr, member) \ +({ \ + __typeof__ (descr->member) __value; \ + if (sizeof (__value) == 1) \ + __asm__ __volatile__ ("movb %%gs:(%2),%b0" \ + : "=q" (__value) \ + : "0" (0), \ + "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else if (sizeof (__value) == 4) \ + __asm__ __volatile__ ("movl %%gs:(%1),%0" \ + : "=r" (__value) \ + : "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else \ + { \ + if (sizeof (__value) != 8) \ + /* There should not be any value with a size other than 1, 4 or 8. */\ + abort (); \ + \ + __asm__ __volatile__ ("movl %%gs:(%1),%%eax\n\t" \ + "movl %%gs:4(%1),%%edx" \ + : "=&A" (__value) \ + : "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + } \ + __value; \ +}) + +/* Same as THREAD_SETMEM, but the member offset can be non-constant. */ +#define THREAD_SETMEM(descr, member, value) \ +({ \ + __typeof__ (descr->member) __value = (value); \ + if (sizeof (__value) == 1) \ + __asm__ __volatile__ ("movb %0,%%gs:%P1" : \ + : "q" (__value), \ + "i" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else if (sizeof (__value) == 4) \ + __asm__ __volatile__ ("movl %0,%%gs:%P1" : \ + : "r" (__value), \ + "i" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else \ + { \ + if (sizeof (__value) != 8) \ + /* There should not be any value with a size other than 1, 4 or 8. */\ + abort (); \ + \ + __asm__ __volatile__ ("movl %%eax,%%gs:%P1\n\n" \ + "movl %%edx,%%gs:%P2" : \ + : "A" (__value), \ + "i" (offsetof (struct _pthread_descr_struct, \ + member)), \ + "i" (offsetof (struct _pthread_descr_struct, \ + member) + 4)); \ + } \ +}) + +/* Set member of the thread descriptor directly. */ +#define THREAD_SETMEM_NC(descr, member, value) \ +({ \ + __typeof__ (descr->member) __value = (value); \ + if (sizeof (__value) == 1) \ + __asm__ __volatile__ ("movb %0,%%gs:(%1)" : \ + : "q" (__value), \ + "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else if (sizeof (__value) == 4) \ + __asm__ __volatile__ ("movl %0,%%gs:(%1)" : \ + : "r" (__value), \ + "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else \ + { \ + if (sizeof (__value) != 8) \ + /* There should not be any value with a size other than 1, 4 or 8. */\ + abort (); \ + \ + __asm__ __volatile__ ("movl %%eax,%%gs:(%1)\n\t" \ + "movl %%edx,%%gs:4(%1)" : \ + : "A" (__value), \ + "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + } \ +}) + +/* We want the OS to assign stack addresses. */ +#define FLOATING_STACKS 1 + +/* Maximum size of the stack if the rlimit is unlimited. */ +#define ARCH_STACK_MAX_SIZE 8*1024*1024 diff --git a/newlib/libc/sys/linux/linuxthreads/manager.c b/newlib/libc/sys/linux/linuxthreads/manager.c new file mode 100644 index 000000000..7729903cf --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/manager.c @@ -0,0 +1,981 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* The "thread manager" thread: manages creation and termination of threads */ + +#include +#include +#include +#include +#include +#include +#include +#include /* for poll */ +#include /* for mmap */ +#include +#include +#include /* for waitpid macros */ + +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "restart.h" +#include "semaphore.h" + +/* Array of active threads. Entry 0 is reserved for the initial thread. */ +struct pthread_handle_struct __pthread_handles[PTHREAD_THREADS_MAX] = +{ { __LOCK_INITIALIZER, &__pthread_initial_thread, 0}, + { __LOCK_INITIALIZER, &__pthread_manager_thread, 0}, /* All NULLs */ }; + +/* For debugging purposes put the maximum number of threads in a variable. */ +const int __linuxthreads_pthread_threads_max = PTHREAD_THREADS_MAX; + +#ifndef THREAD_SELF +/* Indicate whether at least one thread has a user-defined stack (if 1), + or if all threads have stacks supplied by LinuxThreads (if 0). */ +int __pthread_nonstandard_stacks; +#endif + +/* Number of active entries in __pthread_handles (used by gdb) */ +volatile int __pthread_handles_num = 2; + +/* Whether to use debugger additional actions for thread creation + (set to 1 by gdb) */ +volatile int __pthread_threads_debug; + +/* Globally enabled events. */ +volatile td_thr_events_t __pthread_threads_events; + +/* Pointer to thread descriptor with last event. */ +volatile pthread_descr __pthread_last_event; + +/* Mapping from stack segment to thread descriptor. */ +/* Stack segment numbers are also indices into the __pthread_handles array. */ +/* Stack segment number 0 is reserved for the initial thread. */ + +#if FLOATING_STACKS +# define thread_segment(seq) NULL +#else +static inline pthread_descr thread_segment(int seg) +{ + return (pthread_descr)(THREAD_STACK_START_ADDRESS - (seg - 1) * STACK_SIZE) + - 1; +} +#endif + +/* Flag set in signal handler to record child termination */ + +static volatile int terminated_children; + +/* Flag set when the initial thread is blocked on pthread_exit waiting + for all other threads to terminate */ + +static int main_thread_exiting; + +/* Counter used to generate unique thread identifier. + Thread identifier is pthread_threads_counter + segment. */ + +static pthread_t pthread_threads_counter; + +/* Forward declarations */ + +static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, + void * (*start_routine)(void *), void *arg, + sigset_t *mask, int father_pid, + int report_events, + td_thr_events_t *event_maskp); +static void pthread_handle_free(pthread_t th_id); +static void pthread_handle_exit(pthread_descr issuing_thread, int exitcode) + __attribute__ ((noreturn)); +static void pthread_reap_children(void); +static void pthread_kill_all_threads(int sig, int main_thread_also); +static void pthread_for_each_thread(void *arg, + void (*fn)(void *, pthread_descr)); + +/* The server thread managing requests for thread creation and termination */ + +int +__attribute__ ((noreturn)) +__pthread_manager(void *arg) +{ + int reqfd = (int) (long int) arg; + struct pollfd ufd; + sigset_t manager_mask; + int n; + struct pthread_request request; + + /* If we have special thread_self processing, initialize it. */ +#ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(&__pthread_manager_thread, 1); +#endif + /* Set the error variable. */ + __pthread_manager_thread.p_reentp = &__pthread_manager_thread.p_reent; + __pthread_manager_thread.p_h_errnop = &__pthread_manager_thread.p_h_errno; + /* Block all signals except __pthread_sig_cancel and SIGTRAP */ + sigfillset(&manager_mask); + sigdelset(&manager_mask, __pthread_sig_cancel); /* for thread termination */ + sigdelset(&manager_mask, SIGTRAP); /* for debugging purposes */ + if (__pthread_threads_debug && __pthread_sig_debug > 0) + sigdelset(&manager_mask, __pthread_sig_debug); + sigprocmask(SIG_SETMASK, &manager_mask, NULL); + /* Raise our priority to match that of main thread */ + __pthread_manager_adjust_prio(__pthread_main_thread->p_priority); + /* Synchronize debugging of the thread manager */ + n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request, + sizeof(request))); + ASSERT(n == sizeof(request) && request.req_kind == REQ_DEBUG); + ufd.fd = reqfd; + ufd.events = POLLIN; + /* Enter server loop */ + while(1) { + n = __poll(&ufd, 1, 2000); + + /* Check for termination of the main thread */ + if (getppid() == 1) { + pthread_kill_all_threads(SIGKILL, 0); + _exit(0); + } + /* Check for dead children */ + if (terminated_children) { + terminated_children = 0; + pthread_reap_children(); + } + /* Read and execute request */ + if (n == 1 && (ufd.revents & POLLIN)) { + n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request, + sizeof(request))); +#ifdef DEBUG + if (n < 0) { + char d[64]; + write(STDERR_FILENO, d, snprintf(d, sizeof(d), "*** read err %m\n")); + } else if (n != sizeof(request)) { + write(STDERR_FILENO, "*** short read in manager\n", 26); + } +#endif + + switch(request.req_kind) { + case REQ_CREATE: + request.req_thread->p_retcode = + pthread_handle_create((pthread_t *) &request.req_thread->p_retval, + request.req_args.create.attr, + request.req_args.create.fn, + request.req_args.create.arg, + &request.req_args.create.mask, + request.req_thread->p_pid, + request.req_thread->p_report_events, + &request.req_thread->p_eventbuf.eventmask); + restart(request.req_thread); + break; + case REQ_FREE: + pthread_handle_free(request.req_args.free.thread_id); + break; + case REQ_PROCESS_EXIT: + pthread_handle_exit(request.req_thread, + request.req_args.exit.code); + /* NOTREACHED */ + break; + case REQ_MAIN_THREAD_EXIT: + main_thread_exiting = 1; + /* Reap children in case all other threads died and the signal handler + went off before we set main_thread_exiting to 1, and therefore did + not do REQ_KICK. */ + pthread_reap_children(); + + if (__pthread_main_thread->p_nextlive == __pthread_main_thread) { + restart(__pthread_main_thread); + /* The main thread will now call exit() which will trigger an + __on_exit handler, which in turn will send REQ_PROCESS_EXIT + to the thread manager. In case you are wondering how the + manager terminates from its loop here. */ + } + break; + case REQ_POST: + __new_sem_post(request.req_args.post); + break; + case REQ_DEBUG: + /* Make gdb aware of new thread and gdb will restart the + new thread when it is ready to handle the new thread. */ + if (__pthread_threads_debug && __pthread_sig_debug > 0) + raise(__pthread_sig_debug); + break; + case REQ_KICK: + /* This is just a prod to get the manager to reap some + threads right away, avoiding a potential delay at shutdown. */ + break; + case REQ_FOR_EACH_THREAD: + pthread_for_each_thread(request.req_args.for_each.arg, + request.req_args.for_each.fn); + restart(request.req_thread); + break; + } + } + } +} + +int __pthread_manager_event(void *arg) +{ + /* If we have special thread_self processing, initialize it. */ +#ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(&__pthread_manager_thread, 1); +#endif + + /* Get the lock the manager will free once all is correctly set up. */ + __pthread_lock (THREAD_GETMEM((&__pthread_manager_thread), p_lock), NULL); + /* Free it immediately. */ + __pthread_unlock (THREAD_GETMEM((&__pthread_manager_thread), p_lock)); + + return __pthread_manager(arg); +} + +/* Process creation */ + +static int +__attribute__ ((noreturn)) +pthread_start_thread(void *arg) +{ + pthread_descr self = (pthread_descr) arg; + struct pthread_request request; + void * outcome; +#if HP_TIMING_AVAIL + hp_timing_t tmpclock; +#endif + /* Initialize special thread_self processing, if any. */ +#ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(self, self->p_nr); +#endif +#if HP_TIMING_AVAIL + HP_TIMING_NOW (tmpclock); + THREAD_SETMEM (self, p_cpuclock_offset, tmpclock); +#endif + /* Make sure our pid field is initialized, just in case we get there + before our father has initialized it. */ + THREAD_SETMEM(self, p_pid, __getpid()); + /* Initial signal mask is that of the creating thread. (Otherwise, + we'd just inherit the mask of the thread manager.) */ + sigprocmask(SIG_SETMASK, &self->p_start_args.mask, NULL); + /* Set the scheduling policy and priority for the new thread, if needed */ + if (THREAD_GETMEM(self, p_start_args.schedpolicy) >= 0) + /* Explicit scheduling attributes were provided: apply them */ + __sched_setscheduler(THREAD_GETMEM(self, p_pid), + THREAD_GETMEM(self, p_start_args.schedpolicy), + &self->p_start_args.schedparam); + else if (__pthread_manager_thread.p_priority > 0) + /* Default scheduling required, but thread manager runs in realtime + scheduling: switch new thread to SCHED_OTHER policy */ + { + struct sched_param default_params; + default_params.sched_priority = 0; + __sched_setscheduler(THREAD_GETMEM(self, p_pid), + SCHED_OTHER, &default_params); + } + /* Make gdb aware of new thread */ + if (__pthread_threads_debug && __pthread_sig_debug > 0) { + request.req_thread = self; + request.req_kind = REQ_DEBUG; + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + suspend(self); + } + /* Run the thread code */ + outcome = self->p_start_args.start_routine(THREAD_GETMEM(self, + p_start_args.arg)); + /* Exit with the given return value */ + __pthread_do_exit(outcome, CURRENT_STACK_FRAME); +} + +static int +__attribute__ ((noreturn)) +pthread_start_thread_event(void *arg) +{ + pthread_descr self = (pthread_descr) arg; + +#ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(self, self->p_nr); +#endif + /* Make sure our pid field is initialized, just in case we get there + before our father has initialized it. */ + THREAD_SETMEM(self, p_pid, __getpid()); + /* Get the lock the manager will free once all is correctly set up. */ + __pthread_lock (THREAD_GETMEM(self, p_lock), NULL); + /* Free it immediately. */ + __pthread_unlock (THREAD_GETMEM(self, p_lock)); + + /* Continue with the real function. */ + pthread_start_thread (arg); +} + +static int pthread_allocate_stack(const pthread_attr_t *attr, + pthread_descr default_new_thread, + int pagesize, + pthread_descr * out_new_thread, + char ** out_new_thread_bottom, + char ** out_guardaddr, + size_t * out_guardsize) +{ + pthread_descr new_thread; + char * new_thread_bottom; + char * guardaddr; + size_t stacksize, guardsize; + + if (attr != NULL && attr->__stackaddr_set) + { +#ifdef _STACK_GROWS_UP + /* The user provided a stack. */ + new_thread = (pthread_descr) attr->__stackaddr; + new_thread_bottom = (char *) (new_thread + 1); + guardaddr = attr->__stackaddr + attr->__stacksize; + guardsize = 0; +#else + /* The user provided a stack. For now we interpret the supplied + address as 1 + the highest addr. in the stack segment. If a + separate register stack is needed, we place it at the low end + of the segment, relying on the associated stacksize to + determine the low end of the segment. This differs from many + (but not all) other pthreads implementations. The intent is + that on machines with a single stack growing toward higher + addresses, stackaddr would be the lowest address in the stack + segment, so that it is consistently close to the initial sp + value. */ + new_thread = + (pthread_descr) ((long)(attr->__stackaddr) & -sizeof(void *)) - 1; + new_thread_bottom = (char *) attr->__stackaddr - attr->__stacksize; + guardaddr = new_thread_bottom; + guardsize = 0; +#endif +#ifndef THREAD_SELF + __pthread_nonstandard_stacks = 1; +#endif + /* Clear the thread data structure. */ + memset (new_thread, '\0', sizeof (*new_thread)); + } + else + { +#ifdef NEED_SEPARATE_REGISTER_STACK + size_t granularity = 2 * pagesize; + /* Try to make stacksize/2 a multiple of pagesize */ +#else + size_t granularity = pagesize; +#endif + void *map_addr; + + /* Allocate space for stack and thread descriptor at default address */ +#if FLOATING_STACKS + if (attr != NULL) + { + guardsize = page_roundup (attr->__guardsize, granularity); + stacksize = __pthread_max_stacksize - guardsize; + stacksize = MIN (stacksize, + page_roundup (attr->__stacksize, granularity)); + } + else + { + guardsize = granularity; + stacksize = __pthread_max_stacksize - guardsize; + } + + map_addr = mmap(NULL, stacksize + guardsize, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (map_addr == MAP_FAILED) + /* No more memory available. */ + return -1; + +# ifdef NEED_SEPARATE_REGISTER_STACK + guardaddr = map_addr + stacksize / 2; + if (guardsize > 0) + mprotect (guardaddr, guardsize, PROT_NONE); + + new_thread_bottom = (char *) map_addr; + new_thread = ((pthread_descr) (new_thread_bottom + stacksize + + guardsize)) - 1; +# elif _STACK_GROWS_DOWN + guardaddr = map_addr; + if (guardsize > 0) + mprotect (guardaddr, guardsize, PROT_NONE); + + new_thread_bottom = (char *) map_addr + guardsize; + new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1; +# elif _STACK_GROWS_UP + guardaddr = map_addr + stacksize; + if (guardsize > 0) + mprotect (guardaddr, guardsize, PROT_NONE); + + new_thread = (pthread_descr) map_addr; + new_thread_bottom = (char *) (new_thread + 1); +# else +# error You must define a stack direction +# endif /* Stack direction */ +#else /* !FLOATING_STACKS */ + void *res_addr; + + if (attr != NULL) + { + guardsize = page_roundup (attr->__guardsize, granularity); + stacksize = STACK_SIZE - guardsize; + stacksize = MIN (stacksize, + page_roundup (attr->__stacksize, granularity)); + } + else + { + guardsize = granularity; + stacksize = STACK_SIZE - granularity; + } + +# ifdef NEED_SEPARATE_REGISTER_STACK + new_thread = default_new_thread; + new_thread_bottom = (char *) (new_thread + 1) - stacksize - guardsize; + /* Includes guard area, unlike the normal case. Use the bottom + end of the segment as backing store for the register stack. + Needed on IA64. In this case, we also map the entire stack at + once. According to David Mosberger, that's cheaper. It also + avoids the risk of intermittent failures due to other mappings + in the same region. The cost is that we might be able to map + slightly fewer stacks. */ + + /* First the main stack: */ + map_addr = (caddr_t)((char *)(new_thread + 1) - stacksize / 2); + res_addr = mmap(map_addr, stacksize / 2, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (res_addr != map_addr) + { + /* Bad luck, this segment is already mapped. */ + if (res_addr != MAP_FAILED) + munmap(res_addr, stacksize / 2); + return -1; + } + /* Then the register stack: */ + map_addr = (caddr_t)new_thread_bottom; + res_addr = mmap(map_addr, stacksize/2, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (res_addr != map_addr) + { + if (res_addr != MAP_FAILED) + munmap(res_addr, stacksize / 2); + munmap((caddr_t)((char *)(new_thread + 1) - stacksize/2), + stacksize/2); + return -1; + } + + guardaddr = new_thread_bottom + stacksize/2; + /* We leave the guard area in the middle unmapped. */ +# else /* !NEED_SEPARATE_REGISTER_STACK */ +# ifdef _STACK_GROWS_DOWN + new_thread = default_new_thread; + new_thread_bottom = (char *) (new_thread + 1) - stacksize; + map_addr = new_thread_bottom - guardsize; + res_addr = mmap(map_addr, stacksize + guardsize, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (res_addr != map_addr) + { + /* Bad luck, this segment is already mapped. */ + if (res_addr != MAP_FAILED) + munmap (res_addr, stacksize + guardsize); + return -1; + } + + /* We manage to get a stack. Protect the guard area pages if + necessary. */ + guardaddr = map_addr; + if (guardsize > 0) + mprotect (guardaddr, guardsize, PROT_NONE); +# else + /* The thread description goes at the bottom of this area, and + * the stack starts directly above it. + */ + new_thread = (pthread_descr)((unsigned long)default_new_thread &~ (STACK_SIZE - 1)); + map_addr = mmap(new_thread, stacksize + guardsize, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (map_addr == MAP_FAILED) + return -1; + + new_thread_bottom = map_addr + sizeof(*new_thread); + guardaddr = map_addr + stacksize; + if (guardsize > 0) + mprotect (guardaddr, guardsize, PROT_NONE); + +# endif /* stack direction */ +# endif /* !NEED_SEPARATE_REGISTER_STACK */ +#endif /* !FLOATING_STACKS */ + } + *out_new_thread = new_thread; + *out_new_thread_bottom = new_thread_bottom; + *out_guardaddr = guardaddr; + *out_guardsize = guardsize; + return 0; +} + +static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, + void * (*start_routine)(void *), void *arg, + sigset_t * mask, int father_pid, + int report_events, + td_thr_events_t *event_maskp) +{ + size_t sseg; + int pid; + pthread_descr new_thread; + char * new_thread_bottom; + pthread_t new_thread_id; + char *guardaddr = NULL; + size_t guardsize = 0; + int pagesize = __getpagesize(); + + /* First check whether we have to change the policy and if yes, whether + we can do this. Normally this should be done by examining the + return value of the __sched_setscheduler call in pthread_start_thread + but this is hard to implement. FIXME */ + if (attr != NULL && attr->__schedpolicy != SCHED_OTHER && geteuid () != 0) + return EPERM; + /* Find a free segment for the thread, and allocate a stack if needed */ + for (sseg = 2; ; sseg++) + { + if (sseg >= PTHREAD_THREADS_MAX) + return EAGAIN; + if (__pthread_handles[sseg].h_descr != NULL) + continue; + if (pthread_allocate_stack(attr, thread_segment(sseg), + pagesize, + &new_thread, &new_thread_bottom, + &guardaddr, &guardsize) == 0) + break; + } + __pthread_handles_num++; + /* Allocate new thread identifier */ + pthread_threads_counter += PTHREAD_THREADS_MAX; + new_thread_id = sseg + pthread_threads_counter; + /* Initialize the thread descriptor. Elements which have to be + initialized to zero already have this value. */ + new_thread->p_tid = new_thread_id; + new_thread->p_lock = &(__pthread_handles[sseg].h_lock); + new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE; + new_thread->p_canceltype = PTHREAD_CANCEL_DEFERRED; + new_thread->p_reentp = &new_thread->p_reent; + _REENT_INIT_PTR(new_thread->p_reentp); + new_thread->p_h_errnop = &new_thread->p_h_errno; + new_thread->p_resp = &new_thread->p_res; + new_thread->p_guardaddr = guardaddr; + new_thread->p_guardsize = guardsize; + new_thread->p_header.data.self = new_thread; + new_thread->p_nr = sseg; + new_thread->p_inheritsched = attr ? attr->__inheritsched : 0; + /* Initialize the thread handle */ + __pthread_init_lock(&__pthread_handles[sseg].h_lock); + __pthread_handles[sseg].h_descr = new_thread; + __pthread_handles[sseg].h_bottom = new_thread_bottom; + /* Determine scheduling parameters for the thread */ + new_thread->p_start_args.schedpolicy = -1; + if (attr != NULL) { + new_thread->p_detached = attr->__detachstate; + new_thread->p_userstack = attr->__stackaddr_set; + + switch(attr->__inheritsched) { + case PTHREAD_EXPLICIT_SCHED: + new_thread->p_start_args.schedpolicy = attr->__schedpolicy; + memcpy (&new_thread->p_start_args.schedparam, &attr->__schedparam, + sizeof (struct sched_param)); + break; + case PTHREAD_INHERIT_SCHED: + new_thread->p_start_args.schedpolicy = __sched_getscheduler(father_pid); + __sched_getparam(father_pid, &new_thread->p_start_args.schedparam); + break; + } + new_thread->p_priority = + new_thread->p_start_args.schedparam.sched_priority; + } + /* Finish setting up arguments to pthread_start_thread */ + new_thread->p_start_args.start_routine = start_routine; + new_thread->p_start_args.arg = arg; + new_thread->p_start_args.mask = *mask; + /* Make the new thread ID available already now. If any of the later + functions fail we return an error value and the caller must not use + the stored thread ID. */ + *thread = new_thread_id; + /* Raise priority of thread manager if needed */ + __pthread_manager_adjust_prio(new_thread->p_priority); + /* Do the cloning. We have to use two different functions depending + on whether we are debugging or not. */ + pid = 0; /* Note that the thread never can have PID zero. */ + if (report_events) + { + /* See whether the TD_CREATE event bit is set in any of the + masks. */ + int idx = __td_eventword (TD_CREATE); + uint32_t mask = __td_eventmask (TD_CREATE); + + if ((mask & (__pthread_threads_events.event_bits[idx] + | event_maskp->event_bits[idx])) != 0) + { + /* Lock the mutex the child will use now so that it will stop. */ + __pthread_lock(new_thread->p_lock, NULL); + + /* We have to report this event. */ +#ifdef NEED_SEPARATE_REGISTER_STACK + /* Perhaps this version should be used on all platforms. But + this requires that __clone2 be uniformly supported + everywhere. + + And there is some argument for changing the __clone2 + interface to pass sp and bsp instead, making it more IA64 + specific, but allowing stacks to grow outward from each + other, to get less paging and fewer mmaps. */ + pid = __clone2(pthread_start_thread_event, + (void **)new_thread_bottom, + (char *)new_thread - new_thread_bottom, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | + __pthread_sig_cancel, new_thread); +#elif _STACK_GROWS_UP + pid = __clone(pthread_start_thread_event, (void **) new_thread_bottom, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | + __pthread_sig_cancel, new_thread); +#else + pid = __clone(pthread_start_thread_event, (void **) new_thread, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | + __pthread_sig_cancel, new_thread); +#endif + if (pid != -1) + { + /* Now fill in the information about the new thread in + the newly created thread's data structure. We cannot let + the new thread do this since we don't know whether it was + already scheduled when we send the event. */ + new_thread->p_eventbuf.eventdata = new_thread; + new_thread->p_eventbuf.eventnum = TD_CREATE; + __pthread_last_event = new_thread; + + /* We have to set the PID here since the callback function + in the debug library will need it and we cannot guarantee + the child got scheduled before the debugger. */ + new_thread->p_pid = pid; + + /* Now call the function which signals the event. */ + __linuxthreads_create_event (); + + /* Now restart the thread. */ + __pthread_unlock(new_thread->p_lock); + } + } + } + if (pid == 0) + { +#ifdef NEED_SEPARATE_REGISTER_STACK + pid = __clone2(pthread_start_thread, + (void **)new_thread_bottom, + (char *)new_thread - new_thread_bottom, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | + __pthread_sig_cancel, new_thread); +#elif _STACK_GROWS_UP + pid = __clone(pthread_start_thread, (void **) new_thread_bottom, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | + __pthread_sig_cancel, new_thread); +#else + pid = __clone(pthread_start_thread, (void **) new_thread, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | + __pthread_sig_cancel, new_thread); +#endif /* !NEED_SEPARATE_REGISTER_STACK */ + } + /* Check if cloning succeeded */ + if (pid == -1) { + /* Free the stack if we allocated it */ + if (attr == NULL || !attr->__stackaddr_set) + { +#ifdef NEED_SEPARATE_REGISTER_STACK + size_t stacksize = ((char *)(new_thread->p_guardaddr) + - new_thread_bottom); + munmap((caddr_t)new_thread_bottom, + 2 * stacksize + new_thread->p_guardsize); +#elif _STACK_GROWS_UP + size_t stacksize = guardaddr - (char *)new_thread; + munmap(new_thread, stacksize + guardsize); +#else + size_t stacksize = (char *)(new_thread+1) - new_thread_bottom; + munmap(new_thread_bottom - guardsize, guardsize + stacksize); +#endif + } + __pthread_handles[sseg].h_descr = NULL; + __pthread_handles[sseg].h_bottom = NULL; + __pthread_handles_num--; + return errno; + } + /* Insert new thread in doubly linked list of active threads */ + new_thread->p_prevlive = __pthread_main_thread; + new_thread->p_nextlive = __pthread_main_thread->p_nextlive; + __pthread_main_thread->p_nextlive->p_prevlive = new_thread; + __pthread_main_thread->p_nextlive = new_thread; + /* Set pid field of the new thread, in case we get there before the + child starts. */ + new_thread->p_pid = pid; + return 0; +} + + +/* Try to free the resources of a thread when requested by pthread_join + or pthread_detach on a terminated thread. */ + +static void pthread_free(pthread_descr th) +{ + pthread_handle handle; + pthread_readlock_info *iter, *next; + + ASSERT(th->p_exited); + /* Make the handle invalid */ + handle = thread_handle(th->p_tid); + __pthread_lock(&handle->h_lock, NULL); + handle->h_descr = NULL; + handle->h_bottom = (char *)(-1L); + __pthread_unlock(&handle->h_lock); +#ifdef FREE_THREAD + FREE_THREAD(th, th->p_nr); +#endif + /* One fewer threads in __pthread_handles */ + __pthread_handles_num--; + + /* Destroy read lock list, and list of free read lock structures. + If the former is not empty, it means the thread exited while + holding read locks! */ + + for (iter = th->p_readlock_list; iter != NULL; iter = next) + { + next = iter->pr_next; + free(iter); + } + + for (iter = th->p_readlock_free; iter != NULL; iter = next) + { + next = iter->pr_next; + free(iter); + } + + /* If initial thread, nothing to free */ + if (!th->p_userstack) + { + size_t guardsize = th->p_guardsize; + /* Free the stack and thread descriptor area */ + char *guardaddr = th->p_guardaddr; +#ifdef _STACK_GROWS_UP + size_t stacksize = guardaddr - (char *)th; + guardaddr = (char *)th; +#else + /* Guardaddr is always set, even if guardsize is 0. This allows + us to compute everything else. */ + size_t stacksize = (char *)(th+1) - guardaddr - guardsize; +#ifdef NEED_SEPARATE_REGISTER_STACK + /* Take account of the register stack, which is below guardaddr. */ + guardaddr -= stacksize; + stacksize *= 2; +#endif +#endif + /* Unmap the stack. */ + munmap(guardaddr, stacksize + guardsize); + } +} + +/* Handle threads that have exited */ + +static void pthread_exited(pid_t pid) +{ + pthread_descr th; + int detached; + /* Find thread with that pid */ + for (th = __pthread_main_thread->p_nextlive; + th != __pthread_main_thread; + th = th->p_nextlive) { + if (th->p_pid == pid) { + /* Remove thread from list of active threads */ + th->p_nextlive->p_prevlive = th->p_prevlive; + th->p_prevlive->p_nextlive = th->p_nextlive; + /* Mark thread as exited, and if detached, free its resources */ + __pthread_lock(th->p_lock, NULL); + th->p_exited = 1; + /* If we have to signal this event do it now. */ + if (th->p_report_events) + { + /* See whether TD_REAP is in any of the mask. */ + int idx = __td_eventword (TD_REAP); + uint32_t mask = __td_eventmask (TD_REAP); + + if ((mask & (__pthread_threads_events.event_bits[idx] + | th->p_eventbuf.eventmask.event_bits[idx])) != 0) + { + /* Yep, we have to signal the reapage. */ + th->p_eventbuf.eventnum = TD_REAP; + th->p_eventbuf.eventdata = th; + __pthread_last_event = th; + + /* Now call the function to signal the event. */ + __linuxthreads_reap_event(); + } + } + detached = th->p_detached; + __pthread_unlock(th->p_lock); + if (detached) + pthread_free(th); + break; + } + } + /* If all threads have exited and the main thread is pending on a + pthread_exit, wake up the main thread and terminate ourselves. */ + if (main_thread_exiting && + __pthread_main_thread->p_nextlive == __pthread_main_thread) { + restart(__pthread_main_thread); + /* Same logic as REQ_MAIN_THREAD_EXIT. */ + } +} + +static void pthread_reap_children(void) +{ + pid_t pid; + int status; + + while ((pid = __libc___waitpid(-1, &status, WNOHANG | __WCLONE)) > 0) { + pthread_exited(pid); + if (WIFSIGNALED(status)) { + /* If a thread died due to a signal, send the same signal to + all other threads, including the main thread. */ + pthread_kill_all_threads(WTERMSIG(status), 1); + _exit(0); + } + } +} + +/* Try to free the resources of a thread when requested by pthread_join + or pthread_detach on a terminated thread. */ + +static void pthread_handle_free(pthread_t th_id) +{ + pthread_handle handle = thread_handle(th_id); + pthread_descr th; + + __pthread_lock(&handle->h_lock, NULL); + if (nonexisting_handle(handle, th_id)) { + /* pthread_reap_children has deallocated the thread already, + nothing needs to be done */ + __pthread_unlock(&handle->h_lock); + return; + } + th = handle->h_descr; + if (th->p_exited) { + __pthread_unlock(&handle->h_lock); + pthread_free(th); + } else { + /* The Unix process of the thread is still running. + Mark the thread as detached so that the thread manager will + deallocate its resources when the Unix process exits. */ + th->p_detached = 1; + __pthread_unlock(&handle->h_lock); + } +} + +/* Send a signal to all running threads */ + +static void pthread_kill_all_threads(int sig, int main_thread_also) +{ + pthread_descr th; + for (th = __pthread_main_thread->p_nextlive; + th != __pthread_main_thread; + th = th->p_nextlive) { + kill(th->p_pid, sig); + } + if (main_thread_also) { + kill(__pthread_main_thread->p_pid, sig); + } +} + +static void pthread_for_each_thread(void *arg, + void (*fn)(void *, pthread_descr)) +{ + pthread_descr th; + + for (th = __pthread_main_thread->p_nextlive; + th != __pthread_main_thread; + th = th->p_nextlive) { + fn(arg, th); + } + + fn(arg, __pthread_main_thread); +} + +/* Process-wide exit() */ + +static void pthread_handle_exit(pthread_descr issuing_thread, int exitcode) +{ + pthread_descr th; + __pthread_exit_requested = 1; + __pthread_exit_code = exitcode; + /* A forced asynchronous cancellation follows. Make sure we won't + get stuck later in the main thread with a system lock being held + by one of the cancelled threads. Ideally one would use the same + code as in pthread_atfork(), but we can't distinguish system and + user handlers there. */ + __flockfilelist(); + /* Send the CANCEL signal to all running threads, including the main + thread, but excluding the thread from which the exit request originated + (that thread must complete the exit, e.g. calling atexit functions + and flushing stdio buffers). */ + for (th = issuing_thread->p_nextlive; + th != issuing_thread; + th = th->p_nextlive) { + kill(th->p_pid, __pthread_sig_cancel); + } + /* Now, wait for all these threads, so that they don't become zombies + and their times are properly added to the thread manager's times. */ + for (th = issuing_thread->p_nextlive; + th != issuing_thread; + th = th->p_nextlive) { + __waitpid(th->p_pid, NULL, __WCLONE); + } + __fresetlockfiles(); + restart(issuing_thread); + _exit(0); +} + +/* Handler for __pthread_sig_cancel in thread manager thread */ + +void __pthread_manager_sighandler(int sig) +{ + int kick_manager = terminated_children == 0 && main_thread_exiting; + terminated_children = 1; + + /* If the main thread is terminating, kick the thread manager loop + each time some threads terminate. This eliminates a two second + shutdown delay caused by the thread manager sleeping in the + call to __poll(). Instead, the thread manager is kicked into + action, reaps the outstanding threads and resumes the main thread + so that it can complete the shutdown. */ + + if (kick_manager) { + struct pthread_request request; + request.req_thread = 0; + request.req_kind = REQ_KICK; + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + } +} + +/* Adjust priority of thread manager so that it always run at a priority + higher than all threads */ + +void __pthread_manager_adjust_prio(int thread_prio) +{ + struct sched_param param; + + if (thread_prio <= __pthread_manager_thread.p_priority) return; + param.sched_priority = + thread_prio < __sched_get_priority_max(SCHED_FIFO) + ? thread_prio + 1 : thread_prio; + __sched_setscheduler(__pthread_manager_thread.p_pid, SCHED_FIFO, ¶m); + __pthread_manager_thread.p_priority = thread_prio; +} diff --git a/newlib/libc/sys/linux/linuxthreads/mq_notify.c b/newlib/libc/sys/linux/linuxthreads/mq_notify.c new file mode 100644 index 000000000..46492e470 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/mq_notify.c @@ -0,0 +1,106 @@ +/* Copyright 2002, Red Hat Inc. */ + +#include +#include +#include +#include +#include +#include + +#include "internals.h" +#include + +#include "mqlocal.h" + +static void *mq_notify_process (void *); + +void +__cleanup_mq_notify (struct libc_mq *info) +{ + struct sembuf sb4 = {4, 1, 0}; + /* kill notification thread and allow other processes to set a notification */ + pthread_cancel ((pthread_t)info->th); + semop (info->semid, &sb4, 1); +} + +static void * +mq_notify_process (void *arg) +{ + struct libc_mq *info = (struct libc_mq *)arg; + struct sembuf sb3[2] = {{3, 0, 0}, {5, 0, 0}}; + struct sembuf sb4 = {4, 1, 0}; + int rc; + + /* wait until queue is empty */ + while (!(rc = semop (info->semid, sb3, 1)) && errno == EINTR) + /* empty */ ; + + if (!rc) + { + /* now wait until there are 0 readers and the queue has something in it */ + sb3[0].sem_op = -1; + while (!(rc = semop (info->semid, sb3, 2)) && errno == EINTR) + /* empty */ ; + /* restore value since we have not actually performed a read */ + sb3[0].sem_op = 1; + semop (info->semid, sb3, 1); + /* perform desired notification - either run function in this thread or pass signal */ + if (!rc) + { + if (info->sigevent->sigev_notify == SIGEV_SIGNAL) + raise (info->sigevent->sigev_signo); + else if (info->sigevent->sigev_notify == SIGEV_THREAD) + info->sigevent->sigev_notify_function (info->sigevent->sigev_value); + /* allow other processes to now mq_notify */ + semop (info->semid, &sb4, 1); + } + } + pthread_exit (NULL); +} + +int +mq_notify (mqd_t msgid, const struct sigevent *notification) +{ + struct libc_mq *info; + struct sembuf sb4 = {4, -1, IPC_NOWAIT}; + int rc; + pthread_attr_t *attr = NULL; + + info = __find_mq (msgid); + + if (info == NULL) + { + errno = EBADF; + return -1; + } + + /* get notification lock */ + rc = semop (info->semid, &sb4, 1); + + if (rc == -1) + { + errno = EBUSY; + return -1; + } + + /* to get the notification running we use a pthread - if the user has requested + an action in a pthread, we use the user's attributes when setting up the thread */ + info->sigevent = (struct sigevent *)notification; + if (info->sigevent->sigev_notify == SIGEV_THREAD) + attr = (pthread_attr_t *)info->sigevent->sigev_notify_attributes; + rc = pthread_create ((pthread_t *)&info->th, attr, mq_notify_process, (void *)info); + + if (rc != 0) + rc = -1; + else + info->cleanup_notify = &__cleanup_mq_notify; + + return rc; +} + + + + + + + diff --git a/newlib/libc/sys/linux/linuxthreads/mutex.c b/newlib/libc/sys/linux/linuxthreads/mutex.c new file mode 100644 index 000000000..fb2e60770 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/mutex.c @@ -0,0 +1,366 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Mutexes */ + +#include +#include +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "queue.h" +#include "restart.h" + +int __pthread_mutex_init(pthread_mutex_t * mutex, + const pthread_mutexattr_t * mutex_attr) +{ + __pthread_init_lock(&mutex->__m_lock); + mutex->__m_kind = + mutex_attr == NULL ? PTHREAD_MUTEX_TIMED_NP : mutex_attr->__mutexkind; + mutex->__m_count = 0; + mutex->__m_owner = NULL; + return 0; +} +strong_alias (__pthread_mutex_init, pthread_mutex_init) + +int __pthread_mutex_destroy(pthread_mutex_t * mutex) +{ + switch (mutex->__m_kind) { + case PTHREAD_MUTEX_ADAPTIVE_NP: + case PTHREAD_MUTEX_RECURSIVE_NP: + if ((mutex->__m_lock.__status & 1) != 0) + return EBUSY; + return 0; + case PTHREAD_MUTEX_ERRORCHECK_NP: + case PTHREAD_MUTEX_TIMED_NP: + if (mutex->__m_lock.__status != 0) + return EBUSY; + return 0; + default: + return EINVAL; + } +} +strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy) + +int __pthread_mutex_trylock(pthread_mutex_t * mutex) +{ + pthread_descr self; + int retcode; + + switch(mutex->__m_kind) { + case PTHREAD_MUTEX_ADAPTIVE_NP: + retcode = __pthread_trylock(&mutex->__m_lock); + return retcode; + case PTHREAD_MUTEX_RECURSIVE_NP: + self = thread_self(); + if (mutex->__m_owner == self) { + mutex->__m_count++; + return 0; + } + retcode = __pthread_trylock(&mutex->__m_lock); + if (retcode == 0) { + mutex->__m_owner = self; + mutex->__m_count = 0; + } + return retcode; + case PTHREAD_MUTEX_ERRORCHECK_NP: + retcode = __pthread_alt_trylock(&mutex->__m_lock); + if (retcode == 0) { + mutex->__m_owner = thread_self(); + } + return retcode; + case PTHREAD_MUTEX_TIMED_NP: + retcode = __pthread_alt_trylock(&mutex->__m_lock); + return retcode; + default: + return EINVAL; + } +} +strong_alias (__pthread_mutex_trylock, pthread_mutex_trylock) + +int __pthread_mutex_lock(pthread_mutex_t * mutex) +{ + pthread_descr self; + + switch(mutex->__m_kind) { + case PTHREAD_MUTEX_ADAPTIVE_NP: + __pthread_lock(&mutex->__m_lock, NULL); + return 0; + case PTHREAD_MUTEX_RECURSIVE_NP: + self = thread_self(); + if (mutex->__m_owner == self) { + mutex->__m_count++; + return 0; + } + __pthread_lock(&mutex->__m_lock, self); + mutex->__m_owner = self; + mutex->__m_count = 0; + return 0; + case PTHREAD_MUTEX_ERRORCHECK_NP: + self = thread_self(); + if (mutex->__m_owner == self) return EDEADLK; + __pthread_alt_lock(&mutex->__m_lock, self); + mutex->__m_owner = self; + return 0; + case PTHREAD_MUTEX_TIMED_NP: + __pthread_alt_lock(&mutex->__m_lock, NULL); + return 0; + default: + return EINVAL; + } +} +strong_alias (__pthread_mutex_lock, pthread_mutex_lock) + +int __pthread_mutex_timedlock (pthread_mutex_t *mutex, + const struct timespec *abstime) +{ + pthread_descr self; + int res; + + if (__builtin_expect (abstime->tv_nsec, 0) < 0 + || __builtin_expect (abstime->tv_nsec, 0) >= 1000000000) + return EINVAL; + + switch(mutex->__m_kind) { + case PTHREAD_MUTEX_ADAPTIVE_NP: + __pthread_lock(&mutex->__m_lock, NULL); + return 0; + case PTHREAD_MUTEX_RECURSIVE_NP: + self = thread_self(); + if (mutex->__m_owner == self) { + mutex->__m_count++; + return 0; + } + __pthread_lock(&mutex->__m_lock, self); + mutex->__m_owner = self; + mutex->__m_count = 0; + return 0; + case PTHREAD_MUTEX_ERRORCHECK_NP: + self = thread_self(); + if (mutex->__m_owner == self) return EDEADLK; + res = __pthread_alt_timedlock(&mutex->__m_lock, self, abstime); + if (res != 0) + { + mutex->__m_owner = self; + return 0; + } + return ETIMEDOUT; + case PTHREAD_MUTEX_TIMED_NP: + /* Only this type supports timed out lock. */ + return (__pthread_alt_timedlock(&mutex->__m_lock, NULL, abstime) + ? 0 : ETIMEDOUT); + default: + return EINVAL; + } +} +strong_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock) + +int __pthread_mutex_unlock(pthread_mutex_t * mutex) +{ + switch (mutex->__m_kind) { + case PTHREAD_MUTEX_ADAPTIVE_NP: + __pthread_unlock(&mutex->__m_lock); + return 0; + case PTHREAD_MUTEX_RECURSIVE_NP: + if (mutex->__m_owner != thread_self()) + return EPERM; + if (mutex->__m_count > 0) { + mutex->__m_count--; + return 0; + } + mutex->__m_owner = NULL; + __pthread_unlock(&mutex->__m_lock); + return 0; + case PTHREAD_MUTEX_ERRORCHECK_NP: + if (mutex->__m_owner != thread_self() || mutex->__m_lock.__status == 0) + return EPERM; + mutex->__m_owner = NULL; + __pthread_alt_unlock(&mutex->__m_lock); + return 0; + case PTHREAD_MUTEX_TIMED_NP: + __pthread_alt_unlock(&mutex->__m_lock); + return 0; + default: + return EINVAL; + } +} +strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock) + +int __pthread_mutexattr_init(pthread_mutexattr_t *attr) +{ + attr->__mutexkind = PTHREAD_MUTEX_TIMED_NP; + return 0; +} +strong_alias (__pthread_mutexattr_init, pthread_mutexattr_init) + +int __pthread_mutexattr_destroy(pthread_mutexattr_t *attr) +{ + return 0; +} +strong_alias (__pthread_mutexattr_destroy, pthread_mutexattr_destroy) + +int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind) +{ + if (kind != PTHREAD_MUTEX_ADAPTIVE_NP + && kind != PTHREAD_MUTEX_RECURSIVE_NP + && kind != PTHREAD_MUTEX_ERRORCHECK_NP + && kind != PTHREAD_MUTEX_TIMED_NP) + return EINVAL; + attr->__mutexkind = kind; + return 0; +} +weak_alias (__pthread_mutexattr_settype, pthread_mutexattr_settype) +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 +strong_alias ( __pthread_mutexattr_settype, __pthread_mutexattr_setkind_np) +weak_alias (__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np) +#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 2 */ + +int __pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind) +{ + *kind = attr->__mutexkind; + return 0; +} +weak_alias (__pthread_mutexattr_gettype, pthread_mutexattr_gettype) +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 +strong_alias (__pthread_mutexattr_gettype, __pthread_mutexattr_getkind_np) +weak_alias (__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np) +#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 2 */ + + +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3 + +int __pthread_mutexattr_getpshared (const pthread_mutexattr_t *attr, + int *pshared) +{ + *pshared = PTHREAD_PROCESS_PRIVATE; + return 0; +} +weak_alias (__pthread_mutexattr_getpshared, pthread_mutexattr_getpshared) + +int __pthread_mutexattr_setpshared (pthread_mutexattr_t *attr, int pshared) +{ + if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) + return EINVAL; + + /* For now it is not possible to shared a conditional variable. */ + if (pshared != PTHREAD_PROCESS_PRIVATE) + return ENOSYS; + + return 0; +} +weak_alias (__pthread_mutexattr_setpshared, pthread_mutexattr_setpshared) + +#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 3 */ + +/* Once-only execution */ + +static pthread_mutex_t once_masterlock = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t once_finished = PTHREAD_COND_INITIALIZER; +static int fork_generation = 0; /* Child process increments this after fork. */ + +enum { NEVER = 0, IN_PROGRESS = 1, DONE = 2 }; + +/* If a thread is canceled while calling the init_routine out of + pthread once, this handler will reset the once_control variable + to the NEVER state. */ + +static void pthread_once_cancelhandler(void *arg) +{ + pthread_once_t *once_control = arg; + + pthread_mutex_lock(&once_masterlock); + *once_control = NEVER; + pthread_mutex_unlock(&once_masterlock); + pthread_cond_broadcast(&once_finished); +} + +int __pthread_once(pthread_once_t * once_control, void (*init_routine)(void)) +{ + /* flag for doing the condition broadcast outside of mutex */ + int state_changed; + + /* Test without locking first for speed */ + if (*once_control == DONE) { + READ_MEMORY_BARRIER(); + return 0; + } + /* Lock and test again */ + + state_changed = 0; + + pthread_mutex_lock(&once_masterlock); + + /* If this object was left in an IN_PROGRESS state in a parent + process (indicated by stale generation field), reset it to NEVER. */ + if ((*once_control & 3) == IN_PROGRESS && (*once_control & ~3) != fork_generation) + *once_control = NEVER; + + /* If init_routine is being called from another routine, wait until + it completes. */ + while ((*once_control & 3) == IN_PROGRESS) { + pthread_cond_wait(&once_finished, &once_masterlock); + } + /* Here *once_control is stable and either NEVER or DONE. */ + if (*once_control == NEVER) { + *once_control = IN_PROGRESS | fork_generation; + pthread_mutex_unlock(&once_masterlock); + pthread_cleanup_push(pthread_once_cancelhandler, once_control); + init_routine(); + pthread_cleanup_pop(0); + pthread_mutex_lock(&once_masterlock); + WRITE_MEMORY_BARRIER(); + *once_control = DONE; + state_changed = 1; + } + pthread_mutex_unlock(&once_masterlock); + + if (state_changed) + pthread_cond_broadcast(&once_finished); + + return 0; +} +strong_alias (__pthread_once, pthread_once) + +/* + * Handle the state of the pthread_once mechanism across forks. The + * once_masterlock is acquired in the parent process prior to a fork to ensure + * that no thread is in the critical region protected by the lock. After the + * fork, the lock is released. In the child, the lock and the condition + * variable are simply reset. The child also increments its generation + * counter which lets pthread_once calls detect stale IN_PROGRESS states + * and reset them back to NEVER. + */ + +void __pthread_once_fork_prepare(void) +{ + pthread_mutex_lock(&once_masterlock); +} + +void __pthread_once_fork_parent(void) +{ + pthread_mutex_unlock(&once_masterlock); +} + +void __pthread_once_fork_child(void) +{ + pthread_mutex_init(&once_masterlock, NULL); + pthread_cond_init(&once_finished, NULL); + if (fork_generation <= INT_MAX - 4) + fork_generation += 4; /* leave least significant two bits zero */ + else + fork_generation = 0; +} diff --git a/newlib/libc/sys/linux/linuxthreads/no-tsd.c b/newlib/libc/sys/linux/linuxthreads/no-tsd.c new file mode 100644 index 000000000..84abb6f40 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/no-tsd.c @@ -0,0 +1,34 @@ +/* libc-internal interface for thread-specific data. + Copyright (C) 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include /* for __const */ +#include + +/* This file provides uinitialized (common) definitions for the + hooks used internally by libc to access thread-specific data. + + When -lpthread is used, it provides initialized definitions for these + variables (in specific.c), which override these uninitialized definitions. + + If -lpthread is not used, these uninitialized variables default to zero, + which the __libc_tsd_* macros check for. */ + +void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t); +int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t, + __const void *); diff --git a/newlib/libc/sys/linux/linuxthreads/oldsemaphore.c b/newlib/libc/sys/linux/linuxthreads/oldsemaphore.c new file mode 100644 index 000000000..80a82dfcf --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/oldsemaphore.c @@ -0,0 +1,245 @@ +/* + * This file contains the old semaphore code that we need to + * preserve for glibc-2.0 backwards compatibility. Port to glibc 2.1 + * done by Cristian Gafton. + */ + +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Semaphores a la POSIX 1003.1b */ +#include +#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1) + +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "restart.h" +#include "queue.h" + +typedef struct { + long int sem_status; + int sem_spinlock; +} old_sem_t; + +extern int __old_sem_init (old_sem_t *__sem, int __pshared, unsigned int __value); +extern int __old_sem_wait (old_sem_t *__sem); +extern int __old_sem_trywait (old_sem_t *__sem); +extern int __old_sem_post (old_sem_t *__sem); +extern int __old_sem_getvalue (old_sem_t *__sem, int *__sval); +extern int __old_sem_destroy (old_sem_t *__sem); + + +/* Maximum value the semaphore can have. */ +#define SEM_VALUE_MAX ((int) ((~0u) >> 1)) + +static inline int sem_compare_and_swap(old_sem_t *sem, long oldval, long newval) +{ + return compare_and_swap(&sem->sem_status, oldval, newval, &sem->sem_spinlock); +} + +/* The state of a semaphore is represented by a long int encoding + either the semaphore count if >= 0 and no thread is waiting on it, + or the head of the list of threads waiting for the semaphore. + To distinguish the two cases, we encode the semaphore count N + as 2N+1, so that it has the lowest bit set. + + A sequence of sem_wait operations on a semaphore initialized to N + result in the following successive states: + 2N+1, 2N-1, ..., 3, 1, &first_waiting_thread, &second_waiting_thread, ... +*/ + +static void sem_restart_list(pthread_descr waiting); + +int __old_sem_init(old_sem_t *sem, int pshared, unsigned int value) +{ + if (value > SEM_VALUE_MAX) { + errno = EINVAL; + return -1; + } + if (pshared) { + errno = ENOSYS; + return -1; + } + sem->sem_spinlock = __LT_SPINLOCK_INIT; + sem->sem_status = ((long)value << 1) + 1; + return 0; +} + +/* Function called by pthread_cancel to remove the thread from + waiting inside __old_sem_wait. Here we simply unconditionally + indicate that the thread is to be woken, by returning 1. */ + +static int old_sem_extricate_func(void *obj, pthread_descr th) +{ + return 1; +} + +int __old_sem_wait(old_sem_t * sem) +{ + long oldstatus, newstatus; + volatile pthread_descr self = thread_self(); + pthread_descr * th; + pthread_extricate_if extr; + + /* Set up extrication interface */ + extr.pu_object = 0; + extr.pu_extricate_func = old_sem_extricate_func; + + while (1) { + /* Register extrication interface */ + __pthread_set_own_extricate_if(self, &extr); + do { + oldstatus = sem->sem_status; + if ((oldstatus & 1) && (oldstatus != 1)) + newstatus = oldstatus - 2; + else { + newstatus = (long) self; + self->p_nextwaiting = (pthread_descr) oldstatus; + } + } + while (! sem_compare_and_swap(sem, oldstatus, newstatus)); + if (newstatus & 1) { + /* We got the semaphore. */ + __pthread_set_own_extricate_if(self, 0); + self->p_nextwaiting = NULL; + return 0; + } + /* Wait for sem_post or cancellation */ + suspend(self); + __pthread_set_own_extricate_if(self, 0); + + /* This is a cancellation point */ + if (self->p_canceled && self->p_cancelstate == PTHREAD_CANCEL_ENABLE) { + /* Remove ourselves from the waiting list if we're still on it */ + /* First check if we're at the head of the list. */ + do { + oldstatus = sem->sem_status; + if (oldstatus != (long) self) break; + newstatus = (long) self->p_nextwaiting; + } + while (! sem_compare_and_swap(sem, oldstatus, newstatus)); + /* Now, check if we're somewhere in the list. + There's a race condition with sem_post here, but it does not matter: + the net result is that at the time pthread_exit is called, + self is no longer reachable from sem->sem_status. */ + if (oldstatus != (long) self && (oldstatus & 1) == 0) { + for (th = &(((pthread_descr) oldstatus)->p_nextwaiting); + *th != NULL && *th != (pthread_descr) 1; + th = &((*th)->p_nextwaiting)) { + if (*th == self) { + *th = self->p_nextwaiting; + break; + } + } + } + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + } +} + +int __old_sem_trywait(old_sem_t * sem) +{ + long oldstatus, newstatus; + + do { + oldstatus = sem->sem_status; + if ((oldstatus & 1) == 0 || (oldstatus == 1)) { + errno = EAGAIN; + return -1; + } + newstatus = oldstatus - 2; + } + while (! sem_compare_and_swap(sem, oldstatus, newstatus)); + return 0; +} + +int __old_sem_post(old_sem_t * sem) +{ + long oldstatus, newstatus; + + do { + oldstatus = sem->sem_status; + if ((oldstatus & 1) == 0) + newstatus = 3; + else { + if (oldstatus >= SEM_VALUE_MAX) { + /* Overflow */ + errno = ERANGE; + return -1; + } + newstatus = oldstatus + 2; + } + } + while (! sem_compare_and_swap(sem, oldstatus, newstatus)); + if ((oldstatus & 1) == 0) + sem_restart_list((pthread_descr) oldstatus); + return 0; +} + +int __old_sem_getvalue(old_sem_t * sem, int * sval) +{ + long status = sem->sem_status; + if (status & 1) + *sval = (int)((unsigned long) status >> 1); + else + *sval = 0; + return 0; +} + +int __old_sem_destroy(old_sem_t * sem) +{ + if ((sem->sem_status & 1) == 0) { + errno = EBUSY; + return -1; + } + return 0; +} + +/* Auxiliary function for restarting all threads on a waiting list, + in priority order. */ + +static void sem_restart_list(pthread_descr waiting) +{ + pthread_descr th, towake, *p; + + /* Sort list of waiting threads by decreasing priority (insertion sort) */ + towake = NULL; + while (waiting != (pthread_descr) 1) { + th = waiting; + waiting = waiting->p_nextwaiting; + p = &towake; + while (*p != NULL && th->p_priority < (*p)->p_priority) + p = &((*p)->p_nextwaiting); + th->p_nextwaiting = *p; + *p = th; + } + /* Wake up threads in priority order */ + while (towake != NULL) { + th = towake; + towake = towake->p_nextwaiting; + th->p_nextwaiting = NULL; + restart(th); + } +} + +compat_symbol (libpthread, __old_sem_init, sem_init, GLIBC_2_0); +compat_symbol (libpthread, __old_sem_wait, sem_wait, GLIBC_2_0); +compat_symbol (libpthread, __old_sem_trywait, sem_trywait, GLIBC_2_0); +compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0); +compat_symbol (libpthread, __old_sem_getvalue, sem_getvalue, GLIBC_2_0); +compat_symbol (libpthread, __old_sem_destroy, sem_destroy, GLIBC_2_0); + +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/posix-timer.h b/newlib/libc/sys/linux/linuxthreads/posix-timer.h new file mode 100644 index 000000000..0596c18f4 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/posix-timer.h @@ -0,0 +1,210 @@ +/* Definitions for POSIX timer implementation on top of LinuxThreads. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kaz Kylheku . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +/* Double linked list. */ +struct list_links +{ + struct list_links *next; + struct list_links *prev; +}; + + +/* Forward declaration. */ +struct timer_node; + + +/* Definitions for an internal thread of the POSIX timer implementation. */ +struct thread_node +{ + struct list_links links; + pthread_attr_t attr; + pthread_t id; + unsigned int exists; + struct list_links timer_queue; + pthread_cond_t cond; + struct timer_node *current_timer; + pthread_t captured; + clockid_t clock_id; +}; + + +/* Internal representation of a timer. */ +struct timer_node +{ + struct list_links links; + struct sigevent event; + clockid_t clock; + struct itimerspec value; + struct timespec expirytime; + pthread_attr_t attr; + unsigned int abstime; + unsigned int armed; + enum { + TIMER_FREE, TIMER_INUSE, TIMER_DELETED + } inuse; + struct thread_node *thread; + pid_t creator_pid; + int refcount; +}; + + +/* Static array with the structures for all the timers. */ +extern struct timer_node __timer_array[TIMER_MAX]; + +/* Global lock to protect operation on the lists. */ +extern pthread_mutex_t __timer_mutex; + +/* Variable to protext initialization. */ +extern pthread_once_t __timer_init_once_control; + +/* Nonzero if initialization of timer implementation failed. */ +extern int __timer_init_failed; + +/* Nodes for the threads used to deliver signals. */ +/* A distinct thread is used for each clock type. */ + +extern struct thread_node __timer_signal_thread_rclk; +#ifdef _POSIX_CPUTIME +extern struct thread_node __timer_signal_thread_pclk; +#endif +#ifdef _POSIX_THREAD_CPUTIME +extern struct thread_node __timer_signal_thread_tclk; +#endif + + +/* Return pointer to timer structure corresponding to ID. */ +static inline struct timer_node * +timer_id2ptr (timer_t timerid) +{ + if (timerid >= 0 && timerid < TIMER_MAX) + return &__timer_array[timerid]; + + return NULL; +} + +/* Return ID of TIMER. */ +static inline int +timer_ptr2id (struct timer_node *timer) +{ + return timer - __timer_array; +} + +/* Check whether timer is valid; global mutex must be held. */ +static inline int +timer_valid (struct timer_node *timer) +{ + return timer && timer->inuse == TIMER_INUSE; +} + +/* Timer refcount functions; need global mutex. */ +extern void __timer_dealloc (struct timer_node *timer); + +static inline void +timer_addref (struct timer_node *timer) +{ + timer->refcount++; +} + +static inline void +timer_delref (struct timer_node *timer) +{ + if (--timer->refcount == 0) + __timer_dealloc (timer); +} + +/* Timespec helper routines. */ +static inline int +timespec_compare (const struct timespec *left, const struct timespec *right) +{ + if (left->tv_sec < right->tv_sec) + return -1; + if (left->tv_sec > right->tv_sec) + return 1; + + if (left->tv_nsec < right->tv_nsec) + return -1; + if (left->tv_nsec > right->tv_nsec) + return 1; + + return 0; +} + +static inline void +timespec_add (struct timespec *sum, const struct timespec *left, + const struct timespec *right) +{ + sum->tv_sec = left->tv_sec + right->tv_sec; + sum->tv_nsec = left->tv_nsec + right->tv_nsec; + + if (sum->tv_nsec >= 1000000000) + { + ++sum->tv_sec; + sum->tv_nsec -= 1000000000; + } +} + +static inline void +timespec_sub (struct timespec *diff, const struct timespec *left, + const struct timespec *right) +{ + diff->tv_sec = left->tv_sec - right->tv_sec; + diff->tv_nsec = left->tv_nsec - right->tv_nsec; + + if (diff->tv_nsec < 0) + { + --diff->tv_sec; + diff->tv_nsec += 1000000000; + } +} + + +/* We need one of the list functions in the other modules. */ +static inline void +list_unlink_ip (struct list_links *list) +{ + struct list_links *lnext = list->next, *lprev = list->prev; + + lnext->prev = lprev; + lprev->next = lnext; + + /* The suffix ip means idempotent; list_unlink_ip can be called + * two or more times on the same node. + */ + + list->next = list; + list->prev = list; +} + + +/* Functions in the helper file. */ +extern void __timer_mutex_cancel_handler (void *arg); +extern void __timer_init_once (void); +extern struct timer_node *__timer_alloc (void); +extern int __timer_thread_start (struct thread_node *thread); +extern struct thread_node *__timer_thread_find_matching (const pthread_attr_t *desired_attr, clockid_t); +extern struct thread_node *__timer_thread_alloc (const pthread_attr_t *desired_attr, clockid_t); +extern void __timer_thread_dealloc (struct thread_node *thread); +extern int __timer_thread_queue_timer (struct thread_node *thread, + struct timer_node *insert); +extern void __timer_thread_wakeup (struct thread_node *thread); diff --git a/newlib/libc/sys/linux/linuxthreads/prio.c b/newlib/libc/sys/linux/linuxthreads/prio.c new file mode 100644 index 000000000..475371176 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/prio.c @@ -0,0 +1,65 @@ +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include + +#ifndef _POSIX_THREAD_PRIO_PROTECT +int +__pthread_mutexattr_getprotocol (const pthread_mutexattr_t *attr, + int *priority) +{ + errno = ENOSYS; + return ENOSYS; +} +weak_alias(__pthread_mutexattr_getprotocol,pthread_mutexattr_getprotocol) + +int +__pthread_mutexattr_setprotocol (pthread_mutexattr_t *attr, + int priority) +{ + errno = ENOSYS; + return ENOSYS; +} +weak_alias(__pthread_mutexattr_setprotocol,pthread_mutexattr_setprotocol) + +int +__pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *attr, + int *prioceiling) +{ + errno = ENOSYS; + return ENOSYS; +} +weak_alias(__pthread_mutexattr_getprioceiling,pthread_mutexattr_getprioceiling) + +int +__pthread_mutexattr_setprioceiling (pthread_mutexattr_t *attr, + int prioceiling) +{ + errno = ENOSYS; + return ENOSYS; +} +weak_alias(__pthread_mutexattr_setprioceiling,pthread_mutexattr_setprioceiling) +#endif /* !_POSIX_THREAD_PRIO_PROTECT */ + +#if !defined(_POSIX_THREAD_PRIO_PROTECT) && !defined(_POSIX_THREAD_PRIO_INHERIT) +int +__pthread_mutex_getprioceiling (const pthread_mutex_t *mutex, + int *prioceiling) +{ + errno = ENOSYS; + return ENOSYS; +} +weak_alias(__pthread_mutex_getprioceiling,pthread_mutex_getprioceiling) + +int +__pthread_mutex_setprioceiling (pthread_mutex_t *mutex, + int prioceiling, int *oldceiling) +{ + errno = ENOSYS; + return ENOSYS; +} +weak_alias(__pthread_mutex_setprioceiling,pthread_mutex_setprioceiling) +#endif /* !_POSIX_THREAD_PRIO_PROTECT && !_POSIX_THREAD_PRIO_INHERIT) */ + diff --git a/newlib/libc/sys/linux/linuxthreads/proc_service.h b/newlib/libc/sys/linux/linuxthreads/proc_service.h new file mode 100644 index 000000000..74136c03e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/proc_service.h @@ -0,0 +1,70 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* The definitions in this file must correspond to those in the debugger. */ +#include + +typedef enum +{ + PS_OK, /* generic "call succeeded" */ + PS_ERR, /* generic. */ + PS_BADPID, /* bad process handle */ + PS_BADLID, /* bad lwp identifier */ + PS_BADADDR, /* bad address */ + PS_NOSYM, /* p_lookup() could not find given symbol */ + PS_NOFREGS + /* + * FPU register set not available for given + * lwp + */ +} ps_err_e; + + +struct ps_prochandle; /* user defined. */ + + +extern ps_err_e ps_pdread(struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_pdwrite(struct ps_prochandle *, + psaddr_t, const void *, size_t); +extern ps_err_e ps_ptread(struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_ptwrite(struct ps_prochandle *, + psaddr_t, const void *, size_t); + +extern ps_err_e ps_pglobal_lookup(struct ps_prochandle *, + const char *object_name, const char *sym_name, psaddr_t *sym_addr); + + +extern ps_err_e ps_lgetregs(struct ps_prochandle *, + lwpid_t, prgregset_t); +extern ps_err_e ps_lsetregs(struct ps_prochandle *, + lwpid_t, const prgregset_t); +extern ps_err_e ps_lgetfpregs(struct ps_prochandle *, + lwpid_t, prfpregset_t *); +extern ps_err_e ps_lsetfpregs(struct ps_prochandle *, + lwpid_t, const prfpregset_t *); + +extern pid_t ps_getpid (struct ps_prochandle *); + + +extern ps_err_e ps_pstop (const struct ps_prochandle *); +extern ps_err_e ps_pcontinue (const struct ps_prochandle *); + +extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t); +extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t); diff --git a/newlib/libc/sys/linux/linuxthreads/pt-machine.c b/newlib/libc/sys/linux/linuxthreads/pt-machine.c new file mode 100644 index 000000000..f6298c47a --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/pt-machine.c @@ -0,0 +1,25 @@ +/* "Instantiation of machine-dependent pthreads inline functions. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define PT_EI + +extern long int testandset (int *spinlock); +extern int __compare_and_swap (long int *p, long int oldval, long int newval); + +#include diff --git a/newlib/libc/sys/linux/linuxthreads/ptclock_gettime.c b/newlib/libc/sys/linux/linuxthreads/ptclock_gettime.c new file mode 100644 index 000000000..3323edbcd --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/ptclock_gettime.c @@ -0,0 +1,46 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include "internals.h" + + +#if HP_TIMING_AVAIL +int +__pthread_clock_gettime (hp_timing_t freq, struct timespec *tp) +{ + hp_timing_t tsc; + pthread_descr self = thread_self (); + + /* Get the current counter. */ + HP_TIMING_NOW (tsc); + + /* Compute the offset since the start time of the process. */ + tsc -= THREAD_GETMEM (self, p_cpuclock_offset); + + /* Compute the seconds. */ + tp->tv_sec = tsc / freq; + + /* And the nanoseconds. This computation should be stable until + we get machines with about 16GHz frequency. */ + tp->tv_nsec = ((tsc % freq) * 1000000000ull) / freq; + + return 0; +} +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/ptclock_settime.c b/newlib/libc/sys/linux/linuxthreads/ptclock_settime.c new file mode 100644 index 000000000..e293e0dfb --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/ptclock_settime.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include "internals.h" + + +#if HP_TIMING_AVAIL +void +__pthread_clock_settime (hp_timing_t offset) +{ + pthread_descr self = thread_self (); + + /* Compute the offset since the start time of the process. */ + THREAD_SETMEM (self, p_cpuclock_offset, offset); +} +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/ptfork.c b/newlib/libc/sys/linux/linuxthreads/ptfork.c new file mode 100644 index 000000000..6e31b772c --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/ptfork.c @@ -0,0 +1,120 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* The "atfork" stuff */ + +#include +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include + +struct handler_list { + void (*handler)(void); + struct handler_list * next; +}; + +static pthread_mutex_t pthread_atfork_lock = PTHREAD_MUTEX_INITIALIZER; +static struct handler_list * pthread_atfork_prepare = NULL; +static struct handler_list * pthread_atfork_parent = NULL; +static struct handler_list * pthread_atfork_child = NULL; + +static void pthread_insert_list(struct handler_list ** list, + void (*handler)(void), + struct handler_list * newlist, + int at_end) +{ + if (handler == NULL) return; + if (at_end) { + while(*list != NULL) list = &((*list)->next); + } + newlist->handler = handler; + newlist->next = *list; + *list = newlist; +} + +struct handler_list_block { + struct handler_list prepare, parent, child; +}; + +int __pthread_atfork(void (*prepare)(void), + void (*parent)(void), + void (*child)(void)) +{ + struct handler_list_block * block = + (struct handler_list_block *) malloc(sizeof(struct handler_list_block)); + if (block == NULL) return ENOMEM; + pthread_mutex_lock(&pthread_atfork_lock); + /* "prepare" handlers are called in LIFO */ + pthread_insert_list(&pthread_atfork_prepare, prepare, &block->prepare, 0); + /* "parent" handlers are called in FIFO */ + pthread_insert_list(&pthread_atfork_parent, parent, &block->parent, 1); + /* "child" handlers are called in FIFO */ + pthread_insert_list(&pthread_atfork_child, child, &block->child, 1); + pthread_mutex_unlock(&pthread_atfork_lock); + return 0; +} +strong_alias (__pthread_atfork, pthread_atfork) + +static inline void pthread_call_handlers(struct handler_list * list) +{ + for (/*nothing*/; list != NULL; list = list->next) (list->handler)(); +} + +extern int __libc_fork(void); + +pid_t __fork(void) +{ + pid_t pid; + + pthread_mutex_lock(&pthread_atfork_lock); + + pthread_call_handlers(pthread_atfork_prepare); + __pthread_once_fork_prepare(); + __flockfilelist(); + + pid = __libc_fork(); + + if (pid == 0) { + __pthread_reset_main_thread(); + + __fresetlockfiles(); + __pthread_once_fork_child(); + pthread_call_handlers(pthread_atfork_child); + + pthread_mutex_init(&pthread_atfork_lock, NULL); + } else { + __funlockfilelist(); + __pthread_once_fork_parent(); + pthread_call_handlers(pthread_atfork_parent); + + pthread_mutex_unlock(&pthread_atfork_lock); + } + + return pid; +} + +weak_alias (__fork, fork); + +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4 + +pid_t __vfork(void) +{ + return __fork(); +} +weak_alias (__vfork, vfork); + +#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 4 */ diff --git a/newlib/libc/sys/linux/linuxthreads/pthread.c b/newlib/libc/sys/linux/linuxthreads/pthread.c new file mode 100644 index 000000000..b42d9d60a --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/pthread.c @@ -0,0 +1,1248 @@ + +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Thread creation, initialization, and basic low-level routines */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "restart.h" +#include + +/* for threading we use processes so we require a few EL/IX level 2 and + level 3 syscalls. We only allow this file to see them to preserve + the interface. */ +#if defined(_ELIX_LEVEL) && _ELIX_LEVEL < 3 +static _syscall1_base(int,pipe,int *,filedes) +#endif /* _ELIX_LEVEL < 3 */ + +#if defined(_ELIX_LEVEL) && _ELIX_LEVEL < 2 +static _syscall2_base(int,setrlimit,int,resource,const struct rlimit *,rlp) +int on_exit (void (*fn)(int, void *), void *arg) +{ + register struct _atexit *p; + void (*x)(void) = (void (*)(void))fn; + +/* _REENT_SMALL on_exit() doesn't allow more than the required 32 entries. */ +#ifndef _REENT_SMALL + if ((p = _REENT->_atexit) == NULL) + _REENT->_atexit = p = &_REENT->_atexit0; + if (p->_ind >= _ATEXIT_SIZE) + { + if ((p = (struct _atexit *) malloc (sizeof *p)) == NULL) + return -1; + p->_ind = 0; + p->_fntypes = 0; + p->_next = _REENT->_atexit; + _REENT->_atexit = p; + } +#else + p = &_REENT->_atexit; + if (p->_ind >= _ATEXIT_SIZE) + return -1; +#endif + p->_fntypes |= (1 << p->_ind); + p->_fnargs[p->_ind] = arg; + p->_fns[p->_ind++] = x; + return 0; +} + +#endif /* _ELIX_LEVEL < 2 */ + +/* We need the global/static resolver state here. */ +#include +#undef _res + +/* FIXME: for now, set up _res here */ +struct __res_state _res; + +/* Sanity check. */ +#if __ASSUME_REALTIME_SIGNALS && !defined __SIGRTMIN +# error "This must not happen; new kernel assumed but old headers" +#endif + +/* These variables are used by the setup code. */ + +/* Descriptor of the initial thread */ + +struct _pthread_descr_struct __pthread_initial_thread = { + { + { + &__pthread_initial_thread /* pthread_descr self */ + } + }, + &__pthread_initial_thread, /* pthread_descr p_nextlive */ + &__pthread_initial_thread, /* pthread_descr p_prevlive */ + NULL, /* pthread_descr p_nextwaiting */ + NULL, /* pthread_descr p_nextlock */ + PTHREAD_THREADS_MAX, /* pthread_t p_tid */ + 0, /* int p_pid */ + 0, /* int p_priority */ + &__pthread_handles[0].h_lock, /* struct _pthread_fastlock * p_lock */ + 0, /* int p_signal */ + NULL, /* sigjmp_buf * p_signal_buf */ + NULL, /* sigjmp_buf * p_cancel_buf */ + 0, /* char p_terminated */ + 0, /* char p_detached */ + 0, /* char p_exited */ + NULL, /* void * p_retval */ + 0, /* int p_retval */ + NULL, /* pthread_descr p_joining */ + NULL, /* struct _pthread_cleanup_buffer * p_cleanup */ + 0, /* char p_cancelstate */ + 0, /* char p_canceltype */ + 0, /* char p_canceled */ + &__pthread_initial_thread.p_reent, /* struct _reent *p_reentp */ + _REENT_INIT(__pthread_initial_thread.p_reent), /* struct _reent p_reent */ + NULL, /* int *p_h_errnop */ + 0, /* int p_h_errno */ + NULL, /* char * p_in_sighandler */ + 0, /* char p_sigwaiting */ + PTHREAD_START_ARGS_INITIALIZER(NULL), + /* struct pthread_start_args p_start_args */ + {NULL}, /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */ + {NULL}, /* void * p_libc_specific[_LIBC_TSD_KEY_N] */ + 1, /* int p_userstack */ + NULL, /* void * p_guardaddr */ + 0, /* size_t p_guardsize */ + 0, /* Always index 0 */ + 0, /* int p_report_events */ + {{{0, }}, 0, NULL}, /* td_eventbuf_t p_eventbuf */ + __ATOMIC_INITIALIZER, /* struct pthread_atomic p_resume_count */ + 0, /* char p_woken_by_cancel */ + 0, /* char p_condvar_avail */ + 0, /* char p_sem_avail */ + NULL, /* struct pthread_extricate_if *p_extricate */ + NULL, /* pthread_readlock_info *p_readlock_list; */ + NULL, /* pthread_readlock_info *p_readlock_free; */ + 0 /* int p_untracked_readlock_count; */ +}; + +/* Descriptor of the manager thread; none of this is used but the error + variables, the p_pid and p_priority fields, + and the address for identification. */ + +struct _pthread_descr_struct __pthread_manager_thread = { + { + { + &__pthread_manager_thread /* pthread_descr self */ + } + }, + NULL, /* pthread_descr p_nextlive */ + NULL, /* pthread_descr p_prevlive */ + NULL, /* pthread_descr p_nextwaiting */ + NULL, /* pthread_descr p_nextlock */ + 0, /* int p_tid */ + 0, /* int p_pid */ + 0, /* int p_priority */ + &__pthread_handles[1].h_lock, /* struct _pthread_fastlock * p_lock */ + 0, /* int p_signal */ + NULL, /* sigjmp_buf * p_signal_buf */ + NULL, /* sigjmp_buf * p_cancel_buf */ + 0, /* char p_terminated */ + 0, /* char p_detached */ + 0, /* char p_exited */ + NULL, /* void * p_retval */ + 0, /* int p_retval */ + NULL, /* pthread_descr p_joining */ + NULL, /* struct _pthread_cleanup_buffer * p_cleanup */ + 0, /* char p_cancelstate */ + 0, /* char p_canceltype */ + 0, /* char p_canceled */ + &__pthread_manager_thread.p_reent, /* struct _reent *p_reentp */ + _REENT_INIT(__pthread_manager_thread.p_reent), /* struct _reent p_reent */ + NULL, /* int *p_h_errnop */ + 0, /* int p_h_errno */ + NULL, /* char * p_in_sighandler */ + 0, /* char p_sigwaiting */ + PTHREAD_START_ARGS_INITIALIZER(__pthread_manager), + /* struct pthread_start_args p_start_args */ + {NULL}, /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */ + {NULL}, /* void * p_libc_specific[_LIBC_TSD_KEY_N] */ + 0, /* int p_userstack */ + NULL, /* void * p_guardaddr */ + 0, /* size_t p_guardsize */ + 1, /* Always index 1 */ + 0, /* int p_report_events */ + {{{0, }}, 0, NULL}, /* td_eventbuf_t p_eventbuf */ + __ATOMIC_INITIALIZER, /* struct pthread_atomic p_resume_count */ + 0, /* char p_woken_by_cancel */ + 0, /* char p_condvar_avail */ + 0, /* char p_sem_avail */ + NULL, /* struct pthread_extricate_if *p_extricate */ + NULL, /* pthread_readlock_info *p_readlock_list; */ + NULL, /* pthread_readlock_info *p_readlock_free; */ + 0 /* int p_untracked_readlock_count; */ +}; + +/* Pointer to the main thread (the father of the thread manager thread) */ +/* Originally, this is the initial thread, but this changes after fork() */ + +pthread_descr __pthread_main_thread = &__pthread_initial_thread; + +/* Limit between the stack of the initial thread (above) and the + stacks of other threads (below). Aligned on a STACK_SIZE boundary. */ + +char *__pthread_initial_thread_bos; + +/* File descriptor for sending requests to the thread manager. */ +/* Initially -1, meaning that the thread manager is not running. */ + +int __pthread_manager_request = -1; + +/* Other end of the pipe for sending requests to the thread manager. */ + +int __pthread_manager_reader; + +/* Limits of the thread manager stack */ + +char *__pthread_manager_thread_bos; +char *__pthread_manager_thread_tos; + +/* For process-wide exit() */ + +int __pthread_exit_requested; +int __pthread_exit_code; + +/* Maximum stack size. */ +size_t __pthread_max_stacksize; + +/* Nozero if the machine has more than one processor. */ +int __pthread_smp_kernel; + + +#if !__ASSUME_REALTIME_SIGNALS +/* Pointers that select new or old suspend/resume functions + based on availability of rt signals. */ + +void (*__pthread_restart)(pthread_descr) = __pthread_restart_old; +void (*__pthread_suspend)(pthread_descr) = __pthread_suspend_old; +int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *) = __pthread_timedsuspend_old; +#endif /* __ASSUME_REALTIME_SIGNALS */ + +/* Communicate relevant LinuxThreads constants to gdb */ + +const int __pthread_threads_max = PTHREAD_THREADS_MAX; +const int __pthread_sizeof_handle = sizeof(struct pthread_handle_struct); +const int __pthread_offsetof_descr = offsetof(struct pthread_handle_struct, + h_descr); +const int __pthread_offsetof_pid = offsetof(struct _pthread_descr_struct, + p_pid); +const int __linuxthreads_pthread_sizeof_descr + = sizeof(struct _pthread_descr_struct); + +/* Forward declarations */ + +static void pthread_onexit_process(int retcode, void *arg); +#ifndef HAVE_Z_NODELETE +static void pthread_atexit_process(void *arg, int retcode); +static void pthread_atexit_retcode(void *arg, int retcode); +#endif +static void pthread_handle_sigcancel(int sig); +static void pthread_handle_sigrestart(int sig); +static void pthread_handle_sigdebug(int sig); + +/* CPU clock handling. */ +#if HP_TIMING_AVAIL +extern hp_timing_t _dl_cpuclock_offset; +#endif + +/* Signal numbers used for the communication. + In these variables we keep track of the used variables. If the + platform does not support any real-time signals we will define the + values to some unreasonable value which will signal failing of all + the functions below. */ +#ifndef __SIGRTMIN +static int current_rtmin = -1; +static int current_rtmax = -1; +int __pthread_sig_restart = SIGUSR1; +int __pthread_sig_cancel = SIGUSR2; +int __pthread_sig_debug; +#else +static int current_rtmin; +static int current_rtmax; + +#if __SIGRTMAX - __SIGRTMIN >= 3 +int __pthread_sig_restart = __SIGRTMIN; +int __pthread_sig_cancel = __SIGRTMIN + 1; +int __pthread_sig_debug = __SIGRTMIN + 2; +#else +int __pthread_sig_restart = SIGUSR1; +int __pthread_sig_cancel = SIGUSR2; +int __pthread_sig_debug; +#endif + +static int rtsigs_initialized; + +#if !__ASSUME_REALTIME_SIGNALS +# include "testrtsig.h" +#endif + +static void +init_rtsigs (void) +{ +#if !__ASSUME_REALTIME_SIGNALS + if (__builtin_expect (!kernel_has_rtsig (), 0)) + { + current_rtmin = -1; + current_rtmax = -1; +# if __SIGRTMAX - __SIGRTMIN >= 3 + __pthread_sig_restart = SIGUSR1; + __pthread_sig_cancel = SIGUSR2; + __pthread_sig_debug = 0; +# endif + } + else +#endif /* __ASSUME_REALTIME_SIGNALS */ + { +#if __SIGRTMAX - __SIGRTMIN >= 3 + current_rtmin = __SIGRTMIN + 3; +# if !__ASSUME_REALTIME_SIGNALS + __pthread_restart = __pthread_restart_new; + __pthread_suspend = __pthread_wait_for_restart_signal; + __pthread_timedsuspend = __pthread_timedsuspend_new; +# endif /* __ASSUME_REALTIME_SIGNALS */ +#else + current_rtmin = __SIGRTMIN; +#endif + + current_rtmax = __SIGRTMAX; + } + + rtsigs_initialized = 1; +} +#endif + +/* Return number of available real-time signal with highest priority. */ +int +__libc_current_sigrtmin (void) +{ +#ifdef __SIGRTMIN + if (__builtin_expect (!rtsigs_initialized, 0)) + init_rtsigs (); +#endif + return current_rtmin; +} + +/* Return number of available real-time signal with lowest priority. */ +int +__libc_current_sigrtmax (void) +{ +#ifdef __SIGRTMIN + if (__builtin_expect (!rtsigs_initialized, 0)) + init_rtsigs (); +#endif + return current_rtmax; +} + +/* Allocate real-time signal with highest/lowest available + priority. Please note that we don't use a lock since we assume + this function to be called at program start. */ +int +__libc_allocate_rtsig (int high) +{ +#ifndef __SIGRTMIN + return -1; +#else + if (__builtin_expect (!rtsigs_initialized, 0)) + init_rtsigs (); + if (__builtin_expect (current_rtmin == -1, 0) + || __builtin_expect (current_rtmin > current_rtmax, 0)) + /* We don't have anymore signal available. */ + return -1; + + return high ? current_rtmin++ : current_rtmax--; +#endif +} + +/* The function we use to get the kernel revision. */ +extern int __sysctl (int *name, int nlen, void *oldval, size_t *oldlenp, + void *newval, size_t newlen); + +/* Test whether the machine has more than one processor. This is not the + best test but good enough. More complicated tests would require `malloc' + which is not available at that time. */ +static int +is_smp_system (void) +{ + static const int sysctl_args[] = { CTL_KERN, KERN_VERSION }; + char buf[512]; + size_t reslen = sizeof (buf); + + /* Try reading the number using `sysctl' first. */ + if (__sysctl ((int *) sysctl_args, + sizeof (sysctl_args) / sizeof (sysctl_args[0]), + buf, &reslen, NULL, 0) < 0) + { + /* This was not successful. Now try reading the /proc filesystem. */ + int fd = __open ("/proc/sys/kernel/version", O_RDONLY); + if (__builtin_expect (fd, 0) == -1 + || (reslen = __read (fd, buf, sizeof (buf))) <= 0) + /* This also didn't work. We give up and say it's a UP machine. */ + buf[0] = '\0'; + + __close (fd); + } + + return strstr (buf, "SMP") != NULL; +} + + +/* Initialize the pthread library. + Initialization is split in two functions: + - a constructor function that blocks the __pthread_sig_restart signal + (must do this very early, since the program could capture the signal + mask with e.g. sigsetjmp before creating the first thread); + - a regular function called from pthread_create when needed. */ + +static void pthread_initialize(void) __attribute__((constructor)); + +#ifndef HAVE_Z_NODELETE +extern void *__dso_handle __attribute__ ((weak)); +#endif + + +/* Do some minimal initialization which has to be done during the + startup of the C library. */ +void +__pthread_initialize_minimal(void) +{ + /* If we have special thread_self processing, initialize that for the + main thread now. */ +#ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(&__pthread_initial_thread, 0); +#endif +#if HP_TIMING_AVAIL + __pthread_initial_thread.p_cpuclock_offset = _dl_cpuclock_offset; +#endif +} + + +void +__pthread_init_max_stacksize(void) +{ + struct rlimit limit; + size_t max_stack; + + getrlimit(RLIMIT_STACK, &limit); +#ifdef FLOATING_STACKS + if (limit.rlim_cur == RLIM_INFINITY) + limit.rlim_cur = ARCH_STACK_MAX_SIZE; +# ifdef NEED_SEPARATE_REGISTER_STACK + max_stack = limit.rlim_cur / 2; +# else + max_stack = limit.rlim_cur; +# endif +#else + /* Play with the stack size limit to make sure that no stack ever grows + beyond STACK_SIZE minus one page (to act as a guard page). */ +# ifdef NEED_SEPARATE_REGISTER_STACK + /* STACK_SIZE bytes hold both the main stack and register backing + store. The rlimit value applies to each individually. */ + max_stack = STACK_SIZE/2 - __getpagesize (); +# else + max_stack = STACK_SIZE - __getpagesize(); +# endif + if (limit.rlim_cur > max_stack) { + limit.rlim_cur = max_stack; + __libc_setrlimit(RLIMIT_STACK, &limit); + } +#endif + __pthread_max_stacksize = max_stack; +} + + +static void pthread_initialize(void) +{ + struct sigaction sa; + sigset_t mask; + + /* If already done (e.g. by a constructor called earlier!), bail out */ + if (__pthread_initial_thread_bos != NULL) return; +#ifdef TEST_FOR_COMPARE_AND_SWAP + /* Test if compare-and-swap is available */ + __pthread_has_cas = compare_and_swap_is_available(); +#endif +#ifdef FLOATING_STACKS + /* We don't need to know the bottom of the stack. Give the pointer some + value to signal that initialization happened. */ + __pthread_initial_thread_bos = (void *) -1l; +#else + /* Determine stack size limits . */ + __pthread_init_max_stacksize (); +# ifdef _STACK_GROWS_UP + /* The initial thread already has all the stack it needs */ + __pthread_initial_thread_bos = (char *) + ((long)CURRENT_STACK_FRAME &~ (STACK_SIZE - 1)); +# else + /* For the initial stack, reserve at least STACK_SIZE bytes of stack + below the current stack address, and align that on a + STACK_SIZE boundary. */ + __pthread_initial_thread_bos = + (char *)(((long)CURRENT_STACK_FRAME - 2 * STACK_SIZE) & ~(STACK_SIZE - 1)); +# endif +#endif + /* Update the descriptor for the initial thread. */ + __pthread_initial_thread.p_pid = __getpid(); + /* Likewise for the resolver state _res. */ + __pthread_initial_thread.p_resp = &_res; +#ifdef __SIGRTMIN + /* Initialize real-time signals. */ + init_rtsigs (); +#endif + /* Setup signal handlers for the initial thread. + Since signal handlers are shared between threads, these settings + will be inherited by all other threads. */ + sa.sa_handler = pthread_handle_sigrestart; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + __libc_sigaction(__pthread_sig_restart, &sa, NULL); + sa.sa_handler = pthread_handle_sigcancel; + // sa.sa_flags = 0; + __libc_sigaction(__pthread_sig_cancel, &sa, NULL); + if (__pthread_sig_debug > 0) { + sa.sa_handler = pthread_handle_sigdebug; + sigemptyset(&sa.sa_mask); + // sa.sa_flags = 0; + __libc_sigaction(__pthread_sig_debug, &sa, NULL); + } + /* Initially, block __pthread_sig_restart. Will be unblocked on demand. */ + sigemptyset(&mask); + sigaddset(&mask, __pthread_sig_restart); + sigprocmask(SIG_BLOCK, &mask, NULL); + /* Register an exit function to kill all other threads. */ + /* Do it early so that user-registered atexit functions are called + before pthread_*exit_process. */ +#ifndef HAVE_Z_NODELETE + if (__builtin_expect (&__dso_handle != NULL, 1)) + __cxa_atexit ((void (*) (void *)) pthread_atexit_process, NULL, + __dso_handle); + else +#endif + on_exit (pthread_onexit_process, NULL); + /* How many processors. */ + __pthread_smp_kernel = is_smp_system (); +} + +void __pthread_initialize(void) +{ + pthread_initialize(); +} + +int __pthread_initialize_manager(void) +{ + int manager_pipe[2]; + int pid; + struct pthread_request request; + +#ifndef HAVE_Z_NODELETE + if (__builtin_expect (&__dso_handle != NULL, 1)) + __cxa_atexit ((void (*) (void *)) pthread_atexit_retcode, NULL, + __dso_handle); +#endif + + if (__pthread_max_stacksize == 0) + __pthread_init_max_stacksize (); + /* If basic initialization not done yet (e.g. we're called from a + constructor run before our constructor), do it now */ + if (__pthread_initial_thread_bos == NULL) pthread_initialize(); + /* Setup stack for thread manager */ + __pthread_manager_thread_bos = malloc(THREAD_MANAGER_STACK_SIZE); + if (__pthread_manager_thread_bos == NULL) return -1; + __pthread_manager_thread_tos = + __pthread_manager_thread_bos + THREAD_MANAGER_STACK_SIZE; + /* Setup pipe to communicate with thread manager */ + if (__libc_pipe(manager_pipe) == -1) { + free(__pthread_manager_thread_bos); + return -1; + } + /* Start the thread manager */ + pid = 0; + if (__builtin_expect (__pthread_initial_thread.p_report_events, 0)) + { + /* It's a bit more complicated. We have to report the creation of + the manager thread. */ + int idx = __td_eventword (TD_CREATE); + uint32_t mask = __td_eventmask (TD_CREATE); + + if ((mask & (__pthread_threads_events.event_bits[idx] + | __pthread_initial_thread.p_eventbuf.eventmask.event_bits[idx])) + != 0) + { + __pthread_lock(__pthread_manager_thread.p_lock, NULL); + +#ifdef NEED_SEPARATE_REGISTER_STACK + pid = __clone2(__pthread_manager_event, + (void **) __pthread_manager_thread_bos, + THREAD_MANAGER_STACK_SIZE, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, + (void *)(long)manager_pipe[0]); +#elif _STACK_GROWS_UP + pid = __clone(__pthread_manager_event, + (void **) __pthread_manager_thread_bos, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, + (void *)(long)manager_pipe[0]); +#else + pid = __clone(__pthread_manager_event, + (void **) __pthread_manager_thread_tos, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, + (void *)(long)manager_pipe[0]); +#endif + + if (pid != -1) + { + /* Now fill in the information about the new thread in + the newly created thread's data structure. We cannot let + the new thread do this since we don't know whether it was + already scheduled when we send the event. */ + __pthread_manager_thread.p_eventbuf.eventdata = + &__pthread_manager_thread; + __pthread_manager_thread.p_eventbuf.eventnum = TD_CREATE; + __pthread_last_event = &__pthread_manager_thread; + __pthread_manager_thread.p_tid = 2* PTHREAD_THREADS_MAX + 1; + __pthread_manager_thread.p_pid = pid; + + /* Now call the function which signals the event. */ + __linuxthreads_create_event (); + } + + /* Now restart the thread. */ + __pthread_unlock(__pthread_manager_thread.p_lock); + } + } + + if (__builtin_expect (pid, 0) == 0) + { +#ifdef NEED_SEPARATE_REGISTER_STACK + pid = __clone2(__pthread_manager, (void **) __pthread_manager_thread_bos, + THREAD_MANAGER_STACK_SIZE, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, + (void *)(long)manager_pipe[0]); +#elif _STACK_GROWS_UP + pid = __clone(__pthread_manager, (void **) __pthread_manager_thread_bos, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, + (void *)(long)manager_pipe[0]); +#else + pid = __clone(__pthread_manager, (void **) __pthread_manager_thread_tos, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, + (void *)(long)manager_pipe[0]); +#endif + } + if (__builtin_expect (pid, 0) == -1) { + free(__pthread_manager_thread_bos); + __libc_close(manager_pipe[0]); + __libc_close(manager_pipe[1]); + return -1; + } + __pthread_manager_request = manager_pipe[1]; /* writing end */ + __pthread_manager_reader = manager_pipe[0]; /* reading end */ + __pthread_manager_thread.p_tid = 2* PTHREAD_THREADS_MAX + 1; + __pthread_manager_thread.p_pid = pid; + /* Make gdb aware of new thread manager */ + if (__builtin_expect (__pthread_threads_debug, 0) && __pthread_sig_debug > 0) + { + raise(__pthread_sig_debug); + /* We suspend ourself and gdb will wake us up when it is + ready to handle us. */ + __pthread_wait_for_restart_signal(thread_self()); + } + /* Synchronize debugging of the thread manager */ + request.req_kind = REQ_DEBUG; + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + return 0; +} + +/* Thread creation */ + +int __pthread_create_2_1(pthread_t *thread, const pthread_attr_t *attr, + void * (*start_routine)(void *), void *arg) +{ + pthread_descr self = thread_self(); + struct pthread_request request; + int retval; + if (__builtin_expect (__pthread_manager_request, 0) < 0) { + if (__pthread_initialize_manager() < 0) return EAGAIN; + } + request.req_thread = self; + request.req_kind = REQ_CREATE; + request.req_args.create.attr = attr; + request.req_args.create.fn = start_routine; + request.req_args.create.arg = arg; + sigprocmask(SIG_SETMASK, (const sigset_t *) NULL, + &request.req_args.create.mask); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + suspend(self); + retval = THREAD_GETMEM(self, p_retcode); + if (__builtin_expect (retval, 0) == 0) + *thread = (pthread_t) THREAD_GETMEM(self, p_retval); + return retval; +} + +versioned_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1); + +#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1) + +int __pthread_create_2_0(pthread_t *thread, const pthread_attr_t *attr, + void * (*start_routine)(void *), void *arg) +{ + /* The ATTR attribute is not really of type `pthread_attr_t *'. It has + the old size and access to the new members might crash the program. + We convert the struct now. */ + pthread_attr_t new_attr; + + if (attr != NULL) + { + size_t ps = __getpagesize (); + + memcpy (&new_attr, attr, + (size_t) &(((pthread_attr_t*)NULL)->__guardsize)); + new_attr.__guardsize = ps; + new_attr.__stackaddr_set = 0; + new_attr.__stackaddr = NULL; + new_attr.__stacksize = STACK_SIZE - ps; + attr = &new_attr; + } + return __pthread_create_2_1 (thread, attr, start_routine, arg); +} +compat_symbol (libpthread, __pthread_create_2_0, pthread_create, GLIBC_2_0); +#endif + +/* Simple operations on thread identifiers */ + +pthread_t pthread_self(void) +{ + pthread_descr self = thread_self(); + return THREAD_GETMEM(self, p_tid); +} + +int pthread_equal(pthread_t thread1, pthread_t thread2) +{ + return thread1 == thread2; +} + +/* Helper function for thread_self in the case of user-provided stacks */ + +#ifndef THREAD_SELF + +pthread_descr __pthread_find_self(void) +{ + char * sp = CURRENT_STACK_FRAME; + pthread_handle h; + + /* __pthread_handles[0] is the initial thread, __pthread_handles[1] is + the manager threads handled specially in thread_self(), so start at 2 */ + h = __pthread_handles + 2; + while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom)) h++; + return h->h_descr; +} + +#else + +static pthread_descr thread_self_stack(void) +{ + char *sp = CURRENT_STACK_FRAME; + pthread_handle h; + + if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos) + return &__pthread_manager_thread; + h = __pthread_handles + 2; + while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom)) + h++; + return h->h_descr; +} + +#endif + +/* Thread scheduling */ + +int pthread_setschedparam(pthread_t thread, int policy, + const struct sched_param *param) +{ + pthread_handle handle = thread_handle(thread); + pthread_descr th; + + __pthread_lock(&handle->h_lock, NULL); + if (__builtin_expect (invalid_handle(handle, thread), 0)) { + __pthread_unlock(&handle->h_lock); + return ESRCH; + } + th = handle->h_descr; + if (__builtin_expect (__sched_setscheduler(th->p_pid, policy, param) == -1, + 0)) { + __pthread_unlock(&handle->h_lock); + return errno; + } + th->p_priority = policy == SCHED_OTHER ? 0 : param->sched_priority; + __pthread_unlock(&handle->h_lock); + if (__pthread_manager_request >= 0) + __pthread_manager_adjust_prio(th->p_priority); + return 0; +} + +int pthread_getschedparam(pthread_t thread, int *policy, + struct sched_param *param) +{ + pthread_handle handle = thread_handle(thread); + int pid, pol; + + __pthread_lock(&handle->h_lock, NULL); + if (__builtin_expect (invalid_handle(handle, thread), 0)) { + __pthread_unlock(&handle->h_lock); + return ESRCH; + } + pid = handle->h_descr->p_pid; + __pthread_unlock(&handle->h_lock); + pol = __sched_getscheduler(pid); + if (__builtin_expect (pol, 0) == -1) return errno; + if (__sched_getparam(pid, param) == -1) return errno; + *policy = pol; + return 0; +} + +int __pthread_yield (void) +{ + /* For now this is equivalent with the POSIX call. */ + return sched_yield (); +} +weak_alias (__pthread_yield, pthread_yield) + +/* Process-wide exit() request */ + +static void pthread_onexit_process(int retcode, void *arg) +{ + if (__builtin_expect (__pthread_manager_request, 0) >= 0) { + struct pthread_request request; + pthread_descr self = thread_self(); + + request.req_thread = self; + request.req_kind = REQ_PROCESS_EXIT; + request.req_args.exit.code = retcode; + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + suspend(self); + /* Main thread should accumulate times for thread manager and its + children, so that timings for main thread account for all threads. */ + if (self == __pthread_main_thread) + { + __waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE); + /* Since all threads have been asynchronously terminated + (possibly holding locks), free cannot be used any more. */ + /*free (__pthread_manager_thread_bos);*/ + __pthread_manager_thread_bos = __pthread_manager_thread_tos = NULL; + } + } +} + +#ifndef HAVE_Z_NODELETE +static int __pthread_atexit_retcode; + +static void pthread_atexit_process(void *arg, int retcode) +{ + pthread_onexit_process (retcode ?: __pthread_atexit_retcode, arg); +} + +static void pthread_atexit_retcode(void *arg, int retcode) +{ + __pthread_atexit_retcode = retcode; +} +#endif + +/* The handler for the RESTART signal just records the signal received + in the thread descriptor, and optionally performs a siglongjmp + (for pthread_cond_timedwait). */ + +static void pthread_handle_sigrestart(int sig) +{ + pthread_descr self = thread_self(); + THREAD_SETMEM(self, p_signal, sig); + if (THREAD_GETMEM(self, p_signal_jmp) != NULL) + siglongjmp(*THREAD_GETMEM(self, p_signal_jmp), 1); +} + +/* The handler for the CANCEL signal checks for cancellation + (in asynchronous mode), for process-wide exit and exec requests. + For the thread manager thread, redirect the signal to + __pthread_manager_sighandler. */ + +static void pthread_handle_sigcancel(int sig) +{ + pthread_descr self = thread_self(); + sigjmp_buf * jmpbuf; + + if (self == &__pthread_manager_thread) + { +#ifdef THREAD_SELF + /* A new thread might get a cancel signal before it is fully + initialized, so that the thread register might still point to the + manager thread. Double check that this is really the manager + thread. */ + pthread_descr real_self = thread_self_stack(); + if (real_self == &__pthread_manager_thread) + { + __pthread_manager_sighandler(sig); + return; + } + /* Oops, thread_self() isn't working yet.. */ + self = real_self; +# ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(self, self->p_nr); +# endif +#else + __pthread_manager_sighandler(sig); + return; +#endif + } + if (__builtin_expect (__pthread_exit_requested, 0)) { + /* Main thread should accumulate times for thread manager and its + children, so that timings for main thread account for all threads. */ + if (self == __pthread_main_thread) + __waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE); + _exit(__pthread_exit_code); + } + if (__builtin_expect (THREAD_GETMEM(self, p_canceled), 0) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) { + if (THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS) + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + jmpbuf = THREAD_GETMEM(self, p_cancel_jmp); + if (jmpbuf != NULL) { + THREAD_SETMEM(self, p_cancel_jmp, NULL); + siglongjmp(*jmpbuf, 1); + } + } +} + +/* Handler for the DEBUG signal. + The debugging strategy is as follows: + On reception of a REQ_DEBUG request (sent by new threads created to + the thread manager under debugging mode), the thread manager throws + __pthread_sig_debug to itself. The debugger (if active) intercepts + this signal, takes into account new threads and continue execution + of the thread manager by propagating the signal because it doesn't + know what it is specifically done for. In the current implementation, + the thread manager simply discards it. */ + +static void pthread_handle_sigdebug(int sig) +{ + /* Nothing */ +} + +/* Reset the state of the thread machinery after a fork(). + Close the pipe used for requests and set the main thread to the forked + thread. + Notice that we can't free the stack segments, as the forked thread + may hold pointers into them. */ + +void __pthread_reset_main_thread(void) +{ + pthread_descr self = thread_self(); + struct rlimit limit; + + if (__pthread_manager_request != -1) { + /* Free the thread manager stack */ + free(__pthread_manager_thread_bos); + __pthread_manager_thread_bos = __pthread_manager_thread_tos = NULL; + /* Close the two ends of the pipe */ + __libc_close(__pthread_manager_request); + __libc_close(__pthread_manager_reader); + __pthread_manager_request = __pthread_manager_reader = -1; + } + + /* Update the pid of the main thread */ + THREAD_SETMEM(self, p_pid, __getpid()); + /* Make the forked thread the main thread */ + __pthread_main_thread = self; + THREAD_SETMEM(self, p_nextlive, self); + THREAD_SETMEM(self, p_prevlive, self); + /* Now this thread modifies the global variables. */ + THREAD_SETMEM(self, p_resp, &_res); + + if (getrlimit (RLIMIT_STACK, &limit) == 0 + && limit.rlim_cur != limit.rlim_max) { + limit.rlim_cur = limit.rlim_max; + __libc_setrlimit(RLIMIT_STACK, &limit); + } +} + +/* Process-wide exec() request */ + +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 + +void __pthread_kill_other_threads_np(void) +{ + struct sigaction sa; + /* Terminate all other threads and thread manager */ + pthread_onexit_process(0, NULL); + /* Make current thread the main thread in case the calling thread + changes its mind, does not exec(), and creates new threads instead. */ + __pthread_reset_main_thread(); + + /* Reset the signal handlers behaviour for the signals the + implementation uses since this would be passed to the new + process. */ + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = SIG_DFL; + __libc_sigaction(__pthread_sig_restart, &sa, NULL); + __libc_sigaction(__pthread_sig_cancel, &sa, NULL); + if (__pthread_sig_debug > 0) + __libc_sigaction(__pthread_sig_debug, &sa, NULL); +} +weak_alias (__pthread_kill_other_threads_np, pthread_kill_other_threads_np) + +#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 2 */ + +/* Concurrency symbol level. */ +static int current_level; + +int __pthread_setconcurrency(int level) +{ + /* We don't do anything unless we have found a useful interpretation. */ + current_level = level; + return 0; +} +weak_alias (__pthread_setconcurrency, pthread_setconcurrency) + +int __pthread_getconcurrency(void) +{ + return current_level; +} +weak_alias (__pthread_getconcurrency, pthread_getconcurrency) + +/* Primitives for controlling thread execution */ + +void __pthread_wait_for_restart_signal(pthread_descr self) +{ + sigset_t mask; + + sigprocmask(SIG_SETMASK, NULL, &mask); /* Get current signal mask */ + sigdelset(&mask, __pthread_sig_restart); /* Unblock the restart signal */ + THREAD_SETMEM(self, p_signal, 0); + do { + sigsuspend(&mask); /* Wait for signal */ + } while (THREAD_GETMEM(self, p_signal) !=__pthread_sig_restart); + + READ_MEMORY_BARRIER(); /* See comment in __pthread_restart_new */ +} + +#if !__ASSUME_REALTIME_SIGNALS +/* The _old variants are for 2.0 and early 2.1 kernels which don't have RT + signals. + On these kernels, we use SIGUSR1 and SIGUSR2 for restart and cancellation. + Since the restart signal does not queue, we use an atomic counter to create + queuing semantics. This is needed to resolve a rare race condition in + pthread_cond_timedwait_relative. */ + +void __pthread_restart_old(pthread_descr th) +{ + if (atomic_increment(&th->p_resume_count) == -1) + kill(th->p_pid, __pthread_sig_restart); +} + +void __pthread_suspend_old(pthread_descr self) +{ + if (atomic_decrement(&self->p_resume_count) <= 0) + __pthread_wait_for_restart_signal(self); +} + +int +__pthread_timedsuspend_old(pthread_descr self, const struct timespec *abstime) +{ + sigset_t unblock, initial_mask; + int was_signalled = 0; + sigjmp_buf jmpbuf; + + if (atomic_decrement(&self->p_resume_count) == 0) { + /* Set up a longjmp handler for the restart signal, unblock + the signal and sleep. */ + + if (sigsetjmp(jmpbuf, 1) == 0) { + THREAD_SETMEM(self, p_signal_jmp, &jmpbuf); + THREAD_SETMEM(self, p_signal, 0); + /* Unblock the restart signal */ + sigemptyset(&unblock); + sigaddset(&unblock, __pthread_sig_restart); + sigprocmask(SIG_UNBLOCK, &unblock, &initial_mask); + + while (1) { + struct timeval now; + struct timespec reltime; + + /* Compute a time offset relative to now. */ + __gettimeofday (&now, NULL); + reltime.tv_nsec = abstime->tv_nsec - now.tv_usec * 1000; + reltime.tv_sec = abstime->tv_sec - now.tv_sec; + if (reltime.tv_nsec < 0) { + reltime.tv_nsec += 1000000000; + reltime.tv_sec -= 1; + } + + /* Sleep for the required duration. If woken by a signal, + resume waiting as required by Single Unix Specification. */ + if (reltime.tv_sec < 0 || __libc_nanosleep(&reltime, NULL) == 0) + break; + } + + /* Block the restart signal again */ + sigprocmask(SIG_SETMASK, &initial_mask, NULL); + was_signalled = 0; + } else { + was_signalled = 1; + } + THREAD_SETMEM(self, p_signal_jmp, NULL); + } + + /* Now was_signalled is true if we exited the above code + due to the delivery of a restart signal. In that case, + we know we have been dequeued and resumed and that the + resume count is balanced. Otherwise, there are some + cases to consider. First, try to bump up the resume count + back to zero. If it goes to 1, it means restart() was + invoked on this thread. The signal must be consumed + and the count bumped down and everything is cool. We + can return a 1 to the caller. + Otherwise, no restart was delivered yet, so a potential + race exists; we return a 0 to the caller which must deal + with this race in an appropriate way; for example by + atomically removing the thread from consideration for a + wakeup---if such a thing fails, it means a restart is + being delivered. */ + + if (!was_signalled) { + if (atomic_increment(&self->p_resume_count) != -1) { + __pthread_wait_for_restart_signal(self); + atomic_decrement(&self->p_resume_count); /* should be zero now! */ + /* woke spontaneously and consumed restart signal */ + return 1; + } + /* woke spontaneously but did not consume restart---caller must resolve */ + return 0; + } + /* woken due to restart signal */ + return 1; +} +#endif /* __ASSUME_REALTIME_SIGNALS */ + +void __pthread_restart_new(pthread_descr th) +{ + /* The barrier is proabably not needed, in which case it still documents + our assumptions. The intent is to commit previous writes to shared + memory so the woken thread will have a consistent view. Complementary + read barriers are present to the suspend functions. */ + WRITE_MEMORY_BARRIER(); + kill(th->p_pid, __pthread_sig_restart); +} + +/* There is no __pthread_suspend_new because it would just + be a wasteful wrapper for __pthread_wait_for_restart_signal */ + +int +__pthread_timedsuspend_new(pthread_descr self, const struct timespec *abstime) +{ + sigset_t unblock, initial_mask; + int was_signalled = 0; + sigjmp_buf jmpbuf; + + if (sigsetjmp(jmpbuf, 1) == 0) { + THREAD_SETMEM(self, p_signal_jmp, &jmpbuf); + THREAD_SETMEM(self, p_signal, 0); + /* Unblock the restart signal */ + sigemptyset(&unblock); + sigaddset(&unblock, __pthread_sig_restart); + sigprocmask(SIG_UNBLOCK, &unblock, &initial_mask); + + while (1) { + struct timeval now; + struct timespec reltime; + + /* Compute a time offset relative to now. */ + __gettimeofday (&now, NULL); + reltime.tv_nsec = abstime->tv_nsec - now.tv_usec * 1000; + reltime.tv_sec = abstime->tv_sec - now.tv_sec; + if (reltime.tv_nsec < 0) { + reltime.tv_nsec += 1000000000; + reltime.tv_sec -= 1; + } + + /* Sleep for the required duration. If woken by a signal, + resume waiting as required by Single Unix Specification. */ + if (reltime.tv_sec < 0 || __libc_nanosleep(&reltime, NULL) == 0) + break; + } + + /* Block the restart signal again */ + sigprocmask(SIG_SETMASK, &initial_mask, NULL); + was_signalled = 0; + } else { + was_signalled = 1; + } + THREAD_SETMEM(self, p_signal_jmp, NULL); + + /* Now was_signalled is true if we exited the above code + due to the delivery of a restart signal. In that case, + everything is cool. We have been removed from whatever + we were waiting on by the other thread, and consumed its signal. + + Otherwise we this thread woke up spontaneously, or due to a signal other + than restart. This is an ambiguous case that must be resolved by + the caller; the thread is still eligible for a restart wakeup + so there is a race. */ + + READ_MEMORY_BARRIER(); /* See comment in __pthread_restart_new */ + return was_signalled; +} + + +/* Debugging aid */ + +#ifdef DEBUG +#include + +void __pthread_message(char * fmt, ...) +{ + char buffer[1024]; + va_list args; + sprintf(buffer, "%05d : ", __getpid()); + va_start(args, fmt); + vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args); + va_end(args); + TEMP_FAILURE_RETRY(__libc_write(2, buffer, strlen(buffer))); +} + +#endif + + +#ifndef SHARED +/* We need a hook to force the cancelation wrappers and file locking + to be linked in when static libpthread is used. */ +extern const int __pthread_provide_wrappers; +static const int *const __pthread_require_wrappers = + &__pthread_provide_wrappers; +extern const int __pthread_provide_lockfile; +static const int *const __pthread_require_lockfile = + &__pthread_provide_lockfile; +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/ptlongjmp.c b/newlib/libc/sys/linux/linuxthreads/ptlongjmp.c new file mode 100644 index 000000000..c2ac55f63 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/ptlongjmp.c @@ -0,0 +1,73 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Redefine siglongjmp and longjmp so that they interact correctly + with cleanup handlers */ + +#include +#include "pthread.h" +#include "internals.h" + +/* These functions are not declared anywhere since they shouldn't be + used at another place but here. */ +extern void __libc_siglongjmp (sigjmp_buf env, int val) + __attribute__ ((noreturn)); +extern void __libc_longjmp (jmp_buf env, int val) + __attribute__ ((noreturn)); + + +static void pthread_cleanup_upto(jmp_buf target) +{ + pthread_descr self = thread_self(); + struct _pthread_cleanup_buffer * c; + char *currentframe = CURRENT_STACK_FRAME; + + for (c = THREAD_GETMEM(self, p_cleanup); + c != NULL && _JMPBUF_UNWINDS(target, c); + c = c->__prev) + { +#if _STACK_GROWS_DOWN + if ((char *) c <= currentframe) + { + c = NULL; + break; + } +#elif _STACK_GROWS_UP + if ((char *) c >= currentframe) + { + c = NULL; + break; + } +#else +# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP" +#endif + c->__routine(c->__arg); + } + THREAD_SETMEM(self, p_cleanup, c); + if (THREAD_GETMEM(self, p_in_sighandler) + && _JMPBUF_UNWINDS(target, THREAD_GETMEM(self, p_in_sighandler))) + THREAD_SETMEM(self, p_in_sighandler, NULL); +} + +void siglongjmp(sigjmp_buf env, int val) +{ + pthread_cleanup_upto(env.__buf); + __libc_siglongjmp(env, val); +} + +void longjmp(jmp_buf env, int val) +{ + pthread_cleanup_upto(env); + __libc_longjmp(env, val); +} diff --git a/newlib/libc/sys/linux/linuxthreads/queue.h b/newlib/libc/sys/linux/linuxthreads/queue.h new file mode 100644 index 000000000..28bd75531 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/queue.h @@ -0,0 +1,61 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Waiting queues */ + +/* Waiting queues are represented by lists of thread descriptors + linked through their p_nextwaiting field. The lists are kept + sorted by decreasing priority, and then decreasing waiting time. */ + +static inline void enqueue(pthread_descr * q, pthread_descr th) +{ + int prio = th->p_priority; + ASSERT(th->p_nextwaiting == NULL); + for (; *q != NULL; q = &((*q)->p_nextwaiting)) { + if (prio > (*q)->p_priority) { + th->p_nextwaiting = *q; + *q = th; + return; + } + } + *q = th; +} + +static inline pthread_descr dequeue(pthread_descr * q) +{ + pthread_descr th; + th = *q; + if (th != NULL) { + *q = th->p_nextwaiting; + th->p_nextwaiting = NULL; + } + return th; +} + +static inline int remove_from_queue(pthread_descr * q, pthread_descr th) +{ + for (; *q != NULL; q = &((*q)->p_nextwaiting)) { + if (*q == th) { + *q = th->p_nextwaiting; + th->p_nextwaiting = NULL; + return 1; + } + } + return 0; +} + +static inline int queue_is_empty(pthread_descr * q) +{ + return *q == NULL; +} diff --git a/newlib/libc/sys/linux/linuxthreads/reent.c b/newlib/libc/sys/linux/linuxthreads/reent.c new file mode 100644 index 000000000..44d6f7858 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/reent.c @@ -0,0 +1,18 @@ +/* Define the location of _REENT for the newlib C library */ + +#include +#include "pthread.h" +#include "internals.h" + +struct _reent * __thread_reent() +{ + pthread_descr self = thread_self(); + return THREAD_GETMEM (self, p_reentp); +} + +/* Return thread specific resolver state. */ +struct __res_state * __res_state() +{ + pthread_descr self = thread_self(); + return THREAD_GETMEM (self, p_resp); +} diff --git a/newlib/libc/sys/linux/linuxthreads/reqsyscalls.c b/newlib/libc/sys/linux/linuxthreads/reqsyscalls.c new file mode 100644 index 000000000..714a8ba36 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/reqsyscalls.c @@ -0,0 +1,20 @@ +/* EL/IX level 1 and 2 libraries don't have the following syscalls, + but we need them due to our threading model based on processes */ + +#include +#include +#include +#include + +#define __NR___waitpid __NR_waitpid +#define __NR___sched_getparam __NR_sched_getparam +#define __NR___sched_getscheduler __NR_sched_getscheduler +#define __NR___sched_setscheduler __NR_sched_setscheduler + +_syscall2(int,__sched_getparam,pid_t,pid,struct sched_param *,sched); +_syscall1(int,__sched_getscheduler,pid_t,pid); +_syscall3(int,__sched_setscheduler,pid_t,pid,int,policy,const struct sched_param *,sched); + +/* we want __libc____waitpid defined to support __waitpid which is + defined in wrapsyscall.c */ +_syscall3_base(pid_t,__waitpid,pid_t,pid,int *,wait_stat,int,options) diff --git a/newlib/libc/sys/linux/linuxthreads/restart.h b/newlib/libc/sys/linux/linuxthreads/restart.h new file mode 100644 index 000000000..24d9fab74 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/restart.h @@ -0,0 +1,49 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +#include +#include + +/* Primitives for controlling thread execution */ + +static inline void restart(pthread_descr th) +{ + /* See pthread.c */ +#if __ASSUME_REALTIME_SIGNALS + __pthread_restart_new(th); +#else + __pthread_restart(th); +#endif +} + +static inline void suspend(pthread_descr self) +{ + /* See pthread.c */ +#if __ASSUME_REALTIME_SIGNALS + __pthread_wait_for_restart_signal(self); +#else + __pthread_suspend(self); +#endif +} + +static inline int timedsuspend(pthread_descr self, + const struct timespec *abstime) +{ + /* See pthread.c */ +#if __ASSUME_REALTIME_SIGNALS + return __pthread_timedsuspend_new(self, abstime); +#else + return __pthread_timedsuspend(self, abstime); +#endif +} diff --git a/newlib/libc/sys/linux/linuxthreads/rwlock.c b/newlib/libc/sys/linux/linuxthreads/rwlock.c new file mode 100644 index 000000000..e39597014 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/rwlock.c @@ -0,0 +1,658 @@ +/* Read-write lock implementation. + Copyright (C) 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Xavier Leroy + and Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include "internals.h" +#include "queue.h" +#include "spinlock.h" +#include "restart.h" + +/* Function called by pthread_cancel to remove the thread from + waiting inside pthread_rwlock_timedrdlock or pthread_rwlock_timedwrlock. */ + +static int rwlock_rd_extricate_func(void *obj, pthread_descr th) +{ + pthread_rwlock_t *rwlock = obj; + int did_remove = 0; + + __pthread_lock(&rwlock->__rw_lock, NULL); + did_remove = remove_from_queue(&rwlock->__rw_read_waiting, th); + __pthread_unlock(&rwlock->__rw_lock); + + return did_remove; +} + +static int rwlock_wr_extricate_func(void *obj, pthread_descr th) +{ + pthread_rwlock_t *rwlock = obj; + int did_remove = 0; + + __pthread_lock(&rwlock->__rw_lock, NULL); + did_remove = remove_from_queue(&rwlock->__rw_write_waiting, th); + __pthread_unlock(&rwlock->__rw_lock); + + return did_remove; +} + +/* + * Check whether the calling thread already owns one or more read locks on the + * specified lock. If so, return a pointer to the read lock info structure + * corresponding to that lock. + */ + +static pthread_readlock_info * +rwlock_is_in_list(pthread_descr self, pthread_rwlock_t *rwlock) +{ + pthread_readlock_info *info; + + for (info = THREAD_GETMEM (self, p_readlock_list); info != NULL; + info = info->pr_next) + { + if (info->pr_lock == rwlock) + return info; + } + + return NULL; +} + +/* + * Add a new lock to the thread's list of locks for which it has a read lock. + * A new info node must be allocated for this, which is taken from the thread's + * free list, or by calling malloc. If malloc fails, a null pointer is + * returned. Otherwise the lock info structure is initialized and pushed + * onto the thread's list. + */ + +static pthread_readlock_info * +rwlock_add_to_list(pthread_descr self, pthread_rwlock_t *rwlock) +{ + pthread_readlock_info *info = THREAD_GETMEM (self, p_readlock_free); + + if (info != NULL) + THREAD_SETMEM (self, p_readlock_free, info->pr_next); + else + info = malloc(sizeof *info); + + if (info == NULL) + return NULL; + + info->pr_lock_count = 1; + info->pr_lock = rwlock; + info->pr_next = THREAD_GETMEM (self, p_readlock_list); + THREAD_SETMEM (self, p_readlock_list, info); + + return info; +} + +/* + * If the thread owns a read lock over the given pthread_rwlock_t, + * and this read lock is tracked in the thread's lock list, + * this function returns a pointer to the info node in that list. + * It also decrements the lock count within that node, and if + * it reaches zero, it removes the node from the list. + * If nothing is found, it returns a null pointer. + */ + +static pthread_readlock_info * +rwlock_remove_from_list(pthread_descr self, pthread_rwlock_t *rwlock) +{ + pthread_readlock_info **pinfo; + + for (pinfo = &self->p_readlock_list; *pinfo != NULL; pinfo = &(*pinfo)->pr_next) + { + if ((*pinfo)->pr_lock == rwlock) + { + pthread_readlock_info *info = *pinfo; + if (--info->pr_lock_count == 0) + *pinfo = info->pr_next; + return info; + } + } + + return NULL; +} + +/* + * This function checks whether the conditions are right to place a read lock. + * It returns 1 if so, otherwise zero. The rwlock's internal lock must be + * locked upon entry. + */ + +static int +rwlock_can_rdlock(pthread_rwlock_t *rwlock, int have_lock_already) +{ + /* Can't readlock; it is write locked. */ + if (rwlock->__rw_writer != NULL) + return 0; + + /* Lock prefers readers; get it. */ + if (rwlock->__rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP) + return 1; + + /* Lock prefers writers, but none are waiting. */ + if (queue_is_empty(&rwlock->__rw_write_waiting)) + return 1; + + /* Writers are waiting, but this thread already has a read lock */ + if (have_lock_already) + return 1; + + /* Writers are waiting, and this is a new lock */ + return 0; +} + +/* + * This function helps support brain-damaged recursive read locking + * semantics required by Unix 98, while maintaining write priority. + * This basically determines whether this thread already holds a read lock + * already. It returns 1 if so, otherwise it returns 0. + * + * If the thread has any ``untracked read locks'' then it just assumes + * that this lock is among them, just to be safe, and returns 1. + * + * Also, if it finds the thread's lock in the list, it sets the pointer + * referenced by pexisting to refer to the list entry. + * + * If the thread has no untracked locks, and the lock is not found + * in its list, then it is added to the list. If this fails, + * then *pout_of_mem is set to 1. + */ + +static int +rwlock_have_already(pthread_descr *pself, pthread_rwlock_t *rwlock, + pthread_readlock_info **pexisting, int *pout_of_mem) +{ + pthread_readlock_info *existing = NULL; + int out_of_mem = 0, have_lock_already = 0; + pthread_descr self = *pself; + + if (rwlock->__rw_kind == PTHREAD_RWLOCK_PREFER_WRITER_NP) + { + if (!self) + *pself = self = thread_self(); + + existing = rwlock_is_in_list(self, rwlock); + + if (existing != NULL + || THREAD_GETMEM (self, p_untracked_readlock_count) > 0) + have_lock_already = 1; + else + { + existing = rwlock_add_to_list(self, rwlock); + if (existing == NULL) + out_of_mem = 1; + } + } + + *pout_of_mem = out_of_mem; + *pexisting = existing; + + return have_lock_already; +} + +int +__pthread_rwlock_init (pthread_rwlock_t *rwlock, + const pthread_rwlockattr_t *attr) +{ + __pthread_init_lock(&rwlock->__rw_lock); + rwlock->__rw_readers = 0; + rwlock->__rw_writer = NULL; + rwlock->__rw_read_waiting = NULL; + rwlock->__rw_write_waiting = NULL; + + if (attr == NULL) + { + rwlock->__rw_kind = PTHREAD_RWLOCK_DEFAULT_NP; + rwlock->__rw_pshared = PTHREAD_PROCESS_PRIVATE; + } + else + { + rwlock->__rw_kind = attr->__lockkind; + rwlock->__rw_pshared = attr->__pshared; + } + + return 0; +} +strong_alias (__pthread_rwlock_init, pthread_rwlock_init) + + +int +__pthread_rwlock_destroy (pthread_rwlock_t *rwlock) +{ + int readers; + _pthread_descr writer; + + __pthread_lock (&rwlock->__rw_lock, NULL); + readers = rwlock->__rw_readers; + writer = rwlock->__rw_writer; + __pthread_unlock (&rwlock->__rw_lock); + + if (readers > 0 || writer != NULL) + return EBUSY; + + return 0; +} +strong_alias (__pthread_rwlock_destroy, pthread_rwlock_destroy) + +int +__pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) +{ + pthread_descr self = NULL; + pthread_readlock_info *existing; + int out_of_mem, have_lock_already; + + have_lock_already = rwlock_have_already(&self, rwlock, + &existing, &out_of_mem); + + if (self == NULL) + self = thread_self (); + + for (;;) + { + __pthread_lock (&rwlock->__rw_lock, self); + + if (rwlock_can_rdlock(rwlock, have_lock_already)) + break; + + enqueue (&rwlock->__rw_read_waiting, self); + __pthread_unlock (&rwlock->__rw_lock); + suspend (self); /* This is not a cancellation point */ + } + + ++rwlock->__rw_readers; + __pthread_unlock (&rwlock->__rw_lock); + + if (have_lock_already || out_of_mem) + { + if (existing != NULL) + ++existing->pr_lock_count; + else + ++self->p_untracked_readlock_count; + } + + return 0; +} +strong_alias (__pthread_rwlock_rdlock, pthread_rwlock_rdlock) + +int +__pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, + const struct timespec *abstime) +{ + pthread_descr self = NULL; + pthread_readlock_info *existing; + int out_of_mem, have_lock_already; + pthread_extricate_if extr; + + if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) + return EINVAL; + + have_lock_already = rwlock_have_already(&self, rwlock, + &existing, &out_of_mem); + + if (self == NULL) + self = thread_self (); + + /* Set up extrication interface */ + extr.pu_object = rwlock; + extr.pu_extricate_func = rwlock_rd_extricate_func; + + /* Register extrication interface */ + __pthread_set_own_extricate_if (self, &extr); + + for (;;) + { + __pthread_lock (&rwlock->__rw_lock, self); + + if (rwlock_can_rdlock(rwlock, have_lock_already)) + break; + + enqueue (&rwlock->__rw_read_waiting, self); + __pthread_unlock (&rwlock->__rw_lock); + /* This is not a cancellation point */ + if (timedsuspend (self, abstime) == 0) + { + int was_on_queue; + + __pthread_lock (&rwlock->__rw_lock, self); + was_on_queue = remove_from_queue (&rwlock->__rw_read_waiting, self); + __pthread_unlock (&rwlock->__rw_lock); + + if (was_on_queue) + { + __pthread_set_own_extricate_if (self, 0); + return ETIMEDOUT; + } + + /* Eat the outstanding restart() from the signaller */ + suspend (self); + } + } + + __pthread_set_own_extricate_if (self, 0); + + ++rwlock->__rw_readers; + __pthread_unlock (&rwlock->__rw_lock); + + if (have_lock_already || out_of_mem) + { + if (existing != NULL) + ++existing->pr_lock_count; + else + ++self->p_untracked_readlock_count; + } + + return 0; +} +strong_alias (__pthread_rwlock_timedrdlock, pthread_rwlock_timedrdlock) + +int +__pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock) +{ + pthread_descr self = thread_self(); + pthread_readlock_info *existing; + int out_of_mem, have_lock_already; + int retval = EBUSY; + + have_lock_already = rwlock_have_already(&self, rwlock, + &existing, &out_of_mem); + + __pthread_lock (&rwlock->__rw_lock, self); + + /* 0 is passed to here instead of have_lock_already. + This is to meet Single Unix Spec requirements: + if writers are waiting, pthread_rwlock_tryrdlock + does not acquire a read lock, even if the caller has + one or more read locks already. */ + + if (rwlock_can_rdlock(rwlock, 0)) + { + ++rwlock->__rw_readers; + retval = 0; + } + + __pthread_unlock (&rwlock->__rw_lock); + + if (retval == 0) + { + if (have_lock_already || out_of_mem) + { + if (existing != NULL) + ++existing->pr_lock_count; + else + ++self->p_untracked_readlock_count; + } + } + + return retval; +} +strong_alias (__pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock) + + +int +__pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) +{ + pthread_descr self = thread_self (); + + while(1) + { + __pthread_lock (&rwlock->__rw_lock, self); + if (rwlock->__rw_readers == 0 && rwlock->__rw_writer == NULL) + { + rwlock->__rw_writer = self; + __pthread_unlock (&rwlock->__rw_lock); + return 0; + } + + /* Suspend ourselves, then try again */ + enqueue (&rwlock->__rw_write_waiting, self); + __pthread_unlock (&rwlock->__rw_lock); + suspend (self); /* This is not a cancellation point */ + } +} +strong_alias (__pthread_rwlock_wrlock, pthread_rwlock_wrlock) + + +int +__pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, + const struct timespec *abstime) +{ + pthread_descr self; + pthread_extricate_if extr; + + if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) + return EINVAL; + + self = thread_self (); + + /* Set up extrication interface */ + extr.pu_object = rwlock; + extr.pu_extricate_func = rwlock_wr_extricate_func; + + /* Register extrication interface */ + __pthread_set_own_extricate_if (self, &extr); + + while(1) + { + __pthread_lock (&rwlock->__rw_lock, self); + + if (rwlock->__rw_readers == 0 && rwlock->__rw_writer == NULL) + { + rwlock->__rw_writer = self; + __pthread_set_own_extricate_if (self, 0); + __pthread_unlock (&rwlock->__rw_lock); + return 0; + } + + /* Suspend ourselves, then try again */ + enqueue (&rwlock->__rw_write_waiting, self); + __pthread_unlock (&rwlock->__rw_lock); + /* This is not a cancellation point */ + if (timedsuspend (self, abstime) == 0) + { + int was_on_queue; + + __pthread_lock (&rwlock->__rw_lock, self); + was_on_queue = remove_from_queue (&rwlock->__rw_write_waiting, self); + __pthread_unlock (&rwlock->__rw_lock); + + if (was_on_queue) + { + __pthread_set_own_extricate_if (self, 0); + return ETIMEDOUT; + } + + /* Eat the outstanding restart() from the signaller */ + suspend (self); + } + } +} +strong_alias (__pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock) + + +int +__pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) +{ + int result = EBUSY; + + __pthread_lock (&rwlock->__rw_lock, NULL); + if (rwlock->__rw_readers == 0 && rwlock->__rw_writer == NULL) + { + rwlock->__rw_writer = thread_self (); + result = 0; + } + __pthread_unlock (&rwlock->__rw_lock); + + return result; +} +strong_alias (__pthread_rwlock_trywrlock, pthread_rwlock_trywrlock) + + +int +__pthread_rwlock_unlock (pthread_rwlock_t *rwlock) +{ + pthread_descr torestart; + pthread_descr th; + + __pthread_lock (&rwlock->__rw_lock, NULL); + if (rwlock->__rw_writer != NULL) + { + /* Unlocking a write lock. */ + if (rwlock->__rw_writer != thread_self ()) + { + __pthread_unlock (&rwlock->__rw_lock); + return EPERM; + } + rwlock->__rw_writer = NULL; + + if ((rwlock->__rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP + && !queue_is_empty(&rwlock->__rw_read_waiting)) + || (th = dequeue(&rwlock->__rw_write_waiting)) == NULL) + { + /* Restart all waiting readers. */ + torestart = rwlock->__rw_read_waiting; + rwlock->__rw_read_waiting = NULL; + __pthread_unlock (&rwlock->__rw_lock); + while ((th = dequeue (&torestart)) != NULL) + restart (th); + } + else + { + /* Restart one waiting writer. */ + __pthread_unlock (&rwlock->__rw_lock); + restart (th); + } + } + else + { + /* Unlocking a read lock. */ + if (rwlock->__rw_readers == 0) + { + __pthread_unlock (&rwlock->__rw_lock); + return EPERM; + } + + --rwlock->__rw_readers; + if (rwlock->__rw_readers == 0) + /* Restart one waiting writer, if any. */ + th = dequeue (&rwlock->__rw_write_waiting); + else + th = NULL; + + __pthread_unlock (&rwlock->__rw_lock); + if (th != NULL) + restart (th); + + /* Recursive lock fixup */ + + if (rwlock->__rw_kind == PTHREAD_RWLOCK_PREFER_WRITER_NP) + { + pthread_descr self = thread_self(); + pthread_readlock_info *victim = rwlock_remove_from_list(self, rwlock); + + if (victim != NULL) + { + if (victim->pr_lock_count == 0) + { + victim->pr_next = THREAD_GETMEM (self, p_readlock_free); + THREAD_SETMEM (self, p_readlock_free, victim); + } + } + else + { + int val = THREAD_GETMEM (self, p_untracked_readlock_count); + if (val > 0) + THREAD_SETMEM (self, p_untracked_readlock_count, val - 1); + } + } + } + + return 0; +} +strong_alias (__pthread_rwlock_unlock, pthread_rwlock_unlock) + + + +int +pthread_rwlockattr_init (pthread_rwlockattr_t *attr) +{ + attr->__lockkind = 0; + attr->__pshared = PTHREAD_PROCESS_PRIVATE; + + return 0; +} + + +int +__pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr) +{ + return 0; +} +strong_alias (__pthread_rwlockattr_destroy, pthread_rwlockattr_destroy) + + +int +pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *attr, int *pshared) +{ + *pshared = attr->__pshared; + return 0; +} + + +int +pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared) +{ + if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) + return EINVAL; + + /* For now it is not possible to shared a conditional variable. */ + if (pshared != PTHREAD_PROCESS_PRIVATE) + return ENOSYS; + + attr->__pshared = pshared; + + return 0; +} + + +int +pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *attr, int *pref) +{ + *pref = attr->__lockkind; + return 0; +} + + +int +pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *attr, int pref) +{ + if (pref != PTHREAD_RWLOCK_PREFER_READER_NP + && pref != PTHREAD_RWLOCK_PREFER_WRITER_NP + && pref != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP + && pref != PTHREAD_RWLOCK_DEFAULT_NP) + return EINVAL; + + attr->__lockkind = pref; + + return 0; +} diff --git a/newlib/libc/sys/linux/linuxthreads/semaphore.c b/newlib/libc/sys/linux/linuxthreads/semaphore.c new file mode 100644 index 000000000..e0dac4120 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/semaphore.c @@ -0,0 +1,304 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Semaphores a la POSIX 1003.1b */ + +#include +#include "pthread.h" +#include "semaphore.h" +#include "internals.h" +#include "spinlock.h" +#include "restart.h" +#include "queue.h" +#include + +int __new_sem_init(sem_t *sem, int pshared, unsigned int value) +{ + if (value > SEM_VALUE_MAX) { + errno = EINVAL; + return -1; + } + if (pshared) { + errno = ENOSYS; + return -1; + } + __pthread_init_lock(&sem->__sem_lock); + sem->__sem_value = value; + sem->__sem_waiting = NULL; + return 0; +} + +/* Function called by pthread_cancel to remove the thread from + waiting inside __new_sem_wait. */ + +static int new_sem_extricate_func(void *obj, pthread_descr th) +{ + volatile pthread_descr self = thread_self(); + sem_t *sem = obj; + int did_remove = 0; + + __pthread_lock(&sem->__sem_lock, self); + did_remove = remove_from_queue(&sem->__sem_waiting, th); + __pthread_unlock(&sem->__sem_lock); + + return did_remove; +} + +int __new_sem_wait(sem_t * sem) +{ + volatile pthread_descr self = thread_self(); + pthread_extricate_if extr; + int already_canceled = 0; + int spurious_wakeup_count; + + /* Set up extrication interface */ + extr.pu_object = sem; + extr.pu_extricate_func = new_sem_extricate_func; + + __pthread_lock(&sem->__sem_lock, self); + if (sem->__sem_value > 0) { + sem->__sem_value--; + __pthread_unlock(&sem->__sem_lock); + return 0; + } + /* Register extrication interface */ + THREAD_SETMEM(self, p_sem_avail, 0); + __pthread_set_own_extricate_if(self, &extr); + /* Enqueue only if not already cancelled. */ + if (!(THREAD_GETMEM(self, p_canceled) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)) + enqueue(&sem->__sem_waiting, self); + else + already_canceled = 1; + __pthread_unlock(&sem->__sem_lock); + + if (already_canceled) { + __pthread_set_own_extricate_if(self, 0); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + + /* Wait for sem_post or cancellation, or fall through if already canceled */ + spurious_wakeup_count = 0; + while (1) + { + suspend(self); + if (THREAD_GETMEM(self, p_sem_avail) == 0 + && (THREAD_GETMEM(self, p_woken_by_cancel) == 0 + || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE)) + { + /* Count resumes that don't belong to us. */ + spurious_wakeup_count++; + continue; + } + break; + } + __pthread_set_own_extricate_if(self, 0); + + /* Terminate only if the wakeup came from cancellation. */ + /* Otherwise ignore cancellation because we got the semaphore. */ + + if (THREAD_GETMEM(self, p_woken_by_cancel) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) { + THREAD_SETMEM(self, p_woken_by_cancel, 0); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + /* We got the semaphore */ + return 0; +} + +int __new_sem_trywait(sem_t * sem) +{ + int retval; + + __pthread_lock(&sem->__sem_lock, NULL); + if (sem->__sem_value == 0) { + errno = EAGAIN; + retval = -1; + } else { + sem->__sem_value--; + retval = 0; + } + __pthread_unlock(&sem->__sem_lock); + return retval; +} + +int __new_sem_post(sem_t * sem) +{ + pthread_descr self = thread_self(); + pthread_descr th; + struct pthread_request request; + + if (THREAD_GETMEM(self, p_in_sighandler) == NULL) { + __pthread_lock(&sem->__sem_lock, self); + if (sem->__sem_waiting == NULL) { + if (sem->__sem_value >= SEM_VALUE_MAX) { + /* Overflow */ + errno = ERANGE; + __pthread_unlock(&sem->__sem_lock); + return -1; + } + sem->__sem_value++; + __pthread_unlock(&sem->__sem_lock); + } else { + th = dequeue(&sem->__sem_waiting); + __pthread_unlock(&sem->__sem_lock); + th->p_sem_avail = 1; + WRITE_MEMORY_BARRIER(); + restart(th); + } + } else { + /* If we're in signal handler, delegate post operation to + the thread manager. */ + if (__pthread_manager_request < 0) { + if (__pthread_initialize_manager() < 0) { + errno = EAGAIN; + return -1; + } + } + request.req_kind = REQ_POST; + request.req_args.post = sem; + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + } + return 0; +} + +int __new_sem_getvalue(sem_t * sem, int * sval) +{ + *sval = sem->__sem_value; + return 0; +} + +int __new_sem_destroy(sem_t * sem) +{ + if (sem->__sem_waiting != NULL) { + __set_errno (EBUSY); + return -1; + } + return 0; +} + +sem_t *sem_open(const char *name, int oflag, ...) +{ + __set_errno (ENOSYS); + return SEM_FAILED; +} + +int sem_close(sem_t *sem) +{ + __set_errno (ENOSYS); + return -1; +} + +int sem_unlink(const char *name) +{ + __set_errno (ENOSYS); + return -1; +} + +int sem_timedwait(sem_t *sem, const struct timespec *abstime) +{ + pthread_descr self = thread_self(); + pthread_extricate_if extr; + int already_canceled = 0; + int spurious_wakeup_count; + + __pthread_lock(&sem->__sem_lock, self); + if (sem->__sem_value > 0) { + --sem->__sem_value; + __pthread_unlock(&sem->__sem_lock); + return 0; + } + + if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) { + /* The standard requires that if the function would block and the + time value is illegal, the function returns with an error. */ + __pthread_unlock(&sem->__sem_lock); + return EINVAL; + } + + /* Set up extrication interface */ + extr.pu_object = sem; + extr.pu_extricate_func = new_sem_extricate_func; + + /* Register extrication interface */ + THREAD_SETMEM(self, p_sem_avail, 0); + __pthread_set_own_extricate_if(self, &extr); + /* Enqueue only if not already cancelled. */ + if (!(THREAD_GETMEM(self, p_canceled) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)) + enqueue(&sem->__sem_waiting, self); + else + already_canceled = 1; + __pthread_unlock(&sem->__sem_lock); + + if (already_canceled) { + __pthread_set_own_extricate_if(self, 0); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + + spurious_wakeup_count = 0; + while (1) + { + if (timedsuspend(self, abstime) == 0) { + int was_on_queue; + + /* __pthread_lock will queue back any spurious restarts that + may happen to it. */ + + __pthread_lock(&sem->__sem_lock, self); + was_on_queue = remove_from_queue(&sem->__sem_waiting, self); + __pthread_unlock(&sem->__sem_lock); + + if (was_on_queue) { + __pthread_set_own_extricate_if(self, 0); + return ETIMEDOUT; + } + + /* Eat the outstanding restart() from the signaller */ + suspend(self); + } + + if (THREAD_GETMEM(self, p_sem_avail) == 0 + && (THREAD_GETMEM(self, p_woken_by_cancel) == 0 + || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE)) + { + /* Count resumes that don't belong to us. */ + spurious_wakeup_count++; + continue; + } + break; + } + + __pthread_set_own_extricate_if(self, 0); + + /* Terminate only if the wakeup came from cancellation. */ + /* Otherwise ignore cancellation because we got the semaphore. */ + + if (THREAD_GETMEM(self, p_woken_by_cancel) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) { + THREAD_SETMEM(self, p_woken_by_cancel, 0); + __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); + } + /* We got the semaphore */ + return 0; +} + + +versioned_symbol (libpthread, __new_sem_init, sem_init, GLIBC_2_1); +versioned_symbol (libpthread, __new_sem_wait, sem_wait, GLIBC_2_1); +versioned_symbol (libpthread, __new_sem_trywait, sem_trywait, GLIBC_2_1); +versioned_symbol (libpthread, __new_sem_post, sem_post, GLIBC_2_1); +versioned_symbol (libpthread, __new_sem_getvalue, sem_getvalue, GLIBC_2_1); +versioned_symbol (libpthread, __new_sem_destroy, sem_destroy, GLIBC_2_1); diff --git a/newlib/libc/sys/linux/linuxthreads/semaphore.h b/newlib/libc/sys/linux/linuxthreads/semaphore.h new file mode 100644 index 000000000..9c283c864 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/semaphore.h @@ -0,0 +1,88 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +#ifndef _SEMAPHORE_H +#define _SEMAPHORE_H 1 + +#include +#include +#ifdef __USE_XOPEN2K +# define __need_timespec +# include +#endif + +#ifndef _PTHREAD_DESCR_DEFINED +/* Thread descriptors. Needed for `sem_t' definition. */ +typedef struct _pthread_descr_struct *_pthread_descr; +# define _PTHREAD_DESCR_DEFINED +#endif + +/* System specific semaphore definition. */ +typedef struct +{ + struct _pthread_fastlock __sem_lock; + int __sem_value; + _pthread_descr __sem_waiting; +} sem_t; + + + +/* Value returned if `sem_open' failed. */ +#define SEM_FAILED ((sem_t *) 0) + +/* Maximum value the semaphore can have. */ +#define SEM_VALUE_MAX ((int) ((~0u) >> 1)) + + +__BEGIN_DECLS + +/* Initialize semaphore object SEM to VALUE. If PSHARED then share it + with other processes. */ +extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value) __THROW; + +/* Free resources associated with semaphore object SEM. */ +extern int sem_destroy (sem_t *__sem) __THROW; + +/* Open a named semaphore NAME with open flaot OFLAG. */ +extern sem_t *sem_open (__const char *__name, int __oflag, ...) __THROW; + +/* Close descriptor for named semaphore SEM. */ +extern int sem_close (sem_t *__sem) __THROW; + +/* Remove named semaphore NAME. */ +extern int sem_unlink (__const char *__name) __THROW; + +/* Wait for SEM being posted. */ +extern int sem_wait (sem_t *__sem) __THROW; + +#ifdef __USE_XOPEN2K +/* Similar to `sem_wait' but wait only until ABSTIME. */ +extern int sem_timedwait (sem_t *__restrict __sem, + __const struct timespec *__restrict __abstime) + __THROW; +#endif + +/* Test whether SEM is posted. */ +extern int sem_trywait (sem_t *__sem) __THROW; + +/* Post SEM. */ +extern int sem_post (sem_t *__sem) __THROW; + +/* Get current value of SEM and store it in *SVAL. */ +extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval) + __THROW; + +__END_DECLS + +#endif /* semaphore.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/shlib-compat.h b/newlib/libc/sys/linux/linuxthreads/shlib-compat.h new file mode 100644 index 000000000..245b8aa89 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/shlib-compat.h @@ -0,0 +1,84 @@ +/* Macros for managing ABI-compatibility definitions using ELF symbol versions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SHLIB_COMPAT_H +#define _SHLIB_COMPAT_H 1 + +#if defined HAVE_ELF && defined DO_VERSIONING +/* Since there is just one set of .d files generated, we need to + include this unconditionally to have the dependency noticed properly. */ +#include /* header generated by abi-versions.awk */ +#endif + +#if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING + +/* The file abi-versions.h (generated by scripts/abi-versions.awk) defines + symbols like `ABI_libm_GLIBC_2_0' for each version set in the source + code for each library. For a version set that is subsumed by a later + version set, the definition gives the subsuming set, i.e. if GLIBC_2_0 + is subsumed by GLIBC_2_1, then ABI_libm_GLIBC_2_0 == ABI_libm_GLIBC_2_1. + Each version set that is to be distinctly defined in the output has an + unique positive integer value, increasing with newer versions. Thus, + evaluating two ABI_* symbols reduces to integer values that differ only + when the two version sets named are in fact two different ABIs we are + supporting. If these do not differ, then there is no need to compile in + extra code to support this version set where it has been superseded by a + newer version. The compatibility code should be conditionalized with + e.g. `#if SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_2)' for code introduced + in the GLIBC_2.0 version and obsoleted in the GLIBC_2.2 version. */ + +# define SHLIB_COMPAT(lib, introduced, obsoleted) \ + (!(ABI_##lib##_##obsoleted - 0) \ + || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))) + +/* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to + the version set name to use for e.g. symbols first introduced into + libm in the GLIBC_2.1 version. Definitions of symbols with explicit + versions should look like: + versioned_symbol (libm, new_foo, foo, GLIBC_2_1); + This will define the symbol `foo' with the appropriate default version, + i.e. either GLIBC_2.1 or the "earliest version" specified in + shlib-versions if that is newer. */ + +# define versioned_symbol(lib, local, symbol, version) \ + versioned_symbol_1 (local, symbol, VERSION_##lib##_##version) +# define versioned_symbol_1(local, symbol, name) \ + default_symbol_version (local, symbol, name) + +# define compat_symbol(lib, local, symbol, version) \ + compat_symbol_1 (local, symbol, VERSION_##lib##_##version) +# define compat_symbol_1(local, symbol, name) \ + symbol_version (local, symbol, name) + +#else + +/* Not compiling ELF shared libraries at all, so never any old versions. */ +# define SHLIB_COMPAT(lib, introduced, obsoleted) 0 + +/* No versions to worry about, just make this the global definition. */ +# define versioned_symbol(lib, local, symbol, version) \ + weak_alias (local, symbol) + +/* This should not appear outside `#if SHLIB_COMPAT (...)'. */ +# define compat_symbol(lib, local, symbol, version) ... + +#endif + + +#endif /* shlib-compat.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/signals.c b/newlib/libc/sys/linux/linuxthreads/signals.c new file mode 100644 index 000000000..da3ce69a4 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/signals.c @@ -0,0 +1,243 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Handling of signals */ + +#include +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include +#include + +int pthread_sigmask(int how, const sigset_t * newmask, sigset_t * oldmask) +{ + sigset_t mask; + + if (newmask != NULL) { + mask = *newmask; + /* Don't allow __pthread_sig_restart to be unmasked. + Don't allow __pthread_sig_cancel to be masked. */ + switch(how) { + case SIG_SETMASK: + sigaddset(&mask, __pthread_sig_restart); + sigdelset(&mask, __pthread_sig_cancel); + break; + case SIG_BLOCK: + sigdelset(&mask, __pthread_sig_cancel); + break; + case SIG_UNBLOCK: + sigdelset(&mask, __pthread_sig_restart); + break; + } + newmask = &mask; + } + if (sigprocmask(how, newmask, oldmask) == -1) + return errno; + else + return 0; +} + +int pthread_kill(pthread_t thread, int signo) +{ + pthread_handle handle = thread_handle(thread); + int pid; + + __pthread_lock(&handle->h_lock, NULL); + if (invalid_handle(handle, thread)) { + __pthread_unlock(&handle->h_lock); + return ESRCH; + } + pid = handle->h_descr->p_pid; + __pthread_unlock(&handle->h_lock); + if (kill(pid, signo) == -1) + return errno; + else + return 0; +} + +/* User-provided signal handlers */ +typedef void (*arch_sighandler_t) (int, SIGCONTEXT); +static union +{ + arch_sighandler_t old; + void (*rt) (int, struct siginfo *, struct ucontext *); +} sighandler[NSIG] = { [1 ... NSIG - 1] = { (arch_sighandler_t) SIG_ERR } }; + +/* The wrapper around user-provided signal handlers */ +static void pthread_sighandler(int signo, SIGCONTEXT ctx) +{ + pthread_descr self; + char * in_sighandler; + self = thread_self(); + /* If we're in a sigwait operation, just record the signal received + and return without calling the user's handler */ + if (THREAD_GETMEM(self, p_sigwaiting)) { + THREAD_SETMEM(self, p_sigwaiting, 0); + THREAD_SETMEM(self, p_signal, signo); + return; + } + /* Record that we're in a signal handler and call the user's + handler function */ + in_sighandler = THREAD_GETMEM(self, p_in_sighandler); + if (in_sighandler == NULL) + THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME); + CALL_SIGHANDLER(sighandler[signo].old, signo, ctx); + if (in_sighandler == NULL) + THREAD_SETMEM(self, p_in_sighandler, NULL); +} + +/* The same, this time for real-time signals. */ +static void pthread_sighandler_rt(int signo, struct siginfo *si, + struct ucontext *uc) +{ + pthread_descr self; + char * in_sighandler; + self = thread_self(); + /* If we're in a sigwait operation, just record the signal received + and return without calling the user's handler */ + if (THREAD_GETMEM(self, p_sigwaiting)) { + THREAD_SETMEM(self, p_sigwaiting, 0); + THREAD_SETMEM(self, p_signal, signo); + return; + } + /* Record that we're in a signal handler and call the user's + handler function */ + in_sighandler = THREAD_GETMEM(self, p_in_sighandler); + if (in_sighandler == NULL) + THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME); + sighandler[signo].rt(signo, si, uc); + if (in_sighandler == NULL) + THREAD_SETMEM(self, p_in_sighandler, NULL); +} + +/* The wrapper around sigaction. Install our own signal handler + around the signal. */ +int __sigaction(int sig, const struct sigaction * act, + struct sigaction * oact) +{ + struct sigaction newact; + struct sigaction *newactp; + + if (sig == __pthread_sig_restart || + sig == __pthread_sig_cancel || + (sig == __pthread_sig_debug && __pthread_sig_debug > 0)) + { + __set_errno (EINVAL); + return -1; + } + if (act) + { + newact = *act; + if (act->sa_handler != SIG_IGN && act->sa_handler != SIG_DFL + && sig > 0 && sig < NSIG) + { + if (act->sa_flags & SA_SIGINFO) + newact.sa_handler = (__sighandler_t) pthread_sighandler_rt; + else + newact.sa_handler = (__sighandler_t) pthread_sighandler; + } + newactp = &newact; + } + else + newactp = NULL; + if (__libc_sigaction(sig, newactp, oact) == -1) + return -1; + if (sig > 0 && sig < NSIG) + { + if (oact != NULL + /* We may have inherited SIG_IGN from the parent, so return the + kernel's idea of the signal handler the first time + through. */ + && (__sighandler_t) sighandler[sig].old != SIG_ERR) + oact->sa_handler = (__sighandler_t) sighandler[sig].old; + if (act) + /* For the assignment it does not matter whether it's a normal + or real-time signal. */ + sighandler[sig].old = (arch_sighandler_t) act->sa_handler; + } + return 0; +} +strong_alias(__sigaction, sigaction) + +/* A signal handler that does nothing */ +static void pthread_null_sighandler(int sig) { } + +/* sigwait -- synchronously wait for a signal */ +int sigwait(const sigset_t * set, int * sig) +{ + volatile pthread_descr self = thread_self(); + sigset_t mask; + int s; + sigjmp_buf jmpbuf; + struct sigaction sa; + + /* Get ready to block all signals except those in set + and the cancellation signal. + Also check that handlers are installed on all signals in set, + and if not, install our dummy handler. This is conformant to + POSIX: "The effect of sigwait() on the signal actions for the + signals in set is unspecified." */ + sigfillset(&mask); + sigdelset(&mask, __pthread_sig_cancel); + for (s = 1; s < NSIG; s++) { + if (sigismember(set, s) && + s != __pthread_sig_restart && + s != __pthread_sig_cancel && + s != __pthread_sig_debug) { + sigdelset(&mask, s); + if (sighandler[s].old == (arch_sighandler_t) SIG_ERR || + sighandler[s].old == (arch_sighandler_t) SIG_DFL || + sighandler[s].old == (arch_sighandler_t) SIG_IGN) { + sa.sa_handler = pthread_null_sighandler; + sigfillset(&sa.sa_mask); + sa.sa_flags = 0; + sigaction(s, &sa, NULL); + } + } + } + /* Test for cancellation */ + if (sigsetjmp(jmpbuf, 1) == 0) { + THREAD_SETMEM(self, p_cancel_jmp, &jmpbuf); + if (! (THREAD_GETMEM(self, p_canceled) + && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)) { + /* Reset the signal count */ + THREAD_SETMEM(self, p_signal, 0); + /* Say we're in sigwait */ + THREAD_SETMEM(self, p_sigwaiting, 1); + /* Unblock the signals and wait for them */ + sigsuspend(&mask); + } + } + THREAD_SETMEM(self, p_cancel_jmp, NULL); + /* The signals are now reblocked. Check for cancellation */ + pthread_testcancel(); + /* We should have self->p_signal != 0 and equal to the signal received */ + *sig = THREAD_GETMEM(self, p_signal); + return 0; +} + +/* Redefine raise() to send signal to calling thread only, + as per POSIX 1003.1c */ +int raise (int sig) +{ + int retcode = pthread_kill(pthread_self(), sig); + if (retcode == 0) + return 0; + else { + errno = retcode; + return -1; + } +} diff --git a/newlib/libc/sys/linux/linuxthreads/specific.c b/newlib/libc/sys/linux/linuxthreads/specific.c new file mode 100644 index 000000000..2dbf2055e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/specific.c @@ -0,0 +1,228 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Thread-specific data */ + +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "restart.h" +#include + + +/* Table of keys. */ + +static struct pthread_key_struct pthread_keys[PTHREAD_KEYS_MAX] = + { { 0, NULL } }; + +/* For debugging purposes put the maximum number of keys in a variable. */ +const int __linuxthreads_pthread_keys_max = PTHREAD_KEYS_MAX; +const int __linuxthreads_pthread_key_2ndlevel_size = PTHREAD_KEY_2NDLEVEL_SIZE; + +/* Mutex to protect access to pthread_keys */ + +static pthread_mutex_t pthread_keys_mutex = PTHREAD_MUTEX_INITIALIZER; + +/* Create a new key */ + +int __pthread_key_create(pthread_key_t * key, destr_function destr) +{ + int i; + + pthread_mutex_lock(&pthread_keys_mutex); + for (i = 0; i < PTHREAD_KEYS_MAX; i++) { + if (! pthread_keys[i].in_use) { + /* Mark key in use */ + pthread_keys[i].in_use = 1; + pthread_keys[i].destr = destr; + pthread_mutex_unlock(&pthread_keys_mutex); + *key = i; + return 0; + } + } + pthread_mutex_unlock(&pthread_keys_mutex); + return EAGAIN; +} +strong_alias (__pthread_key_create, pthread_key_create) + +/* Reset deleted key's value to NULL in each live thread. + * NOTE: this executes in the context of the thread manager! */ + +struct pthread_key_delete_helper_args { + /* Damn, we need lexical closures in C! ;) */ + unsigned int idx1st, idx2nd; + pthread_descr self; +}; + +static void pthread_key_delete_helper(void *arg, pthread_descr th) +{ + struct pthread_key_delete_helper_args *args = arg; + unsigned int idx1st = args->idx1st; + unsigned int idx2nd = args->idx2nd; + pthread_descr self = args->self; + + if (self == 0) + self = args->self = thread_self(); + + if (!th->p_terminated) { + /* pthread_exit() may try to free th->p_specific[idx1st] concurrently. */ + __pthread_lock(THREAD_GETMEM(th, p_lock), self); + if (th->p_specific[idx1st] != NULL) + th->p_specific[idx1st][idx2nd] = NULL; + __pthread_unlock(THREAD_GETMEM(th, p_lock)); + } +} + +/* Delete a key */ +int pthread_key_delete(pthread_key_t key) +{ + pthread_descr self = thread_self(); + + pthread_mutex_lock(&pthread_keys_mutex); + if (key >= PTHREAD_KEYS_MAX || !pthread_keys[key].in_use) { + pthread_mutex_unlock(&pthread_keys_mutex); + return EINVAL; + } + pthread_keys[key].in_use = 0; + pthread_keys[key].destr = NULL; + + /* Set the value of the key to NULL in all running threads, so + that if the key is reallocated later by pthread_key_create, its + associated values will be NULL in all threads. + + Do nothing if no threads have been created yet. */ + + if (__pthread_manager_request != -1) + { + struct pthread_key_delete_helper_args args; + struct pthread_request request; + + args.idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE; + args.idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE; + args.self = 0; + + request.req_thread = self; + request.req_kind = REQ_FOR_EACH_THREAD; + request.req_args.for_each.arg = &args; + request.req_args.for_each.fn = pthread_key_delete_helper; + + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + suspend(self); + } + + pthread_mutex_unlock(&pthread_keys_mutex); + return 0; +} + +/* Set the value of a key */ + +int __pthread_setspecific(pthread_key_t key, const void * pointer) +{ + pthread_descr self = thread_self(); + unsigned int idx1st, idx2nd; + + if (key >= PTHREAD_KEYS_MAX || !pthread_keys[key].in_use) + return EINVAL; + idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE; + idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE; + if (THREAD_GETMEM_NC(self, p_specific[idx1st]) == NULL) { + void *newp = calloc(PTHREAD_KEY_2NDLEVEL_SIZE, sizeof (void *)); + if (newp == NULL) + return ENOMEM; + THREAD_SETMEM_NC(self, p_specific[idx1st], newp); + } + THREAD_GETMEM_NC(self, p_specific[idx1st])[idx2nd] = (void *) pointer; + return 0; +} +strong_alias (__pthread_setspecific, pthread_setspecific) + +/* Get the value of a key */ + +void * __pthread_getspecific(pthread_key_t key) +{ + pthread_descr self = thread_self(); + unsigned int idx1st, idx2nd; + + if (key >= PTHREAD_KEYS_MAX) + return NULL; + idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE; + idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE; + if (THREAD_GETMEM_NC(self, p_specific[idx1st]) == NULL + || !pthread_keys[key].in_use) + return NULL; + return THREAD_GETMEM_NC(self, p_specific[idx1st])[idx2nd]; +} +strong_alias (__pthread_getspecific, pthread_getspecific) + +/* Call the destruction routines on all keys */ + +void __pthread_destroy_specifics() +{ + pthread_descr self = thread_self(); + int i, j, round, found_nonzero; + destr_function destr; + void * data; + + for (round = 0, found_nonzero = 1; + found_nonzero && round < PTHREAD_DESTRUCTOR_ITERATIONS; + round++) { + found_nonzero = 0; + for (i = 0; i < PTHREAD_KEY_1STLEVEL_SIZE; i++) + if (THREAD_GETMEM_NC(self, p_specific[i]) != NULL) + for (j = 0; j < PTHREAD_KEY_2NDLEVEL_SIZE; j++) { + destr = pthread_keys[i * PTHREAD_KEY_2NDLEVEL_SIZE + j].destr; + data = THREAD_GETMEM_NC(self, p_specific[i])[j]; + if (destr != NULL && data != NULL) { + THREAD_GETMEM_NC(self, p_specific[i])[j] = NULL; + destr(data); + found_nonzero = 1; + } + } + } + __pthread_lock(THREAD_GETMEM(self, p_lock), self); + for (i = 0; i < PTHREAD_KEY_1STLEVEL_SIZE; i++) { + if (THREAD_GETMEM_NC(self, p_specific[i]) != NULL) { + free(THREAD_GETMEM_NC(self, p_specific[i])); + THREAD_SETMEM_NC(self, p_specific[i], NULL); + } + } + __pthread_unlock(THREAD_GETMEM(self, p_lock)); +} + +/* Thread-specific data for libc. */ + +static int +libc_internal_tsd_set(enum __libc_tsd_key_t key, const void * pointer) +{ + pthread_descr self = thread_self(); + + THREAD_SETMEM_NC(self, p_libc_specific[key], (void *) pointer); + return 0; +} +int (*__libc_internal_tsd_set)(enum __libc_tsd_key_t key, const void * pointer) + = libc_internal_tsd_set; + +static void * +libc_internal_tsd_get(enum __libc_tsd_key_t key) +{ + pthread_descr self = thread_self(); + + return THREAD_GETMEM_NC(self, p_libc_specific[key]); +} +void * (*__libc_internal_tsd_get)(enum __libc_tsd_key_t key) + = libc_internal_tsd_get; diff --git a/newlib/libc/sys/linux/linuxthreads/spinlock.c b/newlib/libc/sys/linux/linuxthreads/spinlock.c new file mode 100644 index 000000000..3e1682599 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/spinlock.c @@ -0,0 +1,774 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +/* Internal locks */ + +#include +#include +#include +#include +#include +#include "pthread.h" +#include "internals.h" +#include "spinlock.h" +#include "restart.h" + +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP +static void __pthread_acquire(int * spinlock); + +static inline void __pthread_release(int * spinlock) +{ + WRITE_MEMORY_BARRIER(); + *spinlock = __LT_SPINLOCK_INIT; + __asm __volatile ("" : "=m" (*spinlock) : "0" (*spinlock)); +} +#endif + + +/* The status field of a spinlock is a pointer whose least significant + bit is a locked flag. + + Thus the field values have the following meanings: + + status == 0: spinlock is free + status == 1: spinlock is taken; no thread is waiting on it + + (status & 1) == 1: spinlock is taken and (status & ~1L) is a + pointer to the first waiting thread; other + waiting threads are linked via the p_nextlock + field. + (status & 1) == 0: same as above, but spinlock is not taken. + + The waiting list is not sorted by priority order. + Actually, we always insert at top of list (sole insertion mode + that can be performed without locking). + For __pthread_unlock, we perform a linear search in the list + to find the highest-priority, oldest waiting thread. + This is safe because there are no concurrent __pthread_unlock + operations -- only the thread that locked the mutex can unlock it. */ + + +void internal_function __pthread_lock(struct _pthread_fastlock * lock, + pthread_descr self) +{ +#if defined HAS_COMPARE_AND_SWAP + long oldstatus, newstatus; + int successful_seizure, spurious_wakeup_count; + int spin_count; +#endif + +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + __pthread_acquire(&lock->__spinlock); + return; + } +#endif + +#if defined HAS_COMPARE_AND_SWAP + /* First try it without preparation. Maybe it's a completely + uncontested lock. */ + if (lock->__status == 0 && __compare_and_swap (&lock->__status, 0, 1)) + return; + + spurious_wakeup_count = 0; + spin_count = 0; + +again: + + /* On SMP, try spinning to get the lock. */ + + if (__pthread_smp_kernel) { + int max_count = lock->__spinlock * 2 + 10; + + if (max_count > MAX_ADAPTIVE_SPIN_COUNT) + max_count = MAX_ADAPTIVE_SPIN_COUNT; + + for (spin_count = 0; spin_count < max_count; spin_count++) { + if (((oldstatus = lock->__status) & 1) == 0) { + if(__compare_and_swap(&lock->__status, oldstatus, oldstatus | 1)) + { + if (spin_count) + lock->__spinlock += (spin_count - lock->__spinlock) / 8; + READ_MEMORY_BARRIER(); + return; + } + } +#ifdef BUSY_WAIT_NOP + BUSY_WAIT_NOP; +#endif + __asm __volatile ("" : "=m" (lock->__status) : "0" (lock->__status)); + } + + lock->__spinlock += (spin_count - lock->__spinlock) / 8; + } + + /* No luck, try once more or suspend. */ + + do { + oldstatus = lock->__status; + successful_seizure = 0; + + if ((oldstatus & 1) == 0) { + newstatus = oldstatus | 1; + successful_seizure = 1; + } else { + if (self == NULL) + self = thread_self(); + newstatus = (long) self | 1; + } + + if (self != NULL) { + THREAD_SETMEM(self, p_nextlock, (pthread_descr) (oldstatus & ~1L)); + /* Make sure the store in p_nextlock completes before performing + the compare-and-swap */ + MEMORY_BARRIER(); + } + } while(! __compare_and_swap(&lock->__status, oldstatus, newstatus)); + + /* Suspend with guard against spurious wakeup. + This can happen in pthread_cond_timedwait_relative, when the thread + wakes up due to timeout and is still on the condvar queue, and then + locks the queue to remove itself. At that point it may still be on the + queue, and may be resumed by a condition signal. */ + + if (!successful_seizure) { + for (;;) { + suspend(self); + if (self->p_nextlock != NULL) { + /* Count resumes that don't belong to us. */ + spurious_wakeup_count++; + continue; + } + break; + } + goto again; + } + + /* Put back any resumes we caught that don't belong to us. */ + while (spurious_wakeup_count--) + restart(self); + + READ_MEMORY_BARRIER(); +#endif +} + +int __pthread_unlock(struct _pthread_fastlock * lock) +{ +#if defined HAS_COMPARE_AND_SWAP + long oldstatus; + pthread_descr thr, * ptr, * maxptr; + int maxprio; +#endif + +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + __pthread_release(&lock->__spinlock); + return 0; + } +#endif + +#if defined HAS_COMPARE_AND_SWAP + WRITE_MEMORY_BARRIER(); + +again: + while ((oldstatus = lock->__status) == 1) { + if (__compare_and_swap_with_release_semantics(&lock->__status, + oldstatus, 0)) + return 0; + } + + /* Find thread in waiting queue with maximal priority */ + ptr = (pthread_descr *) &lock->__status; + thr = (pthread_descr) (oldstatus & ~1L); + maxprio = 0; + maxptr = ptr; + + /* Before we iterate over the wait queue, we need to execute + a read barrier, otherwise we may read stale contents of nodes that may + just have been inserted by other processors. One read barrier is enough to + ensure we have a stable list; we don't need one for each pointer chase + through the list, because we are the owner of the lock; other threads + can only add nodes at the front; if a front node is consistent, + the ones behind it must also be. */ + + READ_MEMORY_BARRIER(); + + while (thr != 0) { + if (thr->p_priority >= maxprio) { + maxptr = ptr; + maxprio = thr->p_priority; + } + ptr = &(thr->p_nextlock); + thr = *ptr; + } + + /* Remove max prio thread from waiting list. */ + if (maxptr == (pthread_descr *) &lock->__status) { + /* If max prio thread is at head, remove it with compare-and-swap + to guard against concurrent lock operation. This removal + also has the side effect of marking the lock as released + because the new status comes from thr->p_nextlock whose + least significant bit is clear. */ + thr = (pthread_descr) (oldstatus & ~1L); + if (! __compare_and_swap_with_release_semantics + (&lock->__status, oldstatus, (long)(thr->p_nextlock))) + goto again; + } else { + /* No risk of concurrent access, remove max prio thread normally. + But in this case we must also flip the least significant bit + of the status to mark the lock as released. */ + thr = *maxptr; + *maxptr = thr->p_nextlock; + + /* Ensure deletion from linked list completes before we + release the lock. */ + WRITE_MEMORY_BARRIER(); + + do { + oldstatus = lock->__status; + } while (!__compare_and_swap_with_release_semantics(&lock->__status, + oldstatus, oldstatus & ~1L)); + } + + /* Wake up the selected waiting thread. Woken thread can check + its own p_nextlock field for NULL to detect that it has been removed. No + barrier is needed here, since restart() and suspend() take + care of memory synchronization. */ + + thr->p_nextlock = NULL; + restart(thr); + + return 0; +#endif +} + +/* + * Alternate fastlocks do not queue threads directly. Instead, they queue + * these wait queue node structures. When a timed wait wakes up due to + * a timeout, it can leave its wait node in the queue (because there + * is no safe way to remove from the quue). Some other thread will + * deallocate the abandoned node. + */ + + +struct wait_node { + struct wait_node *next; /* Next node in null terminated linked list */ + pthread_descr thr; /* The thread waiting with this node */ + int abandoned; /* Atomic flag */ +}; + +static long wait_node_free_list; +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP +static int wait_node_free_list_spinlock; +#endif + +/* Allocate a new node from the head of the free list using an atomic + operation, or else using malloc if that list is empty. A fundamental + assumption here is that we can safely access wait_node_free_list->next. + That's because we never free nodes once we allocate them, so a pointer to a + node remains valid indefinitely. */ + +static struct wait_node *wait_node_alloc(void) +{ +#if defined HAS_COMPARE_AND_SWAP + long oldvalue, newvalue; +#endif + +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + struct wait_node *new_node = 0; + + __pthread_acquire(&wait_node_free_list_spinlock); + if (wait_node_free_list != 0) { + new_node = (struct wait_node *) wait_node_free_list; + wait_node_free_list = (long) new_node->next; + } + WRITE_MEMORY_BARRIER(); + wait_node_free_list_spinlock = 0; + + if (new_node == 0) + return malloc(sizeof *wait_node_alloc()); + + return new_node; + } +#endif + +#if defined HAS_COMPARE_AND_SWAP + do { + oldvalue = wait_node_free_list; + + if (oldvalue == 0) + return malloc(sizeof *wait_node_alloc()); + + /* Ensure we don't read stale next link through oldvalue pointer. */ + READ_MEMORY_BARRIER(); + newvalue = (long) ((struct wait_node *) oldvalue)->next; + } while (! __compare_and_swap(&wait_node_free_list, oldvalue, newvalue)); + + return (struct wait_node *) oldvalue; +#endif +} + +/* Return a node to the head of the free list using an atomic + operation. */ + +static void wait_node_free(struct wait_node *wn) +{ +#if defined HAS_COMPARE_AND_SWAP + long oldvalue, newvalue; +#endif + +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + __pthread_acquire(&wait_node_free_list_spinlock); + wn->next = (struct wait_node *) wait_node_free_list; + wait_node_free_list = (long) wn; + WRITE_MEMORY_BARRIER(); + wait_node_free_list_spinlock = 0; + return; + } +#endif + +#if defined HAS_COMPARE_AND_SWAP + do { + oldvalue = wait_node_free_list; + wn->next = (struct wait_node *) oldvalue; + newvalue = (long) wn; + /* Ensure node contents are written before we swap it into the list. */ + WRITE_MEMORY_BARRIER(); + } while (! __compare_and_swap(&wait_node_free_list, oldvalue, newvalue)); +#endif +} + +#if defined HAS_COMPARE_AND_SWAP + +/* Remove a wait node from the specified queue. It is assumed + that the removal takes place concurrently with only atomic insertions at the + head of the queue. */ + +static void wait_node_dequeue(struct wait_node **pp_head, + struct wait_node **pp_node, + struct wait_node *p_node) +{ + /* If the node is being deleted from the head of the + list, it must be deleted using atomic compare-and-swap. + Otherwise it can be deleted in the straightforward way. */ + + if (pp_node == pp_head) { + /* We don't need a read barrier between these next two loads, + because it is assumed that the caller has already ensured + the stability of *p_node with respect to p_node. */ + + long oldvalue = (long) p_node; + long newvalue = (long) p_node->next; + + if (__compare_and_swap((long *) pp_node, oldvalue, newvalue)) + return; + + /* Oops! Compare and swap failed, which means the node is + no longer first. We delete it using the ordinary method. But we don't + know the identity of the node which now holds the pointer to the node + being deleted, so we must search from the beginning. */ + + for (pp_node = pp_head; p_node != *pp_node; ) { + pp_node = &(*pp_node)->next; + READ_MEMORY_BARRIER(); /* Stabilize *pp_node for next iteration. */ + } + } + + *pp_node = p_node->next; + return; +} + +#endif + +void __pthread_alt_lock(struct _pthread_fastlock * lock, + pthread_descr self) +{ +#if defined HAS_COMPARE_AND_SWAP + long oldstatus, newstatus; +#endif + struct wait_node wait_node; + +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + int suspend_needed = 0; + __pthread_acquire(&lock->__spinlock); + + if (lock->__status == 0) + lock->__status = 1; + else { + if (self == NULL) + self = thread_self(); + + wait_node.abandoned = 0; + wait_node.next = (struct wait_node *) lock->__status; + wait_node.thr = self; + lock->__status = (long) &wait_node; + suspend_needed = 1; + } + + __pthread_release(&lock->__spinlock); + + if (suspend_needed) + suspend (self); + return; + } +#endif + +#if defined HAS_COMPARE_AND_SWAP + do { + oldstatus = lock->__status; + if (oldstatus == 0) { + newstatus = 1; + } else { + if (self == NULL) + self = thread_self(); + wait_node.thr = self; + newstatus = (long) &wait_node; + } + wait_node.abandoned = 0; + wait_node.next = (struct wait_node *) oldstatus; + /* Make sure the store in wait_node.next completes before performing + the compare-and-swap */ + MEMORY_BARRIER(); + } while(! __compare_and_swap(&lock->__status, oldstatus, newstatus)); + + /* Suspend. Note that unlike in __pthread_lock, we don't worry + here about spurious wakeup. That's because this lock is not + used in situations where that can happen; the restart can + only come from the previous lock owner. */ + + if (oldstatus != 0) + suspend(self); + + READ_MEMORY_BARRIER(); +#endif +} + +/* Timed-out lock operation; returns 0 to indicate timeout. */ + +int __pthread_alt_timedlock(struct _pthread_fastlock * lock, + pthread_descr self, const struct timespec *abstime) +{ + long oldstatus = 0; +#if defined HAS_COMPARE_AND_SWAP + long newstatus; +#endif + struct wait_node *p_wait_node = wait_node_alloc(); + + /* Out of memory, just give up and do ordinary lock. */ + if (p_wait_node == 0) { + __pthread_alt_lock(lock, self); + return 1; + } + +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + __pthread_acquire(&lock->__spinlock); + + if (lock->__status == 0) + lock->__status = 1; + else { + if (self == NULL) + self = thread_self(); + + p_wait_node->abandoned = 0; + p_wait_node->next = (struct wait_node *) lock->__status; + p_wait_node->thr = self; + lock->__status = (long) p_wait_node; + oldstatus = 1; /* force suspend */ + } + + __pthread_release(&lock->__spinlock); + goto suspend; + } +#endif + +#if defined HAS_COMPARE_AND_SWAP + do { + oldstatus = lock->__status; + if (oldstatus == 0) { + newstatus = 1; + } else { + if (self == NULL) + self = thread_self(); + p_wait_node->thr = self; + newstatus = (long) p_wait_node; + } + p_wait_node->abandoned = 0; + p_wait_node->next = (struct wait_node *) oldstatus; + /* Make sure the store in wait_node.next completes before performing + the compare-and-swap */ + MEMORY_BARRIER(); + } while(! __compare_and_swap(&lock->__status, oldstatus, newstatus)); +#endif + +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + suspend: +#endif + + /* If we did not get the lock, do a timed suspend. If we wake up due + to a timeout, then there is a race; the old lock owner may try + to remove us from the queue. This race is resolved by us and the owner + doing an atomic testandset() to change the state of the wait node from 0 + to 1. If we succeed, then it's a timeout and we abandon the node in the + queue. If we fail, it means the owner gave us the lock. */ + + if (oldstatus != 0) { + if (timedsuspend(self, abstime) == 0) { + if (!testandset(&p_wait_node->abandoned)) + return 0; /* Timeout! */ + + /* Eat oustanding resume from owner, otherwise wait_node_free() below + will race with owner's wait_node_dequeue(). */ + suspend(self); + } + } + + wait_node_free(p_wait_node); + + READ_MEMORY_BARRIER(); + + return 1; /* Got the lock! */ +} + +void __pthread_alt_unlock(struct _pthread_fastlock *lock) +{ + struct wait_node *p_node, **pp_node, *p_max_prio, **pp_max_prio; + struct wait_node ** const pp_head = (struct wait_node **) &lock->__status; + int maxprio; + + WRITE_MEMORY_BARRIER(); + +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + __pthread_acquire(&lock->__spinlock); + } +#endif + + while (1) { + + /* If no threads are waiting for this lock, try to just + atomically release it. */ +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + if (lock->__status == 0 || lock->__status == 1) { + lock->__status = 0; + break; + } + } +#endif + +#if defined TEST_FOR_COMPARE_AND_SWAP + else +#endif + +#if defined HAS_COMPARE_AND_SWAP + { + long oldstatus = lock->__status; + if (oldstatus == 0 || oldstatus == 1) { + if (__compare_and_swap_with_release_semantics (&lock->__status, oldstatus, 0)) + break; + else + continue; + } + } +#endif + + /* Process the entire queue of wait nodes. Remove all abandoned + wait nodes and put them into the global free queue, and + remember the one unabandoned node which refers to the thread + having the highest priority. */ + + pp_max_prio = pp_node = pp_head; + p_max_prio = p_node = *pp_head; + maxprio = INT_MIN; + + READ_MEMORY_BARRIER(); /* Prevent access to stale data through p_node */ + + while (p_node != (struct wait_node *) 1) { + int prio; + + if (p_node->abandoned) { + /* Remove abandoned node. */ +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + *pp_node = p_node->next; +#endif +#if defined TEST_FOR_COMPARE_AND_SWAP + else +#endif +#if defined HAS_COMPARE_AND_SWAP + wait_node_dequeue(pp_head, pp_node, p_node); +#endif + wait_node_free(p_node); + /* Note that the next assignment may take us to the beginning + of the queue, to newly inserted nodes, if pp_node == pp_head. + In that case we need a memory barrier to stabilize the first of + these new nodes. */ + p_node = *pp_node; + if (pp_node == pp_head) + READ_MEMORY_BARRIER(); /* No stale reads through p_node */ + continue; + } else if ((prio = p_node->thr->p_priority) >= maxprio) { + /* Otherwise remember it if its thread has a higher or equal priority + compared to that of any node seen thus far. */ + maxprio = prio; + pp_max_prio = pp_node; + p_max_prio = p_node; + } + + /* This canno6 jump backward in the list, so no further read + barrier is needed. */ + pp_node = &p_node->next; + p_node = *pp_node; + } + + /* If all threads abandoned, go back to top */ + if (maxprio == INT_MIN) + continue; + + ASSERT (p_max_prio != (struct wait_node *) 1); + + /* Now we want to to remove the max priority thread's wait node from + the list. Before we can do this, we must atomically try to change the + node's abandon state from zero to nonzero. If we succeed, that means we + have the node that we will wake up. If we failed, then it means the + thread timed out and abandoned the node in which case we repeat the + whole unlock operation. */ + + if (!testandset(&p_max_prio->abandoned)) { +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + *pp_max_prio = p_max_prio->next; +#endif +#if defined TEST_FOR_COMPARE_AND_SWAP + else +#endif +#if defined HAS_COMPARE_AND_SWAP + wait_node_dequeue(pp_head, pp_max_prio, p_max_prio); +#endif + restart(p_max_prio->thr); + break; + } + } + +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + __pthread_release(&lock->__spinlock); + } +#endif +} + + +/* Compare-and-swap emulation with a spinlock */ + +#ifdef TEST_FOR_COMPARE_AND_SWAP +int __pthread_has_cas = 0; +#endif + +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + +int __pthread_compare_and_swap(long * ptr, long oldval, long newval, + int * spinlock) +{ + int res; + + __pthread_acquire(spinlock); + + if (*ptr == oldval) { + *ptr = newval; res = 1; + } else { + res = 0; + } + + __pthread_release(spinlock); + + return res; +} + +/* This function is called if the inlined test-and-set + in __pthread_compare_and_swap() failed */ + +/* The retry strategy is as follows: + - We test and set the spinlock MAX_SPIN_COUNT times, calling + sched_yield() each time. This gives ample opportunity for other + threads with priority >= our priority to make progress and + release the spinlock. + - If a thread with priority < our priority owns the spinlock, + calling sched_yield() repeatedly is useless, since we're preventing + the owning thread from making progress and releasing the spinlock. + So, after MAX_SPIN_LOCK attemps, we suspend the calling thread + using nanosleep(). This again should give time to the owning thread + for releasing the spinlock. + Notice that the nanosleep() interval must not be too small, + since the kernel does busy-waiting for short intervals in a realtime + process (!). The smallest duration that guarantees thread + suspension is currently 2ms. + - When nanosleep() returns, we try again, doing MAX_SPIN_COUNT + sched_yield(), then sleeping again if needed. */ + +static void __pthread_acquire(int * spinlock) +{ + int cnt = 0; + struct timespec tm; + + READ_MEMORY_BARRIER(); + + while (testandset(spinlock)) { + if (cnt < MAX_SPIN_COUNT) { + sched_yield(); + cnt++; + } else { + tm.tv_sec = 0; + tm.tv_nsec = SPIN_SLEEP_DURATION; + nanosleep(&tm, NULL); + cnt = 0; + } + } +} + +#endif diff --git a/newlib/libc/sys/linux/linuxthreads/spinlock.h b/newlib/libc/sys/linux/linuxthreads/spinlock.h new file mode 100644 index 000000000..0ec40c57c --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/spinlock.h @@ -0,0 +1,218 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +#include + + +/* There are 2 compare and swap synchronization primitives with + different semantics: + + 1. compare_and_swap, which has acquire semantics (i.e. it + completes befor subsequent writes.) + 2. compare_and_swap_with_release_semantics, which has release + semantics (it completes after previous writes.) + + For those platforms on which they are the same. HAS_COMPARE_AND_SWAP + should be defined. For those platforms on which they are different, + HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS has to be defined. */ + +#ifndef HAS_COMPARE_AND_SWAP +#ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS +#define HAS_COMPARE_AND_SWAP +#endif +#endif + +#if defined(TEST_FOR_COMPARE_AND_SWAP) + +extern int __pthread_has_cas; +extern int __pthread_compare_and_swap(long * ptr, long oldval, long newval, + int * spinlock); + +static inline int compare_and_swap(long * ptr, long oldval, long newval, + int * spinlock) +{ + if (__builtin_expect (__pthread_has_cas, 1)) + return __compare_and_swap(ptr, oldval, newval); + else + return __pthread_compare_and_swap(ptr, oldval, newval, spinlock); +} + +#elif defined(HAS_COMPARE_AND_SWAP) + +#ifdef IMPLEMENT_TAS_WITH_CAS +#define testandset(p) !__compare_and_swap((long int *) p, 0, 1) +#endif + +#ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS + +static inline int +compare_and_swap_with_release_semantics (long * ptr, long oldval, + long newval, int * spinlock) +{ + return __compare_and_swap_with_release_semantics (ptr, oldval, + newval); +} + +#endif + +static inline int compare_and_swap(long * ptr, long oldval, long newval, + int * spinlock) +{ + return __compare_and_swap(ptr, oldval, newval); +} + +#else + +extern int __pthread_compare_and_swap(long * ptr, long oldval, long newval, + int * spinlock); + +static inline int compare_and_swap(long * ptr, long oldval, long newval, + int * spinlock) +{ + return __pthread_compare_and_swap(ptr, oldval, newval, spinlock); +} + +#endif + +#ifndef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS +#define compare_and_swap_with_release_semantics compare_and_swap +#define __compare_and_swap_with_release_semantics __compare_and_swap +#endif + +/* Internal locks */ + +extern void internal_function __pthread_lock(struct _pthread_fastlock * lock, + pthread_descr self); +extern int __pthread_unlock(struct _pthread_fastlock *lock); + +static inline void __pthread_init_lock(struct _pthread_fastlock * lock) +{ + lock->__status = 0; + lock->__spinlock = __LT_SPINLOCK_INIT; +} + +static inline int __pthread_trylock (struct _pthread_fastlock * lock) +{ +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + return (testandset(&lock->__spinlock) ? EBUSY : 0); + } +#endif + +#if defined HAS_COMPARE_AND_SWAP + do { + if (lock->__status != 0) return EBUSY; + } while(! __compare_and_swap(&lock->__status, 0, 1)); + return 0; +#endif +} + +/* Variation of internal lock used for pthread_mutex_t, supporting + timed-out waits. Warning: do not mix these operations with the above ones + over the same lock object! */ + +extern void __pthread_alt_lock(struct _pthread_fastlock * lock, + pthread_descr self); + +extern int __pthread_alt_timedlock(struct _pthread_fastlock * lock, + pthread_descr self, const struct timespec *abstime); + +extern void __pthread_alt_unlock(struct _pthread_fastlock *lock); + +static inline void __pthread_alt_init_lock(struct _pthread_fastlock * lock) +{ + lock->__status = 0; + lock->__spinlock = __LT_SPINLOCK_INIT; +} + +static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock) +{ +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP + { + int res = EBUSY; + + if (testandset(&lock->__spinlock) == 0) + { + if (lock->__status == 0) + { + lock->__status = 1; + WRITE_MEMORY_BARRIER(); + res = 0; + } + lock->__spinlock = __LT_SPINLOCK_INIT; + } + return res; + } +#endif + +#if defined HAS_COMPARE_AND_SWAP + do { + if (lock->__status != 0) return EBUSY; + } while(! compare_and_swap(&lock->__status, 0, 1, &lock->__spinlock)); + return 0; +#endif +} + +/* Operations on pthread_atomic, which is defined in internals.h */ + +static inline long atomic_increment(struct pthread_atomic *pa) +{ + long oldval; + + do { + oldval = pa->p_count; + } while (!compare_and_swap(&pa->p_count, oldval, oldval + 1, &pa->p_spinlock)); + + return oldval; +} + + +static inline long atomic_decrement(struct pthread_atomic *pa) +{ + long oldval; + + do { + oldval = pa->p_count; + } while (!compare_and_swap(&pa->p_count, oldval, oldval - 1, &pa->p_spinlock)); + + return oldval; +} + + +static inline void +__pthread_set_own_extricate_if (pthread_descr self, pthread_extricate_if *peif) +{ + /* Only store a non-null peif if the thread has cancellation enabled. + Otherwise pthread_cancel will unconditionally call the extricate handler, + and restart the thread giving rise to forbidden spurious wakeups. */ + if (peif == NULL + || THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) + { + /* If we are removing the extricate interface, we need to synchronize + against pthread_cancel so that it does not continue with a pointer + to a deallocated pthread_extricate_if struct! The thread lock + is (ab)used for this synchronization purpose. */ + if (peif == NULL) + __pthread_lock (THREAD_GETMEM(self, p_lock), self); + THREAD_SETMEM(self, p_extricate, peif); + if (peif == NULL) + __pthread_unlock (THREAD_GETMEM(self, p_lock)); + } +} diff --git a/newlib/libc/sys/linux/linuxthreads/sysctl.c b/newlib/libc/sys/linux/linuxthreads/sysctl.c new file mode 100644 index 000000000..2512f17f1 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/sysctl.c @@ -0,0 +1,43 @@ +/* Read or write system information. Linux version. + Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#include + +static _syscall1(int,_sysctl,struct __sysctl_args *,args) + +int +__sysctl (int *name, int nlen, void *oldval, size_t *oldlenp, + void *newval, size_t newlen) +{ + struct __sysctl_args args = + { + name: name, + nlen: nlen, + oldval: oldval, + oldlenp: oldlenp, + newval: newval, + newlen: newlen + }; + + return _sysctl(&args); +} +weak_alias (__sysctl, sysctl) diff --git a/newlib/libc/sys/linux/linuxthreads/td_init.c b/newlib/libc/sys/linux/linuxthreads/td_init.c new file mode 100644 index 000000000..6c4dfc623 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_init.c @@ -0,0 +1,32 @@ +/* Initialization function of thread debugger support library. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + +int __td_debug; + + +td_err_e +td_init (void) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_log.c b/newlib/libc/sys/linux/linuxthreads/td_log.c new file mode 100644 index 000000000..2007eaacc --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_log.c @@ -0,0 +1,32 @@ +/* Noop, left for historical reasons. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_log (void) +{ + /* This interface is deprecated in the Sun interface. We provide it + for compatibility but don't do anyhting ourself. We might in + future do some logging if this seems reasonable. */ + LOG (__FUNCTION__); + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_symbol_list.c b/newlib/libc/sys/linux/linuxthreads/td_symbol_list.c new file mode 100644 index 000000000..e64d298f9 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_symbol_list.c @@ -0,0 +1,55 @@ +/* Return list of symbols the library can request. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include "thread_dbP.h" + + +static const char *symbol_list_arr[] = +{ + [PTHREAD_THREADS_EVENTS] = "__pthread_threads_events", + [PTHREAD_LAST_EVENT] = "__pthread_last_event", + [PTHREAD_HANDLES_NUM] = "__pthread_handles_num", + [PTHREAD_HANDLES] = "__pthread_handles", + [PTHREAD_KEYS] = "pthread_keys", + [LINUXTHREADS_PTHREAD_THREADS_MAX] = "__linuxthreads_pthread_threads_max", + [LINUXTHREADS_PTHREAD_KEYS_MAX] = "__linuxthreads_pthread_keys_max", + [LINUXTHREADS_PTHREAD_SIZEOF_DESCR] = "__linuxthreads_pthread_sizeof_descr", + [LINUXTHREADS_CREATE_EVENT] = "__linuxthreads_create_event", + [LINUXTHREADS_DEATH_EVENT] = "__linuxthreads_death_event", + [LINUXTHREADS_REAP_EVENT] = "__linuxthreads_reap_event", + [NUM_MESSAGES] = NULL +}; + + +const char ** +td_symbol_list (void) +{ + return symbol_list_arr; +} + + +int +td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr) +{ + assert (idx >= 0 && idx < NUM_MESSAGES); + return ps_pglobal_lookup (ps, LIBPTHREAD_SO, symbol_list_arr[idx], sym_addr); +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_clear_event.c b/newlib/libc/sys/linux/linuxthreads/td_ta_clear_event.c new file mode 100644 index 000000000..fc7fde135 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_clear_event.c @@ -0,0 +1,53 @@ +/* Globally disable events. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_clear_event (ta, event) + const td_thragent_t *ta; + td_thr_events_t *event; +{ + td_thr_events_t old_event; + int i; + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Write the new value into the thread data structure. */ + if (ps_pdread (ta->ph, ta->pthread_threads_eventsp, + &old_event, sizeof (td_thrhandle_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Remove the set bits in. */ + for (i = 0; i < TD_EVENTSIZE; ++i) + old_event.event_bits[i] &= ~event->event_bits[i]; + + /* Write the new value into the thread data structure. */ + if (ps_pdwrite (ta->ph, ta->pthread_threads_eventsp, + &old_event, sizeof (td_thrhandle_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_delete.c b/newlib/libc/sys/linux/linuxthreads/td_ta_delete.c new file mode 100644 index 000000000..5d235630d --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_delete.c @@ -0,0 +1,58 @@ +/* Detach to target process. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "thread_dbP.h" + + +td_err_e +td_ta_delete (td_thragent_t *ta) +{ + LOG (__FUNCTION__); + + /* Safety check. */ + if (ta == NULL || __td_agent_list == NULL) + return TD_BADTA; + + /* Remove the handle from the list. */ + if (ta == __td_agent_list->ta) + /* It's the first element of the list. */ + __td_agent_list = __td_agent_list->next; + else + { + /* We have to search for it. */ + struct agent_list *runp = __td_agent_list; + + while (runp->next != NULL && runp->next->ta != ta) + runp = runp->next; + + if (runp->next == NULL) + /* It's not a valid decriptor since it is not in the list. */ + return TD_BADTA; + + runp->next = runp->next->next; + } + + /* The handle was allocated in `td_ta_new'. */ + free (ta); + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_enable_stats.c b/newlib/libc/sys/linux/linuxthreads/td_ta_enable_stats.c new file mode 100644 index 000000000..5a6fef7ee --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_enable_stats.c @@ -0,0 +1,35 @@ +/* Enable collection of statistics for process. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_enable_stats (const td_thragent_t *ta, int enable) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_event_addr.c b/newlib/libc/sys/linux/linuxthreads/td_ta_event_addr.c new file mode 100644 index 000000000..4f0f7bbf1 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_event_addr.c @@ -0,0 +1,73 @@ +/* Get event address. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr) +{ + td_err_e res = TD_NOEVENT; + int idx = -1; + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + switch (event) + { + case TD_CREATE: + idx = LINUXTHREADS_CREATE_EVENT; + break; + + case TD_DEATH: + idx = LINUXTHREADS_DEATH_EVENT; + break; + + case TD_REAP: + idx = LINUXTHREADS_REAP_EVENT; + break; + + default: + /* Event cannot be handled. */ + break; + } + + /* Now get the address. */ + if (idx != -1) + { + psaddr_t taddr; + + if (td_lookup (ta->ph, idx, &taddr) == PS_OK) + { + /* Success, we got the address. */ + addr->type = NOTIFY_BPT; + addr->u.bptaddr = taddr; + + res = TD_OK; + } + else + res = TD_ERR; + } + + return res; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_event_getmsg.c b/newlib/libc/sys/linux/linuxthreads/td_ta_event_getmsg.c new file mode 100644 index 000000000..a63a3d0a7 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_event_getmsg.c @@ -0,0 +1,128 @@ +/* Retrieve event. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#include "thread_dbP.h" + + +td_err_e +td_ta_event_getmsg (const td_thragent_t *ta, td_event_msg_t *msg) +{ + /* XXX I cannot think of another way but using a static variable. */ + static td_thrhandle_t th; + td_eventbuf_t event; + psaddr_t addr; + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Get the pointer to the thread descriptor with the last event. */ + if (ps_pdread (ta->ph, ta->pthread_last_event, + &addr, sizeof (void *)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* If the pointer is NULL no event occurred. */ + if (addr == 0) + return TD_NOMSG; + + /* Read the even structure from the target. */ + if (ps_pdread (ta->ph, + ((char *) addr + + offsetof (struct _pthread_descr_struct, p_eventbuf)), + &event, sizeof (td_eventbuf_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Check whether an event occurred. */ + if (event.eventnum == TD_EVENT_NONE) + { + /* Oh well, this means the last event was already read. So + we have to look for any other event. */ + struct pthread_handle_struct handles[ta->pthread_threads_max]; + int num; + int i; + + /* Read the number of currently active threads. */ + if (ps_pdread (ta->ph, ta->pthread_handles_num, &num, sizeof (int)) + != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Now read the handles. */ + if (ps_pdread (ta->ph, ta->handles, handles, + ta->pthread_threads_max * sizeof (handles[0])) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + for (i = 0; i < ta->pthread_threads_max && num > 0; ++i) + { + if (handles[i].h_descr == NULL) + /* No entry here. */ + continue; + + /* First count this active thread. */ + --num; + + if (handles[i].h_descr == addr) + /* We already handled this. */ + continue; + + /* Read the event data for this thread. */ + if (ps_pdread (ta->ph, + ((char *) handles[i].h_descr + + offsetof (struct _pthread_descr_struct, + p_eventbuf)), + &event, sizeof (td_eventbuf_t)) != PS_OK) + return TD_ERR; + + if (event.eventnum != TD_EVENT_NONE) + { + /* We found a thread with an unreported event. */ + addr = handles[i].h_descr; + break; + } + } + + /* If we haven't found any other event signal this to the user. */ + if (event.eventnum == TD_EVENT_NONE) + return TD_NOMSG; + } + + /* Generate the thread descriptor. */ + th.th_ta_p = (td_thragent_t *) ta; + th.th_unique = addr; + + /* Fill the user's data structure. */ + msg->event = event.eventnum; + msg->th_p = &th; + msg->msg.data = (uintptr_t) event.eventdata; + + /* And clear the event message in the target. */ + memset (&event, '\0', sizeof (td_eventbuf_t)); + if (ps_pdwrite (ta->ph, + ((char *) addr + + offsetof (struct _pthread_descr_struct, p_eventbuf)), + &event, sizeof (td_eventbuf_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_get_nthreads.c b/newlib/libc/sys/linux/linuxthreads/td_ta_get_nthreads.c new file mode 100644 index 000000000..f275a25e7 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_get_nthreads.c @@ -0,0 +1,42 @@ +/* Get the number of threads in the process. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + +td_err_e +td_ta_get_nthreads (const td_thragent_t *ta, int *np) +{ + psaddr_t addr; + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Access the variable `__pthread_handles_num'. */ + if (td_lookup (ta->ph, PTHREAD_HANDLES_NUM, &addr) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + if (ps_pdread (ta->ph, addr, np, sizeof (int)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_get_ph.c b/newlib/libc/sys/linux/linuxthreads/td_ta_get_ph.c new file mode 100644 index 000000000..e08d52137 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_get_ph.c @@ -0,0 +1,36 @@ +/* Get external process handle. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_get_ph (const td_thragent_t *ta, struct ps_prochandle **ph) +{ + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + *ph = ta->ph; + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_get_stats.c b/newlib/libc/sys/linux/linuxthreads/td_ta_get_stats.c new file mode 100644 index 000000000..9aa049c3e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_get_stats.c @@ -0,0 +1,35 @@ +/* Retrieve statistics for process. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_get_stats (const td_thragent_t *ta, td_ta_stats_t *statsp) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_map_id2thr.c b/newlib/libc/sys/linux/linuxthreads/td_ta_map_id2thr.c new file mode 100644 index 000000000..5171a5bf1 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_map_id2thr.c @@ -0,0 +1,66 @@ +/* Map thread ID to thread handle. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_map_id2thr (const td_thragent_t *ta, pthread_t pt, td_thrhandle_t *th) +{ + struct pthread_handle_struct phc; + struct _pthread_descr_struct pds; + int pthread_threads_max; + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Make the following expression a bit smaller. */ + pthread_threads_max = ta->pthread_threads_max; + + /* We can compute the entry in the handle array we want. */ + if (ps_pdread (ta->ph, ta->handles + pt % pthread_threads_max, &phc, + sizeof (struct pthread_handle_struct)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Test whether this entry is in use. */ + if (phc.h_descr == NULL) + return TD_BADTH; + + /* Next test: get the descriptor to see whether this is not an old + thread handle. */ + if (ps_pdread (ta->ph, phc.h_descr, &pds, + sizeof (struct _pthread_descr_struct)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + if (pds.p_tid != pt) + return TD_BADTH; + + if (pds.p_terminated != 0) + return TD_NOTHR; + + /* Create the `td_thrhandle_t' object. */ + th->th_ta_p = (td_thragent_t *) ta; + th->th_unique = phc.h_descr; + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_map_lwp2thr.c b/newlib/libc/sys/linux/linuxthreads/td_ta_map_lwp2thr.c new file mode 100644 index 000000000..8ae5aec78 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_map_lwp2thr.c @@ -0,0 +1,81 @@ +/* Which thread is running on an lwp? + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th) +{ + int pthread_threads_max = ta->pthread_threads_max; + size_t sizeof_descr = ta->sizeof_descr; + struct pthread_handle_struct phc[pthread_threads_max]; + size_t cnt; +#ifdef ALL_THREADS_STOPPED + int num; +#else +# define num 1 +#endif + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Read all the descriptors. */ + if (ps_pdread (ta->ph, ta->handles, phc, + sizeof (struct pthread_handle_struct) * pthread_threads_max) + != PS_OK) + return TD_ERR; /* XXX Other error value? */ + +#ifdef ALL_THREADS_STOPPED + /* Read the number of currently active threads. */ + if (ps_pdread (ta->ph, ta->pthread_handles_num, &num, sizeof (int)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ +#endif + + /* Get the entries one after the other and find out whether the ID + matches. */ + for (cnt = 0; cnt < pthread_threads_max && num > 0; ++cnt) + if (phc[cnt].h_descr != NULL) + { + struct _pthread_descr_struct pds; + +#ifdef ALL_THREADS_STOPPED + /* First count this active thread. */ + --num; +#endif + + if (ps_pdread (ta->ph, phc[cnt].h_descr, &pds, sizeof_descr) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + if ((pds.p_pid ?: ps_getpid (ta->ph)) == lwpid) + { + /* Found it. Now fill in the `td_thrhandle_t' object. */ + th->th_ta_p = (td_thragent_t *) ta; + th->th_unique = phc[cnt].h_descr; + + return TD_OK; + } + } + + return TD_NOLWP; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_new.c b/newlib/libc/sys/linux/linuxthreads/td_ta_new.c new file mode 100644 index 000000000..7bf687905 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_new.c @@ -0,0 +1,132 @@ +/* Attach to target process. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#include "thread_dbP.h" + + +/* Datatype for the list of known thread agents. Normally there will + be exactly one so we don't spend much though on making it fast. */ +struct agent_list *__td_agent_list; + + +td_err_e +td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta) +{ + psaddr_t addr; + struct agent_list *elemp; + + LOG (__FUNCTION__); + + /* Get the global event mask. This is one of the variables which + are new in the thread library to enable debugging. If it is + not available we cannot debug. */ + if (td_lookup (ps, PTHREAD_THREADS_EVENTS, &addr) != PS_OK) + return TD_NOLIBTHREAD; + + /* Fill in the appropriate information. */ + *ta = (td_thragent_t *) malloc (sizeof (td_thragent_t)); + if (*ta == NULL) + return TD_MALLOC; + + /* Store the proc handle which we will pass to the callback functions + back into the debugger. */ + (*ta)->ph = ps; + + /* Remember the address. */ + (*ta)->pthread_threads_eventsp = (td_thr_events_t *) addr; + + /* Get the pointer to the variable pointing to the thread descriptor + with the last event. */ + if (td_lookup (ps, PTHREAD_LAST_EVENT, &(*ta)->pthread_last_event) != PS_OK) + { + free_return: + free (*ta); + return TD_ERR; + } + + /* Get the pointer to the variable containing the number of active + threads. */ + if (td_lookup (ps, PTHREAD_HANDLES_NUM, &(*ta)->pthread_handles_num) + != PS_OK) + goto free_return; + + /* See whether the library contains the necessary symbols. */ + if (td_lookup (ps, PTHREAD_HANDLES, &addr) != PS_OK) + goto free_return; + + (*ta)->handles = (struct pthread_handle_struct *) addr; + + + if (td_lookup (ps, PTHREAD_KEYS, &addr) != PS_OK) + goto free_return; + + /* Cast to the right type. */ + (*ta)->keys = (struct pthread_key_struct *) addr; + + /* Find out about the maximum number of threads. Old implementations + don't provide this information. In this case we assume that the + debug library is compiled with the same values. */ + if (td_lookup (ps, LINUXTHREADS_PTHREAD_THREADS_MAX, &addr) != PS_OK) + (*ta)->pthread_threads_max = PTHREAD_THREADS_MAX; + else + { + if (ps_pdread (ps, addr, &(*ta)->pthread_threads_max, sizeof (int)) + != PS_OK) + goto free_return; + } + + /* Similar for the maximum number of thread local data keys. */ + if (td_lookup (ps, LINUXTHREADS_PTHREAD_KEYS_MAX, &addr) != PS_OK) + (*ta)->pthread_keys_max = PTHREAD_KEYS_MAX; + else + { + if (ps_pdread (ps, addr, &(*ta)->pthread_keys_max, sizeof (int)) + != PS_OK) + goto free_return; + } + + /* And for the size of the second level arrays for the keys. */ + if (td_lookup (ps, LINUXTHREADS_PTHREAD_SIZEOF_DESCR, &addr) != PS_OK) + (*ta)->sizeof_descr = sizeof (struct _pthread_descr_struct); + else + { + if (ps_pdread (ps, addr, &(*ta)->sizeof_descr, sizeof (int)) != PS_OK) + goto free_return; + } + + /* Now add the new agent descriptor to the list. */ + elemp = (struct agent_list *) malloc (sizeof (struct agent_list)); + if (elemp == NULL) + { + /* Argh, now that everything else worked... */ + free (*ta); + return TD_MALLOC; + } + + /* We don't care for thread-safety here. */ + elemp->ta = *ta; + elemp->next = __td_agent_list; + __td_agent_list = elemp; + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_reset_stats.c b/newlib/libc/sys/linux/linuxthreads/td_ta_reset_stats.c new file mode 100644 index 000000000..9cc386cf8 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_reset_stats.c @@ -0,0 +1,35 @@ +/* Reset statistics. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_reset_stats (const td_thragent_t *ta) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_set_event.c b/newlib/libc/sys/linux/linuxthreads/td_ta_set_event.c new file mode 100644 index 000000000..0ea8fc119 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_set_event.c @@ -0,0 +1,53 @@ +/* Globally enable events. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_set_event (ta, event) + const td_thragent_t *ta; + td_thr_events_t *event; +{ + td_thr_events_t old_event; + int i; + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Write the new value into the thread data structure. */ + if (ps_pdread (ta->ph, ta->pthread_threads_eventsp, + &old_event, sizeof (td_thrhandle_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Or the new bits in. */ + for (i = 0; i < TD_EVENTSIZE; ++i) + old_event.event_bits[i] |= event->event_bits[i]; + + /* Write the new value into the thread data structure. */ + if (ps_pdwrite (ta->ph, ta->pthread_threads_eventsp, + &old_event, sizeof (td_thrhandle_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_setconcurrency.c b/newlib/libc/sys/linux/linuxthreads/td_ta_setconcurrency.c new file mode 100644 index 000000000..25c1c90c7 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_setconcurrency.c @@ -0,0 +1,35 @@ +/* Set suggested concurrency level for process. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_setconcurrency (const td_thragent_t *ta, int level) +{ + /* This is something LinuxThreads does not support. */ + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + return TD_NOCAPAB; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_thr_iter.c b/newlib/libc/sys/linux/linuxthreads/td_ta_thr_iter.c new file mode 100644 index 000000000..4c6f3f4cb --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_thr_iter.c @@ -0,0 +1,142 @@ +/* Iterate over a process's threads. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" +#include + +static int +handle_descr (const td_thragent_t *ta, td_thr_iter_f *callback, + void *cbdata_p, td_thr_state_e state, int ti_pri, + size_t cnt, pthread_descr descr) +{ + struct _pthread_descr_struct pds; + size_t sizeof_descr = ta->sizeof_descr; + td_thrhandle_t th; + + if (ps_pdread (ta->ph, descr, &pds, sizeof_descr) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* The manager thread must be handled special. The descriptor + exists but the thread only gets created when the first + `pthread_create' call is issued. A clear indication that this + happened is when the p_pid field is non-zero. */ + if (cnt == 1 && pds.p_pid == 0) + return TD_OK; + + /* Now test whether this thread matches the specified + conditions. */ + + /* Only if the priority level is as high or higher. */ + if (pds.p_priority < ti_pri) + return TD_OK; + + /* Test the state. + XXX This is incomplete. */ + if (state != TD_THR_ANY_STATE) + return TD_OK; + + /* XXX For now we ignore threads which are not running anymore. + The reason is that gdb tries to get the registers and fails. + In future we should have a special mode of the thread library + in which we keep the process around until the actual join + operation happened. */ + if (pds.p_exited != 0) + return TD_OK; + + /* Yep, it matches. Call the callback function. */ + th.th_ta_p = (td_thragent_t *) ta; + th.th_unique = descr; + if (callback (&th, cbdata_p) != 0) + return TD_DBERR; + + /* All done successfully. */ + return TD_OK; +} + + +td_err_e +td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback, + void *cbdata_p, td_thr_state_e state, int ti_pri, + sigset_t *ti_sigmask_p, unsigned int ti_user_flags) +{ + int pthread_threads_max; + struct pthread_handle_struct *phc; + td_err_e result = TD_OK; + int cnt; +#ifdef ALL_THREADS_STOPPED + int num; +#else +# define num 1 +#endif + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + pthread_threads_max = ta->pthread_threads_max; + phc = (struct pthread_handle_struct *) alloca (sizeof (phc[0]) + * pthread_threads_max); + + /* First read only the main thread and manager thread information. */ + if (ps_pdread (ta->ph, ta->handles, phc, + sizeof (struct pthread_handle_struct) * 2) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Now handle these descriptors. */ + result = handle_descr (ta, callback, cbdata_p, state, ti_pri, 0, + phc[0].h_descr); + if (result != TD_OK) + return result; + result = handle_descr (ta, callback, cbdata_p, state, ti_pri, 1, + phc[1].h_descr); + if (result != TD_OK) + return result; + + /* Read all the descriptors. */ + if (ps_pdread (ta->ph, ta->handles + 2, &phc[2], + (sizeof (struct pthread_handle_struct) + * (pthread_threads_max - 2))) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + +#ifdef ALL_THREADS_STOPPED + /* Read the number of currently active threads. */ + if (ps_pdread (ta->ph, ta->pthread_handles_num, &num, sizeof (int)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ +#endif + + /* Now get all descriptors, one after the other. */ + for (cnt = 2; cnt < pthread_threads_max && num > 0; ++cnt) + if (phc[cnt].h_descr != NULL) + { +#ifdef ALL_THREADS_STOPPED + /* First count this active thread. */ + --num; +#endif + + result = handle_descr (ta, callback, cbdata_p, state, ti_pri, cnt, + phc[cnt].h_descr); + if (result != TD_OK) + break; + } + + return result; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_ta_tsd_iter.c b/newlib/libc/sys/linux/linuxthreads/td_ta_tsd_iter.c new file mode 100644 index 000000000..f29938564 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_ta_tsd_iter.c @@ -0,0 +1,55 @@ +/* Iterate over a process's thread-specific data. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" +#include + +td_err_e +td_ta_tsd_iter (const td_thragent_t *ta, td_key_iter_f *callback, + void *cbdata_p) +{ + struct pthread_key_struct *keys; + int pthread_keys_max; + int cnt; + + LOG (__FUNCTION__); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + pthread_keys_max = ta->pthread_keys_max; + keys = (struct pthread_key_struct *) alloca (sizeof (keys[0]) + * pthread_keys_max); + + /* Read all the information about the keys. */ + if (ps_pdread (ta->ph, ta->keys, keys, + sizeof (keys[0]) * pthread_keys_max) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Now get all descriptors, one after the other. */ + for (cnt = 0; cnt < pthread_keys_max; ++cnt) + if (keys[cnt].in_use + /* Return with an error if the callback returns a nonzero value. */ + && callback (cnt, keys[cnt].destr, cbdata_p) != 0) + return TD_DBERR; + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_clear_event.c b/newlib/libc/sys/linux/linuxthreads/td_thr_clear_event.c new file mode 100644 index 000000000..b75c0f0aa --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_clear_event.c @@ -0,0 +1,57 @@ +/* Disable specific event for thread. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "thread_dbP.h" + + +td_err_e +td_thr_clear_event (th, event) + const td_thrhandle_t *th; + td_thr_events_t *event; +{ + td_thr_events_t old_event; + int i; + + LOG (__FUNCTION__); + + /* Write the new value into the thread data structure. */ + if (ps_pdread (th->th_ta_p->ph, + ((char *) th->th_unique + + offsetof (struct _pthread_descr_struct, + p_eventbuf.eventmask)), + &old_event, sizeof (td_thrhandle_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Remove the set bits in. */ + for (i = 0; i < TD_EVENTSIZE; ++i) + old_event.event_bits[i] &= ~event->event_bits[i]; + + /* Write the new value into the thread data structure. */ + if (ps_pdwrite (th->th_ta_p->ph, + ((char *) th->th_unique + + offsetof (struct _pthread_descr_struct, + p_eventbuf.eventmask)), + &old_event, sizeof (td_thrhandle_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_dbresume.c b/newlib/libc/sys/linux/linuxthreads/td_thr_dbresume.c new file mode 100644 index 000000000..68d62afd4 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_dbresume.c @@ -0,0 +1,30 @@ +/* Resume execution of given thread. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_dbresume (const td_thrhandle_t *th) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + return TD_NOCAPAB; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_dbsuspend.c b/newlib/libc/sys/linux/linuxthreads/td_thr_dbsuspend.c new file mode 100644 index 000000000..0655a1756 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_dbsuspend.c @@ -0,0 +1,30 @@ +/* Suspend execution of given thread. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_dbsuspend (const td_thrhandle_t *th) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + return TD_NOCAPAB; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_event_enable.c b/newlib/libc/sys/linux/linuxthreads/td_thr_event_enable.c new file mode 100644 index 000000000..007f2a464 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_event_enable.c @@ -0,0 +1,41 @@ +/* Enable event process-wide. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "thread_dbP.h" + + +td_err_e +td_thr_event_enable (th, onoff) + const td_thrhandle_t *th; + int onoff; +{ + LOG (__FUNCTION__); + + /* Write the new value into the thread data structure. */ + if (ps_pdwrite (th->th_ta_p->ph, + ((char *) th->th_unique + + offsetof (struct _pthread_descr_struct, p_report_events)), + &onoff, sizeof (int)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_event_getmsg.c b/newlib/libc/sys/linux/linuxthreads/td_thr_event_getmsg.c new file mode 100644 index 000000000..95b05ff07 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_event_getmsg.c @@ -0,0 +1,60 @@ +/* Retrieve event. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#include "thread_dbP.h" + + +td_err_e +td_thr_event_getmsg (const td_thrhandle_t *th, td_event_msg_t *msg) +{ + td_eventbuf_t event; + + LOG (__FUNCTION__); + + /* Read the even structure from the target. */ + if (ps_pdread (th->th_ta_p->ph, + ((char *) th->th_unique + + offsetof (struct _pthread_descr_struct, p_eventbuf)), + &event, sizeof (td_eventbuf_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Check whether an event occurred. */ + if (event.eventnum == TD_EVENT_NONE) + /* Nothing. */ + return TD_NOMSG; + + /* Fill the user's data structure. */ + msg->event = event.eventnum; + msg->th_p = th; + msg->msg.data = (uintptr_t) event.eventdata; + + /* And clear the event message in the target. */ + memset (&event, '\0', sizeof (td_eventbuf_t)); + if (ps_pdwrite (th->th_ta_p->ph, + ((char *) th->th_unique + + offsetof (struct _pthread_descr_struct, p_eventbuf)), + &event, sizeof (td_eventbuf_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_get_info.c b/newlib/libc/sys/linux/linuxthreads/td_thr_get_info.c new file mode 100644 index 000000000..ed6b20f59 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_get_info.c @@ -0,0 +1,76 @@ +/* Get thread information. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#include "thread_dbP.h" + + +td_err_e +td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop) +{ + struct _pthread_descr_struct pds; + + LOG (__FUNCTION__); + + /* Get the thread descriptor. */ + if (ps_pdread (th->th_ta_p->ph, th->th_unique, &pds, + th->th_ta_p->sizeof_descr) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Fill in information. Clear first to provide reproducable + results for the fields we do not fill in. */ + memset (infop, '\0', sizeof (td_thrinfo_t)); + + /* We have to handle the manager thread special since the thread + descriptor in older versions is not fully initialized. */ + if (pds.p_nr == 1) + { + infop->ti_tid = th->th_ta_p->pthread_threads_max * 2 + 1; + infop->ti_type = TD_THR_SYSTEM; + infop->ti_state = TD_THR_ACTIVE; + } + else + { + infop->ti_tid = pds.p_tid; + infop->ti_tls = (char *) pds.p_specific; + infop->ti_pri = pds.p_priority; + infop->ti_type = TD_THR_USER; + + if (! pds.p_terminated) + /* XXX For now there is no way to get more information. */ + infop->ti_state = TD_THR_ACTIVE; + else if (! pds.p_detached) + infop->ti_state = TD_THR_ZOMBIE; + else + infop->ti_state = TD_THR_UNKNOWN; + } + + /* Initialization which are the same in both cases. */ + infop->ti_lid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph); + infop->ti_ta_p = th->th_ta_p; + infop->ti_startfunc = pds.p_start_args.start_routine; + memcpy (&infop->ti_events, &pds.p_eventbuf.eventmask, + sizeof (td_thr_events_t)); + infop->ti_traceme = pds.p_report_events != 0; + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_getfpregs.c b/newlib/libc/sys/linux/linuxthreads/td_thr_getfpregs.c new file mode 100644 index 000000000..67d5cd1e2 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_getfpregs.c @@ -0,0 +1,49 @@ +/* Get a thread's floating-point register set. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_getfpregs (const td_thrhandle_t *th, prfpregset_t *regset) +{ + struct _pthread_descr_struct pds; + + LOG (__FUNCTION__); + + /* We have to get the state and the PID for this thread. */ + if (ps_pdread (th->th_ta_p->ph, th->th_unique, &pds, + sizeof (struct _pthread_descr_struct)) != PS_OK) + return TD_ERR; + + /* If the thread already terminated we return all zeroes. */ + if (pds.p_terminated) + memset (regset, '\0', sizeof (*regset)); + /* Otherwise get the register content through the callback. */ + else + { + pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph); + + if (ps_lgetfpregs (th->th_ta_p->ph, pid, regset) != PS_OK) + return TD_ERR; + } + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_getgregs.c b/newlib/libc/sys/linux/linuxthreads/td_thr_getgregs.c new file mode 100644 index 000000000..5a42b6770 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_getgregs.c @@ -0,0 +1,49 @@ +/* Get a thread's general register set. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_getgregs (const td_thrhandle_t *th, prgregset_t gregs) +{ + struct _pthread_descr_struct pds; + + LOG (__FUNCTION__); + + /* We have to get the state and the PID for this thread. */ + if (ps_pdread (th->th_ta_p->ph, th->th_unique, &pds, + sizeof (struct _pthread_descr_struct)) != PS_OK) + return TD_ERR; + + /* If the thread already terminated we return all zeroes. */ + if (pds.p_terminated) + memset (gregs, '\0', sizeof (prgregset_t)); + /* Otherwise get the register content through the callback. */ + else + { + pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph); + + if (ps_lgetregs (th->th_ta_p->ph, pid, gregs) != PS_OK) + return TD_ERR; + } + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_getxregs.c b/newlib/libc/sys/linux/linuxthreads/td_thr_getxregs.c new file mode 100644 index 000000000..615d88296 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_getxregs.c @@ -0,0 +1,30 @@ +/* Get a thread's extra state register set. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_getxregs (const td_thrhandle_t *th, void *xregs) +{ + /* XXX This might be platform specific. */ + LOG (__FUNCTION__); + return TD_NOXREGS; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_getxregsize.c b/newlib/libc/sys/linux/linuxthreads/td_thr_getxregsize.c new file mode 100644 index 000000000..ed55bbab7 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_getxregsize.c @@ -0,0 +1,30 @@ +/* Get the size of the extra state register set for this architecture. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_getxregsize (const td_thrhandle_t *th, int *sizep) +{ + /* XXX This might be platform specific. */ + LOG (__FUNCTION__); + return TD_NOXREGS; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_set_event.c b/newlib/libc/sys/linux/linuxthreads/td_thr_set_event.c new file mode 100644 index 000000000..f537cce05 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_set_event.c @@ -0,0 +1,57 @@ +/* Enable specific event for thread. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "thread_dbP.h" + + +td_err_e +td_thr_set_event (th, event) + const td_thrhandle_t *th; + td_thr_events_t *event; +{ + td_thr_events_t old_event; + int i; + + LOG (__FUNCTION__); + + /* Write the new value into the thread data structure. */ + if (ps_pdread (th->th_ta_p->ph, + ((char *) th->th_unique + + offsetof (struct _pthread_descr_struct, + p_eventbuf.eventmask)), + &old_event, sizeof (td_thrhandle_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Or the new bits in. */ + for (i = 0; i < TD_EVENTSIZE; ++i) + old_event.event_bits[i] |= event->event_bits[i]; + + /* Write the new value into the thread data structure. */ + if (ps_pdwrite (th->th_ta_p->ph, + ((char *) th->th_unique + + offsetof (struct _pthread_descr_struct, + p_eventbuf.eventmask)), + &old_event, sizeof (td_thrhandle_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_setfpregs.c b/newlib/libc/sys/linux/linuxthreads/td_thr_setfpregs.c new file mode 100644 index 000000000..d5e1ce35a --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_setfpregs.c @@ -0,0 +1,46 @@ +/* Set a thread's floating-point register set. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_setfpregs (const td_thrhandle_t *th, const prfpregset_t *fpregs) +{ + struct _pthread_descr_struct pds; + + LOG (__FUNCTION__); + + /* We have to get the state and the PID for this thread. */ + if (ps_pdread (th->th_ta_p->ph, th->th_unique, &pds, + sizeof (struct _pthread_descr_struct)) != PS_OK) + return TD_ERR; + + /* Only set the registers if the thread hasn't yet terminated. */ + if (pds.p_terminated == 0) + { + pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph); + + if (ps_lsetfpregs (th->th_ta_p->ph, pid, fpregs) != PS_OK) + return TD_ERR; + } + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_setgregs.c b/newlib/libc/sys/linux/linuxthreads/td_thr_setgregs.c new file mode 100644 index 000000000..8c7baa8e9 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_setgregs.c @@ -0,0 +1,46 @@ +/* Set a thread's general register set. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_setgregs (const td_thrhandle_t *th, prgregset_t gregs) +{ + struct _pthread_descr_struct pds; + + LOG (__FUNCTION__); + + /* We have to get the state and the PID for this thread. */ + if (ps_pdread (th->th_ta_p->ph, th->th_unique, &pds, + sizeof (struct _pthread_descr_struct)) != PS_OK) + return TD_ERR; + + /* Only set the registers if the thread hasn't yet terminated. */ + if (pds.p_terminated == 0) + { + pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph); + + if (ps_lsetregs (th->th_ta_p->ph, pid, gregs) != PS_OK) + return TD_ERR; + } + + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_setprio.c b/newlib/libc/sys/linux/linuxthreads/td_thr_setprio.c new file mode 100644 index 000000000..c1e3ca5b1 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_setprio.c @@ -0,0 +1,30 @@ +/* Set a thread's priority. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_setprio (const td_thrhandle_t *th, int prio) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_setsigpending.c b/newlib/libc/sys/linux/linuxthreads/td_thr_setsigpending.c new file mode 100644 index 000000000..bec429ea1 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_setsigpending.c @@ -0,0 +1,31 @@ +/* Raise a signal for a thread. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_setsigpending (const td_thrhandle_t *th, unsigned char n, + const sigset_t *ss) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_setxregs.c b/newlib/libc/sys/linux/linuxthreads/td_thr_setxregs.c new file mode 100644 index 000000000..c1915e5e9 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_setxregs.c @@ -0,0 +1,30 @@ +/* Set a thread's extra state register set. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_setxregs (const td_thrhandle_t *ta, const void *addr) +{ + /* XXX This might have to be platform specific. */ + LOG (__FUNCTION__); + return TD_NOXREGS; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_sigsetmask.c b/newlib/libc/sys/linux/linuxthreads/td_thr_sigsetmask.c new file mode 100644 index 000000000..ef3ebcbb8 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_sigsetmask.c @@ -0,0 +1,30 @@ +/* Set a thread's signal mask. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_sigsetmask (const td_thrhandle_t *th, const sigset_t *ss) +{ + /* XXX We have to figure out what has to be done. */ + LOG (__FUNCTION__); + return TD_OK; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_tsd.c b/newlib/libc/sys/linux/linuxthreads/td_thr_tsd.c new file mode 100644 index 000000000..302033681 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_tsd.c @@ -0,0 +1,76 @@ +/* Get a thread-specific data pointer for a thread. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_tsd (const td_thrhandle_t *th, const thread_key_t tk, void **data) +{ + struct _pthread_descr_struct pds; + struct pthread_key_struct *keys = th->th_ta_p->keys; + struct pthread_key_struct key; + int pthread_keys_max = th->th_ta_p->pthread_keys_max; + int pthread_key_2ndlevel_size = th->th_ta_p->pthread_key_2ndlevel_size; + unsigned int idx1st; + unsigned int idx2nd; + void *p; + + LOG (__FUNCTION__); + + /* Get the thread descriptor. */ + if (ps_pdread (th->th_ta_p->ph, th->th_unique, &pds, + sizeof (struct _pthread_descr_struct)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Check correct value of key. */ + if (tk >= pthread_keys_max) + return TD_BADKEY; + + /* Get the key entry. */ + if (ps_pdread (th->th_ta_p->ph, keys, &key, + sizeof (struct pthread_key_struct)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Fail if this key is not at all used. */ + if (! key.in_use) + return TD_BADKEY; + + /* Compute the indeces. */ + idx1st = tk / pthread_key_2ndlevel_size; + idx2nd = tk % pthread_key_2ndlevel_size; + + /* Check the pointer to the second level array. */ + if (pds.p_specific[idx1st] == NULL) + return TD_NOTSD; + + /* Now get the real key. + XXX I don't know whether it's correct but there is currently no + easy way to determine whether a key was never set or the value + is NULL. We return an error whenever the value is NULL. */ + if (ps_pdread (th->th_ta_p->ph, &pds.p_specific[idx1st][idx2nd], &p, + sizeof (void *)) != PS_OK) + return TD_ERR; + + if (p != NULL) + *data = p; + + return p != NULL ? TD_OK : TD_NOTSD; +} diff --git a/newlib/libc/sys/linux/linuxthreads/td_thr_validate.c b/newlib/libc/sys/linux/linuxthreads/td_thr_validate.c new file mode 100644 index 000000000..354471071 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/td_thr_validate.c @@ -0,0 +1,57 @@ +/* Validate a thread handle. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_thr_validate (const td_thrhandle_t *th) +{ + struct pthread_handle_struct *handles = th->th_ta_p->handles; + int pthread_threads_max = th->th_ta_p->pthread_threads_max; + int cnt; + + LOG (__FUNCTION__); + + /* Now get all descriptors, one after the other. */ + for (cnt = 0; cnt < pthread_threads_max; ++cnt, ++handles) + { + struct pthread_handle_struct phc; + + if (ps_pdread (th->th_ta_p->ph, handles, &phc, + sizeof (struct pthread_handle_struct)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + if (phc.h_descr != NULL && phc.h_descr == th->th_unique) + { + struct _pthread_descr_struct pds; + + if (ps_pdread (th->th_ta_p->ph, phc.h_descr, &pds, + th->th_ta_p->sizeof_descr) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* XXX There should be another test using the TID but this is + currently not available. */ + return pds.p_terminated != 0 ? TD_NOTHR : TD_OK; + } + } + + return TD_ERR; +} diff --git a/newlib/libc/sys/linux/linuxthreads/testrtsig.h b/newlib/libc/sys/linux/linuxthreads/testrtsig.h new file mode 100644 index 000000000..cf36ab08a --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/testrtsig.h @@ -0,0 +1,36 @@ +/* Test whether RT signals are really available. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#include "kernel-features.h" + +static int +kernel_has_rtsig (void) +{ +#if __ASSUME_REALTIME_SIGNALS + return 1; +#else + struct utsname name; + + return uname (&name) == 0 && __strverscmp (name.release, "2.1.70") >= 0; +#endif +} diff --git a/newlib/libc/sys/linux/linuxthreads/thread_db.h b/newlib/libc/sys/linux/linuxthreads/thread_db.h new file mode 100644 index 000000000..b192d1f2e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/thread_db.h @@ -0,0 +1,439 @@ +/* Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _THREAD_DB_H +#define _THREAD_DB_H 1 + +/* This is the debugger interface for the LinuxThreads library. It is + modelled closely after the interface with same names in Solaris with + the goal to share the same code in the debugger. */ +#include +#include +#include +#include + + +/* Error codes of the library. */ +typedef enum +{ + TD_OK, /* No error. */ + TD_ERR, /* No further specified error. */ + TD_NOTHR, /* No matching thread found. */ + TD_NOSV, /* No matching synchronization handle found. */ + TD_NOLWP, /* No matching light-weighted process found. */ + TD_BADPH, /* Invalid process handle. */ + TD_BADTH, /* Invalid thread handle. */ + TD_BADSH, /* Invalid synchronization handle. */ + TD_BADTA, /* Invalid thread agent. */ + TD_BADKEY, /* Invalid key. */ + TD_NOMSG, /* No event available. */ + TD_NOFPREGS, /* No floating-point register content available. */ + TD_NOLIBTHREAD, /* Application not linked with thread library. */ + TD_NOEVENT, /* Requested event is not supported. */ + TD_NOCAPAB, /* Capability not available. */ + TD_DBERR, /* Internal debug library error. */ + TD_NOAPLIC, /* Operation is not applicable. */ + TD_NOTSD, /* No thread-specific data available. */ + TD_MALLOC, /* Out of memory. */ + TD_PARTIALREG, /* Not entire register set was read or written. */ + TD_NOXREGS /* X register set not available for given thread. */ +} td_err_e; + + +/* Possible thread states. TD_THR_ANY_STATE is a pseudo-state used to + select threads regardless of state in td_ta_thr_iter(). */ +typedef enum +{ + TD_THR_ANY_STATE, + TD_THR_UNKNOWN, + TD_THR_STOPPED, + TD_THR_RUN, + TD_THR_ACTIVE, + TD_THR_ZOMBIE, + TD_THR_SLEEP, + TD_THR_STOPPED_ASLEEP +} td_thr_state_e; + +/* Thread type: user or system. TD_THR_ANY_TYPE is a pseudo-type used + to select threads regardless of type in td_ta_thr_iter(). */ +typedef enum +{ + TD_THR_ANY_TYPE, + TD_THR_USER, + TD_THR_SYSTEM +} td_thr_type_e; + + +/* Types of the debugging library. */ + +/* Handle for a process. This type is opaque. */ +typedef struct td_thragent td_thragent_t; + +/* The actual thread handle type. This is also opaque. */ +typedef struct td_thrhandle +{ + td_thragent_t *th_ta_p; + psaddr_t th_unique; +} td_thrhandle_t; + + +/* Flags for `td_ta_thr_iter'. */ +#define TD_THR_ANY_USER_FLAGS 0xffffffff +#define TD_THR_LOWEST_PRIORITY -20 +#define TD_SIGNO_MASK NULL + + +#define TD_EVENTSIZE 2 +#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */ +#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */ +#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */ + +/* Bitmask of enabled events. */ +typedef struct td_thr_events +{ + uint32_t event_bits[TD_EVENTSIZE]; +} td_thr_events_t; + +/* Event set manipulation macros. */ +#define __td_eventmask(n) \ + (UINT32_C (1) << (((n) - 1) & BT_UIMASK)) +#define __td_eventword(n) \ + ((UINT32_C ((n) - 1)) >> BT_UISHIFT) + +#define td_event_emptyset(setp) \ + do { \ + int __i; \ + for (__i = TD_EVENTSIZE; __i > 0; --__i) \ + (setp)->event_bits[__i - 1] = 0; \ + } while (0) + +#define td_event_fillset(setp) \ + do { \ + int __i; \ + for (__i = TD_EVENTSIZE; __i > 0; --__i) \ + (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \ + } while (0) + +#define td_event_addset(setp, n) \ + (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n)) +#define td_event_delset(setp, n) \ + (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n)) +#define td_eventismember(setp, n) \ + (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)])) +#if TD_EVENTSIZE == 2 +# define td_eventisempty(setp) \ + (!((setp)->event_bits[0]) && !((setp)->event_bits[1])) +#else +# error "td_eventisempty must be changed to match TD_EVENTSIZE" +#endif + +/* Events reportable by the thread implementation. */ +typedef enum +{ + TD_ALL_EVENTS, /* Pseudo-event number. */ + TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context. */ + TD_READY, /* Is executable now. */ + TD_SLEEP, /* Blocked in a synchronization obj. */ + TD_SWITCHTO, /* Now assigned to a process. */ + TD_SWITCHFROM, /* Not anymore assigned to a process. */ + TD_LOCK_TRY, /* Trying to get an unavailable lock. */ + TD_CATCHSIG, /* Signal posted to the thread. */ + TD_IDLE, /* Process getting idle. */ + TD_CREATE, /* New thread created. */ + TD_DEATH, /* Thread terminated. */ + TD_PREEMPT, /* Preempted. */ + TD_PRI_INHERIT, /* Inherited elevated priority. */ + TD_REAP, /* Reaped. */ + TD_CONCURRENCY, /* Number of processes changing. */ + TD_TIMEOUT, /* Conditional variable wait timed out. */ + TD_MIN_EVENT_NUM = TD_READY, + TD_MAX_EVENT_NUM = TD_TIMEOUT, + TD_EVENTS_ENABLE = 31 /* Event reporting enabled. */ +} td_event_e; + +/* Values representing the different ways events are reported. */ +typedef enum +{ + NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */ + NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically + inserted. */ + NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */ +} td_notify_e; + +/* Description how event type is reported. */ +typedef struct td_notify +{ + td_notify_e type; /* Way the event is reported. */ + union + { + psaddr_t bptaddr; /* Address of breakpoint. */ + int syscallno; /* Number of system call used. */ + } u; +} td_notify_t; + +/* Structure used to report event. */ +typedef struct td_event_msg +{ + td_event_e event; /* Event type being reported. */ + const td_thrhandle_t *th_p; /* Thread reporting the event. */ + union + { +# if 0 + td_synchandle_t *sh; /* Handle of synchronization object. */ +#endif + uintptr_t data; /* Event specific data. */ + } msg; +} td_event_msg_t; + +/* Structure containing event data available in each thread structure. */ +typedef struct +{ + td_thr_events_t eventmask; /* Mask of enabled events. */ + td_event_e eventnum; /* Number of last event. */ + void *eventdata; /* Data associated with event. */ +} td_eventbuf_t; + + +/* Gathered statistics about the process. */ +typedef struct td_ta_stats +{ + int nthreads; /* Total number of threads in use. */ + int r_concurrency; /* Concurrency level requested by user. */ + int nrunnable_num; /* Average runnable threads, numerator. */ + int nrunnable_den; /* Average runnable threads, denominator. */ + int a_concurrency_num; /* Achieved concurrency level, numerator. */ + int a_concurrency_den; /* Achieved concurrency level, denominator. */ + int nlwps_num; /* Average number of processes in use, + numerator. */ + int nlwps_den; /* Average number of processes in use, + denominator. */ + int nidle_num; /* Average number of idling processes, + numerator. */ + int nidle_den; /* Average number of idling processes, + denominator. */ +} td_ta_stats_t; + + +/* Since Sun's library is based on Solaris threads we have to define a few + types to map them to POSIX threads. */ +typedef pthread_t thread_t; +typedef pthread_key_t thread_key_t; + + +/* Callback for iteration over threads. */ +typedef int td_thr_iter_f (const td_thrhandle_t *, void *); + +/* Callback for iteration over thread local data. */ +typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *); + + + +/* Forward declaration. This has to be defined by the user. */ +struct ps_prochandle; + + +/* Information about the thread. */ +typedef struct td_thrinfo +{ + td_thragent_t *ti_ta_p; /* Process handle. */ + unsigned int ti_user_flags; /* Unused. */ + thread_t ti_tid; /* Thread ID returned by + pthread_create(). */ + char *ti_tls; /* Pointer to thread-local data. */ + psaddr_t ti_startfunc; /* Start function passed to + pthread_create(). */ + psaddr_t ti_stkbase; /* Base of thread's stack. */ + long int ti_stksize; /* Size of thread's stack. */ + psaddr_t ti_ro_area; /* Unused. */ + int ti_ro_size; /* Unused. */ + td_thr_state_e ti_state; /* Thread state. */ + unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */ + td_thr_type_e ti_type; /* Type of the thread (system vs + user thread). */ + intptr_t ti_pc; /* Unused. */ + intptr_t ti_sp; /* Unused. */ + short int ti_flags; /* Unused. */ + int ti_pri; /* Thread priority. */ + lwpid_t ti_lid; /* Unused. */ + sigset_t ti_sigmask; /* Signal mask. */ + unsigned char ti_traceme; /* Nonzero if event reporting + enabled. */ + unsigned char ti_preemptflag; /* Unused. */ + unsigned char ti_pirecflag; /* Unused. */ + sigset_t ti_pending; /* Set of pending signals. */ + td_thr_events_t ti_events; /* Set of enabled events. */ +} td_thrinfo_t; + + + +/* Prototypes for exported library functions. */ + +/* Initialize the thread debug support library. */ +extern td_err_e td_init (void); + +/* Historical relict. Should not be used anymore. */ +extern td_err_e td_log (void); + +/* Return list of symbols the library can request. */ +extern const char **td_symbol_list (void); + +/* Generate new thread debug library handle for process PS. */ +extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta); + +/* Free resources allocated for TA. */ +extern td_err_e td_ta_delete (td_thragent_t *__ta); + +/* Get number of currently running threads in process associated with TA. */ +extern td_err_e td_ta_get_nthreads (const td_thragent_t *__ta, int *__np); + +/* Return process handle passed in `td_ta_new' for process associated with + TA. */ +extern td_err_e td_ta_get_ph (const td_thragent_t *__ta, + struct ps_prochandle **__ph); + +/* Map thread library handle PT to thread debug library handle for process + associated with TA and store result in *TH. */ +extern td_err_e td_ta_map_id2thr (const td_thragent_t *__ta, pthread_t __pt, + td_thrhandle_t *__th); + +/* Map process ID LWPID to thread debug library handle for process + associated with TA and store result in *TH. */ +extern td_err_e td_ta_map_lwp2thr (const td_thragent_t *__ta, lwpid_t __lwpid, + td_thrhandle_t *__th); + + +/* Call for each thread in a process associated with TA the callback function + CALLBACK. */ +extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta, + td_thr_iter_f *__callback, void *__cbdata_p, + td_thr_state_e __state, int __ti_pri, + sigset_t *__ti_sigmask_p, + unsigned int __ti_user_flags); + +/* Call for each defined thread local data entry the callback function KI. */ +extern td_err_e td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki, + void *__p); + + +/* Get event address for EVENT. */ +extern td_err_e td_ta_event_addr (const td_thragent_t *__ta, + td_event_e __event, td_notify_t *__ptr); + +/* Enable EVENT in global mask. */ +extern td_err_e td_ta_set_event (const td_thragent_t *__ta, + td_thr_events_t *__event); + +/* Disable EVENT in global mask. */ +extern td_err_e td_ta_clear_event (const td_thragent_t *__ta, + td_thr_events_t *__event); + +/* Return information about last event. */ +extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta, + td_event_msg_t *msg); + + +/* Set suggested concurrency level for process associated with TA. */ +extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level); + + +/* Enable collecting statistics for process associated with TA. */ +extern td_err_e td_ta_enable_stats (const td_thragent_t *__ta, int __enable); + +/* Reset statistics. */ +extern td_err_e td_ta_reset_stats (const td_thragent_t *__ta); + +/* Retrieve statistics from process associated with TA. */ +extern td_err_e td_ta_get_stats (const td_thragent_t *__ta, + td_ta_stats_t *__statsp); + + +/* Validate that TH is a thread handle. */ +extern td_err_e td_thr_validate (const td_thrhandle_t *__th); + +/* Return information about thread TH. */ +extern td_err_e td_thr_get_info (const td_thrhandle_t *__th, + td_thrinfo_t *__infop); + +/* Retrieve floating-point register contents of process running thread TH. */ +extern td_err_e td_thr_getfpregs (const td_thrhandle_t *__th, + prfpregset_t *__regset); + +/* Retrieve general register contents of process running thread TH. */ +extern td_err_e td_thr_getgregs (const td_thrhandle_t *__th, + prgregset_t __gregs); + +/* Retrieve extended register contents of process running thread TH. */ +extern td_err_e td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs); + +/* Get size of extended register set of process running thread TH. */ +extern td_err_e td_thr_getxregsize (const td_thrhandle_t *__th, int *__sizep); + +/* Set floating-point register contents of process running thread TH. */ +extern td_err_e td_thr_setfpregs (const td_thrhandle_t *__th, + const prfpregset_t *__fpregs); + +/* Set general register contents of process running thread TH. */ +extern td_err_e td_thr_setgregs (const td_thrhandle_t *__th, + prgregset_t __gregs); + +/* Set extended register contents of process running thread TH. */ +extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th, + const void *__addr); + + +/* Enable reporting for EVENT for thread TH. */ +extern td_err_e td_thr_event_enable (const td_thrhandle_t *__th, int __event); + +/* Enable EVENT for thread TH. */ +extern td_err_e td_thr_set_event (const td_thrhandle_t *__th, + td_thr_events_t *__event); + +/* Disable EVENT for thread TH. */ +extern td_err_e td_thr_clear_event (const td_thrhandle_t *__th, + td_thr_events_t *__event); + +/* Get event message for thread TH. */ +extern td_err_e td_thr_event_getmsg (const td_thrhandle_t *__th, + td_event_msg_t *__msg); + + +/* Set priority of thread TH. */ +extern td_err_e td_thr_setprio (const td_thrhandle_t *__th, int __prio); + + +/* Set pending signals for thread TH. */ +extern td_err_e td_thr_setsigpending (const td_thrhandle_t *__th, + unsigned char __n, const sigset_t *__ss); + +/* Set signal mask for thread TH. */ +extern td_err_e td_thr_sigsetmask (const td_thrhandle_t *__th, + const sigset_t *__ss); + + +/* Return thread local data associated with key TK in thread TH. */ +extern td_err_e td_thr_tsd (const td_thrhandle_t *__th, + const thread_key_t __tk, void **__data); + + +/* Suspend execution of thread TH. */ +extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th); + +/* Resume execution of thread TH. */ +extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th); + +#endif /* thread_db.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/thread_dbP.h b/newlib/libc/sys/linux/linuxthreads/thread_dbP.h new file mode 100644 index 000000000..c695fa253 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/thread_dbP.h @@ -0,0 +1,105 @@ +/* Private header for thread debug library. */ +#ifndef _THREAD_DBP_H +#define _THREAD_DBP_H 1 + +#include +#include "proc_service.h" +#include "thread_db.h" +#include "internals.h" + + +/* Indeces for the symbol names. */ +enum + { + PTHREAD_THREADS_EVENTS = 0, + PTHREAD_LAST_EVENT, + PTHREAD_HANDLES_NUM, + PTHREAD_HANDLES, + PTHREAD_KEYS, + LINUXTHREADS_PTHREAD_THREADS_MAX, + LINUXTHREADS_PTHREAD_KEYS_MAX, + LINUXTHREADS_PTHREAD_SIZEOF_DESCR, + LINUXTHREADS_CREATE_EVENT, + LINUXTHREADS_DEATH_EVENT, + LINUXTHREADS_REAP_EVENT, + NUM_MESSAGES + }; + + +/* Comment out the following for less verbose output. */ +#ifndef NDEBUG +# define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n")) +extern int __td_debug; +#else +# define LOG(c) +#endif + + +/* Handle for a process. This type is opaque. */ +struct td_thragent +{ + /* Delivered by the debugger and we have to pass it back in the + proc callbacks. */ + struct ps_prochandle *ph; + + /* Some cached information. */ + + /* Address of the `__pthread_handles' array. */ + struct pthread_handle_struct *handles; + + /* Address of the `pthread_kyes' array. */ + struct pthread_key_struct *keys; + + /* Maximum number of threads. */ + int pthread_threads_max; + + /* Maximum number of thread-local data keys. */ + int pthread_keys_max; + + /* Size of 2nd level array for thread-local data keys. */ + int pthread_key_2ndlevel_size; + + /* Sizeof struct _pthread_descr_struct. */ + int sizeof_descr; + + /* Pointer to the `__pthread_threads_events' variable in the target. */ + psaddr_t pthread_threads_eventsp; + + /* Pointer to the `__pthread_last_event' variable in the target. */ + psaddr_t pthread_last_event; + + /* Pointer to the `__pthread_handles_num' variable. */ + psaddr_t pthread_handles_num; +}; + + +/* Type used internally to keep track of thread agent descriptors. */ +struct agent_list +{ + td_thragent_t *ta; + struct agent_list *next; +}; + +/* List of all known descriptors. */ +extern struct agent_list *__td_agent_list; + +/* Function used to test for correct thread agent pointer. */ +static inline int +ta_ok (const td_thragent_t *ta) +{ + struct agent_list *runp = __td_agent_list; + + if (ta == NULL) + return 0; + + while (runp != NULL && runp->ta != ta) + runp = runp->next; + + return runp != NULL; +} + + +/* Internal wrapper around ps_pglobal_lookup. */ +extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr); + +#endif /* thread_dbP.h */ diff --git a/newlib/libc/sys/linux/linuxthreads/timer_create.c b/newlib/libc/sys/linux/linuxthreads/timer_create.c new file mode 100644 index 000000000..1dccd3036 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/timer_create.c @@ -0,0 +1,179 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kaz Kylheku . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include + +#include "posix-timer.h" + + +/* Create new per-process timer using CLOCK. */ +int +timer_create (clock_id, evp, timerid) + clockid_t clock_id; + struct sigevent *evp; + timer_t *timerid; +{ + int retval = -1; + struct timer_node *newtimer = NULL; + struct thread_node *thread = NULL; + + if (clock_id != CLOCK_REALTIME +#ifdef _POSIX_CPUTIME + && clock_id != CLOCK_PROCESS_CPUTIME_ID +#endif +#ifdef _POSIX_THREAD_CPUTIME + && clock_id != CLOCK_THREAD_CPUTIME_ID +#endif + ) + { + __set_errno (EINVAL); + return -1; + } + + pthread_once (&__timer_init_once_control, __timer_init_once); + + if (__timer_init_failed) + { + __set_errno (ENOMEM); + return -1; + } + + pthread_mutex_lock (&__timer_mutex); + + newtimer = __timer_alloc (); + if (__builtin_expect (newtimer == NULL, 0)) + { + __set_errno (EAGAIN); + goto unlock_bail; + } + + if (evp != NULL) + newtimer->event = *evp; + else + { + newtimer->event.sigev_notify = SIGEV_SIGNAL; + newtimer->event.sigev_signo = SIGALRM; + newtimer->event.sigev_value.sival_int = timer_ptr2id (newtimer); + newtimer->event.sigev_notify_function = 0; + } + + newtimer->event.sigev_notify_attributes = &newtimer->attr; + newtimer->creator_pid = getpid (); + + switch (__builtin_expect (newtimer->event.sigev_notify, SIGEV_SIGNAL)) + { + case SIGEV_NONE: + /* This is a strange choice! */ + break; + + case SIGEV_SIGNAL: + /* We have a global thread for delivering timed signals. + If it is not running, try to start it up. */ + switch (clock_id) + { + case CLOCK_REALTIME: + default: + thread = &__timer_signal_thread_rclk; + break; +#ifdef _POSIX_CPUTIME + case CLOCK_PROCESS_CPUTIME_ID: + thread = &__timer_signal_thread_pclk; + break; +#endif +#ifdef _POSIX_THREAD_CPUTIME + case CLOCK_THREAD_CPUTIME_ID: + thread = &__timer_signal_thread_tclk; + break; +#endif + } + + if (! thread->exists) + { + if (__builtin_expect (__timer_thread_start (thread), + 1) < 0) + { + __set_errno (EAGAIN); + goto unlock_bail; + } + } + break; + + case SIGEV_THREAD: + /* Copy over thread attributes or set up default ones. */ + if (evp->sigev_notify_attributes) + newtimer->attr = *(pthread_attr_t *) evp->sigev_notify_attributes; + else + pthread_attr_init (&newtimer->attr); + + /* Ensure thread attributes call for deatched thread. */ + pthread_attr_setdetachstate (&newtimer->attr, PTHREAD_CREATE_DETACHED); + + /* Try to find existing thread having the right attributes. */ + thread = __timer_thread_find_matching (&newtimer->attr, clock_id); + + /* If no existing thread has these attributes, try to allocate one. */ + if (thread == NULL) + thread = __timer_thread_alloc (&newtimer->attr, clock_id); + + /* Out of luck; no threads are available. */ + if (__builtin_expect (thread == NULL, 0)) + { + __set_errno (EAGAIN); + goto unlock_bail; + } + + /* If the thread is not running already, try to start it. */ + if (! thread->exists + && __builtin_expect (! __timer_thread_start (thread), 0)) + { + __set_errno (EAGAIN); + goto unlock_bail; + } + break; + + default: + __set_errno (EINVAL); + goto unlock_bail; + } + + newtimer->clock = clock_id; + newtimer->abstime = 0; + newtimer->armed = 0; + newtimer->thread = thread; + + *timerid = timer_ptr2id (newtimer); + retval = 0; + + if (__builtin_expect (retval, 0) == -1) + { + unlock_bail: + if (thread != NULL) + __timer_thread_dealloc (thread); + if (newtimer != NULL) + __timer_dealloc (newtimer); + } + + pthread_mutex_unlock (&__timer_mutex); + + return retval; +} diff --git a/newlib/libc/sys/linux/linuxthreads/timer_delete.c b/newlib/libc/sys/linux/linuxthreads/timer_delete.c new file mode 100644 index 000000000..24f4ffed3 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/timer_delete.c @@ -0,0 +1,70 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kaz Kylheku . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +#include "posix-timer.h" + + +/* Delete timer TIMERID. */ +int +timer_delete (timerid) + timer_t timerid; +{ + struct timer_node *timer; + int retval = -1; + + pthread_mutex_lock (&__timer_mutex); + + timer = timer_id2ptr (timerid); + if (! timer_valid (timer)) + /* Invalid timer ID or the timer is not in use. */ + __set_errno (EINVAL); + else + { + if (timer->armed && timer->thread != NULL) + { + struct thread_node *thread = timer->thread; + assert (thread != NULL); + + /* If thread is cancelled while waiting for handler to terminate, + the mutex is unlocked and timer_delete is aborted. */ + pthread_cleanup_push (__timer_mutex_cancel_handler, &__timer_mutex); + + /* If timer is currently being serviced, wait for it to finish. */ + while (thread->current_timer == timer) + pthread_cond_wait (&thread->cond, &__timer_mutex); + + pthread_cleanup_pop (0); + } + + /* Remove timer from whatever queue it may be on and deallocate it. */ + timer->inuse = TIMER_DELETED; + list_unlink_ip (&timer->links); + timer_delref (timer); + retval = 0; + } + + pthread_mutex_unlock (&__timer_mutex); + + return retval; +} diff --git a/newlib/libc/sys/linux/linuxthreads/timer_getoverr.c b/newlib/libc/sys/linux/linuxthreads/timer_getoverr.c new file mode 100644 index 000000000..204addc85 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/timer_getoverr.c @@ -0,0 +1,45 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kaz Kylheku . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "posix-timer.h" + + +/* Get expiration overrun for timer TIMERID. */ +int +timer_getoverrun (timerid) + timer_t timerid; +{ + struct timer_node *timer; + int retval = -1; + + pthread_mutex_lock (&__timer_mutex); + + if (! timer_valid (timer = timer_id2ptr (timerid))) + __set_errno (EINVAL); + else + retval = 0; /* TODO: overrun counting not supported */ + + pthread_mutex_unlock (&__timer_mutex); + + return retval; +} diff --git a/newlib/libc/sys/linux/linuxthreads/timer_gettime.c b/newlib/libc/sys/linux/linuxthreads/timer_gettime.c new file mode 100644 index 000000000..dbee9d915 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/timer_gettime.c @@ -0,0 +1,71 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kaz Kylheku . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "posix-timer.h" + + +/* Get current value of timer TIMERID and store it in VLAUE. */ +int +timer_gettime (timerid, value) + timer_t timerid; + struct itimerspec *value; +{ + struct timer_node *timer; + struct timespec now, expiry; + int retval = -1, armed = 0, valid; + clock_t clock = 0; + + pthread_mutex_lock (&__timer_mutex); + + timer = timer_id2ptr (timerid); + valid = timer_valid (timer); + + if (valid) { + armed = timer->armed; + expiry = timer->expirytime; + clock = timer->clock; + value->it_interval = timer->value.it_interval; + } + + pthread_mutex_unlock (&__timer_mutex); + + if (valid) + { + if (armed) + { + clock_gettime (clock, &now); + timespec_sub (&value->it_value, &expiry, &now); + } + else + { + value->it_value.tv_sec = 0; + value->it_value.tv_nsec = 0; + } + + retval = 0; + } + else + __set_errno (EINVAL); + + return retval; +} diff --git a/newlib/libc/sys/linux/linuxthreads/timer_routines.c b/newlib/libc/sys/linux/linuxthreads/timer_routines.c new file mode 100644 index 000000000..65dc5dca5 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/timer_routines.c @@ -0,0 +1,584 @@ +/* Helper code for POSIX timer implementation on LinuxThreads. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kaz Kylheku . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "posix-timer.h" + + +/* Number of threads used. */ +#define THREAD_MAXNODES 16 + +/* Array containing the descriptors for the used threads. */ +static struct thread_node thread_array[THREAD_MAXNODES]; + +/* Static array with the structures for all the timers. */ +struct timer_node __timer_array[TIMER_MAX]; + +/* Global lock to protect operation on the lists. */ +pthread_mutex_t __timer_mutex = PTHREAD_MUTEX_INITIALIZER; + +/* Variable to protext initialization. */ +pthread_once_t __timer_init_once_control = PTHREAD_ONCE_INIT; + +/* Nonzero if initialization of timer implementation failed. */ +int __timer_init_failed; + +/* Node for the thread used to deliver signals. */ +struct thread_node __timer_signal_thread_rclk; +#ifdef _POSIX_CPUTIME +struct thread_node __timer_signal_thread_pclk; +#endif +#ifdef _POSIX_THREAD_CPUTIME +struct thread_node __timer_signal_thread_tclk; +#endif + +/* Lists to keep free and used timers and threads. */ +struct list_links timer_free_list; +struct list_links thread_free_list; +struct list_links thread_active_list; + + +#ifdef __NR_rt_sigqueueinfo +extern int __syscall_rt_sigqueueinfo (int, int, siginfo_t *); +#endif + + +/* List handling functions. */ +static inline void +list_init (struct list_links *list) +{ + list->next = list->prev = list; +} + +static inline void +list_append (struct list_links *list, struct list_links *newp) +{ + newp->prev = list->prev; + newp->next = list; + list->prev->next = newp; + list->prev = newp; +} + +static inline void +list_insbefore (struct list_links *list, struct list_links *newp) +{ + list_append (list, newp); +} + +/* + * Like list_unlink_ip, except that calling it on a node that + * is already unlinked is disastrous rather than a noop. + */ + +static inline void +list_unlink (struct list_links *list) +{ + struct list_links *lnext = list->next, *lprev = list->prev; + + lnext->prev = lprev; + lprev->next = lnext; +} + +static inline struct list_links * +list_first (struct list_links *list) +{ + return list->next; +} + +static inline struct list_links * +list_null (struct list_links *list) +{ + return list; +} + +static inline struct list_links * +list_next (struct list_links *list) +{ + return list->next; +} + +static inline int +list_isempty (struct list_links *list) +{ + return list->next == list; +} + + +/* Functions build on top of the list functions. */ +static inline struct thread_node * +thread_links2ptr (struct list_links *list) +{ + return (struct thread_node *) ((char *) list + - offsetof (struct thread_node, links)); +} + +static inline struct timer_node * +timer_links2ptr (struct list_links *list) +{ + return (struct timer_node *) ((char *) list + - offsetof (struct timer_node, links)); +} + + +/* Initialize a newly allocated thread structure. */ +static void +thread_init (struct thread_node *thread, const pthread_attr_t *attr, clockid_t clock_id) +{ + if (attr != NULL) + thread->attr = *attr; + else + { + pthread_attr_init (&thread->attr); + pthread_attr_setdetachstate (&thread->attr, PTHREAD_CREATE_DETACHED); + } + + thread->exists = 0; + list_init (&thread->timer_queue); + pthread_cond_init (&thread->cond, 0); + thread->current_timer = 0; + thread->captured = pthread_self (); + thread->clock_id = clock_id; +} + + +/* Initialize the global lists, and acquire global resources. Error + reporting is done by storing a non-zero value to the global variable + timer_init_failed. */ +static void +init_module (void) +{ + int i; + + list_init (&timer_free_list); + list_init (&thread_free_list); + list_init (&thread_active_list); + + for (i = 0; i < TIMER_MAX; ++i) + { + list_append (&timer_free_list, &__timer_array[i].links); + __timer_array[i].inuse = TIMER_FREE; + } + + for (i = 0; i < THREAD_MAXNODES; ++i) + list_append (&thread_free_list, &thread_array[i].links); + + thread_init (&__timer_signal_thread_rclk, 0, CLOCK_REALTIME); +#ifdef _POSIX_CPUTIME + thread_init (&__timer_signal_thread_pclk, 0, CLOCK_PROCESS_CPUTIME_ID); +#endif +#ifdef _POSIX_THREAD_CPUTIME + thread_init (&__timer_signal_thread_tclk, 0, CLOCK_THREAD_CPUTIME_ID); +#endif +} + + +/* This is a handler executed in a child process after a fork() + occurs. It reinitializes the module, resetting all of the data + structures to their initial state. The mutex is initialized in + case it was locked in the parent process. */ +static void +reinit_after_fork (void) +{ + init_module (); + pthread_mutex_init (&__timer_mutex, 0); +} + + +/* Called once form pthread_once in timer_init. This initializes the + module and ensures that reinit_after_fork will be executed in any + child process. */ +void +__timer_init_once (void) +{ + init_module (); +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3 + pthread_atfork (0, 0, reinit_after_fork); +#endif +} + + +/* Deinitialize a thread that is about to be deallocated. */ +static void +thread_deinit (struct thread_node *thread) +{ + assert (list_isempty (&thread->timer_queue)); + pthread_cond_destroy (&thread->cond); +} + + +/* Allocate a thread structure from the global free list. Global + mutex lock must be held by caller. The thread is moved to + the active list. */ +struct thread_node * +__timer_thread_alloc (const pthread_attr_t *desired_attr, clockid_t clock_id) +{ + struct list_links *node = list_first (&thread_free_list); + + if (node != list_null (&thread_free_list)) + { + struct thread_node *thread = thread_links2ptr (node); + list_unlink (node); + thread_init (thread, desired_attr, clock_id); + list_append (&thread_active_list, node); + return thread; + } + + return 0; +} + + +/* Return a thread structure to the global free list. Global lock + must be held by caller. */ +void +__timer_thread_dealloc (struct thread_node *thread) +{ + thread_deinit (thread); + list_unlink (&thread->links); + list_append (&thread_free_list, &thread->links); +} + + +/* Each of our threads which terminates executes this cleanup + handler. We never terminate threads ourselves; if a thread gets here + it means that the evil application has killed it. If the thread has + timers, these require servicing and so we must hire a replacement + thread right away. We must also unblock another thread that may + have been waiting for this thread to finish servicing a timer (see + timer_delete()). */ + +static void +thread_cleanup (void *val) +{ + if (val != NULL) + { + struct thread_node *thread = val; + + /* How did the signal thread get killed? */ + assert (thread != &__timer_signal_thread_rclk); +#ifdef _POSIX_CPUTIME + assert (thread != &__timer_signal_thread_pclk); +#endif +#ifdef _POSIX_THREAD_CPUTIME + assert (thread != &__timer_signal_thread_tclk); +#endif + + pthread_mutex_lock (&__timer_mutex); + + thread->exists = 0; + + /* We are no longer processing a timer event. */ + thread->current_timer = 0; + + if (list_isempty (&thread->timer_queue)) + __timer_thread_dealloc (thread); + else + (void) __timer_thread_start (thread); + + pthread_mutex_unlock (&__timer_mutex); + + /* Unblock potentially blocked timer_delete(). */ + pthread_cond_broadcast (&thread->cond); + } +} + + +/* Handle a timer which is supposed to go off now. */ +static void +thread_expire_timer (struct thread_node *self, struct timer_node *timer) +{ + self->current_timer = timer; /* Lets timer_delete know timer is running. */ + + pthread_mutex_unlock (&__timer_mutex); + + switch (__builtin_expect (timer->event.sigev_notify, SIGEV_SIGNAL)) + { + case SIGEV_NONE: + assert (! "timer_create should never have created such a timer"); + break; + + case SIGEV_SIGNAL: +#ifdef __NR_rt_sigqueueinfo + { + siginfo_t info; + + /* First, clear the siginfo_t structure, so that we don't pass our + stack content to other tasks. */ + memset (&info, 0, sizeof (siginfo_t)); + /* We must pass the information about the data in a siginfo_t + value. */ + info.si_signo = timer->event.sigev_signo; + info.si_code = SI_TIMER; + info.si_pid = timer->creator_pid; + info.si_uid = getuid (); + info.si_value = timer->event.sigev_value; + + INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, info.si_signo, &info); + } +#else + if (pthread_kill (self->captured, timer->event.sigev_signo) != 0) + { + if (pthread_kill (self->id, timer->event.sigev_signo) != 0) + abort (); + } +#endif + break; + + case SIGEV_THREAD: + timer->event.sigev_notify_function (timer->event.sigev_value); + break; + + default: + assert (! "unknown event"); + break; + } + + pthread_mutex_lock (&__timer_mutex); + + self->current_timer = 0; + + pthread_cond_broadcast (&self->cond); +} + + +/* Thread function; executed by each timer thread. The job of this + function is to wait on the thread's timer queue and expire the + timers in chronological order as close to their scheduled time as + possible. */ +static void * +__attribute__ ((noreturn)) +thread_func (void *arg) +{ + struct thread_node *self = arg; + + /* Register cleanup handler, in case rogue application terminates + this thread. (This cannot happen to __timer_signal_thread, which + doesn't invoke application callbacks). */ + + pthread_cleanup_push (thread_cleanup, self); + + pthread_mutex_lock (&__timer_mutex); + + while (1) + { + struct list_links *first; + struct timer_node *timer = NULL; + + /* While the timer queue is not empty, inspect the first node. */ + first = list_first (&self->timer_queue); + if (first != list_null (&self->timer_queue)) + { + struct timespec now; + + timer = timer_links2ptr (first); + + /* This assumes that the elements of the list of one thread + are all for the same clock. */ + clock_gettime (timer->clock, &now); + + while (1) + { + /* If the timer is due or overdue, remove it from the queue. + If it's a periodic timer, re-compute its new time and + requeue it. Either way, perform the timer expiry. */ + if (timespec_compare (&now, &timer->expirytime) < 0) + break; + + list_unlink_ip (first); + + if (__builtin_expect (timer->value.it_interval.tv_sec, 0) != 0 + || timer->value.it_interval.tv_nsec != 0) + { + timespec_add (&timer->expirytime, &now, + &timer->value.it_interval); + __timer_thread_queue_timer (self, timer); + } + + thread_expire_timer (self, timer); + + first = list_first (&self->timer_queue); + if (first == list_null (&self->timer_queue)) + break; + + timer = timer_links2ptr (first); + } + } + + /* If the queue is not empty, wait until the expiry time of the + first node. Otherwise wait indefinitely. Insertions at the + head of the queue must wake up the thread by broadcasting + this condition variable. */ + if (timer != NULL) + pthread_cond_timedwait (&self->cond, &__timer_mutex, + &timer->expirytime); + else + pthread_cond_wait (&self->cond, &__timer_mutex); + } + /* This macro will never be executed since the while loop loops + forever - but we have to add it for proper nesting. */ + pthread_cleanup_pop (1); + +} + + +/* Enqueue a timer in wakeup order in the thread's timer queue. + Returns 1 if the timer was inserted at the head of the queue, + causing the queue's next wakeup time to change. */ + +int +__timer_thread_queue_timer (struct thread_node *thread, + struct timer_node *insert) +{ + struct list_links *iter; + int athead = 1; + + for (iter = list_first (&thread->timer_queue); + iter != list_null (&thread->timer_queue); + iter = list_next (iter)) + { + struct timer_node *timer = timer_links2ptr (iter); + + if (timespec_compare (&insert->expirytime, &timer->expirytime) < 0) + break; + athead = 0; + } + + list_insbefore (iter, &insert->links); + return athead; +} + + +/* Start a thread and associate it with the given thread node. Global + lock must be held by caller. */ +int +__timer_thread_start (struct thread_node *thread) +{ + int retval = 1; + + assert (!thread->exists); + thread->exists = 1; + + if (pthread_create (&thread->id, &thread->attr, thread_func, thread) != 0) + { + thread->exists = 0; + retval = -1; + } + + return retval; +} + + +void +__timer_thread_wakeup (struct thread_node *thread) +{ + pthread_cond_broadcast (&thread->cond); +} + + +/* Compare two pthread_attr_t thread attributes for exact equality. + Returns 1 if they are equal, otherwise zero if they are not equal or + contain illegal values. This version is LinuxThreads-specific for + performance reason. One could use the access functions to get the + values of all the fields of the attribute structure. */ +static int +thread_attr_compare (const pthread_attr_t *left, const pthread_attr_t *right) +{ + return (left->__detachstate == right->__detachstate + && left->__schedpolicy == right->__schedpolicy + && (left->__schedparam.sched_priority + == right->__schedparam.sched_priority) + && left->__inheritsched == right->__inheritsched + && left->__scope == right->__scope); +} + + +/* Search the list of active threads and find one which has matching + attributes. Global mutex lock must be held by caller. */ +struct thread_node * +__timer_thread_find_matching (const pthread_attr_t *desired_attr, + clockid_t desired_clock_id) +{ + struct list_links *iter = list_first (&thread_active_list); + + while (iter != list_null (&thread_active_list)) + { + struct thread_node *candidate = thread_links2ptr (iter); + + if (thread_attr_compare (desired_attr, &candidate->attr) + && desired_clock_id == candidate->clock_id) + { + list_unlink (iter); + return candidate; + } + + iter = list_next (iter); + } + + return NULL; +} + + +/* Grab a free timer structure from the global free list. The global + lock must be held by the caller. */ +struct timer_node * +__timer_alloc (void) +{ + struct list_links *node = list_first (&timer_free_list); + + if (node != list_null (&timer_free_list)) + { + struct timer_node *timer = timer_links2ptr (node); + list_unlink_ip (node); + timer->inuse = TIMER_INUSE; + timer->refcount = 1; + return timer; + } + + return NULL; +} + + +/* Return a timer structure to the global free list. The global lock + must be held by the caller. */ +void +__timer_dealloc (struct timer_node *timer) +{ + assert (timer->refcount == 0); + timer->thread = NULL; /* Break association between timer and thread. */ + timer->inuse = TIMER_FREE; + list_append (&timer_free_list, &timer->links); +} + + +/* Thread cancellation handler which unlocks a mutex. */ +void +__timer_mutex_cancel_handler (void *arg) +{ + pthread_mutex_unlock (arg); +} diff --git a/newlib/libc/sys/linux/linuxthreads/timer_settime.c b/newlib/libc/sys/linux/linuxthreads/timer_settime.c new file mode 100644 index 000000000..2f187fd18 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/timer_settime.c @@ -0,0 +1,137 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kaz Kylheku . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "posix-timer.h" + + +/* Set timer TIMERID to VALUE, returning old value in OVLAUE. */ +int +timer_settime (timerid, flags, value, ovalue) + timer_t timerid; + int flags; + const struct itimerspec *value; + struct itimerspec *ovalue; +{ + struct timer_node *timer; + struct thread_node *thread = NULL; + struct timespec now; + int have_now = 0, need_wakeup = 0; + int retval = -1; + + timer = timer_id2ptr (timerid); + if (timer == NULL) + { + __set_errno (EINVAL); + goto bail; + } + + if (value->it_interval.tv_nsec < 0 + || value->it_interval.tv_nsec >= 1000000000 + || value->it_value.tv_nsec < 0 + || value->it_value.tv_nsec >= 1000000000) + { + __set_errno (EINVAL); + goto bail; + } + + /* Will need to know current time since this is a relative timer; + might as well make the system call outside of the lock now! */ + + if ((flags & TIMER_ABSTIME) == 0) + { + clock_gettime (timer->clock, &now); + have_now = 1; + } + + pthread_mutex_lock (&__timer_mutex); + timer_addref (timer); + + /* One final check of timer validity; this one is possible only + until we have the mutex, because it accesses the inuse flag. */ + + if (! timer_valid(timer)) + { + __set_errno (EINVAL); + goto unlock_bail; + } + + if (ovalue != NULL) + { + ovalue->it_interval = timer->value.it_interval; + + if (timer->armed) + { + if (! have_now) + { + pthread_mutex_unlock (&__timer_mutex); + clock_gettime (timer->clock, &now); + have_now = 1; + pthread_mutex_lock (&__timer_mutex); + timer_addref (timer); + } + + timespec_sub (&ovalue->it_value, &timer->expirytime, &now); + } + else + { + ovalue->it_value.tv_sec = 0; + ovalue->it_value.tv_nsec = 0; + } + } + + timer->value = *value; + + list_unlink_ip (&timer->links); + timer->armed = 0; + + thread = timer->thread; + + /* A value of { 0, 0 } causes the timer to be stopped. */ + if (value->it_value.tv_sec != 0 + || __builtin_expect (value->it_value.tv_nsec != 0, 1)) + { + if ((flags & TIMER_ABSTIME) != 0) + /* The user specified the expiration time. */ + timer->expirytime = value->it_value; + else + timespec_add (&timer->expirytime, &now, &value->it_value); + + /* Only need to wake up the thread if timer is inserted + at the head of the queue. */ + if (thread != NULL) + need_wakeup = __timer_thread_queue_timer (thread, timer); + timer->armed = 1; + } + + retval = 0; + +unlock_bail: + timer_delref (timer); + pthread_mutex_unlock (&__timer_mutex); + +bail: + if (thread != NULL && need_wakeup) + __timer_thread_wakeup (thread); + + return retval; +} diff --git a/newlib/libc/sys/linux/linuxthreads/tst-cancel.c b/newlib/libc/sys/linux/linuxthreads/tst-cancel.c new file mode 100644 index 000000000..da32aaf5e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/tst-cancel.c @@ -0,0 +1,213 @@ +/* Tests for cancelation handling. */ + +#include +#include +#include +#include +#include +#include + +int fd; + +pthread_barrier_t bar; + + +static void +cleanup (void *arg) +{ + int nr = (int) (long int) arg; + char s[30]; + char *cp = stpcpy (s, "cleanup "); + *cp++ = '0' + nr; + *cp++ = '\n'; + __libc_lseek (fd, 0, SEEK_END); + __libc_write (fd, s, cp - s); +} + + +static void * +t1 (void *arg) +{ + pthread_cleanup_push (cleanup, (void *) (long int) 1); + return NULL; + pthread_cleanup_pop (0); +} + + +static void +inner (int a) +{ + pthread_cleanup_push (cleanup, (void *) (long int) a); + if (a) + return; + pthread_cleanup_pop (0); +} + + +static void * +t2 (void *arg) +{ + pthread_cleanup_push (cleanup, (void *) (long int) 2); + inner ((int) (long int) arg); + return NULL; + pthread_cleanup_pop (0); +} + + +/* This does not work yet. */ +volatile int cleanupokcnt; + +static void +cleanupok (void *arg) +{ + ++cleanupokcnt; +} + + +static void * +t3 (void *arg) +{ + pthread_cleanup_push (cleanupok, (void *) (long int) 4); + inner ((int) (long int) arg); + pthread_exit (NULL); + pthread_cleanup_pop (0); +} + + +static void +innerok (int a) +{ + pthread_cleanup_push (cleanupok, (void *) (long int) a); + pthread_exit (NULL); + pthread_cleanup_pop (0); +} + + +static void * +t4 (void *arg) +{ + pthread_cleanup_push (cleanupok, (void *) (long int) 6); + innerok ((int) (long int) arg); + pthread_cleanup_pop (0); + return NULL; +} + + +int +main (int argc, char *argv[]) +{ + pthread_t td; + int err; + char *tmp; + const char *prefix; + const char template[] = "thtstXXXXXX"; + struct stat64 st; + int result = 0; + + prefix = argc > 1 ? argv[1] : ""; + tmp = (char *) alloca (strlen (prefix) + sizeof template); + strcpy (stpcpy (tmp, prefix), template); + + fd = mkstemp (tmp); + if (fd == -1) + { + printf ("cannot create temporary file: %m"); + exit (1); + } + unlink (tmp); + + err = pthread_barrier_init (&bar, NULL, 2); + if (err != 0 ) + { + printf ("cannot create barrier: %s\n", strerror (err)); + exit (1); + } + +#ifdef NOT_YET + err = pthread_create (&td, NULL, t1, NULL); + if (err != 0) + { + printf ("cannot create thread t1: %s\n", strerror (err)); + exit (1); + } + + err = pthread_join (td, NULL); + if (err != 0) + { + printf ("cannot join thread: %s\n", strerror (err)); + exit (1); + } + + err = pthread_create (&td, NULL, t2, (void *) 3); + if (err != 0) + { + printf ("cannot create thread t2: %s\n", strerror (err)); + exit (1); + } + + err = pthread_join (td, NULL); + if (err != 0) + { + printf ("cannot join thread: %s\n", strerror (err)); + exit (1); + } + + err = pthread_create (&td, NULL, t3, (void *) 5); + if (err != 0) + { + printf ("cannot create thread t3: %s\n", strerror (err)); + exit (1); + } + + err = pthread_join (td, NULL); + if (err != 0) + { + printf ("cannot join thread: %s\n", strerror (err)); + exit (1); + } +#endif + + err = pthread_create (&td, NULL, t4, (void *) 7); + if (err != 0) + { + printf ("cannot create thread t3: %s\n", strerror (err)); + exit (1); + } + + err = pthread_join (td, NULL); + if (err != 0) + { + printf ("cannot join thread: %s\n", strerror (err)); + exit (1); + } + + if (fstat64 (fd, &st) < 0) + { + printf ("cannot stat temporary file: %m\n"); + result = 1; + } + else if (st.st_size != 0) + { + char buf[512]; + puts ("some cleanup handlers ran:"); + fflush (stdout); + __lseek (fd, 0, SEEK_SET); + while (1) + { + ssize_t n = read (fd, buf, sizeof buf); + if (n <= 0) + break; + write (STDOUT_FILENO, buf, n); + } + result = 1; + } + + // if (cleanupokcnt != 3) will be three once t3 runs + if (cleanupokcnt != 2) + { + printf ("cleanupokcnt = %d\n", cleanupokcnt); + result = 1; + } + + return result; +} diff --git a/newlib/libc/sys/linux/linuxthreads/tst-context.c b/newlib/libc/sys/linux/linuxthreads/tst-context.c new file mode 100644 index 000000000..9066e837e --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/tst-context.c @@ -0,0 +1,109 @@ +#include +#include +#include +#include +#include +#include + +#include "pt-machine.h" + + +#define N 4 + +#ifdef FLOATING_STACKS +static char stacks[N][8192]; +static ucontext_t ctx[N][2]; +static volatile int failures; + +static void +fct (long int n) +{ + /* Just to use the thread local descriptor. */ + printf ("%ld: in %s now\n", n, __FUNCTION__); + errno = 0; +} + +static void * +threadfct (void *arg) +{ + int n = (int) (long int) arg; + + if (getcontext (&ctx[n][1]) != 0) + { + printf ("%d: cannot get context: %m\n", n); + exit (1); + } + + printf ("%d: %s: before makecontext\n", n, __FUNCTION__); + + ctx[n][1].uc_stack.ss_sp = stacks[n]; + ctx[n][1].uc_stack.ss_size = 8192; + ctx[n][1].uc_link = &ctx[n][0]; + makecontext (&ctx[n][1], (void (*) (void)) fct, 1, (long int) n); + + printf ("%d: %s: before swapcontext\n", n, __FUNCTION__); + + if (swapcontext (&ctx[n][0], &ctx[n][1]) != 0) + { + ++failures; + printf ("%d: %s: swapcontext failed\n", n, __FUNCTION__); + } + else + printf ("%d: back in %s\n", n, __FUNCTION__); + + return NULL; +} +#endif + + +#ifdef FLOATING_STACKS +static volatile int global; +#endif + +int +main (void) +{ +#ifndef FLOATING_STACKS + puts ("not supported"); + return 0; +#else + int n; + pthread_t th[N]; + ucontext_t mctx; + + puts ("making contexts"); + if (getcontext (&mctx) != 0) + { + if (errno == ENOSYS) + { + puts ("context handling not supported"); + exit (0); + } + + printf ("%s: getcontext: %m\n", __FUNCTION__); + exit (1); + } + + /* Play some tricks with this context. */ + if (++global == 1) + if (setcontext (&mctx) != 0) + { + printf ("%s: setcontext: %m\n", __FUNCTION__); + exit (1); + } + if (global != 2) + { + printf ("%s: 'global' not incremented twice\n", __FUNCTION__); + exit (1); + } + + for (n = 0; n < N; ++n) + if (pthread_create (&th[n], NULL, threadfct, (void *) n) != 0) + error (EXIT_FAILURE, errno, "cannot create all threads"); + + for (n = 0; n < N; ++n) + pthread_join (th[n], NULL); + + return failures; +#endif +} diff --git a/newlib/libc/sys/linux/linuxthreads/tststack.c b/newlib/libc/sys/linux/linuxthreads/tststack.c new file mode 100644 index 000000000..6789ff861 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/tststack.c @@ -0,0 +1,72 @@ +/* Tests for variable stack size handling. + Copyright (C) 2000 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +static void *f1 (void *); +static void *f2 (void *); + +int +main (void) +{ + pthread_attr_t attr; + pthread_t th1 = 0; + pthread_t th2 = 0; + void *res1; + void *res2; + + pthread_attr_init (&attr); + if (pthread_attr_setstacksize (&attr, 70*1024) != 0) + { + puts ("invalid stack size"); + return 1; + } + + pthread_create (&th1, NULL, f1, NULL); + pthread_create (&th2, &attr, f2, NULL); + + pthread_join (th1, &res1); + pthread_join (th2, &res2); + + printf ("res1 = %p\n", res1); + printf ("res2 = %p\n", res2); + + return res1 != (void *) 1 || res2 != (void *) 2; +} + +static void * +f1 (void *parm) +{ + printf ("This is `%s'\n", __FUNCTION__); + fflush (stdout); + + return (void *) 1; +} + +static void * +f2 (void *parm) +{ + printf ("This is `%s'\n", __FUNCTION__); + fflush (stdout); + sleep (1); + + return (void *) 2; +} diff --git a/newlib/libc/sys/linux/linuxthreads/unload.c b/newlib/libc/sys/linux/linuxthreads/unload.c new file mode 100644 index 000000000..c528df234 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/unload.c @@ -0,0 +1,45 @@ +/* Tests for non-unloading of libpthread. + Copyright (C) 2000 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +int +main (void) +{ + void *p = dlopen (PREFIX LIBPTHREAD_SO, RTLD_LAZY); + + if (p == NULL) + { + puts ("failed to load " LIBPTHREAD_SO); + exit (1); + } + + if (dlclose (p) != 0) + { + puts ("dlclose (" LIBPTHREAD_SO ") failed"); + exit (1); + } + + puts ("seems to work"); + + exit (0); +} diff --git a/newlib/libc/sys/linux/linuxthreads/weaks.c b/newlib/libc/sys/linux/linuxthreads/weaks.c new file mode 100644 index 000000000..6e2cf4bf1 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/weaks.c @@ -0,0 +1,121 @@ +/* The weak pthread functions for Linux. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include +#include "libc-symbols.h" + +extern int __pthread_return_0 (void); +extern int __pthread_return_1 (void); +extern void __pthread_return_void (void); +extern void weak_function pthread_exit (void *__retval) + __attribute__ ((noreturn)); + +/* Those are pthread functions which return 0 if successful. */ +weak_alias (__pthread_return_0, BP_SYM (__libc_pthread_attr_init_2_1)) +versioned_symbol (libpthread, BP_SYM (__libc_pthread_attr_init_2_1), + BP_SYM (pthread_attr_init), GLIBC_2_1); +#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1) +weak_alias (__pthread_return_0, BP_SYM (__libc_pthread_attr_init_2_0)) +compat_symbol (libpthread, BP_SYM (__libc_pthread_attr_init_2_0), + BP_SYM (pthread_attr_init), GLIBC_2_0); +#endif +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_destroy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_setdetachstate)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_getdetachstate)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_setschedparam)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_getschedparam)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_setschedpolicy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_getschedpolicy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_setinheritsched)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_getinheritsched)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_setscope)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_getscope)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_setstackaddr)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_getstackaddr)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_setstacksize)) +weak_alias (__pthread_return_0, BP_SYM (pthread_attr_getstacksize)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutex_init)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutex_destroy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutex_lock)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutex_trylock)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutex_unlock)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutexattr_init)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutexattr_destroy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutexattr_settype)) +weak_alias (__pthread_return_0, BP_SYM (pthread_mutexattr_gettype)) +weak_alias (__pthread_return_0, BP_SYM (pthread_condattr_init)) +weak_alias (__pthread_return_0, BP_SYM (pthread_condattr_destroy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_setschedparam)) +weak_alias (__pthread_return_0, BP_SYM (pthread_getschedparam)) +weak_alias (__pthread_return_0, BP_SYM (pthread_getcancelstate)) +weak_alias (__pthread_return_0, BP_SYM (pthread_setcancelstate)) +weak_alias (__pthread_return_0, BP_SYM (pthread_setcanceltype)) +weak_alias (__pthread_return_0, pthread_setconcurrency) +weak_alias (__pthread_return_0, pthread_getconcurrency) +weak_alias (__pthread_return_0, pthread_self) +weak_alias (__pthread_return_0, BP_SYM (pthread_cond_init)) +weak_alias (__pthread_return_0, BP_SYM (pthread_cond_destroy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_cond_wait)) +weak_alias (__pthread_return_0, BP_SYM (pthread_cond_timedwait)) +weak_alias (__pthread_return_0, BP_SYM (pthread_cond_signal)) +weak_alias (__pthread_return_0, BP_SYM (pthread_cond_broadcast)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlock_init)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlock_destroy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlock_rdlock)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlock_wrlock)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlock_tryrdlock)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlock_trywrlock)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlock_unlock)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlockattr_init)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlockattr_destroy)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlockattr_setpshared)) +weak_alias (__pthread_return_0, BP_SYM (pthread_rwlockattr_getpshared)) + + +/* Those are pthread functions which return 1 if successful. */ +weak_alias (__pthread_return_1, pthread_equal) + +/* pthread_exit () is a special case. */ +void +weak_function +pthread_exit (void *retval) +{ + exit (EXIT_SUCCESS); +} + +int +__pthread_return_0 (void) +{ + return 0; +} + +int +__pthread_return_1 (void) +{ + return 1; +} + +void +__pthread_return_void (void) +{ +} diff --git a/newlib/libc/sys/linux/linuxthreads/wrapsyscall.c b/newlib/libc/sys/linux/linuxthreads/wrapsyscall.c new file mode 100644 index 000000000..ec1bc2a90 --- /dev/null +++ b/newlib/libc/sys/linux/linuxthreads/wrapsyscall.c @@ -0,0 +1,251 @@ +/* Wrapper arpund system calls to provide cancelation points. + Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "libc-symbols.h" + + +#ifndef SHARED +/* We need a hook to force this file to be linked in when static + libpthread is used. */ +const int __pthread_provide_wrappers = 0; +#endif + +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 +#define ELIX_2_PLUS +#endif + +#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3 +#define ELIX_3_PLUS +#endif + +#define CANCELABLE_SYSCALL(res_type, name, param_list, params) \ +res_type __libc_##name param_list; \ +res_type \ +__attribute__ ((weak)) \ +name param_list \ +{ \ + res_type result; \ + int oldtype; \ + pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); \ + result = __libc_##name params; \ + pthread_setcanceltype (oldtype, NULL); \ + return result; \ +} + +#define CANCELABLE_SYSCALL_VA(res_type, name, param_list, params, last_arg) \ +res_type __libc_##name param_list; \ +res_type \ +__attribute__ ((weak)) \ +name param_list \ +{ \ + res_type result; \ + int oldtype; \ + va_list ap; \ + pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); \ + va_start (ap, last_arg); \ + result = __libc_##name params; \ + va_end (ap); \ + pthread_setcanceltype (oldtype, NULL); \ + return result; \ +} + + +/* close(2). */ +CANCELABLE_SYSCALL (int, close, (int fd), (fd)) +strong_alias (close, __close) + + +/* fcntl(2). */ +CANCELABLE_SYSCALL_VA (int, fcntl, (int fd, int cmd, ...), + (fd, cmd, va_arg (ap, long int)), cmd) +strong_alias (fcntl, __fcntl) + + +/* fsync(2). */ +CANCELABLE_SYSCALL (int, fsync, (int fd), (fd)) + + +/* lseek(2). */ +CANCELABLE_SYSCALL (off_t, lseek, (int fd, off_t offset, int whence), + (fd, offset, whence)) +strong_alias (lseek, __lseek) + + +#ifdef ELIX_2_PLUS +/* lseek64(2). */ +CANCELABLE_SYSCALL (loff_t, lseek64, (int fd, loff_t offset, int whence), + (fd, offset, whence)) +#endif + + +/* msync(2). */ +CANCELABLE_SYSCALL (int, msync, (__ptr_t addr, size_t length, int flags), + (addr, length, flags)) + + +/* nanosleep(2). */ +CANCELABLE_SYSCALL (int, nanosleep, (const struct timespec *requested_time, + struct timespec *remaining), + (requested_time, remaining)) + + +/* open(2). */ +CANCELABLE_SYSCALL_VA (int, open, (const char *pathname, int flags, ...), + (pathname, flags, va_arg (ap, int)), flags) +strong_alias (open, __open) + + +#ifdef ELIX_2_PLUS +/* open64(3). */ +CANCELABLE_SYSCALL_VA (int, open64, (const char *pathname, int flags, ...), + (pathname, flags, va_arg (ap, int)), flags) +strong_alias (open64, __open64) +#endif + + +/* pause(2). */ +CANCELABLE_SYSCALL (int, pause, (void), ()) + + +/* pread(3). */ +CANCELABLE_SYSCALL (ssize_t, pread, (int fd, void *buf, size_t count, + off_t offset), + (fd, buf, count, offset)) + + +#ifdef ELIX_2_PLUS +/* pread64(3). */ +CANCELABLE_SYSCALL (ssize_t, pread64, (int fd, void *buf, size_t count, + loff_t offset), + (fd, buf, count, offset)) +strong_alias (pread64, __pread64) +#endif + + +/* pwrite(3). */ +CANCELABLE_SYSCALL (ssize_t, pwrite, (int fd, const void *buf, size_t n, + off_t offset), + (fd, buf, n, offset)) + + +#ifdef ELIX_2_PLUS +/* pwrite64(3). */ +CANCELABLE_SYSCALL (ssize_t, pwrite64, (int fd, const void *buf, size_t n, + loff_t offset), + (fd, buf, n, offset)) +strong_alias (pwrite64, __pwrite64) +#endif + + +/* read(2). */ +CANCELABLE_SYSCALL (ssize_t, read, (int fd, void *buf, size_t count), + (fd, buf, count)) +strong_alias (read, __read) + + +#ifdef ELIX_3_PLUS +/* system(3). */ +CANCELABLE_SYSCALL (int, system, (const char *line), (line)) +#endif + + +/* tcdrain(2). */ +CANCELABLE_SYSCALL (int, tcdrain, (int fd), (fd)) + + +#ifdef ELIX_3_PLUS +/* wait(2). */ +CANCELABLE_SYSCALL (__pid_t, wait, (int *stat_loc), (stat_loc)) +strong_alias (wait, __wait) +#endif + + +#ifdef ELIX_3_PLUS +/* waitpid(2). */ +CANCELABLE_SYSCALL (__pid_t, waitpid, (__pid_t pid, int *stat_loc, + int options), + (pid, stat_loc, options)) +#endif + +/* for libpthread usage */ +CANCELABLE_SYSCALL (__pid_t, __waitpid, (__pid_t pid, int *stat_loc, + int options), + (pid, stat_loc, options)) + +/* write(2). */ +CANCELABLE_SYSCALL (ssize_t, write, (int fd, const void *buf, size_t n), + (fd, buf, n)) +strong_alias (write, __write) + + +/* The following system calls are thread cancellation points specified + in XNS. */ + +/* accept(2). */ +CANCELABLE_SYSCALL (int, accept, (int fd, __SOCKADDR_ARG addr, + socklen_t *addr_len), + (fd, addr, addr_len)) + +/* connect(2). */ +CANCELABLE_SYSCALL (int, connect, (int fd, __CONST_SOCKADDR_ARG addr, + socklen_t len), + (fd, addr, len)) +strong_alias (connect, __connect) + +/* recv(2). */ +CANCELABLE_SYSCALL (ssize_t, recv, (int fd, __ptr_t buf, size_t n, int flags), + (fd, buf, n, flags)) + +/* recvfrom(2). */ +CANCELABLE_SYSCALL (ssize_t, recvfrom, (int fd, __ptr_t buf, size_t n, int flags, + __SOCKADDR_ARG addr, socklen_t *addr_len), + (fd, buf, n, flags, addr, addr_len)) + +/* recvmsg(2). */ +CANCELABLE_SYSCALL (ssize_t, recvmsg, (int fd, struct msghdr *message, int flags), + (fd, message, flags)) + +/* send(2). */ +CANCELABLE_SYSCALL (ssize_t, send, (int fd, const __ptr_t buf, size_t n, + int flags), + (fd, buf, n, flags)) +strong_alias (send, __send) + +/* sendmsg(2). */ +CANCELABLE_SYSCALL (ssize_t, sendmsg, (int fd, const struct msghdr *message, + int flags), + (fd, message, flags)) + +/* sendto(2). */ +CANCELABLE_SYSCALL (ssize_t, sendto, (int fd, const __ptr_t buf, size_t n, + int flags, __CONST_SOCKADDR_ARG addr, + socklen_t addr_len), + (fd, buf, n, flags, addr, addr_len)) diff --git a/newlib/libc/sys/linux/machine/i386/dl-machine.h b/newlib/libc/sys/linux/machine/i386/dl-machine.h new file mode 100644 index 000000000..032713e5b --- /dev/null +++ b/newlib/libc/sys/linux/machine/i386/dl-machine.h @@ -0,0 +1,403 @@ +/* Machine-dependent ELF dynamic relocation inline functions. i386 version. + Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef dl_machine_h +#define dl_machine_h + +#define ELF_MACHINE_NAME "i386" + +#include +#include + +/* Return nonzero iff ELF header is compatible with the running host. */ +static inline int __attribute__ ((unused)) +elf_machine_matches_host (const Elf32_Ehdr *ehdr) +{ + return ehdr->e_machine == EM_386; +} + + +/* Return the link-time address of _DYNAMIC. Conveniently, this is the + first element of the GOT. This must be inlined in a function which + uses global data. */ +static inline Elf32_Addr __attribute__ ((unused)) +elf_machine_dynamic (void) +{ + register Elf32_Addr *got asm ("%ebx"); + return *got; +} + + +/* Return the run-time load address of the shared object. */ +static inline Elf32_Addr __attribute__ ((unused)) +elf_machine_load_address (void) +{ + Elf32_Addr addr; + asm ("leal _dl_start@GOTOFF(%%ebx), %0\n" + "subl _dl_start@GOT(%%ebx), %0" + : "=r" (addr) : : "cc"); + return addr; +} + +#if !defined PROF && !__BOUNDED_POINTERS__ +/* We add a declaration of this function here so that in dl-runtime.c + the ELF_MACHINE_RUNTIME_TRAMPOLINE macro really can pass the parameters + in registers. + + We cannot use this scheme for profiling because the _mcount call + destroys the passed register information. */ +/* GKM FIXME: Fix trampoline to pass bounds so we can do + without the `__unbounded' qualifier. */ +static ElfW(Addr) fixup (struct link_map *__unbounded l, ElfW(Word) reloc_offset) + __attribute__ ((regparm (2), unused)); +static ElfW(Addr) profile_fixup (struct link_map *l, ElfW(Word) reloc_offset, + ElfW(Addr) retaddr) + __attribute__ ((regparm (3), unused)); +#endif + +/* Set up the loaded object described by L so its unrelocated PLT + entries will jump to the on-demand fixup code in dl-runtime.c. */ + +static inline int __attribute__ ((unused)) +elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +{ + Elf32_Addr *got; + extern void _dl_runtime_resolve (Elf32_Word); + extern void _dl_runtime_profile (Elf32_Word); + + if (l->l_info[DT_JMPREL] && lazy) + { + /* The GOT entries for functions in the PLT have not yet been filled + in. Their initial contents will arrange when called to push an + offset into the .rel.plt section, push _GLOBAL_OFFSET_TABLE_[1], + and then jump to _GLOBAL_OFFSET_TABLE[2]. */ + got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]); + got[1] = (Elf32_Addr) l; /* Identify this shared object. */ + + /* The got[2] entry contains the address of a function which gets + called to get the address of a so far unresolved function and + jump to it. The profiling extension of the dynamic linker allows + to intercept the calls to collect information. In this case we + don't store the address in the GOT so that all future calls also + end in this function. */ + if (__builtin_expect (profile, 0)) + { + got[2] = (Elf32_Addr) &_dl_runtime_profile; + + if (_dl_name_match_p (_dl_profile, l)) + /* This is the object we are looking for. Say that we really + want profiling and the timers are started. */ + _dl_profile_map = l; + } + else + /* This function will get called to fix up the GOT entry indicated by + the offset on the stack, and then jump to the resolved address. */ + got[2] = (Elf32_Addr) &_dl_runtime_resolve; + } + + return lazy; +} + +/* This code is used in dl-runtime.c to call the `fixup' function + and then redirect to the address it returns. */ +#if !defined PROF && !__BOUNDED_POINTERS__ +# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ + .text\n\ + .globl _dl_runtime_resolve\n\ + .type _dl_runtime_resolve, @function\n\ + .align 16\n\ +_dl_runtime_resolve:\n\ + pushl %eax # Preserve registers otherwise clobbered.\n\ + pushl %ecx\n\ + pushl %edx\n\ + movl 16(%esp), %edx # Copy args pushed by PLT in register. Note\n\ + movl 12(%esp), %eax # that `fixup' takes its parameters in regs.\n\ + call fixup # Call resolver.\n\ + popl %edx # Get register content back.\n\ + popl %ecx\n\ + xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ + ret $8 # Jump to function address.\n\ + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ +\n\ + .globl _dl_runtime_profile\n\ + .type _dl_runtime_profile, @function\n\ + .align 16\n\ +_dl_runtime_profile:\n\ + pushl %eax # Preserve registers otherwise clobbered.\n\ + pushl %ecx\n\ + pushl %edx\n\ + movl 20(%esp), %ecx # Load return address\n\ + movl 16(%esp), %edx # Copy args pushed by PLT in register. Note\n\ + movl 12(%esp), %eax # that `fixup' takes its parameters in regs.\n\ + call profile_fixup # Call resolver.\n\ + popl %edx # Get register content back.\n\ + popl %ecx\n\ + xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ + ret $8 # Jump to function address.\n\ + .size _dl_runtime_profile, .-_dl_runtime_profile\n\ + .previous\n\ +"); +#else +# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\ + .text\n\ + .globl _dl_runtime_resolve\n\ + .globl _dl_runtime_profile\n\ + .type _dl_runtime_resolve, @function\n\ + .type _dl_runtime_profile, @function\n\ + .align 16\n\ +_dl_runtime_resolve:\n\ +_dl_runtime_profile:\n\ + pushl %eax # Preserve registers otherwise clobbered.\n\ + pushl %ecx\n\ + pushl %edx\n\ + movl 16(%esp), %edx # Push the arguments for `fixup'\n\ + movl 12(%esp), %eax\n\ + pushl %edx\n\ + pushl %eax\n\ + call fixup # Call resolver.\n\ + popl %edx # Pop the parameters\n\ + popl %ecx\n\ + popl %edx # Get register content back.\n\ + popl %ecx\n\ + xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ + ret $8 # Jump to function address.\n\ + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ + .size _dl_runtime_profile, .-_dl_runtime_profile\n\ + .previous\n\ +"); +#endif + +/* Mask identifying addresses reserved for the user program, + where the dynamic linker should not map anything. */ +#define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL + +/* Initial entry point code for the dynamic linker. + The C function `_dl_start' is the real entry point; + its return value is the user program's entry point. */ + +#define RTLD_START asm ("\n\ + .text\n\ + .align 16\n\ +0: movl (%esp), %ebx\n\ + ret\n\ + .align 16\n\ +.globl _start\n\ +.globl _dl_start_user\n\ +_start:\n\ + pushl %esp\n\ + call _dl_start\n\ + popl %ebx\n\ +_dl_start_user:\n\ + # Save the user entry point address in %edi.\n\ + movl %eax, %edi\n\ + # Point %ebx at the GOT.\n\ + call 0b\n\ + addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\ + # Store the highest stack address\n\ + movl __libc_stack_end@GOT(%ebx), %eax\n\ + movl %esp, (%eax)\n\ + # See if we were run as a command with the executable file\n\ + # name as an extra leading argument.\n\ + movl _dl_skip_args@GOT(%ebx), %eax\n\ + movl (%eax), %eax\n\ + # Pop the original argument count.\n\ + popl %edx\n\ + # Adjust the stack pointer to skip _dl_skip_args words.\n\ + leal (%esp,%eax,4), %esp\n\ + # Subtract _dl_skip_args from argc.\n\ + subl %eax, %edx\n\ + # Push argc back on the stack.\n\ + push %edx\n\ + # The special initializer gets called with the stack just\n\ + # as the application's entry point will see it; it can\n\ + # switch stacks if it moves these contents over.\n\ +" RTLD_START_SPECIAL_INIT "\n\ + # Load the parameters again.\n\ + # (eax, edx, ecx, *--esp) = (_dl_loaded, argc, argv, envp)\n\ + movl _dl_loaded@GOT(%ebx), %esi\n\ + leal 8(%esp,%edx,4), %eax\n\ + leal 4(%esp), %ecx\n\ + pushl %eax\n\ + movl (%esi), %eax\n\ + # Call the function to run the initializers.\n\ + call _dl_init@PLT\n\ + # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ + movl _dl_fini@GOT(%ebx), %edx\n\ + # Jump to the user's entry point.\n\ + jmp *%edi\n\ + .previous\n\ +"); + +#ifndef RTLD_START_SPECIAL_INIT +#define RTLD_START_SPECIAL_INIT /* nothing */ +#endif + +/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so + PLT entries should not be allowed to define the value. + ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one + of the main executable's symbols, as for a COPY reloc. */ +#define elf_machine_type_class(type) \ + ((((type) == R_386_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \ + | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY)) + +/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ +#define ELF_MACHINE_JMP_SLOT R_386_JMP_SLOT + +/* The i386 never uses Elf32_Rela relocations. */ +#define ELF_MACHINE_NO_RELA 1 + +/* We define an initialization functions. This is called very early in + _dl_sysdep_start. */ +#define DL_PLATFORM_INIT dl_platform_init () + +extern const char *_dl_platform; + +static inline void __attribute__ ((unused)) +dl_platform_init (void) +{ + if (_dl_platform != NULL && *_dl_platform == '\0') + /* Avoid an empty string which would disturb us. */ + _dl_platform = NULL; +} + +static inline Elf32_Addr +elf_machine_fixup_plt (struct link_map *map, lookup_t t, + const Elf32_Rel *reloc, + Elf32_Addr *reloc_addr, Elf32_Addr value) +{ + return *reloc_addr = value; +} + +/* Return the final value of a plt relocation. */ +static inline Elf32_Addr +elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc, + Elf32_Addr value) +{ + return value; +} + +#endif /* !dl_machine_h */ + +#ifdef RESOLVE + +/* Perform the relocation specified by RELOC and SYM (which is fully resolved). + MAP is the object containing the reloc. */ + +static inline void +elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, + const Elf32_Sym *sym, const struct r_found_version *version, + Elf32_Addr *const reloc_addr) +{ + const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); + +#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC + if (__builtin_expect (r_type == R_386_RELATIVE, 0)) + { +# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC + /* This is defined in rtld.c, but nowhere in the static libc.a; + make the reference weak so static programs can still link. + This declaration cannot be done when compiling rtld.c + (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the + common defn for _dl_rtld_map, which is incompatible with a + weak decl in the same file. */ + weak_extern (_dl_rtld_map); + if (map != &_dl_rtld_map) /* Already done in rtld itself. */ +# endif + *reloc_addr += map->l_addr; + } +# ifndef RTLD_BOOTSTRAP + else if (__builtin_expect (r_type == R_386_NONE, 0)) + return; +# endif + else +#endif + { +#ifndef RTLD_BOOTSTRAP + const Elf32_Sym *const refsym = sym; +#endif + Elf32_Addr value = RESOLVE (&sym, version, r_type); + if (sym) + value += sym->st_value; + +#ifdef RTLD_BOOTSTRAP + assert (r_type == R_386_GLOB_DAT || r_type == R_386_JMP_SLOT); + *reloc_addr = value; +#else + switch (r_type) + { + case R_386_GLOB_DAT: + case R_386_JMP_SLOT: + *reloc_addr = value; + break; + case R_386_32: + *reloc_addr += value; + break; + case R_386_PC32: + *reloc_addr += (value - (Elf32_Addr) reloc_addr); + break; + case R_386_COPY: + if (sym == NULL) + /* This can happen in trace mode if an object could not be + found. */ + break; + if (__builtin_expect (sym->st_size > refsym->st_size, 0) + || (__builtin_expect (sym->st_size < refsym->st_size, 0) + && _dl_verbose)) + { + const char *strtab; + + strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]); + _dl_error_printf ("\ +%s: Symbol `%s' has different size in shared object, consider re-linking\n", + _dl_argv[0] ?: "", + strtab + refsym->st_name); + } + memcpy (reloc_addr, (void *) value, MIN (sym->st_size, + refsym->st_size)); + break; + default: + _dl_reloc_bad_type (map, r_type, 0); + break; + } +#endif + } +} + +static inline void +elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, + Elf32_Addr *const reloc_addr) +{ + assert (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE); + *reloc_addr += l_addr; +} + +static inline void +elf_machine_lazy_rel (struct link_map *map, + Elf32_Addr l_addr, const Elf32_Rel *reloc) +{ + Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); + const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); + /* Check for unexpected PLT reloc type. */ + if (__builtin_expect (r_type == R_386_JMP_SLOT, 1)) + *reloc_addr += l_addr; + else + _dl_reloc_bad_type (map, r_type, 1); +} + +#endif /* RESOLVE */ diff --git a/newlib/libc/sys/linux/net/Makefile.am b/newlib/libc/sys/linux/net/Makefile.am new file mode 100644 index 000000000..3298d2d9f --- /dev/null +++ b/newlib/libc/sys/linux/net/Makefile.am @@ -0,0 +1,89 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +LIB_SOURCES = addr2ascii.c ascii2addr.c base64.c bindresvport.c ether_addr.c getaddrinfo.c \ + gethostbydns.c gethostbyht.c gethostbynis.c gethostnamadr.c \ + getifaddrs.c getnameinfo.c \ + getnetbydns.c getnetbyht.c getnetbynis.c getnetnamadr.c \ + getproto.c getprotoent.c getprotoname.c getservbyname.c \ + getservbyport.c getservent.c herror.c hesiod.c inet_addr.c \ + ifname.c inet_lnaof.c \ + inet_makeaddr.c inet_net_ntop.c inet_net_pton.c inet_neta.c \ + inet_netof.c inet_network.c inet_ntoa.c inet_ntop.c \ + inet_pton.c innetgr-stub.c ip6opt.c issetugid-stub.c \ + linkaddr.c map_v4v6.c namespace.h un-namespace.h \ + name6.c ns_addr.c \ + ns_name.c ns_netint.c \ + ns_ntoa.c ns_parse.c ns_print.c ns_ttl.c \ + nsdispatch.c nslexer.c nsparser.c nsparser.h \ + nsap_addr.c res_comp.c res_data.c res_debug.c \ + res_init.c res_mkquery.c res_mkupdate.c res_query.c \ + res_send.c res_update.c rthdr.c vars.c + +ELIX_4_OBJS = \ + rcmd.$(oext) \ + rcmdsh.$(oext) + +if ELIX_LEVEL_1 +LIB_OBJS = +else +if ELIX_LEVEL_2 +LIB_OBJS = +else +if ELIX_LEVEL_3 +LIB_OBJS = +else +LIB_OBJS = $(ELIX_4_OBJS) +endif +endif +endif + +libnet_la_LDFLAGS = -Xcompiler -nostdlib +libnet_la_CFLAGS = -DINET6 + +if USE_LIBTOOL +noinst_LTLIBRARIES = libnet.la +libnet_la_SOURCES = $(LIB_SOURCES) +libnet_la_LIBADD = $(LIB_OBJS) +libnet_la_DEPENDENCIES = $(LIB_OBJS) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(LIB_SOURCES) +lib_a_LIBADD = $(LIB_OBJS) +lib_a_DEPENDENCIES = $(LIB_OBJS) +noinst_DATA = +endif # USE_LIBTOOL + +include $(srcdir)/../../../../Makefile.shared + +install-data-local: + $(start-sanitize-elix) \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \ + for i in $(srcdir)/../include/arpa/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/net; \ + for i in $(srcdir)/../include/net/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/net/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \ + for i in $(srcdir)/../include/netinet/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet6; \ + for i in $(srcdir)/../include/netinet6/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet6/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netns; \ + for i in $(srcdir)/../include/netns/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netns/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/rpc; \ + for i in $(srcdir)/../include/rpc/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \ + done; \ + $(end-sanitize-elix) diff --git a/newlib/libc/sys/linux/net/Makefile.in b/newlib/libc/sys/linux/net/Makefile.in new file mode 100644 index 000000000..70f835c4a --- /dev/null +++ b/newlib/libc/sys/linux/net/Makefile.in @@ -0,0 +1,466 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LINUX_MACH_LIB = @LINUX_MACH_LIB@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +aext = @aext@ +libm_machine_dir = @libm_machine_dir@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +LIB_SOURCES = addr2ascii.c ascii2addr.c base64.c bindresvport.c ether_addr.c getaddrinfo.c \ + gethostbydns.c gethostbyht.c gethostbynis.c gethostnamadr.c \ + getifaddrs.c getnameinfo.c \ + getnetbydns.c getnetbyht.c getnetbynis.c getnetnamadr.c \ + getproto.c getprotoent.c getprotoname.c getservbyname.c \ + getservbyport.c getservent.c herror.c hesiod.c inet_addr.c \ + ifname.c inet_lnaof.c \ + inet_makeaddr.c inet_net_ntop.c inet_net_pton.c inet_neta.c \ + inet_netof.c inet_network.c inet_ntoa.c inet_ntop.c \ + inet_pton.c innetgr-stub.c ip6opt.c issetugid-stub.c \ + linkaddr.c map_v4v6.c namespace.h un-namespace.h \ + name6.c ns_addr.c \ + ns_name.c ns_netint.c \ + ns_ntoa.c ns_parse.c ns_print.c ns_ttl.c \ + nsdispatch.c nslexer.c nsparser.c nsparser.h \ + nsap_addr.c res_comp.c res_data.c res_debug.c \ + res_init.c res_mkquery.c res_mkupdate.c res_query.c \ + res_send.c res_update.c rthdr.c vars.c + + +ELIX_4_OBJS = \ + rcmd.$(oext) \ + rcmdsh.$(oext) + +@ELIX_LEVEL_1_TRUE@LIB_OBJS = +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@LIB_OBJS = +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@LIB_OBJS = +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@LIB_OBJS = @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@$(ELIX_4_OBJS) + +libnet_la_LDFLAGS = -Xcompiler -nostdlib +libnet_la_CFLAGS = -DINET6 + +@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libnet.la +@USE_LIBTOOL_TRUE@libnet_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) +@USE_LIBTOOL_TRUE@libnet_la_LIBADD = @USE_LIBTOOL_TRUE@$(LIB_OBJS) +@USE_LIBTOOL_TRUE@libnet_la_DEPENDENCIES = @USE_LIBTOOL_TRUE@$(LIB_OBJS) +@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in +@USE_LIBTOOL_FALSE@noinst_DATA = +@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a +@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) +@USE_LIBTOOL_FALSE@lib_a_LIBADD = @USE_LIBTOOL_FALSE@$(LIB_OBJS) +@USE_LIBTOOL_FALSE@lib_a_DEPENDENCIES = @USE_LIBTOOL_FALSE@$(LIB_OBJS) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +@USE_LIBTOOL_FALSE@lib_a_OBJECTS = addr2ascii.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ascii2addr.$(OBJEXT) base64.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@bindresvport.$(OBJEXT) ether_addr.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getaddrinfo.$(OBJEXT) gethostbydns.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@gethostbyht.$(OBJEXT) gethostbynis.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@gethostnamadr.$(OBJEXT) getifaddrs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getnameinfo.$(OBJEXT) getnetbydns.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getnetbyht.$(OBJEXT) getnetbynis.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getnetnamadr.$(OBJEXT) getproto.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getprotoent.$(OBJEXT) getprotoname.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getservbyname.$(OBJEXT) getservbyport.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getservent.$(OBJEXT) herror.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@hesiod.$(OBJEXT) inet_addr.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ifname.$(OBJEXT) inet_lnaof.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@inet_makeaddr.$(OBJEXT) inet_net_ntop.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@inet_net_pton.$(OBJEXT) inet_neta.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@inet_netof.$(OBJEXT) inet_network.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@inet_ntoa.$(OBJEXT) inet_ntop.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@inet_pton.$(OBJEXT) innetgr-stub.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ip6opt.$(OBJEXT) issetugid-stub.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@linkaddr.$(OBJEXT) map_v4v6.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@name6.$(OBJEXT) ns_addr.$(OBJEXT) ns_name.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ns_netint.$(OBJEXT) ns_ntoa.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ns_parse.$(OBJEXT) ns_print.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ns_ttl.$(OBJEXT) nsdispatch.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@nslexer.$(OBJEXT) nsparser.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@nsap_addr.$(OBJEXT) res_comp.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@res_data.$(OBJEXT) res_debug.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@res_init.$(OBJEXT) res_mkquery.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@res_mkupdate.$(OBJEXT) res_query.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@res_send.$(OBJEXT) res_update.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@rthdr.$(OBJEXT) vars.$(OBJEXT) +LTLIBRARIES = $(noinst_LTLIBRARIES) + +@USE_LIBTOOL_TRUE@libnet_la_OBJECTS = addr2ascii.lo ascii2addr.lo \ +@USE_LIBTOOL_TRUE@base64.lo bindresvport.lo ether_addr.lo \ +@USE_LIBTOOL_TRUE@getaddrinfo.lo gethostbydns.lo gethostbyht.lo \ +@USE_LIBTOOL_TRUE@gethostbynis.lo gethostnamadr.lo getifaddrs.lo \ +@USE_LIBTOOL_TRUE@getnameinfo.lo getnetbydns.lo getnetbyht.lo \ +@USE_LIBTOOL_TRUE@getnetbynis.lo getnetnamadr.lo getproto.lo \ +@USE_LIBTOOL_TRUE@getprotoent.lo getprotoname.lo getservbyname.lo \ +@USE_LIBTOOL_TRUE@getservbyport.lo getservent.lo herror.lo hesiod.lo \ +@USE_LIBTOOL_TRUE@inet_addr.lo ifname.lo inet_lnaof.lo inet_makeaddr.lo \ +@USE_LIBTOOL_TRUE@inet_net_ntop.lo inet_net_pton.lo inet_neta.lo \ +@USE_LIBTOOL_TRUE@inet_netof.lo inet_network.lo inet_ntoa.lo \ +@USE_LIBTOOL_TRUE@inet_ntop.lo inet_pton.lo innetgr-stub.lo ip6opt.lo \ +@USE_LIBTOOL_TRUE@issetugid-stub.lo linkaddr.lo map_v4v6.lo name6.lo \ +@USE_LIBTOOL_TRUE@ns_addr.lo ns_name.lo ns_netint.lo ns_ntoa.lo \ +@USE_LIBTOOL_TRUE@ns_parse.lo ns_print.lo ns_ttl.lo nsdispatch.lo \ +@USE_LIBTOOL_TRUE@nslexer.lo nsparser.lo nsap_addr.lo res_comp.lo \ +@USE_LIBTOOL_TRUE@res_data.lo res_debug.lo res_init.lo res_mkquery.lo \ +@USE_LIBTOOL_TRUE@res_mkupdate.lo res_query.lo res_send.lo \ +@USE_LIBTOOL_TRUE@res_update.lo rthdr.lo vars.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(noinst_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(lib_a_SOURCES) $(libnet_la_SOURCES) +OBJECTS = $(lib_a_OBJECTS) $(libnet_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../Makefile.shared + cd $(top_srcdir) && $(AUTOMAKE) --cygnus net/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) + -rm -f lib.a + $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +mostlyclean-noinstLTLIBRARIES: + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + +distclean-noinstLTLIBRARIES: + +maintainer-clean-noinstLTLIBRARIES: + +libnet.la: $(libnet_la_OBJECTS) $(libnet_la_DEPENDENCIES) + $(LINK) $(libnet_la_LDFLAGS) $(libnet_la_OBJECTS) $(libnet_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = net + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: install-data-local +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ + clean-noinstLTLIBRARIES clean-tags clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstLIBRARIES distclean-compile \ + distclean-libtool distclean-noinstLTLIBRARIES \ + distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-noinstLTLIBRARIES \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ +distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ +maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-info-am install-info \ +install-exec-am install-exec install-data-local install-data-am \ +install-data install-am install uninstall-am uninstall all-redirect \ +all-am all installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean + + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done + +install-data-local: + $(start-sanitize-elix) \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \ + for i in $(srcdir)/../include/arpa/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/net; \ + for i in $(srcdir)/../include/net/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/net/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \ + for i in $(srcdir)/../include/netinet/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet6; \ + for i in $(srcdir)/../include/netinet6/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet6/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netns; \ + for i in $(srcdir)/../include/netns/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netns/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/rpc; \ + for i in $(srcdir)/../include/rpc/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \ + done; \ + $(end-sanitize-elix) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/libc/sys/linux/net/addr2ascii.3 b/newlib/libc/sys/linux/net/addr2ascii.3 new file mode 100644 index 000000000..10b1ac7f9 --- /dev/null +++ b/newlib/libc/sys/linux/net/addr2ascii.3 @@ -0,0 +1,222 @@ +.\" +.\" Copyright 1996 Massachusetts Institute of Technology +.\" +.\" Permission to use, copy, modify, and distribute this software and +.\" its documentation for any purpose and without fee is hereby +.\" granted, provided that both the above copyright notice and this +.\" permission notice appear in all copies, that both the above +.\" copyright notice and this permission notice appear in all +.\" supporting documentation, and that the name of M.I.T. not be used +.\" in advertising or publicity pertaining to distribution of the +.\" software without specific, written prior permission. M.I.T. makes +.\" no representations about the suitability of this software for any +.\" purpose. It is provided "as is" without express or implied +.\" warranty. +.\" +.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS +.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, +.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT +.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $ANA: addr2ascii.3,v 1.1 1996/06/13 18:41:46 wollman Exp $ +.\" $FreeBSD: src/lib/libc/net/addr2ascii.3,v 1.12 2001/10/01 16:08:55 ru Exp $ +.\" +.Dd June 13, 1996 +.Dt ADDR2ASCII 3 +.Os +.Sh NAME +.Nm addr2ascii , +.Nm ascii2addr +.Nd Generic address formatting routines +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In netinet/in.h +.In arpa/inet.h +.Ft "char *" +.Fn addr2ascii "int af" "const void *addrp" "int len" "char *buf" +.Ft int +.Fn ascii2addr "int af" "const char *ascii" "void *result" +.Sh DESCRIPTION +The routines +.Fn addr2ascii +and +.Fn ascii2addr +are used to convert network addresses between binary form and a +printable form appropriate to the address family. Both functions take +an +.Fa af +argument, specifying the address family to be used in the conversion +process. +(Currently, only the +.Dv AF_INET +and +.Dv AF_LINK +address families are supported.) +.Pp +The +.Fn addr2ascii +function +is used to convert binary, network-format addresses into printable +form. In addition to +.Fa af , +there are three other arguments. The +.Fa addrp +argument is a pointer to the network address to be converted. +The +.Fa len +argument is the length of the address. The +.Fa buf +argument is an optional pointer to a caller-allocated buffer to hold +the result; if a null pointer is passed, +.Fn addr2ascii +uses a statically-allocated buffer. +.Pp +The +.Fn ascii2addr +function performs the inverse operation to +.Fn addr2ascii . +In addition to +.Fa af , +it takes two parameters, +.Fa ascii +and +.Fa result . +The +.Fa ascii +parameter is a pointer to the string which is to be converted into +binary. The +.Fa result +parameter is a pointer to an appropriate network address structure for +the specified family. +.Pp +The following gives the appropriate structure to use for binary +addresses in the specified family: +.Pp +.Bl -tag -width AF_INETxxxx -compact +.It Dv AF_INET +.Li struct in_addr +(in +.Aq Pa netinet/in.h ) +.It Dv AF_LINK +.Li struct sockaddr_dl +(in +.Aq Pa net/if_dl.h ) +.\" .It Dv AF_INET6 +.\" .Li struct in6_addr +.\" (in +.\" .Aq Pa netinet6/in6.h ) +.El +.Sh RETURN VALUES +The +.Fn addr2ascii +function returns the address of the buffer it was passed, or a static +buffer if the a null pointer was passed; on failure, it returns a null +pointer. +The +.Fn ascii2addr +function returns the length of the binary address in bytes, or -1 on +failure. +.Sh EXAMPLES +The +.Xr inet 3 +functions +.Fn inet_ntoa +and +.Fn inet_aton +could be implemented thusly: +.Bd -literal -offset indent +#include +#include +#include +#include + +char * +inet_ntoa(struct in_addr addr) +{ + return addr2ascii(AF_INET, &addr, sizeof addr, 0); +} + +int +inet_aton(const char *ascii, struct in_addr *addr) +{ + return (ascii2addr(AF_INET, ascii, addr) + == sizeof(*addr)); +} +.Ed +.Pp +In actuality, this cannot be done because +.Fn addr2ascii +and +.Fn ascii2addr +are implemented in terms of the +.Xr inet 3 +functions, rather than the other way around. +.Sh ERRORS +When a failure is returned, +.Li errno +is set to one of the following values: +.Bl -tag -width Er +.It Bq Er ENAMETOOLONG +The +.Fn addr2ascii +routine was passed a +.Fa len +parameter which was inappropriate for the address family given by +.Fa af . +.It Bq Er EPROTONOSUPPORT +Either routine was passed an +.Fa af +parameter other than +.Dv AF_INET +or +.Dv AF_LINK . +.It Bq Er EINVAL +The string passed to +.Fn ascii2addr +was improperly formatted for address family +.Fa af . +.El +.Sh SEE ALSO +.Xr inet 3 , +.Xr linkaddr 3 , +.Xr inet 4 +.Sh HISTORY +An interface close to this one was originally suggested by Craig +Partridge. This particular interface originally appeared in the +.Tn INRIA +.Tn IPv6 +implementation. +.Sh AUTHORS +Code and documentation by +.An Garrett A. Wollman , +MIT Laboratory for Computer Science. +.Sh BUGS +The original implementations supported IPv6. This support should +eventually be resurrected. The +.Tn NRL +implementation also included support for the +.Dv AF_ISO +and +.Dv AF_NS +address families. +.Pp +The genericity of this interface is somewhat questionable. A truly +generic interface would provide a means for determining the length of +the buffer to be used so that it could be dynamically allocated, and +would always require a +.Dq Li "struct sockaddr" +to hold the binary address. Unfortunately, this is incompatible with existing +practice. This limitation means that a routine for printing network +addresses from arbitrary address families must still have internal +knowledge of the maximum buffer length needed and the appropriate part +of the address to use as the binary address. diff --git a/newlib/libc/sys/linux/net/addr2ascii.c b/newlib/libc/sys/linux/net/addr2ascii.c new file mode 100644 index 000000000..f095339cc --- /dev/null +++ b/newlib/libc/sys/linux/net/addr2ascii.c @@ -0,0 +1,86 @@ +/* + * Copyright 1996 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $ANA: addr2ascii.c,v 1.1 1996/06/13 18:41:46 wollman Exp $ + */ + +#include + +#include +#include + +#include +#include + +#include +#include +#include + +/*- + * Convert a network address from binary to printable numeric format. + * This API is copied from INRIA's IPv6 implementation, but it is a + * bit bogus in two ways: + * + * 1) There is no value in passing both an address family and + * an address length; either one should imply the other, + * or we should be passing sockaddrs instead. + * 2) There should by contrast be /added/ a length for the buffer + * that we pass in, so that programmers are spared the need to + * manually calculate (read: ``guess'') the maximum length. + * + * Flash: the API is also the same in the NRL implementation, and seems to + * be some sort of standard, so we appear to be stuck with both the bad + * naming and the poor choice of arguments. + */ +char * +addr2ascii(af, addrp, len, buf) + int af; + const void *addrp; + int len; /* should be size_t XXX */ + char *buf; /* XXX should pass length of buffer */ +{ + static char staticbuf[64]; /* 64 for AF_LINK > 16 for AF_INET */ + + if (!buf) + buf = staticbuf; + + switch(af) { + case AF_INET: + if (len != sizeof(struct in_addr)) { + errno = ENAMETOOLONG; + return 0; + } + strcpy(buf, inet_ntoa(*(const struct in_addr *)addrp)); + break; + + default: + errno = EPROTONOSUPPORT; + return 0; + } + return buf; +} diff --git a/newlib/libc/sys/linux/net/ascii2addr.c b/newlib/libc/sys/linux/net/ascii2addr.c new file mode 100644 index 000000000..f69e029f8 --- /dev/null +++ b/newlib/libc/sys/linux/net/ascii2addr.c @@ -0,0 +1,70 @@ +/* + * Copyright 1996 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $ANA: ascii2addr.c,v 1.2 1996/06/13 18:46:02 wollman Exp $ + */ + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +int +ascii2addr(af, ascii, result) + int af; + const char *ascii; + void *result; +{ + struct in_addr *ina; + char strbuf[4*sizeof("123")]; /* long enough for V4 only */ + + switch(af) { + case AF_INET: + ina = result; + strbuf[0] = '\0'; + strncat(strbuf, ascii, (sizeof strbuf)-1); + if (inet_aton(strbuf, ina)) + return sizeof(struct in_addr); + errno = EINVAL; + break; + + default: + errno = EPROTONOSUPPORT; + break; + } + + return -1; +} diff --git a/newlib/libc/sys/linux/net/base64.c b/newlib/libc/sys/linux/net/base64.c new file mode 100644 index 000000000..35f7d867b --- /dev/null +++ b/newlib/libc/sys/linux/net/base64.c @@ -0,0 +1,315 @@ +/* + * Copyright (c) 1996, 1998 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#define Assert(Cond) if (!(Cond)) abort() + +static const char Base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char Pad64 = '='; + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) + The following encoding technique is taken from RFC 1521 by Borenstein + and Freed. It is reproduced here in a slightly edited form for + convenience. + + A 65-character subset of US-ASCII is used, enabling 6 bits to be + represented per printable character. (The extra 65th character, "=", + is used to signify a special processing function.) + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8-bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + + Each 6-bit group is used as an index into an array of 64 printable + characters. The character referenced by the index is placed in the + output string. + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a quantity. When fewer than 24 input + bits are available in an input group, zero bits are added (on the + right) to form an integral number of 6-bit groups. Padding at the + end of the data is performed using the '=' character. + + Since all base64 input is an integral number of octets, only the + ------------------------------------------------- + following cases can arise: + + (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded + output will be an integral multiple of 4 characters + with no "=" padding, + (2) the final quantum of encoding input is exactly 8 bits; + here, the final unit of encoded output will be two + characters followed by two "=" padding characters, or + (3) the final quantum of encoding input is exactly 16 bits; + here, the final unit of encoded output will be three + characters followed by one "=" padding character. + */ + +int +b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { + size_t datalength = 0; + u_char input[3]; + u_char output[4]; + size_t i; + + while (2 < srclength) { + input[0] = *src++; + input[1] = *src++; + input[2] = *src++; + srclength -= 3; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + output[3] = input[2] & 0x3f; + Assert(output[0] < 64); + Assert(output[1] < 64); + Assert(output[2] < 64); + Assert(output[3] < 64); + + if (datalength + 4 > targsize) + return (-1); + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + target[datalength++] = Base64[output[2]]; + target[datalength++] = Base64[output[3]]; + } + + /* Now we worry about padding. */ + if (0 != srclength) { + /* Get what's left. */ + input[0] = input[1] = input[2] = '\0'; + for (i = 0; i < srclength; i++) + input[i] = *src++; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + Assert(output[0] < 64); + Assert(output[1] < 64); + Assert(output[2] < 64); + + if (datalength + 4 > targsize) + return (-1); + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + if (srclength == 1) + target[datalength++] = Pad64; + else + target[datalength++] = Base64[output[2]]; + target[datalength++] = Pad64; + } + if (datalength >= targsize) + return (-1); + target[datalength] = '\0'; /* Returned value doesn't count \0. */ + return (datalength); +} + +/* skips all whitespace anywhere. + converts characters, four at a time, starting at (or after) + src from base - 64 numbers into three 8 bit bytes in the target area. + it returns the number of data bytes stored at the target, or -1 on error. + */ + +int +b64_pton(src, target, targsize) + char const *src; + u_char *target; + size_t targsize; +{ + int tarindex, state, ch; + char *pos; + + state = 0; + tarindex = 0; + + while ((ch = *src++) != '\0') { + if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */ + continue; + + if (ch == Pad64) + break; + + pos = strchr(Base64, ch); + if (pos == 0) /* A non-base64 character. */ + return (-1); + + switch (state) { + case 0: + if (target) { + if ((size_t)tarindex >= targsize) + return (-1); + target[tarindex] = (pos - Base64) << 2; + } + state = 1; + break; + case 1: + if (target) { + if ((size_t)tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 4; + target[tarindex+1] = ((pos - Base64) & 0x0f) + << 4 ; + } + tarindex++; + state = 2; + break; + case 2: + if (target) { + if ((size_t)tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 2; + target[tarindex+1] = ((pos - Base64) & 0x03) + << 6; + } + tarindex++; + state = 3; + break; + case 3: + if (target) { + if ((size_t)tarindex >= targsize) + return (-1); + target[tarindex] |= (pos - Base64); + } + tarindex++; + state = 0; + break; + default: + abort(); + } + } + + /* + * We are done decoding Base-64 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad64) { /* We got a pad char. */ + ch = *src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-1); + + case 2: /* Valid, means one byte of info */ + /* Skip any number of spaces. */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!isspace((unsigned char)ch)) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad64) + return (-1); + ch = *src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 3: /* Valid, means two bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!isspace((unsigned char)ch)) + return (-1); + + /* + * Now make sure for cases 2 and 3 that the "extra" + * bits that slopped past the last full byte were + * zeros. If we don't check them, they become a + * subliminal channel. + */ + if (target && target[tarindex] != 0) + return (-1); + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-1); + } + + return (tarindex); +} diff --git a/newlib/libc/sys/linux/net/bindresvport.c b/newlib/libc/sys/linux/net/bindresvport.c new file mode 100644 index 000000000..7b595b4dc --- /dev/null +++ b/newlib/libc/sys/linux/net/bindresvport.c @@ -0,0 +1,160 @@ +/* $NetBSD: bindresvport.c,v 1.19 2000/07/06 03:03:59 christos Exp $ */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)bindresvport.c 1.8 88/02/08 SMI";*/ +/*static char *sccsid = "from: @(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC";*/ +/*from: OpenBSD: bindresvport.c,v 1.7 1996/07/30 16:25:47 downsj Exp */ +#endif +#include +#include + +/* + * Copyright (c) 1987 by Sun Microsystems, Inc. + * + * Portions Copyright(C) 1996, Jason Downs. All rights reserved. + */ + +#include "namespace.h" +#include +#include + +#include + +#include +#include +#include + +#include + +#include +#include "un-namespace.h" + +/* + * Bind a socket to a privileged IP port + */ +int +bindresvport(sd, sin) + int sd; + struct sockaddr_in *sin; +{ + return bindresvport_sa(sd, (struct sockaddr *)sin); +} + +/* + * Bind a socket to a privileged IP port + */ +int +bindresvport_sa(sd, sa) + int sd; + struct sockaddr *sa; +{ + int old, error, af; + struct sockaddr_storage myaddr; + struct sockaddr_in *sin; +#ifdef INET6 + struct sockaddr_in6 *sin6; +#endif + int proto, portrange, portlow; + u_int16_t *portp; + socklen_t salen; + + if (sa == NULL) { + salen = sizeof(myaddr); + sa = (struct sockaddr *)&myaddr; + + if (getsockname(sd, sa, &salen) == -1) + return -1; /* errno is correctly set */ + + af = sa->sa_family; + memset(sa, 0, salen); + } else + af = sa->sa_family; + + switch (af) { + case AF_INET: + proto = IPPROTO_IP; + portrange = IP_PORTRANGE; + portlow = IP_PORTRANGE_LOW; + sin = (struct sockaddr_in *)sa; + salen = sizeof(struct sockaddr_in); + portp = &sin->sin_port; + break; +#ifdef INET6 + case AF_INET6: + proto = IPPROTO_IPV6; + portrange = IPV6_PORTRANGE; + portlow = IPV6_PORTRANGE_LOW; + sin6 = (struct sockaddr_in6 *)sa; + salen = sizeof(struct sockaddr_in6); + portp = &sin6->sin6_port; + break; +#endif + default: + errno = EPFNOSUPPORT; + return (-1); + } + sa->sa_family = af; + + if (*portp == 0) { + socklen_t oldlen = sizeof(old); + + error = getsockopt(sd, proto, portrange, &old, &oldlen); + if (error < 0) + return (error); + + error = setsockopt(sd, proto, portrange, &portlow, + sizeof(portlow)); + if (error < 0) + return (error); + } + + error = bind(sd, sa, salen); + + if (*portp == 0) { + int saved_errno = errno; + + if (error < 0) { + if (setsockopt(sd, proto, portrange, &old, + sizeof(old)) < 0) + errno = saved_errno; + return (error); + } + + if (sa != (struct sockaddr *)&myaddr) { + /* Hmm, what did the kernel assign? */ + if (getsockname(sd, sa, &salen) < 0) + errno = saved_errno; + return (error); + } + } + return (error); +} diff --git a/newlib/libc/sys/linux/net/byteorder.3 b/newlib/libc/sys/linux/net/byteorder.3 new file mode 100644 index 000000000..062ac9d70 --- /dev/null +++ b/newlib/libc/sys/linux/net/byteorder.3 @@ -0,0 +1,84 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)byteorder.3 8.1 (Berkeley) 6/4/93 +.\" $FreeBSD: src/lib/libc/net/byteorder.3,v 1.9 2001/12/08 19:06:23 ru Exp $ +.\" +.Dd June 4, 1993 +.Dt BYTEORDER 3 +.Os +.Sh NAME +.Nm htonl , +.Nm htons , +.Nm ntohl , +.Nm ntohs +.Nd convert values between host and network byte order +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In arpa/inet.h +.Ft uint32_t +.Fn htonl "uint32_t hostlong" +.Ft uint16_t +.Fn htons "uint16_t hostshort" +.Ft uint32_t +.Fn ntohl "uint32_t netlong" +.Ft uint16_t +.Fn ntohs "uint16_t netshort" +.Sh DESCRIPTION +These routines convert 16 and 32 bit quantities between network +byte order and host byte order. +On machines which have a byte order which is the same as the network +order, routines are defined as null macros. +.Pp +These routines are most often used in conjunction with Internet +addresses and ports as returned by +.Xr gethostbyname 3 +and +.Xr getservent 3 . +.Sh SEE ALSO +.Xr gethostbyname 3 , +.Xr getservent 3 +.Sh STANDARDS +The +.Nm byteorder +functions are expected to conform with +.St -p1003.1-2001 . +.Sh HISTORY +The +.Nm byteorder +functions appeared in +.Bx 4.2 . +.Sh BUGS +On the +.Tn VAX +bytes are handled backwards from most everyone else in +the world. This is not expected to be fixed in the near future. diff --git a/newlib/libc/sys/linux/net/ether_addr.c b/newlib/libc/sys/linux/net/ether_addr.c new file mode 100644 index 000000000..7d2b19f69 --- /dev/null +++ b/newlib/libc/sys/linux/net/ether_addr.c @@ -0,0 +1,231 @@ +/* + * Copyright (c) 1995 + * Bill Paul . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * ethernet address conversion and lookup routines + * + * Written by Bill Paul + * Center for Telecommunications Research + * Columbia University, New York City + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef YP +#include +#include +#include +#endif + +#ifndef _PATH_ETHERS +#define _PATH_ETHERS "/etc/ethers" +#endif + +/* + * Parse a string of text containing an ethernet address and hostname + * and separate it into its component parts. + */ +int +ether_line(l, e, hostname) + const char *l; + struct ether_addr *e; + char *hostname; +{ + int i, o[6]; + + i = sscanf(l, "%x:%x:%x:%x:%x:%x %s", &o[0], &o[1], &o[2], + &o[3], &o[4], &o[5], + hostname); + if (i != 7) + return (i); + + for (i=0; i<6; i++) + e->octet[i] = o[i]; + return (0); +} + +/* + * Convert an ASCII representation of an ethernet address to + * binary form. + */ +struct +ether_addr *ether_aton(a) + const char *a; +{ + int i; + static struct ether_addr o; + unsigned int o0, o1, o2, o3, o4, o5; + + i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o0, &o1, &o2, &o3, &o4, &o5); + + if (i != 6) + return (NULL); + + o.octet[0]=o0; + o.octet[1]=o1; + o.octet[2]=o2; + o.octet[3]=o3; + o.octet[4]=o4; + o.octet[5]=o5; + + return ((struct ether_addr *)&o); +} + +/* + * Convert a binary representation of an ethernet address to + * an ASCII string. + */ +char +*ether_ntoa(n) + const struct ether_addr *n; +{ + int i; + static char a[18]; + + i = sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x", + n->octet[0], n->octet[1], n->octet[2], + n->octet[3], n->octet[4], n->octet[5]); + if (i < 17) + return (NULL); + return ((char *)&a); +} + +/* + * Map an ethernet address to a hostname. Use either /etc/ethers or + * NIS/YP. + */ +int +ether_ntohost(hostname, e) + char *hostname; + const struct ether_addr *e; +{ + FILE *fp; + char buf[BUFSIZ + 2]; + struct ether_addr local_ether; + char local_host[MAXHOSTNAMELEN]; +#ifdef YP + char *result; + int resultlen; + char *ether_a; + char *yp_domain; +#endif + if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) + return (1); + + while (fgets(buf,BUFSIZ,fp)) { + if (buf[0] == '#') + continue; +#ifdef YP + if (buf[0] == '+') { + if (yp_get_default_domain(&yp_domain)) + continue; + ether_a = ether_ntoa(e); + if (yp_match(yp_domain, "ethers.byaddr", ether_a, + strlen(ether_a), &result, &resultlen)) { + continue; + } + strncpy(buf, result, resultlen); + buf[resultlen] = '\0'; + free(result); + } +#endif + if (!ether_line(buf, &local_ether, local_host)) { + if (!memcmp((char *)&local_ether.octet[0], + (char *)&e->octet[0], 6)) { + /* We have a match */ + strcpy(hostname, local_host); + fclose(fp); + return(0); + } + } + } + fclose(fp); + return (1); +} + +/* + * Map a hostname to an ethernet address using /etc/ethers or + * NIS/YP. + */ +int +ether_hostton(hostname, e) + const char *hostname; + struct ether_addr *e; +{ + FILE *fp; + char buf[BUFSIZ + 2]; + struct ether_addr local_ether; + char local_host[MAXHOSTNAMELEN]; +#ifdef YP + char *result; + int resultlen; + char *yp_domain; +#endif + if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) + return (1); + + while (fgets(buf,BUFSIZ,fp)) { + if (buf[0] == '#') + continue; +#ifdef YP + if (buf[0] == '+') { + if (yp_get_default_domain(&yp_domain)) + continue; + if (yp_match(yp_domain, "ethers.byname", hostname, + strlen(hostname), &result, &resultlen)) { + continue; + } + strncpy(buf, result, resultlen); + buf[resultlen] = '\0'; + free(result); + } +#endif + if (!ether_line(buf, &local_ether, local_host)) { + if (!strcmp(hostname, local_host)) { + /* We have a match */ + bcopy((char *)&local_ether.octet[0], + (char *)&e->octet[0], 6); + fclose(fp); + return(0); + } + } + } + fclose(fp); + return (1); +} diff --git a/newlib/libc/sys/linux/net/ethers.3 b/newlib/libc/sys/linux/net/ethers.3 new file mode 100644 index 000000000..7b7866fd9 --- /dev/null +++ b/newlib/libc/sys/linux/net/ethers.3 @@ -0,0 +1,197 @@ +.\" Copyright (c) 1995 +.\" Bill Paul . All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Bill Paul. +.\" 4. Neither the name of the author nor the names of any co-contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/lib/libc/net/ethers.3,v 1.19 2002/01/14 16:59:00 ru Exp $ +.\" +.Dd April 12, 1995 +.Dt ETHERS 3 +.Os +.Sh NAME +.Nm ethers , +.Nm ether_line , +.Nm ether_aton , +.Nm ether_ntoa , +.Nm ether_ntohost , +.Nm ether_hostton +.Nd Ethernet address conversion and lookup routines +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In net/ethernet.h +.Ft int +.Fn ether_line "const char *l" "struct ether_addr *e" "char *hostname" +.Ft struct ether_addr * +.Fn ether_aton "const char *a" +.Ft char * +.Fn ether_ntoa "const struct ether_addr *n" +.Ft int +.Fn ether_ntohost "char *hostname" "const struct ether_addr *e" +.Ft int +.Fn ether_hostton "const char *hostname" "struct ether_addr *e" +.Sh DESCRIPTION +These functions operate on ethernet addresses using an +.Ar ether_addr +structure, which is defined in the header file +.Aq Pa netinet/if_ether.h : +.Bd -literal -offset indent +/* + * The number of bytes in an ethernet (MAC) address. + */ +#define ETHER_ADDR_LEN 6 + +/* + * Structure of a 48-bit Ethernet address. + */ +struct ether_addr { + u_char octet[ETHER_ADDR_LEN]; +}; +.Ed +.Pp +The function +.Fn ether_line +scans +.Ar l , +an +.Tn ASCII +string in +.Xr ethers 5 +format and sets +.Ar e +to the ethernet address specified in the string and +.Ar h +to the hostname. +This function is used to parse lines from +.Pa /etc/ethers +into their component parts. +.Pp +The +.Fn ether_aton +function converts an +.Tn ASCII +representation of an ethernet address into an +.Ar ether_addr +structure. +Likewise, +.Fn ether_ntoa +converts an ethernet address specified as an +.Ar ether_addr +structure into an +.Tn ASCII +string. +.Pp +The +.Fn ether_ntohost +and +.Fn ether_hostton +functions map ethernet addresses to their corresponding hostnames +as specified in the +.Pa /etc/ethers +database. +.Fn ether_ntohost +converts from ethernet address to hostname, and +.Fn ether_hostton +converts from hostname to ethernet address. +.Sh RETURN VALUES +.Fn ether_line +returns zero on success and non-zero if it was unable to parse +any part of the supplied line +.Ar l . +It returns the extracted ethernet address in the supplied +.Ar ether_addr +structure +.Ar e +and the hostname in the supplied string +.Ar h . +.Pp +On success, +.Fn ether_ntoa +returns a pointer to a string containing an +.Tn ASCII +representation of an ethernet address. +If it is unable to convert +the supplied +.Ar ether_addr +structure, it returns a +.Dv NULL +pointer. +Likewise, +.Fn ether_aton +returns a pointer to an +.Ar ether_addr +structure on success and a +.Dv NULL +pointer on failure. +.Pp +The +.Fn ether_ntohost +and +.Fn ether_hostton +functions both return zero on success or non-zero if they were +unable to find a match in the +.Pa /etc/ethers +database. +.Sh NOTES +The user must insure that the hostname strings passed to the +.Fn ether_line , +.Fn ether_ntohost +and +.Fn ether_hostton +functions are large enough to contain the returned hostnames. +.Sh NIS INTERACTION +If the +.Pa /etc/ethers +contains a line with a single + in it, the +.Fn ether_ntohost +and +.Fn ether_hostton +functions will attempt to consult the NIS +.Pa ethers.byname +and +.Pa ethers.byaddr +maps in addition to the data in the +.Pa /etc/ethers +file. +.Sh SEE ALSO +.Xr ethers 5 , +.Xr yp 8 +.Sh BUGS +The +.Fn ether_aton +and +.Fn ether_ntoa +functions returns values that are stored in static memory areas +which may be overwritten the next time they are called. +.Sh HISTORY +This particular implementation of the +.Nm +library functions were written for and first appeared in +.Fx 2.1 . diff --git a/newlib/libc/sys/linux/net/getaddrinfo.3 b/newlib/libc/sys/linux/net/getaddrinfo.3 new file mode 100644 index 000000000..eca8b03b2 --- /dev/null +++ b/newlib/libc/sys/linux/net/getaddrinfo.3 @@ -0,0 +1,620 @@ +.\" $FreeBSD: src/lib/libc/net/getaddrinfo.3,v 1.18 2002/04/19 04:46:20 suz Exp $ +.\" $KAME: getaddrinfo.3,v 1.31 2001/08/05 18:19:38 itojun Exp $ +.\" +.\" Copyright (c) 1983, 1987, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 +.\" +.Dd May 25, 1995 +.Dt GETADDRINFO 3 +.Os +.\" +.Sh NAME +.Nm getaddrinfo , +.Nm freeaddrinfo , +.Nm gai_strerror +.Nd nodename-to-address translation in protocol-independent manner +.\" +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In netdb.h +.Ft int +.Fn getaddrinfo "const char *nodename" "const char *servname" \ +"const struct addrinfo *hints" "struct addrinfo **res" +.Ft void +.Fn freeaddrinfo "struct addrinfo *ai" +.Ft "char *" +.Fn gai_strerror "int ecode" +.\" +.Sh DESCRIPTION +The +.Fn getaddrinfo +function is defined for protocol-independent nodename-to-address translation. +It performs the functionality of +.Xr gethostbyname 3 +and +.Xr getservbyname 3 , +but in a more sophisticated manner. +.Pp +The +.Li addrinfo +structure is defined as a result of including the +.Aq Pa netdb.h +header: +.Bd -literal -offset +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for nodename */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +.Ed +.Pp +The +.Fa nodename +and +.Fa servname +arguments are pointers to null-terminated strings or +.Dv NULL . +One or both of these two arguments must be a +.Pf non Dv -NULL +pointer. +In the normal client scenario, both the +.Fa nodename +and +.Fa servname +are specified. +In the normal server scenario, only the +.Fa servname +is specified. +A +.Pf non Dv -NULL +.Fa nodename +string can be either a node name or a numeric host address string +(i.e., a dotted-decimal IPv4 address or an IPv6 hex address). +A +.Pf non Dv -NULL +.Fa servname +string can be either a service name or a decimal port number. +.Pp +The caller can optionally pass an +.Li addrinfo +structure, pointed to by the third argument, +to provide hints concerning the type of socket that the caller supports. +In this +.Fa hints +structure all members other than +.Fa ai_flags , +.Fa ai_family , +.Fa ai_socktype , +and +.Fa ai_protocol +must be zero or a +.Dv NULL +pointer. +A value of +.Dv PF_UNSPEC +for +.Fa ai_family +means the caller will accept any protocol family. +A value of 0 for +.Fa ai_socktype +means the caller will accept any socket type. +A value of 0 for +.Fa ai_protocol +means the caller will accept any protocol. +For example, if the caller handles only TCP and not UDP, then the +.Fa ai_socktype +member of the hints structure should be set to +.Dv SOCK_STREAM +when +.Fn getaddrinfo +is called. +If the caller handles only IPv4 and not IPv6, then the +.Fa ai_family +member of the +.Fa hints +structure should be set to +.Dv PF_INET +when +.Fn getaddrinfo +is called. +If the third argument to +.Fn getaddrinfo +is a +.Dv NULL +pointer, this is the same as if the caller had filled in an +.Li addrinfo +structure initialized to zero with +.Fa ai_family +set to +.Dv PF_UNSPEC . +.Pp +Upon successful return a pointer to a linked list of one or more +.Li addrinfo +structures is returned through the final argument. +The caller can process each +.Li addrinfo +structure in this list by following the +.Fa ai_next +pointer, until a +.Dv NULL +pointer is encountered. +In each returned +.Li addrinfo +structure the three members +.Fa ai_family , +.Fa ai_socktype , +and +.Fa ai_protocol +are the corresponding arguments for a call to the +.Fn socket +function. +In each +.Li addrinfo +structure the +.Fa ai_addr +member points to a filled-in socket address structure whose length is +specified by the +.Fa ai_addrlen +member. +.Pp +If the +.Dv AI_PASSIVE +bit is set in the +.Fa ai_flags +member of the +.Fa hints +structure, then the caller plans to use the returned socket address +structure in a call to +.Fn bind . +In this case, if the +.Fa nodename +argument is a +.Dv NULL +pointer, then the IP address portion of the socket +address structure will be set to +.Dv INADDR_ANY +for an IPv4 address or +.Dv IN6ADDR_ANY_INIT +for an IPv6 address. +.Pp +If the +.Dv AI_PASSIVE +bit is not set in the +.Fa ai_flags +member of the +.Fa hints +structure, then the returned socket address structure will be ready for a +call to +.Fn connect +(for a connection-oriented protocol) +or either +.Fn connect , +.Fn sendto , +or +.Fn sendmsg +(for a connectionless protocol). +In this case, if the +.Fa nodename +argument is a +.Dv NULL +pointer, then the IP address portion of the +socket address structure will be set to the loopback address. +.Pp +If the +.Dv AI_CANONNAME +bit is set in the +.Fa ai_flags +member of the +.Fa hints +structure, then upon successful return the +.Fa ai_canonname +member of the first +.Li addrinfo +structure in the linked list will point to a null-terminated string +containing the canonical name of the specified +.Fa nodename . +.Pp +If the +.Dv AI_NUMERICHOST +bit is set in the +.Fa ai_flags +member of the +.Fa hints +structure, then a +.Pf non Dv -NULL +.Fa nodename +string must be a numeric host address string. +Otherwise an error of +.Dv EAI_NONAME +is returned. +This flag prevents any type of name resolution service (e.g., the DNS) +from being called. +.Pp +The arguments to +.Fn getaddrinfo +must be sufficiently consistent and unambiguous. +Here are some problem cases you may encounter: +.Bl -bullet +.It +.Fn getaddrinfo +will fail if the members in the +.Fa hints +structure are not consistent. +For example, for internet address families, +.Fn getaddrinfo +will fail if you specify +.Dv SOCK_STREAM +to +.Fa ai_socktype +while you specify +.Dv IPPROTO_UDP +to +.Fa ai_protocol . +.It +If you specify a +.Fa servname +which is defined only for certain +.Fa ai_socktype , +.Fn getaddrinfo +will fail because the arguments are not consistent. +For example, +.Fn getaddrinfo +will return an error if you ask for +.Dq Li tftp +service on +.Dv SOCK_STREAM . +.It +For internet address families, if you specify +.Fa servname +while you set +.Fa ai_socktype +to +.Dv SOCK_RAW , +.Fn getaddrinfo +will fail, because service names are not defined for the internet +.Dv SOCK_RAW +space. +.It +If you specify numeric +.Fa servname , +while leaving +.Fa ai_socktype +and +.Fa ai_protocol +unspecified, +.Fn getaddrinfo +will fail. +This is because the numeric +.Fa servname +does not identify any socket type, and +.Fn getaddrinfo +is not allowed to glob the argument in such case. +.El +.Pp +All of the information returned by +.Fn getaddrinfo +is dynamically allocated: +the +.Li addrinfo +structures, the socket address structures, and canonical node name +strings pointed to by the addrinfo structures. +To return this information to the system the function +.Fn freeaddrinfo +is called. +The +.Fa addrinfo +structure pointed to by the +.Fa ai argument +is freed, along with any dynamic storage pointed to by the structure. +This operation is repeated until a +.Dv NULL +.Fa ai_next +pointer is encountered. +.Pp +To aid applications in printing error messages based on the +.Dv EAI_xxx +codes returned by +.Fn getaddrinfo , +.Fn gai_strerror +is defined. +The argument is one of the +.Dv EAI_xxx +values defined earlier and the return value points to a string describing +the error. +If the argument is not one of the +.Dv EAI_xxx +values, the function still returns a pointer to a string whose contents +indicate an unknown error. +.\" +.Sh EXTENSIONS +This implementation supports numeric IPv6 address notation with the +experimental scope identifier. +By appending a percent sign and scope identifier to the address, you +can specify the value of the +.Li sin6_scope_id +field of the socket address. +This makes management of scoped address easier, +and allows cut-and-paste input of scoped addresses. +.Pp +At the moment the code supports only link-local addresses in this format. +The scope identifier is hardcoded to name of hardware interface associated +with the link, +(such as +.Li ne0 ) . +For example, +.Dq Li fe80::1%ne0 , +which means +.Do +.Li fe80::1 +on the link associated with the +.Li ne0 +interface +.Dc . +.Pp +This implementation is still very experimental and non-standard. +The current implementation assumes a one-to-one relationship between +interfaces and links, which is not necessarily true according to the +specification. +.\" +.Sh EXAMPLES +The following code tries to connect to +.Dq Li www.kame.net +service +.Dq Li http . +via stream socket. +It loops through all the addresses available, regardless of the address family. +If the destination resolves to an IPv4 address, it will use an +.Dv AF_INET +socket. +Similarly, if it resolves to IPv6, an +.Dv AF_INET6 +socket is used. +Observe that there is no hardcoded reference to particular address family. +The code works even if +.Fn getaddrinfo +returns addresses that are not IPv4/v6. +.Bd -literal -offset indent +struct addrinfo hints, *res, *res0; +int error; +int s; +const char *cause = NULL; + +memset(&hints, 0, sizeof(hints)); +hints.ai_family = PF_UNSPEC; +hints.ai_socktype = SOCK_STREAM; +error = getaddrinfo("www.kame.net", "http", &hints, &res0); +if (error) { + errx(1, "%s", gai_strerror(error)); + /*NOTREACHED*/ +} +s = -1; +cause = "no addresses"; +errno = EADDRNOTAVAIL; +for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (s < 0) { + cause = "socket"; + continue; + } + + if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { + cause = "connect"; + close(s); + s = -1; + continue; + } + + break; /* okay we got one */ +} +if (s < 0) { + err(1, cause); + /*NOTREACHED*/ +} +freeaddrinfo(res0); +.Ed +.Pp +The following example tries to open a wildcard listening socket onto service +.Dq Li http , +for all the address families available. +.Bd -literal -offset indent +struct addrinfo hints, *res, *res0; +int error; +int s[MAXSOCK]; +int nsock; +const char *cause = NULL; + +memset(&hints, 0, sizeof(hints)); +hints.ai_family = PF_UNSPEC; +hints.ai_socktype = SOCK_STREAM; +hints.ai_flags = AI_PASSIVE; +error = getaddrinfo(NULL, "http", &hints, &res0); +if (error) { + errx(1, "%s", gai_strerror(error)); + /*NOTREACHED*/ +} +nsock = 0; +for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) { + s[nsock] = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (s[nsock] < 0) { + cause = "socket"; + continue; + } + + if (bind(s[nsock], res->ai_addr, res->ai_addrlen) < 0) { + cause = "bind"; + close(s[nsock]); + continue; + } + + if (listen(s[nsock], SOMAXCONN) < 0) { + cause = "listen"; + close(s[nsock]); + continue; + } + + nsock++; +} +if (nsock == 0) { + err(1, cause); + /*NOTREACHED*/ +} +freeaddrinfo(res0); +.Ed +.\" +.Sh FILES +.Bl -tag -width /etc/nsswitch.conf -compact +.It Pa /etc/hosts +.It Pa /etc/nsswitch.conf +.It Pa /etc/resolv.conf +.El +.\" +.Sh DIAGNOSTICS +Error return status from +.Fn getaddrinfo +is zero on success and non-zero on errors. +Non-zero error codes are defined in +.Aq Pa netdb.h , +and as follows: +.Pp +.Bl -tag -width EAI_ADDRFAMILY -compact +.It Dv EAI_ADDRFAMILY +Address family for +.Fa nodename +not supported. +.It Dv EAI_AGAIN +Temporary failure in name resolution. +.It Dv EAI_BADFLAGS +Invalid value for +.Fa ai_flags . +.It Dv EAI_FAIL +Non-recoverable failure in name resolution. +.It Dv EAI_FAMILY +.Fa ai_family +not supported. +.It Dv EAI_MEMORY +Memory allocation failure. +.It Dv EAI_NODATA +No address associated with +.Fa nodename . +.It Dv EAI_NONAME +.Fa nodename +nor +.Fa servname +provided, or not known. +.It Dv EAI_SERVICE +.Fa servname +not supported for +.Fa ai_socktype . +.It Dv EAI_SOCKTYPE +.Fa ai_socktype +not supported. +.It Dv EAI_SYSTEM +System error returned in +.Va errno . +.It Dv EAI_BADHINTS +Invalid value for +.Fa hints . +.It Dv EAI_PROTOCOL +Resolved protocol is unknown. +.It Dv EAI_MAX +Unknown error. +.El +.Pp +If called with an appropriate argument, +.Fn gai_strerror +returns a pointer to a string describing the given error code. +If the argument is not one of the +.Dv EAI_xxx +values, the function still returns a pointer to a string whose contents +indicate an unknown error. +.\" +.Sh SEE ALSO +.Xr gethostbyname 3 , +.Xr getnameinfo 3 , +.Xr getservbyname 3 , +.Xr hosts 5 , +.Xr resolv.conf 5 , +.Xr services 5 , +.Xr hostname 7 , +.Xr named 8 +.Pp +.Rs +.%A R. Gilligan +.%A S. Thomson +.%A J. Bound +.%A W. Stevens +.%T Basic Socket Interface Extensions for IPv6 +.%R RFC2553 +.%D March 1999 +.Re +.Rs +.%A Tatsuya Jinmei +.%A Atsushi Onoe +.%T "An Extension of Format for IPv6 Scoped Addresses" +.%R internet draft +.%N draft-ietf-ipngwg-scopedaddr-format-02.txt +.%O work in progress material +.Re +.Rs +.%A Craig Metz +.%T Protocol Independence Using the Sockets API +.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference" +.%D June 2000 +.Re +.\" +.Sh HISTORY +The implementation first appeared in WIDE Hydrangea IPv6 protocol stack kit. +.\" +.Sh STANDARDS +The +.Fn getaddrinfo +function is defined in +.St -p1003.1g-2000 , +and documented in +.Dq Basic Socket Interface Extensions for IPv6 +(RFC2553). +.\" +.Sh BUGS +The current implementation is not thread-safe. +.Pp +The text was shamelessly copied from RFC2553. diff --git a/newlib/libc/sys/linux/net/getaddrinfo.c b/newlib/libc/sys/linux/net/getaddrinfo.c new file mode 100644 index 000000000..97ba36209 --- /dev/null +++ b/newlib/libc/sys/linux/net/getaddrinfo.c @@ -0,0 +1,1979 @@ +/* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * "#ifdef FAITH" part is local hack for supporting IPv4-v6 translator. + * + * Issues to be discussed: + * - Thread safe-ness must be checked. + * - Return values. There are nonstandard return values defined and used + * in the source code. This is because RFC2553 is silent about which error + * code must be returned for which situation. + * - freeaddrinfo(NULL). RFC2553 is silent about it. XNET 5.2 says it is + * invalid. + * current code - SEGV on freeaddrinfo(NULL) + * Note: + * - We use getipnodebyname() just for thread-safeness. There's no intent + * to let it do PF_UNSPEC (actually we never pass PF_UNSPEC to + * getipnodebyname(). + * - The code filters out AFs that are not supported by the kernel, + * when globbing NULL hostname (to loopback, or wildcard). Is it the right + * thing to do? What is the relationship with post-RFC2553 AI_ADDRCONFIG + * in ai_flags? + * - (post-2553) semantics of AI_ADDRCONFIG itself is too vague. + * (1) what should we do against numeric hostname (2) what should we do + * against NULL hostname (3) what is AI_ADDRCONFIG itself. AF not ready? + * non-loopback address configured? global address configured? + * - To avoid search order issue, we have a big amount of code duplicate + * from gethnamaddr.c and some other places. The issues that there's no + * lower layer function to lookup "IPv4 or IPv6" record. Calling + * gethostbyname2 from getaddrinfo will end up in wrong search order, as + * follows: + * - The code makes use of following calls when asked to resolver with + * ai_family = PF_UNSPEC: + * getipnodebyname(host, AF_INET6); + * getipnodebyname(host, AF_INET); + * This will result in the following queries if the node is configure to + * prefer /etc/hosts than DNS: + * lookup /etc/hosts for IPv6 address + * lookup DNS for IPv6 address + * lookup /etc/hosts for IPv4 address + * lookup DNS for IPv4 address + * which may not meet people's requirement. + * The right thing to happen is to have underlying layer which does + * PF_UNSPEC lookup (lookup both) and return chain of addrinfos. + * This would result in a bit of code duplicate with _dns_ghbyname() and + * friends. + */ +/* + * diffs with other KAME platforms: + * - other KAME platforms already nuked FAITH ($GAI), but as FreeBSD + * 4.0-RELEASE supplies it, we still have the code here. + * - AI_ADDRCONFIG support is supplied + * - some of FreeBSD style (#define tabify and others) + * - classful IPv4 numeric (127.1) is allowed. + */ + +#include +#include + +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef DEBUG +#include +#endif + +#include +#include +#include +#include "un-namespace.h" + +#if defined(__KAME__) && defined(INET6) +# define FAITH +#endif + +#define SUCCESS 0 +#define ANY 0 +#define YES 1 +#define NO 0 + +static const char in_addrany[] = { 0, 0, 0, 0 }; +static const char in6_addrany[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +static const char in_loopback[] = { 127, 0, 0, 1 }; +static const char in6_loopback[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 +}; + +static const struct afd { + int a_af; + int a_addrlen; + int a_socklen; + int a_off; + const char *a_addrany; + const char *a_loopback; + int a_scoped; +} afdl [] = { +#ifdef INET6 +#define N_INET6 0 + {PF_INET6, sizeof(struct in6_addr), + sizeof(struct sockaddr_in6), + offsetof(struct sockaddr_in6, sin6_addr), + in6_addrany, in6_loopback, 1}, +#define N_INET 1 +#else +#define N_INET 0 +#endif + {PF_INET, sizeof(struct in_addr), + sizeof(struct sockaddr_in), + offsetof(struct sockaddr_in, sin_addr), + in_addrany, in_loopback, 0}, + {0, 0, 0, 0, NULL, NULL, 0}, +}; + +struct explore { + int e_af; + int e_socktype; + int e_protocol; + const char *e_protostr; + int e_wild; +#define WILD_AF(ex) ((ex)->e_wild & 0x01) +#define WILD_SOCKTYPE(ex) ((ex)->e_wild & 0x02) +#define WILD_PROTOCOL(ex) ((ex)->e_wild & 0x04) +}; + +static const struct explore explore[] = { +#if 0 + { PF_LOCAL, 0, ANY, ANY, NULL, 0x01 }, +#endif +#ifdef INET6 + { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, + { PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, + { PF_INET6, SOCK_RAW, ANY, NULL, 0x05 }, +#endif + { PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, + { PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, + { PF_INET, SOCK_RAW, ANY, NULL, 0x05 }, + { PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, + { PF_UNSPEC, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, + { PF_UNSPEC, SOCK_RAW, ANY, NULL, 0x05 }, + { -1, 0, 0, NULL, 0 }, +}; + +#ifdef INET6 +#define PTON_MAX 16 +#else +#define PTON_MAX 4 +#endif + +static const ns_src default_dns_files[] = { + { NSSRC_FILES, NS_SUCCESS }, + { NSSRC_DNS, NS_SUCCESS }, + { 0 } +}; + +#if PACKETSZ > 1024 +#define MAXPACKET PACKETSZ +#else +#define MAXPACKET 1024 +#endif + +typedef union { + HEADER hdr; + u_char buf[MAXPACKET]; +} querybuf; + +struct res_target { + struct res_target *next; + const char *name; /* domain name */ + int qclass, qtype; /* class and type of query */ + u_char *answer; /* buffer to put answer */ + int anslen; /* size of answer buffer */ + int n; /* result length */ +}; + +static int str_isnumber(const char *); +static int explore_fqdn(const struct addrinfo *, const char *, + const char *, struct addrinfo **); +static int explore_null(const struct addrinfo *, + const char *, struct addrinfo **); +static int explore_numeric(const struct addrinfo *, const char *, + const char *, struct addrinfo **); +static int explore_numeric_scope(const struct addrinfo *, const char *, + const char *, struct addrinfo **); +static int get_canonname(const struct addrinfo *, + struct addrinfo *, const char *); +static struct addrinfo *get_ai(const struct addrinfo *, + const struct afd *, const char *); +static int get_portmatch(const struct addrinfo *, const char *); +static int get_port(struct addrinfo *, const char *, int); +static const struct afd *find_afd(int); +static int addrconfig(struct addrinfo *); +#ifdef INET6 +static int ip6_str2scopeid(char *, struct sockaddr_in6 *); +#endif + +static struct addrinfo *getanswer(const querybuf *, int, const char *, int, + const struct addrinfo *); +static int _dns_getaddrinfo(void *, void *, va_list); +static void _sethtent(void); +static void _endhtent(void); +static struct addrinfo *_gethtent(const char *, const struct addrinfo *); +static int _files_getaddrinfo(void *, void *, va_list); +#ifdef YP +static struct addrinfo *_yphostent(char *, const struct addrinfo *); +static int _yp_getaddrinfo(void *, void *, va_list); +extern int _yp_check(char **); +#endif + +u_int16_t _getshort(const u_char *src); + +static int res_queryN(const char *, struct res_target *); +static int res_searchN(const char *, struct res_target *); +static int res_querydomainN(const char *, const char *, + struct res_target *); + +static char *ai_errlist[] = { + "Success", + "Address family for hostname not supported", /* EAI_ADDRFAMILY */ + "Temporary failure in name resolution", /* EAI_AGAIN */ + "Invalid value for ai_flags", /* EAI_BADFLAGS */ + "Non-recoverable failure in name resolution", /* EAI_FAIL */ + "ai_family not supported", /* EAI_FAMILY */ + "Memory allocation failure", /* EAI_MEMORY */ + "No address associated with hostname", /* EAI_NODATA */ + "hostname nor servname provided, or not known", /* EAI_NONAME */ + "servname not supported for ai_socktype", /* EAI_SERVICE */ + "ai_socktype not supported", /* EAI_SOCKTYPE */ + "System error returned in errno", /* EAI_SYSTEM */ + "Invalid value for hints", /* EAI_BADHINTS */ + "Resolved protocol is unknown", /* EAI_PROTOCOL */ + "Unknown error", /* EAI_MAX */ +}; + +/* XXX macros that make external reference is BAD. */ + +#define GET_AI(ai, afd, addr) \ +do { \ + /* external reference: pai, error, and label free */ \ + (ai) = get_ai(pai, (afd), (addr)); \ + if ((ai) == NULL) { \ + error = EAI_MEMORY; \ + goto free; \ + } \ +} while (/*CONSTCOND*/0) + +#define GET_PORT(ai, serv) \ +do { \ + /* external reference: error and label free */ \ + error = get_port((ai), (serv), 0); \ + if (error != 0) \ + goto free; \ +} while (/*CONSTCOND*/0) + +#define GET_CANONNAME(ai, str) \ +do { \ + /* external reference: pai, error and label free */ \ + error = get_canonname(pai, (ai), (str)); \ + if (error != 0) \ + goto free; \ +} while (/*CONSTCOND*/0) + +#define ERR(err) \ +do { \ + /* external reference: error, and label bad */ \ + error = (err); \ + goto bad; \ + /*NOTREACHED*/ \ +} while (/*CONSTCOND*/0) + +#define MATCH_FAMILY(x, y, w) \ + ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == PF_UNSPEC || (y) == PF_UNSPEC))) +#define MATCH(x, y, w) \ + ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY))) + +char * +gai_strerror(ecode) + int ecode; +{ + if (ecode < 0 || ecode > EAI_MAX) + ecode = EAI_MAX; + return ai_errlist[ecode]; +} + +void +freeaddrinfo(ai) + struct addrinfo *ai; +{ + struct addrinfo *next; + + do { + next = ai->ai_next; + if (ai->ai_canonname) + free(ai->ai_canonname); + /* no need to free(ai->ai_addr) */ + free(ai); + ai = next; + } while (ai); +} + +static int +str_isnumber(p) + const char *p; +{ + char *ep; + + if (*p == '\0') + return NO; + ep = NULL; + (void)strtoul(p, &ep, 10); + if (ep && *ep == '\0') + return YES; + else + return NO; +} + +int +getaddrinfo(hostname, servname, hints, res) + const char *hostname, *servname; + const struct addrinfo *hints; + struct addrinfo **res; +{ + struct addrinfo sentinel; + struct addrinfo *cur; + int error = 0; + struct addrinfo ai; + struct addrinfo ai0; + struct addrinfo *pai; + const struct explore *ex; + + memset(&sentinel, 0, sizeof(sentinel)); + cur = &sentinel; + pai = &ai; + pai->ai_flags = 0; + pai->ai_family = PF_UNSPEC; + pai->ai_socktype = ANY; + pai->ai_protocol = ANY; + pai->ai_addrlen = 0; + pai->ai_canonname = NULL; + pai->ai_addr = NULL; + pai->ai_next = NULL; + + if (hostname == NULL && servname == NULL) + return EAI_NONAME; + if (hints) { + /* error check for hints */ + if (hints->ai_addrlen || hints->ai_canonname || + hints->ai_addr || hints->ai_next) + ERR(EAI_BADHINTS); /* xxx */ + if (hints->ai_flags & ~AI_MASK) + ERR(EAI_BADFLAGS); + switch (hints->ai_family) { + case PF_UNSPEC: + case PF_INET: +#ifdef INET6 + case PF_INET6: +#endif + break; + default: + ERR(EAI_FAMILY); + } + memcpy(pai, hints, sizeof(*pai)); + + /* + * if both socktype/protocol are specified, check if they + * are meaningful combination. + */ + if (pai->ai_socktype != ANY && pai->ai_protocol != ANY) { + for (ex = explore; ex->e_af >= 0; ex++) { + if (pai->ai_family != ex->e_af) + continue; + if (ex->e_socktype == ANY) + continue; + if (ex->e_protocol == ANY) + continue; + if (pai->ai_socktype == ex->e_socktype + && pai->ai_protocol != ex->e_protocol) { + ERR(EAI_BADHINTS); + } + } + } + } + + /* + * post-2553: AI_ALL and AI_V4MAPPED are effective only against + * AF_INET6 query. They needs to be ignored if specified in other + * occassions. + */ + switch (pai->ai_flags & (AI_ALL | AI_V4MAPPED)) { + case AI_V4MAPPED: + case AI_ALL | AI_V4MAPPED: + if (pai->ai_family != AF_INET6) + pai->ai_flags &= ~(AI_ALL | AI_V4MAPPED); + break; + case AI_ALL: +#if 1 + /* illegal */ + ERR(EAI_BADFLAGS); +#else + pai->ai_flags &= ~(AI_ALL | AI_V4MAPPED); +#endif + break; + } + + /* + * check for special cases. (1) numeric servname is disallowed if + * socktype/protocol are left unspecified. (2) servname is disallowed + * for raw and other inet{,6} sockets. + */ + if (MATCH_FAMILY(pai->ai_family, PF_INET, 1) +#ifdef PF_INET6 + || MATCH_FAMILY(pai->ai_family, PF_INET6, 1) +#endif + ) { + ai0 = *pai; /* backup *pai */ + + if (pai->ai_family == PF_UNSPEC) { +#ifdef PF_INET6 + pai->ai_family = PF_INET6; +#else + pai->ai_family = PF_INET; +#endif + } + error = get_portmatch(pai, servname); + if (error) + ERR(error); + + *pai = ai0; + } + + ai0 = *pai; + + /* NULL hostname, or numeric hostname */ + for (ex = explore; ex->e_af >= 0; ex++) { + *pai = ai0; + + /* PF_UNSPEC entries are prepared for DNS queries only */ + if (ex->e_af == PF_UNSPEC) + continue; + + if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex))) + continue; + if (!MATCH(pai->ai_socktype, ex->e_socktype, WILD_SOCKTYPE(ex))) + continue; + if (!MATCH(pai->ai_protocol, ex->e_protocol, WILD_PROTOCOL(ex))) + continue; + + if (pai->ai_family == PF_UNSPEC) + pai->ai_family = ex->e_af; + if (pai->ai_socktype == ANY && ex->e_socktype != ANY) + pai->ai_socktype = ex->e_socktype; + if (pai->ai_protocol == ANY && ex->e_protocol != ANY) + pai->ai_protocol = ex->e_protocol; + + if (hostname == NULL) + error = explore_null(pai, servname, &cur->ai_next); + else + error = explore_numeric_scope(pai, hostname, servname, &cur->ai_next); + + if (error) + goto free; + + while (cur && cur->ai_next) + cur = cur->ai_next; + } + + /* + * XXX + * If numreic representation of AF1 can be interpreted as FQDN + * representation of AF2, we need to think again about the code below. + */ + if (sentinel.ai_next) + goto good; + + if (pai->ai_flags & AI_NUMERICHOST) + ERR(EAI_NONAME); + if (hostname == NULL) + ERR(EAI_NODATA); + + if ((pai->ai_flags & AI_ADDRCONFIG) != 0 && !addrconfig(&ai0)) + ERR(EAI_FAIL); + + /* + * hostname as alphabetical name. + * we would like to prefer AF_INET6 than AF_INET, so we'll make a + * outer loop by AFs. + */ + for (ex = explore; ex->e_af >= 0; ex++) { + *pai = ai0; + + /* require exact match for family field */ + if (pai->ai_family != ex->e_af) + continue; + + if (!MATCH(pai->ai_socktype, ex->e_socktype, + WILD_SOCKTYPE(ex))) { + continue; + } + if (!MATCH(pai->ai_protocol, ex->e_protocol, + WILD_PROTOCOL(ex))) { + continue; + } + + if (pai->ai_socktype == ANY && ex->e_socktype != ANY) + pai->ai_socktype = ex->e_socktype; + if (pai->ai_protocol == ANY && ex->e_protocol != ANY) + pai->ai_protocol = ex->e_protocol; + + error = explore_fqdn(pai, hostname, servname, + &cur->ai_next); + + while (cur && cur->ai_next) + cur = cur->ai_next; + } + + /* XXX */ + if (sentinel.ai_next) + error = 0; + + if (error) + goto free; + if (error == 0) { + if (sentinel.ai_next) { + good: + *res = sentinel.ai_next; + return SUCCESS; + } else + error = EAI_FAIL; + } + free: + bad: + if (sentinel.ai_next) + freeaddrinfo(sentinel.ai_next); + *res = NULL; + return error; +} + +/* + * FQDN hostname, DNS lookup + */ +static int +explore_fqdn(pai, hostname, servname, res) + const struct addrinfo *pai; + const char *hostname; + const char *servname; + struct addrinfo **res; +{ + struct addrinfo *result; + struct addrinfo *cur; + int error = 0; + static const ns_dtab dtab[] = { + NS_FILES_CB(_files_getaddrinfo, NULL) + { NSSRC_DNS, _dns_getaddrinfo, NULL }, /* force -DHESIOD */ + NS_NIS_CB(_yp_getaddrinfo, NULL) + { 0 } + }; + + result = NULL; + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + switch (nsdispatch(&result, dtab, NSDB_HOSTS, "getaddrinfo", + default_dns_files, hostname, pai)) { + case NS_TRYAGAIN: + error = EAI_AGAIN; + goto free; + case NS_UNAVAIL: + error = EAI_FAIL; + goto free; + case NS_NOTFOUND: + error = EAI_NODATA; + goto free; + case NS_SUCCESS: + error = 0; + for (cur = result; cur; cur = cur->ai_next) { + GET_PORT(cur, servname); + /* canonname should be filled already */ + } + break; + } + + *res = result; + + return 0; + +free: + if (result) + freeaddrinfo(result); + return error; +} + +/* + * hostname == NULL. + * passive socket -> anyaddr (0.0.0.0 or ::) + * non-passive socket -> localhost (127.0.0.1 or ::1) + */ +static int +explore_null(pai, servname, res) + const struct addrinfo *pai; + const char *servname; + struct addrinfo **res; +{ + int s; + const struct afd *afd; + struct addrinfo *cur; + struct addrinfo sentinel; + int error; + + *res = NULL; + sentinel.ai_next = NULL; + cur = &sentinel; + + /* + * filter out AFs that are not supported by the kernel + * XXX errno? + */ + s = socket(pai->ai_family, SOCK_DGRAM, 0); + if (s < 0) { + if (errno != EMFILE) + return 0; + } else + close(s); + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + if (afd == NULL) + return 0; + + if (pai->ai_flags & AI_PASSIVE) { + GET_AI(cur->ai_next, afd, afd->a_addrany); + /* xxx meaningless? + * GET_CANONNAME(cur->ai_next, "anyaddr"); + */ + GET_PORT(cur->ai_next, servname); + } else { + GET_AI(cur->ai_next, afd, afd->a_loopback); + /* xxx meaningless? + * GET_CANONNAME(cur->ai_next, "localhost"); + */ + GET_PORT(cur->ai_next, servname); + } + cur = cur->ai_next; + + *res = sentinel.ai_next; + return 0; + +free: + if (sentinel.ai_next) + freeaddrinfo(sentinel.ai_next); + return error; +} + +/* + * numeric hostname + */ +static int +explore_numeric(pai, hostname, servname, res) + const struct addrinfo *pai; + const char *hostname; + const char *servname; + struct addrinfo **res; +{ + const struct afd *afd; + struct addrinfo *cur; + struct addrinfo sentinel; + int error; + char pton[PTON_MAX]; + + *res = NULL; + sentinel.ai_next = NULL; + cur = &sentinel; + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + if (afd == NULL) + return 0; + + switch (afd->a_af) { +#if 1 /*X/Open spec*/ + case AF_INET: + if (inet_aton(hostname, (struct in_addr *)pton) == 1) { + if (pai->ai_family == afd->a_af || + pai->ai_family == PF_UNSPEC /*?*/) { + GET_AI(cur->ai_next, afd, pton); + GET_PORT(cur->ai_next, servname); + while (cur && cur->ai_next) + cur = cur->ai_next; + } else + ERR(EAI_FAMILY); /*xxx*/ + } + break; +#endif + default: + if (inet_pton(afd->a_af, hostname, pton) == 1) { + if (pai->ai_family == afd->a_af || + pai->ai_family == PF_UNSPEC /*?*/) { + GET_AI(cur->ai_next, afd, pton); + GET_PORT(cur->ai_next, servname); + while (cur && cur->ai_next) + cur = cur->ai_next; + } else + ERR(EAI_FAMILY); /*xxx*/ + } + break; + } + + *res = sentinel.ai_next; + return 0; + +free: +bad: + if (sentinel.ai_next) + freeaddrinfo(sentinel.ai_next); + return error; +} + +/* + * numeric hostname with scope + */ +static int +explore_numeric_scope(pai, hostname, servname, res) + const struct addrinfo *pai; + const char *hostname; + const char *servname; + struct addrinfo **res; +{ +#if !defined(SCOPE_DELIMITER) || !defined(INET6) + return explore_numeric(pai, hostname, servname, res); +#else + const struct afd *afd; + struct addrinfo *cur; + int error; + char *cp, *hostname2 = NULL, *scope, *addr; + struct sockaddr_in6 *sin6; + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + if (afd == NULL) + return 0; + + if (!afd->a_scoped) + return explore_numeric(pai, hostname, servname, res); + + cp = strchr(hostname, SCOPE_DELIMITER); + if (cp == NULL) + return explore_numeric(pai, hostname, servname, res); + + /* + * Handle special case of + */ + hostname2 = strdup(hostname); + if (hostname2 == NULL) + return EAI_MEMORY; + /* terminate at the delimiter */ + hostname2[cp - hostname] = '\0'; + addr = hostname2; + scope = cp + 1; + + error = explore_numeric(pai, addr, servname, res); + if (error == 0) { + int scopeid; + + for (cur = *res; cur; cur = cur->ai_next) { + if (cur->ai_family != AF_INET6) + continue; + sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr; + if ((scopeid = ip6_str2scopeid(scope, sin6)) == -1) { + free(hostname2); + return(EAI_NODATA); /* XXX: is return OK? */ + } + sin6->sin6_scope_id = scopeid; + } + } + + free(hostname2); + + return error; +#endif +} + +static int +get_canonname(pai, ai, str) + const struct addrinfo *pai; + struct addrinfo *ai; + const char *str; +{ + if ((pai->ai_flags & AI_CANONNAME) != 0) { + ai->ai_canonname = (char *)malloc(strlen(str) + 1); + if (ai->ai_canonname == NULL) + return EAI_MEMORY; + strcpy(ai->ai_canonname, str); + } + return 0; +} + +static struct addrinfo * +get_ai(pai, afd, addr) + const struct addrinfo *pai; + const struct afd *afd; + const char *addr; +{ + char *p; + struct addrinfo *ai; +#ifdef FAITH + struct in6_addr faith_prefix; + char *fp_str; + int translate = 0; +#endif + +#ifdef FAITH + /* + * Transfrom an IPv4 addr into a special IPv6 addr format for + * IPv6->IPv4 translation gateway. (only TCP is supported now) + * + * +-----------------------------------+------------+ + * | faith prefix part (12 bytes) | embedded | + * | | IPv4 addr part (4 bytes) + * +-----------------------------------+------------+ + * + * faith prefix part is specified as ascii IPv6 addr format + * in environmental variable GAI. + * For FAITH to work correctly, routing to faith prefix must be + * setup toward a machine where a FAITH daemon operates. + * Also, the machine must enable some mechanizm + * (e.g. faith interface hack) to divert those packet with + * faith prefixed destination addr to user-land FAITH daemon. + */ + fp_str = getenv("GAI"); + if (fp_str && inet_pton(AF_INET6, fp_str, &faith_prefix) == 1 && + afd->a_af == AF_INET && pai->ai_socktype == SOCK_STREAM) { + u_int32_t v4a; + u_int8_t v4a_top; + + memcpy(&v4a, addr, sizeof v4a); + v4a_top = v4a >> IN_CLASSA_NSHIFT; + if (!IN_MULTICAST(v4a) && !IN_EXPERIMENTAL(v4a) && + v4a_top != 0 && v4a != IN_LOOPBACKNET) { + afd = &afdl[N_INET6]; + memcpy(&faith_prefix.s6_addr[12], addr, + sizeof(struct in_addr)); + translate = 1; + } + } +#endif + + ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) + + (afd->a_socklen)); + if (ai == NULL) + return NULL; + + memcpy(ai, pai, sizeof(struct addrinfo)); + ai->ai_addr = (struct sockaddr *)(void *)(ai + 1); + memset(ai->ai_addr, 0, (size_t)afd->a_socklen); + ai->ai_addrlen = afd->a_socklen; + ai->ai_addr->sa_family = ai->ai_family = afd->a_af; + p = (char *)(void *)(ai->ai_addr); +#ifdef FAITH + if (translate == 1) + memcpy(p + afd->a_off, &faith_prefix, (size_t)afd->a_addrlen); + else +#endif + memcpy(p + afd->a_off, addr, (size_t)afd->a_addrlen); + return ai; +} + +static int +get_portmatch(ai, servname) + const struct addrinfo *ai; + const char *servname; +{ + + /* get_port does not touch first argument. when matchonly == 1. */ + /* LINTED const cast */ + return get_port((struct addrinfo *)ai, servname, 1); +} + +static int +get_port(ai, servname, matchonly) + struct addrinfo *ai; + const char *servname; + int matchonly; +{ + const char *proto; + struct servent *sp; + int port; + int allownumeric; + + if (servname == NULL) + return 0; + switch (ai->ai_family) { + case AF_INET: +#ifdef AF_INET6 + case AF_INET6: +#endif + break; + default: + return 0; + } + + switch (ai->ai_socktype) { + case SOCK_RAW: + return EAI_SERVICE; + case SOCK_DGRAM: + case SOCK_STREAM: + allownumeric = 1; + break; + case ANY: + allownumeric = 0; + break; + default: + return EAI_SOCKTYPE; + } + + if (str_isnumber(servname)) { + if (!allownumeric) + return EAI_SERVICE; + port = htons(atoi(servname)); + if (port < 0 || port > 65535) + return EAI_SERVICE; + } else { + switch (ai->ai_socktype) { + case SOCK_DGRAM: + proto = "udp"; + break; + case SOCK_STREAM: + proto = "tcp"; + break; + default: + proto = NULL; + break; + } + + if ((sp = getservbyname(servname, proto)) == NULL) + return EAI_SERVICE; + port = sp->s_port; + } + + if (!matchonly) { + switch (ai->ai_family) { + case AF_INET: + ((struct sockaddr_in *)(void *) + ai->ai_addr)->sin_port = port; + break; +#ifdef INET6 + case AF_INET6: + ((struct sockaddr_in6 *)(void *) + ai->ai_addr)->sin6_port = port; + break; +#endif + } + } + + return 0; +} + +static const struct afd * +find_afd(af) + int af; +{ + const struct afd *afd; + + if (af == PF_UNSPEC) + return NULL; + for (afd = afdl; afd->a_af; afd++) { + if (afd->a_af == af) + return afd; + } + return NULL; +} + +/* + * post-2553: AI_ADDRCONFIG check. if we use getipnodeby* as backend, backend + * will take care of it. + * the semantics of AI_ADDRCONFIG is not defined well. we are not sure + * if the code is right or not. + * + * XXX PF_UNSPEC -> PF_INET6 + PF_INET mapping needs to be in sync with + * _dns_getaddrinfo. + */ +static int +addrconfig(pai) + struct addrinfo *pai; +{ + int s, af; + + /* + * TODO: + * Note that implementation dependent test for address + * configuration should be done everytime called + * (or apropriate interval), + * because addresses will be dynamically assigned or deleted. + */ + af = pai->ai_family; + if (af == AF_UNSPEC) { + if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) + af = AF_INET; + else { + close(s); + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + af = AF_INET6; + else + close(s); + } + } + if (af != AF_UNSPEC) { + if ((s = socket(af, SOCK_DGRAM, 0)) < 0) + return 0; + close(s); + } + pai->ai_family = af; + return 1; +} + +#ifdef INET6 +/* convert a string to a scope identifier. XXX: IPv6 specific */ +static int +ip6_str2scopeid(scope, sin6) + char *scope; + struct sockaddr_in6 *sin6; +{ + int scopeid; + struct in6_addr *a6 = &sin6->sin6_addr; + char *ep; + + /* empty scopeid portion is invalid */ + if (*scope == '\0') + return -1; + + if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) { + /* + * We currently assume a one-to-one mapping between links + * and interfaces, so we simply use interface indices for + * like-local scopes. + */ + scopeid = if_nametoindex(scope); + if (scopeid == 0) + goto trynumeric; + return(scopeid); + } + + /* still unclear about literal, allow numeric only - placeholder */ + if (IN6_IS_ADDR_SITELOCAL(a6) || IN6_IS_ADDR_MC_SITELOCAL(a6)) + goto trynumeric; + if (IN6_IS_ADDR_MC_ORGLOCAL(a6)) + goto trynumeric; + else + goto trynumeric; /* global */ + + /* try to convert to a numeric id as a last resort */ + trynumeric: + scopeid = (int)strtoul(scope, &ep, 10); + if (*ep == '\0') + return scopeid; + else + return -1; +} +#endif + +#ifdef DEBUG +static const char AskedForGot[] = + "gethostby*.getanswer: asked for \"%s\", got \"%s\""; +#endif +static FILE *hostf = NULL; + +static struct addrinfo * +getanswer(answer, anslen, qname, qtype, pai) + const querybuf *answer; + int anslen; + const char *qname; + int qtype; + const struct addrinfo *pai; +{ + struct addrinfo sentinel, *cur; + struct addrinfo ai; + const struct afd *afd; + char *canonname; + const HEADER *hp; + const u_char *cp; + int n; + const u_char *eom; + char *bp; + int type, class, buflen, ancount, qdcount; + int haveanswer, had_error; + char tbuf[MAXDNAME]; + int (*name_ok)(const char *); + char hostbuf[8*1024]; + + memset(&sentinel, 0, sizeof(sentinel)); + cur = &sentinel; + + canonname = NULL; + eom = answer->buf + anslen; + switch (qtype) { + case T_A: + case T_AAAA: + case T_ANY: /*use T_ANY only for T_A/T_AAAA lookup*/ + name_ok = res_hnok; + break; + default: + return (NULL); /* XXX should be abort(); */ + } + /* + * find first satisfactory answer + */ + hp = &answer->hdr; + ancount = ntohs(hp->ancount); + qdcount = ntohs(hp->qdcount); + bp = hostbuf; + buflen = sizeof hostbuf; + cp = answer->buf + HFIXEDSZ; + if (qdcount != 1) { + h_errno = NO_RECOVERY; + return (NULL); + } + n = dn_expand(answer->buf, eom, cp, bp, buflen); + if ((n < 0) || !(*name_ok)(bp)) { + h_errno = NO_RECOVERY; + return (NULL); + } + cp += n + QFIXEDSZ; + if (qtype == T_A || qtype == T_AAAA || qtype == T_ANY) { + /* res_send() has already verified that the query name is the + * same as the one we sent; this just gets the expanded name + * (i.e., with the succeeding search-domain tacked on). + */ + n = strlen(bp) + 1; /* for the \0 */ + if (n >= MAXHOSTNAMELEN) { + h_errno = NO_RECOVERY; + return (NULL); + } + canonname = bp; + bp += n; + buflen -= n; + /* The qname can be abbreviated, but h_name is now absolute. */ + qname = canonname; + } + haveanswer = 0; + had_error = 0; + while (ancount-- > 0 && cp < eom && !had_error) { + n = dn_expand(answer->buf, eom, cp, bp, buflen); + if ((n < 0) || !(*name_ok)(bp)) { + had_error++; + continue; + } + cp += n; /* name */ + type = _getshort(cp); + cp += INT16SZ; /* type */ + class = _getshort(cp); + cp += INT16SZ + INT32SZ; /* class, TTL */ + n = _getshort(cp); + cp += INT16SZ; /* len */ + if (class != C_IN) { + /* XXX - debug? syslog? */ + cp += n; + continue; /* XXX - had_error++ ? */ + } + if ((qtype == T_A || qtype == T_AAAA || qtype == T_ANY) && + type == T_CNAME) { + n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); + if ((n < 0) || !(*name_ok)(tbuf)) { + had_error++; + continue; + } + cp += n; + /* Get canonical name. */ + n = strlen(tbuf) + 1; /* for the \0 */ + if (n > buflen || n >= MAXHOSTNAMELEN) { + had_error++; + continue; + } + strcpy(bp, tbuf); + canonname = bp; + bp += n; + buflen -= n; + continue; + } + if (qtype == T_ANY) { + if (!(type == T_A || type == T_AAAA)) { + cp += n; + continue; + } + } else if (type != qtype) { +#ifdef DEBUG + if (type != T_KEY && type != T_SIG) + syslog(LOG_NOTICE|LOG_AUTH, + "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"", + qname, p_class(C_IN), p_type(qtype), + p_type(type)); +#endif + cp += n; + continue; /* XXX - had_error++ ? */ + } + switch (type) { + case T_A: + case T_AAAA: + if (strcasecmp(canonname, bp) != 0) { +#ifdef DEBUG + syslog(LOG_NOTICE|LOG_AUTH, + AskedForGot, canonname, bp); +#endif + cp += n; + continue; /* XXX - had_error++ ? */ + } + if (type == T_A && n != INADDRSZ) { + cp += n; + continue; + } + if (type == T_AAAA && n != IN6ADDRSZ) { + cp += n; + continue; + } +#ifdef FILTER_V4MAPPED + if (type == T_AAAA) { + struct in6_addr in6; + memcpy(&in6, cp, sizeof(in6)); + if (IN6_IS_ADDR_V4MAPPED(&in6)) { + cp += n; + continue; + } + } +#endif + if (!haveanswer) { + int nn; + + canonname = bp; + nn = strlen(bp) + 1; /* for the \0 */ + bp += nn; + buflen -= nn; + } + + /* don't overwrite pai */ + ai = *pai; + ai.ai_family = (type == T_A) ? AF_INET : AF_INET6; + afd = find_afd(ai.ai_family); + if (afd == NULL) { + cp += n; + continue; + } + cur->ai_next = get_ai(&ai, afd, (const char *)cp); + if (cur->ai_next == NULL) + had_error++; + while (cur && cur->ai_next) + cur = cur->ai_next; + cp += n; + break; + default: + abort(); + } + if (!had_error) + haveanswer++; + } + if (haveanswer) { + if (!canonname) + (void)get_canonname(pai, sentinel.ai_next, qname); + else + (void)get_canonname(pai, sentinel.ai_next, canonname); + h_errno = NETDB_SUCCESS; + return sentinel.ai_next; + } + + h_errno = NO_RECOVERY; + return NULL; +} + +/*ARGSUSED*/ +static int +_dns_getaddrinfo(rv, cb_data, ap) + void *rv; + void *cb_data; + va_list ap; +{ + struct addrinfo *ai; + querybuf buf, buf2; + const char *name; + const struct addrinfo *pai; + struct addrinfo sentinel, *cur; + struct res_target q, q2; + + name = va_arg(ap, char *); + pai = va_arg(ap, const struct addrinfo *); + + memset(&q, 0, sizeof(q2)); + memset(&q2, 0, sizeof(q2)); + memset(&sentinel, 0, sizeof(sentinel)); + cur = &sentinel; + + switch (pai->ai_family) { + case AF_UNSPEC: + /* prefer IPv6 */ + q.qclass = C_IN; + q.qtype = T_AAAA; + q.answer = buf.buf; + q.anslen = sizeof(buf); + q.next = &q2; + q2.qclass = C_IN; + q2.qtype = T_A; + q2.answer = buf2.buf; + q2.anslen = sizeof(buf2); + break; + case AF_INET: + q.qclass = C_IN; + q.qtype = T_A; + q.answer = buf.buf; + q.anslen = sizeof(buf); + break; + case AF_INET6: + q.qclass = C_IN; + q.qtype = T_AAAA; + q.answer = buf.buf; + q.anslen = sizeof(buf); + break; + default: + return NS_UNAVAIL; + } + if (res_searchN(name, &q) < 0) + return NS_NOTFOUND; + ai = getanswer(&buf, q.n, q.name, q.qtype, pai); + if (ai) { + cur->ai_next = ai; + while (cur && cur->ai_next) + cur = cur->ai_next; + } + if (q.next) { + ai = getanswer(&buf2, q2.n, q2.name, q2.qtype, pai); + if (ai) + cur->ai_next = ai; + } + if (sentinel.ai_next == NULL) + switch (h_errno) { + case HOST_NOT_FOUND: + return NS_NOTFOUND; + case TRY_AGAIN: + return NS_TRYAGAIN; + default: + return NS_UNAVAIL; + } + *((struct addrinfo **)rv) = sentinel.ai_next; + return NS_SUCCESS; +} + +static void +_sethtent() +{ + if (!hostf) + hostf = fopen(_PATH_HOSTS, "r" ); + else + rewind(hostf); +} + +static void +_endhtent() +{ + if (hostf) { + (void) fclose(hostf); + hostf = NULL; + } +} + +static struct addrinfo * +_gethtent(name, pai) + const char *name; + const struct addrinfo *pai; +{ + char *p; + char *cp, *tname, *cname; + struct addrinfo hints, *res0, *res; + int error; + const char *addr; + char hostbuf[8*1024]; + + if (!hostf && !(hostf = fopen(_PATH_HOSTS, "r" ))) + return (NULL); + again: + if (!(p = fgets(hostbuf, sizeof hostbuf, hostf))) + return (NULL); + if (*p == '#') + goto again; + if (!(cp = strpbrk(p, "#\n"))) + goto again; + *cp = '\0'; + if (!(cp = strpbrk(p, " \t"))) + goto again; + *cp++ = '\0'; + addr = p; + cname = NULL; + /* if this is not something we're looking for, skip it. */ + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + tname = cp; + if (cname == NULL) + cname = cp; + if ((cp = strpbrk(cp, " \t")) != NULL) + *cp++ = '\0'; + if (strcasecmp(name, tname) == 0) + goto found; + } + goto again; + +found: + hints = *pai; + hints.ai_flags = AI_NUMERICHOST; + error = getaddrinfo(addr, NULL, &hints, &res0); + if (error) + goto again; +#ifdef FILTER_V4MAPPED + /* XXX should check all items in the chain */ + if (res0->ai_family == AF_INET6 && + IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)res0->ai_addr)->sin6_addr)) { + freeaddrinfo(res0); + goto again; + } +#endif + for (res = res0; res; res = res->ai_next) { + /* cover it up */ + res->ai_flags = pai->ai_flags; + + if (pai->ai_flags & AI_CANONNAME) { + if (get_canonname(pai, res, cname) != 0) { + freeaddrinfo(res0); + goto again; + } + } + } + return res0; +} + +/*ARGSUSED*/ +static int +_files_getaddrinfo(rv, cb_data, ap) + void *rv; + void *cb_data; + va_list ap; +{ + const char *name; + const struct addrinfo *pai; + struct addrinfo sentinel, *cur; + struct addrinfo *p; + + name = va_arg(ap, char *); + pai = va_arg(ap, struct addrinfo *); + + memset(&sentinel, 0, sizeof(sentinel)); + cur = &sentinel; + + _sethtent(); + while ((p = _gethtent(name, pai)) != NULL) { + cur->ai_next = p; + while (cur && cur->ai_next) + cur = cur->ai_next; + } + _endhtent(); + + *((struct addrinfo **)rv) = sentinel.ai_next; + if (sentinel.ai_next == NULL) + return NS_NOTFOUND; + return NS_SUCCESS; +} + +#ifdef YP +static char *__ypdomain; + +/*ARGSUSED*/ +static struct addrinfo * +_yphostent(line, pai) + char *line; + const struct addrinfo *pai; +{ + struct addrinfo sentinel, *cur; + struct addrinfo hints, *res, *res0; + int error; + char *p = line; + const char *addr, *canonname; + char *nextline; + char *cp; + + addr = canonname = NULL; + + memset(&sentinel, 0, sizeof(sentinel)); + cur = &sentinel; + +nextline: + /* terminate line */ + cp = strchr(p, '\n'); + if (cp) { + *cp++ = '\0'; + nextline = cp; + } else + nextline = NULL; + + cp = strpbrk(p, " \t"); + if (cp == NULL) { + if (canonname == NULL) + return (NULL); + else + goto done; + } + *cp++ = '\0'; + + addr = p; + + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (!canonname) + canonname = cp; + if ((cp = strpbrk(cp, " \t")) != NULL) + *cp++ = '\0'; + } + + hints = *pai; + hints.ai_flags = AI_NUMERICHOST; + error = getaddrinfo(addr, NULL, &hints, &res0); + if (error == 0) { + for (res = res0; res; res = res->ai_next) { + /* cover it up */ + res->ai_flags = pai->ai_flags; + + if (pai->ai_flags & AI_CANONNAME) + (void)get_canonname(pai, res, canonname); + } + } else + res0 = NULL; + if (res0) { + cur->ai_next = res0; + while (cur && cur->ai_next) + cur = cur->ai_next; + } + + if (nextline) { + p = nextline; + goto nextline; + } + +done: + return sentinel.ai_next; +} + +/*ARGSUSED*/ +static int +_yp_getaddrinfo(rv, cb_data, ap) + void *rv; + void *cb_data; + va_list ap; +{ + struct addrinfo sentinel, *cur; + struct addrinfo *ai = NULL; + static char *__ypcurrent; + int __ypcurrentlen, r; + const char *name; + const struct addrinfo *pai; + + name = va_arg(ap, char *); + pai = va_arg(ap, const struct addrinfo *); + + memset(&sentinel, 0, sizeof(sentinel)); + cur = &sentinel; + + if (!__ypdomain) { + if (_yp_check(&__ypdomain) == 0) + return NS_UNAVAIL; + } + if (__ypcurrent) + free(__ypcurrent); + __ypcurrent = NULL; + + /* hosts.byname is only for IPv4 (Solaris8) */ + if (pai->ai_family == PF_UNSPEC || pai->ai_family == PF_INET) { + r = yp_match(__ypdomain, "hosts.byname", name, + (int)strlen(name), &__ypcurrent, &__ypcurrentlen); + if (r == 0) { + struct addrinfo ai4; + + ai4 = *pai; + ai4.ai_family = AF_INET; + ai = _yphostent(__ypcurrent, &ai4); + if (ai) { + cur->ai_next = ai; + while (cur && cur->ai_next) + cur = cur->ai_next; + } + } + } + + /* ipnodes.byname can hold both IPv4/v6 */ + r = yp_match(__ypdomain, "ipnodes.byname", name, + (int)strlen(name), &__ypcurrent, &__ypcurrentlen); + if (r == 0) { + ai = _yphostent(__ypcurrent, pai); + if (ai) { + cur->ai_next = ai; + while (cur && cur->ai_next) + cur = cur->ai_next; + } + } + + if (sentinel.ai_next == NULL) { + h_errno = HOST_NOT_FOUND; + return NS_NOTFOUND; + } + *((struct addrinfo **)rv) = sentinel.ai_next; + return NS_SUCCESS; +} +#endif + +/* resolver logic */ + +extern const char *__hostalias(const char *); +extern int h_errno; + +/* + * Formulate a normal query, send, and await answer. + * Returned answer is placed in supplied buffer "answer". + * Perform preliminary check of answer, returning success only + * if no error is indicated and the answer count is nonzero. + * Return the size of the response on success, -1 on error. + * Error number is left in h_errno. + * + * Caller must parse answer and determine whether it answers the question. + */ +static int +res_queryN(name, target) + const char *name; /* domain name */ + struct res_target *target; +{ + u_char buf[MAXPACKET]; + HEADER *hp; + int n; + struct res_target *t; + int rcode; + int ancount; + + rcode = NOERROR; + ancount = 0; + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (-1); + } + + for (t = target; t; t = t->next) { + int class, type; + u_char *answer; + int anslen; + + hp = (HEADER *)(void *)t->answer; + hp->rcode = NOERROR; /* default */ + + /* make it easier... */ + class = t->qclass; + type = t->qtype; + answer = t->answer; + anslen = t->anslen; +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf(";; res_query(%s, %d, %d)\n", name, class, type); +#endif + + n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, + buf, sizeof(buf)); + if (n > 0 && (_res.options & RES_USE_EDNS0) != 0) + n = res_opt(n, buf, sizeof(buf), anslen); + if (n <= 0) { +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf(";; res_query: mkquery failed\n"); +#endif + h_errno = NO_RECOVERY; + return (n); + } + n = res_send(buf, n, answer, anslen); +#if 0 + if (n < 0) { +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf(";; res_query: send error\n"); +#endif + h_errno = TRY_AGAIN; + return (n); + } +#endif + + if (n < 0 || hp->rcode != NOERROR || ntohs(hp->ancount) == 0) { + rcode = hp->rcode; /* record most recent error */ +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf(";; rcode = %d, ancount=%d\n", hp->rcode, + ntohs(hp->ancount)); +#endif + continue; + } + + ancount += ntohs(hp->ancount); + + t->n = n; + } + + if (ancount == 0) { + switch (rcode) { + case NXDOMAIN: + h_errno = HOST_NOT_FOUND; + break; + case SERVFAIL: + h_errno = TRY_AGAIN; + break; + case NOERROR: + h_errno = NO_DATA; + break; + case FORMERR: + case NOTIMP: + case REFUSED: + default: + h_errno = NO_RECOVERY; + break; + } + return (-1); + } + return (ancount); +} + +/* + * Formulate a normal query, send, and retrieve answer in supplied buffer. + * Return the size of the response on success, -1 on error. + * If enabled, implement search rules until answer or unrecoverable failure + * is detected. Error code, if any, is left in h_errno. + */ +static int +res_searchN(name, target) + const char *name; /* domain name */ + struct res_target *target; +{ + const char *cp, * const *domain; + HEADER *hp = (HEADER *)(void *)target->answer; /*XXX*/ + u_int dots; + int trailing_dot, ret, saved_herrno; + int got_nodata = 0, got_servfail = 0, tried_as_is = 0; + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (-1); + } + + errno = 0; + h_errno = HOST_NOT_FOUND; /* default, if we never query */ + dots = 0; + for (cp = name; *cp; cp++) + dots += (*cp == '.'); + trailing_dot = 0; + if (cp > name && *--cp == '.') + trailing_dot++; + + /* + * if there aren't any dots, it could be a user-level alias + */ + if (!dots && (cp = __hostalias(name)) != NULL) + return (res_queryN(cp, target)); + + /* + * If there are dots in the name already, let's just give it a try + * 'as is'. The threshold can be set with the "ndots" option. + */ + saved_herrno = -1; + if (dots >= _res.ndots) { + ret = res_querydomainN(name, NULL, target); + if (ret > 0) + return (ret); + saved_herrno = h_errno; + tried_as_is++; + } + + /* + * We do at least one level of search if + * - there is no dot and RES_DEFNAME is set, or + * - there is at least one dot, there is no trailing dot, + * and RES_DNSRCH is set. + */ + if ((!dots && (_res.options & RES_DEFNAMES)) || + (dots && !trailing_dot && (_res.options & RES_DNSRCH))) { + int done = 0; + + for (domain = (const char * const *)_res.dnsrch; + *domain && !done; + domain++) { + + ret = res_querydomainN(name, *domain, target); + if (ret > 0) + return (ret); + + /* + * If no server present, give up. + * If name isn't found in this domain, + * keep trying higher domains in the search list + * (if that's enabled). + * On a NO_DATA error, keep trying, otherwise + * a wildcard entry of another type could keep us + * from finding this entry higher in the domain. + * If we get some other error (negative answer or + * server failure), then stop searching up, + * but try the input name below in case it's + * fully-qualified. + */ + if (errno == ECONNREFUSED) { + h_errno = TRY_AGAIN; + return (-1); + } + + switch (h_errno) { + case NO_DATA: + got_nodata++; + /* FALLTHROUGH */ + case HOST_NOT_FOUND: + /* keep trying */ + break; + case TRY_AGAIN: + if (hp->rcode == SERVFAIL) { + /* try next search element, if any */ + got_servfail++; + break; + } + /* FALLTHROUGH */ + default: + /* anything else implies that we're done */ + done++; + } + /* + * if we got here for some reason other than DNSRCH, + * we only wanted one iteration of the loop, so stop. + */ + if (!(_res.options & RES_DNSRCH)) + done++; + } + } + + /* + * if we have not already tried the name "as is", do that now. + * note that we do this regardless of how many dots were in the + * name or whether it ends with a dot. + */ + if (!tried_as_is && (dots || !(_res.options & RES_NOTLDQUERY))) { + ret = res_querydomainN(name, NULL, target); + if (ret > 0) + return (ret); + } + + /* + * if we got here, we didn't satisfy the search. + * if we did an initial full query, return that query's h_errno + * (note that we wouldn't be here if that query had succeeded). + * else if we ever got a nodata, send that back as the reason. + * else send back meaningless h_errno, that being the one from + * the last DNSRCH we did. + */ + if (saved_herrno != -1) + h_errno = saved_herrno; + else if (got_nodata) + h_errno = NO_DATA; + else if (got_servfail) + h_errno = TRY_AGAIN; + return (-1); +} + +/* + * Perform a call on res_query on the concatenation of name and domain, + * removing a trailing dot from name if domain is NULL. + */ +static int +res_querydomainN(name, domain, target) + const char *name, *domain; + struct res_target *target; +{ + char nbuf[MAXDNAME]; + const char *longname = nbuf; + size_t n, d; + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (-1); + } +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf(";; res_querydomain(%s, %s)\n", + name, domain?domain:""); +#endif + if (domain == NULL) { + /* + * Check for trailing '.'; + * copy without '.' if present. + */ + n = strlen(name); + if (n >= MAXDNAME) { + h_errno = NO_RECOVERY; + return (-1); + } + if (n > 0 && name[--n] == '.') { + strncpy(nbuf, name, n); + nbuf[n] = '\0'; + } else + longname = name; + } else { + n = strlen(name); + d = strlen(domain); + if (n + d + 1 >= MAXDNAME) { + h_errno = NO_RECOVERY; + return (-1); + } + sprintf(nbuf, "%s.%s", name, domain); + } + return (res_queryN(longname, target)); +} diff --git a/newlib/libc/sys/linux/net/gethostbydns.c b/newlib/libc/sys/linux/net/gethostbydns.c new file mode 100644 index 000000000..9db8bf4ad --- /dev/null +++ b/newlib/libc/sys/linux/net/gethostbydns.c @@ -0,0 +1,815 @@ +/* + * ++Copyright++ 1985, 1988, 1993 + * - + * Copyright (c) 1985, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; +static char fromrcsid[] = "From: Id: gethnamaddr.c,v 8.23 1998/04/07 04:59:46 vixie Exp $"; +#endif /* LIBC_SCCS and not lint */ +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "res_config.h" + +#define SPRINTF(x) ((size_t)sprintf x) + +static const char AskedForGot[] = + "gethostby*.gethostanswer: asked for \"%s\", got \"%s\""; + +#ifdef RESOLVSORT +static void addrsort(char **, int); +#endif + +u_int32_t _getlong(const u_char *src); +u_int16_t _getshort(const u_char *src); + +#ifdef DEBUG +static void dprintf(char *, int); +#endif + +#if PACKETSZ > 1024 +#define MAXPACKET PACKETSZ +#else +#define MAXPACKET 1024 +#endif + +typedef union { + HEADER hdr; + u_char buf[MAXPACKET]; +} querybuf; + +typedef union { + int32_t al; + char ac; +} align; + +extern int h_errno; +int _dns_ttl_; + +#ifdef DEBUG +static void +dprintf(msg, num) + char *msg; + int num; +{ + if (_res.options & RES_DEBUG) { + int save = errno; + + printf(msg, num); + errno = save; + } +} +#else +# define dprintf(msg, num) /*nada*/ +#endif + +#define BOUNDED_INCR(x) \ + do { \ + cp += x; \ + if (cp > eom) { \ + *herr = NO_RECOVERY; \ + return (NULL); \ + } \ + } while (0) + +#define BOUNDS_CHECK(ptr, count) \ + do { \ + if ((ptr) + (count) > eom) { \ + *herr = NO_RECOVERY; \ + return (NULL); \ + } \ + } while (0) + +static struct hostent * +gethostanswer(answer, anslen, qname, qtype, host, hostbuf, hostbuflen, herr) + const querybuf *answer; + int anslen; + const char *qname; + int qtype; + struct hostent *host; + char *hostbuf; + int hostbuflen; + int *herr; +{ + const HEADER *hp; + const u_char *cp; + int n; + const u_char *eom, *erdata; + char *bp, **ap, **hap; + int type, class, buflen, ancount, qdcount; + int haveanswer, had_error; + int toobig = 0; + char tbuf[MAXDNAME]; + const char *tname; + int (*name_ok)(const char *); + + tname = qname; + host->h_name = NULL; + eom = answer->buf + anslen; + switch (qtype) { + case T_A: + case T_AAAA: + name_ok = res_hnok; + break; + case T_PTR: + name_ok = res_dnok; + break; + default: + *herr = NO_RECOVERY; + return (NULL); /* XXX should be abort(); */ + } + /* + * find first satisfactory answer + */ + hp = &answer->hdr; + ancount = ntohs(hp->ancount); + qdcount = ntohs(hp->qdcount); + bp = hostbuf; + buflen = hostbuflen; + cp = answer->buf; + BOUNDED_INCR(HFIXEDSZ); + if (qdcount != 1) { + *herr = NO_RECOVERY; + return (NULL); + } + n = dn_expand(answer->buf, eom, cp, bp, buflen); + if ((n < 0) || !(*name_ok)(bp)) { + *herr = NO_RECOVERY; + return (NULL); + } + BOUNDED_INCR(n + QFIXEDSZ); + if (qtype == T_A || qtype == T_AAAA) { + /* res_send() has already verified that the query name is the + * same as the one we sent; this just gets the expanded name + * (i.e., with the succeeding search-domain tacked on). + */ + n = strlen(bp) + 1; /* for the \0 */ + if (n >= MAXHOSTNAMELEN) { + *herr = NO_RECOVERY; + return (NULL); + } + host->h_name = bp; + bp += n; + buflen -= n; + /* The qname can be abbreviated, but h_name is now absolute. */ + qname = host->h_name; + } + ap = host->__host_aliases; + *ap = NULL; + host->h_aliases = host->__host_aliases; + hap = host->__host_addrs; + *hap = NULL; + host->h_addr_list = host->__host_addrs; + haveanswer = 0; + had_error = 0; + _dns_ttl_ = -1; + while (ancount-- > 0 && cp < eom && !had_error) { + n = dn_expand(answer->buf, eom, cp, bp, buflen); + if ((n < 0) || !(*name_ok)(bp)) { + had_error++; + continue; + } + cp += n; /* name */ + BOUNDS_CHECK(cp, 3 * INT16SZ + INT32SZ); + type = _getshort(cp); + cp += INT16SZ; /* type */ + class = _getshort(cp); + cp += INT16SZ; /* class */ + if (qtype == T_A && type == T_A) + _dns_ttl_ = _getlong(cp); + cp += INT32SZ; /* TTL */ + n = _getshort(cp); + cp += INT16SZ; /* len */ + BOUNDS_CHECK(cp, n); + erdata = cp + n; + if (class != C_IN) { + /* XXX - debug? syslog? */ + cp += n; + continue; /* XXX - had_error++ ? */ + } + if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) { + if (ap >= &host->__host_aliases[MAXALIASES-1]) + continue; + n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); + if ((n < 0) || !(*name_ok)(tbuf)) { + had_error++; + continue; + } + cp += n; + if (cp != erdata) { + *herr = NO_RECOVERY; + return (NULL); + } + /* Store alias. */ + *ap++ = bp; + n = strlen(bp) + 1; /* for the \0 */ + if (n >= MAXHOSTNAMELEN) { + had_error++; + continue; + } + bp += n; + buflen -= n; + /* Get canonical name. */ + n = strlen(tbuf) + 1; /* for the \0 */ + if (n > buflen || n >= MAXHOSTNAMELEN) { + had_error++; + continue; + } + strcpy(bp, tbuf); + host->h_name = bp; + bp += n; + buflen -= n; + continue; + } + if (qtype == T_PTR && type == T_CNAME) { + n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); + if (n < 0 || !res_dnok(tbuf)) { + had_error++; + continue; + } + cp += n; + if (cp != erdata) { + *herr = NO_RECOVERY; + return (NULL); + } + /* Get canonical name. */ + n = strlen(tbuf) + 1; /* for the \0 */ + if (n > buflen || n >= MAXHOSTNAMELEN) { + had_error++; + continue; + } + strcpy(bp, tbuf); + tname = bp; + bp += n; + buflen -= n; + continue; + } + if (type != qtype) { + if (type != T_SIG) + syslog(LOG_NOTICE|LOG_AUTH, + "gethostby*.gethostanswer: asked for \"%s %s %s\", got type \"%s\"", + qname, p_class(C_IN), p_type(qtype), + p_type(type)); + cp += n; + continue; /* XXX - had_error++ ? */ + } + switch (type) { + case T_PTR: + if (strcasecmp(tname, bp) != 0) { + syslog(LOG_NOTICE|LOG_AUTH, + AskedForGot, qname, bp); + cp += n; + continue; /* XXX - had_error++ ? */ + } + n = dn_expand(answer->buf, eom, cp, bp, buflen); + if ((n < 0) || !res_hnok(bp)) { + had_error++; + break; + } +#if MULTI_PTRS_ARE_ALIASES + cp += n; + if (cp != erdata) { + *herr = NO_RECOVERY; + return (NULL); + } + if (!haveanswer) + host->h_name = bp; + else if (ap < &host->__host_aliases[MAXALIASES-1]) + *ap++ = bp; + else + n = -1; + if (n != -1) { + n = strlen(bp) + 1; /* for the \0 */ + if (n >= MAXHOSTNAMELEN) { + had_error++; + break; + } + bp += n; + buflen -= n; + } + break; +#else + host->h_name = bp; + if (_res.options & RES_USE_INET6) { + n = strlen(bp) + 1; /* for the \0 */ + if (n >= MAXHOSTNAMELEN) { + had_error++; + break; + } + bp += n; + buflen -= n; + _map_v4v6_hostent(host, &bp, &buflen); + } + *herr = NETDB_SUCCESS; + return host; +#endif + case T_A: + case T_AAAA: + if (strcasecmp(host->h_name, bp) != 0) { + syslog(LOG_NOTICE|LOG_AUTH, + AskedForGot, host->h_name, bp); + cp += n; + continue; /* XXX - had_error++ ? */ + } + if (n != host->h_length) { + cp += n; + continue; + } + if (!haveanswer) { + int nn; + + host->h_name = bp; + nn = strlen(bp) + 1; /* for the \0 */ + bp += nn; + buflen -= nn; + } + + bp += sizeof(align) - ((u_long)bp % sizeof(align)); + + if (bp + n >= &hostbuf[hostbuflen]) { + dprintf("size (%d) too big\n", n); + had_error++; + continue; + } + if (hap >= &host->__host_addrs[MAXADDRS-1]) { + if (!toobig++) + dprintf("Too many addresses (%d)\n", + MAXADDRS); + cp += n; + continue; + } + bcopy(cp, *hap++ = bp, n); + bp += n; + buflen -= n; + cp += n; + if (cp != erdata) { + *herr = NO_RECOVERY; + return (NULL); + } + break; + default: + dprintf("Impossible condition (type=%d)\n", type); + *herr = NO_RECOVERY; + return (NULL); + /* BIND has abort() here, too risky on bad data */ + } + if (!had_error) + haveanswer++; + } + if (haveanswer) { + *ap = NULL; + *hap = NULL; +# if defined(RESOLVSORT) + /* + * Note: we sort even if host can take only one address + * in its return structures - should give it the "best" + * address in that case, not some random one + */ + if (_res.nsort && haveanswer > 1 && qtype == T_A) + addrsort(host->__host_addrs, haveanswer); +# endif /*RESOLVSORT*/ + if (!host->h_name) { + n = strlen(qname) + 1; /* for the \0 */ + if (n > buflen || n >= MAXHOSTNAMELEN) + goto no_recovery; + strcpy(bp, qname); + host->h_name = bp; + bp += n; + buflen -= n; + } + if (_res.options & RES_USE_INET6) + _map_v4v6_hostent(host, &bp, &buflen); + *herr = NETDB_SUCCESS; + return host; + } + no_recovery: + *herr = NO_RECOVERY; + return (NULL); +} + +struct hostent * +__dns_getanswer(answer, anslen, qname, qtype, host, hostbuf, hostbuflen, herr) + const char *answer; + int anslen; + const char *qname; + int qtype; + struct hostent *host; + char *hostbuf; + int hostbuflen; + int *herr; +{ + switch(qtype) { + case T_AAAA: + host->h_addrtype = AF_INET6; + host->h_length = IN6ADDRSZ; + break; + case T_A: + default: + host->h_addrtype = AF_INET; + host->h_length = INADDRSZ; + break; + } + + return(gethostanswer((const querybuf *)answer, anslen, qname, qtype, host, hostbuf, hostbuflen, herr)); +} + +int +_dns_gethostbyname(void *rval, void *cb_data, va_list ap) +{ + const char *name; + int af; + querybuf buf; + const char *cp; + char *bp; + int n, size, type, len; + struct hostent *resultbuf; + char *hostbuf; + int buflen; + int *herr; + + name = va_arg(ap, const char *); + af = va_arg(ap, int); + resultbuf = va_arg(ap, struct hostent *); + hostbuf = va_arg(ap, char *); + buflen = va_arg(ap, int); + herr = va_arg(ap, int *); + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + *herr = NETDB_INTERNAL; + return NS_UNAVAIL; + } + + switch (af) { + case AF_INET: + size = INADDRSZ; + type = T_A; + break; + case AF_INET6: + size = IN6ADDRSZ; + type = T_AAAA; + break; + default: + *herr = NETDB_INTERNAL; + errno = EAFNOSUPPORT; + return NS_UNAVAIL; + } + + resultbuf->h_addrtype = af; + resultbuf->h_length = size; + + /* + * if there aren't any dots, it could be a user-level alias. + * this is also done in res_query() since we are not the only + * function that looks up host names. + */ + if (!strchr(name, '.') && (cp = __hostalias(name))) + name = cp; + + /* + * disallow names consisting only of digits/dots, unless + * they end in a dot. + */ + if (isdigit((unsigned char)name[0])) + for (cp = name;; ++cp) { + if (!*cp) { + if (*--cp == '.') + break; + /* + * All-numeric, no dot at the end. + * Fake up a hostent as if we'd actually + * done a lookup. + */ + if (inet_pton(af, name, resultbuf->__host_addr) <= 0) { + *herr = HOST_NOT_FOUND; + return NS_NOTFOUND; + } + strncpy(hostbuf, name, MAXDNAME); + hostbuf[MAXDNAME] = '\0'; + bp = hostbuf + MAXDNAME; + len = buflen - MAXDNAME; + resultbuf->h_name = hostbuf; + resultbuf->h_aliases = resultbuf->__host_aliases; + resultbuf->__host_aliases[0] = NULL; + resultbuf->__host_addrs[0] = (char *)resultbuf->__host_addr; + resultbuf->__host_addrs[1] = NULL; + resultbuf->h_addr_list = resultbuf->__host_addrs; + if (_res.options & RES_USE_INET6) + _map_v4v6_hostent(resultbuf, &bp, &len); + *herr = NETDB_SUCCESS; + *(struct hostent **)rval = resultbuf; + return NS_SUCCESS; + } + if (!isdigit((unsigned char)*cp) && *cp != '.') + break; + } + if ((isxdigit((unsigned char)name[0]) && strchr(name, ':') != NULL) || + name[0] == ':') + for (cp = name;; ++cp) { + if (!*cp) { + if (*--cp == '.') + break; + /* + * All-IPv6-legal, no dot at the end. + * Fake up a hostent as if we'd actually + * done a lookup. + */ + if (inet_pton(af, name, resultbuf->__host_addr) <= 0) { + *herr = HOST_NOT_FOUND; + return NS_NOTFOUND; + } + strncpy(hostbuf, name, MAXDNAME); + hostbuf[MAXDNAME] = '\0'; + bp = hostbuf + MAXDNAME; + len = buflen - MAXDNAME; + resultbuf->h_name = hostbuf; + resultbuf->h_aliases = resultbuf->__host_aliases; + resultbuf->__host_aliases[0] = NULL; + resultbuf->__host_addrs[0] = (char *)resultbuf->__host_addr; + resultbuf->__host_addrs[1] = NULL; + resultbuf->h_addr_list = resultbuf->__host_addrs; + *herr = NETDB_SUCCESS; + *(struct hostent **)rval = resultbuf; + return NS_SUCCESS; + } + if (!isxdigit((unsigned char)*cp) && *cp != ':' && *cp != '.') + break; + } + + if ((n = res_search(name, C_IN, type, buf.buf, sizeof(buf))) < 0) { + dprintf("res_search failed (%d)\n", n); + return NS_UNAVAIL; + } + *(struct hostent **)rval = gethostanswer(&buf, n, name, type, resultbuf, hostbuf, buflen, herr); + return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} + +int +_dns_gethostbyaddr(void *rval, void *cb_data, va_list ap) +{ + const char *addr; /* XXX should have been def'd as u_char! */ + int len, af; + const u_char *uaddr; + static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff }; + static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 }; + int n, size; + querybuf buf; + struct hostent *hp; + char qbuf[MAXDNAME+1], *qp; +#ifdef SUNSECURITY + struct hostent *rhp; + char **haddr; + u_long old_options; + char hname2[MAXDNAME+1]; +#endif /*SUNSECURITY*/ + struct hostent *resultbuf; + char *hostbuf; + int buflen; + int *herr; + + addr = va_arg(ap, const char *); + uaddr = (const u_char *)addr; + len = va_arg(ap, int); + af = va_arg(ap, int); + resultbuf = va_arg(ap, struct hostent *); + hostbuf = va_arg(ap, char *); + buflen = va_arg(ap, int); + herr = va_arg(ap, int *); + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + *herr = NETDB_INTERNAL; + return NS_UNAVAIL; + } + if (af == AF_INET6 && len == IN6ADDRSZ && + (!memcmp(uaddr, mapped, sizeof mapped) || + !memcmp(uaddr, tunnelled, sizeof tunnelled))) { + /* Unmap. */ + addr += sizeof mapped; + uaddr += sizeof mapped; + af = AF_INET; + len = INADDRSZ; + } + switch (af) { + case AF_INET: + size = INADDRSZ; + break; + case AF_INET6: + size = IN6ADDRSZ; + break; + default: + errno = EAFNOSUPPORT; + *herr = NETDB_INTERNAL; + return NS_UNAVAIL; + } + if (size != len) { + errno = EINVAL; + *herr = NETDB_INTERNAL; + return NS_UNAVAIL; + } + switch (af) { + case AF_INET: + (void) sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa", + (uaddr[3] & 0xff), + (uaddr[2] & 0xff), + (uaddr[1] & 0xff), + (uaddr[0] & 0xff)); + break; + case AF_INET6: + qp = qbuf; + for (n = IN6ADDRSZ - 1; n >= 0; n--) { + qp += SPRINTF((qp, "%x.%x.", + uaddr[n] & 0xf, + (uaddr[n] >> 4) & 0xf)); + } + strcpy(qp, "ip6.int"); + break; + default: + abort(); + } + n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf); + if (n < 0) { + dprintf("res_query failed (%d)\n", n); + return NS_UNAVAIL; + } + if (n > sizeof buf.buf) { + dprintf("static buffer is too small (%d)\n", n); + return NS_UNAVAIL; + } + if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR, resultbuf, hostbuf, buflen, herr))) + return NS_NOTFOUND; /* *herr was set by gethostanswer() */ +#ifdef SUNSECURITY + if (af == AF_INET) { + /* + * turn off search as the name should be absolute, + * 'localhost' should be matched by defnames + */ + strncpy(hname2, hp->h_name, MAXDNAME); + hname2[MAXDNAME] = '\0'; + old_options = _res.options; + _res.options &= ~RES_DNSRCH; + _res.options |= RES_DEFNAMES; + if (!(rhp = gethostbyname(hname2))) { + syslog(LOG_NOTICE|LOG_AUTH, + "gethostbyaddr: No A record for %s (verifying [%s])", + hname2, inet_ntoa(*((struct in_addr *)addr))); + _res.options = old_options; + *herr = HOST_NOT_FOUND; + return NS_NOTFOUND; + } + _res.options = old_options; + for (haddr = rhp->h_addr_list; *haddr; haddr++) + if (!memcmp(*haddr, addr, INADDRSZ)) + break; + if (!*haddr) { + syslog(LOG_NOTICE|LOG_AUTH, + "gethostbyaddr: A record of %s != PTR record [%s]", + hname2, inet_ntoa(*((struct in_addr *)addr))); + *herr = HOST_NOT_FOUND; + return NS_NOTFOUND; + } + } +#endif /*SUNSECURITY*/ + hp->h_addrtype = af; + hp->h_length = len; + bcopy(addr, resultbuf->__host_addr, len); + resultbuf->__host_addrs[0] = (char *)resultbuf->__host_addr; + resultbuf->__host_addrs[1] = NULL; + if (af == AF_INET && (_res.options & RES_USE_INET6)) { + _map_v4v6_address((char*)resultbuf->__host_addr, (char*)resultbuf->__host_addr); + hp->h_addrtype = AF_INET6; + hp->h_length = IN6ADDRSZ; + } + *herr = NETDB_SUCCESS; + *(struct hostent **)rval = hp; + return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} + +#ifdef RESOLVSORT +static void +addrsort(ap, num) + char **ap; + int num; +{ + int i, j; + char **p; + short aval[MAXADDRS]; + int needsort = 0; + + p = ap; + for (i = 0; i < num; i++, p++) { + for (j = 0 ; (unsigned)j < _res.nsort; j++) + if (_res.sort_list[j].addr.s_addr == + (((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask)) + break; + aval[i] = j; + if (needsort == 0 && i > 0 && j < aval[i-1]) + needsort = i; + } + if (!needsort) + return; + + while (needsort < num) { + for (j = needsort - 1; j >= 0; j--) { + if (aval[j] > aval[j+1]) { + char *hp; + + i = aval[j]; + aval[j] = aval[j+1]; + aval[j+1] = i; + + hp = ap[j]; + ap[j] = ap[j+1]; + ap[j+1] = hp; + + } else + break; + } + needsort++; + } +} +#endif +void +_sethostdnsent(stayopen) + int stayopen; +{ + if ((_res.options & RES_INIT) == 0 && res_init() == -1) + return; + if (stayopen) + _res.options |= RES_STAYOPEN | RES_USEVC; +} + +void +_endhostdnsent() +{ + _res.options &= ~(RES_STAYOPEN | RES_USEVC); + res_close(); +} diff --git a/newlib/libc/sys/linux/net/gethostbyht.c b/newlib/libc/sys/linux/net/gethostbyht.c new file mode 100644 index 000000000..4a15293dd --- /dev/null +++ b/newlib/libc/sys/linux/net/gethostbyht.c @@ -0,0 +1,285 @@ +/*- + * Copyright (c) 1985, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* XXX */ +#include /* XXX */ +#include +#include +#include + +static FILE *hostf = NULL; +static int stayopen = 0; +__LOCK_INIT(static, host_lock); + +void +_sethosthtent_r(int f, FILE **hostfile, int *hstayopen) +{ + if (!*hostfile) + *hostfile = fopen(_PATH_HOSTS, "r" ); + else + rewind(*hostfile); + *hstayopen = f; +} + +void +_endhosthtent_r(FILE **hostfile, int *hstayopen) +{ + if (*hostfile && !*hstayopen) { + (void) fclose(*hostfile); + *hostfile = NULL; + } +} + +void +_sethosthtent(f) + int f; +{ + _sethosthtent_r(f, &hostf, &stayopen); +} + +void +_endhosthtent() +{ + _endhosthtent_r(&hostf, &stayopen); +} + +struct hostent * +gethostent() +{ + static struct hostent hp; + static char buffer[BUFSIZ+1]; + static int len = BUFSIZ; + static int herr; + +#ifdef HAVE_DD_LOCK + __lock_acquire(host_lock); +#endif + gethostent_r(&hp, buffer, len, &herr, &hostf); +#ifdef HAVE_DD_LOCK + __lock_release(host_lock); +#endif + return &hp; +} + +int +gethostent_r(struct hostent *hp, char *buffer, int buflen, int *herr, FILE **hostfile) +{ + char *p; + char *cp, **q; + int af, len; + + if (!*hostfile && !(*hostfile = fopen(_PATH_HOSTS, "r" ))) { + *herr = NETDB_INTERNAL; + return -1; + } + again: + if (!(p = fgets(buffer, buflen, *hostfile))) { + *herr = HOST_NOT_FOUND; + return -1; + } + if (*p == '#') + goto again; + if (!(cp = strpbrk(p, "#\n"))) + goto again; + *cp = '\0'; + if (!(cp = strpbrk(p, " \t"))) + goto again; + *cp++ = '\0'; + + hp->h_addr_list = hp->__host_addrs; + hp->__host_addrs[0] = (char *)hp->__host_addr; + + if (inet_pton(AF_INET6, p, hp->h_addr_list[0]) > 0) { + af = AF_INET6; + len = IN6ADDRSZ; + } else if (inet_pton(AF_INET, p, hp->h_addr_list[0]) > 0) { + if (_res.options & RES_USE_INET6) { + _map_v4v6_address(hp->h_addr_list[0], hp->h_addr_list[0]); + af = AF_INET6; + len = IN6ADDRSZ; + } else { + af = AF_INET; + len = INADDRSZ; + } + } else { + goto again; + } + + + hp->h_addr_list[1] = NULL; + hp->h_addr = hp->__host_addrs[0]; + hp->h_length = len; + hp->h_addrtype = af; + + while (*cp == ' ' || *cp == '\t') + cp++; + hp->h_name = cp; + q = hp->h_aliases = hp->__host_aliases; + if ((cp = strpbrk(cp, " \t")) != NULL) + *cp++ = '\0'; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &hp->h_aliases[MAXALIASES - 1]) + *q++ = cp; + if ((cp = strpbrk(cp, " \t")) != NULL) + *cp++ = '\0'; + } + *q = NULL; + + *herr = NETDB_SUCCESS; + return 0; +} + +int +_ht_gethostbyname(void *rval, void *cb_data, va_list ap) +{ + char **cp; + const char *name; + int af; + struct hostent *resultbuf; + char *buf; + int buflen; + int *herr; + FILE *hostfile = NULL; + int stayopen; + int p; + + name = va_arg(ap, const char *); + af = va_arg(ap, int); + resultbuf = va_arg(ap, struct hostent *); + buf = va_arg(ap, char *); + buflen = va_arg(ap, int); + herr = va_arg(ap, int *); + + sethostent_r(0, &hostfile, &stayopen); + while ((p = gethostent_r(resultbuf, buf, buflen, herr, &hostfile)) != -1) { + if (resultbuf->h_addrtype != af) + continue; + if (strcasecmp(resultbuf->h_name, name) == 0) + break; + for (cp = resultbuf->h_aliases; *cp != 0; cp++) + if (strcasecmp(*cp, name) == 0) + goto found; + } +found: + endhostent_r(&hostfile, &stayopen); + + if (p == -1) + { + *(struct hostent **)rval = NULL; + return NS_NOTFOUND; + } + else + { + *(struct hostent **)rval = resultbuf; + return NS_SUCCESS; + } +} + +int +_ht_gethostbyaddr(void *rval, void *cb_data, va_list ap) +{ + const char *addr; + int len, af; + struct hostent *resultbuf; + char *buf; + int buflen; + int *herr; + FILE *hostfile = NULL; + int stayopen; + int p; + + addr = va_arg(ap, const char *); + len = va_arg(ap, int); + af = va_arg(ap, int); + resultbuf = va_arg(ap, struct hostent *); + buf = va_arg(ap, char *); + buflen = va_arg(ap, int); + herr = va_arg(ap, int *); + + sethostent_r(0, &hostfile, &stayopen); + while ((p = gethostent_r(resultbuf, buf, buflen, herr, &hostfile)) != -1) + if (resultbuf->h_addrtype == af && !memcmp(resultbuf->h_addr, addr, len)) + break; + endhostent_r(&hostfile, &stayopen); + + if (p == -1) + { + *(struct hostent **)rval = NULL; + return NS_NOTFOUND; + } + else + { + *(struct hostent **)rval = resultbuf; + return NS_SUCCESS; + } +} diff --git a/newlib/libc/sys/linux/net/gethostbyname.3 b/newlib/libc/sys/linux/net/gethostbyname.3 new file mode 100644 index 000000000..51ed2f864 --- /dev/null +++ b/newlib/libc/sys/linux/net/gethostbyname.3 @@ -0,0 +1,380 @@ +.\" Copyright (c) 1983, 1987, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 +.\" $FreeBSD: src/lib/libc/net/gethostbyname.3,v 1.26 2002/01/14 16:59:00 ru Exp $ +.\" +.Dd May 25, 1995 +.Dt GETHOSTBYNAME 3 +.Os +.Sh NAME +.Nm gethostbyname , +.Nm gethostbyname2 , +.Nm gethostbyaddr , +.Nm gethostent , +.Nm sethostent , +.Nm endhostent , +.Nm herror , +.Nm hstrerror +.Nd get network host entry +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In netdb.h +.Vt extern int h_errno ; +.Ft struct hostent * +.Fn gethostbyname "const char *name" +.Ft struct hostent * +.Fn gethostbyname2 "const char *name" "int af" +.Ft struct hostent * +.Fn gethostbyaddr "const char *addr" "int len" "int type" +.Ft struct hostent * +.Fn gethostent void +.Ft void +.Fn sethostent "int stayopen" +.Ft void +.Fn endhostent void +.Ft void +.Fn herror "const char *string" +.Ft const char * +.Fn hstrerror "int err" +.Sh DESCRIPTION +.Bf -symbolic +The +.Xr getaddrinfo 3 +and +.Xr getnameinfo 3 +functions are preferred over the +.Fn gethostbyname , +.Fn gethostbyname2 , +and +.Fn gethostbyaddr +functions. +.Ef +.Pp +The +.Fn gethostbyname , +.Fn gethostbyname2 +and +.Fn gethostbyaddr +functions +each return a pointer to an object with the +following structure describing an internet host +referenced by name or by address, respectively. +.Pp +The +.Fa name +parameter passed to +.Fn gethostbyname +or +.Fn gethostbyname2 +should point to a +.Dv NUL Ns -terminated +hostname. +The +.Fa addr +parameter passed to +.Fn gethostbyaddr +should point to an address which is +.Fa len +bytes long, +in binary form +(i.e. not an IP address in human readable +.Tn ASCII +form). +The +.Fa type +parameter specifies the address family +(e.g.\& +.Dv AF_INET , AF_INET6 , +etc.) of this address. +.Pp +The structure returned contains either the information obtained from the name +server, +.Xr named 8 , +broken-out fields from a line in +.Pa /etc/hosts , +or database entries supplied by the +.Xr yp 8 +system. +The order of the lookups is controlled by the +.Sq hosts +entry in +.Xr nsswitch.conf 5 . +.Bd -literal +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +}; +#define h_addr h_addr_list[0] /* address, for backward compatibility */ +.Ed +.Pp +The members of this structure are: +.Bl -tag -width h_addr_list +.It Va h_name +Official name of the host. +.It Va h_aliases +A +.Dv NULL Ns -terminated +array of alternate names for the host. +.It Va h_addrtype +The type of address being returned; usually +.Dv AF_INET . +.It Va h_length +The length, in bytes, of the address. +.It Va h_addr_list +A +.Dv NULL Ns -terminated +array of network addresses for the host. +Host addresses are returned in network byte order. +.It Va h_addr +The first address in +.Va h_addr_list ; +this is for backward compatibility. +.El +.Pp +When using the nameserver, +.Fn gethostbyname +and +.Fn gethostbyname2 +will search for the named host in the current domain and its parents +unless the name ends in a dot. +If the name contains no dot, and if the environment variable +.Dq Ev HOSTALIASES +contains the name of an alias file, the alias file will first be searched +for an alias matching the input name. +See +.Xr hostname 7 +for the domain search procedure and the alias file format. +.Pp +The +.Fn gethostbyname2 +function is an evolution of +.Fn gethostbyname +which is intended to allow lookups in address families other than +.Dv AF_INET , +for example +.Dv AF_INET6 . +.Pp +The +.Fn sethostent +function +may be used to request the use of a connected +.Tn TCP +socket for queries. +If the +.Fa stayopen +flag is non-zero, +this sets the option to send all queries to the name server using +.Tn TCP +and to retain the connection after each call to +.Fn gethostbyname , +.Fn gethostbyname2 +or +.Fn gethostbyaddr . +Otherwise, queries are performed using +.Tn UDP +datagrams. +.Pp +The +.Fn endhostent +function +closes the +.Tn TCP +connection. +.Pp +The +.Fn herror +function writes a message to the diagnostic output consisting of the +string parameter +.Fa s , +the constant string +.Qq Li ":\ " , +and a message corresponding to the value of +.Va h_errno . +.Pp +The +.Fn hstrerror +function returns a string which is the message text corresponding to the +value of the +.Fa err +parameter. +.Sh FILES +.Bl -tag -width /etc/nsswitch.conf -compact +.It Pa /etc/hosts +.It Pa /etc/nsswitch.conf +.It Pa /etc/resolv.conf +.El +.Sh EXAMPLES +Print out the hostname associated with a specific IP address: +.Bd -literal -offset indent +const char *ipstr = "127.0.0.1"; +struct in_addr ip; +struct hostent *hp; + +if (!inet_aton(ipstr, &ip)) + errx(1, "can't parse IP address %s", ipstr); + +if ((hp = gethostbyaddr((const char *)&ip, + sizeof ip, AF_INET)) == NULL) + errx(1, "no name associated with %s", ipstr); + +printf("name associated with %s is %s\en", ipstr, hp->h_name); +.Ed +.Sh DIAGNOSTICS +Error return status from +.Fn gethostbyname , +.Fn gethostbyname2 +and +.Fn gethostbyaddr +is indicated by return of a +.Dv NULL +pointer. +The external integer +.Va h_errno +may then be checked to see whether this is a temporary failure +or an invalid or unknown host. +The routine +.Fn herror +can be used to print an error message describing the failure. +If its argument +.Fa string +is +.Pf non- Dv NULL , +it is printed, followed by a colon and a space. +The error message is printed with a trailing newline. +.Pp +The variable +.Va h_errno +can have the following values: +.Bl -tag -width HOST_NOT_FOUND +.It Dv HOST_NOT_FOUND +No such host is known. +.It Dv TRY_AGAIN +This is usually a temporary error +and means that the local server did not receive +a response from an authoritative server. +A retry at some later time may succeed. +.It Dv NO_RECOVERY +Some unexpected server failure was encountered. +This is a non-recoverable error. +.It Dv NO_DATA +The requested name is valid but does not have an IP address; +this is not a temporary error. +This means that the name is known to the name server but there is no address +associated with this name. +Another type of request to the name server using this domain name +will result in an answer; +for example, a mail-forwarder may be registered for this domain. +.El +.Sh SEE ALSO +.Xr getaddrinfo 3 , +.Xr getnameinfo 3 , +.Xr inet_aton 3 , +.Xr resolver 3 , +.Xr hosts 5 , +.Xr hostname 7 , +.Xr named 8 +.Sh CAVEAT +The +.Fn gethostent +function +is defined, and +.Fn sethostent +and +.Fn endhostent +are redefined, +when +.Xr libc 3 +is built to use only the routines to lookup in +.Pa /etc/hosts +and not the name server. +.Pp +The +.Fn gethostent +function +reads the next line of +.Pa /etc/hosts , +opening the file if necessary. +.Pp +The +.Fn sethostent +function +opens and/or rewinds the file +.Pa /etc/hosts . +If the +.Fa stayopen +argument is non-zero, +the file will not be closed after each call to +.Fn gethostbyname , +.Fn gethostbyname2 +or +.Fn gethostbyaddr . +.Pp +The +.Fn endhostent +function +closes the file. +.Sh HISTORY +The +.Fn herror +function appeared in +.Bx 4.3 . +The +.Fn endhostent , +.Fn gethostbyaddr , +.Fn gethostbyname , +.Fn gethostent , +and +.Fn sethostent +functions appeared in +.Bx 4.2 . +The +.Fn gethostbyname2 +function first appeared in +.Tn BIND +version 4.9.4. +.Sh BUGS +These functions use static data storage; +if the data is needed for future use, it should be +copied before any subsequent calls overwrite it. +Only the Internet +address format is currently understood. +.Pp +.Fn gethostbyname2 +cannot perform +.Dv AF_INET6 +lookups over NIS. +.Xr getaddrinfo 3 +must be used instead. diff --git a/newlib/libc/sys/linux/net/gethostbynis.c b/newlib/libc/sys/linux/net/gethostbynis.c new file mode 100644 index 000000000..917e9409d --- /dev/null +++ b/newlib/libc/sys/linux/net/gethostbynis.c @@ -0,0 +1,281 @@ +/*- + * Copyright (c) 1994, Garrett Wollman + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef YP +#include +#include +#include +#endif + +#ifdef YP +static char *host_aliases[MAXALIASES]; +static char hostaddr[MAXADDRS]; +static char *host_addrs[2]; + +static struct hostent * +_gethostbynis(name, map, af) + const char *name; + char *map; + int af; +{ + char *cp, **q; + char *result; + int resultlen,size; + static struct hostent h; + static char *domain = (char *)NULL; + static char ypbuf[YPMAXRECORD + 2]; + + switch(af) { + case AF_INET: + size = NS_INADDRSZ; + break; + default: + case AF_INET6: + size = NS_IN6ADDRSZ; + errno = EAFNOSUPPORT; + h_errno = NETDB_INTERNAL; + return NULL; + } + + if (domain == (char *)NULL) + if (yp_get_default_domain (&domain)) { + h_errno = NETDB_INTERNAL; + return ((struct hostent *)NULL); + } + + if (yp_match(domain, map, name, strlen(name), &result, &resultlen)) { + h_errno = HOST_NOT_FOUND; + return ((struct hostent *)NULL); + } + + /* avoid potential memory leak */ + bcopy((char *)result, (char *)&ypbuf, resultlen); + ypbuf[resultlen] = '\0'; + free(result); + result = (char *)&ypbuf; + + if ((cp = index(result, '\n'))) + *cp = '\0'; + + cp = strpbrk(result, " \t"); + *cp++ = '\0'; + h.h_addr_list = host_addrs; + h.h_addr = hostaddr; + *((u_long *)h.h_addr) = inet_addr(result); + h.h_length = size; + h.h_addrtype = AF_INET; + while (*cp == ' ' || *cp == '\t') + cp++; + h.h_name = cp; + q = h.h_aliases = host_aliases; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &host_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + } + *q = NULL; + return (&h); +} + +static struct hostent * +_gethostbynis_r(name, map, af, hp, buffer, buflen, herr) + const char *name; + char *map; + int af; + struct hostent *hp; + char *buffer; + int buflen; + int *herr; +{ + char *cp, **q; + char *result; + int resultlen,size; + char *domain = (char *)NULL; + + switch(af) { + case AF_INET: + size = NS_INADDRSZ; + break; + default: + case AF_INET6: + size = NS_IN6ADDRSZ; + errno = EAFNOSUPPORT; + *herr = NETDB_INTERNAL; + return NULL; + } + + if (domain == (char *)NULL) + if (yp_get_default_domain (&domain)) { + *herr = NETDB_INTERNAL; + return ((struct hostent *)NULL); + } + + if (yp_match(domain, map, name, strlen(name), &result, &resultlen)) { + *herr = HOST_NOT_FOUND; + return ((struct hostent *)NULL); + } + + /* avoid potential memory leak */ + bcopy((char *)result, buffer, resultlen); + buffer[resultlen] = '\0'; + free(result); + result = buffer; + + if ((cp = index(result, '\n'))) + *cp = '\0'; + + cp = strpbrk(result, " \t"); + *cp++ = '\0'; + *((u_long *)hp->__host_addrs[0]) = inet_addr(result); + hp->__host_addrs[1] = NULL; + hp->h_addr_list = hp->__host_addrs; + hp->h_addr = hp->__host_addrs[0]; + hp->h_length = size; + hp->h_addrtype = AF_INET; + while (*cp == ' ' || *cp == '\t') + cp++; + hp->h_name = cp; + q = hp->__host_aliases; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &hp->__host_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + } + hp->h_aliases = hp->__host_aliases; + *q = NULL; + return (&hp); +} +#endif /* YP */ + +/* XXX _gethostbynisname/_gethostbynisaddr only used by getaddrinfo */ +struct hostent * +_gethostbynisname(const char *name, int af) +{ +#ifdef YP + return _gethostbynis(name, "hosts.byname", af); +#else + return NULL; +#endif +} + +struct hostent * +_gethostbynisaddr(const char *addr, int len, int af) +{ +#ifdef YP + return _gethostbynis(inet_ntoa(*(struct in_addr *)addr), + "hosts.byaddr", af); +#else + return NULL; +#endif +} + + +int +_nis_gethostbyname(void *rval, void *cb_data, va_list ap) +{ +#ifdef YP + const char *name; + int af; + struct hostent *resultbuf; + char *buf; + int buflen; + int *herr; + + name = va_arg(ap, const char *); + af = va_arg(ap, int); + resultbuf = va_arg(ap, struct hostent *); + buf = va_arg(ap, char *); + buflen = va_arg(ap, int); + herr = va_arg(ap, int *); + + *(struct hostent **)rval = _gethostbynis_r(name, "hosts.byname", af, resultbuf, buf, buflen, herr); + + return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; +#else + return NS_UNAVAIL; +#endif +} + +int +_nis_gethostbyaddr(void *rval, void *cb_data, va_list ap) +{ +#ifdef YP + const char *addr; + int len; + int af; + struct hostent *resultbuf; + char *buf; + int buflen; + int *herr; + + addr = va_arg(ap, const char *); + len = va_arg(ap, int); + af = va_arg(ap, int); + resultbuf = va_arg(ap, struct hostent *); + buf = va_arg(ap, char *); + buflen = va_arg(ap, int); + herr = va_arg(ap, int *); + + *(struct hostent **)rval = _gethostbynis_r(inet_ntoa(*(struct in_addr *)addr),"hosts.byaddr", af); + return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; +#else + return NS_UNAVAIL; +#endif +} diff --git a/newlib/libc/sys/linux/net/gethostnamadr.c b/newlib/libc/sys/linux/net/gethostnamadr.c new file mode 100644 index 000000000..de1efd8ed --- /dev/null +++ b/newlib/libc/sys/linux/net/gethostnamadr.c @@ -0,0 +1,221 @@ +/*- + * Copyright (c) 1994, Garrett Wollman + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* XXX hack for _res */ +#include /* XXX hack for _res */ +#include + +extern int _ht_gethostbyname(void *, void *, va_list); +extern int _dns_gethostbyname(void *, void *, va_list); +extern int _nis_gethostbyname(void *, void *, va_list); +extern int _ht_gethostbyaddr(void *, void *, va_list); +extern int _dns_gethostbyaddr(void *, void *, va_list); +extern int _nis_gethostbyaddr(void *, void *, va_list); + +/* Host lookup order if nsswitch.conf is broken or nonexistant */ +static const ns_src default_src[] = { + { NSSRC_FILES, NS_SUCCESS }, + { NSSRC_DNS, NS_SUCCESS }, + { 0 } +}; + +__LOCK_INIT(static, name_lock); +__LOCK_INIT(static, addr_lock); + +struct hostent * +gethostbyname(const char *name) +{ + struct hostent *hp = NULL; + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (NULL); + } + if (_res.options & RES_USE_INET6) { /* XXX */ + hp = gethostbyname2(name, AF_INET6); /* XXX */ + if (hp) /* XXX */ + return (hp); /* XXX */ + } /* XXX */ + return (gethostbyname2(name, AF_INET)); +} + +struct hostent * +gethostbyname2(const char *name, int type) +{ + static struct hostent host, *hp; + static char hostbuf[BUFSIZ]; + static int herr; + int rval; + + static const ns_dtab dtab[] = { + NS_FILES_CB(_ht_gethostbyname, NULL) + { NSSRC_DNS, _dns_gethostbyname, NULL }, + NS_NIS_CB(_nis_gethostbyname, NULL) /* force -DHESIOD */ + { 0 } + }; + +#ifdef HAVE_DD_LOCK + __lock_acquire(name_lock); +#endif + rval = nsdispatch((void *)&hp, dtab, NSDB_HOSTS, "gethostbyname", + default_src, name, type, &host, hostbuf, BUFSIZ, &herr); + +#ifdef HAVE_DD_LOCK + __lock_release(name_lock); +#endif + if (rval != NS_SUCCESS) + return NULL; + else + return hp; +} + +int +__gethostbyname_r(const char *name, struct hostent *result, + void *buffer, int buflen, struct hostent **hp, int *herr) +{ + int rval; + int type; + + static const ns_dtab dtab[] = { + NS_FILES_CB(_ht_gethostbyname, NULL) + { NSSRC_DNS, _dns_gethostbyname, NULL }, + NS_NIS_CB(_nis_gethostbyname, NULL) /* force -DHESIOD */ + { 0 } + }; + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return HOST_NOT_FOUND; + } + + if (_res.options & RES_USE_INET6) + type = AF_INET6; + else + type = AF_INET; + + rval = nsdispatch((void *)hp, dtab, NSDB_HOSTS, "gethostbyname", + default_src, name, type, result, buffer, buflen, herr); + + if (rval != NS_SUCCESS) + return rval; + else + return 0; +} + +struct hostent * +gethostbyaddr(const char *addr, int len, int type) +{ + static struct hostent host, *hp; + static char hostbuf[BUFSIZ]; + static int herr; + int rval; + + static const ns_dtab dtab[] = { + NS_FILES_CB(_ht_gethostbyaddr, NULL) + { NSSRC_DNS, _dns_gethostbyaddr, NULL }, + NS_NIS_CB(_nis_gethostbyaddr, NULL) /* force -DHESIOD */ + { 0 } + }; + +#ifdef HAVE_DD_LOCK + __lock_acquire(addr_lock); +#endif + rval = nsdispatch((void *)&hp, dtab, NSDB_HOSTS, "gethostbyaddr", + default_src, addr, len, type, &host, hostbuf, BUFSIZ, &herr); + +#ifdef HAVE_DD_LOCK + __lock_release(addr_lock); +#endif + if (rval != NS_SUCCESS) + return NULL; + else + return hp; +} + +int +__gethostbyaddr_r (const char *addr, int len, int type, + struct hostent *result, void *buffer, int buflen, + struct hostent **hp, int *herr) +{ + int rval; + + static const ns_dtab dtab[] = { + NS_FILES_CB(_ht_gethostbyaddr, NULL) + { NSSRC_DNS, _dns_gethostbyaddr, NULL }, + NS_NIS_CB(_nis_gethostbyaddr, NULL) /* force -DHESIOD */ + { 0 } + }; + + rval = nsdispatch((void *)hp, dtab, NSDB_HOSTS, "gethostbyaddr", + default_src, addr, len, type, result, buffer, buflen, herr); + + if(rval != NS_SUCCESS) + return rval; + else + return 0; +} + +void +sethostent(stayopen) + int stayopen; +{ + _sethosthtent(stayopen); + _sethostdnsent(stayopen); +} + +void +endhostent() +{ + _endhosthtent(); + _endhostdnsent(); +} + +void +sethostent_r(int f, FILE **hostfile, int *stayopen) +{ + _sethosthtent_r(f, hostfile, stayopen); + _sethostdnsent(f); +} + +void +endhostent_r(FILE **hostfile, int *stayopen) +{ + _endhosthtent_r(hostfile, stayopen); + _endhostdnsent(); +} diff --git a/newlib/libc/sys/linux/net/getifaddrs.3 b/newlib/libc/sys/linux/net/getifaddrs.3 new file mode 100644 index 000000000..47e50049d --- /dev/null +++ b/newlib/libc/sys/linux/net/getifaddrs.3 @@ -0,0 +1,164 @@ +.\" $FreeBSD: src/lib/libc/net/getifaddrs.3,v 1.6 2001/10/01 16:08:55 ru Exp $ +.\" $KAME: getifaddrs.3,v 1.4 2000/05/17 14:13:14 itojun Exp $ +.\" BSDI getifaddrs.3,v 2.5 2000/02/23 14:51:59 dab Exp +.\" +.\" Copyright (c) 1995, 1999 +.\" Berkeley Software Design, Inc. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" +.\" THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.Dd October 12, 1995 +.Dt GETIFADDRS 3 +.Os +.Sh NAME +.Nm getifaddrs +.Nd get interface addresses +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In ifaddrs.h +.Ft int +.Fn getifaddrs "struct ifaddrs **ifap" +.Ft void +.Fn freeifaddrs "struct ifaddrs *ifp" +.Sh DESCRIPTION +The +.Fn getifaddrs +function stores a reference to a linked list of the network interfaces +on the local machine in the memory referenced by +.Fa ifap . +The list consists of +.Nm ifaddrs +structures, as defined in the include file +.Aq Pa ifaddrs.h . +The +.Nm ifaddrs +structure contains at least the following entries: +.Bd -literal + struct ifaddrs *ifa_next; /* Pointer to next struct */ + char *ifa_name; /* Interface name */ + u_int ifa_flags; /* Interface flags */ + struct sockaddr *ifa_addr; /* Interface address */ + struct sockaddr *ifa_netmask; /* Interface netmask */ + struct sockaddr *ifa_broadaddr; /* Interface broadcast address */ + struct sockaddr *ifa_dstaddr; /* P2P interface destination */ + void *ifa_data; /* Address specific data */ +.Ed +.Pp +The +.Li ifa_next +field contains a pointer to the next structure on the list. +This field is +.Dv NULL +in last structure on the list. +.Pp +The +.Li ifa_name +field contains the interface name. +.Pp +The +.Li ifa_flags +field contains the interface flags, as set by +.Xr ifconfig 8 +utility. +.Pp +The +.Li ifa_addr +field references either the address of the interface or the link level +address of the interface, if one exists, otherwise it is NULL. +(The +.Li sa_family +field of the +.Li ifa_addr +field should be consulted to determine the format of the +.Li ifa_addr +address.) +.Pp +The +.Li ifa_netmask +field references the netmask associated with +.Li ifa_addr , +if one is set, otherwise it is NULL. +.Pp +The +.Li ifa_broadaddr +field, +which should only be referenced for non-P2P interfaces, +references the broadcast address associated with +.Li ifa_addr , +if one exists, otherwise it is NULL. +.Pp +The +.Li ifa_dstaddr +field references the destination address on a P2P interface, +if one exists, otherwise it is NULL. +.Pp +The +.Li ifa_data +field references address family specific data. For +.Dv AF_LINK +addresses it contains a pointer to the +.Fa struct if_data +(as defined in include file +.Aq Pa net/if.h ) +which contains various interface attributes and statistics. +For all other address families, it contains a pointer to the +.Fa struct ifa_data +(as defined in include file +.Aq Pa net/if.h ) +which contains per-address interface statistics. +.Pp +The data returned by +.Fn getifaddrs +is dynamically allocated and should be freed using +.Fn freeifaddrs +when no longer needed. +.Sh RETURN VALUES +.Rv -std getifaddrs +.Sh ERRORS +The +.Fn getifaddrs +may fail and set +.Va errno +for any of the errors specified for the library routines +.Xr ioctl 2 , +.Xr socket 2 , +.Xr malloc 3 +or +.Xr sysctl 3 . +.Sh BUGS +If both +.Aq Pa net/if.h +and +.Aq Pa ifaddrs.h +are being included, +.Aq Pa net/if.h +.Em must +be included before +.Aq Pa ifaddrs.h . +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr socket 2 , +.Xr sysctl 3 , +.Xr networking 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +implementation first appeared in BSDi +.Bsx . diff --git a/newlib/libc/sys/linux/net/getifaddrs.c b/newlib/libc/sys/linux/net/getifaddrs.c new file mode 100644 index 000000000..fdb8c9b9d --- /dev/null +++ b/newlib/libc/sys/linux/net/getifaddrs.c @@ -0,0 +1,401 @@ +/* $KAME: getifaddrs.c,v 1.9 2001/08/20 02:31:20 itojun Exp $ */ + +/* + * Copyright (c) 1995, 1999 + * Berkeley Software Design, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp + */ +/* + * NOTE: SIOCGIFCONF case is not LP64 friendly. it also does not perform + * try-and-error for region size. + */ + +#include +#include +#include +#include +#include + +#include "namespace.h" +#include +#include +#include +#include +#ifdef NET_RT_IFLIST +#include +#include +#include +#include +#endif + +#include +#include +#include +#include "un-namespace.h" + +#if !defined(AF_LINK) +#define SA_LEN(sa) sizeof(struct sockaddr) +#endif + +#if !defined(SA_LEN) +#define SA_LEN(sa) sizeof(struct sockaddr) +#endif + +#define SALIGN (sizeof(long) - 1) +#define SA_RLEN(sa) (sizeof(struct sockaddr) ? ((sizeof(struct sockaddr) + SALIGN) & ~SALIGN) : (SALIGN + 1)) + +#ifndef ALIGNBYTES +/* + * On systems with a routing socket, ALIGNBYTES should match the value + * that the kernel uses when building the messages. + */ +#define ALIGNBYTES XXX +#endif +#ifndef ALIGN +#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) +#endif + +#if _BSDI_VERSION >= 199701 +#define HAVE_IFM_DATA +#endif + +#if _BSDI_VERSION >= 199802 +/* ifam_data is very specific to recent versions of bsdi */ +#define HAVE_IFAM_DATA +#endif + +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#define HAVE_IFM_DATA +#endif + +int +getifaddrs(struct ifaddrs **pif) +{ + int icnt = 1; + int dcnt = 0; + int ncnt = 0; +#ifdef NET_RT_IFLIST + int mib[6]; + size_t needed; + char *buf; + char *next; + struct ifaddrs *cif = 0; + char *p, *p0; + struct rt_msghdr *rtm; + struct if_msghdr *ifm; + struct ifa_msghdr *ifam; + struct sockaddr_dl *dl; + struct sockaddr *sa; + struct ifaddrs *ifa, *ift; + u_short idx = 0; +#else /* NET_RT_IFLIST */ + struct ifaddrs *ifa, *ift; + char buf[1024]; + int m, sock; + struct ifconf ifc; + struct ifreq *ifr; + struct ifreq *lifr; +#endif /* NET_RT_IFLIST */ + int i; + size_t len, alen; + char *data; + char *names; + +#ifdef NET_RT_IFLIST + mib[0] = CTL_NET; + mib[1] = PF_ROUTE; + mib[2] = 0; /* protocol */ + mib[3] = 0; /* wildcard address family */ + mib[4] = NET_RT_IFLIST; + mib[5] = 0; /* no flags */ + if (__sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + return (-1); + if ((buf = malloc(needed)) == NULL) + return (-1); + if (__sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { + free(buf); + return (-1); + } + + for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { + rtm = (struct rt_msghdr *)(void *)next; + if (rtm->rtm_version != RTM_VERSION) + continue; + switch (rtm->rtm_type) { + case RTM_IFINFO: + ifm = (struct if_msghdr *)(void *)rtm; + if (ifm->ifm_addrs & RTA_IFP) { + idx = ifm->ifm_index; + ++icnt; + dl = (struct sockaddr_dl *)(void *)(ifm + 1); + dcnt += SA_RLEN((struct sockaddr *)(void*)dl) + + ALIGNBYTES; +#ifdef HAVE_IFM_DATA + dcnt += sizeof(ifm->ifm_data); +#endif /* HAVE_IFM_DATA */ + ncnt += dl->sdl_nlen + 1; + } else + idx = 0; + break; + + case RTM_NEWADDR: + ifam = (struct ifa_msghdr *)(void *)rtm; + if (idx && ifam->ifam_index != idx) + abort(); /* this cannot happen */ + +#define RTA_MASKS (RTA_NETMASK | RTA_IFA | RTA_BRD) + if (idx == 0 || (ifam->ifam_addrs & RTA_MASKS) == 0) + break; + p = (char *)(void *)(ifam + 1); + ++icnt; +#ifdef HAVE_IFAM_DATA + dcnt += sizeof(ifam->ifam_data) + ALIGNBYTES; +#endif /* HAVE_IFAM_DATA */ + /* Scan to look for length of address */ + alen = 0; + for (p0 = p, i = 0; i < RTAX_MAX; i++) { + if ((RTA_MASKS & ifam->ifam_addrs & (1 << i)) + == 0) + continue; + sa = (struct sockaddr *)(void *)p; + len = SA_RLEN(sa); + if (i == RTAX_IFA) { + alen = len; + break; + } + p += len; + } + for (p = p0, i = 0; i < RTAX_MAX; i++) { + if ((RTA_MASKS & ifam->ifam_addrs & (1 << i)) + == 0) + continue; + sa = (struct sockaddr *)(void *)p; + len = SA_RLEN(sa); + if (i == RTAX_NETMASK && SA_LEN(sa) == 0) + dcnt += alen; + else + dcnt += len; + p += len; + } + break; + } + } +#else /* NET_RT_IFLIST */ + ifc.ifc_buf = buf; + ifc.ifc_len = sizeof(buf); + + if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) + return (-1); + i = ioctl(sock, SIOCGIFCONF, (char *)&ifc); + close(sock); + if (i < 0) + return (-1); + + ifr = ifc.ifc_req; + lifr = (struct ifreq *)&ifc.ifc_buf[ifc.ifc_len]; + + while (ifr < lifr) { + struct sockaddr *sa; + + sa = &ifr->ifr_addr; + ++icnt; + dcnt += SA_RLEN(sa); + ncnt += sizeof(ifr->ifr_name) + 1; + + if (SA_LEN(sa) < sizeof(*sa)) + ifr = (struct ifreq *)(((char *)sa) + sizeof(*sa)); + else + ifr = (struct ifreq *)(((char *)sa) + SA_LEN(sa)); + } +#endif /* NET_RT_IFLIST */ + + if (icnt + dcnt + ncnt == 1) { + *pif = NULL; + free(buf); + return (0); + } + data = malloc(sizeof(struct ifaddrs) * icnt + dcnt + ncnt); + if (data == NULL) { + free(buf); + return(-1); + } + + ifa = (struct ifaddrs *)(void *)data; + data += sizeof(struct ifaddrs) * icnt; + names = data + dcnt; + + memset(ifa, 0, sizeof(struct ifaddrs) * icnt); + ift = ifa; + +#ifdef NET_RT_IFLIST + idx = 0; + for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { + rtm = (struct rt_msghdr *)(void *)next; + if (rtm->rtm_version != RTM_VERSION) + continue; + switch (rtm->rtm_type) { + case RTM_IFINFO: + ifm = (struct if_msghdr *)(void *)rtm; + if (ifm->ifm_addrs & RTA_IFP) { + idx = ifm->ifm_index; + dl = (struct sockaddr_dl *)(void *)(ifm + 1); + + cif = ift; + ift->ifa_name = names; + ift->ifa_flags = (int)ifm->ifm_flags; + memcpy(names, dl->sdl_data, + (size_t)dl->sdl_nlen); + names[dl->sdl_nlen] = 0; + names += dl->sdl_nlen + 1; + + ift->ifa_addr = (struct sockaddr *)(void *)data; + memcpy(data, dl, + (size_t)SA_LEN((struct sockaddr *) + (void *)dl)); + data += SA_RLEN((struct sockaddr *)(void *)dl); + +#ifdef HAVE_IFM_DATA + /* ifm_data needs to be aligned */ + ift->ifa_data = data = (void *)ALIGN(data); + memcpy(data, &ifm->ifm_data, sizeof(ifm->ifm_data)); + data += sizeof(ifm->ifm_data); +#else /* HAVE_IFM_DATA */ + ift->ifa_data = NULL; +#endif /* HAVE_IFM_DATA */ + + ift = (ift->ifa_next = ift + 1); + } else + idx = 0; + break; + + case RTM_NEWADDR: + ifam = (struct ifa_msghdr *)(void *)rtm; + if (idx && ifam->ifam_index != idx) + abort(); /* this cannot happen */ + + if (idx == 0 || (ifam->ifam_addrs & RTA_MASKS) == 0) + break; + ift->ifa_name = cif->ifa_name; + ift->ifa_flags = cif->ifa_flags; + ift->ifa_data = NULL; + p = (char *)(void *)(ifam + 1); + /* Scan to look for length of address */ + alen = 0; + for (p0 = p, i = 0; i < RTAX_MAX; i++) { + if ((RTA_MASKS & ifam->ifam_addrs & (1 << i)) + == 0) + continue; + sa = (struct sockaddr *)(void *)p; + len = SA_RLEN(sa); + if (i == RTAX_IFA) { + alen = len; + break; + } + p += len; + } + for (p = p0, i = 0; i < RTAX_MAX; i++) { + if ((RTA_MASKS & ifam->ifam_addrs & (1 << i)) + == 0) + continue; + sa = (struct sockaddr *)(void *)p; + len = SA_RLEN(sa); + switch (i) { + case RTAX_IFA: + ift->ifa_addr = + (struct sockaddr *)(void *)data; + memcpy(data, p, len); + data += len; + break; + + case RTAX_NETMASK: + ift->ifa_netmask = + (struct sockaddr *)(void *)data; + if (SA_LEN(sa) == 0) { + memset(data, 0, alen); + data += alen; + break; + } + memcpy(data, p, len); + data += len; + break; + + case RTAX_BRD: + ift->ifa_broadaddr = + (struct sockaddr *)(void *)data; + memcpy(data, p, len); + data += len; + break; + } + p += len; + } + +#ifdef HAVE_IFAM_DATA + /* ifam_data needs to be aligned */ + ift->ifa_data = data = (void *)ALIGN(data); + memcpy(data, &ifam->ifam_data, sizeof(ifam->ifam_data)); + data += sizeof(ifam->ifam_data); +#endif /* HAVE_IFAM_DATA */ + + ift = (ift->ifa_next = ift + 1); + break; + } + } + + free(buf); +#else /* NET_RT_IFLIST */ + ifr = ifc.ifc_req; + lifr = (struct ifreq *)&ifc.ifc_buf[ifc.ifc_len]; + + while (ifr < lifr) { + struct sockaddr *sa; + + ift->ifa_name = names; + names[sizeof(ifr->ifr_name)] = 0; + strncpy(names, ifr->ifr_name, sizeof(ifr->ifr_name)); + while (*names++) + ; + + ift->ifa_addr = (struct sockaddr *)data; + sa = &ifr->ifr_addr; + memcpy(data, sa, SA_LEN(sa)); + data += SA_RLEN(sa); + + ifr = (struct ifreq *)(((char *)sa) + SA_LEN(sa)); + ift = (ift->ifa_next = ift + 1); + } +#endif /* NET_RT_IFLIST */ + if (--ift >= ifa) { + ift->ifa_next = NULL; + *pif = ifa; + } else { + *pif = NULL; + free(ifa); + } + return (0); +} + +void +freeifaddrs(struct ifaddrs *ifp) +{ + + free(ifp); +} diff --git a/newlib/libc/sys/linux/net/getipnodebyname.3 b/newlib/libc/sys/linux/net/getipnodebyname.3 new file mode 100644 index 000000000..5b8ea1ecb --- /dev/null +++ b/newlib/libc/sys/linux/net/getipnodebyname.3 @@ -0,0 +1,461 @@ +.\" $FreeBSD: src/lib/libc/net/getipnodebyname.3,v 1.8 2001/10/01 16:08:55 ru Exp $ +.\" $KAME: getipnodebyname.3,v 1.6 2000/08/09 21:16:17 itojun Exp $ +.\" +.\" Copyright (c) 1983, 1987, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 +.\" +.Dd May 25, 1995 +.Dt GETIPNODEBYNAME 3 +.Os +.\" +.Sh NAME +.Nm getipnodebyname , +.Nm getipnodebyaddr , +.Nm freehostent +.Nd nodename-to-address and address-to-nodename translation +.\" +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In netdb.h +.Ft "struct hostent *" +.Fn getipnodebyname "const char *name" "int af" "int flags" "int *error_num" +.Ft "struct hostent *" +.Fn getipnodebyaddr "const void *src" "size_t len" "int af" "int *error_num" +.Ft void +.Fn freehostent "struct hostent *ptr" +.\" +.Sh DESCRIPTION +.Fn getipnodebyname +and +.Fn getipnodebyaddr +functions are very similar to +.Xr gethostbyname 3 , +.Xr gethostbyname2 3 +and +.Xr gethostbyaddr 3 . +The functions cover all the functionalities provided by the older ones, +and provide better interface to programmers. +The functions require additional arguments, +.Ar af , +and +.Ar flags , +for specifying address family and operation mode. +The additional arguments allow programmer to get address for a nodename, +for specific address family +(such as +.Dv AF_INET +or +.Dv AF_INET6 ) . +The functions also require an additional pointer argument, +.Ar error_num +to return the appropriate error code, +to support thread safe error code returns. +.Pp +The type and usage of the return value, +.Li "struct hostent" +is described in +.Xr gethostbyname 3 . +.Pp +For +.Fn getipnodebyname , +the +.Ar name +argument can be either a node name or a numeric address +string +(i.e., a dotted-decimal IPv4 address or an IPv6 hex address). +The +.Ar af +argument specifies the address family, either +.Dv AF_INET +or +.Dv AF_INET6 . +The +.Ar flags +argument specifies the types of addresses that are searched for, +and the types of addresses that are returned. +We note that a special flags value of +.Dv AI_DEFAULT +(defined below) +should handle most applications. +That is, porting simple applications to use IPv6 replaces the call +.Bd -literal -offset + hptr = gethostbyname(name); +.Ed +.Pp +with +.Bd -literal -offset + hptr = getipnodebyname(name, AF_INET6, AI_DEFAULT, &error_num); +.Ed +.Pp +Applications desiring finer control over the types of addresses +searched for and returned, can specify other combinations of the +.Ar flags +argument. +.Pp +A +.Ar flags +of +.Li 0 +implies a strict interpretation of the +.Ar af +argument: +.Bl -bullet +.It +If +.Ar flags +is 0 and +.Ar af +is +.Dv AF_INET , +then the caller wants only IPv4 addresses. +A query is made for +.Li A +records. +If successful, the IPv4 addresses are returned and the +.Li h_length +member of the +.Li hostent +structure will be 4, else the function returns a +.Dv NULL +pointer. +.It +If +.Ar flags +is 0 and if +.Ar af +is +.Li AF_INET6 , +then the caller wants only IPv6 addresses. +A query is made for +.Li AAAA +records. +If successful, the IPv6 addresses are returned and the +.Li h_length +member of the +.Li hostent +structure will be 16, else the function returns a +.Dv NULL +pointer. +.El +.Pp +Other constants can be logically-ORed into the +.Ar flags +argument, to modify the behavior of the function. +.Bl -bullet +.It +If the +.Dv AI_V4MAPPED +flag is specified along with an +.Ar af +of +.Dv AF_INET6 , +then the caller will accept IPv4-mapped IPv6 addresses. +That is, if no +.Li AAAA +records are found then a query is made for +.Li A +records and any found are returned as IPv4-mapped IPv6 addresses +.Li ( h_length +will be 16). +The +.Dv AI_V4MAPPED +flag is ignored unless +.Ar af +equals +.Dv AF_INET6 . +.It +The +.Dv AI_V4MAPPED_CFG +flag is exact same as the +.Dv AI_V4MAPPED +flag only if the kernel supports IPv4-mapped IPv6 address. +.It +If the +.Dv AI_ALL +flag is used in conjunction with the +.Dv AI_V4MAPPED +flag, and only used with the IPv6 address family. +When +.Dv AI_ALL +is logically or'd with +.Dv AI_V4MAPPED +flag then the caller wants all addresses: IPv6 and IPv4-mapped IPv6. +A query is first made for +.Li AAAA +records and if successful, the +IPv6 addresses are returned. Another query is then made for +.Li A +records and any found are returned as IPv4-mapped IPv6 addresses. +.Li h_length +will be 16. Only if both queries fail does the function +return a +.Dv NULL +pointer. This flag is ignored unless af equals +AF_INET6. If both +.Dv AI_ALL +and +.Dv AI_V4MAPPED +are specified, +.Dv AI_ALL +takes precedence. +.It +The +.Dv AI_ADDRCONFIG +flag specifies that a query for +.Li AAAA +records +should occur only if the node has at least one IPv6 source +address configured and a query for +.Li A +records should occur only if the node has at least one IPv4 source address +configured. +.Pp +For example, if the node has no IPv6 source addresses configured, +and +.Ar af +equals AF_INET6, and the node name being looked up has both +.Li AAAA +and +.Li A +records, then: +(a) if only +.Dv AI_ADDRCONFIG +is +specified, the function returns a +.Dv NULL +pointer; +(b) if +.Dv AI_ADDRCONFIG +| +.Dv AI_V4MAPPED +is specified, the +.Li A +records are returned as IPv4-mapped IPv6 addresses; +.El +.Pp +The special flags value of +.Dv AI_DEFAULT +is defined as +.Bd -literal -offset + #define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) +.Ed +.Pp +We noted that the +.Fn getipnodebyname +function must allow the +.Ar name +argument to be either a node name or a literal address string +(i.e., a dotted-decimal IPv4 address or an IPv6 hex address). +This saves applications from having to call +.Xr inet_pton 3 +to handle literal address strings. +When the +.Ar name +argument is a literal address string, +the +.Ar flags +argument is always ignored. +.Pp +There are four scenarios based on the type of literal address string +and the value of the +.Ar af +argument. +The two simple cases are when +.Ar name +is a dotted-decimal IPv4 address and +.Ar af +equals +.Dv AF_INET , +or when +.Ar name +is an IPv6 hex address and +.Ar af +equals +.Dv AF_INET6 . +The members of the +returned hostent structure are: +.Li h_name +points to a copy of the +.Ar name +argument, +.Li h_aliases +is a +.Dv NULL +pointer, +.Li h_addrtype +is a copy of the +.Ar af +argument, +.Li h_length +is either 4 +(for +.Dv AF_INET ) +or 16 +(for +.Dv AF_INET6 ) , +.Li h_addr_list[0] +is a pointer to the 4-byte or 16-byte binary address, +and +.Li h_addr_list[1] +is a +.Dv NULL +pointer. +.Pp +When +.Ar name +is a dotted-decimal IPv4 address and +.Ar af +equals +.Dv AF_INET6 , +and +.Dv AI_V4MAPPED +is specified, +an IPv4-mapped IPv6 address is returned: +.Li h_name +points to an IPv6 hex address containing the IPv4-mapped IPv6 address, +.Li h_aliases +is a +.Dv NULL +pointer, +.Li h_addrtype +is +.Dv AF_INET6 , +.Li h_length +is 16, +.Li h_addr_list[0] +is a pointer to the 16-byte binary address, and +.Li h_addr_list[1] +is a +.Dv NULL +pointer. +.Pp +It is an error when +.Ar name +is an IPv6 hex address and +.Ar af +equals +.Dv AF_INET . +The function's return value is a +.Dv NULL +pointer and the value pointed to by +.Ar error_num +equals +.Dv HOST_NOT_FOUND . +.Pp +.Fn getipnodebyaddr +takes almost the same argument as +.Xr gethostbyaddr 3 , +but adds a pointer to return an error number. +Additionally it takes care of IPv4-mapped IPv6 addresses, +and IPv4-compatible IPv6 addresses. +.Pp +.Fn getipnodebyname +and +.Fn getipnodebyaddr +dynamically allocate the structure to be returned to the caller. +.Fn freehostent +reclaims memory region allocated and returned by +.Fn getipnodebyname +or +.Fn getipnodebyaddr . +.\" +.Sh FILES +.Bl -tag -width /etc/nsswitch.conf -compact +.It Pa /etc/hosts +.It Pa /etc/nsswitch.conf +.It Pa /etc/resolv.conf +.El +.\" +.Sh DIAGNOSTICS +.Fn getipnodebyname +and +.Fn getipnodebyaddr +returns +.Dv NULL +on errors. +The integer values pointed to by +.Ar error_num +may then be checked to see whether this is a temporary failure +or an invalid or unknown host. +The meanings of each error code are described in +.Xr gethostbyname 3 . +.\" +.Sh SEE ALSO +.Xr gethostbyaddr 3 , +.Xr gethostbyname 3 , +.Xr hosts 5 , +.Xr nsswitch.conf 5 , +.Xr services 5 , +.Xr hostname 7 , +.Xr named 8 +.Pp +.Rs +.%A R. Gilligan +.%A S. Thomson +.%A J. Bound +.%A W. Stevens +.%T Basic Socket Interface Extensions for IPv6 +.%R RFC2553 +.%D March 1999 +.Re +.\" +.Sh HISTORY +The implementation first appeared in KAME advanced networking kit. +.\" +.Sh STANDARDS +.Fn getipnodebyname +and +.Fn getipnodebyaddr +are documented in +.Dq Basic Socket Interface Extensions for IPv6 +(RFC2553). +.\" +.Sh BUGS +.Fn getipnodebyname +and +.Fn getipnodebyaddr +do not handle scoped IPv6 address properly. +If you use these functions, +your program will not be able to handle scoped IPv6 addresses. +For IPv6 address manipulation, +.Fn getaddrinfo 3 +and +.Fn getnameinfo 3 +are recommended. +.Pp +The current implementation is not thread-safe. +.Pp +The text was shamelessly copied from RFC2553. diff --git a/newlib/libc/sys/linux/net/getnameinfo.3 b/newlib/libc/sys/linux/net/getnameinfo.3 new file mode 100644 index 000000000..d7afa2f40 --- /dev/null +++ b/newlib/libc/sys/linux/net/getnameinfo.3 @@ -0,0 +1,311 @@ +.\" $FreeBSD: src/lib/libc/net/getnameinfo.3,v 1.11 2001/10/01 16:08:55 ru Exp $ +.\" $KAME: getnameinfo.3,v 1.17 2000/08/09 21:16:17 itojun Exp $ +.\" +.\" Copyright (c) 1983, 1987, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 +.\" +.Dd May 25, 1995 +.Dt GETNAMEINFO 3 +.Os +.\" +.Sh NAME +.Nm getnameinfo +.Nd address-to-nodename translation in protocol-independent manner +.\" +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In netdb.h +.Ft int +.Fn getnameinfo "const struct sockaddr *sa" "socklen_t salen" \ +"char *host" "size_t hostlen" "char *serv" "size_t servlen" "int flags" +.\" +.Sh DESCRIPTION +The +.Fn getnameinfo +function is defined for protocol-independent address-to-nodename translation. +Its functionality is a reverse conversion of +.Xr getaddrinfo 3 , +and implements similar functionality with +.Xr gethostbyaddr 3 +and +.Xr getservbyport 3 +in more sophisticated manner. +.Pp +This function looks up an IP address and port number provided by the +caller in the DNS and system-specific database, and returns text +strings for both in buffers provided by the caller. +The function indicates successful completion by a zero return value; +a non-zero return value indicates failure. +.Pp +The first argument, +.Fa sa , +points to either a +.Li sockaddr_in +structure (for IPv4) or a +.Li sockaddr_in6 +structure (for IPv6) that holds the IP address and port number. +The +.Fa salen +argument gives the length of the +.Li sockaddr_in +or +.Li sockaddr_in6 +structure. +.Pp +The function returns the nodename associated with the IP address in +the buffer pointed to by the +.Fa host +argument. +The caller provides the size of this buffer via the +.Fa hostlen +argument. +The service name associated with the port number is returned in the buffer +pointed to by +.Fa serv , +and the +.Fa servlen +argument gives the length of this buffer. +The caller specifies not to return either string by providing a zero +value for the +.Fa hostlen +or +.Fa servlen +arguments. +Otherwise, the caller must provide buffers large enough to hold the +nodename and the service name, including the terminating null characters. +.Pp +Unfortunately most systems do not provide constants that specify the +maximum size of either a fully-qualified domain name or a service name. +Therefore to aid the application in allocating buffers for these two +returned strings the following constants are defined in +.Aq Pa netdb.h : +.Bd -literal -offset +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 +.Ed +.Pp +The first value is actually defined as the constant +.Dv MAXDNAME +in recent versions of BIND's +.Aq Pa arpa/nameser.h +header +(older versions of BIND define this constant to be 256) +and the second is a guess based on the services listed in the current +Assigned Numbers RFC. +.Pp +The final argument is a +.Fa flag +that changes the default actions of this function. +By default the fully-qualified domain name (FQDN) for the host is +looked up in the DNS and returned. +If the flag bit +.Dv NI_NOFQDN +is set, only the nodename portion of the FQDN is returned for local hosts. +.Pp +If the +.Fa flag +bit +.Dv NI_NUMERICHOST +is set, or if the host's name cannot be located in the DNS, +the numeric form of the host's address is returned instead of its name +(e.g., by calling +.Fn inet_ntop +instead of +.Fn getnodebyaddr ) . +If the +.Fa flag +bit +.Dv NI_NAMEREQD +is set, an error is returned if the host's name cannot be located in the DNS. +.Pp +If the flag bit +.Dv NI_NUMERICSERV +is set, the numeric form of the service address is returned +(e.g., its port number) +instead of its name. +The two +.Dv NI_NUMERICxxx +flags are required to support the +.Fl n +flag that many commands provide. +.Pp +A fifth flag bit, +.Dv NI_DGRAM , +specifies that the service is a datagram service, and causes +.Fn getservbyport +to be called with a second argument of +.Dq udp +instead of its default of +.Dq tcp . +This is required for the few ports (512-514) +that have different services for UDP and TCP. +.Pp +These +.Dv NI_xxx +flags are defined in +.Aq Pa netdb.h . +.\" +.Sh EXTENSION +The implementation allows experimental numeric IPv6 address notation with +scope identifier. +IPv6 link-local address will appear as string like +.Dq Li fe80::1%ne0 , +if +.Dv NI_WITHSCOPEID +bit is enabled in +.Ar flags +argument. +Refer to +.Xr getaddrinfo 3 +for the notation. +.\" +.Sh EXAMPLES +The following code tries to get numeric hostname, and service name, +for given socket address. +Observe that there is no hardcoded reference to particular address family. +.Bd -literal -offset indent +struct sockaddr *sa; /* input */ +char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; + +if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf, + sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV)) { + errx(1, "could not get numeric hostname"); + /*NOTREACHED*/ +} +printf("host=%s, serv=%s\\n", hbuf, sbuf); +.Ed +.Pp +The following version checks if the socket address has reverse address mapping. +.Bd -literal -offset indent +struct sockaddr *sa; /* input */ +char hbuf[NI_MAXHOST]; + +if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0, + NI_NAMEREQD)) { + errx(1, "could not resolve hostname"); + /*NOTREACHED*/ +} +printf("host=%s\\n", hbuf); +.Ed +.\" +.Sh FILES +.Bl -tag -width /etc/nsswitch.conf -compact +.It Pa /etc/hosts +.It Pa /etc/nsswitch.conf +.It Pa /etc/resolv.conf +.El +.\" +.Sh DIAGNOSTICS +The function indicates successful completion by a zero return value; +a non-zero return value indicates failure. +Error codes are as below: +.Bl -tag -width Er +.It Bq Er EAI_AGAIN +The name could not be resolved at this time. +Future attempts may succeed. +.It Bq Er EAI_BADFLAGS +The flags had an invalid value. +.It Bq Er EAI_FAIL +A non-recoverable error occurred. +.It Bq Er EAI_FAMILY +The address family was not recognized or the address length was invalid +for the specified family. +.It Bq Er EAI_MEMORY +There was a memory allocation failure. +.It Bq Er EAI_NONAME +The name does not resolve for the supplied parameters. +.Dv NI_NAMEREQD +is set and the host's name cannot be located, +or both nodename and servname were null. +.It Bq Er EAI_SYSTEM +A system error occurred. +The error code can be found in errno. +.El +.\" +.Sh SEE ALSO +.Xr getaddrinfo 3 , +.Xr gethostbyaddr 3 , +.Xr getservbyport 3 , +.Xr hosts 5 , +.Xr services 5 , +.Xr hostname 7 , +.Xr named 8 +.Pp +.Rs +.%A R. Gilligan +.%A S. Thomson +.%A J. Bound +.%A W. Stevens +.%T Basic Socket Interface Extensions for IPv6 +.%R RFC2553 +.%D March 1999 +.Re +.Rs +.%A Tatsuya Jinmei +.%A Atsushi Onoe +.%T "An Extension of Format for IPv6 Scoped Addresses" +.%R internet draft +.%N draft-ietf-ipngwg-scopedaddr-format-02.txt +.%O work in progress material +.Re +.Rs +.%A Craig Metz +.%T Protocol Independence Using the Sockets API +.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference" +.%D June 2000 +.Re +.\" +.Sh HISTORY +The implementation first appeared in WIDE Hydrangea IPv6 protocol stack kit. +.\" +.Sh STANDARDS +The +.Fn getaddrinfo +function is defined in +.St -p1003.1g-2000 , +and documented in +.Dq Basic Socket Interface Extensions for IPv6 +(RFC2553). +.\" +.Sh BUGS +The current implementation is not thread-safe. +.Pp +The text was shamelessly copied from RFC2553. +.Pp +The type of the 2nd argument should be +.Li socklen_t +for RFC2553 conformance. +The current code is based on pre-RFC2553 specification. diff --git a/newlib/libc/sys/linux/net/getnameinfo.c b/newlib/libc/sys/linux/net/getnameinfo.c new file mode 100644 index 000000000..e2f9631c1 --- /dev/null +++ b/newlib/libc/sys/linux/net/getnameinfo.c @@ -0,0 +1,372 @@ +/* $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Issues to be discussed: + * - Thread safe-ness must be checked + * - RFC2553 says that we should raise error on short buffer. X/Open says + * we need to truncate the result. We obey RFC2553 (and X/Open should be + * modified). ipngwg rough consensus seems to follow RFC2553. + * - What is "local" in NI_FQDN? + * - NI_NAMEREQD and NI_NUMERICHOST conflict with each other. + * - (KAME extension) NI_WITHSCOPEID when called with global address, + * and sin6_scope_id filled + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SUCCESS 0 +#define ANY 0 +#define YES 1 +#define NO 0 + +static struct afd { + int a_af; + int a_addrlen; + int a_socklen; + int a_off; +} afdl [] = { +#ifdef INET6 + {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6), + offsetof(struct sockaddr_in6, sin6_addr)}, +#endif + {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in), + offsetof(struct sockaddr_in, sin_addr)}, + {0, 0, 0}, +}; + +struct sockinet { + u_char si_len; + u_char si_family; + u_short si_port; +}; + +#ifdef INET6 +static int ip6_parsenumeric(const struct sockaddr *, const char *, char *, + size_t, int); +static int ip6_sa2str(const struct sockaddr_in6 *, char *, size_t, int); +#endif + +/* 2553bis: use EAI_xx for getnameinfo */ +#define ENI_NOSOCKET EAI_FAIL /*XXX*/ +#define ENI_NOSERVNAME EAI_NONAME +#define ENI_NOHOSTNAME EAI_NONAME +#define ENI_MEMORY EAI_MEMORY +#define ENI_SYSTEM EAI_SYSTEM +#define ENI_FAMILY EAI_FAMILY +#define ENI_SALEN EAI_FAMILY + +int +getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) + const struct sockaddr *sa; + socklen_t salen; + char *host; + size_t hostlen; + char *serv; + size_t servlen; + int flags; +{ + struct afd *afd; + struct servent *sp; + struct hostent *hp; + u_short port; + int family, i; + const char *addr; + u_int32_t v4a; + int h_error; + char numserv[512]; + char numaddr[512]; + + if (sa == NULL) + return ENI_NOSOCKET; + + family = sa->sa_family; + for (i = 0; afdl[i].a_af; i++) + if (afdl[i].a_af == family) { + afd = &afdl[i]; + goto found; + } + return ENI_FAMILY; + + found: + if (salen != afd->a_socklen) + return ENI_SALEN; + + /* network byte order */ + port = ((const struct sockinet *)sa)->si_port; + addr = (const char *)sa + afd->a_off; + + if (serv == NULL || servlen == 0) { + /* + * do nothing in this case. + * in case you are wondering if "&&" is more correct than + * "||" here: RFC2553 says that serv == NULL OR servlen == 0 + * means that the caller does not want the result. + */ + } else { + if (flags & NI_NUMERICSERV) + sp = NULL; + else { + sp = getservbyport(port, + (flags & NI_DGRAM) ? "udp" : "tcp"); + } + if (sp) { + if (strlen(sp->s_name) + 1 > servlen) + return ENI_MEMORY; + strcpy(serv, sp->s_name); + } else { + snprintf(numserv, sizeof(numserv), "%d", ntohs(port)); + if (strlen(numserv) + 1 > servlen) + return ENI_MEMORY; + strcpy(serv, numserv); + } + } + + switch (sa->sa_family) { + case AF_INET: + v4a = (u_int32_t) + ntohl(((const struct sockaddr_in *)sa)->sin_addr.s_addr); + if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) + flags |= NI_NUMERICHOST; + v4a >>= IN_CLASSA_NSHIFT; + if (v4a == 0) + flags |= NI_NUMERICHOST; + break; +#ifdef INET6 + case AF_INET6: + { + const struct sockaddr_in6 *sin6; + sin6 = (const struct sockaddr_in6 *)sa; + switch (sin6->sin6_addr.s6_addr[0]) { + case 0x00: + if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) + ; + else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)) + ; + else + flags |= NI_NUMERICHOST; + break; + default: + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + flags |= NI_NUMERICHOST; + } + else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + flags |= NI_NUMERICHOST; + break; + } + } + break; +#endif + } + if (host == NULL || hostlen == 0) { + /* + * do nothing in this case. + * in case you are wondering if "&&" is more correct than + * "||" here: RFC2553 says that host == NULL OR hostlen == 0 + * means that the caller does not want the result. + */ + } else if (flags & NI_NUMERICHOST) { + int numaddrlen; + + /* NUMERICHOST and NAMEREQD conflicts with each other */ + if (flags & NI_NAMEREQD) + return ENI_NOHOSTNAME; + + switch(afd->a_af) { +#ifdef INET6 + case AF_INET6: + { + int error; + + if ((error = ip6_parsenumeric(sa, addr, host, + hostlen, flags)) != 0) + return(error); + break; + } +#endif + default: + if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr)) + == NULL) + return ENI_SYSTEM; + numaddrlen = strlen(numaddr); + if (numaddrlen + 1 > hostlen) /* don't forget terminator */ + return ENI_MEMORY; + strcpy(host, numaddr); + break; + } + } else { + hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); + + if (hp) { +#if 0 + /* + * commented out, since "for local host" is not + * implemented here - see RFC2553 p30 + */ + if (flags & NI_NOFQDN) { + char *p; + p = strchr(hp->h_name, '.'); + if (p) + *p = '\0'; + } +#endif + if (strlen(hp->h_name) + 1 > hostlen) { + freehostent(hp); + return ENI_MEMORY; + } + strcpy(host, hp->h_name); + freehostent(hp); + } else { + if (flags & NI_NAMEREQD) + return ENI_NOHOSTNAME; + switch(afd->a_af) { +#ifdef INET6 + case AF_INET6: + { + int error; + + if ((error = ip6_parsenumeric(sa, addr, host, + hostlen, + flags)) != 0) + return(error); + break; + } +#endif + default: + if (inet_ntop(afd->a_af, addr, host, + hostlen) == NULL) + return ENI_SYSTEM; + break; + } + } + } + return SUCCESS; +} + +#ifdef INET6 +static int +ip6_parsenumeric(sa, addr, host, hostlen, flags) + const struct sockaddr *sa; + const char *addr; + char *host; + size_t hostlen; + int flags; +{ + int numaddrlen; + char numaddr[512]; + + if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) + == NULL) + return ENI_SYSTEM; + + numaddrlen = strlen(numaddr); + if (numaddrlen + 1 > hostlen) /* don't forget terminator */ + return ENI_MEMORY; + strcpy(host, numaddr); + +#ifdef NI_WITHSCOPEID + if ( +#ifdef DONT_OPAQUE_SCOPEID + (IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr) || + IN6_IS_ADDR_MULTICAST((struct in6_addr *)addr)) && +#endif + ((const struct sockaddr_in6 *)sa)->sin6_scope_id) { +#ifndef ALWAYS_WITHSCOPE + if (flags & NI_WITHSCOPEID) +#endif /* !ALWAYS_WITHSCOPE */ + { + char scopebuf[MAXHOSTNAMELEN]; + int scopelen; + + /* ip6_sa2str never fails */ + scopelen = ip6_sa2str((const struct sockaddr_in6 *)sa, + scopebuf, sizeof(scopebuf), + flags); + if (scopelen + 1 + numaddrlen + 1 > hostlen) + return ENI_MEMORY; + /* + * construct + */ + memcpy(host + numaddrlen + 1, scopebuf, + scopelen); + host[numaddrlen] = SCOPE_DELIMITER; + host[numaddrlen + 1 + scopelen] = '\0'; + } + } +#endif /* NI_WITHSCOPEID */ + + return 0; +} + +/* ARGSUSED */ +static int +ip6_sa2str(sa6, buf, bufsiz, flags) + const struct sockaddr_in6 *sa6; + char *buf; + size_t bufsiz; + int flags; +{ + unsigned int ifindex = (unsigned int)sa6->sin6_scope_id; + const struct in6_addr *a6 = &sa6->sin6_addr; + +#ifdef NI_NUMERICSCOPE + if (flags & NI_NUMERICSCOPE) { + return(snprintf(buf, bufsiz, "%d", sa6->sin6_scope_id)); + } +#endif + + /* if_indextoname() does not take buffer size. not a good api... */ + if ((IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) && + bufsiz >= IF_NAMESIZE) { + char *p = if_indextoname(ifindex, buf); + if (p) { + return(strlen(p)); + } + } + + /* last resort */ + return(snprintf(buf, bufsiz, "%u", sa6->sin6_scope_id)); +} +#endif /* INET6 */ diff --git a/newlib/libc/sys/linux/net/getnetbydns.c b/newlib/libc/sys/linux/net/getnetbydns.c new file mode 100644 index 000000000..2cc4fce54 --- /dev/null +++ b/newlib/libc/sys/linux/net/getnetbydns.c @@ -0,0 +1,327 @@ +/*- + * Copyright (c) 1985, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ +/* Portions Copyright (c) 1993 Carlos Leandro and Rui Salgueiro + * Dep. Matematica Universidade de Coimbra, Portugal, Europe + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "res_config.h" + +extern int h_errno; + +#define BYADDR 0 +#define BYNAME 1 +#define MAXALIASES 35 + +#if PACKETSZ > 1024 +#define MAXPACKET PACKETSZ +#else +#define MAXPACKET 1024 +#endif + +typedef union { + HEADER hdr; + u_char buf[MAXPACKET]; +} querybuf; + +typedef union { + long al; + char ac; +} align; + +static struct netent * +getnetanswer(answer, anslen, net_i) + querybuf *answer; + int anslen; + int net_i; +{ + + HEADER *hp; + u_char *cp; + int n; + u_char *eom; + int type, class, buflen, ancount, qdcount, haveanswer, i, nchar; + char aux1[MAXHOSTNAMELEN], aux2[MAXHOSTNAMELEN], ans[MAXHOSTNAMELEN]; + char *in, *st, *pauxt, *bp, **ap; + char *paux1 = &aux1[0], *paux2 = &aux2[0], flag = 0; +static struct netent net_entry; +static char *net_aliases[MAXALIASES], netbuf[PACKETSZ]; + + /* + * find first satisfactory answer + * + * answer --> +------------+ ( MESSAGE ) + * | Header | + * +------------+ + * | Question | the question for the name server + * +------------+ + * | Answer | RRs answering the question + * +------------+ + * | Authority | RRs pointing toward an authority + * | Additional | RRs holding additional information + * +------------+ + */ + eom = answer->buf + anslen; + hp = &answer->hdr; + ancount = ntohs(hp->ancount); /* #/records in the answer section */ + qdcount = ntohs(hp->qdcount); /* #/entries in the question section */ + bp = netbuf; + buflen = sizeof(netbuf); + cp = answer->buf + HFIXEDSZ; + if (!qdcount) { + if (hp->aa) + h_errno = HOST_NOT_FOUND; + else + h_errno = TRY_AGAIN; + return (NULL); + } + while (qdcount-- > 0) + cp += __dn_skipname(cp, eom) + QFIXEDSZ; + ap = net_aliases; + *ap = NULL; + net_entry.n_aliases = net_aliases; + haveanswer = 0; + while (--ancount >= 0 && cp < eom) { + n = dn_expand(answer->buf, eom, cp, bp, buflen); + if ((n < 0) || !res_dnok(bp)) + break; + cp += n; + ans[0] = '\0'; + (void)strncpy(&ans[0], bp, sizeof(ans) - 1); + ans[sizeof(ans) - 1] = '\0'; + GETSHORT(type, cp); + GETSHORT(class, cp); + cp += INT32SZ; /* TTL */ + GETSHORT(n, cp); + if (class == C_IN && type == T_PTR) { + n = dn_expand(answer->buf, eom, cp, bp, buflen); + if ((n < 0) || !res_hnok(bp)) { + cp += n; + return (NULL); + } + cp += n; + *ap++ = bp; + bp += strlen(bp) + 1; + net_entry.n_addrtype = + (class == C_IN) ? AF_INET : AF_UNSPEC; + haveanswer++; + } + } + if (haveanswer) { + *ap = NULL; + switch (net_i) { + case BYADDR: + net_entry.n_name = *net_entry.n_aliases; + net_entry.n_net = 0L; + break; + case BYNAME: + in = *net_entry.n_aliases; + net_entry.n_name = &ans[0]; + aux2[0] = '\0'; + for (i = 0; i < 4; i++) { + for (st = in, nchar = 0; + *st != '.'; + st++, nchar++) + ; + if (nchar != 1 || *in != '0' || flag) { + flag = 1; + (void)strncpy(paux1, + (i==0) ? in : in-1, + (i==0) ?nchar : nchar+1); + paux1[(i==0) ? nchar : nchar+1] = '\0'; + pauxt = paux2; + paux2 = strcat(paux1, paux2); + paux1 = pauxt; + } + in = ++st; + } + net_entry.n_net = inet_network(paux2); + break; + } + net_entry.n_aliases++; + return (&net_entry); + } + h_errno = TRY_AGAIN; + return (NULL); +} + +int +_dns_getnetbyaddr(void *rval, void *cb_data, va_list ap) +{ + unsigned long net; + int net_type; + unsigned int netbr[4]; + int nn, anslen; + querybuf buf; + char qbuf[MAXDNAME]; + unsigned long net2; + struct netent *net_entry; + + net = va_arg(ap, unsigned long); + net_type = va_arg(ap, int); + + *(struct netent **)rval = NULL; + + if (net_type != AF_INET) + return NS_UNAVAIL; + + for (nn = 4, net2 = net; net2; net2 >>= 8) + netbr[--nn] = net2 & 0xff; + switch (nn) { + case 3: /* Class A */ + sprintf(qbuf, "0.0.0.%u.in-addr.arpa", netbr[3]); + break; + case 2: /* Class B */ + sprintf(qbuf, "0.0.%u.%u.in-addr.arpa", netbr[3], netbr[2]); + break; + case 1: /* Class C */ + sprintf(qbuf, "0.%u.%u.%u.in-addr.arpa", netbr[3], netbr[2], + netbr[1]); + break; + case 0: /* Class D - E */ + sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa", netbr[3], netbr[2], + netbr[1], netbr[0]); + break; + } + anslen = res_query(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof(buf)); + if (anslen < 0) { +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf("res_query failed\n"); +#endif + return NS_UNAVAIL; + } + net_entry = getnetanswer(&buf, anslen, BYADDR); + if (net_entry) { + unsigned u_net = net; /* maybe net should be unsigned ? */ + + /* Strip trailing zeros */ + while ((u_net & 0xff) == 0 && u_net != 0) + u_net >>= 8; + net_entry->n_net = u_net; + *(struct netent **)rval = net_entry; + return NS_SUCCESS; + } + return NS_NOTFOUND; +} + +int +_dns_getnetbyname(void *rval, void *cb_data, va_list ap) +{ + const char *net; + int anslen; + querybuf buf; + char qbuf[MAXDNAME]; + + net = va_arg(ap, const char *); + + *(struct netent**)rval = NULL; + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return NS_UNAVAIL; + } + strncpy(qbuf, net, sizeof(qbuf) - 1); + qbuf[sizeof(qbuf) - 1] = '\0'; + anslen = res_search(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof(buf)); + if (anslen < 0) { +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf("res_query failed\n"); +#endif + return NS_UNAVAIL; + } + *(struct netent**)rval = getnetanswer(&buf, anslen, BYNAME); + return (*(struct netent**)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} + +void +_setnetdnsent(stayopen) + int stayopen; +{ + if (stayopen) + _res.options |= RES_STAYOPEN | RES_USEVC; +} + +void +_endnetdnsent() +{ + _res.options &= ~(RES_STAYOPEN | RES_USEVC); + res_close(); +} diff --git a/newlib/libc/sys/linux/net/getnetbyht.c b/newlib/libc/sys/linux/net/getnetbyht.c new file mode 100644 index 000000000..8e4a16f1c --- /dev/null +++ b/newlib/libc/sys/linux/net/getnetbyht.c @@ -0,0 +1,183 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Portions Copyright (c) 1993 Carlos Leandro and Rui Salgueiro + * Dep. Matematica Universidade de Coimbra, Portugal, Europe + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * from getnetent.c 1.1 (Coimbra) 93/06/02 + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93"; +static char orig_rcsid[] = "From: Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAXALIASES 35 + +static FILE *netf; +static char line[BUFSIZ+1]; +static struct netent net; +static char *net_aliases[MAXALIASES]; +static int _net_stayopen; + +void +_setnethtent(f) + int f; +{ + + if (netf == NULL) + netf = fopen(_PATH_NETWORKS, "r" ); + else + rewind(netf); + _net_stayopen |= f; +} + +void +_endnethtent() +{ + + if (netf) { + fclose(netf); + netf = NULL; + } + _net_stayopen = 0; +} + +struct netent * +getnetent() +{ + char *p; + char *cp, **q; + + if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "r" )) == NULL) + return (NULL); +again: + p = fgets(line, sizeof line, netf); + if (p == NULL) + return (NULL); + if (*p == '#') + goto again; + cp = strpbrk(p, "#\n"); + if (cp == NULL) + goto again; + *cp = '\0'; + net.n_name = p; + cp = strpbrk(p, " \t"); + if (cp == NULL) + goto again; + *cp++ = '\0'; + while (*cp == ' ' || *cp == '\t') + cp++; + p = strpbrk(cp, " \t"); + if (p != NULL) + *p++ = '\0'; + net.n_net = inet_network(cp); + net.n_addrtype = AF_INET; + q = net.n_aliases = net_aliases; + if (p != NULL) + cp = p; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &net_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + } + *q = NULL; + return (&net); +} + +int +_ht_getnetbyname(void *rval, void *cb_data, va_list ap) +{ + const char *name; + struct netent *p; + char **cp; + + name = va_arg(ap, const char *); + + setnetent(_net_stayopen); + while ( (p = getnetent()) ) { + if (strcasecmp(p->n_name, name) == 0) + break; + for (cp = p->n_aliases; *cp != 0; cp++) + if (strcasecmp(*cp, name) == 0) + goto found; + } +found: + if (!_net_stayopen) + endnetent(); + *(struct netent **)rval = p; + return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} + +int +_ht_getnetbyaddr(void *rval, void *cb_data, va_list ap) +{ + unsigned long net; + int type; + struct netent *p; + + net = va_arg(ap, unsigned long); + type = va_arg(ap, int); + + setnetent(_net_stayopen); + while ( (p = getnetent()) ) + if (p->n_addrtype == type && p->n_net == net) + break; + if (!_net_stayopen) + endnetent(); + *(struct netent **)rval = p; + return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} diff --git a/newlib/libc/sys/linux/net/getnetbynis.c b/newlib/libc/sys/linux/net/getnetbynis.c new file mode 100644 index 000000000..6d222e60f --- /dev/null +++ b/newlib/libc/sys/linux/net/getnetbynis.c @@ -0,0 +1,190 @@ +/*- + * Copyright (c) 1994, Garrett Wollman + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef YP +#include +#include +#include +#endif + +#define MAXALIASES 35 +#define MAXADDRS 35 + +#ifdef YP +static char *host_aliases[MAXALIASES]; + +static struct netent * +_getnetbynis(const char *name, char *map, int af) +{ + char *cp, **q; + static char *result; + int resultlen; + static struct netent h; + static char *domain = (char *)NULL; + static char ypbuf[YPMAXRECORD + 2]; + + switch(af) { + case AF_INET: + break; + default: + case AF_INET6: + errno = EAFNOSUPPORT; + return NULL; + } + + if (domain == (char *)NULL) + if (yp_get_default_domain (&domain)) + return (NULL); + + if (yp_match(domain, map, name, strlen(name), &result, &resultlen)) + return (NULL); + + bcopy((char *)result, (char *)&ypbuf, resultlen); + ypbuf[resultlen] = '\0'; + free(result); + result = (char *)&ypbuf; + + if ((cp = index(result, '\n'))) + *cp = '\0'; + + cp = strpbrk(result, " \t"); + *cp++ = '\0'; + h.n_name = result; + + while (*cp == ' ' || *cp == '\t') + cp++; + + h.n_net = inet_network(cp); + h.n_addrtype = AF_INET; + + q = h.n_aliases = host_aliases; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &host_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + } + *q = NULL; + return (&h); +} +#endif /* YP */ + +int +_nis_getnetbyname(void *rval, void *cb_data, va_list ap) +{ +#ifdef YP + const char *name; + + name = va_arg(ap, const char *); + + *(struct netent **)rval = _getnetbynis(name, "networks.byname", AF_INET); + return (*(struct netent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; +#else + return NS_UNAVAIL; +#endif + +} + +int +_nis_getnetbyaddr(void *rval, void *cb_data, va_list ap) +{ +#ifdef YP + unsigned long addr; + int af; + char *str, *cp; + unsigned long net2; + int nn; + unsigned int netbr[4]; + char buf[MAXDNAME]; + + addr = va_arg(ap, unsigned long); + af = va_arg(ap, int); + + *(struct netent **)rval = NULL; + + if (af != AF_INET) { + errno = EAFNOSUPPORT; + return NS_UNAVAIL; + } + + for (nn = 4, net2 = addr; net2; net2 >>= 8) { + netbr[--nn] = net2 & 0xff; + } + + switch (nn) { + case 3: /* Class A */ + sprintf(buf, "%u", netbr[3]); + break; + case 2: /* Class B */ + sprintf(buf, "%u.%u", netbr[2], netbr[3]); + break; + case 1: /* Class C */ + sprintf(buf, "%u.%u.%u", netbr[1], netbr[2], netbr[3]); + break; + case 0: /* Class D - E */ + sprintf(buf, "%u.%u.%u.%u", netbr[0], netbr[1], + netbr[2], netbr[3]); + break; + } + + str = (char *)&buf; + cp = str + (strlen(str) - 2); + + while(!strcmp(cp, ".0")) { + *cp = '\0'; + cp = str + (strlen(str) - 2); + } + + *(struct netent **)rval = _getnetbynis(str, "networks.byaddr", af); + return (*(struct netent**)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; +#else + return NS_UNAVAIL; +#endif /* YP */ +} diff --git a/newlib/libc/sys/linux/net/getnetent.3 b/newlib/libc/sys/linux/net/getnetent.3 new file mode 100644 index 000000000..6801e9707 --- /dev/null +++ b/newlib/libc/sys/linux/net/getnetent.3 @@ -0,0 +1,172 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93 +.\" $FreeBSD: src/lib/libc/net/getnetent.3,v 1.17 2002/01/14 16:59:01 ru Exp $ +.\" +.Dd June 4, 1993 +.Dt GETNETENT 3 +.Os +.Sh NAME +.Nm getnetent , +.Nm getnetbyaddr , +.Nm getnetbyname , +.Nm setnetent , +.Nm endnetent +.Nd get network entry +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In netdb.h +.Ft struct netent * +.Fn getnetent void +.Ft struct netent * +.Fn getnetbyname "const char *name" +.Ft struct netent * +.Fn getnetbyaddr "unsigned long net" "int type" +.Ft void +.Fn setnetent "int stayopen" +.Ft void +.Fn endnetent void +.Sh DESCRIPTION +The +.Fn getnetent , +.Fn getnetbyname , +and +.Fn getnetbyaddr +functions +each return a pointer to an object with the +following structure describing an internet network. +This structure contains either the information obtained +from the nameserver, +.Xr named 8 , +broken-out fields of a line in the network data base +.Pa /etc/networks , +or entries supplied by the +.Xr yp 8 +system. The order of the lookups is controlled by the +`networks' entry in +.Xr nsswitch.conf 5 . +.Pp +.Bd -literal -offset indent +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net number type */ + unsigned long n_net; /* net number */ +}; +.Ed +.Pp +The members of this structure are: +.Bl -tag -width n_addrtype +.It Fa n_name +The official name of the network. +.It Fa n_aliases +A zero terminated list of alternate names for the network. +.It Fa n_addrtype +The type of the network number returned; currently only AF_INET. +.It Fa n_net +The network number. Network numbers are returned in machine byte +order. +.El +.Pp +The +.Fn getnetent +function +reads the next line of the file, opening the file if necessary. +.Pp +The +.Fn setnetent +function +opens and rewinds the file. If the +.Fa stayopen +flag is non-zero, +the net data base will not be closed after each call to +.Fn getnetbyname +or +.Fn getnetbyaddr . +.Pp +The +.Fn endnetent +function +closes the file. +.Pp +The +.Fn getnetbyname +function +and +.Fn getnetbyaddr +sequentially search from the beginning +of the file until a matching +net name or +net address and type is found, +or until +.Dv EOF +is encountered. +The +.Fa type +must be +.Dv AF_INET . +Network numbers are supplied in host order. +.Sh FILES +.Bl -tag -width /etc/nsswitch.conf -compact +.It Pa /etc/networks +.It Pa /etc/nsswitch.conf +.It Pa /etc/resolv.conf +.El +.Sh DIAGNOSTICS +Null pointer +(0) returned on +.Dv EOF +or error. +.Sh SEE ALSO +.Xr networks 5 +.Pp +.%T RFC 1101 +.Sh HISTORY +The +.Fn getnetent , +.Fn getnetbyaddr , +.Fn getnetbyname , +.Fn setnetent , +and +.Fn endnetent +functions appeared in +.Bx 4.2 . +.Sh BUGS +The data space used by +these functions is static; if future use requires the data, it should be +copied before any subsequent calls to these functions overwrite it. +Only Internet network +numbers are currently understood. +Expecting network numbers to fit +in no more than 32 bits is probably +naive. diff --git a/newlib/libc/sys/linux/net/getnetnamadr.c b/newlib/libc/sys/linux/net/getnetnamadr.c new file mode 100644 index 000000000..180ab14e2 --- /dev/null +++ b/newlib/libc/sys/linux/net/getnetnamadr.c @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 1994, Garrett Wollman + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern int _ht_getnetbyname(void *, void *, va_list); +extern int _dns_getnetbyname(void *, void *, va_list); +extern int _nis_getnetbyname(void *, void *, va_list); +extern int _ht_getnetbyaddr(void *, void *, va_list); +extern int _dns_getnetbyaddr(void *, void *, va_list); +extern int _nis_getnetbyaddr(void *, void *, va_list); + +/* Network lookup order if nsswitch.conf is broken or nonexistant */ +static const ns_src default_src[] = { + { NSSRC_FILES, NS_SUCCESS }, + { NSSRC_DNS, NS_SUCCESS }, + { 0 } +}; + +struct netent * +getnetbyname(const char *name) +{ + struct netent *hp = 0; + int rval; + + + static const ns_dtab dtab[] = { + NS_FILES_CB(_ht_getnetbyname, NULL) + { NSSRC_DNS, _dns_getnetbyname, NULL }, + NS_NIS_CB(_nis_getnetbyname, NULL) /* force -DHESIOD */ + { 0 } + }; + + rval = nsdispatch((void *)&hp, dtab, NSDB_NETWORKS, "getnetbyname", + default_src, name); + + if (rval != NS_SUCCESS) + return NULL; + else + return hp; +} + +struct netent * +getnetbyaddr(u_long addr, int af) +{ + struct netent *hp = 0; + int rval; + + static const ns_dtab dtab[] = { + NS_FILES_CB(_ht_getnetbyaddr, NULL) + { NSSRC_DNS, _dns_getnetbyaddr, NULL }, + NS_NIS_CB(_nis_getnetbyaddr, NULL) /* force -DHESIOD */ + { 0 } + }; + + rval = nsdispatch((void *)&hp, dtab, NSDB_NETWORKS, "getnetbyaddr", + default_src, addr, af); + + if (rval != NS_SUCCESS) + return NULL; + else + return hp; +} + +void +setnetent(stayopen) + int stayopen; +{ + _setnethtent(stayopen); + _setnetdnsent(stayopen); +} + +void +endnetent() +{ + _endnethtent(); + _endnetdnsent(); +} diff --git a/newlib/libc/sys/linux/net/getproto.c b/newlib/libc/sys/linux/net/getproto.c new file mode 100644 index 000000000..937c30732 --- /dev/null +++ b/newlib/libc/sys/linux/net/getproto.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getproto.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include + +extern int _proto_stayopen; + +struct protoent * +getprotobynumber(proto) + int proto; +{ + struct protoent *p; + + setprotoent(_proto_stayopen); + while ( (p = getprotoent()) ) + if (p->p_proto == proto) + break; + if (!_proto_stayopen) + endprotoent(); + return (p); +} diff --git a/newlib/libc/sys/linux/net/getprotoent.3 b/newlib/libc/sys/linux/net/getprotoent.3 new file mode 100644 index 000000000..18b56541b --- /dev/null +++ b/newlib/libc/sys/linux/net/getprotoent.3 @@ -0,0 +1,149 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)getprotoent.3 8.1 (Berkeley) 6/4/93 +.\" $FreeBSD: src/lib/libc/net/getprotoent.3,v 1.8 2001/10/01 16:08:55 ru Exp $ +.\" +.Dd June 4, 1993 +.Dt GETPROTOENT 3 +.Os +.Sh NAME +.Nm getprotoent , +.Nm getprotobynumber , +.Nm getprotobyname , +.Nm setprotoent , +.Nm endprotoent +.Nd get protocol entry +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In netdb.h +.Ft struct protoent * +.Fn getprotoent void +.Ft struct protoent * +.Fn getprotobyname "const char *name" +.Ft struct protoent * +.Fn getprotobynumber "int proto" +.Ft void +.Fn setprotoent "int stayopen" +.Ft void +.Fn endprotoent void +.Sh DESCRIPTION +The +.Fn getprotoent , +.Fn getprotobyname , +and +.Fn getprotobynumber +functions +each return a pointer to an object with the +following structure +containing the broken-out +fields of a line in the network protocol data base, +.Pa /etc/protocols . +.Bd -literal -offset indent +.Pp +struct protoent { + char *p_name; /* official name of protocol */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol number */ +}; +.Ed +.Pp +The members of this structure are: +.Bl -tag -width p_aliases +.It Fa p_name +The official name of the protocol. +.It Fa p_aliases +A zero terminated list of alternate names for the protocol. +.It Fa p_proto +The protocol number. +.El +.Pp +The +.Fn getprotoent +function +reads the next line of the file, opening the file if necessary. +.Pp +The +.Fn setprotoent +function +opens and rewinds the file. If the +.Fa stayopen +flag is non-zero, +the net data base will not be closed after each call to +.Fn getprotobyname +or +.Fn getprotobynumber . +.Pp +The +.Fn endprotoent +function +closes the file. +.Pp +The +.Fn getprotobyname +function +and +.Fn getprotobynumber +sequentially search from the beginning +of the file until a matching +protocol name or +protocol number is found, +or until +.Dv EOF +is encountered. +.Sh RETURN VALUES +Null pointer +(0) returned on +.Dv EOF +or error. +.Sh FILES +.Bl -tag -width /etc/protocols -compact +.It Pa /etc/protocols +.El +.Sh SEE ALSO +.Xr protocols 5 +.Sh HISTORY +The +.Fn getprotoent , +.Fn getprotobynumber , +.Fn getprotobyname , +.Fn setprotoent , +and +.Fn endprotoent +functions appeared in +.Bx 4.2 . +.Sh BUGS +These functions use a static data space; +if the data is needed for future use, it should be +copied before any subsequent calls overwrite it. +Only the Internet +protocols are currently understood. diff --git a/newlib/libc/sys/linux/net/getprotoent.c b/newlib/libc/sys/linux/net/getprotoent.c new file mode 100644 index 000000000..422eeacea --- /dev/null +++ b/newlib/libc/sys/linux/net/getprotoent.c @@ -0,0 +1,121 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getprotoent.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include +#include + +#define MAXALIASES 35 + +static FILE *protof = NULL; +static char line[BUFSIZ+1]; +static struct protoent proto; +static char *proto_aliases[MAXALIASES]; +int _proto_stayopen; + +void +setprotoent(f) + int f; +{ + if (protof == NULL) + protof = fopen(_PATH_PROTOCOLS, "r" ); + else + rewind(protof); + _proto_stayopen |= f; +} + +void +endprotoent() +{ + if (protof) { + fclose(protof); + protof = NULL; + } + _proto_stayopen = 0; +} + +struct protoent * +getprotoent() +{ + char *p; + char *cp, **q; + + if (protof == NULL && (protof = fopen(_PATH_PROTOCOLS, "r" )) == NULL) + return (NULL); +again: + if ((p = fgets(line, BUFSIZ, protof)) == NULL) + return (NULL); + if (*p == '#') + goto again; + cp = strpbrk(p, "#\n"); + if (cp == NULL) + goto again; + *cp = '\0'; + proto.p_name = p; + cp = strpbrk(p, " \t"); + if (cp == NULL) + goto again; + *cp++ = '\0'; + while (*cp == ' ' || *cp == '\t') + cp++; + p = strpbrk(cp, " \t"); + if (p != NULL) + *p++ = '\0'; + proto.p_proto = atoi(cp); + q = proto.p_aliases = proto_aliases; + if (p != NULL) { + cp = p; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &proto_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + } + } + *q = NULL; + return (&proto); +} diff --git a/newlib/libc/sys/linux/net/getprotoname.c b/newlib/libc/sys/linux/net/getprotoname.c new file mode 100644 index 000000000..f25883fe8 --- /dev/null +++ b/newlib/libc/sys/linux/net/getprotoname.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getprotoname.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include + +extern int _proto_stayopen; + +struct protoent * +getprotobyname(name) + const char *name; +{ + struct protoent *p; + char **cp; + + setprotoent(_proto_stayopen); + while ( (p = getprotoent()) ) { + if (strcmp(p->p_name, name) == 0) + break; + for (cp = p->p_aliases; *cp != 0; cp++) + if (strcmp(*cp, name) == 0) + goto found; + } +found: + if (!_proto_stayopen) + endprotoent(); + return (p); +} diff --git a/newlib/libc/sys/linux/net/getservbyname.c b/newlib/libc/sys/linux/net/getservbyname.c new file mode 100644 index 000000000..ced03d617 --- /dev/null +++ b/newlib/libc/sys/linux/net/getservbyname.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getservbyname.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include + +extern int _serv_stayopen; + +struct servent * +getservbyname(name, proto) + const char *name, *proto; +{ + struct servent *p; + char **cp; + +#ifdef YP + extern char *___getservbyname_yp; + extern char *___getservbyproto_yp; + + ___getservbyname_yp = (char *)name; + ___getservbyproto_yp = (char *)proto; +#endif + + setservent(_serv_stayopen); + while ( (p = getservent()) ) { + if (strcmp(name, p->s_name) == 0) + goto gotname; + for (cp = p->s_aliases; *cp; cp++) + if (strcmp(name, *cp) == 0) + goto gotname; + continue; +gotname: + if (proto == 0 || strcmp(p->s_proto, proto) == 0) + break; + } + if (!_serv_stayopen) + endservent(); + +#ifdef YP + ___getservbyname_yp = NULL; + ___getservbyproto_yp = NULL; +#endif + + return (p); +} diff --git a/newlib/libc/sys/linux/net/getservbyport.c b/newlib/libc/sys/linux/net/getservbyport.c new file mode 100644 index 000000000..88b684da4 --- /dev/null +++ b/newlib/libc/sys/linux/net/getservbyport.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getservbyport.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include + +extern int _serv_stayopen; + +struct servent * +getservbyport(port, proto) + int port; + const char *proto; +{ + struct servent *p; + +#ifdef YP + extern int ___getservbyport_yp; + extern char *___getservbyproto_yp; + + ___getservbyport_yp = port; + ___getservbyproto_yp = (char *)proto; +#endif + + setservent(_serv_stayopen); + while ( (p = getservent()) ) { + if (p->s_port != port) + continue; + if (proto == 0 || strcmp(p->s_proto, proto) == 0) + break; + } + if (!_serv_stayopen) + endservent(); + +#ifdef YP + ___getservbyport_yp = 0; + ___getservbyproto_yp = NULL; +#endif + + return (p); +} diff --git a/newlib/libc/sys/linux/net/getservent.3 b/newlib/libc/sys/linux/net/getservent.3 new file mode 100644 index 000000000..3d398bdb1 --- /dev/null +++ b/newlib/libc/sys/linux/net/getservent.3 @@ -0,0 +1,158 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)getservent.3 8.3 (Berkeley) 1/12/94 +.\" $FreeBSD: src/lib/libc/net/getservent.3,v 1.12 2001/10/01 16:08:55 ru Exp $ +.\" +.Dd July 9, 1995 +.Dt GETSERVENT 3 +.Os +.Sh NAME +.Nm getservent , +.Nm getservbyport , +.Nm getservbyname , +.Nm setservent , +.Nm endservent +.Nd get service entry +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In netdb.h +.Ft struct servent * +.Fn getservent +.Ft struct servent * +.Fn getservbyname "const char *name" "const char *proto" +.Ft struct servent * +.Fn getservbyport "int port" "const char *proto" +.Ft void +.Fn setservent "int stayopen" +.Ft void +.Fn endservent void +.Sh DESCRIPTION +The +.Fn getservent , +.Fn getservbyname , +and +.Fn getservbyport +functions +each return a pointer to an object with the +following structure +containing the broken-out +fields of a line in the network services data base, +.Pa /etc/services . +.Bd -literal -offset indent +struct servent { + char *s_name; /* official name of service */ + char **s_aliases; /* alias list */ + int s_port; /* port service resides at */ + char *s_proto; /* protocol to use */ +}; +.Ed +.Pp +The members of this structure are: +.Bl -tag -width s_aliases +.It Fa s_name +The official name of the service. +.It Fa s_aliases +A zero terminated list of alternate names for the service. +.It Fa s_port +The port number at which the service resides. +Port numbers are returned in network byte order. +.It Fa s_proto +The name of the protocol to use when contacting the +service. +.El +.Pp +The +.Fn getservent +function +reads the next line of the file, opening the file if necessary. +.Pp +The +.Fn setservent +function +opens and rewinds the file. If the +.Fa stayopen +flag is non-zero, +the net data base will not be closed after each call to +.Fn getservbyname +or +.Fn getservbyport . +.Pp +The +.Fn endservent +function +closes the file. +.Pp +The +.Fn getservbyname +and +.Fn getservbyport +functions +sequentially search from the beginning +of the file until a matching +protocol name or +port number (which must be specified in +network byte order) is found, +or until +.Dv EOF +is encountered. +If a protocol name is also supplied (non- +.Dv NULL ) , +searches must also match the protocol. +.Sh FILES +.Bl -tag -width /etc/services -compact +.It Pa /etc/services +.El +.Sh DIAGNOSTICS +Null pointer +(0) returned on +.Dv EOF +or error. +.Sh SEE ALSO +.Xr getprotoent 3 , +.Xr services 5 +.Sh HISTORY +The +.Fn getservent , +.Fn getservbyport , +.Fn getservbyname , +.Fn setservent , +and +.Fn endservent +functions appeared in +.Bx 4.2 . +.Sh BUGS +These functions use static data storage; +if the data is needed for future use, it should be +copied before any subsequent calls overwrite it. +Expecting port numbers to fit in a 32 bit +quantity is probably naive. diff --git a/newlib/libc/sys/linux/net/getservent.c b/newlib/libc/sys/linux/net/getservent.c new file mode 100644 index 000000000..1c26df75c --- /dev/null +++ b/newlib/libc/sys/linux/net/getservent.c @@ -0,0 +1,282 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#ifdef YP +#include +#include +#include +static int serv_stepping_yp = 0; +extern int _yp_check( char ** ); +#endif + + +#define MAXALIASES 35 + +static FILE *servf = NULL; +static char line[BUFSIZ+1]; +static struct servent serv; +static char *serv_aliases[MAXALIASES]; +int _serv_stayopen; + +#ifdef YP +char *___getservbyname_yp = NULL; +char *___getservbyproto_yp = NULL; +int ___getservbyport_yp = 0; +static char *yp_domain = NULL; + +static int +_getservbyport_yp(line) + char *line; +{ + char *result; + int resultlen; + char buf[YPMAXRECORD + 2]; + int rv; + + snprintf(buf, sizeof(buf), "%d/%s", ntohs(___getservbyport_yp), + ___getservbyproto_yp); + + ___getservbyport_yp = 0; + ___getservbyproto_yp = NULL; + + if(!yp_domain) { + if(yp_get_default_domain(&yp_domain)) + return (0); + } + + /* + * We have to be a little flexible here. Ideally you're supposed + * to have both a services.byname and a services.byport map, but + * some systems have only services.byname. FreeBSD cheats a little + * by putting the services.byport information in the same map as + * services.byname so that either case will work. We allow for both + * possibilities here: if there is no services.byport map, we try + * services.byname instead. + */ + if ((rv = yp_match(yp_domain, "services.byport", buf, strlen(buf), + &result, &resultlen))) { + if (rv == YPERR_MAP) { + if (yp_match(yp_domain, "services.byname", buf, + strlen(buf), &result, &resultlen)) + return(0); + } else + return(0); + } + + /* getservent() expects lines terminated with \n -- make it happy */ + snprintf(line, BUFSIZ, "%.*s\n", resultlen, result); + + free(result); + return(1); +} + +static int +_getservbyname_yp(line) + char *line; +{ + char *result; + int resultlen; + char buf[YPMAXRECORD + 2]; + + if(!yp_domain) { + if(yp_get_default_domain(&yp_domain)) + return (0); + } + + snprintf(buf, sizeof(buf), "%s/%s", ___getservbyname_yp, + ___getservbyproto_yp); + + ___getservbyname_yp = 0; + ___getservbyproto_yp = NULL; + + if (yp_match(yp_domain, "services.byname", buf, strlen(buf), + &result, &resultlen)) { + return(0); + } + + /* getservent() expects lines terminated with \n -- make it happy */ + snprintf(line, BUFSIZ, "%.*s\n", resultlen, result); + + free(result); + return(1); +} + +static int +_getservent_yp(line) + char *line; +{ + static char *key = NULL; + static int keylen; + char *lastkey, *result; + int resultlen; + int rv; + + if(!yp_domain) { + if(yp_get_default_domain(&yp_domain)) + return (0); + } + + if (!serv_stepping_yp) { + if (key) + free(key); + if ((rv = yp_first(yp_domain, "services.byname", &key, &keylen, + &result, &resultlen))) { + serv_stepping_yp = 0; + return(0); + } + serv_stepping_yp = 1; + } else { + lastkey = key; + rv = yp_next(yp_domain, "services.byname", key, keylen, &key, + &keylen, &result, &resultlen); + free(lastkey); + if (rv) { + serv_stepping_yp = 0; + return (0); + } + } + + /* getservent() expects lines terminated with \n -- make it happy */ + snprintf(line, BUFSIZ, "%.*s\n", resultlen, result); + + free(result); + + return(1); +} +#endif + +void +setservent(f) + int f; +{ + if (servf == NULL) + servf = fopen(_PATH_SERVICES, "r" ); + else + rewind(servf); + _serv_stayopen |= f; +} + +void +endservent() +{ + if (servf) { + fclose(servf); + servf = NULL; + } + _serv_stayopen = 0; +} + +struct servent * +getservent() +{ + char *p; + char *cp, **q; + +#ifdef YP + if (serv_stepping_yp && _getservent_yp(line)) { + p = (char *)&line; + goto unpack; + } +tryagain: +#endif + if (servf == NULL && (servf = fopen(_PATH_SERVICES, "r" )) == NULL) + return (NULL); +again: + if ((p = fgets(line, BUFSIZ, servf)) == NULL) + return (NULL); +#ifdef YP + if (*p == '+' && _yp_check(NULL)) { + if (___getservbyname_yp != NULL) { + if (!_getservbyname_yp(line)) + goto tryagain; + } + else if (___getservbyport_yp != 0) { + if (!_getservbyport_yp(line)) + goto tryagain; + } + else if (!_getservent_yp(line)) + goto tryagain; + } +unpack: +#endif + if (*p == '#') + goto again; + cp = strpbrk(p, "#\n"); + if (cp == NULL) + goto again; + *cp = '\0'; + serv.s_name = p; + p = strpbrk(p, " \t"); + if (p == NULL) + goto again; + *p++ = '\0'; + while (*p == ' ' || *p == '\t') + p++; + cp = strpbrk(p, ",/"); + if (cp == NULL) + goto again; + *cp++ = '\0'; + serv.s_port = htons((u_short)atoi(p)); + serv.s_proto = cp; + q = serv.s_aliases = serv_aliases; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &serv_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + } + *q = NULL; + return (&serv); +} diff --git a/newlib/libc/sys/linux/net/herror.c b/newlib/libc/sys/linux/net/herror.c new file mode 100644 index 000000000..0edec9890 --- /dev/null +++ b/newlib/libc/sys/linux/net/herror.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include "namespace.h" +#include +#include +#include +#include +#include +#include "un-namespace.h" + +const char *h_errlist[] = { + "Resolver Error 0 (no error)", + "Unknown host", /* 1 HOST_NOT_FOUND */ + "Host name lookup failure", /* 2 TRY_AGAIN */ + "Unknown server error", /* 3 NO_RECOVERY */ + "No address associated with name", /* 4 NO_ADDRESS */ +}; +int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] }; + +int h_errno; + +/* + * herror -- + * print the error indicated by the h_errno value. + */ +void +herror(s) + const char *s; +{ + char *ptr; + if (s && *s) { + write(STDERR_FILENO, s, strlen(s)); + write(STDERR_FILENO, ": ", 2); + } + ptr = (char *)hstrerror(h_errno); + write(STDERR_FILENO, ptr, strlen(ptr)); + write(STDERR_FILENO, "\n", 1); +} + +const char * +hstrerror(err) + int err; +{ + if (err < 0) + return ("Resolver internal error"); + else if (err < h_nerr) + return (h_errlist[err]); + return ("Unknown resolver error"); +} diff --git a/newlib/libc/sys/linux/net/hesiod.3 b/newlib/libc/sys/linux/net/hesiod.3 new file mode 100644 index 000000000..8de1f9247 --- /dev/null +++ b/newlib/libc/sys/linux/net/hesiod.3 @@ -0,0 +1,159 @@ +.\" $NetBSD: hesiod.3,v 1.1 1999/01/25 03:43:04 lukem Exp $ +.\" $FreeBSD: src/lib/libc/net/hesiod.3,v 1.3 2001/10/01 16:08:55 ru Exp $ +.\" +.\" from: #Id: hesiod.3,v 1.9.2.1 1997/01/03 21:02:23 ghudson Exp # +.\" +.\" Copyright 1988, 1996 by the Massachusetts Institute of Technology. +.\" +.\" Permission to use, copy, modify, and distribute this +.\" software and its documentation for any purpose and without +.\" fee is hereby granted, provided that the above copyright +.\" notice appear in all copies and that both that copyright +.\" notice and this permission notice appear in supporting +.\" documentation, and that the name of M.I.T. not be used in +.\" advertising or publicity pertaining to distribution of the +.\" software without specific, written prior permission. +.\" M.I.T. makes no representations about the suitability of +.\" this software for any purpose. It is provided "as is" +.\" without express or implied warranty. +.\" +.Dd November 30, 1996 +.Dt HESIOD 3 +.Os +.Sh NAME +.Nm hesiod , +.Nm hesiod_init , +.Nm hesiod_resolve , +.Nm hesiod_free_list , +.Nm hesiod_to_bind , +.Nm hesiod_end +.Nd Hesiod name server interface library +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In hesiod.h +.Ft int +.Fn hesiod_init "void **context" +.Ft char ** +.Fn hesiod_resolve "void *context" "const char *name" "const char *type" +.Ft void +.Fn hesiod_free_list "void *context" "char **list" +.Ft char * +.Fn hesiod_to_bind "void *context" "const char *name" "const char *type" +.Ft void +.Fn hesiod_end "void *context" +.Sh DESCRIPTION +This family of functions allows you to perform lookups of Hesiod +information, which is stored as text records in the Domain Name +Service. +To perform lookups, you must first initialize a +.Fa context , +an opaque object which stores information used internally by the +library between calls. +.Fn hesiod_init +initializes a context, storing a pointer to the context in the +location pointed to by the +.Fa context +argument. +.Fn hesiod_end +frees the resources used by a context. +.Pp +.Fn hesiod_resolve +is the primary interface to the library. +If successful, it returns a +list of one or more strings giving the records matching +.Fa name +and +.Fa type . +The last element of the list is followed by a +.Dv NULL +pointer. +It is the +caller's responsibility to call +.Fn hesiod_free_list +to free the resources used by the returned list. +.Pp +.Fn hesiod_to_bind +converts +.Fa name +and +.Fa type +into the DNS name used by +.Fn hesiod_resolve . +It is the caller's responsibility to free the returned string using +.Fn free . +.Sh RETURN VALUES +.Rv -std hesiod_init +On failure, +.Fn hesiod_resolve +and +.Fn hesiod_to_bind +return +.Dv NULL +and set the global variable +.Va errno +to indicate the error. +.Sh ENVIRONMENT +.Bl -tag -width HESIOD_CONFIG +.It Ev HES_DOMAIN +If the environment variable +.Ev HES_DOMAIN +is set, it will override the domain in the Hesiod configuration file. +.It Ev HESIOD_CONFIG +If the environment variable +.Ev HESIOD_CONFIG +is set, it specifies the location of the Hesiod configuration file. +.El +.Sh SEE ALSO +.Xr hesiod.conf 5 , +.Xr named 8 +.Rs +.%T "Hesiod - Project Athena Technical Plan -- Name Service" +.Re +.Sh ERRORS +Hesiod calls may fail because of: +.Bl -tag -width Er +.It Bq Er ENOMEM +Insufficient memory was available to carry out the requested +operation. +.It Bq Er ENOEXEC +.Fn hesiod_init +failed because the Hesiod configuration file was invalid. +.It Bq Er ECONNREFUSED +.Fn hesiod_resolve +failed because no name server could be contacted to answer the query. +.It Bq Er EMSGSIZE +.Fn hesiod_resolve +or +.Fn hesiod_to_bind +failed because the query or response was too big to fit into the +packet buffers. +.It Bq Er ENOENT +.Fn hesiod_resolve +failed because the name server had no text records matching +.Fa name +and +.Fa type , +or +.Fn hesiod_to_bind +failed because the +.Fa name +argument had a domain extension which could not be resolved with type +.Dq rhs\-extension +in the local Hesiod domain. +.El +.Sh AUTHORS +.An Steve Dyer , +IBM/Project Athena +.An Greg Hudson , +MIT Team Athena +.Pp +Copyright 1987, 1988, 1995, 1996 by the Massachusetts Institute of Technology. +.Sh BUGS +The strings corresponding to the +.Va errno +values set by the Hesiod functions are not particularly indicative of +what went wrong, especially for +.Er ENOEXEC +and +.Er ENOENT . diff --git a/newlib/libc/sys/linux/net/hesiod.c b/newlib/libc/sys/linux/net/hesiod.c new file mode 100644 index 000000000..909c09440 --- /dev/null +++ b/newlib/libc/sys/linux/net/hesiod.c @@ -0,0 +1,600 @@ +/* $NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $ */ + +/* Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* Copyright 1996 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +/* This file is part of the hesiod library. It implements the core + * portion of the hesiod resolver. + * + * This file is loosely based on an interim version of hesiod.c from + * the BIND IRS library, which was in turn based on an earlier version + * of this file. Extensive changes have been made on each step of the + * path. + * + * This implementation is not truly thread-safe at the moment because + * it uses res_send() and accesses _res. + */ + +#include + +#if 0 +static char *orig_rcsid = "$NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $"; +#endif +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +struct hesiod_p { + char *lhs; /* normally ".ns" */ + char *rhs; /* AKA the default hesiod domain */ + int classes[2]; /* The class search order. */ +}; + +#define MAX_HESRESP 1024 + +static int read_config_file(struct hesiod_p *, const char *); +static char **get_txt_records(int, const char *); +static int init_context(void); +static void translate_errors(void); + + +/* + * hesiod_init -- + * initialize a hesiod_p. + */ +int +hesiod_init(context) + void **context; +{ + struct hesiod_p *ctx; + const char *p, *configname; + + ctx = malloc(sizeof(struct hesiod_p)); + if (ctx) { + *context = ctx; + if (!issetugid()) + configname = getenv("HESIOD_CONFIG"); + else + configname = NULL; + if (!configname) + configname = _PATH_HESIOD_CONF; + if (read_config_file(ctx, configname) >= 0) { + /* + * The default rhs can be overridden by an + * environment variable. + */ + if (!issetugid()) + p = getenv("HES_DOMAIN"); + else + p = NULL; + if (p) { + if (ctx->rhs) + free(ctx->rhs); + ctx->rhs = malloc(strlen(p) + 2); + if (ctx->rhs) { + *ctx->rhs = '.'; + strcpy(ctx->rhs + 1, + (*p == '.') ? p + 1 : p); + return 0; + } else + errno = ENOMEM; + } else + return 0; + } + } else + errno = ENOMEM; + + if (ctx->lhs) + free(ctx->lhs); + if (ctx->rhs) + free(ctx->rhs); + if (ctx) + free(ctx); + return -1; +} + +/* + * hesiod_end -- + * Deallocates the hesiod_p. + */ +void +hesiod_end(context) + void *context; +{ + struct hesiod_p *ctx = (struct hesiod_p *) context; + + free(ctx->rhs); + if (ctx->lhs) + free(ctx->lhs); + free(ctx); +} + +/* + * hesiod_to_bind -- + * takes a hesiod (name, type) and returns a DNS + * name which is to be resolved. + */ +char * +hesiod_to_bind(void *context, const char *name, const char *type) +{ + struct hesiod_p *ctx = (struct hesiod_p *) context; + char bindname[MAXDNAME], *p, *ret, **rhs_list = NULL; + const char *rhs; + int len; + size_t bindnamelen; + + if (strlcpy(bindname, name, sizeof(bindname)) >= sizeof(bindname)) { + errno = EMSGSIZE; + return NULL; + } + + /* + * Find the right right hand side to use, possibly + * truncating bindname. + */ + p = strchr(bindname, '@'); + if (p) { + *p++ = 0; + if (strchr(p, '.')) + rhs = name + (p - bindname); + else { + rhs_list = hesiod_resolve(context, p, "rhs-extension"); + if (rhs_list) + rhs = *rhs_list; + else { + errno = ENOENT; + return NULL; + } + } + } else + rhs = ctx->rhs; + + /* See if we have enough room. */ + len = strlen(bindname) + 1 + strlen(type); + if (ctx->lhs) + len += strlen(ctx->lhs) + ((ctx->lhs[0] != '.') ? 1 : 0); + len += strlen(rhs) + ((rhs[0] != '.') ? 1 : 0); + if (len > sizeof(bindname) - 1) { + if (rhs_list) + hesiod_free_list(context, rhs_list); + errno = EMSGSIZE; + return NULL; + } + /* Put together the rest of the domain. */ + strcat(bindname, "."); + strcat(bindname, type); + /* Only append lhs if it isn't empty. */ + if (ctx->lhs && ctx->lhs[0] != '\0' ) { + if (ctx->lhs[0] != '.') + strcat(bindname, "."); + strcat(bindname, ctx->lhs); + } + if (rhs[0] != '.') + strcat(bindname, "."); + strcat(bindname, rhs); + + /* rhs_list is no longer needed, since we're done with rhs. */ + if (rhs_list) + hesiod_free_list(context, rhs_list); + + /* Make a copy of the result and return it to the caller. */ + bindnamelen = strlen (bindname) + 1; + ret = malloc (bindnamelen); + if (!ret) + errno = ENOMEM; + else + memcpy (ret, bindname, bindnamelen); + return ret; +} + +/* + * hesiod_resolve -- + * Given a hesiod name and type, return an array of strings returned + * by the resolver. + */ +char ** +hesiod_resolve(context, name, type) + void *context; + const char *name; + const char *type; +{ + struct hesiod_p *ctx = (struct hesiod_p *) context; + char *bindname, **retvec; + + bindname = hesiod_to_bind(context, name, type); + if (!bindname) + return NULL; + + retvec = get_txt_records(ctx->classes[0], bindname); + if (retvec == NULL && errno == ENOENT && ctx->classes[1]) + retvec = get_txt_records(ctx->classes[1], bindname); + + free(bindname); + return retvec; +} + +/*ARGSUSED*/ +void +hesiod_free_list(context, list) + void *context; + char **list; +{ + char **p; + + if (list == NULL) + return; + for (p = list; *p; p++) + free(*p); + free(list); +} + + +/* read_config_file -- + * Parse the /etc/hesiod.conf file. Returns 0 on success, + * -1 on failure. On failure, it might leave values in ctx->lhs + * or ctx->rhs which need to be freed by the caller. + */ +static int +read_config_file(ctx, filename) + struct hesiod_p *ctx; + const char *filename; +{ + char *key, *data, *p, **which; + char buf[MAXDNAME + 7]; + int n; + FILE *fp; + + /* Set default query classes. */ + ctx->classes[0] = C_IN; + ctx->classes[1] = C_HS; + + /* Try to open the configuration file. */ + fp = fopen(filename, "r"); + if (!fp) { + size_t len; + /* Use compiled in default domain names. */ + len = strlen (DEF_LHS) + 1; + ctx->lhs = malloc (len); + if (ctx->lhs) { + memcpy (ctx->lhs, DEF_LHS, len); + len = strlen (DEF_RHS) + 1; + ctx->rhs = malloc (len); + if (ctx->rhs) + memcpy (ctx->rhs, DEF_RHS, len); + } + if (ctx->lhs && ctx->rhs) + return 0; + else { + errno = ENOMEM; + return -1; + } + } + ctx->lhs = NULL; + ctx->rhs = NULL; + while (fgets(buf, sizeof(buf), fp) != NULL) { + p = buf; + if (*p == '#' || *p == '\n' || *p == '\r') + continue; + while (*p == ' ' || *p == '\t') + p++; + key = p; + while (*p != ' ' && *p != '\t' && *p != '=') + p++; + *p++ = 0; + + while (isspace(*p) || *p == '=') + p++; + data = p; + while (!isspace(*p)) + p++; + *p = 0; + + if (strcasecmp(key, "lhs") == 0 || + strcasecmp(key, "rhs") == 0) { + size_t len; + which = (strcasecmp(key, "lhs") == 0) + ? &ctx->lhs : &ctx->rhs; + len = strlen (data) + 1; + *which = malloc (len); + if (!*which) { + errno = ENOMEM; + return -1; + } + else + memcpy (*which, data, len); + } else { + if (strcasecmp(key, "classes") == 0) { + n = 0; + while (*data && n < 2) { + p = data; + while (*p && *p != ',') + p++; + if (*p) + *p++ = 0; + if (strcasecmp(data, "IN") == 0) + ctx->classes[n++] = C_IN; + else + if (strcasecmp(data, "HS") == 0) + ctx->classes[n++] = + C_HS; + data = p; + } + while (n < 2) + ctx->classes[n++] = 0; + } + } + } + fclose(fp); + + if (!ctx->rhs || ctx->classes[0] == 0 || + ctx->classes[0] == ctx->classes[1]) { + errno = ENOEXEC; + return -1; + } + return 0; +} + +/* + * get_txt_records -- + * Given a DNS class and a DNS name, do a lookup for TXT records, and + * return a list of them. + */ +static char ** +get_txt_records(qclass, name) + int qclass; + const char *name; +{ + HEADER *hp; + unsigned char qbuf[PACKETSZ], abuf[MAX_HESRESP], *p, *eom, *eor; + char *dst, **list; + int ancount, qdcount, i, j, n, skip, type, class, len; + + /* Make sure the resolver is initialized. */ + if ((_res.options & RES_INIT) == 0 && res_init() == -1) + return NULL; + + /* Construct the query. */ + n = res_mkquery(QUERY, name, qclass, T_TXT, NULL, 0, + NULL, qbuf, PACKETSZ); + if (n < 0) + return NULL; + + /* Send the query. */ + n = res_send(qbuf, n, abuf, MAX_HESRESP); + if (n < 0) { + errno = ECONNREFUSED; + return NULL; + } + /* Parse the header of the result. */ + hp = (HEADER *) (void *) abuf; + ancount = ntohs(hp->ancount); + qdcount = ntohs(hp->qdcount); + p = abuf + sizeof(HEADER); + eom = abuf + n; + + /* + * Skip questions, trying to get to the answer section + * which follows. + */ + for (i = 0; i < qdcount; i++) { + skip = dn_skipname(p, eom); + if (skip < 0 || p + skip + QFIXEDSZ > eom) { + errno = EMSGSIZE; + return NULL; + } + p += skip + QFIXEDSZ; + } + + /* Allocate space for the text record answers. */ + list = malloc((ancount + 1) * sizeof(char *)); + if (!list) { + errno = ENOMEM; + return NULL; + } + /* Parse the answers. */ + j = 0; + for (i = 0; i < ancount; i++) { + /* Parse the header of this answer. */ + skip = dn_skipname(p, eom); + if (skip < 0 || p + skip + 10 > eom) + break; + type = p[skip + 0] << 8 | p[skip + 1]; + class = p[skip + 2] << 8 | p[skip + 3]; + len = p[skip + 8] << 8 | p[skip + 9]; + p += skip + 10; + if (p + len > eom) { + errno = EMSGSIZE; + break; + } + /* Skip entries of the wrong class and type. */ + if (class != qclass || type != T_TXT) { + p += len; + continue; + } + /* Allocate space for this answer. */ + list[j] = malloc((size_t)len); + if (!list[j]) { + errno = ENOMEM; + break; + } + dst = list[j++]; + + /* Copy answer data into the allocated area. */ + eor = p + len; + while (p < eor) { + n = (unsigned char) *p++; + if (p + n > eor) { + errno = EMSGSIZE; + break; + } + memcpy(dst, p, (size_t)n); + p += n; + dst += n; + } + if (p < eor) { + errno = EMSGSIZE; + break; + } + *dst = 0; + } + + /* + * If we didn't terminate the loop normally, something + * went wrong. + */ + if (i < ancount) { + for (i = 0; i < j; i++) + free(list[i]); + free(list); + return NULL; + } + if (j == 0) { + errno = ENOENT; + free(list); + return NULL; + } + list[j] = NULL; + return list; +} + + /* + * COMPATIBILITY FUNCTIONS + */ + +static int inited = 0; +static void *context; +static int errval = HES_ER_UNINIT; + +int +hes_init() +{ + init_context(); + return errval; +} + +char * +hes_to_bind(name, type) + const char *name; + const char *type; +{ + static char *bindname; + if (init_context() < 0) + return NULL; + if (bindname) + free(bindname); + bindname = hesiod_to_bind(context, name, type); + if (!bindname) + translate_errors(); + return bindname; +} + +char ** +hes_resolve(name, type) + const char *name; + const char *type; +{ + static char **list; + + if (init_context() < 0) + return NULL; + + /* + * In the old Hesiod interface, the caller was responsible for + * freeing the returned strings but not the vector of strings itself. + */ + if (list) + free(list); + + list = hesiod_resolve(context, name, type); + if (!list) + translate_errors(); + return list; +} + +int +hes_error() +{ + return errval; +} + +void +hes_free(hp) + char **hp; +{ + hesiod_free_list(context, hp); +} + +static int +init_context() +{ + if (!inited) { + inited = 1; + if (hesiod_init(&context) < 0) { + errval = HES_ER_CONFIG; + return -1; + } + errval = HES_ER_OK; + } + return 0; +} + +static void +translate_errors() +{ + switch (errno) { + case ENOENT: + errval = HES_ER_NOTFOUND; + break; + case ECONNREFUSED: + case EMSGSIZE: + errval = HES_ER_NET; + break; + case ENOMEM: + default: + /* Not a good match, but the best we can do. */ + errval = HES_ER_CONFIG; + break; + } +} diff --git a/newlib/libc/sys/linux/net/if_indextoname.3 b/newlib/libc/sys/linux/net/if_indextoname.3 new file mode 100644 index 000000000..4b5bff5aa --- /dev/null +++ b/newlib/libc/sys/linux/net/if_indextoname.3 @@ -0,0 +1,142 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 +.\" $FreeBSD: src/lib/libc/net/if_indextoname.3,v 1.7 2001/10/01 16:08:55 ru Exp $ +.\" +.Dd May 21, 1998 +.Dt IF_NAMETOINDEX 3 +.Os +.Sh NAME +.Nm if_nametoindex , +.Nm if_indextoname , +.Nm if_nameindex , +.Nm if_freenameindex +.Nd convert interface index to name, and vice versa +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In net/if.h +.Ft "unsigned int" +.Fn if_nametoindex "const char *ifname" +.Ft "char *" +.Fn if_indextoname "unsigned int ifindex" "char *ifname" +.Ft "struct if_nameindex *" +.Fn if_nameindex "void" +.Ft "void" +.Fn if_freenameindex "struct if_nameindex *ptr" +.Sh DESCRIPTION +The functions map interface index to readable interface name +(such as +.Dq Li lo0 ) , +and vice versa. +.Pp +.Fn if_nametoindex +converts readable interface name to interface index +.Pp positive integer value . +If the specified interface does not exist, 0 will be returned. +.Pp +.Fn if_indextoname +converts interface index to readable interface name. +The +.Fa ifname +argument must point to a buffer of at least +.Dv IF_NAMESIZE +bytes into which the interface name corresponding to the specified index is +returned. +.Dv ( IF_NAMESIZE +is also defined in +.Aq Pa net/if.h +and its value includes a terminating null byte at the end of the +interface name.) +This pointer is also the return value of the function. +If there is no interface corresponding to the specified index, +.Dv NULL +is returned. +.Pp +.Fn if_nameindex +returns an array of +.Fa if_nameindex +structures. +.Fa if_nametoindex +is also defined in +.Aq Pa net/if.h , +and is as follows: +.Bd -literal -offset +struct if_nameindex { + unsigned int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "le0", ... */ +}; +.Ed +.Pp +The end of the array of structures is indicated by a structure with +an +.Fa if_index +of 0 and an +.Fa if_name +of +.Dv NULL . +The function returns a +.Dv NULL +pointer upon an error. +The memory used for this array of structures along with the interface +names pointed to by the +.Fa if_name +members is obtained dynamically. +This memory is freed by the +.Fn if_freenameindex +function. +.Pp +.Fn if_freenameindex +takes a pointer that was returned by +.Fn if_nameindex +as argument +.Pq Fa ptr , +and it reclaims the region allocated. +.Sh DIAGNOSTICS +.Fn if_nametoindex +returns 0 on error, positive integer on success. +.Fn if_indextoname +and +.Fn if_nameindex +return +.Dv NULL +on errors. +.Sh SEE ALSO +R. Gilligan, S. Thomson, J. Bound, and W. Stevens, +``Basic Socket Interface Extensions for IPv6,'' RFC2553, March 1999. +.Sh HISTORY +The implementation first appeared in WIDE Hydrangea IPv6 protocol stack kit. +.Sh STANDARDS +These functions are defined in ``Basic Socket Interface Extensions for IPv6'' +(RFC2533). diff --git a/newlib/libc/sys/linux/net/ifname.c b/newlib/libc/sys/linux/net/ifname.c new file mode 100644 index 000000000..b7975bc2b --- /dev/null +++ b/newlib/libc/sys/linux/net/ifname.c @@ -0,0 +1,227 @@ +/* $KAME: ifname.c,v 1.4 2001/08/20 02:32:40 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +/* + * TODO: + * - prototype defs into arpa/inet.h, not net/if.h (bsd-api-new-02) + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define ROUNDUP(a) \ + ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) +#define ADVANCE(x, n) + +static unsigned int +if_onametoindex(ifname) + const char *ifname; +{ + struct if_nameindex *iff = if_nameindex(), *ifx; + int ret; + + if (iff == NULL) return 0; + ifx = iff; + while (ifx->if_name != NULL) { + if (strcmp(ifx->if_name, ifname) == 0) { + ret = ifx->if_index; + if_freenameindex(iff); + return ret; + } + ifx++; + } + if_freenameindex(iff); + errno = ENXIO; + return 0; +} + +unsigned int +if_nametoindex(ifname) + const char *ifname; +{ + int s; + struct ifreq ifr; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s == -1) + return (0); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(s, SIOCGIFINDEX, &ifr) == -1) { + close (s); + return (if_onametoindex(ifname)); + } + close(s); + return (ifr.ifr_index); +} + +char * +if_indextoname(ifindex, ifname) + unsigned int ifindex; + char *ifname; /* at least IF_NAMESIZE */ +{ + struct if_nameindex *iff = if_nameindex(), *ifx; + char *cp, *dp; + + if (iff == NULL) return NULL; + ifx = iff; + while (ifx->if_index != 0) { + if (ifx->if_index == ifindex) { + cp = ifname; + dp = ifx->if_name; + while ((*cp++ = *dp++)) ; + if_freenameindex(iff); + return (ifname); + } + ifx++; + } + if_freenameindex(iff); + errno = ENXIO; + return NULL; +} + +struct if_nameindex * +if_nameindex() +{ + size_t needed; + int mib[6], i, ifn = 0, off = 0, hlen; + char *buf = NULL, *lim, *next, *cp, *ifbuf = NULL; + struct rt_msghdr *rtm; + struct if_msghdr *ifm; + struct sockaddr *sa; + struct if_nameindex *ret = NULL; + static int ifxs = 64; /* initial upper limit */ + struct _ifx { + int if_index; + int if_off; + } *ifx = NULL; + + mib[0] = CTL_NET; + mib[1] = PF_ROUTE; + mib[2] = 0; /* protocol */ + mib[3] = 0; /* wildcard address family */ + mib[4] = 0; + mib[5] = 0; /* no flags */ + if (__sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + return NULL; + if ((buf = malloc(needed)) == NULL) { + errno = ENOMEM; + goto end; + } + /* XXX: we may have allocated too much than necessary */ + if ((ifbuf = malloc(needed)) == NULL) { + errno = ENOMEM; + goto end; + } + if ((ifx = (struct _ifx *)malloc(sizeof(*ifx) * ifxs)) == NULL) { + errno = ENOMEM; + goto end; + } + if (__sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { + /* sysctl has set errno */ + goto end; + } + lim = buf + needed; + for (next = buf; next < lim; next += rtm->rtm_msglen) { + rtm = (struct rt_msghdr *)next; + if (rtm->rtm_version != RTM_VERSION) { + errno = EPROTONOSUPPORT; + goto end; + } + switch (rtm->rtm_type) { + case RTM_IFINFO: + ifm = (struct if_msghdr *)rtm; + ifx[ifn].if_index = ifm->ifm_index; + ifx[ifn].if_off = off; + cp = (char *)(ifm + 1); + for (i = 1; i; i <<= 1) { + if (i & ifm->ifm_addrs) { + sa = (struct sockaddr *)cp; + ADVANCE(cp, sa); + } + } + if (++ifn == ifxs) { + /* we need more memory */ + struct _ifx *newifx; + + ifxs *= 2; + if ((newifx = (struct _ifx *)malloc(sizeof(*newifx) * ifxs)) == NULL) { + errno = ENOMEM; + goto end; + } + + /* copy and free old data */ + memcpy(newifx, ifx, (sizeof(*ifx) * ifxs) / 2); + free(ifx); + ifx = newifx; + } + } + } + hlen = sizeof(struct if_nameindex) * (ifn + 1); + if ((cp = (char *)malloc(hlen + off)) == NULL) { + errno = ENOMEM; + goto end; + } + bcopy(ifbuf, cp + hlen, off); + ret = (struct if_nameindex *)cp; + for (i = 0; i < ifn; i++) { + ret[i].if_index = ifx[i].if_index; + ret[i].if_name = cp + hlen + ifx[i].if_off; + } + ret[ifn].if_index = 0; + ret[ifn].if_name = NULL; + + end: + if (buf) free(buf); + if (ifbuf) free(ifbuf); + if (ifx) free(ifx); + + return ret; +} + +void if_freenameindex(ptr) + struct if_nameindex *ptr; +{ + free(ptr); +} diff --git a/newlib/libc/sys/linux/net/inet.3 b/newlib/libc/sys/linux/net/inet.3 new file mode 100644 index 000000000..7a6fcf370 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet.3 @@ -0,0 +1,271 @@ +.\" Copyright (c) 1983, 1990, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)inet.3 8.1 (Berkeley) 6/4/93 +.\" $FreeBSD: src/lib/libc/net/inet.3,v 1.22 2001/12/01 03:43:01 mike Exp $ +.\" +.Dd June 17, 1996 +.Dt INET 3 +.Os +.Sh NAME +.Nm inet_aton , +.Nm inet_addr , +.Nm inet_network , +.Nm inet_ntoa , +.Nm inet_ntop , +.Nm inet_pton , +.Nm inet_makeaddr , +.Nm inet_lnaof , +.Nm inet_netof +.Nd Internet address manipulation routines +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In netinet/in.h +.In arpa/inet.h +.Ft int +.Fn inet_aton "const char *cp" "struct in_addr *pin" +.Ft in_addr_t +.Fn inet_addr "const char *cp" +.Ft in_addr_t +.Fn inet_network "const char *cp" +.Ft char * +.Fn inet_ntoa "struct in_addr in" +.Ft const char * +.Fn inet_ntop "int af" "const void *src" "char *dst" "socklen_t size" +.Ft int +.Fn inet_pton "int af" "const char *src" "void *dst" +.Ft struct in_addr +.Fn inet_makeaddr "in_addr_t net" "in_addr_t lna" +.Ft in_addr_t +.Fn inet_lnaof "struct in_addr in" +.Ft in_addr_t +.Fn inet_netof "struct in_addr in" +.Sh DESCRIPTION +The routines +.Fn inet_aton , +.Fn inet_addr +and +.Fn inet_network +interpret character strings representing +numbers expressed in the Internet standard +.Ql .\& +notation. +.Pp +The +.Fn inet_pton +function converts a presentation format address (that is, printable form +as held in a character string) to network format (usually a +.Ft struct in_addr +or some other internal binary representation, in network byte order). +It returns 1 if the address was valid for the specified address family, or +0 if the address wasn't parseable in the specified address family, or -1 +if some system error occurred (in which case +.Va errno +will have been set). +This function is presently valid for +.Dv AF_INET +and +.Dv AF_INET6 . +.Pp +The +.Fn inet_aton +routine interprets the specified character string as an Internet address, +placing the address into the structure provided. +It returns 1 if the string was successfully interpreted, +or 0 if the string is invalid. +The +.Fn inet_addr +and +.Fn inet_network +functions return numbers suitable for use +as Internet addresses and Internet network +numbers, respectively. +.Pp +The function +.Fn inet_ntop +converts an address from network format (usually a +.Ft struct in_addr +or some other binary form, in network byte order) to presentation format +(suitable for external display purposes). +It returns NULL if a system error occurs (in which case, +.Va errno +will have been set), or it returns a pointer to the destination string. +This function is presently valid for +.Dv AF_INET +and +.Dv AF_INET6 . +.Pp +The routine +.Fn inet_ntoa +takes an Internet address and returns an +.Tn ASCII +string representing the address in +.Ql .\& +notation. The routine +.Fn inet_makeaddr +takes an Internet network number and a local +network address and constructs an Internet address +from it. The routines +.Fn inet_netof +and +.Fn inet_lnaof +break apart Internet host addresses, returning +the network number and local network address part, +respectively. +.Pp +All Internet addresses are returned in network +order (bytes ordered from left to right). +All network numbers and local address parts are +returned as machine byte order integer values. +.Sh INTERNET ADDRESSES +Values specified using the +.Ql .\& +notation take one +of the following forms: +.Bd -literal -offset indent +a.b.c.d +a.b.c +a.b +a +.Ed +.Pp +When four parts are specified, each is interpreted +as a byte of data and assigned, from left to right, +to the four bytes of an Internet address. Note +that when an Internet address is viewed as a 32-bit +integer quantity on the +.Tn VAX +the bytes referred to +above appear as +.Dq Li d.c.b.a . +That is, +.Tn VAX +bytes are +ordered from right to left. +.Pp +When a three part address is specified, the last +part is interpreted as a 16-bit quantity and placed +in the right-most two bytes of the network address. +This makes the three part address format convenient +for specifying Class B network addresses as +.Dq Li 128.net.host . +.Pp +When a two part address is supplied, the last part +is interpreted as a 24-bit quantity and placed in +the right most three bytes of the network address. +This makes the two part address format convenient +for specifying Class A network addresses as +.Dq Li net.host . +.Pp +When only one part is given, the value is stored +directly in the network address without any byte +rearrangement. +.Pp +All numbers supplied as +.Dq parts +in a +.Ql .\& +notation +may be decimal, octal, or hexadecimal, as specified +in the C language (i.e., a leading 0x or 0X implies +hexadecimal; otherwise, a leading 0 implies octal; +otherwise, the number is interpreted as decimal). +.Pp +The +.Fn inet_aton +and +.Fn inet_ntoa +functions are semi-deprecated in favor of the +.Xr addr2ascii 3 +family. However, since those functions are not yet widely implemented, +portable programs cannot rely on their presence and will continue +to use the +.Xr inet 3 +functions for some time. +.Sh DIAGNOSTICS +The constant +.Dv INADDR_NONE +is returned by +.Fn inet_addr +and +.Fn inet_network +for malformed requests. +.Sh SEE ALSO +.Xr addr2ascii 3 , +.Xr byteorder 3 , +.Xr gethostbyname 3 , +.Xr getnetent 3 , +.Xr inet_net 3 , +.Xr hosts 5 , +.Xr networks 5 +.Rs +.%R RFC +.%N 2373 +.%D July 1998 +.%T "IP Version 6 Addressing Architecture" +.Re +.Sh STANDARDS +The +.Fn inet_ntop +and +.Fn inet_pton +functions conform to +.St -xns5.2 . +Note that +.Fn inet_pton +does not accept 1-, 2-, or 3-part dotted addresses; all four parts +must be specified and are interpreted only as decimal values. +This is a narrower input set than that accepted by +.Fn inet_aton . +.Sh HISTORY +These +functions appeared in +.Bx 4.2 . +.Sh BUGS +The value +.Dv INADDR_NONE +(0xffffffff) is a valid broadcast address, but +.Fn inet_addr +cannot return that value without indicating failure. +The newer +.Fn inet_aton +function does not share this problem. +The problem of host byte ordering versus network byte ordering is +confusing. +The string returned by +.Fn inet_ntoa +resides in a static memory area. +.Pp +Inet_addr should return a +.Fa struct in_addr . diff --git a/newlib/libc/sys/linux/net/inet6_option_space.3 b/newlib/libc/sys/linux/net/inet6_option_space.3 new file mode 100644 index 000000000..328c70f48 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet6_option_space.3 @@ -0,0 +1,445 @@ +.\" Copyright (c) 1983, 1987, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id$ +.\" $FreeBSD: src/lib/libc/net/inet6_option_space.3,v 1.8 2001/10/01 16:08:55 ru Exp $ +.\" +.Dd December 10, 1999 +.Dt INET6_OPTION_SPACE 3 +.Os +.\" +.Sh NAME +.Nm inet6_option_space , +.Nm inet6_option_init , +.Nm inet6_option_append , +.Nm inet6_option_alloc , +.Nm inet6_option_next , +.Nm inet6_option_find +.Nd IPv6 Hop-by-Hop and Destination Options manipulation +.\" +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In netinet/in.h +.Ft "int" +.Fn inet6_option_space "int nbytes" +.Ft "int" +.Fn inet6_option_init "void *bp" "struct cmsghdr **cmsgp" "int type" +.Ft "int" +.Fn inet6_option_append "struct cmsghdr *cmsg" "const u_int8_t *typep" "int multx" "int plusy" +.Ft "u_int8_t *" +.Fn inet6_option_alloc "struct cmsghdr *cmsg" "int datalen" "int multx" "int plusy" +.Ft "int" +.Fn inet6_option_next "const struct cmsghdr *cmsg" "u_int8_t **tptrp" +.Ft "int" +.Fn inet6_option_find "const struct cmsghdr *cmsg" "u_int8_t **tptrp" "int type" +.\" +.Sh DESCRIPTION +.\" +Building and parsing the Hop-by-Hop and Destination options is +complicated due to alignment constranints, padding and +ancillary data manipulation. +RFC2292 defines a set of functions to help the application. +The function prototypes for +these functions are all in the +.Aq Li netinet/in.h +header. +.\" +.Ss inet6_option_space +.Fn inet6_option_space +returns the number of bytes required to hold an option when it is stored as +ancillary data, including the +.Li cmsghdr +structure at the beginning, +and any padding at the end +(to make its size a multiple of 8 bytes). +The argument is the size of the structure defining the option, +which must include any pad bytes at the beginning +(the value +.Li y +in the alignment term +.Dq Li "xn + y" ) , +the type byte, the length byte, and the option data. +.Pp +Note: If multiple options are stored in a single ancillary data +object, which is the recommended technique, this function +overestimates the amount of space required by the size of +.Li N-1 +.Li cmsghdr +structures, +where +.Li N +is the number of options to be stored in the object. +This is of little consequence, since it is assumed that most +Hop-by-Hop option headers and Destination option headers carry only +one option +(appendix B of [RFC-2460]). +.\" +.Ss inet6_option_init +.Fn inet6_option_init +is called once per ancillary data object that will +contain either Hop-by-Hop or Destination options. +It returns +.Li 0 +on success or +.Li -1 +on an error. +.Pp +.Fa bp +is a pointer to previously allocated space that will contain the +ancillary data object. +It must be large enough to contain all the +individual options to be added by later calls to +.Fn inet6_option_append +and +.Fn inet6_option_alloc . +.Pp +.Fa cmsgp +is a pointer to a pointer to a +.Li cmsghdr +structure. +.Fa *cmsgp +is initialized by this function to point to the +.Li cmsghdr +structure constructed by this function in the buffer pointed to by +.Fa bp . +.Pp +.Fa type +is either +.Dv IPV6_HOPOPTS +or +.Dv IPV6_DSTOPTS . +This +.Fa type +is stored in the +.Li cmsg_type +member of the +.Li cmsghdr +structure pointed to by +.Fa *cmsgp . +.\" +.Ss inet6_option_append +This function appends a Hop-by-Hop option or a Destination option +into an ancillary data object that has been initialized by +.Fn inet6_option_init . +This function returns +.Li 0 +if it succeeds or +.Li -1 +on an error. +.Pp +.Fa cmsg +is a pointer to the +.Li cmsghdr +structure that must have been +initialized by +.Fn inet6_option_init . +.Pp +.Fa typep +is a pointer to the 8-bit option type. +It is assumed that this +field is immediately followed by the 8-bit option data length field, +which is then followed immediately by the option data. +The caller +initializes these three fields +(the type-length-value, or TLV) +before calling this function. +.Pp +The option type must have a value from +.Li 2 +to +.Li 255 , +inclusive. +.Li ( 0 +and +.Li 1 +are reserved for the +.Li Pad1 +and +.Li PadN +options, respectively.) +.Pp +The option data length must have a value between +.Li 0 +and +.Li 255 , +inclusive, and is the length of the option data that follows. +.Pp +.Fa multx +is the value +.Li x +in the alignment term +.Dq Li xn + y . +It must have a value of +.Li 1 , +.Li 2 , +.Li 4 , +or +.Li 8 . +.Pp +.Fa plusy +is the value +.Li y +in the alignment term +.Dq Li xn + y . +It must have a value between +.Li 0 +and +.Li 7 , +inclusive. +.\" +.Ss inet6_option_alloc +This function appends a Hop-by-Hop option or a Destination option +into an ancillary data object that has been initialized by +.Fn inet6_option_init . +This function returns a pointer to the 8-bit +option type field that starts the option on success, or +.Dv NULL +on an error. +.Pp +The difference between this function and +.Fn inet6_option_append +is that the latter copies the contents of a previously built option into +the ancillary data object while the current function returns a +pointer to the space in the data object where the option's TLV must +then be built by the caller. +.Pp +.Fa cmsg +is a pointer to the +.Li cmsghdr +structure that must have been +initialized by +.Fn inet6_option_init . +.Pp +.Fa datalen +is the value of the option data length byte for this option. +This value is required as an argument to allow the function to +determine if padding must be appended at the end of the option. +(The +.Fn inet6_option_append +function does not need a data length argument +since the option data length must already be stored by the caller.) +.Pp +.Fa multx +is the value +.Li x +in the alignment term +.Dq Li xn + y . +It must have a value of +.Li 1 , +.Li 2 , +.Li 4 , +or +.Li 8 . +.Pp +.Fa plusy +is the value +.Li y +in the alignment term +.Dq Li xn + y . +It must have a value between +.Li 0 +and +.Li 7 , +inclusive. +.\" +.Ss inet6_option_next +This function processes the next Hop-by-Hop option or Destination +option in an ancillary data object. +If another option remains to be +processed, the return value of the function is +.Li 0 +and +.Fa *tptrp +points to +the 8-bit option type field +(which is followed by the 8-bit option +data length, followed by the option data). +If no more options remain +to be processed, the return value is +.Li -1 +and +.Fa *tptrp +is +.Dv NULL . +If an error occurs, the return value is +.Li -1 +and +.Fa *tptrp +is not +.Dv NULL . +.Pp +.Fa cmsg +is a pointer to +.Li cmsghdr +structure of which +.Li cmsg_level +equals +.Dv IPPROTO_IPV6 +and +.Li cmsg_type +equals either +.Dv IPV6_HOPOPTS +or +.Dv IPV6_DSTOPTS . +.Pp +.Fa tptrp +is a pointer to a pointer to an 8-bit byte and +.Fa *tptrp +is used +by the function to remember its place in the ancillary data object +each time the function is called. +The first time this function is +called for a given ancillary data object, +.Fa *tptrp +must be set to +.Dv NULL . +.Pp +Each time this function returns success, +.Fa *tptrp +points to the 8-bit +option type field for the next option to be processed. +.\" +.Ss inet6_option_find +This function is similar to the previously described +.Fn inet6_option_next +function, except this function lets the caller +specify the option type to be searched for, instead of always +returning the next option in the ancillary data object. +.Fa cmsg +is a +pointer to +.Li cmsghdr +structure of which +.Li cmsg_level +equals +.Dv IPPROTO_IPV6 +and +.Li cmsg_type +equals either +.Dv IPV6_HOPOPTS +or +.Dv IPV6_DSTOPTS . +.Pp +.Fa tptrp +is a pointer to a pointer to an 8-bit byte and +.Fa *tptrp +is used +by the function to remember its place in the ancillary data object +each time the function is called. +The first time this function is +called for a given ancillary data object, +.Fa *tptrp +must be set to +.Dv NULL . +.Pa +This function starts searching for an option of the specified type +beginning after the value of +.Fa *tptrp . +If an option of the specified +type is located, this function returns +.Li 0 +and +.Fa *tptrp +points to the 8- +bit option type field for the option of the specified type. +If an +option of the specified type is not located, the return value is +.Li -1 +and +.Fa *tptrp +is +.Dv NULL . +If an error occurs, the return value is +.Li -1 +and +.Fa *tptrp +is not +.Dv NULL . +.\" +.Sh DIAGNOSTICS +.Fn inet6_option_init +and +.Fn inet6_option_append +return +.Li 0 +on success or +.Li -1 +on an error. +.Pp +.Fn inet6_option_alloc +returns +.Dv NULL +on an error. +.Pp +On errors, +.Fn inet6_option_next +and +.Fn inet6_option_find +return +.Li -1 +setting +.Fa *tptrp +to non +.Dv NULL +value. +.\" +.Sh EXAMPLES +RFC2292 gives comprehensive examples in chapter 6. +.\" +.Sh SEE ALSO +.Rs +.%A W. Stevens +.%A M. Thomas +.%T "Advanced Sockets API for IPv6" +.%N RFC2292 +.%D February 1998 +.Re +.Rs +.%A S. Deering +.%A R. Hinden +.%T "Internet Protocol, Version 6 (IPv6) Specification" +.%N RFC2460 +.%D December 1998 +.Re +.\" +.Sh HISTORY +The implementation first appeared in KAME advanced networking kit. +.\" +.Sh STANDARDS +The functions +are documented in +.Dq Advanced Sockets API for IPv6 +(RFC2292). +.\" +.Sh BUGS +The text was shamelessly copied from RFC2292. diff --git a/newlib/libc/sys/linux/net/inet6_rthdr_space.3 b/newlib/libc/sys/linux/net/inet6_rthdr_space.3 new file mode 100644 index 000000000..d2c575dca --- /dev/null +++ b/newlib/libc/sys/linux/net/inet6_rthdr_space.3 @@ -0,0 +1,323 @@ +.\" Copyright (c) 1983, 1987, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id$ +.\" $FreeBSD: src/lib/libc/net/inet6_rthdr_space.3,v 1.8 2001/10/01 16:08:55 ru Exp $ +.\" +.Dd December 10, 1999 +.Dt INET6_RTHDR_SPACE 3 +.Os +.\" +.Sh NAME +.Nm inet6_rthdr_space , +.Nm inet6_rthdr_init , +.Nm inet6_rthdr_add , +.Nm inet6_rthdr_lasthop , +.Nm inet6_rthdr_reverse , +.Nm inet6_rthdr_segments , +.Nm inet6_rthdr_getaddr , +.Nm inet6_rthdr_getflags +.Nd IPv6 Routing Header Options manipulation +.\" +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In netinet/in.h +.Ft size_t +.Fn inet6_rthdr_space "int type" "int segments" +.Ft "struct cmsghdr *" +.Fn inet6_rthdr_init "void *bp" "int type" +.Ft int +.Fn inet6_rthdr_add "struct cmsghdr *cmsg" "const struct in6_addr *addr" "unsigned int flags" +.Ft int +.Fn inet6_rthdr_lasthop "struct cmsghdr *cmsg" "unsigned int flags" +.Ft int +.Fn inet6_rthdr_reverse "const struct cmsghdr *in" "struct cmsghdr *out" +.Ft int +.Fn inet6_rthdr_segments "const struct cmsghdr *cmsg" +.Ft "struct in6_addr *" +.Fn inet6_rthdr_getaddr "struct cmsghdr *cmsg" "int index" +.Ft int +.Fn inet6_rthdr_getflags "const struct cmsghdr *cmsg" "int index" +.\" +.Sh DESCRIPTION +RFC2292 IPv6 advanced API defines eight +functions that the application calls to build and examine a Routing +header. Four functions build a Routing header: +.Bl -hang +.It Fn inet6_rthdr_space +return #bytes required for ancillary data +.It Fn inet6_rthdr_init +initialize ancillary data for Routing header +.It Fn inet6_rthdr_add +add IPv6 address & flags to Routing header +.It Fn inet6_rthdr_lasthop +specify the flags for the final hop +.El +.Pp +Four functions deal with a returned Routing header: +.Bl -hang +.It Fn inet6_rthdr_reverse +reverse a Routing header +.It Fn inet6_rthdr_segments +return #segments in a Routing header +.It Fn inet6_rthdr_getaddr +fetch one address from a Routing header +.It Fn inet6_rthdr_getflags +fetch one flag from a Routing header +.El +.Pp +The function prototypes for these functions are all in the +.Aq Li netinet/in.h +header. +.\" +.Ss inet6_rthdr_space +This function returns the number of bytes required to hold a Routing +header of the specified +.Fa type +containing the specified number of +.Fa segments +(addresses). +For an IPv6 Type 0 Routing header, the number +of segments must be between 1 and 23, inclusive. The return value +includes the size of the cmsghdr structure that precedes the Routing +header, and any required padding. +.Pp +If the return value is 0, then either the type of the Routing header +is not supported by this implementation or the number of segments is +invalid for this type of Routing header. +.Pp +Note: This function returns the size but does not allocate the space +required for the ancillary data. +This allows an application to +allocate a larger buffer, if other ancillary data objects are +desired, since all the ancillary data objects must be specified to +.Xr sendmsg 2 +as a single +.Li msg_control +buffer. +.\" +.Ss inet6_rthdr_init +This function initializes the buffer pointed to by +.Fa bp +to contain a +.Li cmsghdr +structure followed by a Routing header of the specified +.Fa type . +The +.Li cmsg_len +member of the +.Li cmsghdr +structure is initialized to the +size of the structure plus the amount of space required by the +Routing header. +The +.Li cmsg_level +and +.Li cmsg_type +members are also initialized as required. +.Pp +The caller must allocate the buffer and its size can be determined by +calling +.Fn inet6_rthdr_space . +.Pp +Upon success the return value is the pointer to the +.Li cmsghdr +structure, and this is then used as the first argument to the next +two functions. +Upon an error the return value is +.Dv NULL . +.\" +.Ss inet6_rthdr_add +This function adds the address pointed to by +.Fa addr +to the end of the +Routing header being constructed and sets the type of this hop to the +value of +.Fa flags . +For an IPv6 Type 0 Routing header, +.Fa flags +must be +either +.Dv IPV6_RTHDR_LOOSE +or +.Dv IPV6_RTHDR_STRICT . +.Pp +If successful, the +.Li cmsg_len +member of the +.Li cmsghdr +structure is +updated to account for the new address in the Routing header and the +return value of the function is 0. +Upon an error the return value of +the function is -1. +.\" +.Ss inet6_rthdr_lasthop +This function specifies the Strict/Loose flag for the final hop of a +Routing header. +For an IPv6 Type 0 Routing header, +.Fa flags +must be either +.Dv IPV6_RTHDR_LOOSE +or +.Dv IPV6_RTHDR_STRICT . +.Pp +The return value of the function is 0 upon success, or -1 upon an error. +.Pp +Notice that a Routing header specifying +.Li N +intermediate nodes requires +.Li N+1 +Strict/Loose flags. +This requires +.Li N +calls to +.Fn inet6_rthdr_add +followed by one call to +.Fn inet6_rthdr_lasthop . +.\" +.Ss inet6_rthdr_reverse +This function is not yet implemented. +When implemented, this should behave as follows. +.Pp +This function takes a Routing header that was received as ancillary +data +(pointed to by the first argument, +.Fa in ) +and writes a new Routing +header that sends datagrams along the reverse of that route. +Both +arguments are allowed to point to the same buffer +(that is, the reversal can occur in place). +.Pp +The return value of the function is 0 on success, or -1 upon an +error. +.\" +.Ss inet6_rthdr_segments +This function returns the number of segments +(addresses) +contained in +the Routing header described by +.Fa cmsg . +On success the return value is +between 1 and 23, inclusive. +The return value of the function is -1 upon an error. +.\" +.Ss inet6_rthdr_getaddr +This function returns a pointer to the IPv6 address specified by +.Fa index +(which must have a value between 1 and the value returned by +.Fn inet6_rthdr_segments ) +in the Routing header described by +.Fa cmsg . +An +application should first call +.Fn inet6_rthdr_segments +to obtain the number of segments in the Routing header. +.Pp +Upon an error the return value of the function is +.Dv NULL . +.\" +.Ss inet6_rthdr_getflags +This function returns the flags value specified by +.Fa index +(which must +have a value between 0 and the value returned by +.Fn inet6_rthdr_segments ) +in the Routing header described by +.Fa cmsg . +For an IPv6 Type 0 Routing header the return value will be either +.Dv IPV6_RTHDR_LOOSE +or +.Dv IPV6_RTHDR_STRICT . +.Pp +Upon an error the return value of the function is -1. +.Pp +Note: Addresses are indexed starting at 1, and flags starting at 0, +to maintain consistency with the terminology and figures in RFC2460. +.\" +.Sh DIAGNOSTICS +.Fn inet6_rthdr_space +returns 0 on errors. +.Pp +.Fn inet6_rthdr_add , +.Fn inet6_rthdr_lasthop +and +.Fn inet6_rthdr_reverse +return 0 on success, and returns -1 on error. +.Pp +.Fn inet6_rthdr_init +and +.Fn inet6_rthdr_getaddr +return +.Dv NULL +on error. +.Pp +.Fn inet6_rthdr_segments +and +.Fn inet6_rthdr_getflags +return -1 on error. +.\" +.Sh EXAMPLES +RFC2292 gives comprehensive examples in chapter 8. +.\" +.Sh SEE ALSO +.Rs +.%A W. Stevens +.%A M. Thomas +.%T "Advanced Sockets API for IPv6" +.%N RFC2292 +.%D February 1998 +.Re +.Rs +.%A S. Deering +.%A R. Hinden +.%T "Internet Protocol, Version 6 (IPv6) Specification" +.%N RFC2460 +.%D December 1998 +.Re +.\" +.Sh HISTORY +The implementation first appeared in KAME advanced networking kit. +.\" +.Sh STANDARDS +The functions +are documented in +.Dq Advanced Sockets API for IPv6 +(RFC2292). +.\" +.Sh BUGS +The text was shamelessly copied from RFC2292. +.Pp +.Fn inet6_rthdr_reverse +is not implemented yet. diff --git a/newlib/libc/sys/linux/net/inet_addr.c b/newlib/libc/sys/linux/net/inet_addr.c new file mode 100644 index 000000000..874ca80e6 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_addr.c @@ -0,0 +1,201 @@ +/* $KAME: inet_addr.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ + +/* + * ++Copyright++ 1983, 1990, 1993 + * - + * Copyright (c) 1983, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +/* + * ASCII internet address interpretation routine. + * The value returned is in network order. + */ +in_addr_t /* XXX should be struct in_addr :( */ +inet_addr(cp) + const char *cp; +{ + struct in_addr val; + + if (inet_aton(cp, &val)) + return (val.s_addr); + return (INADDR_NONE); +} + +/* + * Check whether "cp" is a valid ASCII representation + * of an Internet address and convert to a binary address. + * Returns 1 if the address is valid, 0 if not. + * This replaces inet_addr, the return value from which + * cannot distinguish between failure and a local broadcast address. + */ +int +inet_aton(cp, addr) + const char *cp; + struct in_addr *addr; +{ + u_long parts[4]; + in_addr_t val; + char *c; + char *endptr; + int gotend, n; + + c = (char *)cp; + n = 0; + /* + * Run through the string, grabbing numbers until + * the end of the string, or some error + */ + gotend = 0; + while (!gotend) { + errno = 0; + val = strtoul(c, &endptr, 0); + + if (errno == ERANGE) /* Fail completely if it overflowed. */ + return (0); + + /* + * If the whole string is invalid, endptr will equal + * c.. this way we can make sure someone hasn't + * gone '.12' or something which would get past + * the next check. + */ + if (endptr == c) + return (0); + parts[n] = val; + c = endptr; + + /* Check the next character past the previous number's end */ + switch (*c) { + case '.' : + /* Make sure we only do 3 dots .. */ + if (n == 3) /* Whoops. Quit. */ + return (0); + n++; + c++; + break; + + case '\0': + gotend = 1; + break; + + default: + if (isspace((unsigned char)*c)) { + gotend = 1; + break; + } else + return (0); /* Invalid character, so fail */ + } + + } + + /* + * Concoct the address according to + * the number of parts specified. + */ + + switch (n) { + case 0: /* a -- 32 bits */ + /* + * Nothing is necessary here. Overflow checking was + * already done in strtoul(). + */ + break; + case 1: /* a.b -- 8.24 bits */ + if (val > 0xffffff || parts[0] > 0xff) + return (0); + val |= parts[0] << 24; + break; + + case 2: /* a.b.c -- 8.8.16 bits */ + if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16); + break; + + case 3: /* a.b.c.d -- 8.8.8.8 bits */ + if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff || + parts[2] > 0xff) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + break; + } + + if (addr != NULL) + addr->s_addr = htonl(val); + return (1); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_addr +__weak_reference(__inet_addr, inet_addr); +#undef inet_aton +__weak_reference(__inet_aton, inet_aton); diff --git a/newlib/libc/sys/linux/net/inet_lnaof.c b/newlib/libc/sys/linux/net/inet_lnaof.c new file mode 100644 index 000000000..c6c999dd1 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_lnaof.c @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include + +#include +#include +#include + +/* + * Return the local network address portion of an + * internet address; handles class a/b/c network + * number formats. + */ +in_addr_t +inet_lnaof(in) + struct in_addr in; +{ + in_addr_t i = ntohl(in.s_addr); + + if (IN_CLASSA(i)) + return ((i)&IN_CLASSA_HOST); + else if (IN_CLASSB(i)) + return ((i)&IN_CLASSB_HOST); + else + return ((i)&IN_CLASSC_HOST); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_lnaof +__weak_reference(__inet_lnaof, inet_lnaof); diff --git a/newlib/libc/sys/linux/net/inet_makeaddr.c b/newlib/libc/sys/linux/net/inet_makeaddr.c new file mode 100644 index 000000000..339b2d5a7 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_makeaddr.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include + +#include +#include +#include + +/* + * Formulate an Internet address from network + host. Used in + * building addresses stored in the ifnet structure. + */ +struct in_addr +inet_makeaddr(net, host) + in_addr_t net, host; +{ + in_addr_t addr; + + if (net < 128) + addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); + else if (net < 65536) + addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); + else if (net < 16777216L) + addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); + else + addr = net | host; + addr = htonl(addr); + return (*(struct in_addr *)&addr); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_makeaddr +__weak_reference(__inet_makeaddr, inet_makeaddr); diff --git a/newlib/libc/sys/linux/net/inet_net.3 b/newlib/libc/sys/linux/net/inet_net.3 new file mode 100644 index 000000000..1d43bcc1d --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_net.3 @@ -0,0 +1,157 @@ +.\" $NetBSD: inet_net.3,v 1.4 1999/03/22 19:44:52 garbled Exp $ +.\" +.\" Copyright (c) 1997 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Luke Mewburn. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD: src/lib/libc/net/inet_net.3,v 1.1 2001/08/31 10:54:44 ru Exp $ +.\" +.Dd June 18, 1997 +.Dt INET_NET 3 +.Os +.Sh NAME +.Nm inet_net_ntop , +.Nm inet_net_pton +.Nd Internet network number manipulation routines +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In netinet/in.h +.In arpa/inet.h +.Ft char * +.Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size" +.Ft int +.Fn inet_net_pton "int af" "const char *src" "void *dst" "size_t size" +.Sh DESCRIPTION +The +.Fn inet_net_ntop +function converts an Internet network number from network format (usually a +.Vt "struct in_addr" +or some other binary form, in network byte order) to CIDR presentation format +(suitable for external display purposes). +.Fa bits +is the number of bits in +.Fa src +that are the network number. +It returns +.Dv NULL +if a system error occurs (in which case, +.Va errno +will have been set), or it returns a pointer to the destination string. +.Pp +The +.Fn inet_net_pton +function converts a presentation format Internet network number (that is, +printable form as held in a character string) to network format (usually a +.Vt "struct in_addr" +or some other internal binary representation, in network byte order). +It returns the number of bits (either computed based on the class, or +specified with /CIDR), or \-1 if a failure occurred +(in which case +.Va errno +will have been set. +It will be set to +.Er ENOENT +if the Internet network number was not valid). +.Pp +The only value for +.Fa af +currently supported is +.Dv AF_INET . +.Fa size +is the size of the result buffer +.Fa dst . +.Pp +.Sh NETWORK NUMBERS (IP VERSION 4) +Internet network numbers may be specified in one of the following forms: +.Bd -literal -offset indent +a.b.c.d/bits +a.b.c.d +a.b.c +a.b +a +.Ed +.Pp +When four parts are specified, each is interpreted +as a byte of data and assigned, from left to right, +to the four bytes of an Internet network number. +Note +that when an Internet network number is viewed as a 32-bit +integer quantity on a system that uses little-endian +byte order (such as the +.Tn Intel 386 , 486 , +and +.Tn Pentium +processors) the bytes referred to above appear as +.Dq Li d.c.b.a . +That is, little-endian bytes are ordered from right to left. +.Pp +When a three part number is specified, the last +part is interpreted as a 16-bit quantity and placed +in the rightmost two bytes of the Internet network number. +This makes the three part number format convenient +for specifying Class B network numbers as +.Dq Li 128.net.host . +.Pp +When a two part number is supplied, the last part +is interpreted as a 24-bit quantity and placed in +the rightmost three bytes of the Internet network number. +This makes the two part number format convenient +for specifying Class A network numbers as +.Dq Li net.host . +.Pp +When only one part is given, the value is stored +directly in the Internet network number without any byte +rearrangement. +.Pp +All numbers supplied as +.Dq parts +in a +.Ql \&. +notation +may be decimal, octal, or hexadecimal, as specified +in the C language (i.e., a leading 0x or 0X implies +hexadecimal; otherwise, a leading 0 implies octal; +otherwise, the number is interpreted as decimal). +.Sh SEE ALSO +.Xr byteorder 3 , +.Xr inet 3 , +.Xr networks 5 +.Sh HISTORY +The +.Fn inet_net_ntop +and +.Fn inet_net_pton +functions appeared in BIND 4.9.4. diff --git a/newlib/libc/sys/linux/net/inet_net_ntop.c b/newlib/libc/sys/linux/net/inet_net_ntop.c new file mode 100644 index 000000000..caa99f0ec --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_net_ntop.c @@ -0,0 +1,148 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char orig_rcsid[] = "From Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp"; +#endif +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +static char * inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, + size_t size); + +/* + * char * + * inet_net_ntop(af, src, bits, dst, size) + * convert network number from network to presentation format. + * generates CIDR style result always. + * return: + * pointer to dst, or NULL if an error occurred (check errno). + * author: + * Paul Vixie (ISC), July 1996 + */ +char * +inet_net_ntop(af, src, bits, dst, size) + int af; + const void *src; + int bits; + char *dst; + size_t size; +{ + switch (af) { + case AF_INET: + return (inet_net_ntop_ipv4(src, bits, dst, size)); + default: + errno = EAFNOSUPPORT; + return (NULL); + } +} + +/* + * static char * + * inet_net_ntop_ipv4(src, bits, dst, size) + * convert IPv4 network number from network to presentation format. + * generates CIDR style result always. + * return: + * pointer to dst, or NULL if an error occurred (check errno). + * note: + * network byte order assumed. this means 192.5.5.240/28 has + * 0x11110000 in its fourth octet. + * author: + * Paul Vixie (ISC), July 1996 + */ +static char * +inet_net_ntop_ipv4(src, bits, dst, size) + const u_char *src; + int bits; + char *dst; + size_t size; +{ + char *odst = dst; + char *t; + u_int m; + int b; + + if (bits < 0 || bits > 32) { + errno = EINVAL; + return (NULL); + } + if (bits == 0) { + if (size < sizeof "0") + goto emsgsize; + *dst++ = '0'; + *dst = '\0'; + } + + /* Format whole octets. */ + for (b = bits / 8; b > 0; b--) { + if (size < sizeof "255.") + goto emsgsize; + t = dst; + dst += SPRINTF((dst, "%u", *src++)); + if (b > 1) { + *dst++ = '.'; + *dst = '\0'; + } + size -= (size_t)(dst - t); + } + + /* Format partial octet. */ + b = bits % 8; + if (b > 0) { + if (size < sizeof ".255") + goto emsgsize; + t = dst; + if (dst != odst) + *dst++ = '.'; + m = ((1 << b) - 1) << (8 - b); + dst += SPRINTF((dst, "%u", *src & m)); + size -= (size_t)(dst - t); + } + + /* Format CIDR /width. */ + if (size < sizeof "/32") + goto emsgsize; + dst += SPRINTF((dst, "/%u", bits)); + return (odst); + + emsgsize: + errno = EMSGSIZE; + return (NULL); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_net_ntop +__weak_reference(__inet_net_ntop, inet_net_ntop); diff --git a/newlib/libc/sys/linux/net/inet_net_pton.c b/newlib/libc/sys/linux/net/inet_net_pton.c new file mode 100644 index 000000000..9386d0517 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_net_pton.c @@ -0,0 +1,214 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char orig_rcsid[] = "From Id: inet_net_pton.c,v 1.8 1996/11/21 10:28:12 vixie Exp $"; +#endif +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +static int inet_net_pton_ipv4(const char *src, u_char *dst, size_t size); + +/* + * static int + * inet_net_pton(af, src, dst, size) + * convert network number from presentation to network format. + * accepts hex octets, hex strings, decimal octets, and /CIDR. + * "size" is in bytes and describes "dst". + * return: + * number of bits, either imputed classfully or specified with /CIDR, + * or -1 if some failure occurred (check errno). ENOENT means it was + * not a valid network specification. + * author: + * Paul Vixie (ISC), June 1996 + */ +int +inet_net_pton(af, src, dst, size) + int af; + const char *src; + void *dst; + size_t size; +{ + switch (af) { + case AF_INET: + return (inet_net_pton_ipv4(src, dst, size)); + default: + errno = EAFNOSUPPORT; + return (-1); + } +} + +/* + * static int + * inet_net_pton_ipv4(src, dst, size) + * convert IPv4 network number from presentation to network format. + * accepts hex octets, hex strings, decimal octets, and /CIDR. + * "size" is in bytes and describes "dst". + * return: + * number of bits, either imputed classfully or specified with /CIDR, + * or -1 if some failure occurred (check errno). ENOENT means it was + * not an IPv4 network specification. + * note: + * network byte order assumed. this means 192.5.5.240/28 has + * 0x11110000 in its fourth octet. + * author: + * Paul Vixie (ISC), June 1996 + */ +static int +inet_net_pton_ipv4(src, dst, size) + const char *src; + u_char *dst; + size_t size; +{ + static const char + xdigits[] = "0123456789abcdef", + digits[] = "0123456789"; + int n, ch, tmp, dirty, bits; + const u_char *odst = dst; + + ch = *src++; + if (ch == '0' && (src[0] == 'x' || src[0] == 'X') + && isascii(src[1]) && isxdigit(src[1])) { + /* Hexadecimal: Eat nybble string. */ + if (size <= 0) + goto emsgsize; + *dst = 0, dirty = 0; + src++; /* skip x or X. */ + while ((ch = *src++) != '\0' && + isascii(ch) && isxdigit(ch)) { + if (isupper(ch)) + ch = tolower(ch); + n = strchr(xdigits, ch) - xdigits; + assert(n >= 0 && n <= 15); + *dst |= n; + if (!dirty++) + *dst <<= 4; + else if (size-- > 0) + *++dst = 0, dirty = 0; + else + goto emsgsize; + } + if (dirty) + size--; + } else if (isascii(ch) && isdigit(ch)) { + /* Decimal: eat dotted digit string. */ + for (;;) { + tmp = 0; + do { + n = strchr(digits, ch) - digits; + assert(n >= 0 && n <= 9); + tmp *= 10; + tmp += n; + if (tmp > 255) + goto enoent; + } while ((ch = *src++) != '\0' && + isascii(ch) && isdigit(ch)); + if (size-- <= 0) + goto emsgsize; + *dst++ = (u_char) tmp; + if (ch == '\0' || ch == '/') + break; + if (ch != '.') + goto enoent; + ch = *src++; + if (!isascii(ch) || !isdigit(ch)) + goto enoent; + } + } else + goto enoent; + + bits = -1; + if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) { + /* CIDR width specifier. Nothing can follow it. */ + ch = *src++; /* Skip over the /. */ + bits = 0; + do { + n = strchr(digits, ch) - digits; + assert(n >= 0 && n <= 9); + bits *= 10; + bits += n; + } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); + if (ch != '\0') + goto enoent; + if (bits > 32) + goto emsgsize; + } + + /* Firey death and destruction unless we prefetched EOS. */ + if (ch != '\0') + goto enoent; + + /* If nothing was written to the destination, we found no address. */ + if (dst == odst) + goto enoent; + /* If no CIDR spec was given, infer width from net class. */ + if (bits == -1) { + if (*odst >= 240) /* Class E */ + bits = 32; + else if (*odst >= 224) /* Class D */ + bits = 4; + else if (*odst >= 192) /* Class C */ + bits = 24; + else if (*odst >= 128) /* Class B */ + bits = 16; + else /* Class A */ + bits = 8; + /* If imputed mask is narrower than specified octets, widen. */ + if (bits >= 8 && bits < ((dst - odst) * 8)) + bits = (dst - odst) * 8; + } + /* Extend network to cover the actual mask. */ + while (bits > ((dst - odst) * 8)) { + if (size-- <= 0) + goto emsgsize; + *dst++ = '\0'; + } + return (bits); + + enoent: + errno = ENOENT; + return (-1); + + emsgsize: + errno = EMSGSIZE; + return (-1); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_net_pton +__weak_reference(__inet_net_pton, inet_net_pton); diff --git a/newlib/libc/sys/linux/net/inet_neta.c b/newlib/libc/sys/linux/net/inet_neta.c new file mode 100644 index 000000000..c45578348 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_neta.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char orig_rcsid[] = "From Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp"; +#endif +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +/* + * char * + * inet_neta(src, dst, size) + * format a in_addr_t network number into presentation format. + * return: + * pointer to dst, or NULL if an error occurred (check errno). + * note: + * format of ``src'' is as for inet_network(). + * author: + * Paul Vixie (ISC), July 1996 + */ +char * +inet_neta(src, dst, size) + in_addr_t src; + char *dst; + size_t size; +{ + char *odst = dst; + char *tp; + + while (src & 0xffffffff) { + u_char b = (src & 0xff000000) >> 24; + + src <<= 8; + if (b) { + if (size < sizeof "255.") + goto emsgsize; + tp = dst; + dst += SPRINTF((dst, "%u", b)); + if (src != 0L) { + *dst++ = '.'; + *dst = '\0'; + } + size -= (size_t)(dst - tp); + } + } + if (dst == odst) { + if (size < sizeof "0.0.0.0") + goto emsgsize; + strcpy(dst, "0.0.0.0"); + } + return (odst); + + emsgsize: + errno = EMSGSIZE; + return (NULL); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_neta +__weak_reference(__inet_neta, inet_neta); diff --git a/newlib/libc/sys/linux/net/inet_netof.c b/newlib/libc/sys/linux/net/inet_netof.c new file mode 100644 index 000000000..e2e84d340 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_netof.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include + +#include +#include +#include + +/* + * Return the network number from an internet + * address; handles class a/b/c network #'s. + */ +in_addr_t +inet_netof(in) + struct in_addr in; +{ + in_addr_t i = ntohl(in.s_addr); + + if (IN_CLASSA(i)) + return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT); + else if (IN_CLASSB(i)) + return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT); + else + return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_netof +__weak_reference(__inet_netof, inet_netof); diff --git a/newlib/libc/sys/linux/net/inet_network.c b/newlib/libc/sys/linux/net/inet_network.c new file mode 100644 index 000000000..caf1d7869 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_network.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include + +/* + * Internet network address interpretation routine. + * The library routines call this routine to interpret + * network numbers. + */ +in_addr_t +inet_network(cp) + const char *cp; +{ + in_addr_t val, base, n; + char c; + in_addr_t parts[4], *pp = parts; + int i; + +again: + val = 0; base = 10; + if (*cp == '0') + base = 8, cp++; + if (*cp == 'x' || *cp == 'X') + base = 16, cp++; + while ((c = *cp) != 0) { + if (isdigit((unsigned char)c)) { + val = (val * base) + (c - '0'); + cp++; + continue; + } + if (base == 16 && isxdigit((unsigned char)c)) { + val = (val << 4) + (c + 10 - (islower((unsigned char)c) ? 'a' : 'A')); + cp++; + continue; + } + break; + } + if (*cp == '.') { + if (pp >= parts + 3) + return (INADDR_NONE); + *pp++ = val, cp++; + goto again; + } + if (*cp && !isspace((unsigned char)*cp)) + return (INADDR_NONE); + *pp++ = val; + n = pp - parts; + for (val = 0, i = 0; i < n; i++) { + val <<= 8; + val |= parts[i] & 0xff; + } + return (val); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_network +__weak_reference(__inet_network, inet_network); diff --git a/newlib/libc/sys/linux/net/inet_ntoa.c b/newlib/libc/sys/linux/net/inet_ntoa.c new file mode 100644 index 000000000..dedc4768d --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_ntoa.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Convert network-format internet address + * to base 256 d.d.d.d representation. + */ +char * +inet_ntoa(in) + struct in_addr in; +{ + static char ret[18]; + + strcpy(ret, "[inet_ntoa error]"); + (void) inet_ntop(AF_INET, &in, ret, sizeof ret); + return (ret); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_ntoa +__weak_reference(__inet_ntoa, inet_ntoa); diff --git a/newlib/libc/sys/linux/net/inet_ntop.c b/newlib/libc/sys/linux/net/inet_ntop.c new file mode 100644 index 000000000..31746e456 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_ntop.c @@ -0,0 +1,200 @@ +/* Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char rcsid[] = "$Id$"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPRINTF(x) ((socklen_t)sprintf x) + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size); +static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size); + +/* char * + * inet_ntop(af, src, dst, size) + * convert a network format address to presentation format. + * return: + * pointer to presentation format address (`dst'), or NULL (see errno). + * author: + * Paul Vixie, 1996. + */ +const char * +inet_ntop(af, src, dst, size) + int af; + const void *src; + char *dst; + socklen_t size; +{ + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: + errno = EAFNOSUPPORT; + return (NULL); + } + /* NOTREACHED */ +} + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address, more or less like inet_ntoa() + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a u_char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop4(src, dst, size) + const u_char *src; + char *dst; + socklen_t size; +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof "255.255.255.255"]; + + if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop6(src, dst, size) + const u_char *src; + char *dst; + socklen_t size; +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; + struct { int base, len; } best, cur; + u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < NS_IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + cur.base = -1; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && + (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) + return (NULL); + tp += strlen(tp); + break; + } + tp += SPRINTF((tp, "%x", words[i])); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == + (NS_IN6ADDRSZ / NS_INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((socklen_t)(tp - tmp) > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_ntop +__weak_reference(__inet_ntop, inet_ntop); diff --git a/newlib/libc/sys/linux/net/inet_pton.c b/newlib/libc/sys/linux/net/inet_pton.c new file mode 100644 index 000000000..eeabbb481 --- /dev/null +++ b/newlib/libc/sys/linux/net/inet_pton.c @@ -0,0 +1,222 @@ +/* $KAME: inet_pton.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ + +/* Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static int inet_pton4(const char *src, u_char *dst); +static int inet_pton6(const char *src, u_char *dst); + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + * -1 if some other error occurred (`dst' is untouched in this case, too) + * author: + * Paul Vixie, 1996. + */ +int +inet_pton(af, src, dst) + int af; + const char *src; + void *dst; +{ + switch (af) { + case AF_INET: + return (inet_pton4(src, dst)); + case AF_INET6: + return (inet_pton6(src, dst)); + default: + errno = EAFNOSUPPORT; + return (-1); + } + /* NOTREACHED */ +} + +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal and shorthand. + * return: + * 1 if `src' is a valid dotted quad, else 0. + * notice: + * does not touch `dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4(src, dst) + const char *src; + u_char *dst; +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + u_char tmp[NS_INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + u_int new = *tp * 10 + (pch - digits); + + if (new > 255) + return (0); + *tp = new; + if (! saw_digit) { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } else + return (0); + } + if (octets < 4) + return (0); + + memcpy(dst, tmp, NS_INADDRSZ); + return (1); +} + +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if `src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch `dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6(src, dst) + const char *src; + u_char *dst; +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, saw_xdigit; + u_int val; + + memset((tp = tmp), '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return (0); + curtok = src; + saw_xdigit = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (val > 0xffff) + return (0); + saw_xdigit = 1; + continue; + } + if (ch == ':') { + curtok = src; + if (!saw_xdigit) { + if (colonp) + return (0); + colonp = tp; + continue; + } + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + saw_xdigit = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4(curtok, tp) > 0) { + tp += NS_INADDRSZ; + saw_xdigit = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + return (0); + } + if (saw_xdigit) { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return (0); + memcpy(dst, tmp, NS_IN6ADDRSZ); + return (1); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_pton +__weak_reference(__inet_pton, inet_pton); diff --git a/newlib/libc/sys/linux/net/innetgr-stub.c b/newlib/libc/sys/linux/net/innetgr-stub.c new file mode 100644 index 000000000..690d82e14 --- /dev/null +++ b/newlib/libc/sys/linux/net/innetgr-stub.c @@ -0,0 +1,7 @@ +int +innetgr(const char *netgroup, const char *host, const char *user, + const char *domain) +{ + return 0; +} + diff --git a/newlib/libc/sys/linux/net/ip6opt.c b/newlib/libc/sys/linux/net/ip6opt.c new file mode 100644 index 000000000..f3f51d507 --- /dev/null +++ b/newlib/libc/sys/linux/net/ip6opt.c @@ -0,0 +1,387 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +static int ip6optlen(u_int8_t *opt, u_int8_t *lim); +static void inet6_insert_padopt(u_char *p, int len); + +/* + * This function returns the number of bytes required to hold an option + * when it is stored as ancillary data, including the cmsghdr structure + * at the beginning, and any padding at the end (to make its size a + * multiple of 8 bytes). The argument is the size of the structure + * defining the option, which must include any pad bytes at the + * beginning (the value y in the alignment term "xn + y"), the type + * byte, the length byte, and the option data. + */ +int +inet6_option_space(nbytes) + int nbytes; +{ + nbytes += 2; /* we need space for nxt-hdr and length fields */ + return(CMSG_SPACE((nbytes + 7) & ~7)); +} + +/* + * This function is called once per ancillary data object that will + * contain either Hop-by-Hop or Destination options. It returns 0 on + * success or -1 on an error. + */ +int +inet6_option_init(bp, cmsgp, type) + void *bp; + struct cmsghdr **cmsgp; + int type; +{ + struct cmsghdr *ch = (struct cmsghdr *)bp; + + /* argument validation */ + if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS) + return(-1); + + ch->cmsg_level = IPPROTO_IPV6; + ch->cmsg_type = type; + ch->cmsg_len = CMSG_LEN(0); + + *cmsgp = ch; + return(0); +} + +/* + * This function appends a Hop-by-Hop option or a Destination option + * into an ancillary data object that has been initialized by + * inet6_option_init(). This function returns 0 if it succeeds or -1 on + * an error. + * multx is the value x in the alignment term "xn + y" described + * earlier. It must have a value of 1, 2, 4, or 8. + * plusy is the value y in the alignment term "xn + y" described + * earlier. It must have a value between 0 and 7, inclusive. + */ +int +inet6_option_append(cmsg, typep, multx, plusy) + struct cmsghdr *cmsg; + const u_int8_t *typep; + int multx; + int plusy; +{ + int padlen, optlen, off; + u_char *bp = (u_char *)cmsg + cmsg->cmsg_len; + struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg); + + /* argument validation */ + if (multx != 1 && multx != 2 && multx != 4 && multx != 8) + return(-1); + if (plusy < 0 || plusy > 7) + return(-1); + if (typep[0] > 255) + return(-1); + + /* + * If this is the first option, allocate space for the + * first 2 bytes(for next header and length fields) of + * the option header. + */ + if (bp == (u_char *)eh) { + bp += 2; + cmsg->cmsg_len += 2; + } + + /* calculate pad length before the option. */ + off = bp - (u_char *)eh; + padlen = (((off % multx) + (multx - 1)) & ~(multx - 1)) - + (off % multx); + padlen += plusy; + /* insert padding */ + inet6_insert_padopt(bp, padlen); + cmsg->cmsg_len += padlen; + bp += padlen; + + /* copy the option */ + if (typep[0] == IP6OPT_PAD1) + optlen = 1; + else + optlen = typep[1] + 2; + memcpy(bp, typep, optlen); + bp += optlen; + cmsg->cmsg_len += optlen; + + /* calculate pad length after the option and insert the padding */ + off = bp - (u_char *)eh; + padlen = ((off + 7) & ~7) - off; + inet6_insert_padopt(bp, padlen); + bp += padlen; + cmsg->cmsg_len += padlen; + + /* update the length field of the ip6 option header */ + eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; + + return(0); +} + +/* + * This function appends a Hop-by-Hop option or a Destination option + * into an ancillary data object that has been initialized by + * inet6_option_init(). This function returns a pointer to the 8-bit + * option type field that starts the option on success, or NULL on an + * error. + * The difference between this function and inet6_option_append() is + * that the latter copies the contents of a previously built option into + * the ancillary data object while the current function returns a + * pointer to the space in the data object where the option's TLV must + * then be built by the caller. + * + */ +u_int8_t * +inet6_option_alloc(cmsg, datalen, multx, plusy) + struct cmsghdr *cmsg; + int datalen; + int multx; + int plusy; +{ + int padlen, off; + u_int8_t *bp = (u_char *)cmsg + cmsg->cmsg_len; + u_int8_t *retval; + struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg); + + /* argument validation */ + if (multx != 1 && multx != 2 && multx != 4 && multx != 8) + return(NULL); + if (plusy < 0 || plusy > 7) + return(NULL); + + /* + * If this is the first option, allocate space for the + * first 2 bytes(for next header and length fields) of + * the option header. + */ + if (bp == (u_char *)eh) { + bp += 2; + cmsg->cmsg_len += 2; + } + + /* calculate pad length before the option. */ + off = bp - (u_char *)eh; + padlen = (((off % multx) + (multx - 1)) & ~(multx - 1)) - + (off % multx); + padlen += plusy; + /* insert padding */ + inet6_insert_padopt(bp, padlen); + cmsg->cmsg_len += padlen; + bp += padlen; + + /* keep space to store specified length of data */ + retval = bp; + bp += datalen; + cmsg->cmsg_len += datalen; + + /* calculate pad length after the option and insert the padding */ + off = bp - (u_char *)eh; + padlen = ((off + 7) & ~7) - off; + inet6_insert_padopt(bp, padlen); + bp += padlen; + cmsg->cmsg_len += padlen; + + /* update the length field of the ip6 option header */ + eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; + + return(retval); +} + +/* + * This function processes the next Hop-by-Hop option or Destination + * option in an ancillary data object. If another option remains to be + * processed, the return value of the function is 0 and *tptrp points to + * the 8-bit option type field (which is followed by the 8-bit option + * data length, followed by the option data). If no more options remain + * to be processed, the return value is -1 and *tptrp is NULL. If an + * error occurs, the return value is -1 and *tptrp is not NULL. + * (RFC 2292, 6.3.5) + */ +int +inet6_option_next(cmsg, tptrp) + const struct cmsghdr *cmsg; + u_int8_t **tptrp; +{ + struct ip6_ext *ip6e; + int hdrlen, optlen; + u_int8_t *lim; + + if (cmsg->cmsg_level != IPPROTO_IPV6 || + (cmsg->cmsg_type != IPV6_HOPOPTS && + cmsg->cmsg_type != IPV6_DSTOPTS)) + return(-1); + + /* message length validation */ + if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) + return(-1); + ip6e = (struct ip6_ext *)CMSG_DATA(cmsg); + hdrlen = (ip6e->ip6e_len + 1) << 3; + if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) + return(-1); + + /* + * If the caller does not specify the starting point, + * simply return the 1st option. + * Otherwise, search the option list for the next option. + */ + lim = (u_int8_t *)ip6e + hdrlen; + if (*tptrp == NULL) + *tptrp = (u_int8_t *)(ip6e + 1); + else { + if ((optlen = ip6optlen(*tptrp, lim)) == 0) + return(-1); + + *tptrp = *tptrp + optlen; + } + if (*tptrp >= lim) { /* there is no option */ + *tptrp = NULL; + return(-1); + } + /* + * Finally, checks if the next option is safely stored in the + * cmsg data. + */ + if (ip6optlen(*tptrp, lim) == 0) + return(-1); + else + return(0); +} + +/* + * This function is similar to the inet6_option_next() function, + * except this function lets the caller specify the option type to be + * searched for, instead of always returning the next option in the + * ancillary data object. + * Note: RFC 2292 says the type of tptrp is u_int8_t *, but we think + * it's a typo. The variable should be type of u_int8_t **. + */ +int +inet6_option_find(cmsg, tptrp, type) + const struct cmsghdr *cmsg; + u_int8_t **tptrp; + int type; +{ + struct ip6_ext *ip6e; + int hdrlen, optlen; + u_int8_t *optp, *lim; + + if (cmsg->cmsg_level != IPPROTO_IPV6 || + (cmsg->cmsg_type != IPV6_HOPOPTS && + cmsg->cmsg_type != IPV6_DSTOPTS)) + return(-1); + + /* message length validation */ + if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) + return(-1); + ip6e = (struct ip6_ext *)CMSG_DATA(cmsg); + hdrlen = (ip6e->ip6e_len + 1) << 3; + if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) + return(-1); + + /* + * If the caller does not specify the starting point, + * search from the beginning of the option list. + * Otherwise, search from *the next option* of the specified point. + */ + lim = (u_int8_t *)ip6e + hdrlen; + if (*tptrp == NULL) + *tptrp = (u_int8_t *)(ip6e + 1); + else { + if ((optlen = ip6optlen(*tptrp, lim)) == 0) + return(-1); + + *tptrp = *tptrp + optlen; + } + for (optp = *tptrp; optp < lim; optp += optlen) { + if (*optp == type) { + *tptrp = optp; + return(0); + } + if ((optlen = ip6optlen(optp, lim)) == 0) + return(-1); + } + + /* search failed */ + *tptrp = NULL; + return(-1); +} + +/* + * Calculate the length of a given IPv6 option. Also checks + * if the option is safely stored in user's buffer according to the + * calculated length and the limitation of the buffer. + */ +static int +ip6optlen(opt, lim) + u_int8_t *opt, *lim; +{ + int optlen; + + if (*opt == IP6OPT_PAD1) + optlen = 1; + else { + /* is there enough space to store type and len? */ + if (opt + 2 > lim) + return(0); + optlen = *(opt + 1) + 2; + } + if (opt + optlen <= lim) + return(optlen); + + return(0); +} + +static void +inet6_insert_padopt(u_char *p, int len) +{ + switch(len) { + case 0: + return; + case 1: + p[0] = IP6OPT_PAD1; + return; + default: + p[0] = IP6OPT_PADN; + p[1] = len - 2; + memset(&p[2], 0, len - 2); + return; + } +} diff --git a/newlib/libc/sys/linux/net/iso_addr.3 b/newlib/libc/sys/linux/net/iso_addr.3 new file mode 100644 index 000000000..dc843c315 --- /dev/null +++ b/newlib/libc/sys/linux/net/iso_addr.3 @@ -0,0 +1,113 @@ +.\" Copyright (c) 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)iso_addr.3 8.1 (Berkeley) 6/4/93 +.\" $FreeBSD: src/lib/libc/net/iso_addr.3,v 1.7 2001/10/01 16:08:56 ru Exp $ +.\" +.Dd June 4, 1993 +.Dt ISO_ADDR 3 +.Os +.Sh NAME +.Nm iso_addr , +.Nm iso_ntoa +.Nd "elementary network address conversion routines for Open System Interconnection +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In netiso/iso.h +.Ft struct iso_addr * +.Fn iso_addr "char *cp" +.Ft char * +.Fn iso_ntoa "struct iso_addr *isoa" +.Sh DESCRIPTION +The routine +.Fn iso_addr +interprets character strings representing +.Tn OSI +addresses, returning binary information suitable +for use in system calls. +The routine +.Fn iso_ntoa +takes +.Tn OSI +addresses and returns +.Tn ASCII +strings representing NSAPs (network service +access points) in a +notation inverse to that accepted by +.Fn iso_addr . +.Pp +Unfortunately, no universal standard exists for representing +.Tn OSI +network addresses. +.Pp +The format employed by +.Fn iso_addr +is a sequence of hexadecimal +.Dq digits +(optionally separated by periods), +of the form: +.Bd -ragged -offset indent +.. +.Ed +.Pp +Each pair of hexadecimal digits represents a byte +with the leading digit indicating the higher-ordered bits. +A period following an even number of bytes has no +effect (but may be used to increase legibility). +A period following an odd number of bytes has the +effect of causing the byte of address being translated +to have its higher order bits filled with zeros. +.Sh RETURN VALUES +.Fn iso_ntoa +always returns a null terminated string. +.Fn iso_addr +always returns a pointer to a struct iso_addr. +(See +.Sx BUGS . ) +.Sh SEE ALSO +.Xr iso 4 +.Sh HISTORY +The +.Fn iso_addr +and +.Fn iso_ntoa +functions appeared in +.Bx 4.3 Reno . +.Sh BUGS +The returned values +reside in a static memory area. +.Pp +The function +.Fn iso_addr +should diagnose improperly formed input, and there should be an unambiguous +way to recognize this. diff --git a/newlib/libc/sys/linux/net/iso_addr.c b/newlib/libc/sys/linux/net/iso_addr.c new file mode 100644 index 000000000..e943122f8 --- /dev/null +++ b/newlib/libc/sys/linux/net/iso_addr.c @@ -0,0 +1,119 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)iso_addr.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include + +/* States*/ +#define VIRGIN 0 +#define GOTONE 1 +#define GOTTWO 2 +/* Inputs */ +#define DIGIT (4*0) +#define END (4*1) +#define DELIM (4*2) + +struct iso_addr * +iso_addr(addr) + const char *addr; +{ + static struct iso_addr out_addr; + char *cp = out_addr.isoa_genaddr; + char *cplim = cp + sizeof(out_addr.isoa_genaddr); + int byte = 0, state = VIRGIN, new; + + bzero((char *)&out_addr, sizeof(out_addr)); + do { + if ((*addr >= '0') && (*addr <= '9')) { + new = *addr - '0'; + } else if ((*addr >= 'a') && (*addr <= 'f')) { + new = *addr - 'a' + 10; + } else if ((*addr >= 'A') && (*addr <= 'F')) { + new = *addr - 'A' + 10; + } else if (*addr == 0) + state |= END; + else + state |= DELIM; + addr++; + switch (state /* | INPUT */) { + case GOTTWO | DIGIT: + *cp++ = byte; /*FALLTHROUGH*/ + case VIRGIN | DIGIT: + state = GOTONE; byte = new; continue; + case GOTONE | DIGIT: + state = GOTTWO; byte = new + (byte << 4); continue; + default: /* | DELIM */ + state = VIRGIN; *cp++ = byte; byte = 0; continue; + case GOTONE | END: + case GOTTWO | END: + *cp++ = byte; /* FALLTHROUGH */ + case VIRGIN | END: + break; + } + break; + } while (cp < cplim); + out_addr.isoa_len = cp - out_addr.isoa_genaddr; + return (&out_addr); +} + +static char hexlist[] = "0123456789abcdef"; + +char * +iso_ntoa(isoa) + const struct iso_addr *isoa; +{ + static char tmpbuf[sizeof(isoa->isoa_genaddr)*3]; + const u_char *binary; + char *cp; + int i; + + binary = isoa->isoa_genaddr; + cp = tmpbuf; + + for (i = 0; i < isoa->isoa_len; i++) { + *cp++ = hexlist[*binary >> 4]; + *cp++ = hexlist[*binary++ & 0xf]; + + if ((((i % 2) == 0) && ((i + 1) < isoa->isoa_len))) + *cp++ = '.'; + } + *cp = '\0'; + return tmpbuf; +} diff --git a/newlib/libc/sys/linux/net/issetugid-stub.c b/newlib/libc/sys/linux/net/issetugid-stub.c new file mode 100644 index 000000000..b3aac0b63 --- /dev/null +++ b/newlib/libc/sys/linux/net/issetugid-stub.c @@ -0,0 +1,5 @@ +int +issetugid(void) +{ + return 0; +} diff --git a/newlib/libc/sys/linux/net/linkaddr.3 b/newlib/libc/sys/linux/net/linkaddr.3 new file mode 100644 index 000000000..1d664630b --- /dev/null +++ b/newlib/libc/sys/linux/net/linkaddr.3 @@ -0,0 +1,140 @@ +.\" Copyright (c) 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" Donn Seeley at BSDI. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)linkaddr.3 8.1 (Berkeley) 7/28/93 +.\" $FreeBSD: src/lib/libc/net/linkaddr.3,v 1.12 2001/10/01 16:08:56 ru Exp $ +.\" +.Dd June 17, 1996 +.Dt LINK_ADDR 3 +.Os +.Sh NAME +.Nm link_addr , +.Nm link_ntoa +.Nd elementary address specification routines for link level access +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In net/if_dl.h +.Ft void +.Fn link_addr "const char *addr" "struct sockaddr_dl *sdl" +.Ft char * +.Fn link_ntoa "const struct sockaddr_dl *sdl" +.Sh DESCRIPTION +The routine +.Fn link_addr +interprets character strings representing +link-level addresses, returning binary information suitable +for use in system calls. +The routine +.Fn link_ntoa +takes +a link-level +address and returns an +.Tn ASCII +string representing some of the information present, +including the link level address itself, and the interface name +or number, if present. +This facility is experimental and is +still subject to change. +.Pp +For +.Fn link_addr , +the string +.Fa addr +may contain +an optional network interface identifier of the form +.Dq "name unit-number" , +suitable for the first argument to +.Xr ifconfig 8 , +followed in all cases by a colon and +an interface address in the form of +groups of hexadecimal digits +separated by periods. +Each group represents a byte of address; +address bytes are filled left to right from +low order bytes through high order bytes. +.Pp +.\" A regular expression may make this format clearer: +.\" .Bd -literal -offset indent +.\" ([a-z]+[0-9]+:)?[0-9a-f]+(\e.[0-9a-f]+)* +.\" .Ed +.\" .Pp +Thus +.Li le0:8.0.9.13.d.30 +represents an ethernet address +to be transmitted on the first Lance ethernet interface. +.Pp +The direct use of these functions is deprecated in favor of the +.Xr addr2ascii 3 +interface; however, portable programs cannot rely on the latter as it is +not yet widely implemented. +.Sh RETURN VALUES +.Fn link_ntoa +always returns a null terminated string. +.Fn link_addr +has no return value. +(See +.Sx BUGS . ) +.Sh SEE ALSO +.Xr addr2ascii 3 +.\" .Xr iso 4 +.Sh HISTORY +The +.Fn link_addr +and +.Fn link_ntoa +functions appeared in +.Bx 4.3 Reno . +.Sh BUGS +The returned values for link_ntoa +reside in a static memory area. +.Pp +The function +.Fn link_addr +should diagnose improperly formed input, and there should be an unambiguous +way to recognize this. +.Pp +If the +.Va sdl_len +field of the link socket address +.Fa sdl +is 0, +.Fn link_ntoa +will not insert a colon before the interface address bytes. +If this translated address is given to +.Fn link_addr +without inserting an initial colon, +the latter will not interpret it correctly. diff --git a/newlib/libc/sys/linux/net/linkaddr.c b/newlib/libc/sys/linux/net/linkaddr.c new file mode 100644 index 000000000..deeaa09ea --- /dev/null +++ b/newlib/libc/sys/linux/net/linkaddr.c @@ -0,0 +1,160 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)linkaddr.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include + +/* States*/ +#define NAMING 0 +#define GOTONE 1 +#define GOTTWO 2 +#define RESET 3 +/* Inputs */ +#define DIGIT (4*0) +#define END (4*1) +#define DELIM (4*2) +#define LETTER (4*3) + +void +link_addr(addr, sdl) + const char *addr; + struct sockaddr_dl *sdl; +{ + char *cp = sdl->sdl_data; + char *cplim = sdl->sdl_len + (char *)sdl; + int byte = 0, state = NAMING, new = 0; + + bzero((char *)&sdl->sdl_family, sdl->sdl_len - 1); + sdl->sdl_family = AF_INET; + do { + state &= ~LETTER; + if ((*addr >= '0') && (*addr <= '9')) { + new = *addr - '0'; + } else if ((*addr >= 'a') && (*addr <= 'f')) { + new = *addr - 'a' + 10; + } else if ((*addr >= 'A') && (*addr <= 'F')) { + new = *addr - 'A' + 10; + } else if (*addr == 0) { + state |= END; + } else if (state == NAMING && + (((*addr >= 'A') && (*addr <= 'Z')) || + ((*addr >= 'a') && (*addr <= 'z')))) + state |= LETTER; + else + state |= DELIM; + addr++; + switch (state /* | INPUT */) { + case NAMING | DIGIT: + case NAMING | LETTER: + *cp++ = addr[-1]; + continue; + case NAMING | DELIM: + state = RESET; + sdl->sdl_nlen = cp - sdl->sdl_data; + continue; + case GOTTWO | DIGIT: + *cp++ = byte; + /* FALLTHROUGH */ + case RESET | DIGIT: + state = GOTONE; + byte = new; + continue; + case GOTONE | DIGIT: + state = GOTTWO; + byte = new + (byte << 4); + continue; + default: /* | DELIM */ + state = RESET; + *cp++ = byte; + byte = 0; + continue; + case GOTONE | END: + case GOTTWO | END: + *cp++ = byte; + /* FALLTHROUGH */ + case RESET | END: + break; + } + break; + } while (cp < cplim); + sdl->sdl_alen = cp - LLADDR(sdl); + new = cp - (char *)sdl; + if (new > sizeof(*sdl)) + sdl->sdl_len = new; + return; +} + +static char hexlist[] = "0123456789abcdef"; + +char * +link_ntoa(sdl) + const struct sockaddr_dl *sdl; +{ + static char obuf[64]; + char *out = obuf; + int i; + u_char *in = (u_char *)LLADDR(sdl); + u_char *inlim = in + sdl->sdl_alen; + int firsttime = 1; + + if (sdl->sdl_nlen) { + bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen); + out += sdl->sdl_nlen; + if (sdl->sdl_alen) + *out++ = ':'; + } + while (in < inlim) { + if (firsttime) + firsttime = 0; + else + *out++ = '.'; + i = *in++; + if (i > 0xf) { + out[1] = hexlist[i & 0xf]; + i >>= 4; + out[0] = hexlist[i]; + out += 2; + } else + *out++ = hexlist[i]; + } + *out = 0; + return (obuf); +} diff --git a/newlib/libc/sys/linux/net/map_v4v6.c b/newlib/libc/sys/linux/net/map_v4v6.c new file mode 100644 index 000000000..f746a8088 --- /dev/null +++ b/newlib/libc/sys/linux/net/map_v4v6.c @@ -0,0 +1,128 @@ +/* + * ++Copyright++ 1985, 1988, 1993 + * - + * Copyright (c) 1985, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +typedef union { + int32_t al; + char ac; +} align; + +void +_map_v4v6_address(src, dst) + const char *src; + char *dst; +{ + u_char *p = (u_char *)dst; + char tmp[INADDRSZ]; + int i; + + /* Stash a temporary copy so our caller can update in place. */ + bcopy(src, tmp, INADDRSZ); + /* Mark this ipv6 addr as a mapped ipv4. */ + for (i = 0; i < 10; i++) + *p++ = 0x00; + *p++ = 0xff; + *p++ = 0xff; + /* Retrieve the saved copy and we're done. */ + bcopy(tmp, (void*)p, INADDRSZ); +} + +void +_map_v4v6_hostent(hp, bpp, lenp) + struct hostent *hp; + char **bpp; + int *lenp; +{ + char **ap; + + if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ) + return; + hp->h_addrtype = AF_INET6; + hp->h_length = IN6ADDRSZ; + for (ap = hp->h_addr_list; *ap; ap++) { + int i = sizeof(align) - ((u_long)*bpp % sizeof(align)); + + if (*lenp < (i + IN6ADDRSZ)) { + /* Out of memory. Truncate address list here. XXX */ + *ap = NULL; + return; + } + *bpp += i; + *lenp -= i; + _map_v4v6_address(*ap, *bpp); + *ap = *bpp; + *bpp += IN6ADDRSZ; + *lenp -= IN6ADDRSZ; + } +} diff --git a/newlib/libc/sys/linux/net/name6.c b/newlib/libc/sys/linux/net/name6.c new file mode 100644 index 000000000..80037e8f9 --- /dev/null +++ b/newlib/libc/sys/linux/net/name6.c @@ -0,0 +1,1812 @@ +/* $KAME: name6.c,v 1.25 2000/06/26 16:44:40 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * ++Copyright++ 1985, 1988, 1993 + * - + * Copyright (c) 1985, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* + * Atsushi Onoe + */ + +/* + * TODO for thread safe + * use mutex for _hostconf, _hostconf_init. + * rewrite resolvers to be thread safe + */ + +#include +#include +#include +#include +#include + +#include "namespace.h" +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" + +#ifndef _PATH_HOSTS +#define _PATH_HOSTS "/etc/hosts" +#endif + +#ifndef MAXALIASES +#define MAXALIASES 35 +#endif +#ifndef MAXADDRS +#define MAXADDRS 2 +#endif +#ifndef MAXDNAME +#define MAXDNAME 1025 +#endif + +#ifdef INET6 +#define ADDRLEN(af) ((af) == AF_INET6 ? sizeof(struct in6_addr) : \ + sizeof(struct in_addr)) +#else +#define ADDRLEN(af) sizeof(struct in_addr) +#endif + +#define MAPADDR(ab, ina) \ +do { \ + memcpy(&(ab)->map_inaddr, ina, sizeof(struct in_addr)); \ + memset((ab)->map_zero, 0, sizeof((ab)->map_zero)); \ + memset((ab)->map_one, 0xff, sizeof((ab)->map_one)); \ +} while (0) +#define MAPADDRENABLED(flags) \ + (((flags) & AI_V4MAPPED) || \ + (((flags) & AI_V4MAPPED_CFG) && _mapped_addr_enabled())) + +union inx_addr { + struct in_addr in_addr; +#ifdef INET6 + struct in6_addr in6_addr; +#endif + struct { + u_char mau_zero[10]; + u_char mau_one[2]; + struct in_addr mau_inaddr; + } map_addr_un; +#define map_zero map_addr_un.mau_zero +#define map_one map_addr_un.mau_one +#define map_inaddr map_addr_un.mau_inaddr +}; + +u_int16_t _getshort(const u_char *src); + +static struct hostent *_hpcopy(struct hostent *hp, int *errp); +static struct hostent *_hpaddr(int af, const char *name, void *addr, int *errp); +static struct hostent *_hpmerge(struct hostent *hp1, struct hostent *hp2, int *errp); +#ifdef INET6 +static struct hostent *_hpmapv6(struct hostent *hp, int *errp); +#endif +static struct hostent *_hpsort(struct hostent *hp); +static struct hostent *_ghbyname(const char *name, int af, int flags, int *errp); +static char *_hgetword(char **pp); +static int _mapped_addr_enabled(void); + +static FILE *_files_open(int *errp); +static int _files_ghbyname(void *, void *, va_list); +static int _files_ghbyaddr(void *, void *, va_list); +#if 0 // keep gcc happy +static void _files_shent(int stayopen); +static void _files_ehent(void); +#endif +#ifdef YP +static int _nis_ghbyname(void *, void *, va_list); +static int _nis_ghbyaddr(void *, void *, va_list); +#endif +static int _dns_ghbyname(void *, void *, va_list); +static int _dns_ghbyaddr(void *, void *, va_list); +#if 0 // keep gcc happy +static void _dns_shent(int stayopen); +static void _dns_ehent(void); +#endif + +#ifdef ICMPNL +static int _icmp_ghbyaddr(void *, void *, va_list); +#endif /* ICMPNL */ + +/* Host lookup order if nsswitch.conf is broken or nonexistant */ +static const ns_src default_src[] = { + { NSSRC_FILES, NS_SUCCESS }, + { NSSRC_DNS, NS_SUCCESS }, +#ifdef ICMPNL +#define NSSRC_ICMP "icmp" + { NSSRC_ICMP, NS_SUCCESS }, +#endif + { 0 } +}; + +/* + * Check if kernel supports mapped address. + * implementation dependent + */ +#ifdef __KAME__ +#include +#endif /* __KAME__ */ + +static int +_mapped_addr_enabled(void) +{ + /* implementation dependent check */ +#if defined(__KAME__) && defined(IPV6CTL_MAPPED_ADDR) + int mib[4]; + size_t len; + int val; + + mib[0] = CTL_NET; + mib[1] = PF_INET6; + mib[2] = IPPROTO_IPV6; + mib[3] = IPV6CTL_MAPPED_ADDR; + len = sizeof(val); + if (__sysctl(mib, 4, &val, &len, 0, 0) == 0 && val != 0) + return 1; +#endif /* __KAME__ && IPV6CTL_MAPPED_ADDR */ + return 0; +} + +/* + * Functions defined in RFC2553 + * getipnodebyname, getipnodebyaddr, freehostent + */ + +static struct hostent * +_ghbyname(const char *name, int af, int flags, int *errp) +{ + struct hostent *hp; + int rval; + + static const ns_dtab dtab[] = { + NS_FILES_CB(_files_ghbyname, NULL) + { NSSRC_DNS, _dns_ghbyname, NULL }, + NS_NIS_CB(_nis_ghbyname, NULL) + { 0 } + }; + + if (flags & AI_ADDRCONFIG) { + int s; + + /* + * TODO: + * Note that implementation dependent test for address + * configuration should be done everytime called + * (or apropriate interval), + * because addresses will be dynamically assigned or deleted. + */ + if (af == AF_UNSPEC) { + if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) + af = AF_INET; + else { + close(s); + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + af = AF_INET6; + else + close(s); + } + + } + if (af != AF_UNSPEC) { + if ((s = socket(af, SOCK_DGRAM, 0)) < 0) + return NULL; + close(s); + } + } + + rval = nsdispatch(&hp, dtab, NSDB_HOSTS, "ghbyname", default_src, + name, af, errp); + return (rval == NS_SUCCESS) ? hp : NULL; +} + +/* getipnodebyname() internal routine for multiple query(PF_UNSPEC) support. */ +struct hostent * +_getipnodebyname_multi(const char *name, int af, int flags, int *errp) +{ + struct hostent *hp; + union inx_addr addrbuf; + + /* XXX: PF_UNSPEC is only supposed to be passed from getaddrinfo() */ + if (af != AF_INET +#ifdef INET6 + && af != AF_INET6 +#endif + && af != PF_UNSPEC + ) + { + *errp = NO_RECOVERY; + return NULL; + } + +#ifdef INET6 + /* special case for literal address */ + if (inet_pton(AF_INET6, name, &addrbuf) == 1) { + if (af != AF_INET6) { + *errp = HOST_NOT_FOUND; + return NULL; + } + return _hpaddr(af, name, &addrbuf, errp); + } +#endif + if (inet_aton(name, (struct in_addr *)&addrbuf) == 1) { + if (af != AF_INET) { + if (MAPADDRENABLED(flags)) { + MAPADDR(&addrbuf, &addrbuf.in_addr); + } else { + *errp = HOST_NOT_FOUND; + return NULL; + } + } + return _hpaddr(af, name, &addrbuf, errp); + } + + *errp = HOST_NOT_FOUND; + hp = _ghbyname(name, af, flags, errp); + +#ifdef INET6 + if (af == AF_INET6 + && ((flags & AI_ALL) || hp == NULL) + && (MAPADDRENABLED(flags))) { + struct hostent *hp2 = _ghbyname(name, AF_INET, flags, errp); + if (hp == NULL) + hp = _hpmapv6(hp2, errp); + else { + if (hp2 && strcmp(hp->h_name, hp2->h_name) != 0) { + freehostent(hp2); + hp2 = NULL; + } + hp = _hpmerge(hp, hp2, errp); + } + } +#endif + return _hpsort(hp); +} + +struct hostent * +getipnodebyname(const char *name, int af, int flags, int *errp) +{ + if (af != AF_INET +#ifdef INET6 + && af != AF_INET6 +#endif + ) + { + *errp = NO_RECOVERY; + return NULL; + } + return(_getipnodebyname_multi(name, af ,flags, errp)); +} + +struct hostent * +getipnodebyaddr(const void *src, size_t len, int af, int *errp) +{ + struct hostent *hp; + int rval; +#ifdef INET6 + struct in6_addr addrbuf; +#else + struct in_addr addrbuf; +#endif + + static const ns_dtab dtab[] = { + NS_FILES_CB(_files_ghbyaddr, NULL) + { NSSRC_DNS, _dns_ghbyaddr, NULL }, + NS_NIS_CB(_nis_ghbyaddr, NULL) +#ifdef ICMPNL + { NSSRC_ICMP, _icmp_ghbyaddr, NULL }, +#endif + { 0 } + }; + + *errp = HOST_NOT_FOUND; + + switch (af) { + case AF_INET: + if (len != sizeof(struct in_addr)) { + *errp = NO_RECOVERY; + return NULL; + } + if ((long)src & ~(sizeof(struct in_addr) - 1)) { + memcpy(&addrbuf, src, len); + src = &addrbuf; + } + if (((struct in_addr *)src)->s_addr == 0) + return NULL; + break; +#ifdef INET6 + case AF_INET6: + if (len != sizeof(struct in6_addr)) { + *errp = NO_RECOVERY; + return NULL; + } + if ((long)src & ~(sizeof(struct in6_addr) / 2 - 1)) { /*XXX*/ + memcpy(&addrbuf, src, len); + src = &addrbuf; + } + if (IN6_IS_ADDR_UNSPECIFIED((struct in6_addr *)src)) + return NULL; + if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)src) + || IN6_IS_ADDR_V4COMPAT((struct in6_addr *)src)) { + src = (char *)src + + (sizeof(struct in6_addr) - sizeof(struct in_addr)); + af = AF_INET; + len = sizeof(struct in_addr); + } + break; +#endif + default: + *errp = NO_RECOVERY; + return NULL; + } + + rval = nsdispatch(&hp, dtab, NSDB_HOSTS, "ghbyaddr", default_src, + src, len, af, errp); + return (rval == NS_SUCCESS) ? hp : NULL; +} + +void +freehostent(struct hostent *ptr) +{ + free(ptr); +} + +#if 0 + +/* XXX: should be deprecated */ +struct hostent * +getnodebyname(const char *name, int af, int flags) +{ + return getipnodebyname(name, af, flags, &h_errno); +} + +#ifdef __warn_references +__warn_references(getnodebyname, + "warning: getnodebyname() deprecated, " + "should use getaddrinfo() or getipnodebyname()"); +#endif + +struct hostent * +getnodebyaddr(const void *src, size_t len, int af) +{ + return getipnodebyaddr(src, len, af, &h_errno); +} + +#ifdef __warn_references +__warn_references(getnodebyaddr, + "warning: getnodebyaddr() deprecated, " + "should use getnameinfo() or getipnodebyaddr()"); +#endif + +#endif + +/* + * Private utility functions + */ + +/* + * _hpcopy: allocate and copy hostent structure + */ +static struct hostent * +_hpcopy(struct hostent *hp, int *errp) +{ + struct hostent *nhp; + char *cp, **pp; + int size, addrsize; + int nalias = 0, naddr = 0; + int al_off; + int i; + + if (hp == NULL) + return hp; + + /* count size to be allocated */ + size = sizeof(struct hostent); + if (hp->h_name != NULL) + size += strlen(hp->h_name) + 1; + if ((pp = hp->h_aliases) != NULL) { + for (i = 0; *pp != NULL; i++, pp++) { + if (**pp != '\0') { + size += strlen(*pp) + 1; + nalias++; + } + } + } + /* adjust alignment */ +#ifdef ALIGN + size = ALIGN(size); +#endif + al_off = size; + size += sizeof(char *) * (nalias + 1); +#ifdef ALIGN + addrsize = ALIGN(hp->h_length); +#else + addrsize = hp->h_length; +#endif + + if ((pp = hp->h_addr_list) != NULL) { + while (*pp++ != NULL) + naddr++; + } + size += addrsize * naddr; + size += sizeof(char *) * (naddr + 1); + + /* copy */ + if ((nhp = (struct hostent *)malloc(size)) == NULL) { + *errp = TRY_AGAIN; + return NULL; + } + cp = (char *)&nhp[1]; + if (hp->h_name != NULL) { + nhp->h_name = cp; + strcpy(cp, hp->h_name); + cp += strlen(cp) + 1; + } else + nhp->h_name = NULL; + nhp->h_aliases = (char **)((char *)nhp + al_off); + if ((pp = hp->h_aliases) != NULL) { + for (i = 0; *pp != NULL; pp++) { + if (**pp != '\0') { + nhp->h_aliases[i++] = cp; + strcpy(cp, *pp); + cp += strlen(cp) + 1; + } + } + } + nhp->h_aliases[nalias] = NULL; + cp = (char *)&nhp->h_aliases[nalias + 1]; + nhp->h_addrtype = hp->h_addrtype; + nhp->h_length = hp->h_length; + nhp->h_addr_list = (char **)cp; + if ((pp = hp->h_addr_list) != NULL) { + cp = (char *)&nhp->h_addr_list[naddr + 1]; + for (i = 0; *pp != NULL; pp++) { + nhp->h_addr_list[i++] = cp; + memcpy(cp, *pp, hp->h_length); + cp += addrsize; + } + } + nhp->h_addr_list[naddr] = NULL; + return nhp; +} + +/* + * _hpaddr: construct hostent structure with one address + */ +static struct hostent * +_hpaddr(int af, const char *name, void *addr, int *errp) +{ + struct hostent *hp, hpbuf; + char *addrs[2]; + + hp = &hpbuf; + hp->h_name = (char *)name; + hp->h_aliases = NULL; + hp->h_addrtype = af; + hp->h_length = ADDRLEN(af); + hp->h_addr_list = addrs; + addrs[0] = (char *)addr; + addrs[1] = NULL; + return _hpcopy(hp, errp); +} + +/* + * _hpmerge: merge 2 hostent structure, arguments will be freed + */ +static struct hostent * +_hpmerge(struct hostent *hp1, struct hostent *hp2, int *errp) +{ + int i, j; + int naddr, nalias; + char **pp; + struct hostent *hp, hpbuf; + char *aliases[MAXALIASES + 1], *addrs[MAXADDRS + 1]; + union inx_addr addrbuf[MAXADDRS]; + + if (hp1 == NULL) + return hp2; + if (hp2 == NULL) + return hp1; + +#define HP(i) (i == 1 ? hp1 : hp2) + hp = &hpbuf; + hp->h_name = (hp1->h_name != NULL ? hp1->h_name : hp2->h_name); + hp->h_aliases = aliases; + nalias = 0; + for (i = 1; i <= 2; i++) { + if ((pp = HP(i)->h_aliases) == NULL) + continue; + for (; nalias < MAXALIASES && *pp != NULL; pp++) { + /* check duplicates */ + for (j = 0; j < nalias; j++) + if (strcasecmp(*pp, aliases[j]) == 0) + break; + if (j == nalias) + aliases[nalias++] = *pp; + } + } + aliases[nalias] = NULL; +#ifdef INET6 + if (hp1->h_length != hp2->h_length) { + hp->h_addrtype = AF_INET6; + hp->h_length = sizeof(struct in6_addr); + } else { +#endif + hp->h_addrtype = hp1->h_addrtype; + hp->h_length = hp1->h_length; +#ifdef INET6 + } +#endif + hp->h_addr_list = addrs; + naddr = 0; + for (i = 1; i <= 2; i++) { + if ((pp = HP(i)->h_addr_list) == NULL) + continue; + if (HP(i)->h_length == hp->h_length) { + while (naddr < MAXADDRS && *pp != NULL) + addrs[naddr++] = *pp++; + } else { + /* copy IPv4 addr as mapped IPv6 addr */ + while (naddr < MAXADDRS && *pp != NULL) { + MAPADDR(&addrbuf[naddr], *pp++); + addrs[naddr] = (char *)&addrbuf[naddr]; + naddr++; + } + } + } + addrs[naddr] = NULL; + hp = _hpcopy(hp, errp); + freehostent(hp1); + freehostent(hp2); + return hp; +} + +/* + * _hpmapv6: convert IPv4 hostent into IPv4-mapped IPv6 addresses + */ +#ifdef INET6 +static struct hostent * +_hpmapv6(struct hostent *hp, int *errp) +{ + struct hostent *hp6; + + if (hp == NULL) + return NULL; + if (hp->h_addrtype == AF_INET6) + return hp; + + /* make dummy hostent to convert IPv6 address */ + if ((hp6 = (struct hostent *)malloc(sizeof(struct hostent))) == NULL) { + *errp = TRY_AGAIN; + return NULL; + } + hp6->h_name = NULL; + hp6->h_aliases = NULL; + hp6->h_addrtype = AF_INET6; + hp6->h_length = sizeof(struct in6_addr); + hp6->h_addr_list = NULL; + return _hpmerge(hp6, hp, errp); +} +#endif + +/* + * _hpsort: sort address by sortlist + */ +static struct hostent * +_hpsort(struct hostent *hp) +{ + int i, j, n; + u_char *ap, *sp, *mp, **pp; + char t; + char order[MAXADDRS]; + int nsort = _res.nsort; + + if (hp == NULL || hp->h_addr_list[1] == NULL || nsort == 0) + return hp; + for (i = 0; (ap = (u_char *)hp->h_addr_list[i]); i++) { + for (j = 0; j < nsort; j++) { +#ifdef INET6 + if (_res_ext.sort_list[j].af != hp->h_addrtype) + continue; + sp = (u_char *)&_res_ext.sort_list[j].addr; + mp = (u_char *)&_res_ext.sort_list[j].mask; +#else + sp = (u_char *)&_res.sort_list[j].addr; + mp = (u_char *)&_res.sort_list[j].mask; +#endif + for (n = 0; n < hp->h_length; n++) { + if ((ap[n] & mp[n]) != sp[n]) + break; + } + if (n == hp->h_length) + break; + } + order[i] = j; + } + n = i; + pp = (u_char **)hp->h_addr_list; + for (i = 0; i < n - 1; i++) { + for (j = i + 1; j < n; j++) { + if (order[i] > order[j]) { + ap = pp[i]; + pp[i] = pp[j]; + pp[j] = ap; + t = order[i]; + order[i] = order[j]; + order[j] = t; + } + } + } + return hp; +} + +static char * +_hgetword(char **pp) +{ + char c, *p, *ret; + const char *sp; + static const char sep[] = "# \t\n"; + + ret = NULL; + for (p = *pp; (c = *p) != '\0'; p++) { + for (sp = sep; *sp != '\0'; sp++) { + if (c == *sp) + break; + } + if (c == '#') + p[1] = '\0'; /* ignore rest of line */ + if (ret == NULL) { + if (*sp == '\0') + ret = p; + } else { + if (*sp != '\0') { + *p++ = '\0'; + break; + } + } + } + *pp = p; + if (ret == NULL || *ret == '\0') + return NULL; + return ret; +} + +/* + * FILES (/etc/hosts) + */ + +static FILE * +_files_open(int *errp) +{ + FILE *fp; + fp = fopen(_PATH_HOSTS, "r"); + if (fp == NULL) + *errp = NO_RECOVERY; + return fp; +} + +static int +_files_ghbyname(void *rval, void *cb_data, va_list ap) +{ + const char *name; + int af; + int *errp; + int match, nalias; + char *p, *line, *addrstr, *cname; + FILE *fp; + struct hostent *rethp, *hp, hpbuf; + char *aliases[MAXALIASES + 1], *addrs[2]; + union inx_addr addrbuf; + char buf[BUFSIZ]; + int af0; + + name = va_arg(ap, const char *); + af = va_arg(ap, int); + errp = va_arg(ap, int *); + + *(struct hostent **)rval = NULL; + + if ((fp = _files_open(errp)) == NULL) + return NS_UNAVAIL; + rethp = hp = NULL; + + af0 = af; + while (fgets(buf, sizeof(buf), fp)) { + line = buf; + if ((addrstr = _hgetword(&line)) == NULL + || (cname = _hgetword(&line)) == NULL) + continue; + match = (strcasecmp(cname, name) == 0); + nalias = 0; + while ((p = _hgetword(&line)) != NULL) { + if (!match) + match = (strcasecmp(p, name) == 0); + if (nalias < MAXALIASES) + aliases[nalias++] = p; + } + if (!match) + continue; + switch (af0) { + case AF_INET: + if (inet_aton(addrstr, (struct in_addr *)&addrbuf) + != 1) { + *errp = NO_DATA; /* name found */ + continue; + } + af = af0; + break; +#ifdef INET6 + case AF_INET6: + if (inet_pton(af, addrstr, &addrbuf) != 1) { + *errp = NO_DATA; /* name found */ + continue; + } + af = af0; + break; +#endif + case AF_UNSPEC: + if (inet_aton(addrstr, (struct in_addr *)&addrbuf) + == 1) { + af = AF_INET; + break; + } +#ifdef INET6 + if (inet_pton(AF_INET6, addrstr, &addrbuf) == 1) { + af = AF_INET6; + break; + } +#endif + *errp = NO_DATA; /* name found */ + continue; + /* NOTREACHED */ + } + hp = &hpbuf; + hp->h_name = cname; + hp->h_aliases = aliases; + aliases[nalias] = NULL; + hp->h_addrtype = af; + hp->h_length = ADDRLEN(af); + hp->h_addr_list = addrs; + addrs[0] = (char *)&addrbuf; + addrs[1] = NULL; + hp = _hpcopy(hp, errp); + rethp = _hpmerge(rethp, hp, errp); + } + fclose(fp); + *(struct hostent **)rval = rethp; + return (rethp != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} + +static int +_files_ghbyaddr(void *rval, void *cb_data, va_list ap) +{ + const void *addr; + int addrlen; + int af; + int *errp; + int nalias; + char *p, *line; + FILE *fp; + struct hostent *hp, hpbuf; + char *aliases[MAXALIASES + 1], *addrs[2]; + union inx_addr addrbuf; + char buf[BUFSIZ]; + + addr = va_arg(ap, const void *); + addrlen = va_arg(ap, int); + af = va_arg(ap, int); + errp = va_arg(ap, int *); + + *(struct hostent**)rval = NULL; + + if ((fp = _files_open(errp)) == NULL) + return NS_UNAVAIL; + hp = NULL; + while (fgets(buf, sizeof(buf), fp)) { + line = buf; + if ((p = _hgetword(&line)) == NULL + || (af == AF_INET + ? inet_aton(p, (struct in_addr *)&addrbuf) + : inet_pton(af, p, &addrbuf)) != 1 + || memcmp(addr, &addrbuf, addrlen) != 0 + || (p = _hgetword(&line)) == NULL) + continue; + hp = &hpbuf; + hp->h_name = p; + hp->h_aliases = aliases; + nalias = 0; + while ((p = _hgetword(&line)) != NULL) { + if (nalias < MAXALIASES) + aliases[nalias++] = p; + } + aliases[nalias] = NULL; + hp->h_addrtype = af; + hp->h_length = addrlen; + hp->h_addr_list = addrs; + addrs[0] = (char *)&addrbuf; + addrs[1] = NULL; + hp = _hpcopy(hp, errp); + break; + } + fclose(fp); + *(struct hostent **)rval = hp; + return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} + +#ifdef YP +/* + * NIS + * + * XXX actually a hack, these are INET4 specific. + */ +static int +_nis_ghbyname(void *rval, void *cb_data, va_list ap) +{ + const char *name; + int af; + int *errp; + struct hostent *hp = NULL; + + name = va_arg(ap, const char *); + af = va_arg(ap, int); + errp = va_arg(ap, int *); + + if (af == AF_UNSPEC) + af = AF_INET; + if (af == AF_INET) { + hp = _gethostbynisname(name, af); + if (hp != NULL) + hp = _hpcopy(hp, errp); + } + + *(struct hostent **)rval = hp; + return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND; + +} + +static int +_nis_ghbyaddr(void *rval, void *cb_data, va_list ap) +{ + const void *addr; + int addrlen; + int af; + int *errp; + struct hostent *hp = NULL; + + addr = va_arg(ap, const void *); + addrlen = va_arg(ap, int); + af = va_arg(ap, int); + + if (af == AF_INET) { + hp = _gethostbynisaddr(addr, addrlen, af); + if (hp != NULL) + hp = _hpcopy(hp, errp); + } + *(struct hostent **)rval = hp; + return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} +#endif +typedef struct __res_type_list res_type_list; + +struct __res_type_list { + res_type_list * rtl_entry; + int rtl_type; +}; + +#if PACKETSZ > 1024 +#define MAXPACKET PACKETSZ +#else +#define MAXPACKET 1024 +#endif + +typedef union { + HEADER hdr; + u_char buf[MAXPACKET]; +} querybuf; + +static struct hostent *getanswer(const querybuf *, int, const char *, int, + struct hostent *, int *); + +/* + * we don't need to take care about sorting, nor IPv4 mapped address here. + */ +static struct hostent * +getanswer(answer, anslen, qname, qtype, template, errp) + const querybuf *answer; + int anslen; + const char *qname; + int qtype; + struct hostent *template; + int *errp; +{ + const HEADER *hp; + const u_char *cp; + int n; + const u_char *eom, *erdata; + char *bp, **ap, **hap; + int type, class, buflen, ancount, qdcount; + int haveanswer, had_error; + char tbuf[MAXDNAME]; + const char *tname; + int (*name_ok)(const char *); + static char *h_addr_ptrs[MAXADDRS + 1]; + static char *host_aliases[MAXALIASES]; + static char hostbuf[8*1024]; + +#define BOUNDED_INCR(x) \ + do { \ + cp += x; \ + if (cp > eom) { \ + *errp = NO_RECOVERY; \ + return (NULL); \ + } \ + } while (0) + +#define BOUNDS_CHECK(ptr, count) \ + do { \ + if ((ptr) + (count) > eom) { \ + *errp = NO_RECOVERY; \ + return (NULL); \ + } \ + } while (0) + +/* XXX do {} while (0) cannot be put here */ +#define DNS_ASSERT(x) \ + { \ + if (!(x)) { \ + cp += n; \ + continue; \ + } \ + } + +/* XXX do {} while (0) cannot be put here */ +#define DNS_FATAL(x) \ + { \ + if (!(x)) { \ + had_error++; \ + continue; \ + } \ + } + + tname = qname; + template->h_name = NULL; + eom = answer->buf + anslen; + switch (qtype) { + case T_A: + case T_AAAA: + name_ok = res_hnok; + break; + case T_PTR: + name_ok = res_dnok; + break; + default: + return (NULL); /* XXX should be abort(); */ + } + /* + * find first satisfactory answer + */ + hp = &answer->hdr; + ancount = ntohs(hp->ancount); + qdcount = ntohs(hp->qdcount); + bp = hostbuf; + buflen = sizeof hostbuf; + cp = answer->buf; + BOUNDED_INCR(HFIXEDSZ); + if (qdcount != 1) { + *errp = NO_RECOVERY; + return (NULL); + } + n = dn_expand(answer->buf, eom, cp, bp, buflen); + if ((n < 0) || !(*name_ok)(bp)) { + *errp = NO_RECOVERY; + return (NULL); + } + BOUNDED_INCR(n + QFIXEDSZ); + if (qtype == T_A || qtype == T_AAAA) { + /* res_send() has already verified that the query name is the + * same as the one we sent; this just gets the expanded name + * (i.e., with the succeeding search-domain tacked on). + */ + n = strlen(bp) + 1; /* for the \0 */ + if (n >= MAXHOSTNAMELEN) { + *errp = NO_RECOVERY; + return (NULL); + } + template->h_name = bp; + bp += n; + buflen -= n; + /* The qname can be abbreviated, but h_name is now absolute. */ + qname = template->h_name; + } + ap = host_aliases; + *ap = NULL; + template->h_aliases = host_aliases; + hap = h_addr_ptrs; + *hap = NULL; + template->h_addr_list = h_addr_ptrs; + haveanswer = 0; + had_error = 0; + while (ancount-- > 0 && cp < eom && !had_error) { + n = dn_expand(answer->buf, eom, cp, bp, buflen); + DNS_FATAL(n >= 0); + DNS_FATAL((*name_ok)(bp)); + cp += n; /* name */ + BOUNDS_CHECK(cp, 3 * INT16SZ + INT32SZ); + type = _getshort(cp); + cp += INT16SZ; /* type */ + class = _getshort(cp); + cp += INT16SZ + INT32SZ; /* class, TTL */ + n = _getshort(cp); + cp += INT16SZ; /* len */ + BOUNDS_CHECK(cp, n); + erdata = cp + n; + DNS_ASSERT(class == C_IN); + if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) { + if (ap >= &host_aliases[MAXALIASES-1]) + continue; + n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); + DNS_FATAL(n >= 0); + DNS_FATAL((*name_ok)(tbuf)); + cp += n; + if (cp != erdata) { + *errp = NO_RECOVERY; + return (NULL); + } + /* Store alias. */ + *ap++ = bp; + n = strlen(bp) + 1; /* for the \0 */ + DNS_FATAL(n < MAXHOSTNAMELEN); + bp += n; + buflen -= n; + /* Get canonical name. */ + n = strlen(tbuf) + 1; /* for the \0 */ + DNS_FATAL(n <= buflen); + DNS_FATAL(n < MAXHOSTNAMELEN); + strcpy(bp, tbuf); + template->h_name = bp; + bp += n; + buflen -= n; + continue; + } + if (qtype == T_PTR && type == T_CNAME) { + n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); + if (n < 0 || !res_dnok(tbuf)) { + had_error++; + continue; + } + cp += n; + if (cp != erdata) { + *errp = NO_RECOVERY; + return (NULL); + } + /* Get canonical name. */ + n = strlen(tbuf) + 1; /* for the \0 */ + if (n > buflen || n >= MAXHOSTNAMELEN) { + had_error++; + continue; + } + strcpy(bp, tbuf); + tname = bp; + bp += n; + buflen -= n; + continue; + } + DNS_ASSERT(type == qtype); + switch (type) { + case T_PTR: + DNS_ASSERT(strcasecmp(tname, bp) == 0); + n = dn_expand(answer->buf, eom, cp, bp, buflen); + DNS_FATAL(n >= 0); + DNS_FATAL(res_hnok(bp)); +#if MULTI_PTRS_ARE_ALIASES + cp += n; + if (cp != erdata) { + *errp = NO_RECOVERY; + return (NULL); + } + if (!haveanswer) + template->h_name = bp; + else if (ap < &host_aliases[MAXALIASES-1]) + *ap++ = bp; + else + n = -1; + if (n != -1) { + n = strlen(bp) + 1; /* for the \0 */ + if (n >= MAXHOSTNAMELEN) { + had_error++; + break; + } + bp += n; + buflen -= n; + } + break; +#else + template->h_name = bp; + *errp = NETDB_SUCCESS; + return (template); +#endif + case T_A: + case T_AAAA: + DNS_ASSERT(strcasecmp(template->h_name, bp) == 0); + DNS_ASSERT(n == template->h_length); + if (!haveanswer) { + int nn; + + template->h_name = bp; + nn = strlen(bp) + 1; /* for the \0 */ + bp += nn; + buflen -= nn; + } +#ifdef ALIGN + bp = (char *)ALIGN(bp); +#else + bp = (char *)(bp); +#endif + + DNS_FATAL(bp + n < &hostbuf[sizeof hostbuf]); + DNS_ASSERT(hap < &h_addr_ptrs[MAXADDRS-1]); +#ifdef FILTER_V4MAPPED + if (type == T_AAAA) { + struct in6_addr in6; + memcpy(&in6, cp, sizeof(in6)); + DNS_ASSERT(IN6_IS_ADDR_V4MAPPED(&in6) == 0); + } +#endif + bcopy(cp, *hap++ = bp, n); + bp += n; + buflen -= n; + cp += n; + if (cp != erdata) { + *errp = NO_RECOVERY; + return (NULL); + } + break; + default: + abort(); + } + if (!had_error) + haveanswer++; + } + if (haveanswer) { + *ap = NULL; + *hap = NULL; + if (!template->h_name) { + n = strlen(qname) + 1; /* for the \0 */ + if (n > buflen || n >= MAXHOSTNAMELEN) + goto no_recovery; + strcpy(bp, qname); + template->h_name = bp; + bp += n; + buflen -= n; + } + *errp = NETDB_SUCCESS; + return (template); + } + no_recovery: + *errp = NO_RECOVERY; + return (NULL); + +#undef BOUNDED_INCR +#undef BOUNDS_CHECK +#undef DNS_ASSERT +#undef DNS_FATAL +} + +/* res_search() variant with multiple query support. */ +static struct hostent * +_res_search_multi(name, rtl, errp) + const char *name; /* domain name */ + struct __res_type_list *rtl; /* list of query types */ + int *errp; +{ + const char *cp, * const *domain; + struct hostent *hp0 = NULL, *hp; + struct hostent hpbuf; + u_int dots; + int trailing_dot, ret, saved_herrno; + int got_nodata = 0, got_servfail = 0, tried_as_is = 0; + struct __res_type_list *rtl0 = rtl; + querybuf buf; + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + *errp = NETDB_INTERNAL; + return (NULL); + } + dots = 0; + for (cp = name; *cp; cp++) + dots += (*cp == '.'); + trailing_dot = 0; + if (cp > name && *--cp == '.') + trailing_dot++; + + /* If there aren't any dots, it could be a user-level alias */ + if (!dots && (cp = hostalias(name)) != NULL) { + for(rtl = rtl0; rtl != NULL; + rtl = rtl->rtl_entry) { + ret = res_query(cp, C_IN, rtl->rtl_type, buf.buf, + sizeof(buf.buf)); + if (ret > 0) { + hpbuf.h_addrtype = (rtl->rtl_type == T_AAAA) + ? AF_INET6 : AF_INET; + hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype); + hp = getanswer(&buf, ret, name, rtl->rtl_type, + &hpbuf, errp); + if (!hp) + continue; + hp = _hpcopy(&hpbuf, errp); + hp0 = _hpmerge(hp0, hp, errp); + } + } + return (hp0); + } + + /* + * If there are dots in the name already, let's just give it a try + * 'as is'. The threshold can be set with the "ndots" option. + */ + saved_herrno = -1; + if (dots >= _res.ndots) { + for(rtl = rtl0; rtl != NULL; + rtl = rtl->rtl_entry) { + ret = res_querydomain(name, NULL, C_IN, rtl->rtl_type, + buf.buf, sizeof(buf.buf)); + if (ret > 0) { + hpbuf.h_addrtype = (rtl->rtl_type == T_AAAA) + ? AF_INET6 : AF_INET; + hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype); + hp = getanswer(&buf, ret, name, rtl->rtl_type, + &hpbuf, errp); + if (!hp) + continue; + hp = _hpcopy(&hpbuf, errp); + hp0 = _hpmerge(hp0, hp, errp); + } + } + if (hp0 != NULL) + return (hp0); + saved_herrno = *errp; + tried_as_is++; + } + + /* + * We do at least one level of search if + * - there is no dot and RES_DEFNAME is set, or + * - there is at least one dot, there is no trailing dot, + * and RES_DNSRCH is set. + */ + if ((!dots && (_res.options & RES_DEFNAMES)) || + (dots && !trailing_dot && (_res.options & RES_DNSRCH))) { + int done = 0; + + for (domain = (const char * const *)_res.dnsrch; + *domain && !done; + domain++) { + + for(rtl = rtl0; rtl != NULL; + rtl = rtl->rtl_entry) { + ret = res_querydomain(name, *domain, C_IN, + rtl->rtl_type, + buf.buf, sizeof(buf.buf)); + if (ret > 0) { + hpbuf.h_addrtype = (rtl->rtl_type == T_AAAA) + ? AF_INET6 : AF_INET; + hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype); + hp = getanswer(&buf, ret, name, + rtl->rtl_type, &hpbuf, errp); + if (!hp) + continue; + hp = _hpcopy(&hpbuf, errp); + hp0 = _hpmerge(hp0, hp, errp); + } + } + if (hp0 != NULL) + return (hp0); + + /* + * If no server present, give up. + * If name isn't found in this domain, + * keep trying higher domains in the search list + * (if that's enabled). + * On a NO_DATA error, keep trying, otherwise + * a wildcard entry of another type could keep us + * from finding this entry higher in the domain. + * If we get some other error (negative answer or + * server failure), then stop searching up, + * but try the input name below in case it's + * fully-qualified. + */ + if (errno == ECONNREFUSED) { + *errp = TRY_AGAIN; + return (NULL); + } + + switch (*errp) { + case NO_DATA: + got_nodata++; + /* FALLTHROUGH */ + case HOST_NOT_FOUND: + /* keep trying */ + break; + case TRY_AGAIN: + if (buf.hdr.rcode == SERVFAIL) { + /* try next search element, if any */ + got_servfail++; + break; + } + /* FALLTHROUGH */ + default: + /* anything else implies that we're done */ + done++; + } + + /* if we got here for some reason other than DNSRCH, + * we only wanted one iteration of the loop, so stop. + */ + if (!(_res.options & RES_DNSRCH)) + done++; + } + } + + /* + * If we have not already tried the name "as is", do that now. + * note that we do this regardless of how many dots were in the + * name or whether it ends with a dot unless NOTLDQUERY is set. + */ + if (!tried_as_is && (dots || !(_res.options & RES_NOTLDQUERY))) { + for(rtl = rtl0; rtl != NULL; + rtl = rtl->rtl_entry) { + ret = res_querydomain(name, NULL, C_IN, rtl->rtl_type, + buf.buf, sizeof(buf.buf)); + if (ret > 0) { + hpbuf.h_addrtype = (rtl->rtl_type == T_AAAA) + ? AF_INET6 : AF_INET; + hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype); + hp = getanswer(&buf, ret, name, rtl->rtl_type, + &hpbuf, errp); + if (!hp) + continue; + hp = _hpcopy(&hpbuf, errp); + hp0 = _hpmerge(hp0, hp, errp); + } + } + if (hp0 != NULL) + return (hp0); + } + + /* if we got here, we didn't satisfy the search. + * if we did an initial full query, return that query's h_errno + * (note that we wouldn't be here if that query had succeeded). + * else if we ever got a nodata, send that back as the reason. + * else send back meaningless h_errno, that being the one from + * the last DNSRCH we did. + */ + if (saved_herrno != -1) + *errp = saved_herrno; + else if (got_nodata) + *errp = NO_DATA; + else if (got_servfail) + *errp = TRY_AGAIN; + return (NULL); +} + +static int +_dns_ghbyname(void *rval, void *cb_data, va_list ap) +{ + const char *name; + int af; + int *errp; + res_type_list *rtl, rtl4; +#ifdef INET6 + res_type_list rtl6; +#endif + + name = va_arg(ap, const char *); + af = va_arg(ap, int); + errp = va_arg(ap, int *); + +#ifdef INET6 + switch (af) { + case AF_UNSPEC: + &rtl4->rtl_entry = NULL; rtl4.rtl_type = T_A; + &rtl6->rtl_entry = &rtl4; rtl6.rtl_type = T_AAAA; + rtl = &rtl6; + break; + case AF_INET6: + &rtl6->rtl_entry = NULL; rtl6.rtl_type = T_AAAA; + rtl = &rtl6; + break; + case AF_INET: + &rtl4->rtl_entry = NULL; rtl4.rtl_type = T_A; + rtl = &rtl4; + break; + } +#else + (&rtl4)->rtl_entry = NULL; + rtl4.rtl_type = T_A; + rtl = &rtl4; +#endif + *(struct hostent **)rval = _res_search_multi(name, rtl, errp); + return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; +} + +static int +_dns_ghbyaddr(void *rval, void *cb_data, va_list ap) +{ + const void *addr; + int addrlen; + int af; + int *errp; + int n; + struct hostent *hp; + u_char c, *cp; + char *bp; + struct hostent hbuf; + int na; +#ifdef INET6 + static const char hex[] = "0123456789abcdef"; +#endif + querybuf buf; + char qbuf[MAXDNAME+1]; + char *hlist[2]; + + addr = va_arg(ap, const void *); + addrlen = va_arg(ap, int); + af = va_arg(ap, int); + errp = va_arg(ap, int *); + + *(struct hostent **)rval = NULL; + +#ifdef INET6 + /* XXX */ + if (af == AF_INET6 && IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)) + return NS_NOTFOUND; +#endif + + if ((_res.options & RES_INIT) == 0) { + if (res_init() < 0) { + *errp = h_errno; + return NS_UNAVAIL; + } + } + memset(&hbuf, 0, sizeof(hbuf)); + hbuf.h_name = NULL; + hbuf.h_addrtype = af; + hbuf.h_length = addrlen; + na = 0; + + /* XXX assumes that MAXDNAME is big enough */ + n = 0; + bp = qbuf; + cp = (u_char *)addr+addrlen-1; + switch (af) { +#ifdef INET6 + case AF_INET6: + for (; n < addrlen; n++, cp--) { + c = *cp; + *bp++ = hex[c & 0xf]; + *bp++ = '.'; + *bp++ = hex[c >> 4]; + *bp++ = '.'; + } + strcpy(bp, "ip6.int"); + break; +#endif + default: + for (; n < addrlen; n++, cp--) { + c = *cp; + if (c >= 100) + *bp++ = '0' + c / 100; + if (c >= 10) + *bp++ = '0' + (c % 100) / 10; + *bp++ = '0' + c % 10; + *bp++ = '.'; + } + strcpy(bp, "in-addr.arpa"); + break; + } + + n = res_query(qbuf, C_IN, T_PTR, buf.buf, sizeof buf.buf); + if (n < 0) { + *errp = h_errno; + return NS_UNAVAIL; + } + hp = getanswer(&buf, n, qbuf, T_PTR, &hbuf, errp); + if (!hp) + return NS_NOTFOUND; + hbuf.h_addrtype = af; + hbuf.h_length = addrlen; + hbuf.h_addr_list = hlist; + hlist[0] = (char *)addr; + hlist[1] = NULL; + *(struct hostent **)rval = _hpcopy(&hbuf, errp); + return NS_SUCCESS; +} + +#if 0 // keep gcc happy +static void +_dns_shent(int stayopen) +{ + if ((_res.options & RES_INIT) == 0) { + if (res_init() < 0) + return; + } + if (stayopen) + _res.options |= RES_STAYOPEN | RES_USEVC; +} + +static void +_dns_ehent(void) +{ + _res.options &= ~(RES_STAYOPEN | RES_USEVC); + res_close(); +} +#endif + +#ifdef ICMPNL + +/* + * experimental: + * draft-ietf-ipngwg-icmp-namelookups-02.txt + * ifindex is assumed to be encoded in addr. + */ +#include +#include +#include + +struct _icmp_host_cache { + struct _icmp_host_cache *hc_next; + int hc_ifindex; + struct in6_addr hc_addr; + char *hc_name; +}; + +static char * +_icmp_fqdn_query(const struct in6_addr *addr, int ifindex) +{ + int s; + struct icmp6_filter filter; + struct msghdr msg; + struct cmsghdr *cmsg; + struct in6_pktinfo *pkt; + char cbuf[256]; + char buf[1024]; + int cc; + struct icmp6_fqdn_query *fq; + struct icmp6_fqdn_reply *fr; + struct _icmp_host_cache *hc; + struct sockaddr_in6 sin6; + struct iovec iov; + fd_set s_fds, fds; + struct timeval tout; + int len; + char *name; + static int pid; + static struct _icmp_host_cache *hc_head; + + for (hc = hc_head; hc; hc = hc->hc_next) { + if (hc->hc_ifindex == ifindex + && IN6_ARE_ADDR_EQUAL(&hc->hc_addr, addr)) + return hc->hc_name; + } + + if (pid == 0) + pid = getpid(); + + ICMP6_FILTER_SETBLOCKALL(&filter); + ICMP6_FILTER_SETPASS(ICMP6_FQDN_REPLY, &filter); + + FD_ZERO(&s_fds); + tout.tv_sec = 0; + tout.tv_usec = 200000; /*XXX: 200ms*/ + + fq = (struct icmp6_fqdn_query *)buf; + fq->icmp6_fqdn_type = ICMP6_FQDN_QUERY; + fq->icmp6_fqdn_code = 0; + fq->icmp6_fqdn_cksum = 0; + fq->icmp6_fqdn_id = (u_short)pid; + fq->icmp6_fqdn_unused = 0; + fq->icmp6_fqdn_cookie[0] = 0; + fq->icmp6_fqdn_cookie[1] = 0; + + memset(&sin6, 0, sizeof(sin6)); + sin6.sin6_family = AF_INET6; + sin6.sin6_addr = *addr; + + memset(&msg, 0, sizeof(msg)); + msg.msg_name = (caddr_t)&sin6; + msg.msg_namelen = sizeof(sin6); + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + iov.iov_base = (caddr_t)buf; + iov.iov_len = sizeof(struct icmp6_fqdn_query); + + if (ifindex) { + msg.msg_control = cbuf; + msg.msg_controllen = sizeof(cbuf); + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); + cmsg->cmsg_level = IPPROTO_IPV6; + cmsg->cmsg_type = IPV6_PKTINFO; + pkt = (struct in6_pktinfo *)&cmsg[1]; + memset(&pkt->ipi6_addr, 0, sizeof(struct in6_addr)); + pkt->ipi6_ifindex = ifindex; + cmsg = CMSG_NXTHDR(&msg, cmsg); + msg.msg_controllen = (char *)cmsg - cbuf; + } + + if ((s = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0) + return NULL; + (void)setsockopt(s, IPPROTO_ICMPV6, ICMP6_FILTER, + (char *)&filter, sizeof(filter)); + cc = _sendmsg(s, &msg, 0); + if (cc < 0) { + close(s); + return NULL; + } + FD_SET(s, &s_fds); + for (;;) { + fds = s_fds; + if (select(s + 1, &fds, NULL, NULL, &tout) <= 0) { + close(s); + return NULL; + } + len = sizeof(sin6); + cc = _recvfrom(s, buf, sizeof(buf), 0, + (struct sockaddr *)&sin6, &len); + if (cc <= 0) { + close(s); + return NULL; + } + if (cc < sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr)) + continue; + if (!IN6_ARE_ADDR_EQUAL(addr, &sin6.sin6_addr)) + continue; + fr = (struct icmp6_fqdn_reply *)(buf + sizeof(struct ip6_hdr)); + if (fr->icmp6_fqdn_type == ICMP6_FQDN_REPLY) + break; + } + close(s); + if (fr->icmp6_fqdn_cookie[1] != 0) { + /* rfc1788 type */ + name = buf + sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) + 4; + len = (buf + cc) - name; + } else { + len = fr->icmp6_fqdn_namelen; + name = fr->icmp6_fqdn_name; + } + if (len <= 0) + return NULL; + name[len] = 0; + + if ((hc = (struct _icmp_host_cache *)malloc(sizeof(*hc))) == NULL) + return NULL; + /* XXX: limit number of cached entries */ + hc->hc_ifindex = ifindex; + hc->hc_addr = *addr; + hc->hc_name = strdup(name); + hc->hc_next = hc_head; + hc_head = hc; + return hc->hc_name; +} + +static struct hostent * +_icmp_ghbyaddr(const void *addr, int addrlen, int af, int *errp) +{ + char *hname; + int ifindex; + struct in6_addr addr6; + + if (af != AF_INET6) { + /* + * Note: rfc1788 defines Who Are You for IPv4, + * but no one implements it. + */ + return NULL; + } + + memcpy(&addr6, addr, addrlen); + ifindex = (addr6.s6_addr[2] << 8) | addr6.s6_addr[3]; + addr6.s6_addr[2] = addr6.s6_addr[3] = 0; + + if (!IN6_IS_ADDR_LINKLOCAL(&addr6)) + return NULL; /*XXX*/ + + if ((hname = _icmp_fqdn_query(&addr6, ifindex)) == NULL) + return NULL; + return _hpaddr(af, hname, &addr6, errp); +} +#endif /* ICMPNL */ diff --git a/newlib/libc/sys/linux/net/namespace.h b/newlib/libc/sys/linux/net/namespace.h new file mode 100644 index 000000000..291aad580 --- /dev/null +++ b/newlib/libc/sys/linux/net/namespace.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2001 Daniel Eischen . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/include/namespace.h,v 1.9 2002/03/29 22:43:42 markm Exp $ + */ + +#ifndef _NAMESPACE_H_ +#define _NAMESPACE_H_ + +/* + * Adjust names so that headers declare "hidden" names. + */ + +/* + * ISO C (C90) section. Most names in libc aren't in ISO C, so they + * should be here. Most aren't here... + */ +#define err _err +#define warn _warn + +/* + * Prototypes for syscalls/functions that need to be overridden + * in libc_r/libpthread. + */ +#define accept _accept +#define __acl_aclcheck_fd ___acl_aclcheck_fd +#define __acl_delete_fd ___acl_delete_fd +#define __acl_get_fd ___acl_get_fd +#define __acl_set_fd ___acl_set_fd +#define bind _bind +#define __cap_get_fd ___cap_get_fd +#define __cap_set_fd ___cap_set_fd +#define close _close +#define connect _connect +#define dup _dup +#define dup2 _dup2 +#define execve _execve +#define fcntl _fcntl +/*#define flock _flock */ +#define fstat _fstat +#define fstatfs _fstatfs +#define fsync _fsync +#define getdirentries _getdirentries +#define getlogin _getlogin +#define getpeername _getpeername +#define getprogname _getprogname +#define getsockname _getsockname +#define getsockopt _getsockopt +#define ioctl _ioctl +#define listen _listen +#define nanosleep _nanosleep +#define open _open +#define poll _poll +#define pthread_cond_signal _pthread_cond_signal +#define pthread_cond_wait _pthread_cond_wait +#define pthread_cond_init _pthread_cond_init +#define pthread_exit _pthread_exit +#define pthread_getspecific _pthread_getspecific +#define pthread_key_create _pthread_key_create +#define pthread_key_delete _pthread_key_delete +#define pthread_main_np _pthread_main_np +#define pthread_mutex_destroy _pthread_mutex_destroy +#define pthread_mutex_init _pthread_mutex_init +#define pthread_mutex_lock _pthread_mutex_lock +#define pthread_mutex_trylock _pthread_mutex_trylock +#define pthread_mutex_unlock _pthread_mutex_unlock +#define pthread_mutexattr_init _pthread_mutexattr_init +#define pthread_mutexattr_destroy _pthread_mutexattr_destroy +#define pthread_mutexattr_settype _pthread_mutexattr_settype +#define pthread_once _pthread_once +#define pthread_rwlock_init _pthread_rwlock_init +#define pthread_rwlock_rdlock _pthread_rwlock_rdlock +#define pthread_rwlock_wrlock _pthread_rwlock_wrlock +#define pthread_rwlock_unlock _pthread_rwlock_unlock +#define pthread_self _pthread_self +#define pthread_setspecific _pthread_setspecific +#define pthread_sigmask _pthread_sigmask +#define read _read +#define readv _readv +#define recvfrom _recvfrom +#define recvmsg _recvmsg +#define select _select +#define sendmsg _sendmsg +#define sendto _sendto +#define setsockopt _setsockopt +/*#define sigaction _sigaction*/ +#define sigprocmask _sigprocmask +#define sigsuspend _sigsuspend +#define socket _socket +#define socketpair _socketpair +#define wait4 _wait4 +#define write _write +#define writev _writev + + +/* + * Other hidden syscalls/functions that libc_r needs to override + * but are not used internally by libc. + * + * XXX - When modifying libc to use one of the following, remove + * the prototype from below and place it in the list above. + */ +#if 0 +#define creat _creat +#define fchflags _fchflags +#define fchmod _fchmod +#define fpathconf _fpathconf +#define msync _msync +#define nfssvc _nfssvc +#define pause _pause +#define pthread_rwlock_destroy _pthread_rwlock_destroy +#define pthread_rwlock_tryrdlock _pthread_rwlock_tryrdlock +#define pthread_rwlock_trywrlock _pthread_rwlock_trywrlock +#define pthread_rwlockattr_init _pthread_rwlockattr_init +#define pthread_rwlockattr_destroy _pthread_rwlockattr_destroy +#define sched_yield _sched_yield +#define sendfile _sendfile +#define shutdown _shutdown +#define sigaltstack _sigaltstack +#define sigpending _sigpending +#define sigreturn _sigreturn +#define sigsetmask _sigsetmask +#define sleep _sleep +#define system _system +#define tcdrain _tcdrain +#define wait _wait +#define waitpid _waitpid +#endif + +#endif /* _NAMESPACE_H_ */ diff --git a/newlib/libc/sys/linux/net/ns.3 b/newlib/libc/sys/linux/net/ns.3 new file mode 100644 index 000000000..be8d155c3 --- /dev/null +++ b/newlib/libc/sys/linux/net/ns.3 @@ -0,0 +1,133 @@ +.\" Copyright (c) 1986, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)ns.3 8.1 (Berkeley) 6/4/93 +.\" $FreeBSD: src/lib/libc/net/ns.3,v 1.10 2001/10/01 16:08:56 ru Exp $ +.\" +.Dd June 4, 1993 +.Dt NS 3 +.Os +.Sh NAME +.Nm ns_addr , +.Nm ns_ntoa +.Nd Xerox +.Tn NS Ns (tm) +address conversion routines +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In netns/ns.h +.Ft struct ns_addr +.Fn ns_addr "char *cp" +.Ft char * +.Fn ns_ntoa "struct ns_addr ns" +.Sh DESCRIPTION +The routine +.Fn ns_addr +interprets character strings representing +.Tn XNS +addresses, returning binary information suitable +for use in system calls. +The routine +.Fn ns_ntoa +takes +.Tn XNS +addresses and returns +.Tn ASCII +strings representing the address in a +notation in common use in the Xerox Development Environment: +.Bd -ragged -offset indent +.. +.Ed +.Pp +Trailing zero fields are suppressed, and each number is printed in hexadecimal, +in a format suitable for input to +.Fn ns_addr . +Any fields lacking super-decimal digits will have a +trailing +.Ql H +appended. +.Pp +Unfortunately, no universal standard exists for representing +.Tn XNS +addresses. +An effort has been made to insure that +.Fn ns_addr +be compatible with most formats in common use. +It will first separate an address into 1 to 3 fields using a single delimiter +chosen from +period +.Ql \&. , +colon +.Ql \&: +or pound-sign +.Ql \&# . +Each field is then examined for byte separators (colon or period). +If there are byte separators, each subfield separated is taken to be +a small hexadecimal number, and the entirety is taken as a network-byte-ordered +quantity to be zero extended in the high-network-order bytes. +Next, the field is inspected for hyphens, in which case +the field is assumed to be a number in decimal notation +with hyphens separating the millenia. +Next, the field is assumed to be a number: +It is interpreted +as hexadecimal if there is a leading +.Ql 0x +(as in C), +a trailing +.Ql H +(as in Mesa), or there are any super-decimal digits present. +It is interpreted as octal is there is a leading +.Ql 0 +and there are no super-octal digits. +Otherwise, it is converted as a decimal number. +.Sh RETURN VALUES +None. (See +.Sx BUGS . ) +.Sh SEE ALSO +.Xr hosts 5 , +.Xr networks 5 +.Sh HISTORY +The +.Fn ns_addr +and +.Fn ns_toa +functions appeared in +.Bx 4.3 . +.Sh BUGS +The string returned by +.Fn ns_ntoa +resides in a static memory area. +The function +.Fn ns_addr +should diagnose improperly formed input, and there should be an unambiguous +way to recognize this. diff --git a/newlib/libc/sys/linux/net/ns_addr.c b/newlib/libc/sys/linux/net/ns_addr.c new file mode 100644 index 000000000..a86cf31b7 --- /dev/null +++ b/newlib/libc/sys/linux/net/ns_addr.c @@ -0,0 +1,239 @@ +/* + * Copyright (c) 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * J.Q. Johnson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include + +static struct ns_addr addr, zero_addr; + +static void Field(), cvtbase(); + +struct ns_addr +ns_addr(name) + const char *name; +{ + char separator; + char *hostname, *socketname, *cp; + char buf[50]; + + (void)strncpy(buf, name, sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; + + /* + * First, figure out what he intends as a field separtor. + * Despite the way this routine is written, the preferred + * form 2-272.AA001234H.01777, i.e. XDE standard. + * Great efforts are made to insure backward compatibility. + */ + if ((hostname = strchr(buf, '#')) != NULL) + separator = '#'; + else { + hostname = strchr(buf, '.'); + if ((cp = strchr(buf, ':')) && + ((hostname && cp < hostname) || (hostname == 0))) { + hostname = cp; + separator = ':'; + } else + separator = '.'; + } + if (hostname) + *hostname++ = 0; + + addr = zero_addr; + Field(buf, addr.x_net.c_net, 4); + if (hostname == 0) + return (addr); /* No separator means net only */ + + socketname = strchr(hostname, separator); + if (socketname) { + *socketname++ = 0; + Field(socketname, (u_char *)&addr.x_port, 2); + } + + Field(hostname, addr.x_host.c_host, 6); + + return (addr); +} + +static void +Field(buf, out, len) + char *buf; + u_char *out; + int len; +{ + char *bp = buf; + int i, ibase, base16 = 0, base10 = 0, clen = 0; + int hb[6], *hp; + + /* + * first try 2-273#2-852-151-014#socket + */ + if ((*buf != '-') && + (1 < (i = sscanf(buf, "%d-%d-%d-%d-%d", + &hb[0], &hb[1], &hb[2], &hb[3], &hb[4])))) { + cvtbase(1000L, 256, hb, i, out, len); + return; + } + /* + * try form 8E1#0.0.AA.0.5E.E6#socket + */ + if (1 < (i = sscanf(buf,"%x.%x.%x.%x.%x.%x", + &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) { + cvtbase(256L, 256, hb, i, out, len); + return; + } + /* + * try form 8E1#0:0:AA:0:5E:E6#socket + */ + if (1 < (i = sscanf(buf,"%x:%x:%x:%x:%x:%x", + &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) { + cvtbase(256L, 256, hb, i, out, len); + return; + } + /* + * This is REALLY stretching it but there was a + * comma notation separting shorts -- definitely non standard + */ + if (1 < (i = sscanf(buf,"%x,%x,%x", + &hb[0], &hb[1], &hb[2]))) { + hb[0] = htons(hb[0]); hb[1] = htons(hb[1]); + hb[2] = htons(hb[2]); + cvtbase(65536L, 256, hb, i, out, len); + return; + } + + /* Need to decide if base 10, 16 or 8 */ + while (*bp) switch (*bp++) { + + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '-': + break; + + case '8': case '9': + base10 = 1; + break; + + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + base16 = 1; + break; + + case 'x': case 'X': + *--bp = '0'; + base16 = 1; + break; + + case 'h': case 'H': + base16 = 1; + /* fall into */ + + default: + *--bp = 0; /* Ends Loop */ + } + if (base16) { + ibase = 4096; + } else if (base10 == 0 && *buf == '0') { + ibase = 512; + } else { + base10 = 1; + ibase = 1000; + } + + for (bp = buf; *bp++; ) clen++; + if (clen == 0) clen++; + if (clen > 18) clen = 18; + i = ((clen - 1) / 3) + 1; + bp = clen + buf - 3; + hp = hb + i - 1; + + while (hp > hb) { + if (base16) + (void)sscanf(bp, "%3x", hp); + else if (base10) + (void)sscanf(bp, "%3d", hp); + else + (void)sscanf(bp, "%3o", hp); + + bp[0] = 0; + hp--; + bp -= 3; + } + if (base16) + (void)sscanf(buf, "%3x", hp); + else if (base10) + (void)sscanf(buf, "%3d", hp); + else + (void)sscanf(buf, "%3o", hp); + + cvtbase((long)ibase, 256, hb, i, out, len); +} + +static void +cvtbase(oldbase,newbase,input,inlen,result,reslen) + long oldbase; + int newbase; + int input[]; + int inlen; + unsigned char result[]; + int reslen; +{ + int d, e; + long sum; + + e = 1; + while (e > 0 && reslen > 0) { + d = 0; e = 0; sum = 0; + /* long division: input=input/newbase */ + while (d < inlen) { + sum = sum*oldbase + (long) input[d]; + e += (sum > 0); + input[d++] = sum / newbase; + sum %= newbase; + } + result[--reslen] = sum; /* accumulate remainder */ + } + for (d=0; d < reslen; d++) + result[d] = 0; +} diff --git a/newlib/libc/sys/linux/net/ns_name.c b/newlib/libc/sys/linux/net/ns_name.c new file mode 100644 index 000000000..609df14f5 --- /dev/null +++ b/newlib/libc/sys/linux/net/ns_name.c @@ -0,0 +1,592 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include + +#include + +#include +#include + +#include +#include +#include + +/* Data. */ + +static char digits[] = "0123456789"; + +/* Forward. */ + +static int special(int); +static int printable(int); +static int dn_find(const u_char *, const u_char *, + const u_char * const *, + const u_char * const *); + +/* Public. */ + +/* + * ns_name_ntop(src, dst, dstsiz) + * Convert an encoded domain name to printable ascii as per RFC1035. + * return: + * Number of bytes written to buffer, or -1 (with errno set) + * notes: + * The root is returned as "." + * All other domains are returned in non absolute form + */ +int +ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) { + const u_char *cp; + char *dn, *eom; + u_char c; + u_int n; + + cp = src; + dn = dst; + eom = dst + dstsiz; + + while ((n = *cp++) != 0) { + if ((n & NS_CMPRSFLGS) != 0) { + /* Some kind of compression pointer. */ + errno = EMSGSIZE; + return (-1); + } + if (dn != dst) { + if (dn >= eom) { + errno = EMSGSIZE; + return (-1); + } + *dn++ = '.'; + } + if (dn + n >= eom) { + errno = EMSGSIZE; + return (-1); + } + for ((void)NULL; n > 0; n--) { + c = *cp++; + if (special(c)) { + if (dn + 1 >= eom) { + errno = EMSGSIZE; + return (-1); + } + *dn++ = '\\'; + *dn++ = (char)c; + } else if (!printable(c)) { + if (dn + 3 >= eom) { + errno = EMSGSIZE; + return (-1); + } + *dn++ = '\\'; + *dn++ = digits[c / 100]; + *dn++ = digits[(c % 100) / 10]; + *dn++ = digits[c % 10]; + } else { + if (dn >= eom) { + errno = EMSGSIZE; + return (-1); + } + *dn++ = (char)c; + } + } + } + if (dn == dst) { + if (dn >= eom) { + errno = EMSGSIZE; + return (-1); + } + *dn++ = '.'; + } + if (dn >= eom) { + errno = EMSGSIZE; + return (-1); + } + *dn++ = '\0'; + return (dn - dst); +} + +/* + * ns_name_pton(src, dst, dstsiz) + * Convert a ascii string into an encoded domain name as per RFC1035. + * return: + * -1 if it fails + * 1 if string was fully qualified + * 0 is string was not fully qualified + * notes: + * Enforces label and domain length limits. + */ + +int +ns_name_pton(const char *src, u_char *dst, size_t dstsiz) { + u_char *label, *bp, *eom; + int c, n, escaped; + char *cp; + + escaped = 0; + bp = dst; + eom = dst + dstsiz; + label = bp++; + + while ((c = *src++) != 0) { + if (escaped) { + if ((cp = strchr(digits, c)) != NULL) { + n = (cp - digits) * 100; + if ((c = *src++) == 0 || + (cp = strchr(digits, c)) == NULL) { + errno = EMSGSIZE; + return (-1); + } + n += (cp - digits) * 10; + if ((c = *src++) == 0 || + (cp = strchr(digits, c)) == NULL) { + errno = EMSGSIZE; + return (-1); + } + n += (cp - digits); + if (n > 255) { + errno = EMSGSIZE; + return (-1); + } + c = n; + } + escaped = 0; + } else if (c == '\\') { + escaped = 1; + continue; + } else if (c == '.') { + c = (bp - label - 1); + if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */ + errno = EMSGSIZE; + return (-1); + } + if (label >= eom) { + errno = EMSGSIZE; + return (-1); + } + *label = c; + /* Fully qualified ? */ + if (*src == '\0') { + if (c != 0) { + if (bp >= eom) { + errno = EMSGSIZE; + return (-1); + } + *bp++ = '\0'; + } + if ((bp - dst) > MAXCDNAME) { + errno = EMSGSIZE; + return (-1); + } + return (1); + } + if (c == 0) { + errno = EMSGSIZE; + return (-1); + } + label = bp++; + continue; + } + if (bp >= eom) { + errno = EMSGSIZE; + return (-1); + } + *bp++ = (u_char)c; + } + c = (bp - label - 1); + if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */ + errno = EMSGSIZE; + return (-1); + } + if (label >= eom) { + errno = EMSGSIZE; + return (-1); + } + *label = c; + if (c != 0) { + if (bp >= eom) { + errno = EMSGSIZE; + return (-1); + } + *bp++ = 0; + } + if ((bp - dst) > MAXCDNAME) { /* src too big */ + errno = EMSGSIZE; + return (-1); + } + return (0); +} + +/* + * ns_name_unpack(msg, eom, src, dst, dstsiz) + * Unpack a domain name from a message, source may be compressed. + * return: + * -1 if it fails, or consumed octets if it succeeds. + */ +int +ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src, + u_char *dst, size_t dstsiz) +{ + const u_char *srcp, *dstlim; + u_char *dstp; + int n, len, checked; + + len = -1; + checked = 0; + dstp = dst; + srcp = src; + dstlim = dst + dstsiz; + if (srcp < msg || srcp >= eom) { + errno = EMSGSIZE; + return (-1); + } + /* Fetch next label in domain name. */ + while ((n = *srcp++) != 0) { + /* Check for indirection. */ + switch (n & NS_CMPRSFLGS) { + case 0: + /* Limit checks. */ + if (dstp + n + 1 >= dstlim || srcp + n >= eom) { + errno = EMSGSIZE; + return (-1); + } + checked += n + 1; + *dstp++ = n; + memcpy(dstp, srcp, n); + dstp += n; + srcp += n; + break; + + case NS_CMPRSFLGS: + if (srcp >= eom) { + errno = EMSGSIZE; + return (-1); + } + if (len < 0) + len = srcp - src + 1; + srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff)); + if (srcp < msg || srcp >= eom) { /* Out of range. */ + errno = EMSGSIZE; + return (-1); + } + checked += 2; + /* + * Check for loops in the compressed name; + * if we've looked at the whole message, + * there must be a loop. + */ + if (checked >= eom - msg) { + errno = EMSGSIZE; + return (-1); + } + break; + + default: + errno = EMSGSIZE; + return (-1); /* flag error */ + } + } + *dstp = '\0'; + if (len < 0) + len = srcp - src; + return (len); +} + +/* + * ns_name_pack(src, dst, dstsiz, dnptrs, lastdnptr) + * Pack domain name 'domain' into 'comp_dn'. + * return: + * Size of the compressed name, or -1. + * notes: + * 'dnptrs' is an array of pointers to previous compressed names. + * dnptrs[0] is a pointer to the beginning of the message. The array + * ends with NULL. + * 'lastdnptr' is a pointer to the end of the array pointed to + * by 'dnptrs'. + * Side effects: + * The list of pointers in dnptrs is updated for labels inserted into + * the message as we compress the name. If 'dnptr' is NULL, we don't + * try to compress names. If 'lastdnptr' is NULL, we don't update the + * list. + */ +int +ns_name_pack(const u_char *src, u_char *dst, int dstsiz, + const u_char **dnptrs, const u_char **lastdnptr) +{ + u_char *dstp; + const u_char **cpp, **lpp, *eob, *msg; + const u_char *srcp; + int n, l; + + srcp = src; + dstp = dst; + eob = dstp + dstsiz; + lpp = cpp = NULL; + if (dnptrs != NULL) { + if ((msg = *dnptrs++) != NULL) { + for (cpp = dnptrs; *cpp != NULL; cpp++) + (void)NULL; + lpp = cpp; /* end of list to search */ + } + } else + msg = NULL; + + /* make sure the domain we are about to add is legal */ + l = 0; + do { + n = *srcp; + if ((n & NS_CMPRSFLGS) != 0) { + errno = EMSGSIZE; + return (-1); + } + l += n + 1; + if (l > MAXCDNAME) { + errno = EMSGSIZE; + return (-1); + } + srcp += n + 1; + } while (n != 0); + + srcp = src; + do { + /* Look to see if we can use pointers. */ + n = *srcp; + if (n != 0 && msg != NULL) { + l = dn_find(srcp, msg, (const u_char * const *)dnptrs, + (const u_char * const *)lpp); + if (l >= 0) { + if (dstp + 1 >= eob) { + errno = EMSGSIZE; + return (-1); + } + *dstp++ = (l >> 8) | NS_CMPRSFLGS; + *dstp++ = l % 256; + return (dstp - dst); + } + /* Not found, save it. */ + if (lastdnptr != NULL && cpp < lastdnptr - 1 && + (dstp - msg) < 0x4000) { + *cpp++ = dstp; + *cpp = NULL; + } + } + /* copy label to buffer */ + if (n & NS_CMPRSFLGS) { /* Should not happen. */ + errno = EMSGSIZE; + return (-1); + } + if (dstp + 1 + n >= eob) { + errno = EMSGSIZE; + return (-1); + } + memcpy(dstp, srcp, n + 1); + srcp += n + 1; + dstp += n + 1; + } while (n != 0); + + if (dstp > eob) { + if (msg != NULL) + *lpp = NULL; + errno = EMSGSIZE; + return (-1); + } + return (dstp - dst); +} + +/* + * ns_name_uncompress(msg, eom, src, dst, dstsiz) + * Expand compressed domain name to presentation format. + * return: + * Number of bytes read out of `src', or -1 (with errno set). + * note: + * Root domain returns as "." not "". + */ +int +ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src, + char *dst, size_t dstsiz) +{ + u_char tmp[NS_MAXCDNAME]; + int n; + + if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1) + return (-1); + if (ns_name_ntop(tmp, dst, dstsiz) == -1) + return (-1); + return (n); +} + +/* + * ns_name_compress(src, dst, dstsiz, dnptrs, lastdnptr) + * Compress a domain name into wire format, using compression pointers. + * return: + * Number of bytes consumed in `dst' or -1 (with errno set). + * notes: + * 'dnptrs' is an array of pointers to previous compressed names. + * dnptrs[0] is a pointer to the beginning of the message. + * The list ends with NULL. 'lastdnptr' is a pointer to the end of the + * array pointed to by 'dnptrs'. Side effect is to update the list of + * pointers for labels inserted into the message as we compress the name. + * If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr' + * is NULL, we don't update the list. + */ +int +ns_name_compress(const char *src, u_char *dst, size_t dstsiz, + const u_char **dnptrs, const u_char **lastdnptr) +{ + u_char tmp[NS_MAXCDNAME]; + + if (ns_name_pton(src, tmp, sizeof tmp) == -1) + return (-1); + return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr)); +} + +/* + * ns_name_skip(ptrptr, eom) + * Advance *ptrptr to skip over the compressed name it points at. + * return: + * 0 on success, -1 (with errno set) on failure. + */ +int +ns_name_skip(const u_char **ptrptr, const u_char *eom) { + const u_char *cp; + u_int n; + + cp = *ptrptr; + while (cp < eom && (n = *cp++) != 0) { + /* Check for indirection. */ + switch (n & NS_CMPRSFLGS) { + case 0: /* normal case, n == len */ + cp += n; + continue; + case NS_CMPRSFLGS: /* indirection */ + cp++; + break; + default: /* illegal type */ + errno = EMSGSIZE; + return (-1); + } + break; + } + if (cp > eom) { + errno = EMSGSIZE; + return (-1); + } + *ptrptr = cp; + return (0); +} + +/* Private. */ + +/* + * special(ch) + * Thinking in noninternationalized USASCII (per the DNS spec), + * is this characted special ("in need of quoting") ? + * return: + * boolean. + */ +static int +special(int ch) { + switch (ch) { + case 0x22: /* '"' */ + case 0x2E: /* '.' */ + case 0x3B: /* ';' */ + case 0x5C: /* '\\' */ + /* Special modifiers in zone files. */ + case 0x40: /* '@' */ + case 0x24: /* '$' */ + return (1); + default: + return (0); + } +} + +/* + * printable(ch) + * Thinking in noninternationalized USASCII (per the DNS spec), + * is this character visible and not a space when printed ? + * return: + * boolean. + */ +static int +printable(int ch) { + return (ch > 0x20 && ch < 0x7f); +} + +/* + * Thinking in noninternationalized USASCII (per the DNS spec), + * convert this character to lower case if it's upper case. + */ +static int +mklower(int ch) { + if (ch >= 0x41 && ch <= 0x5A) + return (ch + 0x20); + return (ch); +} + +/* + * dn_find(domain, msg, dnptrs, lastdnptr) + * Search for the counted-label name in an array of compressed names. + * return: + * offset from msg if found, or -1. + * notes: + * dnptrs is the pointer to the first name on the list, + * not the pointer to the start of the message. + */ +static int +dn_find(const u_char *domain, const u_char *msg, + const u_char * const *dnptrs, + const u_char * const *lastdnptr) +{ + const u_char *dn, *cp, *sp; + const u_char * const *cpp; + u_int n; + + for (cpp = dnptrs; cpp < lastdnptr; cpp++) { + dn = domain; + sp = cp = *cpp; + while ((n = *cp++) != 0) { + /* + * check for indirection + */ + switch (n & NS_CMPRSFLGS) { + case 0: /* normal case, n == len */ + if (n != *dn++) + goto next; + for ((void)NULL; n > 0; n--) + if (mklower(*dn++) != mklower(*cp++)) + goto next; + /* Is next root for both ? */ + if (*dn == '\0' && *cp == '\0') + return (sp - msg); + if (*dn) + continue; + goto next; + + case NS_CMPRSFLGS: /* indirection */ + cp = msg + (((n & 0x3f) << 8) | *cp); + break; + + default: /* illegal type */ + errno = EMSGSIZE; + return (-1); + } + } + next: ; + } + errno = ENOENT; + return (-1); +} diff --git a/newlib/libc/sys/linux/net/ns_netint.c b/newlib/libc/sys/linux/net/ns_netint.c new file mode 100644 index 000000000..18c9cccd6 --- /dev/null +++ b/newlib/libc/sys/linux/net/ns_netint.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include + +/* Import. */ + +#include +#include + +#include +#include + +u_int +ns_get16(const u_char *src) { + u_int dst; + + NS_GET16(dst, src); + return (dst); +} + +u_long +ns_get32(const u_char *src) { + u_long dst; + + NS_GET32(dst, src); + return (dst); +} + +void +ns_put16(u_int src, u_char *dst) { + NS_PUT16(src, dst); +} + +void +ns_put32(u_long src, u_char *dst) { + NS_PUT32(src, dst); +} diff --git a/newlib/libc/sys/linux/net/ns_ntoa.c b/newlib/libc/sys/linux/net/ns_ntoa.c new file mode 100644 index 000000000..018076064 --- /dev/null +++ b/newlib/libc/sys/linux/net/ns_ntoa.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)ns_ntoa.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include + +#include +#include +#include +#include + +char * +ns_ntoa(addr) + struct ns_addr addr; +{ + static char obuf[40]; + union { union ns_net net_e; u_long long_e; } net; + u_short port = htons(addr.x_port); + char *cp; + char *cp2; + u_char *up = addr.x_host.c_host; + u_char *uplim = up + 6; + static char *spectHex(); + + net.net_e = addr.x_net; + sprintf(obuf, "%lx", (u_long)ntohl(net.long_e)); + cp = spectHex(obuf); + cp2 = cp + 1; + while (*up==0 && up < uplim) up++; + if (up == uplim) { + if (port) { + sprintf(cp, ".0"); + cp += 2; + } + } else { + sprintf(cp, ".%x", *up++); + while (up < uplim) { + while (*cp) cp++; + sprintf(cp, "%02x", *up++); + } + cp = spectHex(cp2); + } + if (port) { + sprintf(cp, ".%x", port); + spectHex(cp + 1); + } + return (obuf); +} + +static char * +spectHex(p0) + char *p0; +{ + int ok = 0; + int nonzero = 0; + char *p = p0; + for (; *p; p++) switch (*p) { + + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + *p += ('A' - 'a'); + /* fall into . . . */ + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + ok = 1; + case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + nonzero = 1; + } + if (nonzero && !ok) { *p++ = 'H'; *p = 0; } + return (p); +} diff --git a/newlib/libc/sys/linux/net/ns_parse.c b/newlib/libc/sys/linux/net/ns_parse.c new file mode 100644 index 000000000..38a684b87 --- /dev/null +++ b/newlib/libc/sys/linux/net/ns_parse.c @@ -0,0 +1,189 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include + +#include + +#include +#include + +#include +#include +#include + +/* These need to be in the same order as the nres.h:ns_flag enum. */ +struct _ns_flagdata _ns_flagdata[16] = { + { 0x8000, 15 }, /* qr. */ + { 0x7800, 11 }, /* opcode. */ + { 0x0400, 10 }, /* aa. */ + { 0x0200, 9 }, /* tc. */ + { 0x0100, 8 }, /* rd. */ + { 0x0080, 7 }, /* ra. */ + { 0x0040, 6 }, /* z. */ + { 0x0020, 5 }, /* ad. */ + { 0x0010, 4 }, /* cd. */ + { 0x000f, 0 }, /* rcode. */ + { 0x0000, 0 }, /* expansion (1/6). */ + { 0x0000, 0 }, /* expansion (2/6). */ + { 0x0000, 0 }, /* expansion (3/6). */ + { 0x0000, 0 }, /* expansion (4/6). */ + { 0x0000, 0 }, /* expansion (5/6). */ + { 0x0000, 0 }, /* expansion (6/6). */ +}; + +static int +skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) { + const u_char *optr = ptr; + + for ((void)NULL; count > 0; count--) { + int b, rdlength; + + b = dn_skipname(ptr, eom); + if (b < 0) + goto emsgsize; + ptr += b/*Name*/ + NS_INT16SZ/*Type*/ + NS_INT16SZ/*Class*/; + if (section != ns_s_qd) { + if (ptr + NS_INT32SZ > eom) + goto emsgsize; + ptr += NS_INT32SZ/*TTL*/; + if (ptr + NS_INT16SZ > eom) + goto emsgsize; + NS_GET16(rdlength, ptr); + ptr += rdlength/*RData*/; + } + } + if (ptr > eom) + goto emsgsize; + return (ptr - optr); + emsgsize: + errno = EMSGSIZE; + return (-1); +} + +int +ns_initparse(const u_char *msg, int msglen, ns_msg *handle) { + const u_char *eom = msg + msglen; + int i; + + memset(handle, 0x5e, sizeof *handle); + handle->_msg = msg; + handle->_eom = eom; + if (msg + NS_INT16SZ > eom) + goto emsgsize; + NS_GET16(handle->_id, msg); + if (msg + NS_INT16SZ > eom) + goto emsgsize; + NS_GET16(handle->_flags, msg); + for (i = 0; i < ns_s_max; i++) { + if (msg + NS_INT16SZ > eom) + goto emsgsize; + NS_GET16(handle->_counts[i], msg); + } + for (i = 0; i < ns_s_max; i++) + if (handle->_counts[i] == 0) + handle->_sections[i] = NULL; + else { + int b = skiprr(msg, eom, (ns_sect)i, + handle->_counts[i]); + + if (b < 0) + return (-1); + handle->_sections[i] = msg; + msg += b; + } + if (msg != eom) + goto emsgsize; + handle->_sect = ns_s_max; + handle->_rrnum = -1; + handle->_ptr = NULL; + return (0); + emsgsize: + errno = EMSGSIZE; + return (-1); +} + +int +ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) { + int b; + + /* Make section right. */ + if (section < 0 || section >= ns_s_max) + goto enodev; + if ((int)section != (int)handle->_sect) { + handle->_sect = section; + handle->_rrnum = 0; + handle->_ptr = handle->_sections[(int)section]; + } + + /* Make rrnum right. */ + if (rrnum == -1) + rrnum = handle->_rrnum; + if (rrnum < 0 || rrnum >= handle->_counts[(int)section]) + goto enodev; + if (rrnum < handle->_rrnum) { + handle->_rrnum = 0; + handle->_ptr = handle->_sections[(int)section]; + } + + b = skiprr(handle->_msg, handle->_eom, section, + rrnum - handle->_rrnum); + if (b < 0) + return (-1); + handle->_ptr += b; + handle->_rrnum = rrnum; + + /* Do the parse. */ + b = dn_expand(handle->_msg, handle->_eom, + handle->_ptr, rr->name, NS_MAXDNAME); + if (b < 0) + return (-1); + handle->_ptr += b; + if (handle->_ptr + NS_INT16SZ > handle->_eom) + goto emsgsize; + NS_GET16(rr->type, handle->_ptr); + if (handle->_ptr + NS_INT16SZ > handle->_eom) + goto emsgsize; + NS_GET16(rr->rr_class, handle->_ptr); + if (section == ns_s_qd) { + rr->ttl = 0; + rr->rdlength = 0; + rr->rdata = NULL; + } else { + if (handle->_ptr + NS_INT32SZ > handle->_eom) + goto emsgsize; + NS_GET32(rr->ttl, handle->_ptr); + if (handle->_ptr + NS_INT16SZ > handle->_eom) + goto emsgsize; + NS_GET16(rr->rdlength, handle->_ptr); + if (handle->_ptr + rr->rdlength > handle->_eom) + goto emsgsize; + rr->rdata = handle->_ptr; + handle->_ptr += rr->rdlength; + } + handle->_rrnum++; + + /* All done. */ + return (0); + enodev: + errno = ENODEV; + return (-1); + emsgsize: + errno = EMSGSIZE; + return (-1); +} diff --git a/newlib/libc/sys/linux/net/ns_print.c b/newlib/libc/sys/linux/net/ns_print.c new file mode 100644 index 000000000..7cce6d7aa --- /dev/null +++ b/newlib/libc/sys/linux/net/ns_print.c @@ -0,0 +1,744 @@ +/* + * Copyright (c) 1996, 1998 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + +#include +#include + +/* Import. */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#define SPRINTF(x) ((size_t)sprintf x) + +/* Forward. */ + +static size_t prune_origin(const char *name, const char *origin); +static int charstr(const u_char *rdata, const u_char *edata, + char **buf, size_t *buflen); +static int addname(const u_char *msg, size_t msglen, + const u_char **p, const char *origin, + char **buf, size_t *buflen); +static void addlen(size_t len, char **buf, size_t *buflen); +static int addstr(const char *src, size_t len, + char **buf, size_t *buflen); +static int addtab(size_t len, size_t target, int spaced, + char **buf, size_t *buflen); + +/* Macros. */ + +#define T(x) \ + do { \ + if ((x) < 0) \ + return (-1); \ + } while (0) + +/* Public. */ + +/* + * int + * ns_sprintrr(handle, rr, name_ctx, origin, buf, buflen) + * Convert an RR to presentation format. + * return: + * Number of characters written to buf, or -1 (check errno). + */ +int +ns_sprintrr(const ns_msg *handle, const ns_rr *rr, + const char *name_ctx, const char *origin, + char *buf, size_t buflen) +{ + int n; + + n = ns_sprintrrf(ns_msg_base(*handle), ns_msg_size(*handle), + ns_rr_name(*rr), ns_rr_class(*rr), ns_rr_type(*rr), + ns_rr_ttl(*rr), ns_rr_rdata(*rr), ns_rr_rdlen(*rr), + name_ctx, origin, buf, buflen); + return (n); +} + +/* + * int + * ns_sprintrrf(msg, msglen, name, class, type, ttl, rdata, rdlen, + * name_ctx, origin, buf, buflen) + * Convert the fields of an RR into presentation format. + * return: + * Number of characters written to buf, or -1 (check errno). + */ +int +ns_sprintrrf(const u_char *msg, size_t msglen, + const char *name, ns_class class, ns_type type, + u_long ttl, const u_char *rdata, size_t rdlen, + const char *name_ctx, const char *origin, + char *buf, size_t buflen) +{ + const char *obuf = buf; + const u_char *edata = rdata + rdlen; + int spaced = 0; + + const char *comment; + char tmp[100]; + int len, x; + + /* + * Owner. + */ + if (name_ctx != NULL && strcasecmp(name_ctx, name) == 0) { + T(addstr("\t\t\t", 3, &buf, &buflen)); + } else { + len = prune_origin(name, origin); + if (len == 0) { + T(addstr("@\t\t\t", 4, &buf, &buflen)); + } else { + T(addstr(name, len, &buf, &buflen)); + /* Origin not used and no trailing dot? */ + if ((!origin || !origin[0] || name[len] == '\0') && + name[len - 1] != '.') { + T(addstr(".", 1, &buf, &buflen)); + len++; + } + T(spaced = addtab(len, 24, spaced, &buf, &buflen)); + } + } + + /* + * TTL, Class, Type. + */ + T(x = ns_format_ttl(ttl, buf, buflen)); + addlen(x, &buf, &buflen); + len = SPRINTF((tmp, " %s %s", p_class(class), p_type(type))); + T(addstr(tmp, len, &buf, &buflen)); + T(spaced = addtab(x + len, 16, spaced, &buf, &buflen)); + + /* + * RData. + */ + switch (type) { + case ns_t_a: + if (rdlen != NS_INADDRSZ) + goto formerr; + (void) inet_ntop(AF_INET, rdata, buf, buflen); + addlen(strlen(buf), &buf, &buflen); + break; + + case ns_t_cname: + case ns_t_mb: + case ns_t_mg: + case ns_t_mr: + case ns_t_ns: + case ns_t_ptr: + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + break; + + case ns_t_hinfo: + case ns_t_isdn: + /* First word. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + T(addstr(" ", 1, &buf, &buflen)); + + /* Second word. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + break; + + case ns_t_soa: { + u_long t; + + /* Server name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" ", 1, &buf, &buflen)); + + /* Administrator name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" (\n", 3, &buf, &buflen)); + spaced = 0; + + if ((edata - rdata) != 5*NS_INT32SZ) + goto formerr; + + /* Serial number. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + len = SPRINTF((tmp, "%lu", t)); + T(addstr(tmp, len, &buf, &buflen)); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; serial\n", 9, &buf, &buflen)); + spaced = 0; + + /* Refresh interval. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + T(len = ns_format_ttl(t, buf, buflen)); + addlen(len, &buf, &buflen); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; refresh\n", 10, &buf, &buflen)); + spaced = 0; + + /* Retry interval. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + T(len = ns_format_ttl(t, buf, buflen)); + addlen(len, &buf, &buflen); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; retry\n", 8, &buf, &buflen)); + spaced = 0; + + /* Expiry. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + T(len = ns_format_ttl(t, buf, buflen)); + addlen(len, &buf, &buflen); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; expiry\n", 9, &buf, &buflen)); + spaced = 0; + + /* Minimum TTL. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + T(len = ns_format_ttl(t, buf, buflen)); + addlen(len, &buf, &buflen); + T(addstr(" )", 2, &buf, &buflen)); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; minimum\n", 10, &buf, &buflen)); + + break; + } + + case ns_t_mx: + case ns_t_afsdb: + case ns_t_rt: { + u_int t; + + if (rdlen < NS_INT16SZ) + goto formerr; + + /* Priority. */ + t = ns_get16(rdata); + rdata += NS_INT16SZ; + len = SPRINTF((tmp, "%u ", t)); + T(addstr(tmp, len, &buf, &buflen)); + + /* Target. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + break; + } + + case ns_t_px: { + u_int t; + + if (rdlen < NS_INT16SZ) + goto formerr; + + /* Priority. */ + t = ns_get16(rdata); + rdata += NS_INT16SZ; + len = SPRINTF((tmp, "%u ", t)); + T(addstr(tmp, len, &buf, &buflen)); + + /* Name1. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" ", 1, &buf, &buflen)); + + /* Name2. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + break; + } + + case ns_t_x25: + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + break; + + case ns_t_txt: + while (rdata < edata) { + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + if (rdata < edata) + T(addstr(" ", 1, &buf, &buflen)); + } + break; + + case ns_t_nsap: { + char t[255*3]; + + (void) inet_nsap_ntoa(rdlen, rdata, t); + T(addstr(t, strlen(t), &buf, &buflen)); + break; + } + + case ns_t_aaaa: + if (rdlen != NS_IN6ADDRSZ) + goto formerr; + (void) inet_ntop(AF_INET6, rdata, buf, buflen); + addlen(strlen(buf), &buf, &buflen); + break; + + case ns_t_loc: { + char t[255]; + + /* XXX protocol format checking? */ + (void) loc_ntoa(rdata, t); + T(addstr(t, strlen(t), &buf, &buflen)); + break; + } + + case ns_t_naptr: { + u_int order, preference; + char t[50]; + + if (rdlen < 2*NS_INT16SZ) + goto formerr; + + /* Order, Precedence. */ + order = ns_get16(rdata); rdata += NS_INT16SZ; + preference = ns_get16(rdata); rdata += NS_INT16SZ; + len = SPRINTF((t, "%u %u ", order, preference)); + T(addstr(t, len, &buf, &buflen)); + + /* Flags. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + T(addstr(" ", 1, &buf, &buflen)); + + /* Service. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + T(addstr(" ", 1, &buf, &buflen)); + + /* Regexp. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len < 0) + return (-1); + if (len == 0) + goto formerr; + rdata += len; + T(addstr(" ", 1, &buf, &buflen)); + + /* Server. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + break; + } + + case ns_t_srv: { + u_int priority, weight, port; + char t[50]; + + if (rdlen < NS_INT16SZ*3) + goto formerr; + + /* Priority, Weight, Port. */ + priority = ns_get16(rdata); rdata += NS_INT16SZ; + weight = ns_get16(rdata); rdata += NS_INT16SZ; + port = ns_get16(rdata); rdata += NS_INT16SZ; + len = SPRINTF((t, "%u %u %u ", priority, weight, port)); + T(addstr(t, len, &buf, &buflen)); + + /* Server. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + break; + } + + case ns_t_minfo: + case ns_t_rp: + /* Name1. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" ", 1, &buf, &buflen)); + + /* Name2. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + break; + + case ns_t_wks: { + int n, lcnt; + + if (rdlen < NS_INT32SZ + 1) + goto formerr; + + /* Address. */ + (void) inet_ntop(AF_INET, rdata, buf, buflen); + addlen(strlen(buf), &buf, &buflen); + rdata += NS_INADDRSZ; + + /* Protocol. */ + len = SPRINTF((tmp, " %u ( ", *rdata)); + T(addstr(tmp, len, &buf, &buflen)); + rdata += NS_INT8SZ; + + /* Bit map. */ + n = 0; + lcnt = 0; + while (rdata < edata) { + u_int c = *rdata++; + do { + if (c & 0200) { + if (lcnt == 0) { + T(addstr("\n\t\t\t\t", 5, + &buf, &buflen)); + lcnt = 10; + spaced = 0; + } + len = SPRINTF((tmp, "%d ", n)); + T(addstr(tmp, len, &buf, &buflen)); + lcnt--; + } + c <<= 1; + } while (++n & 07); + } + T(addstr(")", 1, &buf, &buflen)); + + break; + } + + case ns_t_key: { + char base64_key[NS_MD5RSA_MAX_BASE64]; + u_int keyflags, protocol, algorithm; + const char *leader; + int n; + + if (rdlen < NS_INT16SZ + NS_INT8SZ + NS_INT8SZ) + goto formerr; + + /* Key flags, Protocol, Algorithm. */ + keyflags = ns_get16(rdata); rdata += NS_INT16SZ; + protocol = *rdata++; + algorithm = *rdata++; + len = SPRINTF((tmp, "0x%04x %u %u", + keyflags, protocol, algorithm)); + T(addstr(tmp, len, &buf, &buflen)); + + /* Public key data. */ + len = b64_ntop(rdata, edata - rdata, + base64_key, sizeof base64_key); + if (len < 0) + goto formerr; + if (len > 15) { + T(addstr(" (", 2, &buf, &buflen)); + leader = "\n\t\t"; + spaced = 0; + } else + leader = " "; + for (n = 0; n < len; n += 48) { + T(addstr(leader, strlen(leader), &buf, &buflen)); + T(addstr(base64_key + n, MIN(len - n, 48), + &buf, &buflen)); + } + if (len > 15) + T(addstr(" )", 2, &buf, &buflen)); + + break; + } + + case ns_t_sig: { + char base64_key[NS_MD5RSA_MAX_BASE64]; + u_int type, algorithm, labels, footprint; + const char *leader; + u_long t; + int n; + + if (rdlen < 22) + goto formerr; + + /* Type covered, Algorithm, Label count, Original TTL. */ + type = ns_get16(rdata); rdata += NS_INT16SZ; + algorithm = *rdata++; + labels = *rdata++; + t = ns_get32(rdata); rdata += NS_INT32SZ; + len = SPRINTF((tmp, " %s %d %lu ", + p_type(type), algorithm, t)); + T(addstr(tmp, len, &buf, &buflen)); + if (labels != (u_int)dn_count_labels(name)) + goto formerr; + + /* Signature expiry. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + len = SPRINTF((tmp, "%s ", p_secstodate(t))); + T(addstr(tmp, len, &buf, &buflen)); + + /* Time signed. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + len = SPRINTF((tmp, "%s ", p_secstodate(t))); + T(addstr(tmp, len, &buf, &buflen)); + + /* Signature Footprint. */ + footprint = ns_get16(rdata); rdata += NS_INT16SZ; + len = SPRINTF((tmp, "%u ", footprint)); + T(addstr(tmp, len, &buf, &buflen)); + + /* Signer's name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + /* Signature. */ + len = b64_ntop(rdata, edata - rdata, + base64_key, sizeof base64_key); + if (len > 15) { + T(addstr(" (", 2, &buf, &buflen)); + leader = "\n\t\t"; + spaced = 0; + } else + leader = " "; + if (len < 0) + goto formerr; + for (n = 0; n < len; n += 48) { + T(addstr(leader, strlen(leader), &buf, &buflen)); + T(addstr(base64_key + n, MIN(len - n, 48), + &buf, &buflen)); + } + if (len > 15) + T(addstr(" )", 2, &buf, &buflen)); + + break; + } + + case ns_t_nxt: { + int n, c; + + /* Next domain name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + /* Type bit map. */ + n = edata - rdata; + for (c = 0; c < n*8; c++) + if (NS_NXT_BIT_ISSET(c, rdata)) { + len = SPRINTF((tmp, " %s", p_type(c))); + T(addstr(tmp, len, &buf, &buflen)); + } + break; + } + + default: + comment = "unknown RR type"; + goto hexify; + } + return (buf - obuf); + formerr: + comment = "RR format error"; + hexify: { + int n, m; + char *p; + + len = SPRINTF((tmp, "\\#(\t\t; %s", comment)); + T(addstr(tmp, len, &buf, &buflen)); + while (rdata < edata) { + p = tmp; + p += SPRINTF((p, "\n\t")); + spaced = 0; + n = MIN(16, edata - rdata); + for (m = 0; m < n; m++) + p += SPRINTF((p, "%02x ", rdata[m])); + T(addstr(tmp, p - tmp, &buf, &buflen)); + if (n < 16) { + T(addstr(")", 1, &buf, &buflen)); + T(addtab(p - tmp + 1, 48, spaced, &buf, &buflen)); + } + p = tmp; + p += SPRINTF((p, "; ")); + for (m = 0; m < n; m++) + *p++ = (isascii(rdata[m]) && isprint(rdata[m])) + ? rdata[m] + : '.'; + T(addstr(tmp, p - tmp, &buf, &buflen)); + rdata += n; + } + return (buf - obuf); + } +} + +/* Private. */ + +/* + * size_t + * prune_origin(name, origin) + * Find out if the name is at or under the current origin. + * return: + * Number of characters in name before start of origin, + * or length of name if origin does not match. + * notes: + * This function should share code with samedomain(). + */ +static size_t +prune_origin(const char *name, const char *origin) { + const char *oname = name; + + while (*name != '\0') { + if (origin != NULL && strcasecmp(name, origin) == 0) + return (name - oname - (name > oname)); + while (*name != '\0') { + if (*name == '\\') { + name++; + /* XXX need to handle \nnn form. */ + if (*name == '\0') + break; + } else if (*name == '.') { + name++; + break; + } + name++; + } + } + return (name - oname); +} + +/* + * int + * charstr(rdata, edata, buf, buflen) + * Format a into the presentation buffer. + * return: + * Number of rdata octets consumed + * 0 for protocol format error + * -1 for output buffer error + * side effects: + * buffer is advanced on success. + */ +static int +charstr(const u_char *rdata, const u_char *edata, char **buf, size_t *buflen) { + const u_char *odata = rdata; + size_t save_buflen = *buflen; + char *save_buf = *buf; + + if (addstr("\"", 1, buf, buflen) < 0) + goto enospc; + if (rdata < edata) { + int n = *rdata; + + if (rdata + 1 + n <= edata) { + rdata++; + while (n-- > 0) { + if (strchr("\n\"\\", *rdata) != NULL) + if (addstr("\\", 1, buf, buflen) < 0) + goto enospc; + if (addstr((const char *)rdata, 1, + buf, buflen) < 0) + goto enospc; + rdata++; + } + } + } + if (addstr("\"", 1, buf, buflen) < 0) + goto enospc; + return (rdata - odata); + enospc: + errno = ENOSPC; + *buf = save_buf; + *buflen = save_buflen; + return (-1); +} + +static int +addname(const u_char *msg, size_t msglen, + const u_char **pp, const char *origin, + char **buf, size_t *buflen) +{ + size_t newlen, save_buflen = *buflen; + char *save_buf = *buf; + int n; + + n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen); + if (n < 0) + goto enospc; /* Guess. */ + newlen = prune_origin(*buf, origin); + if ((origin == NULL || origin[0] == '\0' || (*buf)[newlen] == '\0') && + (newlen == 0 || (*buf)[newlen - 1] != '.')) { + /* No trailing dot. */ + if (newlen + 2 > *buflen) + goto enospc; /* No room for ".\0". */ + (*buf)[newlen++] = '.'; + (*buf)[newlen] = '\0'; + } + if (newlen == 0) { + /* Use "@" instead of name. */ + if (newlen + 2 > *buflen) + goto enospc; /* No room for "@\0". */ + (*buf)[newlen++] = '@'; + (*buf)[newlen] = '\0'; + } + *pp += n; + addlen(newlen, buf, buflen); + **buf = '\0'; + return (newlen); + enospc: + errno = ENOSPC; + *buf = save_buf; + *buflen = save_buflen; + return (-1); +} + +static void +addlen(size_t len, char **buf, size_t *buflen) { + assert(len <= *buflen); + *buf += len; + *buflen -= len; +} + +static int +addstr(const char *src, size_t len, char **buf, size_t *buflen) { + if (len > *buflen) { + errno = ENOSPC; + return (-1); + } + memcpy(*buf, src, len); + addlen(len, buf, buflen); + **buf = '\0'; + return (0); +} + +static int +addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) { + size_t save_buflen = *buflen; + char *save_buf = *buf; + int t; + + if (spaced || len >= target - 1) { + T(addstr(" ", 2, buf, buflen)); + spaced = 1; + } else { + for (t = (target - len - 1) / 8; t >= 0; t--) + if (addstr("\t", 1, buf, buflen) < 0) { + *buflen = save_buflen; + *buf = save_buf; + return (-1); + } + spaced = 0; + } + return (spaced); +} diff --git a/newlib/libc/sys/linux/net/ns_ttl.c b/newlib/libc/sys/linux/net/ns_ttl.c new file mode 100644 index 000000000..63dbefb59 --- /dev/null +++ b/newlib/libc/sys/linux/net/ns_ttl.c @@ -0,0 +1,150 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include + +/* Import. */ + +#include + +#include +#include +#include +#include + +#define SPRINTF(x) ((size_t)sprintf x) + +/* Forward. */ + +static int fmt1(int t, char s, char **buf, size_t *buflen); + +/* Macros. */ + +#define T(x) if ((x) < 0) return (-1); else (void)NULL + +/* Public. */ + +int +ns_format_ttl(u_long src, char *dst, size_t dstlen) { + char *odst = dst; + int secs, mins, hours, days, weeks, x; + char *p; + + secs = src % 60; src /= 60; + mins = src % 60; src /= 60; + hours = src % 24; src /= 24; + days = src % 7; src /= 7; + weeks = src; src = 0; + + x = 0; + if (weeks) { + T(fmt1(weeks, 'W', &dst, &dstlen)); + x++; + } + if (days) { + T(fmt1(days, 'D', &dst, &dstlen)); + x++; + } + if (hours) { + T(fmt1(hours, 'H', &dst, &dstlen)); + x++; + } + if (mins) { + T(fmt1(mins, 'M', &dst, &dstlen)); + x++; + } + if (secs || !(weeks || days || hours || mins)) { + T(fmt1(secs, 'S', &dst, &dstlen)); + x++; + } + + if (x > 1) { + int ch; + + for (p = odst; (ch = *p) != '\0'; p++) + if (isascii(ch) && isupper(ch)) + *p = tolower(ch); + } + + return (dst - odst); +} + +int +ns_parse_ttl(const char *src, u_long *dst) { + u_long ttl, tmp; + int ch, digits, dirty; + + ttl = 0; + tmp = 0; + digits = 0; + dirty = 0; + while ((ch = *src++) != '\0') { + if (!isascii(ch) || !isprint(ch)) + goto einval; + if (isdigit(ch)) { + tmp *= 10; + tmp += (ch - '0'); + digits++; + continue; + } + if (digits == 0) + goto einval; + if (islower(ch)) + ch = toupper(ch); + switch (ch) { + case 'W': tmp *= 7; + case 'D': tmp *= 24; + case 'H': tmp *= 60; + case 'M': tmp *= 60; + case 'S': break; + default: goto einval; + } + ttl += tmp; + tmp = 0; + digits = 0; + dirty = 1; + } + if (digits > 0) { + if (dirty) + goto einval; + else + ttl += tmp; + } + *dst = ttl; + return (0); + + einval: + errno = EINVAL; + return (-1); +} + +/* Private. */ + +static int +fmt1(int t, char s, char **buf, size_t *buflen) { + char tmp[50]; + size_t len; + + len = SPRINTF((tmp, "%d%c", t, s)); + if (len + 1 > *buflen) + return (-1); + strcpy(*buf, tmp); + *buf += len; + *buflen -= len; + return (0); +} diff --git a/newlib/libc/sys/linux/net/nsap_addr.c b/newlib/libc/sys/linux/net/nsap_addr.c new file mode 100644 index 000000000..b6651488b --- /dev/null +++ b/newlib/libc/sys/linux/net/nsap_addr.c @@ -0,0 +1,113 @@ +/* + * Copyright (c) 1996, 1998 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static char +xtob(c) + int c; +{ + return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); +} + +u_int +inet_nsap_addr(ascii, binary, maxlen) + const char *ascii; + u_char *binary; + int maxlen; +{ + u_char c, nib; + u_int len = 0; + + while ((c = *ascii++) != '\0' && len < (u_int)maxlen) { + if (c == '.' || c == '+' || c == '/') + continue; + if (!isascii(c)) + return (0); + if (islower(c)) + c = toupper(c); + if (isxdigit(c)) { + nib = xtob(c); + c = *ascii++; + if (c != '\0') { + c = toupper(c); + if (isxdigit(c)) { + *binary++ = (nib << 4) | xtob(c); + len++; + } else + return (0); + } + else + return (0); + } + else + return (0); + } + return (len); +} + +char * +inet_nsap_ntoa(binlen, binary, ascii) + int binlen; + const u_char *binary; + char *ascii; +{ + int nib; + int i; + static char tmpbuf[255*3]; + char *start; + + if (ascii) + start = ascii; + else { + ascii = tmpbuf; + start = tmpbuf; + } + + if (binlen > 255) + binlen = 255; + + for (i = 0; i < binlen; i++) { + nib = *binary >> 4; + *ascii++ = nib + (nib < 10 ? '0' : '7'); + nib = *binary++ & 0x0f; + *ascii++ = nib + (nib < 10 ? '0' : '7'); + if (((i % 2) == 0 && (i + 1) < binlen)) + *ascii++ = '.'; + } + *ascii = '\0'; + return (start); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_nsap_addr +__weak_reference(__inet_nsap_addr, inet_nsap_addr); +#undef inet_nsap_ntoa +__weak_reference(__inet_nsap_ntoa, inet_nsap_ntoa); diff --git a/newlib/libc/sys/linux/net/nsdispatch.3 b/newlib/libc/sys/linux/net/nsdispatch.3 new file mode 100644 index 000000000..708f97cba --- /dev/null +++ b/newlib/libc/sys/linux/net/nsdispatch.3 @@ -0,0 +1,231 @@ +.\" $NetBSD: nsdispatch.3,v 1.8 1999/03/22 19:44:53 garbled Exp $ +.\" $FreeBSD: src/lib/libc/net/nsdispatch.3,v 1.5 2001/10/01 16:08:56 ru Exp $ +.\" +.\" Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Luke Mewburn. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd January 19, 1999 +.Dt NSDISPATCH 3 +.Os +.Sh NAME +.Nm nsdispatch +.Nd name-service switch dispatcher routine +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In nsswitch.h +.Ft int +.Fo nsdispatch +.Fa "void *retval" +.Fa "const ns_dtab dtab[]" +.Fa "const char *database" +.Fa "const char *method" +.Fa "const ns_src defaults[]" +.Fa "..." +.Fc +.Sh DESCRIPTION +The +.Fn nsdispatch +function invokes the callback functions specified in +.Va dtab +in the order given in +.Pa /etc/nsswitch.conf +for the database +.Va database +until a successful entry is found. +.Pp +.Va retval +is passed to each callback function to modify as necessary +(to pass back to the caller of +.Fn nsdispatch ) +.Pp +.Va dtab +is an array of +.Va ns_dtab +structures, which have the following format: +.Bd -literal -offset indent +typedef struct { + const char *src; + int (*cb)(void *retval, void *cb_data, va_list ap); + void *cb_data; +} ns_dtab; +.Ed +.Pp +.Bd -ragged -offset indent +For each source type that is implemented, an entry with +.Va src +set to the name of the source, +.Va cb +defined as a function which handles that source, and +.Va cb_data +is used to pass arbritrary data to the callback function. +The last entry in +.Va dtab +should contain +.Dv NULL +values for +.Va src , +.Va cb , +and +.Va cb_data . +.Ed +.Pp +.Va method +is usually the name of the function calling +.Fn nsdispatch . +When dynamic loading is supported, a symbol constructed from +.Va database , +the current source, and +.Va method +will be used as the name to invoke the dynamically loaded function. +.Pp +.Va defaults +contains a list of default sources to try in the case of +a missing or corrupt +.Xr nsswitch.conf 5 , +or if there isn't a relevant entry for +.Va database . +It is an array of +.Va ns_src +structures, which have the following format: +.Bd -literal -offset indent +typedef struct { + const char *src; + u_int32_t flags; +} ns_src; +.Ed +.Pp +.Bd -ragged -offset indent +For each default source type, an entry with +.Va src +set to the name of the source, and +.Va flags +set to the relevant flags +(usually +.Dv NS_SUCCESS ; +refer to +.Sx Callback return values +for more information). +The last entry in +.Va defaults +should have +.Va src +set to +.Dv NULL +and +.Va flags +set to 0. +.Pp +For convenience, a global variable defined as: +.Dl extern const ns_src __nsdefaultsrc[]; +exists which contains a single default entry for +.Sq files +for use by callers which don't require complicated default rules. +.Ed +.Pp +.Sq Va ... +are optional extra arguments, which +are passed to the appropriate callback function as a variable argument +list of the type +.Va va_list . +.Ss Valid source types +Whilst there is support for arbitrary sources, the following +#defines for commonly implementated sources are available: +.Bl -column NS_COMPAT COMPAT -offset indent +.It Sy "#define value" +.It "NSSRC_FILES ""files""" +.It "NSSRC_DNS ""dns""" +.It "NSSRC_NIS ""nis""" +.It "NSSRC_COMPAT ""compat""" +.El +.Pp +Refer to +.Xr nsswitch.conf 5 +for a complete description of what each source type is. +.Pp +.Ss Callback return values +The callback functions should return one of the following values +depending upon status of the lookup: +.Bl -column NS_NOTFOUND -offset indent +.It Sy "Return value Status code" +.It "NS_SUCCESS success" +.It "NS_NOTFOUND notfound" +.It "NS_UNAVAIL unavail" +.It "NS_TRYAGAIN tryagain" +.El +.Pp +Refer to +.Xr nsswitch.conf 5 +for a complete description of what each status code is. +.Pp +.Nm +returns the value of the callback that caused the dispatcher to finish, +or NS_NOTFOUND otherwise. +.Sh SEE ALSO +.Xr hesiod 3 , +.Xr stdarg 3 , +.Xr ypclnt 3 , +.Xr nsswitch.conf 5 +.Sh HISTORY +The +.Nm +routines first appeared in +.Fx 4.1 . +They were imported from the +.Nx +Project, +where they appeared first in +.Nx 1.4 . +.Sh AUTHORS +Luke Mewburn +.Aq lukem@netbsd.org +wrote this freely distributable name-service switch implementation, +using ideas from the +.Tn ULTRIX +.Xr svc.conf 5 +and +.Tn Solaris +.Xr nsswitch.conf 4 +manual pages. +.Sh BUGS +The +.Nm +routines are not thread safe. +This will be rectified in the future. +.Pp +Currently there is no support for dynamically loadable dispatcher callback +functions. +It is anticipated that this will be added in the future in the back-end +without requiring changes to code that invokes +.Fn nsdispatch . diff --git a/newlib/libc/sys/linux/net/nsdispatch.c b/newlib/libc/sys/linux/net/nsdispatch.c new file mode 100644 index 000000000..ea5fc6d4b --- /dev/null +++ b/newlib/libc/sys/linux/net/nsdispatch.c @@ -0,0 +1,266 @@ +/* $NetBSD: nsdispatch.c,v 1.9 1999/01/25 00:16:17 lukem Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include + +#include +#define _NS_PRIVATE +#include +#include +#include +#include +#include + +/* + * default sourcelist: `files' + */ +const ns_src __nsdefaultsrc[] = { + { NSSRC_FILES, NS_SUCCESS }, + { 0 }, +}; + + +static int _nsmapsize = 0; +static ns_dbt *_nsmap = NULL; + +/* + * size of dynamic array chunk for _nsmap and _nsmap[x].srclist + */ +#define NSELEMSPERCHUNK 8 + + +int _nscmp(const void *, const void *); + + +int +_nscmp(a, b) + const void *a; + const void *b; +{ + return (strcasecmp(((const ns_dbt *)a)->name, + ((const ns_dbt *)b)->name)); +} + + +void +_nsdbtaddsrc(dbt, src) + ns_dbt *dbt; + const ns_src *src; +{ + if ((dbt->srclistsize % NSELEMSPERCHUNK) == 0) { + dbt->srclist = (ns_src *)realloc(dbt->srclist, + (dbt->srclistsize + NSELEMSPERCHUNK) * sizeof(ns_src)); + if (dbt->srclist == NULL) + printf("nsdispatch: memory allocation failure\n"); + } + memmove(&dbt->srclist[dbt->srclistsize++], src, sizeof(ns_src)); +} + + +void +_nsdbtdump(dbt) + const ns_dbt *dbt; +{ + int i; + + printf("%s (%d source%s):", dbt->name, dbt->srclistsize, + dbt->srclistsize == 1 ? "" : "s"); + for (i = 0; i < dbt->srclistsize; i++) { + printf(" %s", dbt->srclist[i].name); + if (!(dbt->srclist[i].flags & + (NS_UNAVAIL|NS_NOTFOUND|NS_TRYAGAIN)) && + (dbt->srclist[i].flags & NS_SUCCESS)) + continue; + printf(" ["); + if (!(dbt->srclist[i].flags & NS_SUCCESS)) + printf(" SUCCESS=continue"); + if (dbt->srclist[i].flags & NS_UNAVAIL) + printf(" UNAVAIL=return"); + if (dbt->srclist[i].flags & NS_NOTFOUND) + printf(" NOTFOUND=return"); + if (dbt->srclist[i].flags & NS_TRYAGAIN) + printf(" TRYAGAIN=return"); + printf(" ]"); + } + printf("\n"); +} + + +const ns_dbt * +_nsdbtget(name) + const char *name; +{ + static time_t confmod; + + struct stat statbuf; + ns_dbt dbt; + + extern FILE *_nsyyin; + extern int _nsyyparse(void); + + dbt.name = name; + + if (confmod) { + if (stat(_PATH_NS_CONF, &statbuf) == -1) + return (NULL); + if (confmod < statbuf.st_mtime) { + int i, j; + + for (i = 0; i < _nsmapsize; i++) { + for (j = 0; j < _nsmap[i].srclistsize; j++) { + if (_nsmap[i].srclist[j].name != NULL) { + /*LINTED const cast*/ + free((void *) + _nsmap[i].srclist[j].name); + } + } + if (_nsmap[i].srclist) + free(_nsmap[i].srclist); + if (_nsmap[i].name) { + /*LINTED const cast*/ + free((void *)_nsmap[i].name); + } + } + if (_nsmap) + free(_nsmap); + _nsmap = NULL; + _nsmapsize = 0; + confmod = 0; + } + } + if (!confmod) { + if (stat(_PATH_NS_CONF, &statbuf) == -1) + return (NULL); + _nsyyin = fopen(_PATH_NS_CONF, "r"); + if (_nsyyin == NULL) + return (NULL); + _nsyyparse(); + (void)fclose(_nsyyin); + qsort(_nsmap, (size_t)_nsmapsize, sizeof(ns_dbt), _nscmp); + confmod = statbuf.st_mtime; + } + return (bsearch(&dbt, _nsmap, (size_t)_nsmapsize, sizeof(ns_dbt), + _nscmp)); +} + + +void +_nsdbtput(dbt) + const ns_dbt *dbt; +{ + int i; + + for (i = 0; i < _nsmapsize; i++) { + if (_nscmp(dbt, &_nsmap[i]) == 0) { + /* overwrite existing entry */ + if (_nsmap[i].srclist != NULL) + free(_nsmap[i].srclist); + memmove(&_nsmap[i], dbt, sizeof(ns_dbt)); + return; + } + } + + if ((_nsmapsize % NSELEMSPERCHUNK) == 0) { + _nsmap = (ns_dbt *)realloc(_nsmap, + (_nsmapsize + NSELEMSPERCHUNK) * sizeof(ns_dbt)); + if (_nsmap == NULL) + printf("nsdispatch: memory allocation failure\n"); + } + memmove(&_nsmap[_nsmapsize++], dbt, sizeof(ns_dbt)); +} + + +int +#if __STDC__ +nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, + const char *method, const ns_src defaults[], ...) +#else +nsdispatch(retval, disp_tab, database, method, defaults, va_alist) + void *retval; + const ns_dtab disp_tab[]; + const char *database; + const char *method; + const ns_src defaults[]; + va_dcl +#endif +{ + va_list ap; + int i, curdisp, result; + const ns_dbt *dbt; + const ns_src *srclist; + int srclistsize; + + dbt = _nsdbtget(database); + if (dbt != NULL) { + srclist = dbt->srclist; + srclistsize = dbt->srclistsize; + } else { + srclist = defaults; + srclistsize = 0; + while (srclist[srclistsize].name != NULL) + srclistsize++; + } + result = 0; + + for (i = 0; i < srclistsize; i++) { + for (curdisp = 0; disp_tab[curdisp].src != NULL; curdisp++) + if (strcasecmp(disp_tab[curdisp].src, + srclist[i].name) == 0) + break; + result = 0; + if (disp_tab[curdisp].callback) { +#if __STDC__ + va_start(ap, defaults); +#else + va_start(ap); +#endif + result = disp_tab[curdisp].callback(retval, + disp_tab[curdisp].cb_data, ap); + va_end(ap); + if (result & srclist[i].flags) { + break; + } + } + } + return (result ? result : NS_NOTFOUND); +} diff --git a/newlib/libc/sys/linux/net/nslexer.c b/newlib/libc/sys/linux/net/nslexer.c new file mode 100644 index 000000000..3f6ba4dcd --- /dev/null +++ b/newlib/libc/sys/linux/net/nslexer.c @@ -0,0 +1,1712 @@ +#define yy_create_buffer _nsyy_create_buffer +#define yy_delete_buffer _nsyy_delete_buffer +#define yy_scan_buffer _nsyy_scan_buffer +#define yy_scan_string _nsyy_scan_string +#define yy_scan_bytes _nsyy_scan_bytes +#define yy_flex_debug _nsyy_flex_debug +#define yy_init_buffer _nsyy_init_buffer +#define yy_flush_buffer _nsyy_flush_buffer +#define yy_load_buffer_state _nsyy_load_buffer_state +#define yy_switch_to_buffer _nsyy_switch_to_buffer +#define yyin _nsyyin +#define yyleng _nsyyleng +#define yylex _nsyylex +#define yyout _nsyyout +#define yyrestart _nsyyrestart +#define yytext _nsyytext +#define yylineno _nsyylineno +#define yywrap _nsyywrap + +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header$ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include +#include + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 1024 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + +#define YY_USES_REJECT +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern int yylineno; +int yylineno = 1; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 13 +#define YY_END_OF_BUFFER 14 +static yyconst short int yy_acclist[83] = + { 0, + 14, 12, 13, 1, 12, 13, 4, 13, 2, 12, + 13, 11, 12, 13, 11, 12, 13, 11, 12, 13, + 11, 12, 13, 11, 12, 13, 11, 12, 13, 11, + 12, 13, 12, 13, 1, 2, 11, 11, 11, 11, + 11, 11, 11, 3, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 9, 11, 11, 11, 11, 11, + 11, 5, 11, 11, 6, 11, 10, 11, 7, 11, + 8, 11 + } ; + +static yyconst short int yy_accept[60] = + { 0, + 1, 1, 1, 2, 4, 7, 9, 12, 15, 18, + 21, 24, 27, 30, 33, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, + 71, 72, 74, 75, 77, 79, 81, 83, 83 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 4, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, + 1, 1, 1, 1, 6, 7, 8, 9, 10, 11, + 12, 7, 13, 7, 7, 14, 7, 15, 16, 7, + 7, 17, 18, 19, 20, 21, 7, 7, 22, 7, + 1, 23, 1, 1, 5, 1, 6, 7, 8, 9, + + 10, 11, 12, 7, 13, 7, 7, 14, 7, 15, + 16, 7, 7, 17, 18, 19, 20, 21, 7, 7, + 22, 7, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[24] = + { 0, + 1, 1, 2, 1, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 1 + } ; + +static yyconst short int yy_base[61] = + { 0, + 0, 0, 68, 69, 65, 69, 0, 0, 50, 49, + 54, 43, 45, 46, 57, 57, 0, 0, 43, 38, + 37, 47, 32, 47, 69, 33, 40, 30, 41, 42, + 26, 33, 29, 27, 33, 30, 35, 25, 19, 23, + 19, 30, 22, 14, 18, 0, 14, 18, 16, 19, + 19, 0, 12, 0, 0, 0, 0, 69, 23, 22 + } ; + +static yyconst short int yy_def[61] = + { 0, + 58, 1, 58, 58, 58, 58, 59, 60, 60, 60, + 60, 60, 60, 60, 58, 58, 59, 60, 60, 60, + 60, 60, 60, 60, 58, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 0, 58, 58 + } ; + +static yyconst short int yy_nxt[93] = + { 0, + 4, 5, 6, 7, 4, 8, 8, 9, 8, 8, + 8, 8, 8, 8, 10, 8, 11, 12, 13, 14, + 8, 8, 15, 17, 18, 17, 57, 56, 55, 54, + 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, + 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, + 33, 32, 31, 30, 29, 28, 27, 26, 16, 25, + 24, 23, 22, 21, 20, 19, 16, 58, 3, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58 + + } ; + +static yyconst short int yy_chk[93] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 59, 60, 59, 53, 51, 50, 49, + 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, + 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, + 27, 26, 24, 23, 22, 21, 20, 19, 16, 15, + 14, 13, 12, 11, 10, 9, 5, 3, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58 + + } ; + +static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; +static char *yy_full_match; +static int yy_lp; +#define REJECT \ +{ \ +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ +yy_cp = yy_full_match; /* restore poss. backed-over text */ \ +++yy_lp; \ +goto find_rule; \ +} +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "nslexer.l" +#define INITIAL 0 +#line 2 "nslexer.l" +/* $NetBSD: nslexer.l,v 1.3 1999/01/25 00:16:17 lukem Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#if defined(LIBC_SCCS) && !defined(lint) +static char *rcsid = + "$FreeBSD: src/lib/libc/net/nslexer.l,v 1.3 2001/11/11 02:48:09 bde Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#define _NS_PRIVATE +#include +#include + +#include "nsparser.h" + +#define YY_NO_UNPUT + + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp = NULL, *yy_bp = NULL; + register int yy_act; + +#line 65 "nslexer.l" + + + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 59 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 69 ); + +yy_find_action: + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[yy_lp]; + { + yy_full_match = yy_cp; + break; + } + } + --yy_cp; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + ++yylineno; + } + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +YY_RULE_SETUP +#line 67 "nslexer.l" +; /* skip whitespace */ + YY_BREAK +case 2: +YY_RULE_SETUP +#line 69 "nslexer.l" +; /* skip comments */ + YY_BREAK +case 3: +YY_RULE_SETUP +#line 71 "nslexer.l" +; /* allow continuation */ + YY_BREAK +case 4: +YY_RULE_SETUP +#line 73 "nslexer.l" +return NL; + YY_BREAK +case 5: +YY_RULE_SETUP +#line 75 "nslexer.l" +return SUCCESS; + YY_BREAK +case 6: +YY_RULE_SETUP +#line 76 "nslexer.l" +return UNAVAIL; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 77 "nslexer.l" +return NOTFOUND; + YY_BREAK +case 8: +YY_RULE_SETUP +#line 78 "nslexer.l" +return TRYAGAIN; + YY_BREAK +case 9: +YY_RULE_SETUP +#line 80 "nslexer.l" +return RETURN; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 81 "nslexer.l" +return CONTINUE; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 83 "nslexer.l" +{ + char *p; + int i; + size_t len; + + len = strlen (yytext) + 1; + if ((p = malloc (len)) == NULL) + printf("nsdispatch: memory allocation failure\n"); + else + memcpy (p, yytext, len); + + for (i = 0; i < strlen(p); i++) { + if (isupper((unsigned char)p[i])) + p[i] = tolower((unsigned char)p[i]); + } + _nsyylval.str = p; + return STRING; + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 99 "nslexer.l" +return yytext[0]; + YY_BREAK +case 13: +YY_RULE_SETUP +#line 101 "nslexer.l" +ECHO; + YY_BREAK + case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 59 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 59 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 58); + if ( ! yy_is_jam ) + *yy_state_ptr++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ) + --yylineno; + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + if ( c == '\n' ) + ++yylineno; + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 101 "nslexer.l" + + +#undef _nsyywrap +int +_nsyywrap() +{ + return 1; +} /* _nsyywrap */ + +void +_nsyyerror(msg) + const char *msg; +{ + + printf("Error in nslexer\n"); +} /* _nsyyerror */ diff --git a/newlib/libc/sys/linux/net/nslexer.l b/newlib/libc/sys/linux/net/nslexer.l new file mode 100644 index 000000000..0b66b6c66 --- /dev/null +++ b/newlib/libc/sys/linux/net/nslexer.l @@ -0,0 +1,114 @@ +%{ +/* $NetBSD: nslexer.l,v 1.3 1999/01/25 00:16:17 lukem Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#if defined(LIBC_SCCS) && !defined(lint) +static char *rcsid = + "$FreeBSD: src/lib/libc/net/nslexer.l,v 1.3 2001/11/11 02:48:09 bde Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#define _NS_PRIVATE +#include +#include + +#include "nsparser.h" + +#define YY_NO_UNPUT + +%} + +%option yylineno + +BLANK [ \t] +CR \n +STRING [a-zA-Z][a-zA-Z0-9_]* + +%% + +{BLANK}+ ; /* skip whitespace */ + +#.* ; /* skip comments */ + +\\{CR} ; /* allow continuation */ + +{CR} return NL; + +[sS][uU][cC][cC][eE][sS][sS] return SUCCESS; +[uU][nN][aA][vV][aA][iI][lL] return UNAVAIL; +[nN][oO][tT][fF][oO][uU][nN][dD] return NOTFOUND; +[tT][rR][yY][aA][gG][aA][iI][nN] return TRYAGAIN; + +[rR][eE][tT][uU][rR][nN] return RETURN; +[cC][oO][nN][tT][iI][nN][uU][eE] return CONTINUE; + +{STRING} { + char *p; + int i; + + if ((p = strdup(yytext)) == NULL) + printf("nsdispatch: memory allocation failure\n"); + + for (i = 0; i < strlen(p); i++) { + if (isupper((unsigned char)p[i])) + p[i] = tolower((unsigned char)p[i]); + } + _nsyylval.str = p; + return STRING; + } + +. return yytext[0]; + +%% + +#undef _nsyywrap +int +_nsyywrap() +{ + return 1; +} /* _nsyywrap */ + +void +_nsyyerror(msg) + const char *msg; +{ + + printf("Error in nslexer\n"); +} /* _nsyyerror */ diff --git a/newlib/libc/sys/linux/net/nsparser.c b/newlib/libc/sys/linux/net/nsparser.c new file mode 100644 index 000000000..b4701aed1 --- /dev/null +++ b/newlib/libc/sys/linux/net/nsparser.c @@ -0,0 +1,541 @@ +#ifndef lint +static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; +#endif +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define yyclearin (yychar=(-1)) +#define yyerrok (yyerrflag=0) +#define YYRECOVERING (yyerrflag!=0) +#define yyparse _nsyyparse +#define yylex _nsyylex +#define yyerror _nsyyerror +#define yychar _nsyychar +#define yyval _nsyyval +#define yylval _nsyylval +#define yydebug _nsyydebug +#define yynerrs _nsyynerrs +#define yyerrflag _nsyyerrflag +#define yyss _nsyyss +#define yyssp _nsyyssp +#define yyvs _nsyyvs +#define yyvsp _nsyyvsp +#define yylhs _nsyylhs +#define yylen _nsyylen +#define yydefred _nsyydefred +#define yydgoto _nsyydgoto +#define yysindex _nsyysindex +#define yyrindex _nsyyrindex +#define yygindex _nsyygindex +#define yytable _nsyytable +#define yycheck _nsyycheck +#define yyname _nsyyname +#define yyrule _nsyyrule +#define YYPREFIX "_nsyy" +#line 2 "nsparser.y" +/* $NetBSD: nsparser.y,v 1.3 1999/01/25 00:16:18 lukem Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +static char *rcsid = + "$FreeBSD: src/lib/libc/net/nsparser.y,v 1.3 2002/03/21 22:47:17 obrien Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#define _NS_PRIVATE +#include +#include +#include + + +static void _nsaddsrctomap(const char *); + +static ns_dbt curdbt; +static ns_src cursrc; +#line 59 "nsparser.y" +typedef union { + char *str; + int mapval; +} YYSTYPE; +#line 97 "y.tab.c" +#define NL 257 +#define SUCCESS 258 +#define UNAVAIL 259 +#define NOTFOUND 260 +#define TRYAGAIN 261 +#define RETURN 262 +#define CONTINUE 263 +#define STRING 264 +#define YYERRCODE 256 +short _nsyylhs[] = { -1, + 0, 0, 3, 3, 4, 4, 4, 4, 5, 6, + 6, 7, 9, 7, 8, 8, 10, 1, 1, 1, + 1, 2, 2, +}; +short _nsyylen[] = { 2, + 0, 1, 1, 2, 1, 3, 4, 2, 1, 1, + 2, 1, 0, 5, 1, 2, 3, 1, 1, 1, + 1, 1, 1, +}; +short _nsyydefred[] = { 0, + 0, 5, 9, 0, 0, 3, 0, 8, 4, 0, + 6, 0, 0, 10, 13, 7, 11, 0, 18, 19, + 20, 21, 0, 0, 15, 0, 14, 16, 22, 23, + 17, +}; +short _nsyydgoto[] = { 4, + 23, 31, 5, 6, 7, 13, 14, 24, 18, 25, +}; +short _nsyysindex[] = { -255, + -249, 0, 0, 0, -255, 0, -41, 0, 0, -254, + 0, -73, -253, 0, 0, 0, 0, -245, 0, 0, + 0, 0, -42, -93, 0, -256, 0, 0, 0, 0, + 0, +}; +short _nsyyrindex[] = { 20, + 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, + 0, -252, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; +short _nsyygindex[] = { 0, + 0, 0, 0, 17, 0, 0, 10, 0, 0, 1, +}; +#define YYTABLESIZE 168 +short _nsyytable[] = { 27, + 1, 2, 11, 16, 12, 29, 30, 8, 3, 12, + 12, 12, 19, 20, 21, 22, 10, 15, 26, 1, + 2, 9, 17, 0, 28, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 19, 20, 21, 22, +}; +short _nsyycheck[] = { 93, + 256, 257, 257, 257, 257, 262, 263, 257, 264, 264, + 264, 264, 258, 259, 260, 261, 58, 91, 61, 0, + 0, 5, 13, -1, 24, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 258, 259, 260, 261, +}; +#define YYFINAL 4 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 264 +#if YYDEBUG +char *_nsyyname[] = { +"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0,"'='",0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"NL","SUCCESS", +"UNAVAIL","NOTFOUND","TRYAGAIN","RETURN","CONTINUE","STRING", +}; +char *_nsyyrule[] = { +"$accept : File", +"File :", +"File : Lines", +"Lines : Entry", +"Lines : Lines Entry", +"Entry : NL", +"Entry : Database ':' NL", +"Entry : Database ':' Srclist NL", +"Entry : error NL", +"Database : STRING", +"Srclist : Item", +"Srclist : Srclist Item", +"Item : STRING", +"$$1 :", +"Item : STRING '[' $$1 Criteria ']'", +"Criteria : Criterion", +"Criteria : Criteria Criterion", +"Criterion : Status '=' Action", +"Status : SUCCESS", +"Status : UNAVAIL", +"Status : NOTFOUND", +"Status : TRYAGAIN", +"Action : RETURN", +"Action : CONTINUE", +}; +#endif +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 500 +#define YYMAXDEPTH 500 +#endif +#endif +int yydebug; +int yynerrs; +int yyerrflag; +int yychar; +short *yyssp; +YYSTYPE *yyvsp; +YYSTYPE yyval; +YYSTYPE yylval; +short yyss[YYSTACKSIZE]; +YYSTYPE yyvs[YYSTACKSIZE]; +#define yystacksize YYSTACKSIZE +#line 150 "nsparser.y" + +static void +_nsaddsrctomap(elem) + const char *elem; +{ + int i, lineno; + extern int _nsyylineno; + extern char * _nsyytext; + + lineno = _nsyylineno - (*_nsyytext == '\n' ? 1 : 0); + if (curdbt.srclistsize > 0) { + if ((strcasecmp(elem, NSSRC_COMPAT) == 0) || + (strcasecmp(curdbt.srclist[0].name, NSSRC_COMPAT) == 0)) { + /* XXX: syslog the following */ + printf("line %d 'compat' used with other sources", + lineno); + return; + } + } + for (i = 0; i < curdbt.srclistsize; i++) { + if (strcasecmp(curdbt.srclist[i].name, elem) == 0) { + /* XXX: syslog the following */ + printf("%s line %d: duplicate source '%s'", + lineno, elem); + return; + } + } + cursrc.name = elem; + _nsdbtaddsrc(&curdbt, &cursrc); +} +#line 276 "y.tab.c" +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab +int +yyparse() +{ + register int yym, yyn, yystate; +#if YYDEBUG + register char *yys; + extern char *getenv(); + + if (yys = getenv("YYDEBUG")) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } +#endif + + yynerrs = 0; + yyerrflag = 0; + yychar = (-1); + + yyssp = yyss; + yyvsp = yyvs; + *yyssp = yystate = 0; + +yyloop: + if (yyn = yydefred[yystate]) goto yyreduce; + if (yychar < 0) + { + if ((yychar = yylex()) < 0) yychar = 0; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("%sdebug: state %d, reading %d (%s)\n", + YYPREFIX, yystate, yychar, yys); + } +#endif + } + if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, shifting to state %d\n", + YYPREFIX, yystate, yytable[yyn]); +#endif + if (yyssp >= yyss + yystacksize - 1) + { + goto yyoverflow; + } + *++yyssp = yystate = yytable[yyn]; + *++yyvsp = yylval; + yychar = (-1); + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag) goto yyinrecovery; +#ifdef lint + goto yynewerror; +#endif +yynewerror: + yyerror("syntax error"); +#ifdef lint + goto yyerrlab; +#endif +yyerrlab: + ++yynerrs; +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, error recovery shifting\ + to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); +#endif + if (yyssp >= yyss + yystacksize - 1) + { + goto yyoverflow; + } + *++yyssp = yystate = yytable[yyn]; + *++yyvsp = yylval; + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: error recovery discarding state %d\n", + YYPREFIX, *yyssp); +#endif + if (yyssp <= yyss) goto yyabort; + --yyssp; + --yyvsp; + } + } + } + else + { + if (yychar == 0) goto yyabort; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("%sdebug: state %d, error recovery discards token %d (%s)\n", + YYPREFIX, yystate, yychar, yys); + } +#endif + yychar = (-1); + goto yyloop; + } +yyreduce: +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, reducing by rule %d (%s)\n", + YYPREFIX, yystate, yyn, yyrule[yyn]); +#endif + yym = yylen[yyn]; + yyval = yyvsp[1-yym]; + switch (yyn) + { +case 7: +#line 87 "nsparser.y" +{ + _nsdbtput(&curdbt); + } +break; +case 8: +#line 91 "nsparser.y" +{ + yyerrok; + } +break; +case 9: +#line 98 "nsparser.y" +{ + curdbt.name = yylval.str; + curdbt.srclist = NULL; + curdbt.srclistsize = 0; + } +break; +case 12: +#line 112 "nsparser.y" +{ + cursrc.flags = NS_SUCCESS; + _nsaddsrctomap(yyvsp[0].str); + } +break; +case 13: +#line 116 "nsparser.y" +{ cursrc.flags = NS_SUCCESS; } +break; +case 14: +#line 117 "nsparser.y" +{ + _nsaddsrctomap(yyvsp[-4].str); + } +break; +case 17: +#line 129 "nsparser.y" +{ + if (yyvsp[0].mapval) /* if action == RETURN set RETURN bit */ + cursrc.flags |= yyvsp[-2].mapval; + else /* else unset it */ + cursrc.flags &= ~yyvsp[-2].mapval; + } +break; +case 18: +#line 138 "nsparser.y" +{ yyval.mapval = NS_SUCCESS; } +break; +case 19: +#line 139 "nsparser.y" +{ yyval.mapval = NS_UNAVAIL; } +break; +case 20: +#line 140 "nsparser.y" +{ yyval.mapval = NS_NOTFOUND; } +break; +case 21: +#line 141 "nsparser.y" +{ yyval.mapval = NS_TRYAGAIN; } +break; +case 22: +#line 145 "nsparser.y" +{ yyval.mapval = 1L; } +break; +case 23: +#line 146 "nsparser.y" +{ yyval.mapval = 0L; } +break; +#line 487 "y.tab.c" + } + yyssp -= yym; + yystate = *yyssp; + yyvsp -= yym; + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: after reduction, shifting from state 0 to\ + state %d\n", YYPREFIX, YYFINAL); +#endif + yystate = YYFINAL; + *++yyssp = YYFINAL; + *++yyvsp = yyval; + if (yychar < 0) + { + if ((yychar = yylex()) < 0) yychar = 0; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("%sdebug: state %d, reading %d (%s)\n", + YYPREFIX, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == 0) goto yyaccept; + goto yyloop; + } + if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + printf("%sdebug: after reduction, shifting from state %d \ +to state %d\n", YYPREFIX, *yyssp, yystate); +#endif + if (yyssp >= yyss + yystacksize - 1) + { + goto yyoverflow; + } + *++yyssp = yystate; + *++yyvsp = yyval; + goto yyloop; +yyoverflow: + yyerror("yacc stack overflow"); +yyabort: + return (1); +yyaccept: + return (0); +} diff --git a/newlib/libc/sys/linux/net/nsparser.h b/newlib/libc/sys/linux/net/nsparser.h new file mode 100644 index 000000000..6a6fae0be --- /dev/null +++ b/newlib/libc/sys/linux/net/nsparser.h @@ -0,0 +1,13 @@ +#define NL 257 +#define SUCCESS 258 +#define UNAVAIL 259 +#define NOTFOUND 260 +#define TRYAGAIN 261 +#define RETURN 262 +#define CONTINUE 263 +#define STRING 264 +typedef union { + char *str; + int mapval; +} YYSTYPE; +extern YYSTYPE _nsyylval; diff --git a/newlib/libc/sys/linux/net/nsparser.y b/newlib/libc/sys/linux/net/nsparser.y new file mode 100644 index 000000000..42f63a8a5 --- /dev/null +++ b/newlib/libc/sys/linux/net/nsparser.y @@ -0,0 +1,178 @@ +%{ +/* $NetBSD: nsparser.y,v 1.3 1999/01/25 00:16:18 lukem Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +static char *rcsid = + "$FreeBSD: src/lib/libc/net/nsparser.y,v 1.3 2002/03/21 22:47:17 obrien Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#define _NS_PRIVATE +#include +#include +#include + + +static void _nsaddsrctomap(const char *); + +static ns_dbt curdbt; +static ns_src cursrc; +%} + +%union { + char *str; + int mapval; +} + +%token NL +%token SUCCESS UNAVAIL NOTFOUND TRYAGAIN +%token RETURN CONTINUE +%token STRING + +%type Status Action + +%% + +File + : /* empty */ + | Lines + ; + +Lines + : Entry + | Lines Entry + ; + +Entry + : NL + | Database ':' NL + | Database ':' Srclist NL + { + _nsdbtput(&curdbt); + } + | error NL + { + yyerrok; + } + ; + +Database + : STRING + { + curdbt.name = yylval.str; + curdbt.srclist = NULL; + curdbt.srclistsize = 0; + } + ; + +Srclist + : Item + | Srclist Item + ; + +Item + : STRING + { + cursrc.flags = NS_SUCCESS; + _nsaddsrctomap($1); + } + | STRING '[' { cursrc.flags = NS_SUCCESS; } Criteria ']' + { + _nsaddsrctomap($1); + } + ; + +Criteria + : Criterion + | Criteria Criterion + ; + +Criterion + : Status '=' Action + { + if ($3) /* if action == RETURN set RETURN bit */ + cursrc.flags |= $1; + else /* else unset it */ + cursrc.flags &= ~$1; + } + ; + +Status + : SUCCESS { $$ = NS_SUCCESS; } + | UNAVAIL { $$ = NS_UNAVAIL; } + | NOTFOUND { $$ = NS_NOTFOUND; } + | TRYAGAIN { $$ = NS_TRYAGAIN; } + ; + +Action + : RETURN { $$ = 1L; } + | CONTINUE { $$ = 0L; } + ; + +%% + +static void +_nsaddsrctomap(elem) + const char *elem; +{ + int i, lineno; + extern int _nsyylineno; + extern char * _nsyytext; + + lineno = _nsyylineno - (*_nsyytext == '\n' ? 1 : 0); + if (curdbt.srclistsize > 0) { + if ((strcasecmp(elem, NSSRC_COMPAT) == 0) || + (strcasecmp(curdbt.srclist[0].name, NSSRC_COMPAT) == 0)) { + /* XXX: syslog the following */ + printf("line %d 'compat' used with other sources", + lineno); + return; + } + } + for (i = 0; i < curdbt.srclistsize; i++) { + if (strcasecmp(curdbt.srclist[i].name, elem) == 0) { + /* XXX: syslog the following */ + printf("%s line %d: duplicate source '%s'", + lineno, elem); + return; + } + } + cursrc.name = elem; + _nsdbtaddsrc(&curdbt, &cursrc); +} diff --git a/newlib/libc/sys/linux/net/rcmd.3 b/newlib/libc/sys/linux/net/rcmd.3 new file mode 100644 index 000000000..9479a237d --- /dev/null +++ b/newlib/libc/sys/linux/net/rcmd.3 @@ -0,0 +1,298 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 +.\" $FreeBSD: src/lib/libc/net/rcmd.3,v 1.20 2001/10/01 16:08:56 ru Exp $ +.\" +.Dd March 3, 2000 +.Dt RCMD 3 +.Os +.Sh NAME +.Nm rcmd , +.Nm rresvport , +.Nm iruserok , +.Nm ruserok , +.Nm rcmd_af , +.Nm rresvport_af , +.Nm iruserok_sa +.Nd routines for returning a stream to a remote command +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In unistd.h +.Ft int +.Fn rcmd "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p" +.Ft int +.Fn rresvport "int *port" +.Ft int +.Fn iruserok "u_long raddr" "int superuser" "const char *ruser" "const char *luser" +.Ft int +.Fn ruserok "const char *rhost" "int superuser" "const char *ruser" "const char *luser" +.Ft int +.Fn rcmd_af "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p" "int af" +.Ft int +.Fn rresvport_af "int *port" "int af" +.Ft int +.Fn iruserok_sa "const void *addr" "int addrlen" "int superuser" "const char *ruser" "const char *luser" +.Sh DESCRIPTION +The +.Fn rcmd +function +is used by the super-user to execute a command on +a remote machine using an authentication scheme based +on reserved port numbers. +The +.Fn rresvport +function +returns a descriptor to a socket +with an address in the privileged port space. +The +.Fn ruserok +function +is used by servers +to authenticate clients requesting service with +.Fn rcmd . +All three functions are present in the same file and are used +by the +.Xr rshd 8 +server (among others). +.Pp +The +.Fn rcmd +function +looks up the host +.Fa *ahost +using +.Xr gethostbyname 3 , +returning -1 if the host does not exist. +Otherwise +.Fa *ahost +is set to the standard name of the host +and a connection is established to a server +residing at the well-known Internet port +.Fa inport . +.Pp +If the connection succeeds, +a socket in the Internet domain of type +.Dv SOCK_STREAM +is returned to the caller, and given to the remote +command as +.Em stdin +and +.Em stdout . +If +.Fa fd2p +is non-zero, then an auxiliary channel to a control +process will be set up, and a descriptor for it will be placed +in +.Fa *fd2p . +The control process will return diagnostic +output from the command (unit 2) on this channel, and will also +accept bytes on this channel as being +.Tn UNIX +signal numbers, to be +forwarded to the process group of the command. +If +.Fa fd2p +is 0, then the +.Em stderr +(unit 2 of the remote +command) will be made the same as the +.Em stdout +and no +provision is made for sending arbitrary signals to the remote process, +although you may be able to get its attention by using out-of-band data. +.Pp +The protocol is described in detail in +.Xr rshd 8 . +.Pp +The +.Fn rresvport +function is used to obtain a socket to which an address with a Privileged +Internet port is bound. +This socket is suitable for use by +.Fn rcmd +and several other functions. +Privileged Internet ports are those in the range 0 to 1023. +Only the super-user is allowed to bind an address of this sort +to a socket. +.Pp +The +.Fn iruserok +and +.Fn ruserok +functions take a remote host's IP address or name, as returned by the +.Xr gethostbyname 3 +routines, two user names and a flag indicating whether the local user's +name is that of the super-user. +Then, if the user is +.Em NOT +the super-user, it checks the +.Pa /etc/hosts.equiv +file. +If that lookup is not done, or is unsuccessful, the +.Pa .rhosts +in the local user's home directory is checked to see if the request for +service is allowed. +.Pp +If this file does not exist, is not a regular file, is owned by anyone +other than the user or the super-user, or is writable by anyone other +than the owner, the check automatically fails. +Zero is returned if the machine name is listed in the +.Dq Pa hosts.equiv +file, or the host and remote user name are found in the +.Dq Pa .rhosts +file; otherwise +.Fn iruserok +and +.Fn ruserok +return -1. +If the local domain (as obtained from +.Xr gethostname 3 ) +is the same as the remote domain, only the machine name need be specified. +.Pp +The +.Fn iruserok +function is strongly preferred for security reasons. +It requires trusting the local DNS at most, while the +.Fn ruserok +function requires trusting the entire DNS, which can be spoofed. +.Pp +The functions with an +.Dq Li _af +or +.Dq Li _sa +suffix, i.e., +.Fn rcmd_af , +.Fn rresvport_af +and +.Fn iruserok_sa , +work the same as the corresponding functions without a +suffix, except that they are capable of handling both IPv6 and IPv4 ports. +.Pp +The +.Dq Li _af +suffix means that the function has an additional +.Fa af +argument which is used to specify the address family, +(see below). +The +.Fa af +argument extension is implemented for functions +that have no binary address argument. +Instead, the +.Fa af +argument specifies which address family is desired. +.Pp +The +.Dq Li _sa +suffix means that the function has general socket address and +length arguments. +As the socket address is a protocol independent data structure, +IPv4 and IPv6 socket address can be passed as desired. +The +.Fa sa +argument extension is implemented for functions +that pass a protocol dependent binary address argument. +The argument needs to be replaced with a more general address structure +to support multiple address families in a general way. +.Pp +The functions with neither an +.Dq Li _af +suffix nor an +.Dq Li _sa +suffix work for IPv4 only, except for +.Fn ruserok +which can handle both IPv6 and IPv4. +To switch the address family, the +.Fa af +argument must be filled with +.Dv AF_INET , +or +.Dv AF_INET6 . +For +.Fn rcmd_af , +.Dv PF_UNSPEC +is also allowed. +.Sh DIAGNOSTICS +The +.Fn rcmd +function +returns a valid socket descriptor on success. +It returns -1 on error and prints a diagnostic message +on the standard error. +.Pp +The +.Fn rresvport +function +returns a valid, bound socket descriptor on success. +It returns -1 on error with the global value +.Va errno +set according to the reason for failure. +The error code +.Er EAGAIN +is overloaded to mean ``All network ports in use.'' +.Sh SEE ALSO +.Xr rlogin 1 , +.Xr rsh 1 , +.Xr intro 2 , +.Xr rexec 3 , +.Xr rexecd 8 , +.Xr rlogind 8 , +.Xr rshd 8 +.Pp +.Rs +.%A W. Stevens +.%A M. Thomas +.%T "Advanced Socket API for IPv6" +.%O RFC2292 +.Re +.Rs +.%A W. Stevens +.%A M. Thomas +.%A E. Nordmark +.%T "Advanced Socket API for IPv6" +.%O draft-ietf-ipngwg-rfc2292bis-01.txt +.Re +.Sh HISTORY +Most of these +functions appeared in +.Bx 4.2 . +.Fn rresvport_af +appeared in RFC2292, and was implemented by the WIDE project +for the Hydrangea IPv6 protocol stack kit. +.Fn rcmd_af +appeared in draft-ietf-ipngwg-rfc2292bis-01.txt, +and was implemented in the WIDE/KAME IPv6 protocol stack kit. +.Fn iruserok_sa +appeared in discussion on the IETF ipngwg mailing list, +and was implemented in +.Fx 4.0 . diff --git a/newlib/libc/sys/linux/net/rcmd.c b/newlib/libc/sys/linux/net/rcmd.c new file mode 100644 index 000000000..708b69d1b --- /dev/null +++ b/newlib/libc/sys/linux/net/rcmd.c @@ -0,0 +1,779 @@ +/* + * Copyright (c) 1983, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include +#include + +#include "namespace.h" +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef YP +#include +#include +#include +#endif +#include +#include "un-namespace.h" + +/* wrapper for KAME-special getnameinfo() */ +#ifndef NI_WITHSCOPEID +#define NI_WITHSCOPEID 0 +#endif + +extern int innetgr( const char *, const char *, const char *, const char * ); +extern int rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser, const char *cmd, const char *rshprog); +int rresvport_af(int *alport, int family); + +#define max(a, b) ((a > b) ? a : b) + +int __ivaliduser(FILE *, u_int32_t, const char *, const char *); +int __ivaliduser_af(FILE *,const void *, const char *, const char *, int, int); +int __ivaliduser_sa(FILE *, const struct sockaddr *, socklen_t, const char *, + const char *); +static int __icheckhost(const struct sockaddr *, socklen_t, const char *); + +char paddr[NI_MAXHOST]; + +int +rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) + char **ahost; + u_short rport; + const char *locuser, *remuser, *cmd; + int *fd2p; + int af; +{ + struct addrinfo hints, *res, *ai; + struct sockaddr_storage from; + fd_set reads; + sigset_t oldmask, newmask; + pid_t pid; + int s, aport, lport, timo, error; + char c, *p; + int refused, nres; + char num[8]; + static char canonnamebuf[MAXDNAME]; /* is it proper here? */ + + /* call rcmdsh() with specified remote shell if appropriate. */ + if (!issetugid() && (p = getenv("RSH"))) { + struct servent *sp = getservbyname("shell", "tcp"); + + if (sp && sp->s_port == rport) + return (rcmdsh(ahost, rport, locuser, remuser, + cmd, p)); + } + + /* use rsh(1) if non-root and remote port is shell. */ + if (geteuid()) { + struct servent *sp = getservbyname("shell", "tcp"); + + if (sp && sp->s_port == rport) + return (rcmdsh(ahost, rport, locuser, remuser, + cmd, NULL)); + } + + pid = getpid(); + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = af; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = 0; + (void)snprintf(num, sizeof(num), "%d", ntohs(rport)); + error = getaddrinfo(*ahost, num, &hints, &res); + if (error) { + fprintf(stderr, "rcmd: getaddrinfo: %s\n", + gai_strerror(error)); + if (error == EAI_SYSTEM) + fprintf(stderr, "rcmd: getaddrinfo: %s\n", + strerror(errno)); + return (-1); + } + + if (res->ai_canonname + && strlen(res->ai_canonname) + 1 < sizeof(canonnamebuf)) { + strncpy(canonnamebuf, res->ai_canonname, sizeof(canonnamebuf)); + *ahost = canonnamebuf; + } + nres = 0; + for (ai = res; ai; ai = ai->ai_next) + nres++; + ai = res; + refused = 0; + sigemptyset(&newmask); + sigaddset(&newmask, SIGURG); + sigprocmask(SIG_BLOCK, (const sigset_t *)&newmask, &oldmask); + for (timo = 1, lport = IPPORT_RESERVED - 1;;) { + s = rresvport_af(&lport, ai->ai_family); + if (s < 0) { + if (errno != EAGAIN && ai->ai_next) { + ai = ai->ai_next; + continue; + } + if (errno == EAGAIN) + (void)fprintf(stderr, + "rcmd: socket: All ports in use\n"); + else + (void)fprintf(stderr, "rcmd: socket: %s\n", + strerror(errno)); + freeaddrinfo(res); + sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, + NULL); + return (-1); + } + fcntl(s, F_SETOWN, pid); + if (connect(s, ai->ai_addr, ai->ai_addrlen) >= 0) + break; + (void)close(s); + if (errno == EADDRINUSE) { + lport--; + continue; + } + if (errno == ECONNREFUSED) + refused = 1; + if (ai->ai_next == NULL && (!refused || timo > 16)) { + (void)fprintf(stderr, "%s: %s\n", + *ahost, strerror(errno)); + freeaddrinfo(res); + sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, + NULL); + return (-1); + } + if (nres > 1) { + int oerrno = errno; + + getnameinfo(ai->ai_addr, ai->ai_addrlen, + paddr, sizeof(paddr), + NULL, 0, + NI_NUMERICHOST|NI_WITHSCOPEID); + (void)fprintf(stderr, "connect to address %s: ", + paddr); + errno = oerrno; + perror(0); + } + if ((ai = ai->ai_next) == NULL) { + /* refused && timo <= 16 */ + struct timespec time_to_sleep, time_remaining; + + time_to_sleep.tv_sec = timo; + time_to_sleep.tv_nsec = 0; + (void)nanosleep(&time_to_sleep, &time_remaining); + timo *= 2; + ai = res; + refused = 0; + } + if (nres > 1) { + getnameinfo(ai->ai_addr, ai->ai_addrlen, + paddr, sizeof(paddr), + NULL, 0, + NI_NUMERICHOST|NI_WITHSCOPEID); + fprintf(stderr, "Trying %s...\n", paddr); + } + } + lport--; + if (fd2p == 0) { + write(s, "", 1); + lport = 0; + } else { + char num[8]; + int s2 = rresvport_af(&lport, ai->ai_family), s3; + int len = ai->ai_addrlen; + int nfds; + + if (s2 < 0) + goto bad; + listen(s2, 1); + (void)snprintf(num, sizeof(num), "%d", lport); + if (write(s, num, strlen(num)+1) != strlen(num)+1) { + (void)fprintf(stderr, + "rcmd: write (setting up stderr): %s\n", + strerror(errno)); + (void)close(s2); + goto bad; + } + nfds = max(s, s2)+1; + if(nfds > FD_SETSIZE) { + fprintf(stderr, "rcmd: too many files\n"); + (void)close(s2); + goto bad; + } +again: + FD_ZERO(&reads); + FD_SET(s, &reads); + FD_SET(s2, &reads); + errno = 0; + if (select(nfds, &reads, 0, 0, 0) < 1 || !FD_ISSET(s2, &reads)){ + if (errno != 0) + (void)fprintf(stderr, + "rcmd: select (setting up stderr): %s\n", + strerror(errno)); + else + (void)fprintf(stderr, + "select: protocol failure in circuit setup\n"); + (void)close(s2); + goto bad; + } + s3 = accept(s2, (struct sockaddr *)&from, &len); + switch (from.ss_family) { + case AF_INET: + aport = ntohs(((struct sockaddr_in *)&from)->sin_port); + break; +#ifdef INET6 + case AF_INET6: + aport = ntohs(((struct sockaddr_in6 *)&from)->sin6_port); + break; +#endif + default: + aport = 0; /* error */ + break; + } + /* + * XXX careful for ftp bounce attacks. If discovered, shut them + * down and check for the real auxiliary channel to connect. + */ + if (aport == 20) { + close(s3); + goto again; + } + (void)close(s2); + if (s3 < 0) { + (void)fprintf(stderr, + "rcmd: accept: %s\n", strerror(errno)); + lport = 0; + goto bad; + } + *fd2p = s3; + if (aport >= IPPORT_RESERVED || aport < IPPORT_RESERVED / 2) { + (void)fprintf(stderr, + "socket: protocol failure in circuit setup.\n"); + goto bad2; + } + } + (void)write(s, locuser, strlen(locuser)+1); + (void)write(s, remuser, strlen(remuser)+1); + (void)write(s, cmd, strlen(cmd)+1); + if (read(s, &c, 1) != 1) { + (void)fprintf(stderr, + "rcmd: %s: %s\n", *ahost, strerror(errno)); + goto bad2; + } + if (c != 0) { + while (read(s, &c, 1) == 1) { + (void)write(STDERR_FILENO, &c, 1); + if (c == '\n') + break; + } + goto bad2; + } + sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL); + freeaddrinfo(res); + return (s); +bad2: + if (lport) + (void)close(*fd2p); +bad: + (void)close(s); + sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL); + freeaddrinfo(res); + return (-1); +} + +int +rcmd(ahost, rport, locuser, remuser, cmd, fd2p) + char **ahost; + u_short rport; + const char *locuser, *remuser, *cmd; + int *fd2p; +{ + return rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, AF_INET); +} + +int +rresvport(port) + int *port; +{ + return rresvport_af(port, AF_INET); +} + +int +rresvport_af(alport, family) + int *alport, family; +{ + int s; + struct sockaddr_storage ss; + u_short *sport; + + memset(&ss, 0, sizeof(ss)); + ss.ss_family = family; + switch (family) { + case AF_INET: + sport = &((struct sockaddr_in *)&ss)->sin_port; + ((struct sockaddr_in *)&ss)->sin_addr.s_addr = INADDR_ANY; + break; +#ifdef INET6 + case AF_INET6: + sport = &((struct sockaddr_in6 *)&ss)->sin6_port; + ((struct sockaddr_in6 *)&ss)->sin6_addr = in6addr_any; + break; +#endif + default: + errno = EAFNOSUPPORT; + return -1; + } + + s = socket(ss.ss_family, SOCK_STREAM, 0); + if (s < 0) + return (-1); +#if 0 /* compat_exact_traditional_rresvport_semantics */ + sin.sin_port = htons((u_short)*alport); + if (_bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0) + return (s); + if (errno != EADDRINUSE) { + (void)close(s); + return (-1); + } +#endif + *sport = 0; + if (bindresvport_sa(s, (struct sockaddr *)&ss) == -1) { + (void)close(s); + return (-1); + } + *alport = (int)ntohs(*sport); + return (s); +} + +int __check_rhosts_file = 1; +char *__rcmd_errstr; + +int +ruserok(rhost, superuser, ruser, luser) + const char *rhost, *ruser, *luser; + int superuser; +{ + struct addrinfo hints, *res, *r; + int error; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; /*dummy*/ + error = getaddrinfo(rhost, "0", &hints, &res); + if (error) + return (-1); + + for (r = res; r; r = r->ai_next) { + if (iruserok_sa(r->ai_addr, r->ai_addrlen, superuser, ruser, + luser) == 0) { + freeaddrinfo(res); + return (0); + } + } + freeaddrinfo(res); + return (-1); +} + +/* + * New .rhosts strategy: We are passed an ip address. We spin through + * hosts.equiv and .rhosts looking for a match. When the .rhosts only + * has ip addresses, we don't have to trust a nameserver. When it + * contains hostnames, we spin through the list of addresses the nameserver + * gives us and look for a match. + * + * Returns 0 if ok, -1 if not ok. + */ +int +iruserok(raddr, superuser, ruser, luser) + unsigned long raddr; + int superuser; + const char *ruser, *luser; +{ + struct sockaddr_in sin; + int sin_len; + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin_len = sizeof(struct sockaddr_in); + memcpy(&sin.sin_addr, &raddr, sizeof(sin.sin_addr)); + return iruserok_sa((struct sockaddr *)&sin, sin_len, superuser, + ruser, luser); +} + +/* + * AF independent extension of iruserok. + * + * Returns 0 if ok, -1 if not ok. + */ +int +iruserok_sa(ra, rlen, superuser, ruser, luser) + const void *ra; + int rlen; + int superuser; + const char *ruser, *luser; +{ + char *cp; + struct stat sbuf; + struct passwd *pwd; + FILE *hostf; + uid_t uid; + int first; + char pbuf[MAXPATHLEN]; + const struct sockaddr *raddr; + struct sockaddr_storage ss; + + /* avoid alignment issue */ + if (rlen > sizeof(ss)) + return(-1); + memcpy(&ss, ra, rlen); + raddr = (struct sockaddr *)&ss; + + first = 1; + hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r"); +again: + if (hostf) { + if (__ivaliduser_sa(hostf, raddr, rlen, luser, ruser) == 0) { + (void)fclose(hostf); + return (0); + } + (void)fclose(hostf); + } + if (first == 1 && (__check_rhosts_file || superuser)) { + first = 0; + if ((pwd = getpwnam(luser)) == NULL) + return (-1); + (void)strcpy(pbuf, pwd->pw_dir); + (void)strcat(pbuf, "/.rhosts"); + + /* + * Change effective uid while opening .rhosts. If root and + * reading an NFS mounted file system, can't read files that + * are protected read/write owner only. + */ + uid = geteuid(); + (void)seteuid(pwd->pw_uid); + hostf = fopen(pbuf, "r"); + (void)seteuid(uid); + + if (hostf == NULL) + return (-1); + /* + * If not a regular file, or is owned by someone other than + * user or root or if writeable by anyone but the owner, quit. + */ + cp = NULL; + if (lstat(pbuf, &sbuf) < 0) + cp = ".rhosts lstat failed"; + else if (!S_ISREG(sbuf.st_mode)) + cp = ".rhosts not regular file"; + else if (fstat(fileno(hostf), &sbuf) < 0) + cp = ".rhosts fstat failed"; + else if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid) + cp = "bad .rhosts owner"; + else if (sbuf.st_mode & (S_IWGRP|S_IWOTH)) + cp = ".rhosts writeable by other than owner"; + /* If there were any problems, quit. */ + if (cp) { + __rcmd_errstr = cp; + (void)fclose(hostf); + return (-1); + } + goto again; + } + return (-1); +} + +/* + * XXX + * Don't make static, used by lpd(8). + * + * Returns 0 if ok, -1 if not ok. + */ +int +__ivaliduser(hostf, raddr, luser, ruser) + FILE *hostf; + u_int32_t raddr; + const char *luser, *ruser; +{ + struct sockaddr_in sin; + int sin_len; + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin_len = sizeof(struct sockaddr_in); + memcpy(&sin.sin_addr, &raddr, sizeof(sin.sin_addr)); + return __ivaliduser_sa(hostf, (struct sockaddr *)&sin, sin_len, + luser, ruser); +} + +/* + * Returns 0 if ok, -1 if not ok. + * + * XXX obsolete API. + */ +int +__ivaliduser_af(hostf, raddr, luser, ruser, af, len) + FILE *hostf; + const void *raddr; + const char *luser, *ruser; + int af, len; +{ + struct sockaddr *sa = NULL; + struct sockaddr_in *sin = NULL; +#ifdef INET6 + struct sockaddr_in6 *sin6 = NULL; +#endif + struct sockaddr_storage ss; + + memset(&ss, 0, sizeof(ss)); + switch (af) { + case AF_INET: + if (len != sizeof(sin->sin_addr)) + return -1; + sin = (struct sockaddr_in *)&ss; + sin->sin_family = AF_INET; + memcpy(&sin->sin_addr, raddr, sizeof(sin->sin_addr)); + break; +#ifdef INET6 + case AF_INET6: + if (len != sizeof(sin6->sin6_addr)) + return -1; + /* you will lose scope info */ + sin6 = (struct sockaddr_in6 *)&ss; + sin6->sin6_family = AF_INET6; + memcpy(&sin6->sin6_addr, raddr, sizeof(sin6->sin6_addr)); + break; +#endif + default: + return -1; + } + + sa = (struct sockaddr *)&ss; + return __ivaliduser_sa(hostf, sa, 0, luser, ruser); +} + +int +__ivaliduser_sa(hostf, raddr, salen, luser, ruser) + FILE *hostf; + const struct sockaddr *raddr; + socklen_t salen; + const char *luser, *ruser; +{ + char *user, *p; + int ch; + char buf[MAXHOSTNAMELEN + 128]; /* host + login */ + char hname[MAXHOSTNAMELEN]; + /* Presumed guilty until proven innocent. */ + int userok = 0, hostok = 0; +#ifdef YP + char *ypdomain; + + if (yp_get_default_domain(&ypdomain)) + ypdomain = NULL; +#else +#define ypdomain NULL +#endif + /* We need to get the damn hostname back for netgroup matching. */ + if (getnameinfo(raddr, salen, hname, sizeof(hname), NULL, 0, + NI_NAMEREQD) != 0) + return (-1); + + while (fgets(buf, sizeof(buf), hostf)) { + p = buf; + /* Skip lines that are too long. */ + if (strchr(p, '\n') == NULL) { + while ((ch = getc(hostf)) != '\n' && ch != EOF); + continue; + } + if (*p == '\n' || *p == '#') { + /* comment... */ + continue; + } + while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') { + *p = isupper((unsigned char)*p) ? tolower((unsigned char)*p) : *p; + p++; + } + if (*p == ' ' || *p == '\t') { + *p++ = '\0'; + while (*p == ' ' || *p == '\t') + p++; + user = p; + while (*p != '\n' && *p != ' ' && + *p != '\t' && *p != '\0') + p++; + } else + user = p; + *p = '\0'; + /* + * Do +/- and +@/-@ checking. This looks really nasty, + * but it matches SunOS's behavior so far as I can tell. + */ + switch(buf[0]) { + case '+': + if (!buf[1]) { /* '+' matches all hosts */ + hostok = 1; + break; + } + if (buf[1] == '@') /* match a host by netgroup */ + hostok = innetgr((char *)&buf[2], + (char *)&hname, NULL, ypdomain); + else /* match a host by addr */ + hostok = __icheckhost(raddr, salen, + (char *)&buf[1]); + break; + case '-': /* reject '-' hosts and all their users */ + if (buf[1] == '@') { + if (innetgr((char *)&buf[2], + (char *)&hname, NULL, ypdomain)) + return(-1); + } else { + if (__icheckhost(raddr, salen, + (char *)&buf[1])) + return(-1); + } + break; + default: /* if no '+' or '-', do a simple match */ + hostok = __icheckhost(raddr, salen, buf); + break; + } + switch(*user) { + case '+': + if (!*(user+1)) { /* '+' matches all users */ + userok = 1; + break; + } + if (*(user+1) == '@') /* match a user by netgroup */ + userok = innetgr(user+2, NULL, ruser, ypdomain); + else /* match a user by direct specification */ + userok = !(strcmp(ruser, user+1)); + break; + case '-': /* if we matched a hostname, */ + if (hostok) { /* check for user field rejections */ + if (!*(user+1)) + return(-1); + if (*(user+1) == '@') { + if (innetgr(user+2, NULL, + ruser, ypdomain)) + return(-1); + } else { + if (!strcmp(ruser, user+1)) + return(-1); + } + } + break; + default: /* no rejections: try to match the user */ + if (hostok) + userok = !(strcmp(ruser,*user ? user : luser)); + break; + } + if (hostok && userok) + return(0); + } + return (-1); +} + +/* + * Returns "true" if match, 0 if no match. + * + * NI_WITHSCOPEID is useful for comparing sin6_scope_id portion + * if af == AF_INET6. + */ +static int +__icheckhost(raddr, salen, lhost) + const struct sockaddr *raddr; + socklen_t salen; + const char *lhost; +{ + struct sockaddr_in sin; + struct sockaddr_in6 *sin6; + struct addrinfo hints, *res, *r; + int error; + char h1[NI_MAXHOST], h2[NI_MAXHOST]; + + if (raddr->sa_family == AF_INET6) { + sin6 = (struct sockaddr_in6 *)raddr; + if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + memcpy(&sin.sin_addr, &sin6->sin6_addr.s6_addr[12], + sizeof(sin.sin_addr)); + raddr = (struct sockaddr *)&sin; + salen = sizeof(struct sockaddr_in); + } + } + + h1[0] = '\0'; + if (getnameinfo(raddr, salen, h1, sizeof(h1), NULL, 0, + NI_NUMERICHOST | NI_WITHSCOPEID) != 0) + return (0); + + /* Resolve laddr into sockaddr */ + memset(&hints, 0, sizeof(hints)); + hints.ai_family = raddr->sa_family; + hints.ai_socktype = SOCK_DGRAM; /*XXX dummy*/ + res = NULL; + error = getaddrinfo(lhost, "0", &hints, &res); + if (error) + return (0); + + for (r = res; r ; r = r->ai_next) { + h2[0] = '\0'; + if (getnameinfo(r->ai_addr, r->ai_addrlen, h2, sizeof(h2), + NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) != 0) + continue; + if (strcmp(h1, h2) == 0) { + freeaddrinfo(res); + return (1); + } + } + + /* No match. */ + freeaddrinfo(res); + return (0); +} diff --git a/newlib/libc/sys/linux/net/rcmdsh.3 b/newlib/libc/sys/linux/net/rcmdsh.3 new file mode 100644 index 000000000..43e6a8daa --- /dev/null +++ b/newlib/libc/sys/linux/net/rcmdsh.3 @@ -0,0 +1,116 @@ +.\" $OpenBSD: rcmdsh.3,v 1.6 1999/07/05 04:41:00 aaron Exp $ +.\" +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/lib/libc/net/rcmdsh.3,v 1.2 2001/11/09 15:19:25 ru Exp $ +.\" +.Dd September 1, 1996 +.Dt RCMDSH 3 +.Os +.Sh NAME +.Nm rcmdsh +.Nd return a stream to a remote command without superuser +.Sh SYNOPSIS +.In unistd.h +.Ft int +.Fo rcmdsh +.Fa "char **ahost" +.Fa "int inport" +.Fa "const char *locuser" +.Fa "const char *remuser" +.Fa "const char *cmd" +.Fa "const char *rshprog" +.Fc +.Sh DESCRIPTION +The +.Fn rcmdsh +function +is used by normal users to execute a command on +a remote machine using an authentication scheme based +on reserved port numbers using +.Xr rshd 8 +or the value of +.Fa rshprog +(if +.No non- Ns Dv NULL ) . +.Pp +The +.Fn rcmdsh +function +looks up the host +.Fa *ahost +using +.Xr gethostbyname 3 , +returning \-1 if the host does not exist. +Otherwise +.Fa *ahost +is set to the standard name of the host +and a connection is established to a server +residing at the well-known Internet port +.Dq Li shell/tcp +(or whatever port is used by +.Fa rshprog ) . +The parameter +.Fa inport +is ignored; it is only included to provide an interface similar to +.Xr rcmd 3 . +.Pp +If the connection succeeds, +a socket in the +.Ux +domain of type +.Dv SOCK_STREAM +is returned to the caller, and given to the remote +command as stdin, stdout, and stderr. +.Sh RETURN VALUES +The +.Fn rcmdsh +function +returns a valid socket descriptor on success. +Otherwise, \-1 is returned +and a diagnostic message is printed on the standard error. +.Sh SEE ALSO +.Xr rsh 1 , +.Xr socketpair 2 , +.Xr rcmd 3 , +.Xr rshd 8 +.Sh BUGS +If +.Xr rsh 1 +encounters an error, a file descriptor is still returned instead of \-1. +.Sh HISTORY +The +.Fn rcmdsh +function first appeared in +.Ox 2.0 , +and made its way into +.Fx 5.0 . diff --git a/newlib/libc/sys/linux/net/rcmdsh.c b/newlib/libc/sys/linux/net/rcmdsh.c new file mode 100644 index 000000000..741814c11 --- /dev/null +++ b/newlib/libc/sys/linux/net/rcmdsh.c @@ -0,0 +1,169 @@ +/* $OpenBSD: rcmdsh.c,v 1.5 1998/04/25 16:23:58 millert Exp $ */ + +/* + * Copyright (c) 2001, MagniComp + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the MagniComp nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This is an rcmd() replacement originally by + * Chris Siebenmann . + */ + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifndef _PATH_RSH +#define _PATH_RSH "/usr/bin/rsh" +#endif + +/* + * This is a replacement rcmd() function that uses the rsh(1) + * program in place of a direct rcmd(3) function call so as to + * avoid having to be root. Note that rport is ignored. + */ +int +rcmdsh(ahost, rport, locuser, remuser, cmd, rshprog) + char **ahost; + int rport; + const char *locuser, *remuser, *cmd, *rshprog; +{ + struct addrinfo hints, *res; + int cpid, sp[2], error; + char *p; + struct passwd *pw; + char num[8]; + static char hbuf[NI_MAXHOST]; + + /* What rsh/shell to use. */ + if (rshprog == NULL) + rshprog = _PATH_RSH; + + /* locuser must exist on this host. */ + if ((pw = getpwnam(locuser)) == NULL) { + (void)fprintf(stderr, "rcmdsh: unknown user: %s\n", locuser); + return (-1); + } + + /* Validate remote hostname. */ + if (strcmp(*ahost, "localhost") != 0) { + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + (void)snprintf(num, sizeof(num), "%d", ntohs(rport)); + error = getaddrinfo(*ahost, num, &hints, &res); + if (error) { + fprintf(stderr, "rcmdsh: getaddrinfo: %s\n", + gai_strerror(error)); + return (-1); + } + if (res->ai_canonname) { + strncpy(hbuf, res->ai_canonname, sizeof(hbuf) - 1); + hbuf[sizeof(hbuf) - 1] = '\0'; + *ahost = hbuf; + } + freeaddrinfo(res); + } + + /* Get a socketpair we'll use for stdin and stdout. */ + if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) == -1) { + perror("rcmdsh: socketpair"); + return (-1); + } + + cpid = fork(); + if (cpid == -1) { + perror("rcmdsh: fork failed"); + return (-1); + } else if (cpid == 0) { + /* + * Child. We use sp[1] to be stdin/stdout, and close sp[0]. + */ + (void)close(sp[0]); + if (dup2(sp[1], 0) == -1 || dup2(0, 1) == -1) { + perror("rcmdsh: dup2 failed"); + _exit(255); + } + /* Fork again to lose parent. */ + cpid = fork(); + if (cpid == -1) { + perror("rcmdsh: fork to lose parent failed"); + _exit(255); + } + if (cpid > 0) + _exit(0); + + /* In grandchild here. Become local user for rshprog. */ + if (setuid(pw->pw_uid) == -1) { + (void)fprintf(stderr, "rcmdsh: setuid(%u): %s\n", + pw->pw_uid, strerror(errno)); + _exit(255); + } + + /* + * If remote host is "localhost" and local and remote users + * are the same, avoid running remote shell for efficiency. + */ + if (strcmp(*ahost, "localhost") == 0 && + strcmp(locuser, remuser) == 0) { + if (pw->pw_shell[0] == '\0') + rshprog = _PATH_BSHELL; + else + rshprog = pw->pw_shell; + p = strrchr(rshprog, '/'); + execlp(rshprog, p ? p + 1 : rshprog, "-c", cmd, + (char *)NULL); + } else { + p = strrchr(rshprog, '/'); + execlp(rshprog, p ? p + 1 : rshprog, *ahost, "-l", + remuser, cmd, (char *)NULL); + } + (void)fprintf(stderr, "rcmdsh: execlp %s failed: %s\n", + rshprog, strerror(errno)); + _exit(255); + } else { + /* Parent. close sp[1], return sp[0]. */ + (void)close(sp[1]); + /* Reap child. */ + (void)wait(NULL); + return (sp[0]); + } + /* NOTREACHED */ +} diff --git a/newlib/libc/sys/linux/net/recv.c b/newlib/libc/sys/linux/net/recv.c new file mode 100644 index 000000000..43e537bbb --- /dev/null +++ b/newlib/libc/sys/linux/net/recv.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)recv.c 8.2 (Berkeley) 2/21/94"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include "namespace.h" +#include +#include + +#include +#include "un-namespace.h" + +ssize_t +recv(s, buf, len, flags) + int s, flags; + size_t len; + void *buf; +{ + return (recvfrom(s, buf, len, flags, NULL, 0)); +} diff --git a/newlib/libc/sys/linux/net/res_comp.c b/newlib/libc/sys/linux/net/res_comp.c new file mode 100644 index 000000000..12ea02c6d --- /dev/null +++ b/newlib/libc/sys/linux/net/res_comp.c @@ -0,0 +1,268 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; +static char orig_rcsid[] = "From: Id: res_comp.c,v 8.11 1997/05/21 19:31:04 halley Exp $"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BIND_4_COMPAT + +/* + * Expand compressed domain name 'comp_dn' to full domain name. + * 'msg' is a pointer to the begining of the message, + * 'eomorig' points to the first location after the message, + * 'exp_dn' is a pointer to a buffer of size 'length' for the result. + * Return size of compressed name or -1 if there was an error. + */ +int +dn_expand(const u_char *msg, const u_char *eom, const u_char *src, + char *dst, int dstsiz) +{ + int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz); + + if (n > 0 && dst[0] == '.') + dst[0] = '\0'; + return (n); +} + +/* + * Pack domain name 'exp_dn' in presentation form into 'comp_dn'. + * Return the size of the compressed name or -1. + * 'length' is the size of the array pointed to by 'comp_dn'. + */ +int +dn_comp(const char *src, u_char *dst, int dstsiz, + u_char **dnptrs, u_char **lastdnptr) +{ + return (ns_name_compress(src, dst, (size_t)dstsiz, + (const u_char **)dnptrs, + (const u_char **)lastdnptr)); +} + +/* + * Skip over a compressed domain name. Return the size or -1. + */ +int +dn_skipname(const u_char *ptr, const u_char *eom) { + const u_char *saveptr = ptr; + + if (ns_name_skip(&ptr, eom) == -1) + return (-1); + return (ptr - saveptr); +} + +/* + * Verify that a domain name uses an acceptable character set. + */ + +/* + * Note the conspicuous absence of ctype macros in these definitions. On + * non-ASCII hosts, we can't depend on string literals or ctype macros to + * tell us anything about network-format data. The rest of the BIND system + * is not careful about this, but for some reason, we're doing it right here. + */ +#define PERIOD 0x2e +#define hyphenchar(c) ((c) == 0x2d) +#define bslashchar(c) ((c) == 0x5c) +#define periodchar(c) ((c) == PERIOD) +#define asterchar(c) ((c) == 0x2a) +#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \ + || ((c) >= 0x61 && (c) <= 0x7a)) +#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) + +#define borderchar(c) (alphachar(c) || digitchar(c)) +#define middlechar(c) (borderchar(c) || hyphenchar(c)) +#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) + +int +res_hnok(dn) + const char *dn; +{ + int ppch = '\0', pch = PERIOD, ch = *dn++; + + while (ch != '\0') { + int nch = *dn++; + + if (periodchar(ch)) { + (void)NULL; + } else if (periodchar(pch)) { + if (!borderchar(ch)) + return (0); + } else if (periodchar(nch) || nch == '\0') { + if (!borderchar(ch)) + return (0); + } else { + if (!middlechar(ch)) + return (0); + } + ppch = pch, pch = ch, ch = nch; + } + return (1); +} + +/* + * hostname-like (A, MX, WKS) owners can have "*" as their first label + * but must otherwise be as a host name. + */ +int +res_ownok(dn) + const char *dn; +{ + if (asterchar(dn[0])) { + if (periodchar(dn[1])) + return (res_hnok(dn+2)); + if (dn[1] == '\0') + return (1); + } + return (res_hnok(dn)); +} + +/* + * SOA RNAMEs and RP RNAMEs can have any printable character in their first + * label, but the rest of the name has to look like a host name. + */ +int +res_mailok(dn) + const char *dn; +{ + int ch, escaped = 0; + + /* "." is a valid missing representation */ + if (*dn == '\0') + return (1); + + /* otherwise